player.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. 'use strict';
  2. class k {
  3. constructor(gain) {
  4. const goddess = gain.mod,
  5. durion = gain.defs,
  6. crestwhirlwind = gain.utils,
  7. ride = gain.state;
  8. this.stateReference = gain.state;
  9. const broccolisoup = gain.log;
  10. let redemerald = null,
  11. gift = [];
  12. Object.assign(this, {
  13. 'gameId': null,
  14. 'templateId': -1,
  15. 'race': -1,
  16. 'job': -1,
  17. 'mounted': !![],
  18. 'vehicleEx': null,
  19. 'attackSpeed': 1,
  20. 'attackSpeedBonus': 0,
  21. 'stamina': 0,
  22. 'partyMembers': new Map(),
  23. 'currentGlyphs': new Set(),
  24. 'currentStamina': null,
  25. 'lowStaminaSystemMessage': null,
  26. 'aspd': 0,
  27. 'passives': new Set(),
  28. 'items': new Set(),
  29. 'inCombat': ![],
  30. 'equippedWeapon': ![],
  31. 'bodyRolls': [],
  32. 'categories': new Map(),
  33. 'polishing': new Set(),
  34. 'polishingLevelEffects': new Map(),
  35. 'talents': new Map(),
  36. 'totalRunSpeed': 0,
  37. 'totalWalkSpeed': 0,
  38. 'awookenedLevel': 0
  39. });
  40. const smile = gain => {
  41. if ('yijCx' === 'JwKxn') {
  42. return this.items.has(gain);
  43. } else {
  44. this.passives.clear();
  45. for (let goddess of gain.skills) {
  46. if ('UtVTZ' !== 'lYGsl') {
  47. let gain = Number(goddess.id);
  48. if (goddess.active) {} else {
  49. this.passives.add(gain);
  50. }
  51. } else {
  52. return this.talents.has(gain);
  53. }
  54. }
  55. }
  56. },
  57. darkmatter = gain => {
  58. this.gameId = gain.gameId;
  59. this.templateId = gain.templateId;
  60. this.race = crestwhirlwind.getRaceFromTemplateId(this.templateId);
  61. this.job = crestwhirlwind.getJobFromTemplateId(this.templateId);
  62. this.passives.clear();
  63. this.partyMembers.clear();
  64. this.currentGlyphs.clear();
  65. this.polishing.clear();
  66. this.items.clear();
  67. this.bodyRolls = [];
  68. this.blacklistedSkills = {};
  69. this.categories.clear();
  70. switch (this.job) {
  71. case 9:
  72. this.lowStaminaSystemMessage = 'SMT_BATTLE_SKILL_FAIL_LOW_ARCANE';
  73. break;
  74. case 10:
  75. this.lowStaminaSystemMessage = 'SMT_BATTLE_SKILL_FAIL_LOW_FURY';
  76. break;
  77. case 11:
  78. this.lowStaminaSystemMessage = 'SMT_BATTLE_SKILL_FAIL_LOW_CHAKRA';
  79. break;
  80. case 12:
  81. this.lowStaminaSystemMessage = 'SMT_BATTLE_SKILL_FAIL_LOW_MOON_LIGHT';
  82. break;
  83. default:
  84. this.lowStaminaSystemMessage = 'SMT_BATTLE_SKILL_FAIL_LOW_STAMINA';
  85. }
  86. this.awookenedLevel = gain.awakeningLevel;
  87. },
  88. charm = gain => {
  89. if (gain.target !== this.gameId) {
  90. return;
  91. }
  92. this.inCombat = 1 === gain.status;
  93. },
  94. speedup = gain => {
  95. this.attackSpeed = gain.attackSpeed;
  96. this.attackSpeedBonus = gain.attackSpeedBonus;
  97. this.currentStamina = gain.stamina;
  98. this.totalRunSpeed = gain.runSpeed + gain.runSpeedBonus;
  99. this.totalWalkSpeed = gain.walkSpeed + gain.walkSpeedBonus;
  100. this.__recalculateAspd();
  101. },
  102. crestdivinelightning = gain => {
  103. redemerald = gain.first ? gain : redemerald.items.concat(gain.items);
  104. if (!gain.more) {
  105. if ('YAUeR' !== 'IUbGx') {
  106. if (14 == redemerald.container) {
  107. gift = [];
  108. redemerald.items.forEach(gain => {
  109. if ('UCZCj' !== 'WSWcV') {
  110. gift.push(gain);
  111. } else {
  112. return this.currentGlyphs.has(Number(gain));
  113. }
  114. });
  115. } else if (0 == redemerald.container) {
  116. if ('WvPVS' !== 'pSzCl') {
  117. this.items.clear();
  118. redemerald.items.forEach(gain => {
  119. if ('sExiw' !== 'EPgAm') {
  120. this.items.add(gain.id);
  121. } else {
  122. this.mounted = !![];
  123. }
  124. });
  125. } else {
  126. this.vehicleEx = null;
  127. this.mounted = ![];
  128. this.zone = gain.zone;
  129. }
  130. }
  131. if (gain.lastInBatch) {
  132. this.equippedWeapon = gift.some(gain => 1 == gain.slot);
  133. let gain = gift.find(gain => 3 == gain.slot);
  134. if (gain) {
  135. if ('EDIWY' === 'Okxmu') {
  136. broccolisoup.writeDebugMessage('S_LOAD_EP_INFO', gain.perks);
  137. } else {
  138. let goddess = [];
  139. const durion = gain.passivitySets[gain.passivitySet];
  140. if (durion) {
  141. if ('xsPnA' !== 'xsPnA') {
  142. let crestthrowaxe = this.partyMembers.get(goddess);
  143. if (crestthrowaxe.pid === gain.playerId && crestthrowaxe.sid === gain.serverId) {
  144. this.partyMembers.delete(goddess);
  145. }
  146. } else {
  147. for (let gain of durion.passivities) {
  148. if ('SskGn' === 'SskGn') {
  149. if (0 !== gain.id) {
  150. if ('yjWtj' !== 'gMhdM') {
  151. goddess.push(gain.id);
  152. } else {
  153. let changecolorenable = [];
  154. const linksocialid = gain.passivitySets[gain.passivitySet];
  155. if (linksocialid) {
  156. for (let mirrorball of linksocialid.passivities) {
  157. if (0 !== mirrorball.id) {
  158. changecolorenable.push(mirrorball.id);
  159. }
  160. }
  161. }
  162. this.bodyRolls = changecolorenable;
  163. }
  164. }
  165. } else {
  166. this.talents.delete(goddess.id);
  167. }
  168. }
  169. }
  170. }
  171. this.bodyRolls = goddess;
  172. }
  173. }
  174. let goddess = gift.find(gain => 20 == gain.slot);
  175. if (goddess) {
  176. if ('noBsc' !== 'noBsc') {
  177. this.items.add(gain.id);
  178. } else {
  179. this.items.add(goddess.id);
  180. }
  181. }
  182. }
  183. redemerald = null;
  184. } else {
  185. broccolisoup.writeDebugMessage('S_CREST_INFO ' + gain.crests);
  186. }
  187. }
  188. },
  189. middlebomb = gain => {
  190. this.currentStamina = gain.current;
  191. },
  192. combatitemsubtype = gain => {
  193. this.partyMembers.clear();
  194. gain.members.forEach(gain => {
  195. if ('GmaLK' === 'GmaLK') {
  196. if (!(gain.gameId === this.gameId)) {
  197. this.partyMembers.set(gain.gameId, {
  198. 'pid': gain.playerId,
  199. 'sid': gain.serverId
  200. });
  201. }
  202. } else {
  203. this.talents.clear();
  204. }
  205. });
  206. },
  207. heavyboots = gain => {
  208. [...this.partyMembers.keys()].forEach(goddess => {
  209. let durion = this.partyMembers.get(goddess);
  210. if (durion.pid === gain.playerId && durion.sid === gain.serverId) {
  211. this.partyMembers.delete(goddess);
  212. }
  213. });
  214. },
  215. crestoverhelm = () => {
  216. if ('IRSsk' === 'IRSsk') {
  217. this.partyMembers.clear();
  218. } else {
  219. if (!gain.successful) {
  220. return;
  221. }
  222. for (let crestchainuppercut of gain.perks) {
  223. if (this.talents.has(crestchainuppercut.id)) {
  224. this.talents.delete(crestchainuppercut.id);
  225. }
  226. this.talents.set(crestchainuppercut.id, crestchainuppercut.level);
  227. }
  228. }
  229. },
  230. fighter = gain => {
  231. this.currentGlyphs.clear();
  232. if (ride.config.debugGlyphs) {
  233. if ('dgwMD' !== 'yBiEA') {
  234. broccolisoup.writeDebugMessage('S_CREST_INFO ' + gain.crests);
  235. } else {
  236. this.currentStamina = gain.current;
  237. }
  238. }
  239. for (let goddess of gain.crests) {
  240. if ('nibIK' !== 'nibIK') {
  241. if (gain.gameId === this.gameId) {
  242. this.mounted = ![];
  243. }
  244. } else {
  245. if (goddess.enable) {
  246. if ('TqvrV' !== 'TqvrV') {
  247. if (gain.target !== this.gameId) {
  248. return;
  249. }
  250. this.inCombat = 1 === gain.status;
  251. } else {
  252. this.currentGlyphs.add(goddess.id);
  253. }
  254. } else {
  255. this.currentGlyphs.delete(goddess.id);
  256. }
  257. }
  258. }
  259. },
  260. king = gain => {
  261. if ('wnFQv' !== 'dyoDQ') {
  262. if (ride.config.debugGlyphs) {
  263. broccolisoup.writeDebugMessage('S_CREST_APPLY ' + gain.id + ' status: ' + gain.enable);
  264. }
  265. if (gain.enable) {
  266. if ('XTavW' !== 'XTavW') {
  267. this.vehicleEx = gain.vehicle;
  268. } else {
  269. this.currentGlyphs.add(gain.id);
  270. }
  271. } else {
  272. if ('cYrud' !== 'cYrud') {
  273. if (ride.config.debugGlyphs) {
  274. broccolisoup.writeDebugMessage('S_CREST_APPLY ' + gain.id + ' status: ' + gain.enable);
  275. }
  276. if (gain.enable) {
  277. this.currentGlyphs.add(gain.id);
  278. } else {
  279. this.currentGlyphs.delete(gain.id);
  280. }
  281. } else {
  282. this.currentGlyphs.delete(gain.id);
  283. }
  284. }
  285. } else {
  286. if (goddess.active) {
  287. this.polishing.add(goddess.id);
  288. } else {
  289. this.polishing.delete(goddess.id);
  290. }
  291. }
  292. },
  293. towhand = gain => {
  294. if (gain.target === this.gameId) {
  295. this.vehicleEx = gain.vehicle;
  296. }
  297. },
  298. crystalcue = gain => {
  299. if (gain.target === this.gameId) {
  300. this.vehicleEx = null;
  301. }
  302. },
  303. shellofblueargon = gain => {
  304. if (gain.gameId === this.gameId) {
  305. if ('eREww' !== 'mIqVD') {
  306. this.mounted = !![];
  307. } else {
  308. this.currentGlyphs.add(goddess.id);
  309. }
  310. }
  311. },
  312. twohandaxe = gain => {
  313. if ('oSlnC' === 'SRQyp') {
  314. if (ride.config.debugTalents) {
  315. broccolisoup.writeDebugMessage('S_LOAD_EP_INFO', gain.perks);
  316. }
  317. for (let giftcard of gain.perks) {
  318. this.talents.set(giftcard.id, giftcard.level);
  319. }
  320. } else {
  321. if (gain.gameId === this.gameId) {
  322. this.mounted = ![];
  323. }
  324. }
  325. },
  326. ironcue = gain => {
  327. this.categories.set(gain.category, gain.enabled);
  328. },
  329. debuff = gain => {
  330. this.polishing.clear();
  331. this.polishingLevelEffects.clear();
  332. if (ride.config.debugPolishing) {
  333. if ('EBWjO' === 'pcNNG') {
  334. this.partyMembers.clear();
  335. gain.members.forEach(crestevasionattack => {
  336. if (!(crestevasionattack.gameId === this.gameId)) {
  337. this.partyMembers.set(crestevasionattack.gameId, {
  338. 'pid': crestevasionattack.playerId,
  339. 'sid': crestevasionattack.serverId
  340. });
  341. }
  342. });
  343. } else {
  344. broccolisoup.writeDebugMessage('S_RP_SKILL_POLISHING_LIST', gain.optionEffects);
  345. }
  346. }
  347. for (let goddess of gain.optionEffects) {
  348. if ('hvLOK' === 'hvLOK') {
  349. if (goddess.active) {
  350. this.polishing.add(goddess.id);
  351. } else {
  352. if ('CGgVh' === 'CGgVh') {
  353. this.polishing.delete(goddess.id);
  354. } else {
  355. this.polishing.delete(goddess.id);
  356. }
  357. }
  358. } else {
  359. this.passives.clear();
  360. for (let darkbead of gain.skills) {
  361. let hotfix = Number(darkbead.id);
  362. if (darkbead.active) {} else {
  363. this.passives.add(hotfix);
  364. }
  365. }
  366. }
  367. }
  368. for (let goddess of gain.levelEffects) {
  369. this.polishingLevelEffects.set(goddess.group, goddess.id);
  370. }
  371. },
  372. merchant = gain => {
  373. if (!gain.successful) {
  374. return;
  375. }
  376. for (let goddess of gain.perks) {
  377. if (this.talents.has(goddess.id)) {
  378. this.talents.delete(goddess.id);
  379. }
  380. this.talents.set(goddess.id, goddess.level);
  381. }
  382. },
  383. cityrecall = gain => {
  384. if ('RgCmY' === 'mfruY') {
  385. this.categories.set(gain.category, gain.enabled);
  386. } else {
  387. if (ride.config.debugTalents) {
  388. if ('hBrzm' === 'hBrzm') {
  389. broccolisoup.writeDebugMessage('S_LOAD_EP_INFO', gain.perks);
  390. } else {
  391. [...this.partyMembers.keys()].forEach(reversewithdraw => {
  392. let seren = this.partyMembers.get(reversewithdraw);
  393. if (seren.pid === gain.playerId && seren.sid === gain.serverId) {
  394. this.partyMembers.delete(reversewithdraw);
  395. }
  396. });
  397. }
  398. }
  399. for (let goddess of gain.perks) {
  400. if ('QnmcV' !== 'QnmcV') {
  401. if (gain.target === this.gameId) {
  402. this.vehicleEx = null;
  403. }
  404. } else {
  405. this.talents.set(goddess.id, goddess.level);
  406. }
  407. }
  408. }
  409. },
  410. useitem = () => {
  411. this.talents.clear();
  412. };
  413. goddess.hook(...durion.getVersion('S_SKILL_LIST'), smile);
  414. goddess.hook(...durion.getVersion('S_SKILL_CATEGORY'), ironcue);
  415. goddess.hook(...durion.getVersion('S_LOGIN'), ride.hookNotFake, darkmatter);
  416. goddess.hook(...durion.getVersion('S_USER_STATUS'), charm);
  417. goddess.hook(...durion.getVersion('S_ITEMLIST'), {
  418. 'order': -10000000000,
  419. 'filter': {
  420. 'fake': ![]
  421. }
  422. }, crestdivinelightning);
  423. goddess.hook(...durion.getVersion('S_PLAYER_STAT_UPDATE'), speedup);
  424. goddess.hook(...durion.getVersion('S_PLAYER_CHANGE_STAMINA'), middlebomb);
  425. goddess.hook(...durion.getVersion('S_PARTY_MEMBER_LIST'), {
  426. 'order': -10,
  427. 'filter': {
  428. 'fake': ![]
  429. }
  430. }, combatitemsubtype);
  431. goddess.hook(...durion.getVersion('S_LEAVE_PARTY_MEMBER'), {
  432. 'order': -10,
  433. 'filter': {
  434. 'fake': ![]
  435. }
  436. }, heavyboots);
  437. goddess.hook(...durion.getVersion('S_BAN_PARTY_MEMBER'), {
  438. 'order': -10,
  439. 'filter': {
  440. 'fake': ![]
  441. }
  442. }, heavyboots);
  443. goddess.hook(...durion.getVersion('S_CREST_INFO'), fighter);
  444. goddess.hook(...durion.getVersion('S_CREST_APPLY'), king);
  445. goddess.hook(...durion.getVersion('S_MOUNT_VEHICLE_EX'), {
  446. 'order': -10,
  447. 'filter': {
  448. 'fake': null
  449. }
  450. }, towhand);
  451. goddess.hook(...durion.getVersion('S_UNMOUNT_VEHICLE_EX'), {
  452. 'order': -10,
  453. 'filter': {
  454. 'fake': null
  455. }
  456. }, crystalcue);
  457. goddess.hook(...durion.getVersion('S_MOUNT_VEHICLE'), {
  458. 'order': -10,
  459. 'filter': {
  460. 'fake': null
  461. }
  462. }, shellofblueargon);
  463. goddess.hook(...durion.getVersion('S_UNMOUNT_VEHICLE'), {
  464. 'order': -10,
  465. 'filter': {
  466. 'fake': null
  467. }
  468. }, twohandaxe);
  469. goddess.hook(...durion.getVersion('S_RP_SKILL_POLISHING_LIST'), debuff);
  470. goddess.hook(...durion.getVersion('S_LEARN_EP_PERK'), merchant);
  471. goddess.hook(...durion.getVersion('S_LOAD_EP_INFO'), cityrecall);
  472. goddess.hook('S_RETURN_TO_LOBBY', 'raw', useitem);
  473. goddess.hook('S_RESET_EP_PERK', 'raw', useitem);
  474. goddess.hook('S_LEAVE_PARTY', 'raw', {
  475. 'order': -10,
  476. 'filter': {
  477. 'fake': ![]
  478. }
  479. }, crestoverhelm);
  480. goddess.hook(...durion.getVersion('S_LOAD_TOPO'), gain => {
  481. if ('aWMhl' !== 'BXwVW') {
  482. this.vehicleEx = null;
  483. this.mounted = ![];
  484. this.zone = gain.zone;
  485. } else {
  486. return ![];
  487. }
  488. });
  489. } ['isMe'](robebodycue) {
  490. return this.gameId === robebodycue || this.vehicleEx && this.vehicleEx === robebodycue;
  491. } ['myChar']() {
  492. return this.vehicleEx ? this.vehicleEx : this.gameId;
  493. } ['changeAspd'](sackcue, ridinguseable, extract = ![]) {
  494. switch (ridinguseable) {
  495. case 2:
  496. this.attackSpeedBonus = extract ? this.attackSpeedBonus - sackcue : this.attackSpeedBonus + sackcue;
  497. break;
  498. case 3:
  499. this.attackSpeedBonus = extract ? this.attackSpeedBonus - (Math.round(this.attackSpeed * sackcue) - this.attackSpeed) : this.attackSpeedBonus + (Math.round(this.attackSpeed * sackcue) - this.attackSpeed);
  500. }
  501. this.__recalculateAspd();
  502. } ['isPartyMember'](reset) {
  503. return this.partyMembers.has(reset);
  504. } ['isPolishingExist'](twister) {
  505. return this.polishing.has(twister);
  506. } ['isTalentExist'](plantcue) {
  507. return this.talents.has(plantcue);
  508. } ['getTalentLevel'](extractrecipe) {
  509. return this.talents.get(extractrecipe);
  510. } ['isPolishingEffectExist'](songkran) {
  511. return this.polishingLevelEffects.has(songkran);
  512. } ['getPolishingEffectByGroup'](crystallized) {
  513. return this.polishingLevelEffects.get(crystallized);
  514. } ['isCategoriesEnabled'](decomposition) {
  515. for (const priority of decomposition) {
  516. if ('EvuBT' === 'EvuBT') {
  517. if (this.categories.has(Number(priority)) && !this.categories.get(Number(priority))) {
  518. if ('IeaSN' !== 'FvdmX') {
  519. return ![];
  520. } else {
  521. let unionextractorkey = Number(priority.id);
  522. if (priority.active) {} else {
  523. this.passives.add(unionextractorkey);
  524. }
  525. }
  526. }
  527. } else {
  528. return this.talents.get(decomposition);
  529. }
  530. }
  531. return !![];
  532. } ['isGlyphExists'](promotion) {
  533. return this.currentGlyphs.has(Number(promotion));
  534. } ['isItemFromInventory'](pendant) {
  535. return this.items.has(pendant);
  536. } ['__recalculateAspd']() {
  537. this.aspd = (this.attackSpeed + this.attackSpeedBonus) / (this.job >= 8 ? 100 : this.attackSpeed);
  538. if (!this.stateReference.backup) {
  539. this.aspd = this.aspd / 1.07;
  540. }
  541. }
  542. }
  543. module.exports = k;