-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
1 lines (1 loc) · 15 KB
/
index.js
1
"use strict";module.exports=function C(d){let s=[],l=false,m={},o=[],r=[],g=[],c=[],f=[],u=[],b=[],t=-1,a=null,n=false,h=null;const i={444:[2201],3037:[2201]};const p={3105:[1e3],3205:[1e3],444:[1e3,1001,2e3,2001],3037:[1e3,1001,2e3,2001],2105:[1e3,1001,1002,1003,2e3],3102:[1e3,1001,1002,1003],3202:[1e3,1001,1002,1003]};d.command.add("autoheal",e=>{if(e)e=e.toLowerCase();if(e==null){d.settings.autoHeal=!d.settings.autoHeal}else if(e==="off"){d.settings.autoHeal=false}else if(e==="on"){d.settings.autoHeal=true}else if(e==="debug"){l=!l;d.command.message("Debug "+(l?"enabled":"disabled"));return}else if(e==="test"){y(0);return}else if(!isNaN(e)){d.settings.autoHeal=true;d.settings.hpCutoff=e<0?0:e>100?100:e}else{d.command.message(e+" is an invalid argument");return}d.command.message("Healing "+(d.settings.autoHeal?"enabled ("+d.settings.hpCutoff+"%)":"disabled"))});d.command.add("autocleanse",e=>{if(e)e=e.toLowerCase();if(e==null){d.settings.autoCleanse=!d.settings.autoCleanse}else if(e==="off"){d.settings.autoCleanse=false}else if(e==="on"){d.settings.autoCleanse=true}else{d.command.message(e+" is an invalid argument for cleanse command");return}d.command.message("Cleansing "+(d.settings.autoCleanse?"enabled":"disabled"))});d.command.add("autocast",e=>{if(e)e=e.toLowerCase();if(e==null){d.settings.autoCast=!d.settings.autoCast}else if(e==="off"){d.settings.autoCast=false}else if(e==="on"){d.settings.autoCast=true}else{d.command.message(e+" is an invalid argument for cast command");return}d.command.message("Casting "+(d.settings.autoCast?"enabled":"disabled"))});d.command.add("autodebuff",e=>{if(e)e=e.toLowerCase();if(e==null){d.settings.autoDebuff=!d.settings.autoDebuff}else if(e==="off"){d.settings.autoDebuff=false}else if(e==="on"){d.settings.autoDebuff=true}else{d.command.message(e+" is an invalid argument for cast command");return}d.command.message("Debuffing "+(d.settings.autoCast?"enabled":"disabled"))});d.command.add("autopriest",e=>{if(e)e=e.toLowerCase();if(e==null){d.command.message("UwU Hi you cute healer. These are your priest settings!");d.command.message("FH"+" : "+(d.settings.enablePriestFH?"enabled":"disabled"));d.command.message("HI"+" : "+(d.settings.enablePriestHI?"enabled":"disabled"));d.command.message("Plague"+" : "+(d.settings.enablePriestPlague?"enabled":"disabled"));d.command.message("Sleep"+" : "+(d.settings.enablePriestSleep?"enabled":"disabled"));d.command.message("EStars"+" : "+(d.settings.enablePriestES?"enabled":"disabled"))}else if(e=="fh"||e=="focus"){d.settings.enablePriestFH=!d.settings.enablePriestFH;d.command.message(e+" : "+(d.settings.enablePriestFH?"enabled":"disabled"))}else if(e=="hi"||e=="immersion"||e=="imm"||e=="healing"){d.settings.enablePriestHI=!d.settings.enablePriestHI;d.command.message(e+" : "+(d.settings.enablePriestHI?"enabled":"disabled"))}else if(e=="plague"||e=="poe"){d.settings.enablePriestPlague=!d.settings.enablePriestPlague;d.command.message(e+" : "+(d.settings.enablePriestPlague?"enabled":"disabled"))}else if(e=="sleep"){d.settings.enablePriestSleep=!d.settings.enablePriestSleep;d.command.message(e+" : "+(d.settings.enablePriestSleep?"enabled":"disabled"))}else if(e=="es"||e=="energy"||e=="estars"){d.settings.enablePriestES=!d.settings.enablePriestES;d.command.message(e+" : "+(d.settings.enablePriestES?"enabled":"disabled"))}else{d.command.message("UGGA BOOGA PEEPOPOOPEE~");d.command.message("Go read commands pepega")}});d.command.add("automystic",e=>{if(e)e=e.toLowerCase();if(e==null){d.command.message("UwU Hi you cute healer. These are your mystic settings!");d.command.message("TF"+" : "+(d.settings.enableMysticTF?"enabled":"disabled"));d.command.message("Cleanse"+" : "+(d.settings.enableMysticACT?"enabled":"disabled"));d.command.message("Sleep"+" : "+(d.settings.enableMysticSleep?"enabled":"disabled"));d.command.message("Volley"+" : "+(d.settings.enableMysticVoC?"enabled":"disabled"));d.command.message("Contagion"+" : "+(d.settings.enableMysticCont?"enabled":"disabled"));d.command.message("Wrath"+" : "+(d.settings.enableMysticToW?"enabled":"disabled"))}else if(e=="tf"){d.settings.enableMysticTF=!d.settings.enableMysticTF;d.command.message(e+" : "+(d.settings.enableMysticTF?"enabled":"disabled"))}else if(e=="act"){d.settings.enableMysticACT=!d.settings.enableMysticACT;d.command.message(e+" : "+(d.settings.enableMysticACT?"enabled":"disabled"))}else if(e=="sleep"){d.settings.enableMysticSleep=!d.settings.enableMysticSleep;d.command.message(e+" : "+(d.settings.enableMysticSleep?"enabled":"disabled"))}else if(e=="voc"){d.settings.enableMysticVoC=!d.settings.enableMysticVoC;d.command.message(e+" : "+(d.settings.enableMysticVoC?"enabled":"disabled"))}else if(e=="cont"){d.settings.enableMysticCont=!d.settings.enableMysticCont;d.command.message(e+" : "+(d.settings.enableMysticCont?"enabled":"disabled"))}else if(e=="tow"||e=="wrath"){d.settings.enableMysticToW=!d.settings.enableMysticToW;d.command.message(e+" : "+(d.settings.enableMysticToW?"enabled":"disabled"))}else{d.command.message("UGGA BOOGA PEEPOPOOPEE~");d.command.message("Go read commands pepega")}});d.game.on("enter_game",()=>{t=(d.game.me.templateId-10101)%100;d.settings.allySkills[t]||d.settings.enemySkills[t]?A():D()});function e(){s.push(d.hook(...arguments))}function D(){if(s.length){for(let e of s)d.unhook(e);s=[]}}function A(){if(!s.length){e("S_PARTY_MEMBER_LIST",9,e=>{const t=o;o=e.members.filter(e=>e.playerId!=d.game.me.playerId);if(t){for(let s=0;s<o.length;s++){const a=t.find(e=>e.playerId==o[s].playerId);if(a){o[s].gameId=a.gameId;if(a.loc)o[s].loc=a.loc}}}});e("S_LEAVE_PARTY",1,e=>{o=[]});e("C_PLAYER_LOCATION",5,e=>{m=e});e("S_SPAWN_ME",3,e=>{m.loc=e.loc;m.w=e.w});e("S_SPAWN_USER",17,s=>{if(o.length!=0){let e=o.find(e=>e.playerId===s.playerId);if(e){e.gameId=s.gameId;e.loc=s.loc;e.alive=s.alive;e.hpP=s.alive?100:0}}});e("S_USER_LOCATION",6,s=>{let e=o.find(e=>e.gameId===s.gameId);if(e)e.loc=s.loc});e("S_USER_LOCATION_IN_ACTION",2,s=>{let e=o.find(e=>e.gameId===s.gameId);if(e)e.loc=s.loc});e("S_INSTANT_DASH",3,s=>{let e=o.find(e=>e.gameId===s.gameId);if(e)e.loc=s.loc});e("S_PARTY_MEMBER_CHANGE_HP",4,s=>{if(d.game.me.playerId==s.playerId)return;let e=o.find(e=>e.playerId===s.playerId);if(e){e.hpP=Number(s.currentHp)/Number(s.maxHp)*100}});e("S_PARTY_MEMBER_STAT_UPDATE",4,s=>{if(d.game.me.playerId==s.playerId)return;let e=o.find(e=>e.playerId===s.playerId);if(e){e.hpP=Number(s.hp)/Number(s.maxHp)*100;e.alive=s.alive}});e("S_DEAD_LOCATION",2,s=>{let e=o.find(e=>e.gameId===s.gameId);if(e){e.loc=s.loc;e.hpP=0;e.alive=false}});e("S_LEAVE_PARTY_MEMBER",2,s=>{o=o.filter(e=>e.playerId!=s.playerId)});e("S_LOGOUT_PARTY_MEMBER",1,s=>{let e=o.find(e=>e.playerId===s.playerId);if(e)e.online=false});e("S_BAN_PARTY_MEMBER",1,s=>{o=o.filter(e=>e.playerId!=s.playerId)});e("S_BOSS_GAGE_INFO",3,e=>{const s=r.indexOf(e.id);if(s>-1){r.splice(s,1)}r.push(e.id)});e("S_SPAWN_NPC",12,e=>{if(i[e.huntingZoneId])if(i[e.huntingZoneId].includes(e.templateId))g.push(e.gameId);if(p[e.huntingZoneId])if(p[e.huntingZoneId].includes(e.templateId))f.push(e.gameId);u[e.gameId]=e.loc;if(e.templateId==10238008&&e.huntingZoneId==1023&&e.owner==d.game.me.gameId){b.push(e.gameId)}});e("S_ACTION_END",5,{filter:{fake:null}},e=>{if(Math.floor(e.skill.id/1e4)==10){if(e.gameId!=d.game.me.gameId)return;n=false}});e("S_ACTION_STAGE",9,{filter:{fake:null}},e=>{if(Math.floor(e.skill.id/1e4)==10){if(e.gameId!=d.game.me.gameId)return;n=true}if(!b.includes(e.gameId)||!d.settings.enableMysticToW)return;switch(e.skill.id){case 1101:h=d.setTimeout(()=>{if(n)return;d.send("C_START_SKILL",7,{skill:{reserved:0,npc:false,type:1,huntingZoneId:0,id:350100},loc:m.loc,w:m.w,unk:true,moving:true,"continue":false,target:r[0],unk2:false})},4800/e.speed);break;case 1102:h=d.setTimeout(()=>{if(n)return;d.send("C_START_SKILL",7,{skill:{reserved:0,npc:false,type:1,huntingZoneId:0,id:350100},loc:m.loc,w:m.w,unk:true,moving:true,"continue":false,target:r[0],unk2:false})},4054/e.speed);break;case 1103:h=d.setTimeout(()=>{if(n)return;d.send("C_START_SKILL",7,{skill:{reserved:0,npc:false,type:1,huntingZoneId:0,id:350100},loc:m.loc,w:m.w,unk:true,moving:true,"continue":false,target:r[0],unk2:false})},2e3/e.speed);break}});e("S_DESPAWN_NPC",3,e=>{const s=r.indexOf(e.gameId);if(s>-1){r.splice(s,1)}const t=g.indexOf(e.gameId);if(t>-1){g.splice(t,1)}const a=f.indexOf(e.gameId);if(a>-1){f.splice(a,1)}const n=c.indexOf(e.gameId);if(n>-1){c.splice(n,1)}const i=u.indexOf(e.gameId);if(i>-1){u.splice(i,1)}const l=b.indexOf(e.gameId);if(l>-1){b.splice(l,1);d.clearTimeout(h)}});e("S_NPC_LOCATION",3,e=>{u[e.gameId]=e.loc});e("S_LOAD_TOPO","event",e=>{r=[];g=[];f=[];u=[];c=[];b=[]});e("S_ABNORMALITY_BEGIN",5,e=>{if(![30372204,90442204].includes(e.id))return;const s=g.indexOf(e.target);if(s>-1){g.splice(s,1)}const t=c.indexOf(e.target);if(t>-1){c.splice(t,1)}});e("S_ABNORMALITY_BEGIN",5,e=>{if(![90442202,30372202].includes(e.id))return;const s=g.indexOf(e.target);if(s==-1){g.push(e.target)}});e("S_ABNORMALITY_BEGIN",5,e=>{if(![701101,801202].includes(e.id))return;const s=g.indexOf(e.target);if(s>-1){c.push(g.splice(s,1)[0])}});e("S_ABNORMALITY_END",1,e=>{if(![701101,801202].includes(e.id))return;const s=c.indexOf(e.target);if(s>-1){g.push(c.splice(s,1)[0])}});e("C_START_SKILL",7,{order:-Infinity,filter:{fake:false}},n=>{if(o.length==0)return;if(n.skill.id/10&1!=0){m.w=n.w;return}let i=Math.floor(n.skill.id/1e4);if(d.settings.allySkills[t]&&d.settings.allySkills[t].includes(i)){switch(i){case 41:if(!d.settings.enableMysticCont)return;else break;case 37:if(!d.settings.enablePriestHI)return;else break;case 35:if(!d.settings.enablePriestES)return;else break;case 33:if(!d.settings.enablePriestSleep)return;else break;case 30:if(!d.settings.enablePriestPlague)return;else break;case 28:if(!d.settings.enableMysticSleep)return;else break;case 24:if(!d.settings.enableMysticVoC)return;else break;case 19:if(!d.settings.enablePriestFH)return;else break;case 9:if(!d.settings.enableMysticACT)return;else break;case 5:if(!d.settings.enableMysticTF)return;else break;default:d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");return}let t=[];let a=O(i);if(i!=9)I();for(let e=0,s=o.length;e<s;e++){if(o[e].online&&o[e].alive&&o[e].hpP!=undefined&&o[e].hpP!=0&&(i==9?true:o[e].hpP<=d.settings.hpCutoff)&&o[e].loc!=undefined&&o[e].loc.dist3D(m.loc)/25<=d.settings.maxDistance){t.push(o[e]);if(t.length==a)break}}if(t.length>0){if(l)y(n.skill);for(let e=0,s=t.length;e<s;e++){setTimeout(()=>{d.send("C_CAN_LOCKON_TARGET",3,{target:t[e].gameId,skill:n.skill.id})},d.settings.lockSpeed)}if(d.settings.autoCast){setTimeout(()=>{d.send("C_START_SKILL",7,Object.assign({},n,{w:m.w,skill:n.skill.id+10}))},Math.max(d.settings.castSpeed,d.settings.lockSpeed+10))}}}});e("C_START_SKILL",7,{order:-Infinity,filter:{fake:false}},i=>{if(i.skill.id/10&1!=0){m.w=i.w;return}let e=Math.floor(i.skill.id/1e4);if(d.settings.enemySkills[t]&&d.settings.enemySkills[t].includes(e)){let t=[];let a=O(e);switch(e){case 41:if(!d.settings.enableMysticCont)return;else break;case 37:if(!d.settings.enablePriestHI)return;else break;case 35:if(!d.settings.enablePriestES)return;else break;case 33:if(!d.settings.enablePriestSleep)return;else break;case 30:if(!d.settings.enablePriestPlague)return;else break;case 28:if(!d.settings.enableMysticSleep)return;else break;case 24:if(!d.settings.enableMysticVoC)return;else break;case 19:if(!d.settings.enablePriestFH)return;else break;case 9:if(!d.settings.enableMysticACT)return;else break;case 5:if(!d.settings.enableMysticTF)return;else break;default:d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");d.command.message("UH OH DANGER UGGA BOOGA!?!?! Contact Kygas and tell him when this happened :DDDD");return}switch(e){case 41:case 35:case 24:t=t.concat(r);break;case 30:t=t.concat(f);break;case 28:case 33:t=t.concat(g);break;default:return}if(t.length==0)return;let n=[];for(let e=0,s=t.length;e<s;e++){if(u[t[e]]!=undefined&&u[t[e]].dist3D(m.loc)/25<=d.settings.maxDistance){n.push(t[e]);if(n.length==a)break}}if(n.length>0){if(l)y(i.skill);for(let e=0,s=n.length;e<s;e++){setTimeout(()=>{d.send("C_CAN_LOCKON_TARGET",3,{target:n[e],skill:i.skill.id})},d.settings.lockSpeed)}if(d.settings.autoCast){setTimeout(()=>{d.send("C_START_SKILL",7,Object.assign({},i,{w:m.w,skill:i.skill.id+10}))},Math.max(d.settings.castSpeed,d.settings.lockSpeed+10))}}}});e("S_CREST_INFO",2,e=>{a=e.crests});e("S_CREST_APPLY",2,s=>{let e=a.find(e=>e.id==s.id);if(e)e.enable=s.enable})}}function O(e){switch(e){case 41:return 1;case 37:return 1;case 35:return 1;case 33:return 1;case 30:return 1;case 28:return 1;case 24:return G(27040)?5:4;case 19:return G(28003)?4:2;case 9:return G(27063)||G(27003)?5:3;case 5:return G(27e3)?4:2}return 1}function G(s){let e=a.find(e=>e.id==s&&e.enable);if(e)return true;else return false}function I(){o.sort(function(e,s){return parseFloat(e.hpP)-parseFloat(s.hpP)})}function y(e){let d="\nAutoheal Debug... Skill: "+e.id+"\tpartyMemebers.length: "+o.length;for(let l=0;l<o.length;l++){d+="\n"+l+"\t";let e=o[l].name;e+=" ".repeat(21-e.length);let s="\tHP: "+parseFloat(o[l].hpP).toFixed(2);let t="\tundefined";if(o[l].loc)t="\tDist: "+(o[l].loc.dist3D(m.loc)/25).toFixed(2);let a="\tOnline: "+o[l].online;let n="\tAlive: "+o[l].alive;let i="\tpid: "+o[l].playerId+" gid: "+o[l].gameId;d+=e+s+t+a+n+i}console.log(d)}};