Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.25 KB | None | 0 0
  1. (function() {
  2. var google = 'https://pokemondb.net/pokedex/',
  3. reGetUrl = new RegExp(/(\[Legendary\]\s)?(.*)\s=(.*)=.*/),
  4. reGetTitle = new RegExp(/(\[Legendary\]\s)?(.*)\s=(.*)=.*/),
  5. responses = {
  6. attack: 1,
  7. fight: 1,
  8. miss: 1,
  9. bosses: 1
  10. },
  11. totalWaifus = 0,
  12. navigatorImg = $.lang.get('waifugames.alert.navigator');
  13.  
  14. //load();
  15.  
  16. /*
  17. * @function load
  18. * @info Loads everything needed for this script to work. Add functions that need loading at startup in here.
  19. */
  20. function load() {
  21. loadWaifus();
  22. pushWaifus();
  23. loadResponses();
  24. }
  25.  
  26. /*
  27. * @function loadWaifus
  28. * @info Gets a count of all the waifus and stores it in a variable. It will also generate a txt file with all the waifus.
  29. */
  30. function loadWaifus() {
  31. var string = '',
  32. i = 0;
  33.  
  34. while ($.lang.exists('pwaifugames.waifu.' + i)) {
  35. string += 'Pokemon #' + i + ' ' + replace($.lang.get('pwaifugames.waifu.' + i)) + '\r\n';
  36. ++i;
  37. }
  38. totalWaifus = i;
  39. }
  40.  
  41. /*
  42. * @function pushWaifus
  43. * @info Pushes the entire waifu list to the db, it does disable auto commit first to make this process a lot faster.
  44. */
  45. function pushWaifus() {
  46. var i = 1;
  47.  
  48. $.inidb.setAutoCommit(false);
  49. while ($.lang.exists('pwaifugames.waifu.' + i)) {
  50. if (!$.inidb.exists('pokemonlist', i)) { // This will make setting pokemons faster since it does not need to write prokemons that are already on the disk.
  51. $.inidb.set('pokemonlist', i, $.lang.get('pwaifugames.waifu.' + i));
  52. }
  53. ++i;
  54. }
  55. $.inidb.setAutoCommit(true);
  56. }
  57.  
  58. /*
  59. * @function loadResponses
  60. * Gets a count of all of the game responses and saves them in an object to be used later.
  61. */
  62. function loadResponses() {
  63. while ($.lang.exists('pwaifugames.attack.' + responses.attack)) {
  64. ++responses.attack;
  65. }
  66.  
  67. while ($.lang.exists('pwaifugames.fight.' + responses.fight)) {
  68. ++responses.fight;
  69. }
  70.  
  71. while ($.lang.exists('pwaifugames.catchmiss.' + responses.miss)) {
  72. ++responses.miss;
  73. }
  74.  
  75. while ($.lang.exists('pwaifugames.bosses.' + responses.bosses)) {
  76. ++responses.bosses;
  77. }
  78. }
  79.  
  80. /*
  81. * @function getWaifuByName
  82. * @info Gets the waifu string by searching for its name in the db.
  83. *
  84. * @param {String} name
  85. * @return {String} waifu name; will return "" if the waifu does not exist.
  86. */
  87. function getWaifuByName(name) {
  88. var results = $.inidb.searchByValue('pokemonlist', name)[0];
  89.  
  90. return (results === undefined ? '' : $.lang.get('pwaifugames.waifu.' + results));
  91. }
  92.  
  93. /*
  94. * @function getWaifuById
  95. * @info Gets the waifu string by searching for its id
  96. *
  97. * @param {Number} id
  98. * @return {String} waifu name; will return "" if the waifu does not exist.
  99. */
  100. function getWaifuById(id) {
  101. return ($.lang.exists('pwaifugames.waifu.' + id) ? $.lang.get('pwaifugames.waifu.' + id) : '');
  102. }
  103.  
  104. /*
  105. * @function getWaifu
  106. * @info Gets the waifu string by either searching for its name, or by its id.
  107. *
  108. * @param {Number|String} waifu
  109. * @return {String} waifu name; will return "" if the waifu does not exist.
  110. */
  111. function getWaifu(waifu) {
  112. return (isNaN(parseInt(waifu)) ? getWaifuByName(waifu) : getWaifuById(waifu));
  113. }
  114.  
  115. /*
  116. * @function waifuExists
  117. * @info Checks if a waifu exist
  118. *
  119. * @param {Number|String} waifu
  120. * @return {Boolean}
  121. */
  122. function waifuExists(waifu) {
  123. return (isNaN(parseInt(waifu)) ? (getWaifuByName(waifu) !== '') : (getWaifuById(waifu) !== ''));
  124. }
  125.  
  126. /*
  127. * @function getWaifuIdByName
  128. * @info Gets the waifu id by its name.
  129. *
  130. * @param {String} name
  131. * @return {Number} waifu id; will return 0 if it does not exist.
  132. */
  133. function getWaifuIdByName(name) {
  134. var results = $.inidb.searchByValue('pokemonlist', name)[0];
  135.  
  136. return (results === undefined ? 0 : results);
  137. }
  138.  
  139. /*
  140. * @function getWaifuId
  141. * @info Gets the waifu id by its name or id
  142. *
  143. * @param {String} name
  144. * @return {Number} waifu id; will return 0 if it does not exist.
  145. */
  146. function getWaifuId(name) {
  147. return (isNaN(parseInt(name)) ? getWaifuIdByName(name) : name);
  148. }
  149.  
  150. /*
  151. * @function hasWaifu
  152. * @info Used to check if a user has a specific waifu.
  153. *
  154. * @param {String} username
  155. * @param {Number|String} id or waifu name; warning the name might not be accurate.
  156. * @return {Boolean}
  157. */
  158. function hasWaifu(username, id) {
  159. return (isNaN(parseInt(id)) ? $.inidb.HasKey(username, 'pokemon', getWaifuIdByName(id)) : $.inidb.HasKey(username, 'pokemon', id));
  160. }
  161.  
  162. /*
  163. * @function getTotalUserWaifus
  164. * @info Used to get the amount of waifus a user has.
  165. *
  166. * @param {String} username
  167. * @return {Number} total amount of waifus the user has; can be 0
  168. */
  169. function getTotalUserWaifus(username) {
  170. return $.inidb.GetKeyList(username, 'pokemon').length;
  171. }
  172.  
  173. /*
  174. * @function getUserWaifuCount
  175. * @info Used to get the amount of waifus a user has with that id
  176. *
  177. * @param {String} username
  178. * @param {Number} id
  179. * @return {Number} total amount of waifus that user has with that id; can be 0
  180. */
  181. function getUserWaifuCount(username, id) {
  182. return ($.inidb.HasKey(username, 'pokemon', getWaifuId(id)) ? $.inidb.GetInteger(username, 'pokemon', getWaifuId(id)) : 0);
  183. }
  184.  
  185. /*
  186. * @function getWins
  187. * @info Used to get the amount of Wins
  188. *
  189. * @param {String} username
  190. */
  191. function getWins(username) {
  192. return ($.inidb.exists(username, 'pWins') ? $.inidb.get(username, 'pWins') : 0);
  193. }
  194.  
  195. /*
  196. * @function getLosses
  197. * @info Used to get the amount of Losses
  198. *
  199. * @param {String} username
  200. */
  201. function getLosses(username) {
  202. return ($.inidb.exists(username, 'pLosses') ? $.inidb.get(username, 'pLosses') : 0);
  203. }
  204.  
  205. /*
  206. * @function getCandy
  207. * @info Used to get the amount of candy
  208. *
  209. * @param {String} username
  210. * @return {Number} total amount of candy that user has; can be 0
  211. */
  212. function getCandy(username) {
  213. return ($.inidb.exists(username, 'pcandy') ? $.inidb.get(username, 'pcandy') : 0);
  214. }
  215.  
  216. /*
  217. * @function getEXP
  218. * @info Used to get the amount of EXP a waifu has
  219. *
  220. * @param {String} username
  221. * @param {Number} id
  222. * @return {Number} total amount of EXP that waifu has; can be 0
  223. */
  224. function getEXP(username, id) {
  225. return ($.inidb.HasKey(username, 'pEXP', id) ? $.inidb.GetInteger(username, 'pEXP', id) : 0);
  226. }
  227.  
  228. /*
  229. * @function getLevel
  230. * @param id
  231. * @return gets waifu level
  232. */
  233. function getLevel(username, id) {
  234. if (getEXP(username, id) <= 0) {
  235. return 1;
  236. }
  237.  
  238. if (getEXP(username, id) >= 120000) {
  239. return 100;
  240. }
  241.  
  242. return Math.round((Math.sqrt(getEXP(username, id) / 12)));
  243. }
  244.  
  245. /*
  246. * @function getHitPoints
  247. * @param id
  248. * @return gets the hitpoints of a waifu in the user's harem
  249. */
  250. function getHitPoints(username, id) {
  251. if ($.inidb.GetInteger(username, 'pHitPoints', id) <= 0) {
  252. return 0;
  253. } else {
  254. return ($.inidb.HasKey(username, 'pHitPoints', id) ? ($.inidb.GetInteger(username, 'pHitPoints', id) >= 2500 ? 2500 : $.inidb.GetInteger(username, 'pHitPoints', id)) : 0);
  255. }
  256. }
  257.  
  258. /*
  259. * @function getAttack
  260. * @param id
  261. * @return gets the attack of a waifu in the user's harem
  262. */
  263. function getAttack(username, id) {
  264. return ($.inidb.HasKey(username, 'pAttack', id) ? $.inidb.GetInteger(username, 'pAttack', id) : 0);
  265. }
  266.  
  267. /*
  268. * @function getDefense
  269. * @param id
  270. * @return gets the defense of a waifu in the user's harem
  271. */
  272. function getDefense(username, id) {
  273. return ($.inidb.HasKey(username, 'pDefense', id) ? $.inidb.GetInteger(username, 'pDefense', id) : 0);
  274. }
  275.  
  276. /*
  277. * @function getLove
  278. * @param id
  279. * @return gets the Love of a waifu in the user's harem
  280. */
  281. function getLove(username, id) {
  282. return ($.inidb.HasKey(username, 'pLove', id) ? ($.inidb.GetInteger(username, 'pLove', id) >= 100 ? 100 : $.inidb.GetInteger(username, 'pLove', id)) : 0);
  283. }
  284.  
  285. /*
  286. * @function getLewd
  287. * @param id
  288. * @return gets the lewdness of a waifu in the user's harem
  289. */
  290. function getLewd(username, id) {
  291. return ($.inidb.HasKey(username, 'pLewdness', id) ? $.inidb.GetInteger(username, 'pLewdness', id) : 0);
  292. }
  293.  
  294. /*
  295. * @function getRandomHaremIdFromUser
  296. * @info Will return a random harem id from that users harem list, can be 0 if he does not have any.
  297. *
  298. * @return {Number} harem id.
  299. */
  300. function getRandomHaremIdFromUser(username) {
  301. var keys = $.inidb.GetKeyList(username, 'pharem'),
  302. temp = [];
  303.  
  304. for (var i = 0; i < keys.length; i++) {
  305. temp.push(keys[i]);
  306. }
  307. if (temp.length > 0) {
  308. return $.randElement(temp);
  309. } else {
  310. return 0;
  311. }
  312. }
  313.  
  314. /*
  315. * @function getRandomOwnedIdFromUser
  316. * @info Will return a random Waifu id from that users waifu list, can be 0 if he does not have any.
  317. *
  318. * @return {Number} harem id.
  319. */
  320. function getRandomOwnedIdFromUser(username) {
  321. var keys = $.inidb.GetKeyList(username, 'pokemon'),
  322. temp = [];
  323.  
  324. for (var i = 0; i < keys.length; i++) {
  325. temp.push(keys[i]);
  326. }
  327. if (temp.length > 0) {
  328. return $.randElement(temp);
  329. } else {
  330. return 0;
  331. }
  332. }
  333.  
  334. /*
  335. * @function getRandomHaremNameFromUser
  336. * @info Will return a random harem name from that users harem list, can be '' if he does not have any.
  337. *
  338. * @return {String} harem name.
  339. */
  340. function getRandomHaremNameFromUser(username) {
  341. var keys = $.inidb.GetKeyList(username, 'pharem'),
  342. temp = [];
  343.  
  344. for (var i = 0; i < keys.length; i++) {
  345. temp.push($.inidb.GetString(username, 'pharem', keys[i]));
  346. }
  347.  
  348. if (temp.length > 0) {
  349. return $.randElement(temp);
  350. } else {
  351. return '';
  352. }
  353. }
  354.  
  355. /*
  356. * @function isMarried
  357. * @info Checks if a user is married
  358. *
  359. * return {Boolean}
  360. */
  361. function isMarried(username) {
  362. return $.inidb.exists(username, 'pmarried');
  363. }
  364.  
  365. /*
  366. * @function getMarried
  367. * @info Pulls married waifu id
  368. *
  369. * return {Boolean}
  370. */
  371. function getMarried(username) {
  372. return ($.inidb.exists(username, 'pmarried') ? $.inidb.get(username, 'pmarried') : 0);
  373. }
  374.  
  375. /*
  376. * @function hasHarem
  377. * @info Used to check if a user has a specific harem.
  378. *
  379. * @param {String} username
  380. * @param {Number|String} id or waifu name; warning the name might not be accurate.
  381. * @return {Boolean}
  382. */
  383. function hasHarem(username, id) {
  384. return (isNaN(parseInt(id)) ? $.inidb.HasKey(username, 'pharem', getWaifuIdByName(id)) : $.inidb.HasKey(username, 'pharem', id));
  385. }
  386.  
  387. /*
  388. * @function getHarem
  389. * @info Gets a harem from a user.
  390. *
  391. * @param {Number|String} waifu
  392. * @return {String} harem name; will return "" if the user does not own that harem
  393. */
  394. function getHarem(username, waifu) {
  395. return ($.inidb.HasKey(username, 'pharem', getWaifuId(waifu)) ? $.inidb.GetString(username, 'pharem', getWaifuId(waifu)) : '');
  396. }
  397.  
  398. /*
  399. * @function getTotalUserHarems
  400. * @info Used to get the amount of harems a user has.
  401. *
  402. * @param {String} username
  403. * @return {Number} total amount of waifus the user has; can be 0
  404. */
  405. function getTotalUserHarems(username) {
  406. return ($.inidb.GetKeyList(username, 'pharem').length !== 0 ? $.inidb.GetKeyList(username, 'pharem').length : 0);
  407. }
  408.  
  409. /*
  410. * @function getReward
  411. * @info Retrieve reward data
  412. *
  413. * @param {String} reward
  414. */
  415. function getReward(reward) {
  416. return ($.inidb.exists('psettings', 'pReward') ? $.inidb.get('psettings', 'pReward') : 100);
  417. }
  418.  
  419. /*
  420. * @function getFReward
  421. * @info Retrieve reward data
  422. *
  423. * @param {String} reward
  424. */
  425. function getFReward(reward) {
  426. return ($.inidb.exists('psettings', 'pFReward') ? $.inidb.get('psettings', 'pFReward') : 25);
  427. }
  428.  
  429. /*
  430. * @function getFReward
  431. * @info Retrieve reward data
  432. *
  433. * @param {String} reward
  434. */
  435. function getBReward(reward) {
  436. return ($.inidb.exists('settings', 'pBReward') ? $.inidb.get('settings', 'pBReward') : 10000);
  437. }
  438.  
  439. /*
  440. * @function replace
  441. *
  442. * @param {String} str
  443. * @return {String}
  444. */
  445. function replace(str) {
  446. return str.replace(/=/, '(').replace('[Legendary]', '').replace(/=/g, ')');
  447. }
  448.  
  449. /*
  450. * @function url
  451. *
  452. * @param {String} str
  453. * @return {String}
  454. */
  455. function url(str) {
  456. return str.replace('\'', '%27');
  457. }
  458.  
  459. /*
  460. * @function updateBattleStats
  461. * @info Used to update a users stats after a battle
  462. *
  463. * @param {String} username
  464. * @param {Array} array
  465. * @param {Number} id
  466. * @param {Boolean} isDecr
  467. */
  468. function updateBattleStats(username, array, id, isDecr) {
  469. var rnd;
  470.  
  471. $.inidb.setAutoCommit(false);
  472. for (var i = 0; i < array.length; i++) {
  473. rnd = $.randRange(0, 1);
  474. if (isDecr === false) {
  475. $.inidb.incr(username, array[i], getWaifuId(id), rnd);
  476. } else {
  477. if ($.inidb.GetInteger(username, array[i], getWaifuId(id)) > 0) {
  478. $.inidb.decr(username, array[i], getWaifuId(id), rnd);
  479. }
  480. }
  481. }
  482. $.inidb.incr(username, 'pharem', getWaifuId(id), 5);
  483. $.inidb.setAutoCommit(true);
  484. }
  485.  
  486. function rareChance() {
  487. var toggle = $.inidb.exists('psettings', 'rChance') ? $.inidb.get('psettings', 'rChance') : 'false';
  488.  
  489. if (toggle == 'false') {
  490. $.say($.lang.get('pwaifugames.rare.chance'));
  491. $.panelsocketserver.alertImage($.lang.get('pwaifugames.alert.rarechance') + ',4');
  492. $.inidb.set('psettings', 'rChance', 'true');
  493. } else {
  494. $.say($.lang.get('pwaifugames.rare.over'));
  495. $.inidb.set('psettings', 'rChance', 'false');
  496. }
  497. }
  498.  
  499. /*
  500. * function catchWaifu
  501. * @info Used to catch random waifus.
  502. *
  503. * @param {String} username
  504. */
  505. function catchWaifu(username) {
  506. var id = $.randRange(1, 802),
  507. missR = $.randRange(1, responses.miss - 1),
  508. unlock = $.randRange(1, 2),
  509. chance = $.randRange(1, 5),
  510. rarechance = $.randRange(4, 25),
  511. reward = getReward(),
  512. waifu = getWaifu(id),
  513. link = (google + url(waifu)),
  514. candy = '',
  515. candy2 = '',
  516. candyDrop = $.randRange(1, 2);
  517. rare = '';
  518.  
  519.  
  520. if (chance >= 4 && candyDrop > 1) {
  521. $.inidb.incr(username, 'pcandy', 1);
  522. candy = $.lang.get('pwaifugames.candy.dropped');
  523. candy2 = $.lang.get('pwaifugames.candy.dropped2');
  524. }
  525.  
  526. if ($.inidb.get('settings', 'rChance') == 'true') {
  527. rarechance = $.randRange(18, 20);
  528. }
  529.  
  530. if (waifu.includes('[Legendary]')) {
  531. if (rarechance >= 20) {
  532. rare = ('/me Legendary! +' + $.getPointsString(reward) + ' ');
  533. $.panelsocketserver.alertImage(navigatorImg + ',5');
  534. $.inidb.incr('points', username, reward);
  535. } else {
  536. $.say($.lang.get('pwaifugames.catchmiss.' + missR, $.userPrefix(username, true), replace(waifu), id, candy2));
  537. return;
  538. }
  539. }
  540.  
  541. if (chance <= 4) {
  542. if (hasWaifu(username, id)) {
  543. $.inidb.incr(username, 'pokemon', id, unlock);
  544. $.say($.lang.get('pwaifugames.catch.own', rare + $.userPrefix(username, true), unlock, replace(waifu), id, $.shortenURL.getShortURL(link) + candy));
  545. } else {
  546. $.inidb.SetInteger(username, 'pokemon', id, unlock);
  547. $.say($.lang.get('pwaifugames.catch.new', rare + $.userPrefix(username, true), unlock, replace(waifu), id, $.shortenURL.getShortURL(link) + candy));
  548. }
  549. } else {
  550. $.say($.lang.get('pwaifugames.catchmiss.' + missR, $.userPrefix(username, true), replace(waifu), id, candy2));
  551. return;
  552. }
  553. }
  554.  
  555. /*
  556. * function randomWaifu
  557. * @info Used to get a random waifu.
  558. *
  559. * @param {String} username
  560. */
  561. function randomWaifu(username) {
  562. var id = $.randRange(1, 802),
  563. waifu = getWaifu(id),
  564. link = (google + url(waifu));
  565.  
  566. if (getTotalUserWaifus(username) === 0) {
  567. $.say($.lang.get('pwaifugames.random.0', $.whisperPrefix(username)));
  568. } else {
  569. if (!isMarried(username)) {
  570. $.say($.lang.get('pwaifugames.random.success', $.userPrefix(username, true), replace(waifu), id, $.shortenURL.getShortURL(link)));
  571. } else {
  572. id = getWaifuId(getMarried(username));
  573. link = (google + url(getWaifu(id)));
  574. $.say($.lang.get('pwaifugames.random.married', $.userPrefix(username, true), replace(getWaifu(id)), id, getHitPoints(username, id), getLevel(username, id), getAttack(username, id), getDefense(username, id), getLove(username, id), $.shortenURL.getShortURL(link)));
  575. }
  576. }
  577. }
  578.  
  579. /*
  580. * function sendWaifu
  581. * @info Used to send someone a waifu.
  582. *
  583. * @param {String} username
  584. * @param {String} receiver
  585. * @param {Number} id
  586. */
  587. function sendWaifu(username, receiver, id) {
  588. if (!waifuExists(id)) {
  589. $.say($.lang.get('pwaifugames.exist.404', $.whisperPrefix(username)));
  590. return;
  591. }
  592.  
  593. id = getWaifuId(id);
  594.  
  595. var waifu = getWaifu(id),
  596. link = (google + url(waifu));
  597.  
  598. if (getUserWaifuCount(username, id) > 0) {
  599. $.say($.lang.get('pwaifugames.giftwaifu.success', $.userPrefix(username, true), replace(waifu), $.userPrefix(receiver, false), $.shortenURL.getShortURL(link)));
  600. $.inidb.incr(receiver.toLowerCase(), 'pokemon', id, 1);
  601. if (getEXP(username, id) > getEXP(receiver.toLowerCase(), id)) {
  602. $.inidb.SetString(receiver.toLowerCase(), 'pEXP', getWaifuId(id), getEXP(username, getWaifuId(id)));
  603. $.inidb.SetString(receiver.toLowerCase(), 'pHitPoints', getWaifuId(id), getHitPoints(username, getWaifuId(id)));
  604. $.inidb.SetString(receiver.toLowerCase(), 'pAttack', getWaifuId(id), getAttack(username, getWaifuId(id)));
  605. $.inidb.SetString(receiver.toLowerCase(), 'pDefense', getWaifuId(id), getDefense(username, getWaifuId(id)));
  606. }
  607. $.inidb.decr(username, 'pokemon', id, 1);
  608. } else {
  609. $.say($.lang.get('pwaifugames.giftwaifu.404', $.userPrefix(username, true)));
  610. }
  611. }
  612.  
  613. /*
  614. * function sendCandy
  615. * @info Used to send someone candy.
  616. *
  617. * @param {String} username
  618. * @param {String} receiver
  619. * @param {Number} candy amount
  620. */
  621. function sendCandy(username, receiver, amount) {
  622. var candy = $.inidb.get(username, 'pcandy');
  623.  
  624. if (candy >= amount) {
  625. $.say($.lang.get('pwaifugames.giftcandy.success', $.userPrefix(username, true), $.userPrefix(receiver, false), amount));
  626. $.inidb.incr(receiver.toLowerCase(), 'pcandy', amount);
  627. $.inidb.decr(username, 'pcandy', amount);
  628. } else {
  629. $.say($.lang.get('pwaifugames.candy.nostock', $.userPrefix(username, true)));
  630. return;
  631. }
  632. }
  633.  
  634. /*
  635. * @function waifuProfile
  636. * @info Used to get your current profile of waifus.
  637. */
  638. function waifuProfile(username) {
  639. $.say($.lang.get('pwaifugames.profile.success', $.whisperPrefix(username), getTotalUserWaifus(username), totalWaifus, getCandy(username), Math.floor((getTotalUserWaifus(username) / totalWaifus) * 100), getWins(username), getLosses(username)));
  640. }
  641.  
  642. /*
  643. * @function setWaifu
  644. * @info Used to set a waifu.
  645. *
  646. * @param {String} username
  647. * @param {Number} id
  648. */
  649. function setWaifu(username, id) {
  650. if (id === undefined) {
  651. $.say($.lang.get('pwaifugames.marry.null', $.whisperPrefix(username)));
  652. return;
  653. }
  654.  
  655. if (isMarried(username)) {
  656. $.say($.lang.get('pwaifugames.marry.already', $.whisperPrefix(username), replace(getWaifu(getMarried(username)))));
  657. return;
  658. }
  659.  
  660. if (!hasHarem(username, id)) {
  661. $.say($.lang.get('pwaifugames.harem.kick404'));
  662. return
  663. }
  664.  
  665. if (waifuExists(id) && hasWaifu(username, id)) {
  666. $.inidb.set(username, 'pmarried', getWaifuId(id));
  667. $.inidb.incr(username, 'pLove', getWaifuId(id), 50);
  668. $.inidb.incr(username, 'pLewdness', getWaifuId(id), 20);
  669. $.say($.lang.get('pwaifugames.marry.success', $.userPrefix(username, true), replace(getWaifu(id))));
  670.  
  671. } else {
  672. $.say($.lang.get('pwaifugames.exist.404', $.whisperPrefix(username)));
  673. }
  674. }
  675.  
  676. /*
  677. * @function resetWaifu
  678. * @info Removes married waifu.
  679. *
  680. * @param {String} username
  681. */
  682. function resetWaifu(username) {
  683. if (isMarried(username)) {
  684. $.say($.lang.get('pwaifugames.split.success', $.whisperPrefix(username), replace(getWaifu(getMarried(username)))));
  685. $.inidb.del(username, 'pmarried');
  686. $.inidb.decr(username, 'pLove', getMarried(username), 60);
  687. $.inidb.decr(username, 'pLewdness', getMarried(username), 20);
  688. } else {
  689. $.say($.lang.get('pwaifugames.split.404', $.whisperPrefix(username)));
  690. }
  691. }
  692.  
  693. /*
  694. * @function buyWaifu
  695. * @info Used to buy waifus
  696. *
  697. * @param {String} username
  698. * @param {Number} id
  699. */
  700. function buyWaifu(username, id) {
  701. if (!waifuExists(id)) {
  702. $.say($.lang.get('pwaifugames.exist.404', $.whisperPrefix(username)));
  703. $.inidb.incr('points', username, $.inidb.get('pricecom', 'buypokemon'));
  704. return;
  705. }
  706.  
  707. var waifu = getWaifu(id),
  708. link = (google + url(waifu));
  709.  
  710. $.inidb.incr(username, 'pokemon', getWaifuId(id), 1);
  711. $.say($.lang.get('pwaifugames.buywaifu.new', $.userPrefix(username, true), replace(waifu), getWaifuId(id), $.shortenURL.getShortURL(link)));
  712.  
  713. }
  714.  
  715. /*
  716. * @function buyCandy
  717. * @info Used to buy candy
  718. *
  719. * @param {Number} id
  720. */
  721. function buyCandy(sender, amount) {
  722. var price = $.inidb.get('pricecom', 'buycandy');
  723.  
  724. if (amount >= 1 && $.inidb.get('points', sender) >= price * amount) {
  725. $.inidb.incr(sender, 'pcandy', amount);
  726. $.inidb.decr('points', sender, ((price * amount) - price));
  727. $.say($.lang.get('pwaifugames.candy.buy', $.whisperPrefix(sender), amount, $.getPointsString(price * amount), getCandy(sender)));
  728. } else {
  729. amount = 1;
  730. $.inidb.incr(sender, 'pcandy', amount);
  731. $.say($.lang.get('pwaifugames.candy.buy', $.whisperPrefix(sender), amount, $.getPointsString(price), getCandy(sender)));
  732. }
  733.  
  734. }
  735.  
  736. /*
  737. * @function checkWaifu
  738. * @info Checks if a user owns that harem
  739. *
  740. * @param {String} username
  741. * @param {Number} id
  742. */
  743. function checkWaifu(sender, id) {
  744. if (!waifuExists(id)) {
  745. $.say($.lang.get('pwaifugames.exist.404', $.whisperPrefix(sender)));
  746. return;
  747. }
  748.  
  749. id = getWaifuId(id);
  750.  
  751. var waifu = getWaifu(id),
  752. link = (google + url(waifu)),
  753. stats = '';
  754.  
  755. if (hasHarem(sender, id)) {
  756. stats = $.lang.get('pwaifugames.checkwaifu.stats', getHitPoints(sender, id), getLevel(sender, id), getAttack(sender, id), getDefense(sender, id), getLove(sender, id));
  757. }
  758.  
  759. $.say($.lang.get('pwaifugames.checkwaifu.success', $.userPrefix(sender, true), getUserWaifuCount(sender, id), replace(getWaifu(id)), id, stats, $.shortenURL.getShortURL(link)));
  760. }
  761.  
  762. /*
  763. * @function releaseWaifu
  764. * @info USed to release a waifu
  765. *
  766. * @param {String} username
  767. * @param {Number|String} id
  768. */
  769. function releaseWaifu(username, id) {
  770.  
  771.  
  772. if ($.inidb.GetInteger(username, 'pharem', getWaifuId(id)) > 0) {
  773. $.say($.lang.get('pwaifugames.harem.release404', replace(getWaifu(id))));
  774. return;
  775. }
  776.  
  777. if ($.inidb.GetInteger(username, 'pokemon', getWaifuId(id)) >= 1) {
  778. $.inidb.decr(username, 'pokemon', getWaifuId(id), 1);
  779. $.inidb.RemoveKey(username, 'pEXP', getWaifuId(id));
  780. $.inidb.RemoveKey(username, 'pHitPoints', getWaifuId(id));
  781. $.inidb.RemoveKey(username, 'pAttack', getWaifuId(id));
  782. $.inidb.RemoveKey(username, 'pDefense', getWaifuId(id));
  783. $.inidb.RemoveKey(username, 'pLove', getWaifuId(id));
  784. $.inidb.RemoveKey(username, 'pLewdness', getWaifuId(id));
  785. $.say($.lang.get('pwaifugames.harem.release', replace(getWaifu(id))));
  786. } else {
  787. $.say($.lang.get('pwaifugames.harem.release404', replace(getWaifu(id))));
  788. return;
  789. }
  790. }
  791.  
  792. /*
  793. * @function addHarem
  794. * @info Adds a harem to that users list
  795. *
  796. * @param {String} username
  797. * @param {Number} id
  798. */
  799. function addHarem(username, id) {
  800. var hp = 100,
  801. atk = 1,
  802. def = 1,
  803. love = 1,
  804. lewd = 1;
  805.  
  806. if (!waifuExists(id)) {
  807. $.say($.lang.get('pwaifugames.exist.404', $.whisperPrefix(username)));
  808. return;
  809. }
  810.  
  811. if (hasHarem(username, id)) {
  812. $.say($.lang.get('pwaifugames.harem.repeat', $.whisperPrefix(username)));
  813. return;
  814. }
  815.  
  816. if (!hasWaifu(username, id)) {
  817. $.say($.lang.get('pwaifugames.harem.owned', $.whisperPrefix(username)));
  818. return;
  819. }
  820.  
  821. if (getTotalUserHarems(username) >= 6) {
  822. $.say($.lang.get('pwaifugames.harem.denied'));
  823. return;
  824. }
  825.  
  826. if (getWaifu(id).includes('[Legendary]')) {
  827. atk = $.randRange(1, 20), def = $.randRange(1, 20), love = $.randRange(1, 30), lewd = 10;
  828. }
  829.  
  830. $.inidb.SetString(username, 'pharem', getWaifuId(id), 1);
  831. $.say($.lang.get('pwaifugames.harem.success', $.userPrefix(username, true), replace(getWaifu(id))));
  832. }
  833.  
  834. /*
  835. * @function kickHarem
  836. * @info USed to kick a harem
  837. *
  838. * @param {String} username
  839. * @param {Number|String} id
  840. */
  841. function kickHarem(username, id) {
  842. if ($.inidb.get(username, 'pmarried') == getWaifuId(id)) {
  843. $.inidb.del(username, 'pmarried');
  844. }
  845.  
  846. if ($.inidb.GetInteger(username, 'pharem', getWaifuId(id)) == 1) {
  847. $.inidb.RemoveKey(username, 'pharem', getWaifuId(id));
  848. $.say($.lang.get('pwaifugames.harem.kick', replace(getWaifu(id))));
  849. } else {
  850. $.say($.lang.get('pwaifugames.harem.kick404', $.userPrefix(username, true)));
  851. }
  852. }
  853.  
  854. /*
  855. * @function getHarem
  856. * @info Used to get a harem
  857. *
  858. * @param {String} username
  859. */
  860. function getHarem(username) {
  861. var keys = $.inidb.GetKeyList(username, 'pharem'),
  862. array = [];
  863.  
  864. for (var i = 0; i < keys.length; i++) {
  865. array.push(replace($.lang.get('pwaifugames.waifu.' + keys[i])) + ' #' + keys[i]);
  866. }
  867.  
  868. if (array.length >= 1) {
  869. $.say($.lang.get('pwaifugames.harem.get', $.whisperPrefix(username), array.join(', ')));
  870. } else {
  871. $.say($.lang.get('pwaifugames.harem.404'));
  872. }
  873. }
  874.  
  875. /*
  876. * @function getCandy
  877. * @info USed to get candy amount
  878. *
  879. * @param {String} sender
  880. */
  881. function useCandy(username, amount, id) {
  882.  
  883. if (amount > getCandy(username)) {
  884. $.say($.lang.get('pwaifugames.candy.enough', $.whisperPrefix(username)));
  885. return;
  886. }
  887.  
  888. if (getCandy(username) < 1) {
  889. $.say($.lang.get('pwaifugames.candy.nostock', $.whisperPrefix(username)));
  890. return;
  891. }
  892.  
  893. if (!waifuExists(id)) {
  894. $.say($.lang.get('pwaifugames.exist.404', $.whisperPrefix(username)));
  895. return;
  896. }
  897.  
  898. if (!hasWaifu(username, id)) {
  899. $.say($.lang.get('waifugames.candy.missing', $.whisperPrefix(username)));
  900. return;
  901. }
  902.  
  903. if (getLevel(username, id) >= 100) {
  904. $.inidb.SetInteger(username, 'pHitPoints', id, 100);
  905. $.inidb.decr(username, 'pcandy', amount);
  906. $.say($.lang.get('pwaifugames.level.max', $.whisperPrefix(username), replace(getWaifu(id))));
  907. return;
  908. }
  909.  
  910. if ((100 * amount + getEXP(username, id)) > 120000) {
  911. $.say($.lang.get('pwaifugames.level.exceed', $.whisperPrefix(username), amount, replace(getWaifu(id))));
  912. return;
  913. }
  914.  
  915. $.inidb.SetInteger(username, 'pHitPoints', id, 100);
  916. $.inidb.incr(username, 'pEXP', id, (100 * amount));
  917. $.inidb.incr(username, 'pAttack', id, $.randRange(1, (1 + amount)));
  918. $.inidb.incr(username, 'pDefense', id, $.randRange(1, (1 + amount)));
  919. $.inidb.incr(username, 'pLove', id, $.randRange(1, (1 + amount)));
  920. $.inidb.incr(username, 'pLewdness', id, $.randRange(1, (1 + amount)));
  921. $.inidb.decr(username, 'pcandy', amount);
  922. $.say($.lang.get('pwaifugames.candy.use', $.whisperPrefix(username), replace(getWaifu(id)), (100 * amount), getEXP(username, id), getHitPoints(username, id), getLevel(username, id), getAttack(username, id), getDefense(username, id), getCandy(username, id)));
  923. }
  924.  
  925. function generateBoss(sender) {
  926. var bosses = $.randRange(1, responses.bosses - 1),
  927. bossHP = $.inidb.GetInteger('boss', 'pHitPoints', $.inidb.get('boss', 'id'));
  928.  
  929. if (bossHP <= 0) {
  930. $.inidb.set('boss', 'id', bosses);
  931. $.inidb.SetInteger('boss', 'pharem', bosses, 1);
  932. $.inidb.SetInteger('boss', 'pHitPoints', bosses, 2500);
  933. $.inidb.SetInteger('boss', 'pAttack', bosses, $.randRange(200,600));
  934. $.inidb.SetInteger('boss', 'pDefense', bosses, $.randRange(800,1000));
  935. $.inidb.SetInteger('boss', 'pLove', bosses, 100);
  936. }
  937. return bosses;
  938. }
  939.  
  940. function getBoss(sender, bosses) {
  941. if ($.inidb.GetInteger('boss', 'pHitPoints', $.inidb.get('boss', 'id')) > 0) {
  942. return $.lang.get('pwaifugames.bosses.' + $.inidb.get('boss', 'id'));
  943. } else {
  944. return $.lang.get('pwaifugames.bosses.' + generateBoss(sender));
  945. }
  946. }
  947. /*
  948. * @function battle
  949. * @param opponent
  950. * @return Battle with another waifu
  951. */
  952. function bossBattle(username, action) {
  953. var random1 = $.randRange(1, responses.attack - 1),
  954. random2 = $.randRange(1, responses.fight - 1),
  955. bosses = $.randRange(1, responses.bosses - 1),
  956. opponent = 'boss',
  957. id,
  958. id2 = getRandomHaremIdFromUser(opponent),
  959. waifu1,
  960. waifu2,
  961. player1 = $.userPrefix(username),
  962. player2 = opponent,
  963. attack = $.lang.get('pwaifugames.attack.' + random1),
  964. dmg,
  965. dmgRec,
  966. dmgMsg = '',
  967. winMsg = '';
  968.  
  969. if (action !== '') {
  970. id = getWaifuId(action);
  971. } else if (isMarried(username) && getHitPoints(username, getMarried(username)) > 1) {
  972. id = getMarried(username);
  973. } else {
  974. id = getRandomHaremIdFromUser(username);
  975. }
  976.  
  977.  
  978. waifu1 = getWaifu(id);
  979. waifu2 = getBoss(id2, generateBoss());
  980.  
  981. if (getTotalUserHarems(username) <= 0) {
  982. $.say($.lang.get('pwaifugames.harem.fight404'));
  983. return;
  984. }
  985.  
  986. if (getAttack(username, id) >= getDefense(opponent, id2)) {
  987. dmg = Math.floor($.randRange(getDefense(opponent, id2), getAttack(username, id)) / 2 - getDefense(opponent, id2) / 3);
  988. } else {
  989. dmg = Math.floor($.randRange(0, getAttack(username, id) / 6));
  990. }
  991.  
  992. if (getDefense(opponent, id2) >= getAttack(username, id)) {
  993. dmgRec = Math.floor($.randRange(getAttack(username, id), getDefense(opponent, id2)) / 2 - getAttack(username, id) / 3);
  994. } else {
  995. dmgRec = Math.floor($.randRange(0, getAttack(opponent, id2) / 6));
  996. }
  997.  
  998. if (getHitPoints(username, id) < 1) {
  999. $.say($.lang.get('pwaifugames.player.nohp', player1, replace(waifu1)));
  1000. return;
  1001. } else if (getHitPoints(opponent, id2) < 1) {
  1002. generateBoss();
  1003. } else {
  1004.  
  1005. if (!getEXP(username) >= 120000) {
  1006. updateBattleStats(username, ['pLewdness', 'pAttack', 'pDefense'], id, false);
  1007. }
  1008.  
  1009. $.inidb.incr(username, 'pEXP', id, 50);
  1010.  
  1011. $.inidb.decr(opponent, 'pHitPoints', id2, dmg);
  1012. $.inidb.decr(username, 'pHitPoints', id, dmgRec);
  1013.  
  1014. if ($.inidb.GetInteger(opponent, 'pHitPoints', id2) <= 0 && $.inidb.GetInteger(username, 'pHitPoints', id) <= 0) {
  1015. winMsg = $.lang.get('pwaifugames.win.draw', player1, replace(waifu1), player2, replace(waifu2));
  1016. }
  1017.  
  1018. if ($.inidb.GetInteger(username, 'pHitPoints', id) <= 0) {
  1019. winMsg = $.lang.get('pwaifugames.boss.loss', player2, replace(waifu2), player1, replace(waifu1));
  1020. $.inidb.incr(username, 'pLosses', 1);
  1021. }
  1022.  
  1023. if ($.inidb.GetInteger(opponent, 'pHitPoints', id2) <= 0) {
  1024. winMsg = $.lang.get('pwaifugames.boss.win', player1, replace(waifu1), player2, '[Boss] ' + replace(waifu2), $.getPointsString(getBReward()));
  1025. $.inidb.incr('points', username, ((getBReward())));
  1026. $.inidb.incr(username, 'pWins', 1);
  1027. $.inidb.incr(username, 'pcandy', 10);
  1028. $.inidb.incr(opponent, 'pLosses', 1);
  1029. $.inidb.RemoveSection('boss', 'pharem');
  1030. $.inidb.del('boss', 'id');
  1031. $.panelsocketserver.alertImage($.lang.get('pwaifugames.alert.boss') + ', 12');
  1032. }
  1033.  
  1034. var dmgRecMsg = $.lang.get('pwaifugames.fight.dmgrec', dmgRec);
  1035.  
  1036. if (dmg === 0) {
  1037. dmgMsg = $.lang.get('pwaifugames.fight.miss');
  1038. } else {
  1039. dmgMsg = $.lang.get('pwaifugames.fight.dmg', dmg);
  1040. }
  1041.  
  1042. $.say($.lang.get('pwaifugames.fight.boss') + $.lang.get('pwaifugames.fight.' + random2, replace(waifu1), getHitPoints(username, id), dmgRecMsg, attack, dmgMsg, '[Boss] ' + replace(waifu2), getHitPoints(opponent, id2), winMsg));
  1043.  
  1044. }
  1045.  
  1046. }
  1047.  
  1048. /*
  1049. * @function battle
  1050. * @param opponent
  1051. * @return Battle with another waifu
  1052. */
  1053. function startBattle(username, opponent, action) {
  1054. var random1 = $.randRange(1, responses.attack - 1),
  1055. random2 = $.randRange(1, responses.fight - 1),
  1056. id,
  1057. id2 = getRandomHaremIdFromUser(opponent),
  1058. waifu1,
  1059. waifu2,
  1060. player1 = $.userPrefix(username),
  1061. player2 = $.userPrefix(opponent),
  1062. attack = $.lang.get('pwaifugames.attack.' + random1),
  1063. dmg,
  1064. dmgRec,
  1065. dmgMsg = '',
  1066. winMsg = '';
  1067.  
  1068. if (action !== '') {
  1069. id = getWaifuId(action);
  1070. } else if (isMarried(username) && getHitPoints(username, getMarried(username)) > 1) {
  1071. id = getMarried(username);
  1072. } else {
  1073. id = getRandomHaremIdFromUser(username);
  1074. }
  1075.  
  1076. if (isMarried(opponent) && getHitPoints(opponent, getMarried(opponent)) > 1) {
  1077. id2 = getMarried(opponent);
  1078. } else {
  1079. id2 = getRandomHaremIdFromUser(opponent);
  1080. }
  1081.  
  1082. waifu1 = getWaifu(id);
  1083. waifu2 = getWaifu(id2);
  1084.  
  1085. if (opponent.equalsIgnoreCase(username)) {
  1086. $.say($.lang.get('pwaifugames.harem.same'));
  1087. return;
  1088. }
  1089.  
  1090. if (getTotalUserHarems(opponent) <= 0) {
  1091. $.say($.lang.get('pwaifugames.harem.fight4042'));
  1092. return;
  1093. } else {
  1094. if (getTotalUserHarems(username) <= 0) {
  1095. $.say($.lang.get('pwaifugames.harem.fight404'));
  1096. return;
  1097. }
  1098. }
  1099.  
  1100. if (getAttack(username, id) >= getDefense(opponent, id2)) {
  1101. dmg = Math.floor($.randRange(getDefense(opponent, id2), getAttack(username, id)) / 2 - getDefense(opponent, id2) / 3);
  1102. } else {
  1103. dmg = Math.floor($.randRange(0, getAttack(username, id) / 6));
  1104. }
  1105.  
  1106. if (getDefense(opponent, id2) >= getAttack(username, id)) {
  1107. dmgRec = Math.floor($.randRange(getAttack(username, id), getDefense(opponent, id2)) / 2 - getAttack(username, id) / 3);
  1108. } else {
  1109. dmgRec = Math.floor($.randRange(0, getAttack(opponent, id2) / 6));
  1110. }
  1111.  
  1112. if (getHitPoints(username, id) < 1) {
  1113. $.say($.lang.get('pwaifugames.player.nohp', player1, replace(waifu1)));
  1114. return;
  1115. } else if (getHitPoints(opponent, id2) < 1) {
  1116. $.say($.lang.get('pwaifugames.player.nohp', player2, replace(waifu2)));
  1117. return;
  1118. } else {
  1119.  
  1120. if (!getEXP(username) >= 120000) {
  1121. updateBattleStats(username, ['pLewdness', 'pAttack', 'pDefense'], id, false);
  1122. }
  1123. if (!getEXP(opponent) >= 120000) {
  1124. updateBattleStats(opponent, ['pLewdness', 'pAttack', 'pDefense'], id2, false);
  1125. }
  1126.  
  1127. $.inidb.incr(username, 'pEXP', id, 50);
  1128. $.inidb.incr(opponent, 'pEXP', id2, 50);
  1129.  
  1130. $.inidb.decr(opponent, 'pHitPoints', id2, dmg);
  1131. $.inidb.decr(username, 'pHitPoints', id, dmgRec);
  1132.  
  1133. if ($.inidb.GetInteger(opponent, 'pHitPoints', id2) <= 0 && $.inidb.GetInteger(username, 'pHitPoints', id) <= 0) {
  1134. winMsg = $.lang.get('pwaifugames.win.draw', player1, replace(waifu1), player2, replace(waifu2));
  1135. }
  1136.  
  1137. if ($.inidb.GetInteger(username, 'pHitPoints', id) <= 0) {
  1138. winMsg = $.lang.get('pwaifugames.win.fight', player2, replace(waifu2), player1, replace(waifu1), $.getPointsString(getFReward()));
  1139. $.inidb.incr('points', opponent, getFReward());
  1140. $.inidb.incr(opponent, 'pWins', 1);
  1141. $.inidb.incr(opponent, 'pcandy', 1);
  1142. $.inidb.incr(username, 'pLosses', 1);
  1143. }
  1144.  
  1145. if ($.inidb.GetInteger(opponent, 'pHitPoints', id2) <= 0) {
  1146. winMsg = $.lang.get('pwaifugames.win.fight', player1, replace(waifu1), player2, replace(waifu2), $.getPointsString(getFReward()));
  1147. $.inidb.incr('points', username, getFReward());
  1148. $.inidb.incr(username, 'pWins', 1);
  1149. $.inidb.incr(username, 'pcandy', 1);
  1150. $.inidb.incr(opponent, 'pLosses', 1);
  1151. }
  1152.  
  1153. var dmgRecMsg = $.lang.get('pwaifugames.fight.dmgrec', dmgRec);
  1154.  
  1155. if (dmg === 0) {
  1156. dmgMsg = $.lang.get('pwaifugames.fight.miss');
  1157. } else {
  1158. dmgMsg = $.lang.get('pwaifugames.fight.dmg', dmg);
  1159. }
  1160.  
  1161. $.say($.lang.get('pwaifugames.fight.' + random2, replace(waifu1), getHitPoints(username, id), dmgRecMsg, attack, dmgMsg, replace(waifu2), getHitPoints(opponent, id2), winMsg));
  1162.  
  1163. }
  1164.  
  1165. }
  1166.  
  1167. /*
  1168. * @event command
  1169. */
  1170. $.bind('command', function(event) {
  1171. var sender = event.getSender(),
  1172. command = event.getCommand(),
  1173. args = event.getArgs(),
  1174. action = args[0],
  1175. subAction = args[1];
  1176.  
  1177. if (command.equalsIgnoreCase('pokedex')) {
  1178. if (action === undefined) {
  1179. randomWaifu(sender);
  1180. } else {
  1181. checkWaifu(sender, action);
  1182. }
  1183. }
  1184.  
  1185. if (command.equalsIgnoreCase('catch')) {
  1186. if ($.isOnline($.channelName)) {
  1187. catchWaifu(sender);
  1188. } else {
  1189. $.say($.lang.get('pwaifugames.online.404', $.whisperPrefix(sender), $.channelName));
  1190. }
  1191. }
  1192.  
  1193. if (command.equalsIgnoreCase('boss')) {
  1194. if ($.isOnline($.channelName)) {
  1195. generateBoss();
  1196. bossBattle(sender, action);
  1197. } else {
  1198. $.say($.lang.get('pwaifugames.online.404', $.whisperPrefix(sender), $.channelName));
  1199. return;
  1200. }
  1201. }
  1202.  
  1203. if (command.equalsIgnoreCase('battle')) {
  1204. if ($.isOnline($.channelName)) {
  1205. startBattle(sender, action.toLowerCase(), subAction);
  1206. if (action === undefined) {
  1207. $.say($.lang.get('pwaifugames.fight.usage'));
  1208. return;
  1209. }
  1210. } else {
  1211. $.say($.lang.get('pwaifugames.online.404', $.whisperPrefix(sender), $.channelName));
  1212. return;
  1213. }
  1214. }
  1215.  
  1216. if (command.equalsIgnoreCase('candy')) {
  1217. if (args.length == 0) {
  1218. useCandy(sender, 1, getRandomOwnedIdFromUser(sender));
  1219. } else if (args.length == 1) {
  1220. useCandy(sender, 1, args.join(' '));
  1221. } else {
  1222. if (args.length > 1) {
  1223. useCandy(sender, action, args.slice(1).join(' '));
  1224. }
  1225. }
  1226. }
  1227.  
  1228. if (command.equalsIgnoreCase('buycandy')) {
  1229. buyCandy(sender, action);
  1230. }
  1231.  
  1232. if (command.equalsIgnoreCase('team')) {
  1233. getHarem(sender);
  1234. }
  1235.  
  1236. if (command.equalsIgnoreCase('addteam')) {
  1237. if (action === undefined) {
  1238. $.say($.lang.get('pwaifugames.addharem.usage'));
  1239. } else {
  1240. addHarem(sender, action);
  1241. }
  1242. }
  1243.  
  1244. if (command.equalsIgnoreCase('kickteam')) {
  1245. if (action === undefined) {
  1246. $.say($.lang.get('pwaifugames.kickharem.usage'));
  1247. } else {
  1248. kickHarem(sender, action);
  1249. }
  1250. }
  1251.  
  1252. if (command.equalsIgnoreCase('resetteam')) {
  1253. $.inidb.del(username, 'pmarried');
  1254. $.inidb.RemoveSection(sender, 'pharem');
  1255. $.say($.whisperPrefix(sender) + $.lang.get('pwaifugames.harem.reset'));
  1256. }
  1257.  
  1258. if (command.equalsIgnoreCase('giftpokemon')) {
  1259. sendWaifu(sender, action, subAction);
  1260. }
  1261.  
  1262. if (command.equalsIgnoreCase('giftcandy')) {
  1263. sendCandy(sender, action, args[1]);
  1264. }
  1265.  
  1266. if (command.equalsIgnoreCase('buypokemon')) {
  1267. buyWaifu(sender, action);
  1268. }
  1269.  
  1270. if (command.equalsIgnoreCase('pokefile')) {
  1271. waifuProfile(sender);
  1272. }
  1273.  
  1274. if (command.equalsIgnoreCase('setpokemon')) {
  1275. setWaifu(sender, action);
  1276. }
  1277.  
  1278. if (command.equalsIgnoreCase('resetpokemon')) {
  1279. resetWaifu(sender);
  1280. }
  1281.  
  1282. if (command.equalsIgnoreCase('legendchance')) {
  1283. rareChance(action);
  1284. }
  1285.  
  1286. if (command.equalsIgnoreCase('release')) {
  1287. releaseWaifu(sender, action);
  1288. }
  1289.  
  1290. if (command.equalsIgnoreCase('pokereward')) {
  1291. if (action === undefined) {
  1292. $.say($.lang.get('pwaifugames.reward.get', $.getPointsString(getReward())));
  1293. } else {
  1294. $.inidb.set('settings', 'pReward', action);
  1295. $.say($.lang.get('pwaifugames.reward.set', $.getPointsString(action)));
  1296. }
  1297. }
  1298.  
  1299. if (command.equalsIgnoreCase('battlereward')) {
  1300. if (action === undefined) {
  1301. $.say($.lang.get('pwaifugames.fightreward.get', $.getPointsString(getFReward())));
  1302. } else {
  1303. $.inidb.set('settings', 'pFReward', action);
  1304. $.say($.lang.get('pwaifugames.fightreward.set', $.getPointsString(action)));
  1305. }
  1306. }
  1307.  
  1308. if (command.equalsIgnoreCase('bossreward')) {
  1309. if (action === undefined) {
  1310. $.say($.lang.get('pwaifugames.bossreward.get', $.getPointsString(getBReward())));
  1311. } else {
  1312. $.inidb.set('settings', 'pBReward', action);
  1313. $.say($.lang.get('pwaifugames.bossreward.set', $.getPointsString(action)));
  1314. }
  1315. }
  1316.  
  1317. if (command.equalsIgnoreCase('pokemonhelp')) {
  1318. $.say($.whisperPrefix(sender) + $.lang.exists('pwaifugames.waifuhelp'));
  1319. }
  1320. });
  1321.  
  1322. /*
  1323. * @event initReady
  1324. */
  1325. $.bind('initReady', function() {
  1326. if ($.bot.isModuleEnabled('./games/pokemonSystem.js')) {
  1327. $.registerChatCommand('./games/waifuGames.js', 'pokedex', 7);
  1328. $.registerChatCommand('./games/waifuGames.js', 'pokefile', 7);
  1329. $.registerChatCommand('./games/waifuGames.js', 'battle', 7);
  1330. $.registerChatCommand('./games/waifuGames.js', 'boss', 7);
  1331. $.registerChatCommand('./games/waifuGames.js', 'candy', 7);
  1332. $.registerChatCommand('./games/waifuGames.js', 'buycandy', 7);
  1333. $.registerChatCommand('./games/waifuGames.js', 'catch', 7);
  1334. $.registerChatCommand('./games/waifuGames.js', 'giftpokemon', 7);
  1335. $.registerChatCommand('./games/waifuGames.js', 'giftcandy', 7);
  1336. $.registerChatCommand('./games/waifuGames.js', 'resetwaifu', 7);
  1337. $.registerChatCommand('./games/waifuGames.js', 'release', 7);
  1338. $.registerChatCommand('./games/waifuGames.js', 'setpokemon', 7);
  1339. $.registerChatCommand('./games/waifuGames.js', 'buypokemon', 7);
  1340. $.registerChatCommand('./games/waifuGames.js', 'team', 7);
  1341. $.registerChatCommand('./games/waifuGames.js', 'addteam', 7);
  1342. $.registerChatCommand('./games/waifuGames.js', 'kickteam', 7);
  1343. $.registerChatCommand('./games/waifuGames.js', 'resetteam', 7);
  1344. $.registerChatCommand('./games/waifuGames.js', 'pokehelp', 7);
  1345. $.registerChatCommand('./games/waifuGames.js', 'legendchance', 7);
  1346. $.registerChatCommand('./games/waifuGames.js', 'resetratio', 7);
  1347. $.registerChatCommand('./games/waifuGames.js', 'pokemonreward', 1);
  1348. $.registerChatCommand('./games/waifuGames.js', 'fightreward', 1);
  1349. $.registerChatCommand('./games/waifuGames.js', 'bossreward', 1);
  1350. load();
  1351. }
  1352. });
  1353. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement