index.js 77 KB

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