index.js 74 KB

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