index.js 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492
  1. 'use strict'
  2. /* global __dirname */
  3. module.exports = function FpsUtils(mod) {
  4. // ~~~ * Data * ~~~ \\
  5. const NotCP = typeof global.TeraProxy === 'undefined';
  6. const NpcData = require("./data/npcData.json"), SkillData = require("./data/skillString.json");
  7. const BnzC = '#BC8F8F', SlvC = '#9A9A9A', GldC = '#DAA520', PnkC = '#FFB7C5', HPkC = '#FF69B4', CPKC = '#ED5D92', RedC = '#FE6F5E', GrnC = '#4DE19C', LPrC = '#E0B0FF', PrpC = '#9966CC', LBlC = '#4DDCE1', BluC = '#436EEE', DBlC = '#5BC0BE', HBlC = '#08B3E5', GryC = '#778899', YlwC = '#C0B94D';
  8. const InvisibleNpcs = { 8: [6011], 12: [1, 2], 23: [201, 202], 34: [8000], 61: [9901], 62: [1039, 1040, 1041, 1042, 1900, 1901, 1902, 1903, 9001, 9002, 9003, 9004, 9901], 83: [9901], 207: [9901], 212: [1034], 223: [9901], 230: [9901] };
  9. const TrapsIds = [30120, 30220, 30320, 90120, 90220, 90320, 90420, 90520, 90620, 90720, 90820, 90920, 100120, 100220, 100320, 100420, 100520, 120220, 120320, 120420, 120520, 120620, 120720, 120820, 120920, 150120, 150220, 150320, 150420, 150520, 150620, 150720, 170120, 170220, 170320, 170420, 170520, 170620, 170720, 170820, 170920, 230120, 230220, 230320, 250120, 250220, 250320, 250420, 250520, 250620, 250720, 250820, 250920, 251020];
  10. const UserNPCs = [12345, 1100100, 1100101, 1023000, 1023001, 1023002, 1023003, 1023004, 1023005, 1023006, 1023007, 1023008, 1023009, 1023010, 1023011, 1023012, 1023013, 1023014, 1023200, 1023201, 1023202, 1023203, 1023204, 1023205, 1023206, 1023207, 1023208, 1023209, 1023210, 1023211, 1023300, 1023301, 1023302, 1023303, 1023304, 1023305, 1023306, 1023307, 1023308, 1023309, 1023310, 1023311, 1023312, 1023400, 1023401, 1023402, 1023403, 1023404, 1023405, 1024000, 1024001, 1024100, 1024200, 1024300, 2100100, 2100101, 10235001, 10235002, 10235003, 10235004, 10235005, 10235006, 10235007, 10235008, 10235009, 10235010, 10235011, 10235012, 10235013, 10235014, 10235015, 10235016, 10235017, 10235100, 10236001, 10236002, 10236003, 10236004, 10236005, 10236006, 10236007, 10236008, 10236009, 10236010, 10236011, 10236012, 10236013, 10236014, 10236015, 10236100, 10237001, 10237002, 10237003, 10237004, 10237005, 10237006, 10237007, 10237008, 10237009, 10237010, 10237011, 10237012, 10237013, 10237014, 10237015, 10237100, 10238001, 10238002, 10238003, 10238004, 10238005, 10238006, 10238007, 10238008, 10238100, 10239003, 30301001, 30301002, 30301003, 30301004, 30301005, 30302001, 30302002, 30302003, 30302004, 30302005, 30302006, 30302007, 30303001, 30303002, 30303003, 30303004, 30303005, 30303006, 30303007];
  11. const SpamAchIds = [6, 51, 377, 391, 466, 467, 468, 469, 470, 471, 472, 473, 476, 611, 1408, 1744, 1745, 1769, 1770, 1771, 1942, 1943, 1952, 1992, 2032, 2033, 2036, 2037, 2038, 2057, 2062, 2071, 2078, 2081, 2082, 2083, 2084, 2088, 2089, 2095, 6005, 9817, 28723, 28724, 28725, 28726, 28727, 28728, 28729, 28730, 28731, 28732, 28733, 28734, 28735, 28736, 510005, 510012, 510019, 510026, 510027, 510033, 510034, 510035, 510036, 510037, 510038, 510039, 510040, 510041, 520029, 520030, 520032, 520033, 520034, 520035, 520048, 520049, 520050, 520051, 525000, 525001, 525002, 525003, 525004, 525005, 525006, 525007, 525008, 525009, 525010, 525011, 525012, 525013, 525014, 525015, 525016, 525017, 525018, 525019, 525020, 525021, 525022, 525023, 525024, 525025, 5010000];
  12. const ImportantAbns = [90440009, 90442106, 90442110, 90442111, 90442112, 90442113, 90442114, 90442400, 90442401, 90442402, 90442403, 90442404, 90442405, 90442406, 90442407, 90442408, 90442502, 78200123, 78200126, 78200130, 78200131, 78200161, 78200162, 78200203, 78200204, 78200205, 78200209, 78200234, 78200235, 78200236];
  13. // ~~~ * Variables * ~~~ \\
  14. let MyGameId,
  15. MyName,
  16. MyPlayerId,
  17. SwitchCd,
  18. AllowedAchUps,
  19. LastState,
  20. LastVrange,
  21. ProjDebug,
  22. AbnDebug,
  23. TmpData = [],
  24. PMembers = [],
  25. SUsers = {},
  26. HUsers = {},
  27. SNpcs = {},
  28. HNpcs = {};
  29. // ~~~ * Gui Parser * ~~~ \\
  30. const Xmap = new WeakMap();
  31. if (!Xmap.has(mod.dispatch || mod)) {
  32. Xmap.set(mod.dispatch || mod, {});
  33. mod.hook('C_CONFIRM_UPDATE_NOTIFICATION', 'raw', () => false)
  34. mod.hook('C_ADMIN', 1, (event) => {
  35. const Xd = event.command.split(";")
  36. Xd.forEach(cmd => mod.command.exec(cmd))
  37. return false
  38. })
  39. }
  40. const gui = {
  41. parse(Xarray, Xtitle) {
  42. let Xdata = '';
  43. for (let i = 0; i < Xarray.length; i++) {
  44. if (Xdata.length >= 16000) {
  45. Xdata += `Gui data limit exceeded, some values may be missing.`;
  46. break;
  47. }
  48. if (Xarray[i].command) Xdata += `<a href="admincommand:/@${Xarray[i].command}">${Xarray[i].text}</a>`;
  49. else if (!Xarray[i].command) Xdata += `${Xarray[i].text}`;
  50. else continue;
  51. }
  52. mod.toClient('S_ANNOUNCE_UPDATE_NOTIFICATION', 1, {
  53. id: 0,
  54. title: Xtitle,
  55. body: Xdata
  56. })
  57. }
  58. }
  59. // ~~~ * Gui Handler * ~~~ \\
  60. function GuiHandler(page, arg) {
  61. switch (page) {
  62. case "searchnpc": case "npcsearch":
  63. NpcJsonSearch(arg, NpcData, "search", `<font color="${LBlC}" size="+16">Search results for '${arg}'</font>.`)
  64. break;
  65. case "npc":
  66. NpcJsonSearch(arg, NpcData, "starts", `<font color="${LBlC}" size="+16">Search results for '${arg}'</font>.`)
  67. break;
  68. case "npclist":
  69. TmpData = []
  70. TmpData.push(
  71. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br><br>`, command: "fps gui" },
  72. { text: `<font color="${YlwC}" size="+20"><p align="right">[Main NPC page]</p></font><br>`, command: "fps gui npcmain" },
  73. { text: `<font color="${LBlC}" size="+19">Click a NPC ID to remove it from the blacklist:</font><br>` }
  74. )
  75. for (let i = 0; i < mod.settings.NpcsBlacklist.length; i++) {
  76. TmpData.push({ text: `<font color="${BnzC}" size="+17">${mod.settings.NpcsBlacklist[i].zone}, ${mod.settings.NpcsBlacklist[i].templateId}</font><br>`, command: `fps npc hide ${mod.settings.NpcsBlacklist[i].zone} ${mod.settings.NpcsBlacklist[i].templateId};fps gui npclist` })
  77. }
  78. gui.parse(TmpData, `<font color="${LPrC}">[FPS] Options - NPCs </font><font color="${GrnC}">(Blacklist)</font>`)
  79. TmpData = []
  80. break;
  81. case "npcmain":
  82. TmpData = []
  83. TmpData.push(
  84. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br><br>`, command: "fps gui" },
  85. { text: `<font color="${YlwC}" size="+20"><p align="right">[Blacklisted NPCs list]</p></font><br>`, command: "fps gui npclist" },
  86. { text: `<font color="${LBlC}" size="+19">Click a letter to view all NPCs starting with that letter:<br><br>` }
  87. )
  88. for (let i = 25, alphabet = ["Z", "Y", "X", "W", "V", "U", "T", "S", "R", "Q", "P", "O", "N", "M", "L", "K", "J", "I", "H", "G", "F", "E", "D", "C", "B", "A"]; i > -1; i--) {
  89. TmpData.push({ text: `<font color="${BluC}" size="+19">${alphabet[i]}</font>`, command: `fps gui npc ${alphabet[i]}` }, { text: "&nbsp;&nbsp;" })
  90. }
  91. TmpData.push(
  92. { text: `<br><br><font color="${PnkC}" size="+16">(Command </font><font color="${HPkC}" size="+16">"fps gui searchnpc &#60;name&#62;"</font><font color="${PnkC}" size="+16"> to search for a specific NPCs names, Case sensitive)</font>` },
  93. { text: `<br><br><font color="${PnkC}" size="+16">(Command </font><font color="${HPkC}" size="+16">"fps gui npc &#60;letters&#62;"</font><font color="${PnkC}" size="+16"> to search for NPCs names that starts with that 'letters', Case sensitive)</font>` },
  94. { text: `<br><br><font color="${PnkC}" size="+16">If you want to search for npc with space between it's name, you've to add the whole name inside quotations, e.g. <font color="${HPkC}" size="+16">fps gui npcsearch "Bay Kamara"\`</font></font>` }
  95. )
  96. gui.parse(TmpData, `<font color="${LPrC}">[FPS] Options - NPCs </font><font color="${YlwC}">(Main)</font>`)
  97. TmpData = []
  98. break;
  99. case "show":
  100. TmpData = []
  101. TmpData.push(
  102. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br>`, command: "fps gui" },
  103. { text: `<font color="${RedC}" size="+16">Red</font><font color="${LPrC}" size="+16"> = Shown, <font color="${GrnC}" size="+16">Green</font><font color="${LPrC}" size="+16"> = Hidden</font></font><br>` },
  104. { text: `<font color="${PnkC}" size="+16">(Command </font><font color="${HPkC}" size="+16">"fps hide &#60;name&#62;"</font><font color="${PnkC}" size="+16"> to hide someone that does not appear here)</font><br><br>` },
  105. { text: `<font color="${LBlC}" size="+19">Click on <font color="${RedC}">Red</font> to hide & add to blacklist.<br>Click on <font color="${GrnC}">Green</font> to show & remove from blacklist</font><br>` }
  106. )
  107. for (let i in SUsers) {
  108. TmpData.push({ text: `<font color="${mod.settings.PlayersBlacklist.includes(SUsers[i].name) ? GrnC : RedC}" size="+17">${SUsers[i].name}</font><br>`, command: mod.settings.PlayersBlacklist.includes(SUsers[i].name) ? `fps show ${SUsers[i].name};fps gui show` : `fps hide ${SUsers[i].name};fps gui show` })
  109. }
  110. gui.parse(TmpData, `<font color="${LPrC}">[FPS] Options - Players </font><font color="${RedC}">(In-distance)</font>`)
  111. TmpData = []
  112. break;
  113. case "hide":
  114. TmpData = []
  115. TmpData.push(
  116. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br><br>`, command: "fps gui" },
  117. { text: `<font color="${LBlC}" size="+19">Click to show & remove from blacklist.</font><br>` }
  118. )
  119. mod.settings.PlayersBlacklist.forEach(mem => TmpData.push({ text: `<font color="${BnzC}" size="+17">${mem}</font><br>`, command: `fps show ${mem};fps gui hide` }))
  120. gui.parse(TmpData, `<font color="${LPrC}">[FPS] Options - Players </font><font color="${GrnC}">(Hidden)</font>`)
  121. TmpData = []
  122. break;
  123. case "skills":
  124. gui.parse([
  125. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br>`, command: "fps gui" },
  126. { text: `<font color="${YlwC}" size="+20">Tankers:</font>` }, { text: "&#09;&#09;" },
  127. { text: `<font color="${LBlC}" size="+18">&#40;Lancer&#41;</font>`, command: "fps gui class lancer" }, { text: "&nbsp;&nbsp;" },
  128. { text: `<font color="${LBlC}" size="+18">&#40;Brawler&#41;</font><br><br>`, command: "fps gui class brawler" },
  129. { text: `<font color="${YlwC}" size="+20">Healers:</font>` }, { text: "&#09;&#09;" },
  130. { text: `<font color="${LBlC}" size="+18">&#40;Priest&#41;</font>`, command: "fps gui class priest" }, { text: "&nbsp;&nbsp;" },
  131. { text: `<font color="${LBlC}" size="+18">&#40;Mystic&#41;</font><br><br>`, command: "fps gui class mystic" },
  132. { text: `<font color="${YlwC}" size="+20">Dpsers(melee):</font>` }, { text: "&#09;" },
  133. { text: `<font color="${LBlC}" size="+18">&#40;Warrior&#41;</font>`, command: "fps gui class warrior" }, { text: "&nbsp;&nbsp;" },
  134. { text: `<font color="${LBlC}" size="+18">&#40;Slayer&#41;</font>`, command: "fps gui class slayer" }, { text: "&nbsp;&nbsp;" },
  135. { text: `<font color="${LBlC}" size="+18">&#40;Berserker&#41;</font>`, command: "fps gui class berserker" }, { text: "&nbsp;&nbsp;" },
  136. { text: `<font color="${LBlC}" size="+18">&#40;Ninja&#41;</font>`, command: "fps gui class ninja" }, { text: "&nbsp;&nbsp;" },
  137. { text: `<font color="${LBlC}" size="+18">&#40;Valkyrie&#41;</font>`, command: "fps gui class valkyrie" }, { text: "&nbsp;&nbsp;" },
  138. { text: `<font color="${LBlC}" size="+18">&#40;Reaper&#41;</font><br><br>`, command: "fps gui class reaper" },
  139. { text: `<font color="${YlwC}" size="+20">Dpsers(ranged):</font>` }, { text: "&#09;" },
  140. { text: `<font color="${LBlC}" size="+18">&#40;Sorcerer&#41;</font>`, command: "fps gui class sorcerer" }, { text: "&nbsp;&nbsp;" },
  141. { text: `<font color="${LBlC}" size="+18">&#40;Archer&#41;</font>`, command: "fps gui class archer" }, { text: "&nbsp;&nbsp;" },
  142. { text: `<font color="${LBlC}" size="+18">&#40;Gunner&#41;</font>`, command: "fps gui class gunner" }
  143. ], `<font color="${LPrC}">[FPS] Options - Skills </font><font color="${YlwC}">(Choose class)</font>`)
  144. break;
  145. case "class":
  146. gui.parse(SkillJsonSearch(arg), `<font color="${LPrC}">[FPS] Options - Skill list for '${arg}'</font>`)
  147. break;
  148. case "role":
  149. gui.parse([
  150. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br><br>`, command: "fps gui" },
  151. { text: `<font color="${YlwC}" size="+20">By Roles:</font>` }, { text: "&#09;" },
  152. { text: `<font color="${mod.settings.RolesBlacklist.includes('tank') ? GrnC : RedC}" size="+18">[Tankers]</font>`, command: `fps ${mod.settings.RolesBlacklist.includes('tank') ? `show` : `hide`} tank;fps gui role` }, { text: "&nbsp;&nbsp;" },
  153. { text: `<font color="${mod.settings.RolesBlacklist.includes('healer') ? GrnC : RedC}" size="+18">[Healers]</font>`, command: `fps ${mod.settings.RolesBlacklist.includes('healer') ? `show` : `hide`} healer;fps gui role` }, { text: "&nbsp;&nbsp;" },
  154. { text: `<font color="${mod.settings.RolesBlacklist.includes('dps') ? GrnC : RedC}" size="+18" >[Dps-All]</font>`, command: `fps ${mod.settings.RolesBlacklist.includes('dps') ? `show` : `hide`} dps;fps gui role` }, { text: "&nbsp;&nbsp;" },
  155. { text: `<font color="${mod.settings.RolesBlacklist.includes('ranged') ? GrnC : RedC}" size="+18">[Dps-Ranged]</font><br><br><br><br>`, command: `fps ${mod.settings.RolesBlacklist.includes('ranged') ? `show` : `hide`} ranged;fps gui role` },
  156. { text: `<font color="${DBlC}" size="+22">By Classes</font><br><br>` },
  157. { text: `<font color="${YlwC}" size="+20">Tankers:</font>` }, { text: "&#09;&#09;" },
  158. { text: `<font color="${mod.settings.ClassesBlacklist.includes('lancer') ? GrnC : RedC}" size="+18">[Lancer]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('lancer') ? `show` : `hide`} lancer;fps gui role` }, { text: "&nbsp;&nbsp;" },
  159. { text: `<font color="${mod.settings.ClassesBlacklist.includes('brawler') ? GrnC : RedC}" size="+18">[Brawler]</font><br><br>`, command: `fps ${mod.settings.ClassesBlacklist.includes('brawler') ? `show` : `hide`} brawler;fps gui role` },
  160. { text: `<font color="${YlwC}" size="+20">Healers:</font>` }, { text: "&#09;&#09;" },
  161. { text: `<font color="${mod.settings.ClassesBlacklist.includes('priest') ? GrnC : RedC}" size="+18">[Priest]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('priest') ? `show` : `hide`} priest;fps gui role` }, { text: "&nbsp;&nbsp;" },
  162. { text: `<font color="${mod.settings.ClassesBlacklist.includes('mystic') ? GrnC : RedC}" size="+18">[Mystic]</font><br><br>`, command: `fps ${mod.settings.ClassesBlacklist.includes('mystic') ? `show` : `hide`} mystic;fps gui role` },
  163. { text: `<font color="${YlwC}" size="+20">Dpsers(melee):</font>` }, { text: "&#09;" },
  164. { text: `<font color="${mod.settings.ClassesBlacklist.includes('warrior') ? GrnC : RedC}" size="+18">[Warrior]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('warrior') ? `show` : `hide`} warrior;fps gui role` }, { text: "&nbsp;&nbsp;" },
  165. { text: `<font color="${mod.settings.ClassesBlacklist.includes('slayer') ? GrnC : RedC}" size="+18">[Slayer]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('slayer') ? `show` : `hide`} slayer;fps gui role` }, { text: "&nbsp;&nbsp;" },
  166. { text: `<font color="${mod.settings.ClassesBlacklist.includes('berserker') ? GrnC : RedC}" size="+18">[Berserker]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('berserker') ? `show` : `hide`} berserker;fps gui role` }, { text: "&nbsp;&nbsp;" },
  167. { text: `<font color="${mod.settings.ClassesBlacklist.includes('ninja') ? GrnC : RedC}" size="+18">[Ninja]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('ninja') ? `show` : `hide`} ninja;fps gui role` }, { text: "&nbsp;&nbsp;" },
  168. { text: `<font color="${mod.settings.ClassesBlacklist.includes('valkyrie') ? GrnC : RedC}" size="+18">[Valkyrie]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('valkyrie') ? `show` : `hide`} valkyrie;fps gui role` }, { text: "&nbsp;&nbsp;" },
  169. { text: `<font color="${mod.settings.ClassesBlacklist.includes('reaper') ? GrnC : RedC}" size="+18">[Reaper]</font><br><br>`, command: `fps ${mod.settings.ClassesBlacklist.includes('reaper') ? `show` : `hide`} reaper;fps gui role` },
  170. { text: `<font color="${YlwC}" size="+20">Dpsers(ranged):</font>` }, { text: "&#09;" },
  171. { text: `<font color="${mod.settings.ClassesBlacklist.includes('sorcerer') ? GrnC : RedC}" size="+18">[Sorcerer]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('sorcerer') ? `show` : `hide`} sorcerer;fps gui role` }, { text: "&nbsp;&nbsp;" },
  172. { text: `<font color="${mod.settings.ClassesBlacklist.includes('archer') ? GrnC : RedC}" size="+18">[Archer]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('archer') ? `show` : `hide`} archer;fps gui role` }, { text: "&nbsp;&nbsp;" },
  173. { text: `<font color="${mod.settings.ClassesBlacklist.includes('gunner') ? GrnC : RedC}" size="+18">[Gunner]</font>`, command: `fps ${mod.settings.ClassesBlacklist.includes('gunner') ? `show` : `hide`} gunner;fps gui role` }
  174. ], `<font color="${LPrC}">[FPS] Options - Roles/Classes</font>`)
  175. break;
  176. case "abn":
  177. TmpData = []
  178. TmpData.push(
  179. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br>`, command: "fps gui" },
  180. { text: `<font color="${AbnDebug ? GrnC : RedC}" size="+19"><p align="right">Debug</p></font><br>`, command: "fps abn log;fps gui abn" },
  181. { text: `<font color="${LPrC}" size="+19">Blacklist: </font><font color="${PnkC}" size="17+">Click to remove from the blacklist.</font><br>` }
  182. )
  183. mod.settings.AbnormalitiesBlacklist.forEach(abnmem => TmpData.push({ text: `<font color="${BnzC}" size="+16">${abnmem}<br></font>`, command: `fps abn blacklist remv ${abnmem};fps gui abn` }))
  184. gui.parse(TmpData, `<font color="${LPrC}">[FPS] Options - Abnormalities</font>`)
  185. TmpData = []
  186. break;
  187. case "proj":
  188. TmpData = []
  189. TmpData.push(
  190. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br>`, command: "fps gui" },
  191. { text: `<font color="${ProjDebug ? GrnC : RedC}" size="+19"><p align="right">Debug</p></font><br>`, command: "fps proj log;fps gui proj" },
  192. { text: `<font color="${LPrC}" size="+19">Blacklist: </font><font color="${PnkC}" size="17+">Click to remove from the blacklist.</font><br>` }
  193. )
  194. mod.settings.ProjectilesBlacklist.forEach(projmem => TmpData.push({ text: `<font color="${BnzC}" size="+16">${projmem}<br></font>`, command: `fps proj blacklist remv ${projmem};fps gui proj` }))
  195. gui.parse(TmpData, `<font color="${LPrC}">[FPS] Options - Projectiles</font>`)
  196. TmpData = []
  197. break;
  198. case "help":
  199. gui.parse([
  200. { text: mod.majorPatchVersion < 79 ? `<font color="${PnkC}" size="+15"><p align="right">The GUI is only visual in classic server, buttons doesn't work, thanks for understanding.</p></font><br>` : '' },
  201. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br>`, command: "fps gui" },
  202. { text: `<font size="20"><font color="${LBlC}">Command</font> <font color="${SlvC}">Arg(s)</font> <font color="${CPKC}">Example</font><br>` },
  203. { text: `<font color="${HBlC}">gui ^ g</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps gui</font><br>` },
  204. { text: `<font color="${HBlC}"> N/A</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps-util</font><br>` },
  205. { text: `<font color="${HBlC}">0 ^ 1 ^ 2 ^ 3</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!0 ^ !1 ^ !2 ^ !3</font><br>` },
  206. { text: `<font color="${HBlC}">mode</font> <font color="${DBlC}">0 ^ 1 ^ 2 ^ 3</font> <font color="${HPkC}">!fps mode 2</font><br>` },
  207. { text: `<font color="${HBlC}">hide^show</font> <font color="${DBlC}">Player^Class^Role</font> <font color="${HPkC}">!fps hide mie</font><br>` },
  208. { text: `<font color="${HBlC}">party</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps party</font><br>` },
  209. { text: `<font color="${HBlC}">raid</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps raid</font><br>` },
  210. { text: `<font color="${HBlC}">list</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps list</font><br>` },
  211. { text: `<font color="${HBlC}">sums</font> <font color="${DBlC}">other ^ me</font> <font color="${HPkC}">!fps sums me</font><br>` },
  212. { text: `<font color="${HBlC}">skill</font> <font color="${DBlC}">blacklist</font> <font color="${HPkC}">!fps skill blacklist</font><br>` },
  213. { text: `<font color="${HBlC}">npc</font> <font color="${DBlC}">N/A ^ hide</font> <font color="${HPkC}">!fps npc</font><br>` },
  214. { text: `<font color="${HBlC}">hit</font> <font color="${DBlC}">me^other^damage</font> <font color="${HPkC}">!fps hit me</font><br>` },
  215. { text: `<font color="${HBlC}">firework</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps firework</font><br>` },
  216. { text: `<font color="${HBlC}">abn</font> <font color="${DBlC}">all ^ blacklist</font> <font color="${HPkC}">!fps abn blacklist</font><br>` },
  217. { text: `<font color="${HBlC}">proj</font> <font color="${DBlC}">all ^ blacklist</font> <font color="${HPkC}">!fps proj all</font><br>` },
  218. { text: `<font color="${HBlC}">guildlogo</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps guildlogo</font><br>` },
  219. { text: `<font color="${HBlC}">style</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps style</font><br>` },
  220. { text: `<font color="${HBlC}">gui npcsearch</font> <font color="${DBlC}">"target"</font> <font color="${HPkC}">!fps gui npcsearch E</font><br>` },
  221. { text: `<font color="${HBlC}">npczoom</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps npczoom</font><br>` },
  222. { text: `<font color="${HBlC}">dropitem</font> <font color="${DBlC}">N/A ^ hide</font> <font color="${HPkC}">!fps dropitem</font><br>` },
  223. { text: `<font color="${HBlC}">monsterdeathani</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps monsterdeathani</font><br>` },
  224. { text: `<font color="${HBlC}">screenabns</font> <font color="${DBlC}">N/A ^ hide</font> <font color="${HPkC}">!fps screenabns</font><br>` },
  225. { text: `<font color="${HBlC}">hpnumbers</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps hpnumbers</font><br>` },
  226. { text: `<font color="${HBlC}">mpnumbers</font> <font color="${DBlC}">N/A</font> <font color="${HPkC}">!fps mpnumbers</font></font>` }
  227. ], `<font color="${LPrC}">[FPS] HELP</font>`)
  228. break;
  229. default:
  230. gui.parse([
  231. { text: mod.majorPatchVersion < 79 ? `<font color="${PnkC}" size="+15"><p align="right">The GUI is only visual in classic server, buttons doesn't work, thanks for understanding.</p></font><br>` : '' },
  232. { text: `<font color="${PrpC}" size="+15"><p align="right">REFRESH</p></font><br>`, command: "fps gui" },
  233. { text: `<font color="${YlwC}" size="+20">Modes:</font>` }, { text: "&#09;&#09;" },
  234. { text: `<font color="${mod.settings.Mode === 0 ? GrnC : RedC}" size="+18">[Mode 0]</font>`, command: "fps mode 0;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
  235. { text: `<font color="${mod.settings.Mode === 1 ? GrnC : RedC}" size="+18">[Mode 1]</font>`, command: "fps mode 1;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
  236. { text: `<font color="${mod.settings.Mode === 2 ? GrnC : RedC}" size="+18">[Mode 2]</font>`, command: "fps mode 2;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
  237. { text: `<font color="${mod.settings.Mode === 3 ? GrnC : RedC}" size="+18">[Mode 3]</font><br><br>`, command: "fps mode 3;fps gui" },
  238. { text: `<font color="${YlwC}" size="+20">Hit:</font>` }, { text: "&#09;&#09;&#09;" },
  239. { text: `<font color="${mod.settings.Hit_Other ? GrnC : RedC}" size="+18">[Players]</font>`, command: "fps hit other;fps gui" }, { text: "&nbsp;&nbsp;" },
  240. { text: `<font color="${mod.settings.Hit_Me ? GrnC : RedC}" size="+18">[Own]</font>`, command: "fps hit me;fps gui" }, { text: "&nbsp;&nbsp;" },
  241. { text: `<font color="${mod.settings.Hit_Damage ? GrnC : RedC}" size="+18">[Dmg/heal numbers]</font>`, command: "fps hit damage;fps gui" }, { text: "&nbsp;&nbsp;" },
  242. { text: `<font color="${mod.settings.Hit_All ? GrnC : RedC}" size="+18">[ALL]</font><br><br>`, command: "fps hit all;fps gui" },
  243. { text: `<font color="${YlwC}" size="+20">Hide:</font>` }, { text: "&#09;&#09;" },
  244. { text: `<font color="${LBlC}" size="+18">[Classes/Roles]</font>`, command: "fps gui role" }, { text: "&nbsp;&nbsp;&nbsp;" },
  245. { text: `<font color="${mod.settings.ShowStyle ? GrnC : RedC}" size="+18">[Style]</font>`, command: "fps style;fps gui" }, { text: "&nbsp;&nbsp;" },
  246. { text: `<font color="${mod.settings.Hideguildlogos ? GrnC : RedC}" size="+18">[Guild Logos]</font>`, command: "fps guildlogo;fps gui" }, { text: "&nbsp;&nbsp;" },
  247. { text: `<font color="${mod.settings.HideFireworks ? GrnC : RedC}" size="+18">[Fireworks]</font><br><br>`, command: "fps fireworks;fps gui" },
  248. { text: `<font color="${YlwC}" size="+20">Self(own):</font>` }, { text: "&#09;" },
  249. { text: `<font color="${mod.settings.HideHpNumbers ? GrnC : RedC}" size="+18">[HP Nums]</font>`, command: "fps hpnumbers;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;" },
  250. { text: `<font color="${mod.settings.HideMpNumbers ? GrnC : RedC}" size="+18">[MP Nums]</font>`, command: "fps mpnumbers;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;" },
  251. { text: `<font color="${mod.settings.HideMySummons ? GrnC : RedC}" size="+18">[Own summons]</font>`, command: "fps summons me;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;" },
  252. { text: `<font color="${mod.settings.HideOwnBlacklistedAbns ? GrnC : RedC}" size="+18">[Blur/dizzy]</font><br>`, command: "fps screenabns;fps gui" },
  253. { text: `<font color="${YlwC}" size="+20">Players:</font>` }, { text: "&#09;&#09;" },
  254. { text: `<font color="${LBlC}" size="+18">[Spawned list]</font>`, command: "fps gui show" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
  255. { text: `<font color="${LBlC}" size="+18">[Hidden list]</font>`, command: "fps gui hide" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
  256. { text: `<font color="${mod.settings.HideOthersSummons ? GrnC : RedC}" size="+18">[Players summons]</font><br>`, command: "fps summons;fps gui" },
  257. { text: `<font color="${YlwC}" size="+20">NPCs:</font>` }, { text: "&#09;&#09;" },
  258. { text: `<font color="${LBlC}" size="+18">[Menu]</font>`, command: "fps gui npcmain" }, { text: "&nbsp;&nbsp;" },
  259. { text: `<font color="${mod.settings.HideMonsterDeathAnimation ? GrnC : RedC}" size="+18">[Hide Death Ani]</font>`, command: "fps monsterdeathani;fps gui" }, { text: "&nbsp;&nbsp;" },
  260. { text: `<font color="${mod.settings.ActionScripts ? GrnC : RedC}" size="+18">[Zoom-ins]</font>`, command: "fps npczoom;fps gui" }, { text: "&nbsp;&nbsp;" },
  261. { text: `<font color="${mod.settings.HideBlacklistedNpcs ? GrnC : RedC}" size="+18">[Hide Blacklisted]</font><br><br>`, command: "fps npc;fps gui" },
  262. { text: `<font color="${YlwC}" size="+20">Skills:</font>` }, { text: "&#09;&#09;" },
  263. { text: `<font color="${LBlC}" size="+18">[Hide individually]</font>`, command: "fps gui skills" }, { text: "&nbsp;&nbsp;&nbsp;" },
  264. { text: `<font color="${mod.settings.HideBlacklistedSkills ? GrnC : RedC}" size="+18">[Hide Blacklisted]</font><br>`, command: "fps skill blacklist;fps gui" },
  265. { text: `<font color="${YlwC}" size="+20">Abnormal:</font>` }, { text: "&#09;" },
  266. { text: `<font color="${mod.settings.HideAllAbnormalities ? GrnC : RedC}" size="+18">[Hide ALL]</font>`, command: "fps abn all;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;" },
  267. { text: `<font color="${mod.settings.HideBlacklistedAbnormalities ? GrnC : RedC}" size="+18">[Hide Blacklisted]</font>`, command: "fps abn blacklist;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;" },
  268. { text: `<font color="${LBlC}" size="+18">[Black List]</font><br>`, command: "fps gui abn" },
  269. { text: `<font color="${YlwC}" size="+20">Projectile:</font>` }, { text: "&#09;" },
  270. { text: `<font color="${mod.settings.HideAllProjectiles ? GrnC : RedC}" size="+18">[Hide ALL]</font>`, command: "fps proj all;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;" },
  271. { text: `<font color="${mod.settings.HideBlacklistedProjectiles ? GrnC : RedC}" size="+18">[Hide Blacklisted]</font>`, command: "fps proj blacklist;fps gui" }, { text: "&nbsp;&nbsp;&nbsp;" },
  272. { text: `<font color="${LBlC}" size="+18">[Black List]</font><br><br>`, command: "fps gui proj" },
  273. { text: `<font color="${YlwC}" size="+20">Misc.</font>` }, { text: "&#09;&#09;" },
  274. { text: `<font color="${mod.settings.RaidAutoChange ? GrnC : RedC}" size="+18">[Raid auto state]</font>`, command: "fps raid;fps gui" }, { text: "&nbsp;&nbsp;" },
  275. { text: `<font color="${mod.settings.OnlyParty ? GrnC : RedC}" size="+18">[Only Party]</font>`, command: "fps party;fps gui" }, { text: "&nbsp;&nbsp;" },
  276. { text: `<font color="${mod.settings.HideBlacklistedDrop ? GrnC : RedC}" size="+18">[Drops BList]</font>`, command: "fps dropitem;fps gui" }, { text: "&nbsp;&nbsp;" },
  277. { text: `<font color="${mod.settings.PvpTraps ? GrnC : RedC}" size="+17">[Show Traps]</font><br><br><br>`, command: "fps pvptraps;fps gui" },
  278. { text: `<font color="${BluC}" size="+22">Quick Links:</font><br>` },
  279. { text: `<font color="${YlwC}" size="+20">UI:</font>` }, { text: "&#09;&#09;" },
  280. { text: `<font color="${PrpC}" size="+17">[Mail]</font>`, command: "fps quicklink parcel" }, { text: "&nbsp;&nbsp;&nbsp;" },
  281. { text: `<font color="${PrpC}" size="+17">[Broker]</font>`, command: "fps quicklink broker" }, { text: "&nbsp;&nbsp;&nbsp;" },
  282. { text: `<font color="${PrpC}" size="+17">[Talent]</font>`, command: "fps quicklink talents" }, { text: "&nbsp;&nbsp;&nbsp;" },
  283. { text: `<font color="${PrpC}" size="+17">[Dress]</font>`, command: "fps quicklink dressingroom" }, { text: "&nbsp;&nbsp;&nbsp;" },
  284. { text: `<font color="${PrpC}" size="+17">[Hat Style]</font>`, command: "fps quicklink hatrestyle" }, { text: "&nbsp;&nbsp;&nbsp;" },
  285. { text: `<font color="${PrpC}" size="+17">[Search-Engine]</font><br>`, command: "fps quicklink searchengine" },
  286. { text: `<font color="${YlwC}" size="+20">Party:</font>` }, { text: "&#09;" },
  287. { text: `<font color="${CPKC}" size="+18">[Reset]</font>`, command: "fps quicklink reset" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
  288. { text: `<font color="${CPKC}" size="+18">[Leave]</font>`, command: "fps quicklink drop" }, { text: "&nbsp;&nbsp;&nbsp;&nbsp;" },
  289. { text: `<font color="${CPKC}" size="+18">[Disband]</font><br>`, command: "fps quicklink disband" },
  290. { text: `<font color="${YlwC}" size="+20">System:</font>` }, { text: "&#09;" },
  291. { text: `<font color="${CPKC}" size="+18">[Character Selection]</font>`, command: "fps quicklink lobby" }, { text: "&#09;&#09;&#09;&#09;" },
  292. { text: `<font color="${CPKC}" size="+18">[!! Instant Exit !!]</font><br>`, command: "fps quicklink instantexit" }
  293. ], `<font color="${LPrC}">[FPS] Options</font> | <font color="${RedC}" size="+16">Red</font><font color="${LPrC}" size="+16"> = disabled, <font color="${GrnC}" size="+16">Green</font><font color="${LPrC}" size="+16"> = enabled</font>`)
  294. }
  295. }
  296. // ~~~ * Gui Functions * ~~~ \\
  297. function SkillJsonSearch(value) {
  298. let keys = [],
  299. skilldata = [],
  300. skillIds = []
  301. skilldata.push(
  302. { text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br>`, command: "fps gui" },
  303. { text: `<font color="${mod.settings.HideBlacklistedSkills ? GrnC : RedC}" size="+22"><p align="right">[Blacklisted skills are ${mod.settings.HideBlacklistedSkills ? 'Hidden' : 'Shown'}]</p></font><br>`, command: "fps skill blacklist;fps gui skills" },
  304. { text: `<font color="${LBlC}" size="+19">Click skill to blacklist it.</font><br>` }
  305. )
  306. for (let key in SkillData[value]) {
  307. keys.push(key);
  308. }
  309. skillIds.push(Object.values(SkillData[value]))
  310. for (let i = 0; i < keys.length; i++) {
  311. skilldata.push({ command: `fps skill class ${value} ${skillIds[0][i]};fps gui class ${value}`, text: `<font color="${mod.settings.ClassesData[ClassNameFromID(value)].CD_SkillsBlacklist.includes(skillIds[0][i].toString()) ? GrnC : RedC}" size="+17">[${keys[i]}]</font><br>` })
  312. }
  313. return skilldata
  314. }
  315. function NpcJsonSearch(nameKey, array, arg, title) {
  316. TmpData = []
  317. TmpData.push({ text: `<font color="${PrpC}" size="+24"><p align="right">MAIN MENU</p></font><br><br>`, command: "fps gui" })
  318. for (let i = 0; i < array.length; i++) {
  319. if (array[i].Nm.startsWith(nameKey) && arg === "starts") TmpData.push({ command: `fps npc hide ${array[i].Hz} ${array[i].Ti};fps gui npc ${nameKey}`, text: `<font color="${mod.settings.NpcsBlacklist.some(arrVal => array[i].Hz == arrVal.zone && array[i].Ti == arrVal.templateId) ? GrnC : RedC}" size="+17">${array[i].Nm}</font><br>` });
  320. if (array[i].Nm.includes(nameKey) && arg === "search") TmpData.push({ command: `fps npc hide ${array[i].Hz} ${array[i].Ti};fps gui npcsearch ${nameKey}`, text: `<font color="${mod.settings.NpcsBlacklist.some(arrVal => array[i].Hz == arrVal.zone && array[i].Ti == arrVal.templateId) ? GrnC : RedC}" size="+17">${array[i].Nm} </font><br>` });
  321. }
  322. gui.parse(TmpData, `<font color="${LPrC}">[FPS] Options - NPCs</font> | ${title}`)
  323. TmpData = []
  324. }
  325. function ClassNameFromID(name) {
  326. for (const Class_data of Object.keys(mod.settings.ClassesData)) {
  327. if (mod.settings.ClassesData[Class_data].name == name) return Class_data;
  328. }
  329. }
  330. // ~~~ * Command Functions * ~~~ \\
  331. function Msg(msg) {
  332. if (NotCP) mod.command.message(`<font color="${LPrC}">[FPS] ${msg}</font>`);
  333. else mod.command.message(`<font color="${LPrC}">${msg}</font>`);
  334. }
  335. function RemoveEntity(name) {
  336. let what, A = arguments, Al = A.length, Ax;
  337. while (Al > 1 && name.length) {
  338. what = A[--Al];
  339. while ((Ax = name.indexOf(what)) !== -1) name.splice(Ax, 1);
  340. }
  341. return name;
  342. }
  343. function HideSpecificPlayer(name) {
  344. for (let i in SUsers) {
  345. if (SUsers[i].name.toString().toLowerCase() === name.toLowerCase()) {
  346. mod.toClient('S_DESPAWN_USER', 3, { gameId: SUsers[i].gameId, type: 1 });
  347. HUsers[SUsers[i].gameId] = SUsers[i];
  348. return;
  349. }
  350. }
  351. }
  352. function HideSpecificNpc(hz, ti) {
  353. for (let i in SNpcs) {
  354. if (SNpcs[i].huntingZoneId === hz && SNpcs[i].templateId === ti) {
  355. mod.toClient('S_DESPAWN_NPC', 3, { gameId: SNpcs[i].gameId, loc: SNpcs[i].loc, type: 1, unk: 0 })
  356. HNpcs[SNpcs[i].gameId] = SNpcs[i];
  357. HNpcs[SNpcs[i].gameId].spawnType = 1;
  358. HNpcs[SNpcs[i].gameId].spawnScript = 0;
  359. }
  360. }
  361. }
  362. function ShowSpecificPlayer(name) {
  363. for (let i in HUsers) {
  364. if (HUsers[i].name.toString().toLowerCase() === name.toLowerCase()) {
  365. ModifyUserAppearance(HUsers[i]);
  366. mod.toClient('S_SPAWN_USER', 14, HUsers[i]);
  367. delete HUsers[i];
  368. }
  369. }
  370. }
  371. function ShowSpecificNpc(hz, ti) {
  372. for (let i in HNpcs) {
  373. if (HNpcs[i].huntingZoneId === hz && HNpcs[i].templateId === ti) {
  374. mod.toClient('S_SPAWN_NPC', 11, HNpcs[i]);
  375. delete HNpcs[i];
  376. }
  377. }
  378. }
  379. function HideAllPlayers() {
  380. if (!mod.settings.OnlyParty) {
  381. for (let i in SUsers) {
  382. mod.toClient('S_DESPAWN_USER', 3, { gameId: SUsers[i].gameId, type: 1 });
  383. HUsers[SUsers[i].gameId] = SUsers[i];
  384. HUsers[SUsers[i].gameId].spawnFx = 1;
  385. }
  386. }
  387. }
  388. function HideNpcs(type) {
  389. switch (type) {
  390. case 'own':
  391. for (let k in SNpcs) {
  392. if (EqGid(SNpcs[k].owner) && UserNPCs.includes(SNpcs[k].templateId) && SNpcs[k].huntingZoneId === 1023) {
  393. mod.toClient('S_DESPAWN_NPC', 3, { gameId: SNpcs[k].gameId, loc: SNpcs[k].loc, type: 1, unk: 0 })
  394. HNpcs[SNpcs[k].gameId] = SNpcs[k];
  395. }
  396. }
  397. break;
  398. case 'others':
  399. for (let k in SNpcs) {
  400. if (!EqGid(SNpcs[k].owner) && UserNPCs.includes(SNpcs[k].templateId) && SNpcs[k].huntingZoneId === 1023) {
  401. mod.toClient('S_DESPAWN_NPC', 3, { gameId: SNpcs[k].gameId, loc: SNpcs[k].loc, type: 1, unk: 0 })
  402. HNpcs[SNpcs[k].gameId] = SNpcs[k];
  403. }
  404. }
  405. break;
  406. case 'bl':
  407. for (let k in SNpcs) {
  408. for (let i = 0; i < mod.settings.NpcsBlacklist.length; i++) {
  409. if (SNpcs[k].huntingZoneId == mod.settings.NpcsBlacklist[i].zone && SNpcs[k].templateId == mod.settings.NpcsBlacklist[i].templateId) {
  410. mod.toClient('S_DESPAWN_NPC', 3, { gameId: SNpcs[k].gameId, loc: SNpcs[k].loc, type: 1, unk: 0 })
  411. HNpcs[SNpcs[k].gameId] = SNpcs[k];
  412. }
  413. }
  414. }
  415. break;
  416. default: break;
  417. }
  418. }
  419. function ShowNpcs(type) {
  420. switch (type) {
  421. case 'own':
  422. for (let v in HNpcs) {
  423. if (EqGid(HNpcs[v].owner) && UserNPCs.includes(HNpcs[v].templateId) && HNpcs[v].huntingZoneId === 1023) {
  424. mod.toClient('S_SPAWN_NPC', 11, HNpcs[v]);
  425. delete HNpcs[v];
  426. }
  427. }
  428. break;
  429. case 'others':
  430. for (let v in HNpcs) {
  431. if (!EqGid(HNpcs[v].owner) && UserNPCs.includes(HNpcs[v].templateId) && HNpcs[v].huntingZoneId === 1023) {
  432. mod.toClient('S_SPAWN_NPC', 11, HNpcs[v]);
  433. delete HNpcs[v];
  434. }
  435. }
  436. break;
  437. case 'bl':
  438. for (let v in HNpcs) {
  439. for (let i = 0; i < mod.settings.NpcsBlacklist.length; i++) {
  440. if (HNpcs[v].huntingZoneId == mod.settings.NpcsBlacklist[i].zone && HNpcs[v].templateId == mod.settings.NpcsBlacklist[i].templateId) {
  441. mod.toClient('S_SPAWN_NPC', 11, HNpcs[v]);
  442. delete HNpcs[v];
  443. }
  444. }
  445. }
  446. break;
  447. default: break;
  448. }
  449. }
  450. function ShowAllPlayers() {
  451. for (let i in HUsers) {
  452. ModifyUserAppearance(HUsers[i]);
  453. mod.toClient('S_SPAWN_USER', 14, HUsers[i]);
  454. delete HUsers[i];
  455. }
  456. }
  457. // ~~~ * Functions * ~~~ \\
  458. function ModifyUserAppearance(event) {
  459. let modified = false;
  460. if (mod.settings.ShowStyle) {
  461. event.weapon = event.body = event.hand = event.feet = event.underwear = event.head = event.face = 0;
  462. if (event.mount) event.mount = 16; //231; The mount 231 doesn't exist in classic server.
  463. if (mod.settings.Hideguildlogos) event.guildLogoId = 0;
  464. if (mod.majorPatchVersion >= 79) event.title = 0; //!classic
  465. // event.weaponModel = event.bodyModel = event.handModel = event.feetModel // TODO;
  466. event.weaponDye = event.bodyDye = event.handDye = event.feetDye = event.weaponEnchant = 0;
  467. event.showFace = false;
  468. event.styleHead = event.styleFace = event.styleBack = event.styleWeapon = event.styleBody = 0;
  469. if (mod.majorPatchVersion >= 79) event.underwearDye = event.styleBackDye = event.styleHeadDye = event.styleFaceDye = 0; //!classic
  470. event.showStyle = false;
  471. if (mod.majorPatchVersion >= 79) { //!classic
  472. event.styleFootprint = event.styleHeadScale = event.styleFaceScale = event.styleBackScale = 0;
  473. event.usedStyleHeadTransform = false;
  474. }
  475. event.styleBodyDye = 0;
  476. event.icons = [];
  477. modified = true;
  478. }
  479. if (mod.settings.Hideguildlogos) {
  480. event.guildLogo = '';
  481. event.guildLogoId = 0;
  482. modified = true;
  483. }
  484. return modified;
  485. }
  486. function ModifySkillResult(event) {
  487. let modified = false;
  488. if (mod.settings.Hit_Me && (EqGid(event.source) || EqGid(event.owner))) {
  489. event.templateId = 10101;
  490. event.skill.id = 10100;
  491. event.time = 0;
  492. event.crit = false;
  493. modified = true;
  494. }
  495. if (mod.settings.Hit_Other && !EqGid(event.target) && !EqGid(event.source) && !EqGid(event.owner) && (SUsers[event.owner] || SUsers[event.source])) {
  496. event.templateId = 10101;
  497. event.skill.id = 10100;
  498. event.time = 0;
  499. event.crit = false;
  500. modified = true;
  501. }
  502. if (mod.settings.Hit_Damage && (EqGid(event.source) || EqGid(event.owner) || UserNPCs.includes(event.templateId) && event.skill.huntingZoneId === 1023)) {
  503. event.id = event.type = event.noctEffect = event.reaction.skill.id = 0;
  504. if (NotCP) event.damage = 0; else event.value = 0;
  505. event.crit = event.stackExplode = false;
  506. if (mod.majorPatchVersion >= 79) if (NotCP) event.blocked = false; else event.superArmor = false; //!classic
  507. modified = true;
  508. }
  509. if (mod.settings.Hit_All) {
  510. event.id = event.type = event.noctEffect = event.reaction.skill.id = 0;
  511. if (NotCP) event.damage = 0; else event.value = 0;
  512. event.crit = event.stackExplode = false;
  513. if (mod.majorPatchVersion >= 79) if (NotCP) event.blocked = false; else event.superArmor = false; //!classic
  514. event.target = 0;
  515. modified = true;
  516. }
  517. return modified ? true : undefined;
  518. }
  519. function NpcBCheck(event) {
  520. let blocked = false;
  521. //if (mod.settings.ShowStyle) event.repairable = false;
  522. if (mod.settings.HideBlacklistedNpcs) {
  523. for (let i = 0; i < mod.settings.NpcsBlacklist.length; i++) {
  524. if (event.huntingZoneId == mod.settings.NpcsBlacklist[i].zone && event.templateId == mod.settings.NpcsBlacklist[i].templateId) {
  525. HNpcs[event.gameId] = event;
  526. HNpcs[event.gameId].spawnType = 1;
  527. HNpcs[event.gameId].spawnScript = 0;
  528. blocked = true;
  529. break;
  530. }
  531. }
  532. }
  533. if (InvisibleNpcs[event.huntingZoneId] && InvisibleNpcs[event.huntingZoneId].includes(event.templateId)) {
  534. HNpcs[event.gameId] = event;
  535. blocked = true;
  536. }
  537. if (mod.settings.HideFireworks && event.huntingZoneId === 1023 && [60016000, 80037000].includes(event.templateId)) {
  538. HNpcs[event.gameId] = event;
  539. blocked = true;
  540. }
  541. if (UserNPCs.includes(event.templateId) && event.huntingZoneId === 1023) {
  542. if (EqGid(event.owner) && mod.settings.HideMySummons) {
  543. HNpcs[event.gameId] = event;
  544. HNpcs[event.gameId].spawnType = 1;
  545. HNpcs[event.gameId].spawnScript = 0;
  546. blocked = true;
  547. } else if (!EqGid(event.owner) && mod.settings.HideOthersSummons) {
  548. HNpcs[event.gameId] = event;
  549. HNpcs[event.gameId].spawnType = 1;
  550. HNpcs[event.gameId].spawnScript = 0;
  551. blocked = true;
  552. }
  553. }
  554. return blocked;
  555. }
  556. function EqGid(xg) {
  557. return (xg === MyGameId)
  558. }
  559. function ClassID(m) {
  560. return (m % 100)
  561. }
  562. function log(name, type, from, target, id) {
  563. console.log(`[\x1b[37m${new Date().toJSON().slice(11)}\x1b[39m] \x1b[91m->\x1b[39m \x1b[36m${name}\x1b[39m \x1b[35m${type}\x1b[39m \x1b[97m${from}\x1b[39m \x1b[32m'${target}'\x1b[39m: \x1b[94m\ID\x1b[39m "\x1b[31m${id}\x1b[39m\x1b[49m\x1b[0m"`);
  564. }
  565. function UpdateUserLoc(event) {
  566. mod.toClient('S_USER_LOCATION', 5, { gameId: event.gameId, loc: event.loc, w: event.w, speed: 300, dest: event.loc, type: 7 });
  567. }
  568. // ~~~ * Hook Functions * ~~~ \\
  569. function sLogin(event) {
  570. LastState = event.name === MyName ? LastState : null;
  571. MyGameId = event.gameId;
  572. MyName = event.name;
  573. MyPlayerId = event.playerId;
  574. ProjDebug = false;
  575. AbnDebug = false;
  576. AllowedAchUps = 2;
  577. }
  578. function sLoadTopo() {
  579. SUsers = {};
  580. SNpcs = {};
  581. HUsers = {};
  582. HNpcs = {};
  583. AllowedAchUps = 1;
  584. if (ProjDebug) {
  585. ProjDebug = false
  586. Msg(`<font color="${HPkC}">Auto Disabled</font> projectile debug, to reduce the unneeded spam.`)
  587. }
  588. if (AbnDebug) {
  589. AbnDebug = false
  590. Msg(`<font color="${HPkC}">Auto Disabled</font> abnormalities debug, to reduce the unneeded spam.`)
  591. }
  592. }
  593. function sLeaveParty() {
  594. PMembers = []
  595. if (mod.settings.RaidAutoChange) {
  596. if (!LastState || mod.settings.Mode !== 2) return;
  597. mod.command.exec(`fps mode ${LastState}`)
  598. LastState = null;
  599. }
  600. }
  601. function sMountVehicle(event) {
  602. if (EqGid(event.gameId)) return;
  603. SUsers[event.gameId].mount = event.id
  604. if (HUsers[event.gameId]) HUsers[event.gameId].mount = event.id;
  605. if (mod.settings.ShowStyle) {
  606. event.id = 16; //231;
  607. return true;
  608. }
  609. }
  610. function sUnmountVehicle(event) {
  611. if (EqGid(event.gameId)) return;
  612. SUsers[event.gameId].mount = 0
  613. if (HUsers[event.gameId]) HUsers[event.gameId].mount = 0;
  614. }
  615. function cSetVisibleRange(event) {
  616. LastVrange = event.range
  617. }
  618. function sStartCooltimeItem(event) {
  619. if (event.cooldown === 0) return false;
  620. }
  621. function sStartActionScript(event) {
  622. if ([40000, 40001, 40002].includes(event.script)) return;
  623. if (mod.settings.ActionScripts) return false;
  624. }
  625. function sPcBangInventory(event) {
  626. for (const Item of event.inventory)
  627. if ([152898, 184659, 201005, 201006, 201007, 201008, 201022, 855604].includes(Item.item)) {
  628. Item.cooldown = 0;
  629. return true;
  630. }
  631. }
  632. function sLoadingScreenControlInfo() {
  633. if (mod.settings.Mode >= 2) return false;
  634. }
  635. function sUpdateAchievementProgress(event) {
  636. if (AllowedAchUps) { AllowedAchUps--; return; }
  637. for (const Achieve of event.achievements) if (SpamAchIds.indexOf(Achieve.id) > -1) return false;
  638. }
  639. function sItemCustomString(event) {
  640. if (event.customStrings.length === 0) return false;
  641. }
  642. function sGuildName(event) {
  643. if (mod.settings.Hideguildlogos) {
  644. event.guildEmblem = '';
  645. return true;
  646. }
  647. }
  648. function sApplyTitle(event) {
  649. if (EqGid(event.gameId)) return;
  650. if (mod.settings.ShowStyle) return false;
  651. }
  652. function sImageData() {
  653. if (mod.settings.Hideguildlogos) return false;
  654. }
  655. function sSpawnUser(event) {
  656. SUsers[event.gameId] = event;
  657. SUsers[event.gameId].spawnFx = 1;
  658. if (mod.settings.Mode === 3 || mod.settings.PlayersBlacklist.includes(event.name) || mod.settings.ClassesData[ClassID(event.templateId)].isHidden || (mod.settings.OnlyParty && !PMembers.includes(event.name))) {
  659. HUsers[event.gameId] = event;
  660. HUsers[event.gameId].spawnFx = 1;
  661. return false;
  662. }
  663. if (ModifyUserAppearance(event)) return true;
  664. }
  665. function sSpawnUserfn(event) {
  666. if (ModifyUserAppearance(event)) return true;
  667. }
  668. function sDespawnUser(event) {
  669. delete HUsers[event.gameId];
  670. delete SUsers[event.gameId];
  671. }
  672. function sUserLocation(event) {
  673. if (SUsers[event.gameId]) {
  674. SUsers[event.gameId].loc = event.dest
  675. SUsers[event.gameId].w = event.w
  676. }
  677. if (HUsers[event.gameId]) {
  678. HUsers[event.gameId].loc = event.dest;
  679. HUsers[event.gameId].w = event.w
  680. return false;
  681. }
  682. }
  683. function sUserStatus(event) {
  684. if (SUsers[event.gameId]) SUsers[event.gameId].status = event.status
  685. if (HUsers[event.gameId]) {
  686. HUsers[event.gameId].status = event.status
  687. return false;
  688. }
  689. }
  690. function sDeadLocation(event) {
  691. if (SUsers[event.gameId]) SUsers[event.gameId].loc = event.loc
  692. if (HUsers[event.gameId]) HUsers[event.gameId].loc = event.loc
  693. }
  694. function sUserMoveType() { return false; }
  695. function sPartyMemberList(event) {
  696. event.members.map(value => PMembers.push(value.name))
  697. if (mod.settings.RaidAutoChange) {
  698. if (event.members.length >= 18) {
  699. if (mod.settings.Mode === 3 || (LastState && mod.settings.Mode === 2)) return;
  700. LastState = mod.settings.Mode
  701. mod.command.exec("fps mode 2")
  702. } else {
  703. if (!LastState || mod.settings.Mode !== 2) {
  704. LastState = null;
  705. return;
  706. }
  707. mod.command.exec(`fps mode ${LastState}`)
  708. LastState = null;
  709. }
  710. }
  711. }
  712. function sUserAppearanceChange(event) {
  713. if (EqGid(event.id)) return;
  714. if (mod.settings.ShowStyle) return false;
  715. }
  716. function sUserExternalChange(event) {
  717. if (EqGid(event.gameId)) return;
  718. if (mod.settings.ShowStyle) return false;
  719. }
  720. function sUnicastTransformData(event) {
  721. if (!event.gameId || EqGid(event.gameId)) return;
  722. if (mod.settings.ShowStyle) return false;
  723. if (mod.settings.Hideguildlogos) {
  724. event.guildLogo = '';
  725. return true;
  726. }
  727. }
  728. function sSpawnNpc(event) {
  729. SNpcs[event.gameId] = event;
  730. SNpcs[event.gameId].spawnType = 1;
  731. SNpcs[event.gameId].spawnScript = 0;
  732. if (NpcBCheck(event)) return false;
  733. //if (mod.settings.ShowStyle) { event.repairable = false; return true; } // partially... This option is not only used for the icons above npcs heads, but it's used also for showing the whole shape of some npcs, e.g. bahaar & glsh. :\
  734. }
  735. function sDespawnNpc(event) {
  736. delete HNpcs[event.gameId];
  737. delete SNpcs[event.gameId];
  738. if (!mod.settings.HideMonsterDeathAnimation || event.type !== 5) return;
  739. event.type = 1;
  740. return true;
  741. }
  742. function sNpcLocation(event) {
  743. if (SNpcs[event.gameId]) {
  744. SNpcs[event.gameId].loc = event.dest
  745. SNpcs[event.gameId].w = event.w
  746. }
  747. if (HNpcs[event.gameId]) {
  748. HNpcs[event.gameId].loc = event.dest
  749. HNpcs[event.gameId].w = event.w
  750. return false;
  751. }
  752. }
  753. function sCreatureRotate(event) {
  754. if (SNpcs[event.gameId]) SNpcs[event.gameId].w = event.w
  755. if (HNpcs[event.gameId]) {
  756. HNpcs[event.gameId].w = event.w
  757. return false;
  758. }
  759. }
  760. function sFearMoveStage(event) {
  761. if ((!EqGid(event.target) && mod.settings.Mode >= 1) || HUsers[event.target] || HNpcs[event.target]) return false;
  762. }
  763. function sFearMoveEnd(event) {
  764. if ((!EqGid(event.target) && mod.settings.Mode >= 1) || HUsers[event.target] || HNpcs[event.target]) return false;
  765. }
  766. function sAbnormalityBegin(event) {
  767. if (AbnDebug) {
  768. if (EqGid(event.target)) log('Abnormality', 'Applied', 'on', MyName, event.id)
  769. if (EqGid(event.source)) log('Abnormality', 'Started', 'from', MyName, event.id)
  770. if (SUsers[event.target]) log('Abnormality', 'Applied', 'on', SUsers[event.target].name, event.id)
  771. if (SUsers[event.source]) log('Abnormality', 'Started', 'from', SUsers[event.source].name, event.id)
  772. }
  773. if (ImportantAbns.includes(event.id)) return;
  774. if (EqGid(event.target)) {
  775. if (mod.settings.HideOwnBlacklistedAbns && mod.settings.OwnAbnormalsBlacklist.includes(event.id)) return false;
  776. return;
  777. }
  778. if (HUsers[event.target] || HNpcs[event.target]) return false;
  779. if (event.id === 9943049) return false;
  780. if (mod.settings.HideBlacklistedAbnormalities && mod.settings.AbnormalitiesBlacklist.includes(event.id)) return false;
  781. if (mod.settings.HideAllAbnormalities && (SUsers[event.target] || SUsers[event.source] || mod.settings.AbnormalitiesBlacklist.includes(event.id))) return false;
  782. }
  783. function sAbnormalityRefresh(event) {
  784. if (ImportantAbns.includes(event.id)) return;
  785. if (HUsers[event.target] || HNpcs[event.target]) return false;
  786. if ((mod.settings.HideBlacklistedAbnormalities || mod.settings.HideAllAbnormalities) && (SUsers[[10306, 10316, 12001, 12003, 22040, 12120, 12130].includes(event.target)] || SUsers[[10306, 10316, 12001, 12003, 22040, 12120, 12130].includes(event.source)])) return false;
  787. }
  788. function sAbnormalityEnd(event) {
  789. if (event.id === 9943049) return false;
  790. }
  791. function sAbnormalityFail(event) {
  792. if ([3000021, 99020000, 99020010].includes(event.id)) return false;
  793. }
  794. function sActionStage(event) {
  795. if (EqGid(event.gameId) || !SUsers[event.gameId]) return;
  796. if ((mod.settings.Mode >= 2) || HUsers[event.gameId] || (mod.settings.HideBlacklistedSkills && mod.settings.ClassesData[ClassID(event.templateId)].CD_SkillsBlacklist.includes(Math.floor(event.skill.id / 10000).toString())) || mod.settings.ClassesData[ClassID(event.templateId)].CD_HideBlacklistedSkills) {
  797. UpdateUserLoc(event);
  798. return false;
  799. }
  800. }
  801. function sStartUserProjectile(event) {
  802. if (ProjDebug) {
  803. if (EqGid(event.gameId)) log('Projectile', 'Started', 'from', MyName, event.skill.id)
  804. if (SUsers[event.gameId]) log('Projectile', 'Started', 'from', SUsers[event.gameId].name, event.skill.id)
  805. }
  806. if (mod.settings.PvpTraps && TrapsIds.includes(event.skill.id)) return;
  807. if ((mod.settings.HideBlacklistedProjectiles || mod.settings.HideAllProjectiles) && mod.settings.ProjectilesBlacklist.includes(event.skill.id)) return false;
  808. if (!EqGid(event.gameId) && SUsers[event.gameId] && (HUsers[event.gameId] || mod.settings.Mode >= 2 || mod.settings.HideAllProjectiles)) return false;
  809. }
  810. function sSpawnProjectile(event) {
  811. if (event.skill.npc) return;
  812. if (ProjDebug) {
  813. if (EqGid(event.gameId)) log('Projectile', 'Spawned', 'from', MyName, event.skill.id)
  814. if (SUsers[event.gameId]) log('Projectile', 'Spawned', 'from', SUsers[event.gameId].name, event.skill.id)
  815. }
  816. if (mod.settings.PvpTraps && TrapsIds.includes(event.skill.id)) return;
  817. if ((mod.settings.HideBlacklistedProjectiles || mod.settings.HideAllProjectiles) && mod.settings.ProjectilesBlacklist.includes(event.skill.id)) return false;
  818. if (!EqGid(event.gameId) && SUsers[event.gameId] && (HUsers[event.gameId] || mod.settings.Mode >= 2 || mod.settings.HideAllProjectiles)) return false;
  819. }
  820. function sPlayerChangeMp(event) {
  821. if (!mod.settings.HideMpNumbers || !EqGid(event.target)) return;
  822. if (event.type !== 0) {
  823. event.type = 0;
  824. return true;
  825. }
  826. }
  827. function sCreatureChangeHp(event) {
  828. if (!mod.settings.HideHpNumbers || !EqGid(event.target)) return;
  829. if (event.type !== 10) {
  830. event.type = 10;
  831. return true;
  832. }
  833. }
  834. function sEachSkillResult(event) {
  835. return ModifySkillResult(event);
  836. }
  837. function sSpawnDropItem(event) {
  838. if (EqGid(event.source)) return;
  839. if (mod.settings.HideBlacklistedDrop) {
  840. for (let i in event.owners) {
  841. if (event.owners[i].playerId.toString() === MyPlayerId.toString()) return;
  842. }
  843. if (mod.settings.DropBlacklist.includes(event.item)) return false;
  844. }
  845. if (mod.settings.Mode >= 2) {
  846. event.explode = 0;
  847. return true;
  848. }
  849. }
  850. function sFontSwapInfo() {
  851. if (mod.settings.Hit_Damage || mod.settings.Hit_All) return false;
  852. }
  853. // ~~~ * Packet Hooks * ~~~ \\
  854. const Last_Hook = { order: 100010 }
  855. const Last_Hookfn = { order: 100010, filter: { fake: null } };
  856. if (mod.majorPatchVersion >= 79) {
  857. mod.hook('S_DEAD_LOCATION', 2, sDeadLocation)
  858. mod.hook('S_USER_MOVETYPE', 'raw', Last_Hook, sUserMoveType)
  859. mod.hook('S_UNICAST_TRANSFORM_DATA', 5, Last_Hook, sUnicastTransformData)
  860. mod.hook('S_USER_APPEARANCE_CHANGE', 1, Last_Hookfn, sUserAppearanceChange)
  861. mod.hook('S_USER_EXTERNAL_CHANGE', 7, Last_Hookfn, sUserExternalChange)
  862. mod.hook('S_FONT_SWAP_INFO', 'raw', sFontSwapInfo)
  863. }
  864. mod.hook('S_LOGIN', 12, sLogin)
  865. mod.hook('S_LOAD_TOPO', 'raw', sLoadTopo)
  866. mod.hook('S_LEAVE_PARTY', 'raw', sLeaveParty)
  867. mod.hook('S_MOUNT_VEHICLE', 2, sMountVehicle)
  868. mod.hook('S_UNMOUNT_VEHICLE', 2, sUnmountVehicle)
  869. mod.hook('C_SET_VISIBLE_RANGE', 1, cSetVisibleRange)
  870. mod.hook('S_START_COOLTIME_ITEM', 1, sStartCooltimeItem)
  871. mod.hook('S_START_ACTION_SCRIPT', 3, sStartActionScript)
  872. mod.hook('S_PCBANGINVENTORY_DATALIST', 1, sPcBangInventory)
  873. mod.hook('S_LOADING_SCREEN_CONTROL_INFO', 'raw', sLoadingScreenControlInfo)
  874. mod.hook('S_UPDATE_ACHIEVEMENT_PROGRESS', 1, Last_Hookfn, sUpdateAchievementProgress)
  875. mod.hook('S_ITEM_CUSTOM_STRING', 2, sItemCustomString)
  876. mod.hook('S_GUILD_NAME', 1, sGuildName)
  877. mod.hook('S_APPLY_TITLE', 2, sApplyTitle)
  878. mod.hook('S_IMAGE_DATA', 'raw', sImageData)
  879. mod.hook('S_SPAWN_USER', 14, Last_Hook, sSpawnUser)
  880. mod.hook('S_SPAWN_USER', 14, Last_Hookfn, sSpawnUserfn)
  881. mod.hook('S_DESPAWN_USER', 3, Last_Hook, sDespawnUser)
  882. mod.hook('S_USER_LOCATION', 5, sUserLocation)
  883. mod.hook('S_USER_STATUS', 3, sUserStatus)
  884. //'S_DEAD_LOCATION
  885. //'S_USER_MOVETYPE'
  886. mod.hook('S_PARTY_MEMBER_LIST', 7, sPartyMemberList)
  887. //'S_USER_APPEARANCE_CHANGE
  888. //'S_USER_EXTERNAL_CHANGE' meh, I can't figure out this definition for classic sth is messed up dunno why. :\
  889. //'S_UNICAST_TRANSFORM_DATA'
  890. mod.hook('S_SPAWN_NPC', 11, sSpawnNpc)
  891. mod.hook('S_DESPAWN_NPC', 3, sDespawnNpc)
  892. mod.hook('S_NPC_LOCATION', 3, sNpcLocation)
  893. mod.hook('S_CREATURE_ROTATE', 2, sCreatureRotate)
  894. mod.hook('S_FEARMOVE_STAGE', 1, sFearMoveStage)
  895. mod.hook('S_FEARMOVE_END', 1, sFearMoveEnd)
  896. mod.hook('S_ABNORMALITY_BEGIN', 3, Last_Hook, sAbnormalityBegin)
  897. mod.hook('S_ABNORMALITY_REFRESH', 1, Last_Hook, sAbnormalityRefresh)
  898. mod.hook('S_ABNORMALITY_FAIL', 1, sAbnormalityFail)
  899. mod.hook('S_ABNORMALITY_END', 1, sAbnormalityEnd)
  900. mod.hook('S_ACTION_STAGE', 9, Last_Hook, sActionStage)
  901. mod.hook('S_SPAWN_PROJECTILE', 5, Last_Hook, sSpawnProjectile)
  902. mod.hook('S_START_USER_PROJECTILE', 9, Last_Hook, sStartUserProjectile)
  903. mod.hook('S_PLAYER_CHANGE_MP', 1, sPlayerChangeMp)
  904. mod.hook('S_CREATURE_CHANGE_HP', 6, sCreatureChangeHp)
  905. mod.hook('S_EACH_SKILL_RESULT', NotCP ? 12 : 13, Last_Hook, sEachSkillResult)
  906. mod.hook('S_SPAWN_DROPITEM', 6, sSpawnDropItem)
  907. //'S_FONT_SWAP_INFO'
  908. // ~~~ * Commands * ~~~ \\
  909. mod.command.add('0', () => mod.command.exec('fps mode 0'))
  910. mod.command.add('1', () => mod.command.exec('fps mode 1'))
  911. mod.command.add('2', () => mod.command.exec('fps mode 2'))
  912. mod.command.add('3', () => mod.command.exec('fps mode 3'))
  913. mod.command.add(['fps', '!fps', 'fps-utils', '!fps-utils'], (key, arg, arg2, arg3) => {
  914. switch (key) {
  915. case "g":
  916. case "gui":
  917. GuiHandler(arg, arg2);
  918. break;
  919. case "0":
  920. mod.command.exec('fps mode 0');
  921. break;
  922. case "1":
  923. mod.command.exec('fps mode 1');
  924. break;
  925. case "2":
  926. mod.command.exec('fps mode 2')
  927. break;
  928. case "3":
  929. mod.command.exec('fps mode 3');
  930. break;
  931. case "mod":
  932. case "mode":
  933. case "state":
  934. switch (arg) {
  935. case "0":
  936. case "off":
  937. case "zero":
  938. if (mod.settings.Mode === 3) ShowAllPlayers();
  939. mod.settings.Mode = 0;
  940. mod.settings.HideAllAbnormalities = false;
  941. mod.settings.HideAllProjectiles = false;
  942. mod.settings.Hit_Other = false;
  943. Msg(`<font color="${RedC}">Mode 0</font>.`);
  944. break;
  945. case "1":
  946. case "one":
  947. if (mod.settings.Mode === 3) ShowAllPlayers();
  948. mod.settings.Mode = 1;
  949. mod.settings.HideAllAbnormalities = false;
  950. mod.settings.HideAllProjectiles = true;
  951. mod.settings.Hit_Other = true;
  952. Msg(`<font color="${BnzC}">Mode 1</font>.`);
  953. break;
  954. case "2":
  955. case "two":
  956. if (mod.settings.Mode === 3) ShowAllPlayers();
  957. mod.settings.Mode = 2;
  958. mod.settings.HideAllAbnormalities = true;
  959. mod.settings.HideAllProjectiles = true;
  960. mod.settings.Hit_Other = true;
  961. Msg(`<font color="${SlvC}">Mode 2</font>.`);
  962. break;
  963. case "3":
  964. case "three":
  965. HideAllPlayers();
  966. mod.settings.Mode = 3;
  967. mod.settings.HideAllAbnormalities = true;
  968. mod.settings.HideAllProjectiles = true;
  969. mod.settings.Hit_Other = true;
  970. mod.settings.OnlyParty = false;
  971. Msg(`<font color="${GldC}">Mode 3</font>.`);
  972. break;
  973. default:
  974. Msg(`<font color="${GryC}">Invalid" ${arg}"</font>.`);
  975. Msg(`Modes: "<font color="${PnkC}">[0, 1, 2, 3]</font>.`);
  976. break;
  977. }
  978. break;
  979. case "hide":
  980. if (typeof arg === "string" && arg !== null) {
  981. if (mod.settings.PlayersBlacklist.includes(arg)) return Msg(`Player '${arg}' <font color="${RedC}">Already hidden</font>.`);
  982. else
  983. if ((mod.settings.ClassesNames.includes(arg) && !mod.settings.ClassesBlacklist.includes(arg)) || (mod.settings.RolesNames.includes(arg) && !mod.settings.RolesBlacklist.includes(arg))) {
  984. for (let i in mod.settings.ClassesData) {
  985. if ((mod.settings.ClassesData[i].name === arg || mod.settings.ClassesData[i].role.includes(arg)) && mod.settings.ClassesData[i].isHidden !== true) {
  986. mod.settings.ClassesData[i].isHidden = true;
  987. if (mod.settings.ClassesData[i].name === arg) mod.settings.ClassesBlacklist.push(arg);
  988. if (mod.settings.ClassesData[i].role.includes(arg)) mod.settings.RolesBlacklist.push(arg);
  989. let classtohide = mod.settings.ClassesData[i].model;
  990. for (let i in SUsers) { if (ClassID(SUsers[i].templateId) === classtohide) HideSpecificPlayer(SUsers[i].name); }
  991. }
  992. }
  993. Msg(`Class/Role ${arg} <font color="${GrnC}">Hidden</font>.`);
  994. return;
  995. } else if (mod.settings.ClassesBlacklist.includes(arg) || mod.settings.RolesBlacklist.includes(arg)) return Msg(`Class/Role '${arg}' <font color="${RedC}">Already hidden</font>.`);
  996. Msg(`Player '${arg}' <font color="${GrnC}">Hidden</font>.`);
  997. mod.settings.PlayersBlacklist.push(arg);
  998. HideSpecificPlayer(arg);
  999. } else Msg(`<font color="${GryC}">Invalid ${arg2}</font>.`);
  1000. break;
  1001. case "show":
  1002. if (typeof arg === "string" && arg !== null) {
  1003. if (mod.settings.PlayersBlacklist.includes(arg)) {
  1004. ShowSpecificPlayer(arg);
  1005. RemoveEntity(mod.settings.PlayersBlacklist, arg);
  1006. Msg(`Player '${arg}' <font color="${RedC}">Shown</font>.`);
  1007. return;
  1008. }
  1009. if ((mod.settings.ClassesNames.includes(arg) && mod.settings.ClassesBlacklist.includes(arg)) || (mod.settings.RolesBlacklist.includes(arg) && mod.settings.RolesNames.includes(arg))) {
  1010. for (let i in mod.settings.ClassesData) {
  1011. if (mod.settings.ClassesData[i].name === arg || mod.settings.ClassesData[i].role.includes(arg)) {
  1012. if (mod.settings.ClassesData[i].name === arg) RemoveEntity(mod.settings.ClassesBlacklist, arg);
  1013. if (mod.settings.ClassesData[i].role.includes(arg)) RemoveEntity(mod.settings.RolesBlacklist, arg);
  1014. mod.settings.ClassesData[i].isHidden = false;
  1015. let classToShow = mod.settings.ClassesData[i].model;
  1016. for (let i in HUsers) {
  1017. if (ClassID(HUsers[i].templateId) === classToShow) ShowSpecificPlayer(HUsers[i].name);
  1018. }
  1019. }
  1020. }
  1021. Msg(`Class '${arg}' <font color="${RedC}">Shown</font>.`);
  1022. } else if (!mod.settings.ClassesBlacklist.includes(arg) || !mod.settings.RolesBlacklist.includes(arg)) Msg(`Class/Role '${arg}' <font color="${RedC}">Already shown</font>.`);
  1023. else if (!mod.settings.PlayersBlacklist.includes(arg)) Msg(`Player '${arg}' <font color="${RedC}">Already shown</font>.`);
  1024. else Msg(`<font color="${GryC}">Invalid ${arg2}</font>.`);
  1025. }
  1026. break;
  1027. case "party":
  1028. if (mod.settings.Mode === 3) return Msg(`<font color="${RedC}">You've to disable mode 3 first</font>.`);
  1029. mod.settings.OnlyParty = !mod.settings.OnlyParty
  1030. if (mod.settings.OnlyParty) {
  1031. for (let i in SUsers) {
  1032. if (!PMembers.includes(SUsers[i].name)) {
  1033. mod.toClient('S_DESPAWN_USER', 3, { gameId: SUsers[i].gameId, type: 1 })
  1034. HUsers[SUsers[i].gameId] = SUsers[i];
  1035. }
  1036. }
  1037. } else ShowAllPlayers();
  1038. Msg(`Everyone but party ${mod.settings.OnlyParty ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1039. break;
  1040. case "raid":
  1041. mod.settings.RaidAutoChange = !mod.settings.RaidAutoChange
  1042. Msg(`Raid auto-state ${mod.settings.RaidAutoChange ? `<font color="${GrnC}">Enabled</font>` : `<font color="${RedC}">Disabled</font>`}.`);
  1043. break;
  1044. case "pvptraps":
  1045. mod.settings.PvpTraps = !mod.settings.PvpTraps;
  1046. Msg(`Pvp Traps are ${mod.settings.PvpTraps ? `<font color="${GrnC}">Shown<font color="${PnkC}">(not affected by hide all projectiles)</font></font>` : `<font color="${RedC}">Normal<font color="${PnkC}">(affected by hide all projectiles)</font></font>`}.`);
  1047. break;
  1048. case "list":
  1049. Msg(`<font color="${PnkC}">Hidden players: ${mod.settings.PlayersBlacklist}</font>.`);
  1050. Msg(`<font color="${PnkC}">Hidden classes: ${mod.settings.ClassesBlacklist}</font>.`);
  1051. Msg(`<font color="${PnkC}">Hidden roles: ${mod.settings.RolesBlacklist}</font>.`);
  1052. break;
  1053. case "summons":
  1054. case "sums":
  1055. switch (arg) {
  1056. case "me":
  1057. mod.settings.HideMySummons = !mod.settings.HideMySummons;
  1058. mod.settings.HideMySummons ? HideNpcs('own') : ShowNpcs('own');
  1059. Msg(`Own summoned NPCs ${mod.settings.HideMySummons ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1060. break;
  1061. default:
  1062. mod.settings.HideOthersSummons = !mod.settings.HideOthersSummons;
  1063. mod.settings.HideOthersSummons ? HideNpcs('others') : ShowNpcs('others');
  1064. Msg(`Others summoned NPCs ${mod.settings.HideOthersSummons ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1065. break;
  1066. }
  1067. break;
  1068. case "skills":
  1069. case "skill":
  1070. switch (arg) {
  1071. case "blacklist":
  1072. mod.settings.HideBlacklistedSkills = !mod.settings.HideBlacklistedSkills;
  1073. Msg(`Blacklisted skills ${mod.settings.HideBlacklistedSkills ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1074. break;
  1075. case "class":
  1076. if (mod.settings.ClassesNames.includes(arg2)) {
  1077. for (let i in mod.settings.ClassesData) {
  1078. if (mod.settings.ClassesData[i].name === arg2) {
  1079. if (arg3 != null && !isNaN(arg3) && arg3 < 50) {
  1080. if (mod.settings.ClassesData[i].CD_SkillsBlacklist.includes(arg3)) {
  1081. let index = mod.settings.ClassesData[i].CD_SkillsBlacklist.indexOf(arg3)
  1082. if (index !== -1) {
  1083. mod.settings.ClassesData[i].CD_SkillsBlacklist.splice(index, 1)
  1084. Msg(`Skill ID '${arg3}' <font color="${RedC}">Shown</font> for class '${arg2}'.`)
  1085. }
  1086. return;
  1087. } else {
  1088. mod.settings.ClassesData[i].CD_SkillsBlacklist.push(arg3)
  1089. Msg(`Skill ID '${arg3}' <font color="${GrnC}">Hidden</font> for class '${arg2}'.`)
  1090. return;
  1091. }
  1092. } else {
  1093. mod.settings.ClassesData[i].CD_HideBlacklistedSkills = !mod.settings.ClassesData[i].CD_HideBlacklistedSkills;
  1094. Msg(`Skills for '${arg2}' class ${mod.settings.ClassesData[i].CD_HideBlacklistedSkills ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1095. return;
  1096. }
  1097. }
  1098. }
  1099. } else Msg(`<font color="${RedC}">Class ${arg2} not found</font>.`);
  1100. break;
  1101. }
  1102. break;
  1103. case "npcs":
  1104. case "npc":
  1105. if (arg === 'hide') {
  1106. if (!arg2 || !arg3) {
  1107. mod.settings.HideBlacklistedNpcs = !mod.settings.HideBlacklistedNpcs;
  1108. Msg(`Blacklisted NPCs ${mod.settings.HideBlacklistedNpcs ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1109. break;
  1110. }
  1111. let found = mod.settings.NpcsBlacklist.some(s => s.zone === arg2 && s.templateId === arg3);
  1112. if (found) {
  1113. if (mod.settings.HideBlacklistedNpcs) ShowSpecificNpc(Number(arg2), Number(arg3));
  1114. Msg(`NPC HntZone '${arg2}', TmpId '${arg3}' <font color="${RedC}">Removed from the blacklist</font>.`)
  1115. mod.settings.NpcsBlacklist = mod.settings.NpcsBlacklist.filter(obj => obj.zone != arg2 || obj.templateId != arg3);
  1116. } else {
  1117. if (mod.settings.HideBlacklistedNpcs) HideSpecificNpc(Number(arg2), Number(arg3));
  1118. Msg(`NPC HntZone '${arg2}', TmpId '${arg3}' <font color="${GrnC}">Added to the blacklist</font>.`)
  1119. mod.settings.NpcsBlacklist.push({ zone: arg2, templateId: arg3 })
  1120. }
  1121. return;
  1122. } else {
  1123. mod.settings.HideBlacklistedNpcs = !mod.settings.HideBlacklistedNpcs;
  1124. mod.settings.HideBlacklistedNpcs ? HideNpcs('bl') : ShowNpcs('bl');
  1125. Msg(`Blacklisted NPCs ${mod.settings.HideBlacklistedNpcs ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1126. }
  1127. break;
  1128. case "hit":
  1129. switch (arg) {
  1130. case "me":
  1131. if (mod.settings.Hit_All) return Msg(`<font color="${RedC}">You've to disable hit ALL first</font>.`);
  1132. mod.settings.Hit_Me = !mod.settings.Hit_Me;
  1133. Msg(`Own hits effect ${mod.settings.Hit_Me ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1134. break;
  1135. case "other":
  1136. if (mod.settings.Hit_All) return Msg(`<font color="${RedC}">You've to disable hit ALL first</font>.`);
  1137. mod.settings.Hit_Other = !mod.settings.Hit_Other;
  1138. Msg(`Players hit effect ${mod.settings.Hit_Other ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1139. break;
  1140. case "damage":
  1141. if (mod.settings.Hit_All) return Msg(`<font color="${RedC}">You've to disable hit ALL first</font>.`);
  1142. mod.settings.Hit_Damage = !mod.settings.Hit_Damage;
  1143. Msg(`Damage numbers ${mod.settings.Hit_Damage ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1144. break;
  1145. case "all":
  1146. mod.settings.Hit_Me = mod.settings.Hit_Other = mod.settings.Hit_Damage = false;
  1147. mod.settings.Hit_All = !mod.settings.Hit_All;
  1148. Msg(`Hit all ${mod.settings.Hit_All ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1149. break;
  1150. default:
  1151. Msg(`<font color="${GryC}">Invalid &#40;hit&#41; '${arg}'</font>.`);
  1152. break;
  1153. }
  1154. break;
  1155. case "fireworks":
  1156. case "firework":
  1157. mod.settings.HideFireworks = !mod.settings.HideFireworks;
  1158. Msg(`Fireworks ${mod.settings.HideFireworks ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1159. break;
  1160. case "abn":
  1161. case "effects":
  1162. case "abnormal":
  1163. case "abnormalities":
  1164. switch (arg) {
  1165. case "all":
  1166. mod.settings.HideAllAbnormalities = !mod.settings.HideAllAbnormalities;
  1167. Msg(`All Abnormalities ${mod.settings.HideAllAbnormalities ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1168. break;
  1169. case "blacklist":
  1170. if (!arg2 || !arg3) {
  1171. mod.settings.HideBlacklistedAbnormalities = !mod.settings.HideBlacklistedAbnormalities;
  1172. Msg(`Blacklisted Abnormalities ${mod.settings.HideBlacklistedAbnormalities ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1173. break;
  1174. } else if (arg2 && arg3) {
  1175. arg3 = Number(arg3);
  1176. if (!mod.settings.AbnormalitiesBlacklist.includes(arg3)) {
  1177. if (arg2 === 'add') {
  1178. mod.settings.AbnormalitiesBlacklist.push(arg3)
  1179. Msg(`Blacklisted Abnormalities <font color="${GrnC}">added '${arg3}'</font>..`)
  1180. return;
  1181. } else if (arg2 === 'remv') return Msg(`Blacklisted Abnormalities <font color="${RedC}">can't remove '${arg3}' as it's not there</font>.`);
  1182. } else if (mod.settings.AbnormalitiesBlacklist.includes(arg3)) {
  1183. if (arg2 === 'add') return Msg(`Blacklisted Abnormalities <font color="${RedC}">can't add '${arg3}' as it's already there</font>.`);
  1184. else if (arg2 === 'remv') {
  1185. let index = mod.settings.AbnormalitiesBlacklist.indexOf(arg3)
  1186. if (index !== -1) {
  1187. mod.settings.AbnormalitiesBlacklist.splice(index, 1)
  1188. Msg(`Blacklisted Abnormalities <font color="${RedC}">removed '${arg3}'</font>.`);
  1189. return;
  1190. }
  1191. }
  1192. } else return Msg(`<font color="${GryC}">Invalid &#40;abnormalities Blacklist&#41; '${arg}'</font>.`);
  1193. }
  1194. break;
  1195. case "log":
  1196. case "debug":
  1197. AbnDebug = !AbnDebug;
  1198. if (AbnDebug) Msg(`Abnormalities debug <font color="${GrnC}">started</font>, check your proxy console for details.`)
  1199. else Msg(`Abnormalities debug <font color="${RedC}">stopped</font>.`);
  1200. break;
  1201. default:
  1202. Msg(`<font color="${GryC}">Invalid &#40;abnormalities&#41; '${arg}'</font>.`);
  1203. break;
  1204. }
  1205. break;
  1206. case "guildlogo":
  1207. if (SwitchCd) return Msg(`<font color="${PnkC}">Try again in 3 seconds</font>.`);
  1208. mod.settings.Hideguildlogos = !mod.settings.Hideguildlogos;
  1209. mod.toServer('C_SET_VISIBLE_RANGE', 1, { range: 0 });
  1210. setTimeout(() => mod.toServer('C_SET_VISIBLE_RANGE', 1, { range: LastVrange }), 1500);
  1211. SwitchCd = true;
  1212. setTimeout(() => SwitchCd = false, 2800);
  1213. Msg(`Guild Logos ${mod.settings.Hideguildlogos ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1214. break;
  1215. case "costume":
  1216. case "style":
  1217. if (SwitchCd) return Msg(`<font color="${PnkC}">Try again in 3 seconds</font>.`);
  1218. mod.settings.ShowStyle = !mod.settings.ShowStyle;
  1219. mod.toServer('C_SET_VISIBLE_RANGE', 1, { range: 0 })
  1220. setTimeout(() => mod.toServer('C_SET_VISIBLE_RANGE', 1, { range: LastVrange }), 1500);
  1221. SwitchCd = true
  1222. setTimeout(() => SwitchCd = false, 2800);
  1223. Msg(`Style of NPCs & others ${mod.settings.ShowStyle ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1224. break;
  1225. case "proj":
  1226. case "projectile":
  1227. switch (arg) {
  1228. case "all":
  1229. mod.settings.HideAllProjectiles = !mod.settings.HideAllProjectiles;
  1230. Msg(`Projectiles ${mod.settings.HideAllProjectiles ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1231. break;
  1232. case "blacklist":
  1233. if (!arg2 || !arg3) {
  1234. mod.settings.HideBlacklistedProjectiles = !mod.settings.HideBlacklistedProjectiles;
  1235. Msg(`Blacklisted projectile ${mod.settings.HideBlacklistedProjectiles ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1236. break;
  1237. } else if (arg2 && arg3) {
  1238. arg3 = Number(arg3);
  1239. if (!mod.settings.ProjectilesBlacklist.includes(arg3)) {
  1240. if (arg2 === 'add') {
  1241. mod.settings.ProjectilesBlacklist.push(arg3)
  1242. Msg(`Blacklisted projectile <font color="${GrnC}">added '${arg3}'</font>.`)
  1243. return;
  1244. } else if (arg2 === 'remv') return Msg(`Blacklisted projectile <font color="${RedC}">can't remove '${arg3}' as it's not there</font>.`);
  1245. } else if (mod.settings.ProjectilesBlacklist.includes(arg3)) {
  1246. if (arg2 === 'add') return Msg(`Blacklisted projectile <font color="${RedC}">can't add '${arg3}' as it's already there</font>.`);
  1247. else if (arg2 === 'remv') {
  1248. let index = mod.settings.ProjectilesBlacklist.indexOf(arg3)
  1249. if (index !== -1) {
  1250. mod.settings.ProjectilesBlacklist.splice(index, 1)
  1251. Msg(`Blacklisted projectile <font color="${RedC}">removed '${arg3}'</font>.`)
  1252. return;
  1253. }
  1254. }
  1255. } else return Msg(`<font color="${GryC}">Invalid &#40;projectile Blacklist&#41; '${arg}'</font>.`);
  1256. }
  1257. break;
  1258. case "log":
  1259. case "debug":
  1260. ProjDebug = !ProjDebug
  1261. if (ProjDebug) Msg(`Projectile debug <font color="${GrnC}">started</font>, check your proxy console for details.`)
  1262. else Msg(`Projectile debug <font color="${RedC}">stopped</font>.`);
  1263. break;
  1264. default:
  1265. Msg(`<font color="${GryC}">Invalid &#40;projectile&#41; '${arg}'</font>.`);
  1266. break;
  1267. }
  1268. break;
  1269. case "quicklink":
  1270. switch (arg) {
  1271. case "mail": case "parcel":
  1272. mod.toServer('C_REQUEST_CONTRACT', 1, { type: 8 });
  1273. break;
  1274. case "talent": case "talents":
  1275. if (mod.majorPatchVersion < 79) return; //classic
  1276. mod.toServer('C_REQUEST_CONTRACT', 1, { type: 77 });
  1277. break;
  1278. case "broker":
  1279. mod.toClient('S_NPC_MENU_SELECT', 1, { type: 28 });
  1280. break;
  1281. case "dress": case "dressingroom":
  1282. if (mod.majorPatchVersion < 79) return; //classic
  1283. mod.toServer('C_REQUEST_CONTRACT', 1, { type: 76 });
  1284. break;
  1285. case "hat": case "hatrestyle":
  1286. if (mod.majorPatchVersion < 79) return; //classic
  1287. mod.toServer('C_REQUEST_CONTRACT', 1, { type: 90 });
  1288. break;
  1289. case "lobby":
  1290. mod.toServer('C_RETURN_TO_LOBBY', 1, {});
  1291. break;
  1292. case "exit": case "instantexit":
  1293. mod.toClient('S_EXIT', 3, { category: 0, code: 0 });
  1294. break;
  1295. case "drop":
  1296. mod.toServer('C_LEAVE_PARTY', 1, {});
  1297. break;
  1298. case "disband":
  1299. mod.toServer('C_DISMISS_PARTY', 1, {});
  1300. break;
  1301. case "reset":
  1302. mod.toServer('C_RESET_ALL_DUNGEON', 1, {});
  1303. break;
  1304. case "searchengine":
  1305. mod.toClient('S_SHOW_AWESOMIUMWEB_SHOP', 1, { link: 'https://start.duckduckgo.com/' });
  1306. break;
  1307. default:
  1308. Msg(`<font color="${GryC}">Invalid &#40;quicklink&#41; '${arg}'</font>.`);
  1309. break;
  1310. }
  1311. break;
  1312. case "npczoom":
  1313. mod.settings.ActionScripts = !mod.settings.ActionScripts;
  1314. Msg(`Npc zoom-ins ${mod.settings.ActionScripts ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1315. break;
  1316. case "dropitem":
  1317. if (arg === 'hide') {
  1318. if (!arg2) {
  1319. mod.settings.HideBlacklistedDrop = !mod.settings.HideBlacklistedDrop;
  1320. Msg(`Blacklisted Drops ${mod.settings.HideBlacklistedDrop ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1321. break;
  1322. }
  1323. arg2 = Number(arg2);
  1324. let found = mod.settings.DropBlacklist.some(s => s === arg2);
  1325. if (found) {
  1326. Msg(`Drops id '${arg2}' <font color="${RedC}">Removed from the blacklist</font>.`)
  1327. mod.settings.DropBlacklist = mod.settings.DropBlacklist.filter(obj => obj != arg2)
  1328. } else {
  1329. Msg(`Drops id '${arg2}' <font color="${GrnC}">Added to the blacklist</font>.`)
  1330. mod.settings.DropBlacklist.push(arg2)
  1331. }
  1332. return;
  1333. } else mod.settings.HideBlacklistedDrop = !mod.settings.HideBlacklistedDrop;
  1334. Msg(`Blacklisted Drops ${mod.settings.HideBlacklistedDrop ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1335. break;
  1336. case "monsterdeathani":
  1337. case "monstersdeathani":
  1338. mod.settings.HideMonsterDeathAnimation = !mod.settings.HideMonsterDeathAnimation;
  1339. Msg(`Monsters Death Animation is ${mod.settings.HideMonsterDeathAnimation ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1340. break;
  1341. case "screenabns":
  1342. if (arg === 'hide') {
  1343. if (!arg2) {
  1344. mod.settings.HideOwnBlacklistedAbns = !mod.settings.HideOwnBlacklistedAbns;
  1345. Msg(`Blacklisted ScreenAbns ${mod.settings.OwnAbnormalsBlacklist ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1346. break;
  1347. }
  1348. arg2 = Number(arg2);
  1349. let found = mod.settings.OwnAbnormalsBlacklist.some(m => m === arg2);
  1350. if (found) {
  1351. Msg(`Abnormal id '${arg2}' <font color="${RedC}">Removed from the blacklist</font>.`)
  1352. mod.settings.OwnAbnormalsBlacklist = mod.settings.OwnAbnormalsBlacklist.filter(obj => obj != arg2);
  1353. } else {
  1354. Msg(`Abnormal id '${arg2}' <font color="${GrnC}">Added to the blacklist</font>.`)
  1355. mod.settings.OwnAbnormalsBlacklist.push(arg2)
  1356. }
  1357. return;
  1358. } else mod.settings.HideOwnBlacklistedAbns = !mod.settings.HideOwnBlacklistedAbns;
  1359. Msg(`Blacklisted ScreenAbns ${mod.settings.HideOwnBlacklistedAbns ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`);
  1360. break;
  1361. case "hpnumbers":
  1362. mod.settings.HideHpNumbers = !mod.settings.HideHpNumbers;
  1363. Msg(`Own Hp numbers ${mod.settings.HideHpNumbers ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`)
  1364. break;
  1365. case "mpnumbers":
  1366. mod.settings.HideMpNumbers = !mod.settings.HideMpNumbers;
  1367. Msg(`Own Mp numbers ${mod.settings.HideMpNumbers ? `<font color="${GrnC}">Hidden</font>` : `<font color="${RedC}">Shown</font>`}.`)
  1368. break;
  1369. case "help":
  1370. mod.command.exec("fps gui help");
  1371. break;
  1372. default:
  1373. Msg(`<font color="${RedC}">Unknown command, check command list</font>.`);
  1374. mod.command.exec("fps gui help");
  1375. break;
  1376. }
  1377. if (!NotCP) mod.saveSettings();
  1378. })
  1379. }