text: window.bots=function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=23)}([function(t,e,r){"use strict";function n(t){return new Promise(e=>setTimeout(e,t))}function a(t){return"character"==t.type&&!function(t){return!!t.npc}(t)}function i(t=parent.character.items){const e=[];for(let r=0;r<t.length;r++)t[r]&&e.push({...t[r],index:r});return e}function o(t){for(let e=0;e<42;e++)if(parent.character.items[e]&&parent.character.items[e].name==t)return{...parent.character.items[e],index:e}}function s(t){const e=[];for(let r=0;r<42;r++)parent.character.items[r]&&parent.character.items[r].name==t&&e.push({...parent.character.items[r],index:r});return e}function c(t,e){const r=[];for(let n=0;n<42;n++)parent.character.items[n]&&parent.character.items[n].name==t&&parent.character.items[n].level==e&&r.push({...parent.character.items[n],index:n});return r}function p(t,e){let r=t.attack;return t.apiercing||(t.apiercing=0),t.rpiercing||(t.rpiercing=0),e.armor||(e.armor=0),!t.damage_type&&t.slots.mainhand&&(t.damage_type=G.items[t.slots.mainhand.name].damage),e["1hp"]?[1,1]:("physical"==t.damage_type?r*=damage_multiplier(e.armor-t.apiercing):"magical"==t.damage_type&&(r*=damage_multiplier(e.resistance-t.rpiercing)),[.9*r,1.1*r])}function h(t,e=!1){if(parent.next_skill&&parent.next_skill[t]){const r=parent.next_skill[t].getTime()-Date.now();return e?r+1:r<parent.character.ping?parent.character.ping:r+1}return parent.character.ping}function u(t=parent.character.items){for(let e=0;e<t.length;e++)if(!t[e])return!1;return!0}function l(){const t=new Set;for(const e of parent.party_list)t.add(parent.party[e].type);return t}function f(t=parent.character.items){const e=[];for(let r=0;r<t.length;r++)t[r]||e.push(r);return e}function m(){if(!["bank","bank_b","bank_u"].includes(parent.character.map))return;const t=[];for(const e in bank_packs)if("gold"!=e&&bank_packs[e][0]==parent.character.map)for(let r=0;r<42;r++){parent.character.bank[e][r]||t.push({pack:e,index:r})}return t}function d(t){const e=G.skills[t].level;if(e&&e>parent.character.level)return!1;if(parent.character.stoned)return!1;if(parent.character.rip)return!1;const r=G.skills[t].wtype;if(r&&!r.includes(G.items[parent.character.slots.mainhand.name].wtype))return!1;if(G.skills[t].slot)for(const e of G.skills[t].slot){if(!parent.character.slots[e[0]])return!1;if(parent.character.slots[e[0]].name!=e[1])return!1}if(G.skills[t].class){let e=!1;for(const r of G.skills[t].class)if(r==parent.character.ctype){e=!0;break}if(!e)return!1}let n=0;if(G.skills[t].mp?n=G.skills[t].mp:["attack","heal"].includes(t)&&(n=parent.character.mp_cost),parent.character.mp<n)return!1;if(void 0===parent.next_skill[t])return!0;const a=G.skills[t].share;return a?!parent.next_skill[a]||Date.now()>=parent.next_skill[a].getTime():Date.now()>=parent.next_skill[t].getTime()}function g({canAttackUsWithoutMoving:t,canKillInOneHit:e,canMoveTo:r,isAttacking:n,isAttackingParty:a,isAttackingUs:i,isCtype:o,isMonster:s,isMonsterType:c,isMoving:h,isNPC:u,isPartyMember:l,isPlayer:f,isRIP:m,isWithinDistance:d}){const g=[],y=is_pvp();for(const v in parent.entities){const b=parent.entities[v],k=distance(parent.character,b);!0===t&&b.range>k||(!1===t&&b.range<=k||!0===e&&p(parent.character,b)[0]>b.hp||!1===e&&p(parent.character,b)[0]<=b.hp||(!0!==r||can_move_to(b.real_x,b.real_y))&&(!1===r&&can_move_to(b.real_x,b.real_y)||(!0!==n||"monster"!=b.type||b.target)&&(!1===n&&"monster"==b.type&&b.target||(!0!==n||"character"!=b.type||b.target)&&(!0!==a||"monster"!=b.type||parent.party_list.includes(b.target))&&(!1===a&&"monster"==b.type&&parent.party_list.includes(b.target)||(!0!==a||"character"!=b.type||y)&&(!0===a&&"character"==b.type&&parent.party_list.includes(v)||!0===a&&"Wizard"==parent.character.name||!0===i&&"monster"==b.type&&b.target!=parent.character.name||!1===i&&"monster"==b.type&&b.target==parent.character.name||(!0!==i||"character"!=b.type||y)&&(!0===i&&"character"==b.type&&parent.party_list.includes(v)||!0===i&&"Wizard"==parent.character.name||(void 0===o||b.ctype)&&(void 0!==o&&b.ctype!=o||!0===s&&"monster"!=b.type||!1===s&&"monster"==b.type||(void 0===c||b.mtype)&&(void 0===c||c.includes(b.mtype))&&(!0!==h||b.moving)&&(!1===h&&b.moving||!0===u&&"character"!=b.type||(!0!==u||"character"!=b.type||b.npc)&&(!0!==l||parent.party_list.includes(v))&&(!1===l&&parent.party_list.includes(v)||!0===f&&"character"!=b.type||!0===f&&b.npc||(!0!==m||b.rip)&&(!1===m&&b.rip||void 0!==d&&k>d||g.push(b)))))))))))}return g}function y(){const t=new Set;for(const e in parent.entities){const r=parent.entities[e];r.mtype&&t.add(r.mtype)}return t}function v(t){const e=[];for(const r in G.maps){const n=G.maps[r];if(!n.instance)for(const a of n.monsters||[])if(a.type==t)if(a.boundary)e.push({map:r,x:(a.boundary[0]+a.boundary[2])/2,y:(a.boundary[1]+a.boundary[3])/2});else if(a.boundaries)for(const t of a.boundaries)e.push({map:t[0],x:(t[1]+t[3])/2,y:(t[2]+t[4])/2})}return e}function b(t){const e=v(t);return e[Math.trunc(Math.random()*e.length)]}r.d(e,"p",(function(){return n})),r.d(e,"o",(function(){return a})),r.d(e,"i",(function(){return i})),r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return s})),r.d(e,"d",(function(){return c})),r.d(e,"a",(function(){return p})),r.d(e,"e",(function(){return h})),r.d(e,"n",(function(){return u})),r.d(e,"j",(function(){return l})),r.d(e,"g",(function(){return f})),r.d(e,"f",(function(){return m})),r.d(e,"m",(function(){return d})),r.d(e,"h",(function(){return g})),r.d(e,"l",(function(){return y})),r.d(e,"k",(function(){return b}))},function(t,e,r){"use strict";function n(t,e){return"string"==typeof e&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e)?new Date(e):e}function a(){return`${parent.server_region}.${parent.server_identifier}`}function i(){return JSON.parse(localStorage.getItem(a()+"_monsters"),n)||{}}function o(t){localStorage.setItem(a()+"_monsters",JSON.stringify(t))}function s(){return JSON.parse(localStorage.getItem(a()+"_npcs"),n)||{}}function c(t){localStorage.setItem(a()+"_npcs",JSON.stringify(t))}function p(){return JSON.parse(localStorage.getItem(a()+"_party"),n)||{}}function h(t){localStorage.setItem(a()+"_party",JSON.stringify(t))}function u(){return JSON.parse(localStorage.getItem(a()+"_players"),n)||{}}function l(t){localStorage.setItem(a()+"_players",JSON.stringify(t))}r.d(e,"a",(function(){return i})),r.d(e,"e",(function(){return o})),r.d(e,"b",(function(){return s})),r.d(e,"f",(function(){return c})),r.d(e,"c",(function(){return p})),r.d(e,"g",(function(){return h})),r.d(e,"d",(function(){return u})),r.d(e,"h",(function(){return l}))},function(t,e,r){"use strict";r.d(e,"h",(function(){return a})),r.d(e,"g",(function(){return i})),r.d(e,"d",(function(){return o})),r.d(e,"a",(function(){return s})),r.d(e,"j",(function(){return c})),r.d(e,"i",(function(){return p})),r.d(e,"e",(function(){return h})),r.d(e,"f",(function(){return u})),r.d(e,"b",(function(){return l})),r.d(e,"c",(function(){return f}));var n=r(0);function a(t){if("bank"!=parent.character.map){if(!Object(n.b)("computer")){let t=!1;if(!G.maps[parent.character.map].npcs)return;for(const e of G.maps[parent.character.map].npcs.filter(t=>"merchant"==G.npcs[t.id].role))if(distance(parent.character,{x:e.position[0],y:e.position[1]})<350){t=!0;break}if(!t)return}for(const e of Object(n.i)())if(!e.p&&t[e.name]){if(e.level&&e.level>t[e.name])continue;e.q?sell(e.index,e.q):sell(e.index,1)}}}function i(){const t=Object(n.b)("stand0");t&&void 0===parent.character.standed&&parent.open_merchant(t.index)}function o(){void 0!==parent.character.standed&&parent.close_merchant()}function s(t){let e=!1;for(const t of parent.npcs)if("secondhands"==t.id&&distance(parent.character,{x:t.position[0],y:t.position[1]})<350){e=!0;break}if(!e)return;let r=0;parent.socket.once("secondhands",e=>{for(let n=0;n<e.length;n++)if(t.has(e[n].name)){if(parent.socket.emit("sbuy",{rid:e[n].rid}),++r>=5)break}else if(e[n].p){if(parent.socket.emit("sbuy",{rid:e[n].rid}),++r>=5)break}else if(G.items[e[n].name].upgrade&&e[n].level>=8){if(parent.socket.emit("sbuy",{rid:e[n].rid}),++r>=5)break}else if(G.items[e[n].name].compound&&e[n].level>=4&&(parent.socket.emit("sbuy",{rid:e[n].rid}),++r>=5))break}),parent.socket.emit("secondhands")}function c(t,e){const r=parent.entities[t];if(!r)return;if(distance(parent.character,r)>400)return;const a=new Set(e),i=Object(n.i)();i.sort((t,e)=>t.name<e.name?-1:t.name>e.name?1:t.level>e.level?-1:void 0);for(const e of i)a.has(e.name)?a.delete(e.name):e.q?send_item(t,e.index,e.q):send_item(t,e.index,1)}function p(t,e=0){if(parent.character.gold<=e)return;const r=parent.entities[t];r&&(distance(parent.character,r)>400||send_gold(t,parent.character.gold-e))}async function h(t){if("bank"!=parent.character.map){if(!Object(n.b)("computer")){let t=!1;for(const e of parent.npcs)if("craftsman"==e.id&&distance(parent.character,{x:e.position[0],y:e.position[1]})<250){t=!0;break}if(!t)return}for(const e in t)if(!(parent.character.gold<G.dismantle[e].cost))for(let r=t[e];r>0;r--){const t=Object(n.d)(e,r);for(const e of t)parent.socket.emit("dismantle",{num:e.index}),await Object(n.p)(parent.character.ping)}}}function u(t){if(parent.character.q.exchange)return;if("bank"==parent.character.map)return;const e=Object(n.b)("computer"),r=[];if(!e){for(const t of parent.npcs)t.position&&distance(parent.character,{x:t.position[0],y:t.position[1]})<250&&r.push(t.id);if(!r.length)return}const a={};for(const t of Object(n.i)()){const e=G.items[t.name],r=e.e;if(!r||r>t.q)continue;let n;if("quest"==e.type)n=e.quest?G.quests[e.quest].id:"exchange";else if("box"==e.type||"gem"==e.type||"misc"==e.type)n="exchange";else{if("lostearring"!=t.name||2!=t.level)continue;n="pwincess"}a[n]||(a[n]=[]),a[n].push(t)}for(const t in a){if(!r.includes(t)&&!e)continue;const n=a[t][0];return void exchange(n.index)}}async function l(){if("bank"==parent.character.map)return;if(!Object(n.b)("computer")){let t=!1;if(!G.maps[parent.character.map].npcs)return;for(const e of G.maps[parent.character.map].npcs.filter(t=>"fancypots"==t.id))if(distance(parent.character,{x:e.position[0],y:e.position[1]})<350){t=!0;break}if(!t)return}if(parent.character.gold<G.items.mpot1.g)return;const t={mpot1:9999,hpot1:9999};for(const e in t){const r=t[e],a=Object(n.c)(e).reduce((t,e)=>t+e.q,0);a<r&&await buy_with_gold(e,Math.min(r-a,parent.character.gold/G.items[e].g))}}async function f(){if("bank"==parent.character.map)return;if(!Object(n.b)("computer")){let t=!1;if(!G.maps[parent.character.map].npcs)return;for(const e of G.maps[parent.character.map].npcs.filter(t=>"scrolls"==t.id))if(distance(parent.character,{x:e.position[0],y:e.position[1]})<350){t=!0;break}if(!t)return}if(parent.character.gold<G.items.scroll0.g)return;const t={scroll0:1e3,scroll1:100,scroll2:10,cscroll0:1e3,cscroll1:100,cscroll2:10};for(const e in t){const r=t[e],a=Object(n.c)(e).reduce((t,e)=>t+e.q,0),i=Math.min(r-a,Math.trunc(parent.character.gold/G.items[e].g));a<r&&i>0&&await buy_with_gold(e,i)}}},function(t,e){function r(t,e){if(!(this instanceof r))return new r(t,e);if(Array.isArray(t)||(e=t,t=[]),e=e||{},this.data=t||[],this.length=this.data.length,this.compare=e.compare||a,this.setNodeId=e.setNodeId||n,this.length>0)for(var i=this.length>>1;i>=0;i--)this._down(i);if(e.setNodeId)for(i=0;i<this.length;++i)this.setNodeId(this.data[i],i)}function n(){}function a(t,e){return t-e}t.exports=r,r.prototype={push:function(t){this.data.push(t),this.setNodeId(t,this.length),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this.setNodeId(this.data[0],0),this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},updateItem:function(t){this._down(t),this._up(t)},_up:function(t){for(var e=this.data,r=this.compare,n=this.setNodeId,a=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(a,o)>=0)break;e[t]=o,n(o,t),t=i}e[t]=a,n(a,t)},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,a=e[t],i=this.setNodeId;t<n;){var o=1+(t<<1),s=o+1,c=e[o];if(s<this.length&&r(e[s],c)<0&&(o=s,c=e[s]),r(c,a)>=0)break;e[t]=c,i(c,t),t=o}e[t]=a,i(a,t)}}},function(t,e){t.exports={l2:function(t,e){var r=t.x-e.x,n=t.y-e.y;return Math.sqrt(r*r+n*n)},l1:function(t,e){var r=t.x-e.x,n=t.y-e.y;return Math.abs(r)+Math.abs(n)}}},function(t,e){var r=[];"function"==typeof Object.freeze&&Object.freeze(r),t.exports={heuristic:function(){return 0},distance:function(){return 1},compareFScore:function(t,e){return t.fScore-e.fScore},NO_PATH:r,setHeapIndex:function(t,e){t.heapIndex=e},setH1:function(t,e){t.h1=e},setH2:function(t,e){t.h2=e},compareF1Score:function(t,e){return t.f1-e.f1},compareF2Score:function(t,e){return t.f2-e.f2}}},function(t,e,r){"use strict";(function(t){var e=function(t,e){return t<e};function n(t){if(!(this instanceof n))return new n(t);this.array=[],this.size=0,this.compare=t||e}n.prototype.clone=function(){var t=new n(this.compare);t.size=this.size;for(var e=0;e<this.size;e++)t.array.push(this.array[e]);return t},n.prototype.add=function(t){var e,r,n=this.size;for(this.array[this.size]=t,this.size+=1;n>0&&(e=n-1>>1,r=this.array[e],this.compare(t,r));)this.array[n]=r,n=e;this.array[n]=t},n.prototype.heapify=function(t){var e;for(this.array=t,this.size=t.length,e=this.size>>1;e>=0;e--)this._percolateDown(e)},n.prototype._percolateUp=function(t,e){for(var r,n,a=this.array[t];t>0&&(r=t-1>>1,n=this.array[r],e||this.compare(a,n));)this.array[t]=n,t=r;this.array[t]=a},n.prototype._percolateDown=function(t){for(var e,r,n,a=this.size,i=this.size>>>1,o=this.array[t];t<i&&(r=(e=1+(t<<1))+1,n=this.array[e],r<a&&this.compare(this.array[r],n)&&(e=r,n=this.array[r]),this.compare(n,o));)this.array[t]=n,t=e;this.array[t]=o},n.prototype._removeAt=function(t){if(!(t>this.size-1||t<0))return this._percolateUp(t,!0),this.poll()},n.prototype.remove=function(t){for(var e=0;e<this.size;e++)if(!this.compare(this.array[e],t)&&!this.compare(t,this.array[e]))return this._removeAt(e),!0;return!1},n.prototype._batchRemove=function(t,e){var r=new Array(e||this.size),n=0;if("function"==typeof t&&this.size)for(var a=0;a<this.size&&n<r.length;)t(this.array[a])?(r[n]=this._removeAt(a),n++,a>>=1):a++;return r.length=n,r},n.prototype.removeOne=function(t){var e=this._batchRemove(t,1);return e.length>0?e[0]:void 0},n.prototype.removeMany=function(t,e){return this._batchRemove(t,e)},n.prototype.peek=function(){if(0!=this.size)return this.array[0]},n.prototype.poll=function(){if(0!=this.size){var t=this.array[0];return this.size>1?(this.array[0]=this.array[--this.size],this._percolateDown(0)):this.size-=1,t}},n.prototype.replaceTop=function(t){if(0!=this.size){var e=this.array[0];return this.array[0]=t,this._percolateDown(0),e}},n.prototype.trim=function(){this.array=this.array.slice(0,this.size)},n.prototype.isEmpty=function(){return 0===this.size},n.prototype.forEach=function(t){if(!this.isEmpty()&&"function"==typeof t)for(var e=0,r=this.clone();!r.isEmpty();)t(r.poll(),e++)},n.prototype.kSmallest=function(t){if(0==this.size)return[];var e=this.compare,r=this.array,a=new n((function(t,n){return e(r[t],r[n])}));t=Math.min(this.size,t);var i=new Array(t),o=0;for(a.add(0);o<t;){var s=a.poll();i[o++]=this.array[s];var c=1+(s<<1),p=c+1;c<this.size&&a.add(c),p<this.size&&a.add(p)}return i};r.c[r.s]===t&&function(){var t=new n((function(t,e){return t<e}));for(t.add(1),t.add(0),t.add(5),t.add(4),t.add(3);!t.isEmpty();)console.log(t.poll())}(),t.exports=n}).call(this,r(11)(t))},function(t,e){function r(t){this.node=t,this.parent=null,this.closed=!1,this.open=0,this.distanceToSource=Number.POSITIVE_INFINITY,this.fScore=Number.POSITIVE_INFINITY,this.heapIndex=-1}t.exports=function(){var t=0,e=[];return{createNewState:function(n){var a=e[t];a?(a.node=n,a.parent=null,a.closed=!1,a.open=0,a.distanceToSource=Number.POSITIVE_INFINITY,a.fScore=Number.POSITIVE_INFINITY,a.heapIndex=-1):(a=new r(n),e[t]=a);return t++,a},reset:function(){t=0}}}},function(t,e,r){t.exports=function(t){"uniqueLinkId"in(t=t||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),t.multigraph=t.uniqueLinkId);void 0===t.multigraph&&(t.multigraph=!1);if("function"!=typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,r=[],p={},h=0,u=t.multigraph?function(t,e,r){var n=c(t,e),a=p.hasOwnProperty(n);if(a||O(t,e)){a||(p[n]=0);var i="@"+ ++p[n];n=c(t+i,e+i)}return new s(t,e,r,n)}:function(t,e,r){var n=c(t,e);return new s(t,e,r,n)},l=[],f=j,m=j,d=j,g=j,y={addNode:k,addLink:function(t,e,n){d();var a=x(t)||k(t),i=x(e)||k(e),s=u(t,e,n);r.push(s),o(a,s),t!==e&&o(i,s);return f(s,"add"),g(),s},removeLink:M,removeNode:_,getNode:x,getNodeCount:w,getLinkCount:T,getLinksCount:T,getNodesCount:w,getLinks:function(t){var e=x(t);return e?e.links:null},forEachNode:N,forEachLinkedNode:function(t,r,n){var a=x(t);if(a&&a.links&&"function"==typeof r)return n?function(t,r,n){for(var a=0;a<t.length;++a){var i=t[a];if(i.fromId===r&&n(e.get(i.toId),i))return!0}}(a.links,t,r):function(t,r,n){for(var a=0;a<t.length;++a){var i=t[a],o=i.fromId===r?i.toId:i.fromId;if(n(e.get(o),i))return!0}}(a.links,t,r)},forEachLink:function(t){var e,n;if("function"==typeof t)for(e=0,n=r.length;e<n;++e)t(r[e])},beginUpdate:d,endUpdate:g,clear:function(){d(),N((function(t){_(t.id)})),g()},hasLink:O,hasNode:x,getLink:O};return n(y),function(){var t=y.on;y.on=function(){return y.beginUpdate=d=S,y.endUpdate=g=I,f=v,m=b,y.on=t,t.apply(y,arguments)}}(),y;function v(t,e){l.push({link:t,changeType:e})}function b(t,e){l.push({node:t,changeType:e})}function k(t,r){if(void 0===t)throw new Error("Invalid node identifier");d();var n=x(t);return n?(n.data=r,m(n,"update")):(n=new i(t,r),m(n,"add")),e.set(t,n),g(),n}function x(t){return e.get(t)}function _(t){var r=x(t);if(!r)return!1;d();var n=r.links;if(n){r.links=null;for(var a=0;a<n.length;++a)M(n[a])}return e.delete(t),m(r,"remove"),g(),!0}function w(){return e.size}function T(){return r.length}function M(t){if(!t)return!1;var e=a(t,r);if(e<0)return!1;d(),r.splice(e,1);var n=x(t.fromId),i=x(t.toId);return n&&(e=a(t,n.links))>=0&&n.links.splice(e,1),i&&(e=a(t,i.links))>=0&&i.links.splice(e,1),f(t,"remove"),g(),!0}function O(t,e){var r,n=x(t);if(!n||!n.links)return null;for(r=0;r<n.links.length;++r){var a=n.links[r];if(a.fromId===t&&a.toId===e)return a}return null}function j(){}function S(){h+=1}function I(){0===(h-=1)&&l.length>0&&(y.fire("changed",l),l.length=0)}function N(t){if("function"!=typeof t)throw new Error("Function is expected to iterate over graph nodes. You passed "+t);for(var r=e.values(),n=r.next();!n.done;){if(t(n.value))return!0;n=r.next()}}};var n=r(12);function a(t,e){if(!e)return-1;if(e.indexOf)return e.indexOf(t);var r,n=e.length;for(r=0;r<n;r+=1)if(e[r]===t)return r;return-1}function i(t,e){this.id=t,this.links=null,this.data=e}function o(t,e){t.links?t.links.push(e):t.links=[e]}function s(t,e,r,n){this.fromId=t,this.toId=e,this.data=r,this.id=n}function c(t,e){return t.toString()+"👉 "+e.toString()}},function(t,e,r){t.exports={aStar:r(13),aGreedy:r(14),nba:r(15)}},function(t,e,r){"use strict";r.d(e,"a",(function(){return d}));var n=r(6),a=r.n(n),i=r(0),o=r(2),s=r(1),c=r(8),p=r.n(c),h=r(9),u=r.n(h);const l=750*parent.character.speed/1e3,f=2e3*parent.character.speed/1e3;class m{constructor(){this.grids={},this.graph=p()({multigraph:!0}),this.pathfinder=u.a.aStar(this.graph,{distance:(t,e,r)=>r.data&&"transport"==r.data.type?l:r.data&&"town"==r.data.type?f:t.data.map==e.data.map?Math.sqrt((t.data.x-e.data.x)**2+(t.data.y-e.data.y)**2):void 0,oriented:!0})}static async getInstance(){return this.instance||(this.instance=new m,await this.instance.prepare()),this.instance}static cleanPosition(t){return{map:t.map,x:void 0!==t.real_x?t.real_x:t.x,y:void 0!==t.real_y?t.real_y:t.y}}reset(){this.searchStartTime=void 0,this.searchFinishTime=void 0,this.moveStartTime=void 0,this.moveFinishTime=void 0}stop(){this.reset(),parent.character.moving&&stop(),parent.character.c.town&&stop("town")}isMoving(){return null==this.moveFinishTime&&null!=this.searchStartTime}wasCancelled(t){return!this.searchStartTime||t<this.searchStartTime}canMove2(t,e){if(t.map!=e.map)return console.error(`Don't use this function across maps. You tried to check canMove from ${t.map} to ${e.map}.`),!1;const r=this.grids[t.map];let n,a,i,o,s=Math.trunc(t.y)-G.geometry[t.map].min_y,c=Math.trunc(t.x)-G.geometry[t.map].min_x,p=Math.trunc(e.x)-Math.trunc(t.x),h=Math.trunc(e.y)-Math.trunc(t.y);if(3!==r[s][c])return!1;h<0?(n=-1,h=-h):n=1,p<0?(a=-1,p=-p):a=1;const u=2*h,l=2*p;if(l>=u){o=i=p;for(let t=0;t<p;t++){if(c+=a,i+=u,i>l)if(s+=n,i-=l,i+o<l){if(3!=r[s-n][c])return!1}else if(i+o>l){if(3!=r[s][c-a])return!1}else{if(3!=r[s-n][c])return!1;if(3!=r[s][c-a])return!1}if(3!==r[s][c])return!1;o=i}}else{o=i=h;for(let t=0;t<h;t++){if(s+=n,i+=l,i>u)if(c+=a,i-=u,i+o<u){if(3!=r[s][c-a])return!1}else if(i+o>u){if(3!=r[s-n][c])return!1}else{if(3!=r[s][c-a])return!1;if(3!=r[s-n][c])return!1}if(3!==r[s][c])return!1;o=i}}return!0}canMove(t,e){if(t.map!=e.map)return console.error(`Don't use this function across maps. You tried to check canMove from ${t.map} to ${e.map}.`),!1;const r=this.grids[t.map],n=Math.trunc(e.x)-Math.trunc(t.x),a=Math.trunc(e.y)-Math.trunc(t.y),i=Math.abs(n),o=Math.abs(a),s=n>0?1:-1,c=a>0?1:-1;let p=Math.trunc(t.x)-G.geometry[t.map].min_x,h=Math.trunc(t.y)-G.geometry[t.map].min_y;for(let t=0,e=0;t<i||e<o;)if((.5+t)/i==(.5+e)/o?(p+=s,h+=c,t++,e++):(.5+t)/i<(.5+e)/o?(p+=s,t++):(h+=c,e++),3!==r[h][p])return!1;return!0}async addToGraph(t){if(this.grids[t])return;G.maps[t]||console.error(t+" is not a valid map.");const e=G.geometry[t].max_x-G.geometry[t].min_x,r=G.geometry[t].max_y-G.geometry[t].min_y,n=Array(r);for(let t=0;t<r;t++){n[t]=[];for(let r=0;r<e;r++)n[t][r]=1}for(const a of G.geometry[t].y_lines)for(let i=Math.max(0,a[0]-G.geometry[t].min_y-parent.character.base.vn-0);i<=a[0]-G.geometry[t].min_y+parent.character.base.v+0&&i<r;i++)for(let r=Math.max(0,a[1]-G.geometry[t].min_x-parent.character.base.h-0);r<=a[2]-G.geometry[t].min_x+parent.character.base.h+0&&r<e;r++)n[i][r]=2;for(const a of G.geometry[t].x_lines)for(let i=Math.max(0,a[0]-G.geometry[t].min_x-parent.character.base.h-0);i<=a[0]-G.geometry[t].min_x+parent.character.base.h+0&&i<e;i++)for(let e=Math.max(0,a[1]-G.geometry[t].min_y-parent.character.base.vn-0);e<=a[2]-G.geometry[t].min_y+parent.character.base.v+0&&e<r;e++)n[e][i]=2;for(const a of G.maps[t].spawns){let i=Math.trunc(a[0])-G.geometry[t].min_x,o=Math.trunc(a[1])-G.geometry[t].min_y;if(3===n[o][i])continue;const s=[[o,i]];for(;s.length;){[o,i]=s.pop();let t=i;for(;t>=0&&1==n[o][t];)t--;t++;let a=0,c=0;for(;t<e&&1==n[o][t];)n[o][t]=3,!a&&o>0&&1==n[o-1][t]?(s.push([o-1,t]),a=1):a&&o>0&&1!=n[o-1][t]&&(a=0),!c&&o<r-1&&1==n[o+1][t]?(s.push([o+1,t]),c=1):c&&o<r-1&&1!=n[o+1][t]&&(c=0),t++}}function a(t,e,r){return`${t}:${Math.trunc(e)},${Math.trunc(r)}`}function i(t,e,r){return{map:t,x:Math.trunc(e),y:Math.trunc(r)}}function o(e,r){let n={x:-99999,y:-99999,distance:99999};for(const a of G.maps[t].spawns){const t=Math.sqrt((a[0]-e)**2+(a[1]-r)**2);t<n.distance&&(n={x:a[0],y:a[1],distance:t})}return n}this.grids[t]=n;{const s=[];for(let o=1;o<r-1;o++)for(let r=1;r<e-1;r++){if(3!=n[o][r])continue;const e=a(t,r+G.geometry[t].min_x,o+G.geometry[t].min_y);if(this.graph.hasNode(e)){s.push(this.graph.getNode(e));continue}const c=i(t,r+G.geometry[t].min_x,o+G.geometry[t].min_y);(2==n[o-1][r-1]&&2==n[o-1][r]&&2==n[o-1][r+1]&&2==n[o][r-1]&&2==n[o+1][r-1]||2==n[o-1][r-1]&&2==n[o-1][r]&&2==n[o-1][r+1]&&2==n[o][r+1]&&2==n[o+1][r+1]||2==n[o-1][r+1]&&2==n[o][r+1]&&2==n[o+1][r-1]&&2==n[o+1][r]&&2==n[o+1][r+1]||2==n[o-1][r-1]&&2==n[o][r-1]&&2==n[o+1][r-1]&&2==n[o+1][r]&&2==n[o+1][r+1]||2==n[o-1][r-1]&&3==n[o-1][r]&&3==n[o][r-1]||3==n[o-1][r]&&2==n[o-1][r+1]&&3==n[o][r+1]||3==n[o][r+1]&&3==n[o+1][r]&&2==n[o+1][r+1]||3==n[o][r-1]&&2==n[o+1][r-1]&&3==n[o+1][r])&&s.push(this.graph.addNode(e,c))}for(const e of G.maps[t].npcs){if("transporter"!=e.id)continue;const r=o(e.position[0],e.position[1]),n=a(t,r.x,r.y);if(this.graph.hasNode(n))s.push(this.graph.getNode(n));else{const e=i(t,r.x,r.y);s.push(this.graph.addNode(n,e))}for(const t in G.npcs.transporter.places){const e=G.npcs.transporter.places[t],r=G.maps[t].spawns[e],o=a(t,r[0],r[1]);if(!this.graph.hasNode(o)){const e=i(t,r[0],r[1]);this.graph.addNode(o,e)}if(!this.graph.hasLink(n,o)){const t={type:"transport",spawn:e};this.graph.addLink(n,o,t)}}}for(const e of G.maps[t].doors){if(e[7]||e[8])continue;const r=G.maps[t].spawns[e[6]],n=a(t,r[0],r[1]);if(this.graph.hasNode(n))s.push(this.graph.getNode(n));else{const e=i(t,r[0],r[1]);s.push(this.graph.addNode(n,e))}const o=G.maps[e[4]].spawns[e[5]],c=a(e[4],o[0],o[1]);if(!this.graph.hasNode(c)){const t=i(e[4],o[0],o[1]);this.graph.addNode(c,t)}if(!this.graph.hasLink(n,c)){const t={type:"transport",spawn:e[5]};this.graph.addLink(n,c,t)}}for(const e of G.maps[t].spawns){const r=a(t,e[0],e[1]);if(!this.graph.hasNode(r)){const n=i(t,e[0],e[1]);s.push(this.graph.addNode(r,n))}}for(let t=0;t<s.length;t++)for(let e=t+1;e<s.length;e++){const r=s[t],n=s[e];this.canMove2(r.data,n.data)&&(this.graph.addLink(r.id,n.id),this.graph.addLink(n.id,r.id))}const c=a(t,G.maps[t].spawns[0][0],G.maps[t].spawns[0][1]),p={type:"town"};for(const t of s)this.graph.addLink(t.id,c,p)}}async prepare(t="main"){const e=[t];for(let t=0;t<e.length;t++){const r=e[t];for(const t of G.maps[r].doors){const r=t[4];e.includes(r)||e.push(t[4])}}for(const t in G.npcs.transporter.places){const r=t;e.includes(r)||e.push(r)}for(const t of e)await this.addToGraph(t),await new Promise(t=>setTimeout(t,50))}getGraphInfo(){console.info("Graph information ----------"),console.info("# Nodes: "+this.graph.getNodeCount()),console.info("# Links: "+this.graph.getLinkCount()),console.info("----------------------------")}getPath(t){let e,r,n=Number.MAX_VALUE,a=Number.MAX_VALUE;this.graph.forEachNode(i=>{if(i.data||(console.error("NO DATA!?"),console.error(i)),i.data.map==parent.character.map){const t=Math.sqrt((i.data.x-parent.character.real_x)**2+(i.data.y-parent.character.real_y)**2);t<n&&can_move_to(i.data.x,i.data.y)&&(n=t,e=i.id)}if(i.data.map==t.map){const e=Math.sqrt((i.data.x-t.x)**2+(i.data.y-t.y)**2);e<a&&(a=e,r=i.id)}});const i=this.pathfinder.find(e,r);if(0==i.length)return void console.error("could not find a path");const o=[];i[i.length-1].data.x==parent.character.real_x&&i[i.length-1].data.y==parent.character.real_y||o.push([m.cleanPosition(parent.character),i[i.length-1].data,void 0]);for(let t=i.length-1;t>0;t--){const e=i[t],r=i[t-1],n=this.graph.getLink(e.id,r.id);o.push([e.data,r.data,n.data])}i[0].data.x==t.x&&i[0].data.y==t.y||o.push([i[0].data,t,void 0]);const s=m.cleanPosition(parent.character);let c=0;for(let t=1;t<o.length;t++){const e=o[t][1],r=o[t][2];if(s.map!==e.map)break;if(r)break;this.canMove2(s,e)&&(c=t)}c>0&&(o.splice(0,c),o[0][0]=s),c=o.length-1;for(let e=o.length-2;e>0;e--){const r=o[e][0],n=o[e][1];if(o[e][2])break;if(n.map!=t.map)break;this.canMove2(r,t)&&(c=e)}return c<o.length-1&&(o.splice(c+1),o[o.length-1][1]=t),o.length>1&&void 0===o[0][2]&&o[1][2]&&"town"==o[1][2].type&&o[0][0].map==o[1][0].map&&o.shift(),o}async move(t,e=0){if(this.reset(),distance(parent.character,t)<=e)return;const r=m.cleanPosition(parent.character),n=m.cleanPosition(t);function a(t){if(0==e)return n;const r=Math.sqrt((t.y-n.y)**2+(t.x-n.x)**2);if(r<e)return t;const a=Math.atan2(t.y-n.y,t.x-n.x);return r>e?{map:n.map,x:n.x+Math.cos(a)*e,y:n.y+Math.sin(a)*e}:void 0}if(r.map==n.map){const t=a(n);if(can_move_to(t.x,t.y))return move(t.x,t.y)}const i=Date.now();this.searchStartTime=i;const o=this.getPath(n);if(this.searchFinishTime=Date.now(),!o)return Promise.reject(`We could not find a path from [${r.map},${r.x},${r.y}] to [${n.map},${n.x},${n.y}] in ${this.searchFinishTime-this.searchStartTime}ms`);async function s(t,e){if(e){if("town"!=e.type)return"transport"==e.type?(transport(t.map,e.spawn),void await new Promise(t=>setTimeout(t,Math.max(...parent.pings)+750))):"blink"==e.type?(use_skill("blink",[t.x,t.y]),void await new Promise(t=>setTimeout(t,Math.max(...parent.pings)+750))):void 0;distance(parent.character,t)<f?await Promise.race([move(t.x,t.y),new Promise(t=>setTimeout(t,1e4))]):(use_skill("town"),await new Promise(t=>setTimeout(t,Math.max(...parent.pings)+2e3)))}else await Promise.race([move(t.x,t.y),new Promise(t=>setTimeout(t,1e4))])}this.moveStartTime=Date.now();for(let r=0;r<o.length;){const n=o[r][0];let c;c=r==o.length-1?a(o[r][1]):o[r][1];let p=o[r][2],h=Math.sqrt((Math.trunc(c.x)-Math.trunc(parent.character.real_x))**2+(Math.trunc(c.y)-Math.trunc(parent.character.real_y))**2);if(this.wasCancelled(i))return Promise.reject("cancelled");if(h<1)r++;else if(parent.character.c.town||parent.character.moving)await new Promise(t=>setTimeout(t,50));else{if(!p&&!can_move_to(c.x,c.y)||parent.character.map!==n.map)return console.warn("NGraphMove movement failed. We're going to teleport to town and try again."),console.log("---- Link -----"),console.log(p),console.log("---------------"),console.log("----- Character Position -----"),console.log(`{map: "${parent.character.map}", x: ${parent.character.real_x}, y: ${parent.character.real_y}`),use_skill("town"),await new Promise(t=>setTimeout(t,Math.max(...parent.pings)+2e3)),this.move(t,e);if(can_use("blink")&&parent.character.mp>G.skills.blink.mp){let t=r;for(;t<o.length&&(h+=Math.sqrt((o[t][1].x-o[t][0].x)**2+(o[t][1].y-o[t][0].y)**2),o[t][0].map==o[t][1].map);t++);h>f&&(t==o.length?(c=o[t-1][1],r=t-2):(c=o[t][0],r=t-1),p={type:"blink"})}await s(c,p)}}this.moveFinishTime=Date.now()}}class d{constructor(){this.itemsToKeep=["computer","tracker","goldbooster","luckbooster","xpbooster","hpot1","mpot1","jacko","lantern","orbg","test_orb"],this.itemsToSell={shoes:2,pants:2,coat:2,helmet:2,gloves:2,cclaw:2,hpamulet:1,hpbelt:1,ringsj:1,vitearring:1,vitring:1},this.itemsToDismantle={},this.itemsToExchange=new Set(["5bucks","gem0","gem1","seashell","leather","candycane","mistletoe","ornament","candy0","candy1","redenvelopev3","basketofeggs","armorbox","bugbountybox","gift0","gift1","mysterybox","weaponbox","xbox"]),this.itemsToBuy=new Set([...this.itemsToExchange,"dexbelt","intbelt","strbelt","ctristone","dexring","intring","ringofluck","strring","suckerpunch","tristone","dexearring","intearring","lostearring","strearring","amuletofm","dexamulet","intamulet","snring","stramulet","t2dexamulet","t2intamulet","t2stramulet","charmer","ftrinket","jacko","orbg","orbofdex","orbofint","orbofsc","orbofstr","rabbitsfoot","talkingskull","t2quiver","lantern","mshield","quiver","sshield","xshield","angelwings","bcape","cape","ecape","stealthcape","hboots","mrnboots","mwboots","shoes1","wingedboots","xboots","hpants","mrnpants","mwpants","pants1","starkillers","xpants","cdragon","coat1","harmor","mcape","mrnarmor","mwarmor","tshirt0","tshirt1","tshirt2","tshirt3","tshirt4","tshirt6","tshirt7","tshirt8","tshirt88","tshirt9","warpvest","xarmor","eears","fury","helmet1","hhelmet","mrnhat","mwhelmet","partyhat","rednose","xhelmet","gloves1","goldenpowerglove","handofmidas","hgloves","mrngloves","mwgloves","poker","powerglove","xgloves","basher","bataxe","bowofthedead","candycanesword","carrotsword","crossbow","dartgun","firebow","frostbow","froststaff","gbow","harbringer","hbow","merry","oozingterror","ornamentstaff","pmace","t2bow","t3bow","wblade","ascale","bfur","cscale","electronics","feather0","fireblade","goldenegg","goldingot","goldnugget","leather","networkcard","platinumingot","platinumnugget","pleather","snakefang","x0","x1","x2","x3","x4","x5","x6","x7","x8","egg0","egg1","egg2","egg3","egg4","egg5","egg6","egg7","egg8","essenceofether","essenceoffire","essenceoffrost","essenceoflife","essenceofnature","bunnyelixir","candypop","elixirdex0","elixirdex1","elixirdex2","elixirint0","elixirint1","elixirint2","elixirluck","elixirstr0","elixirstr1","elixirstr2","greenbomb","hotchocolate","cscroll3","scroll3","scroll4","bottleofxp","bugbountybox","monstertoken","poison","snakeoil"]),this.holdPosition=!1,this.holdAttack=!1}async mainLoop(){try{if("merchant"!=parent.character.ctype&&(this.equipBetterItems(),this.getMonsterhuntQuest(),await Object(o.b)()),this.getNewYearTreeBuff(),Object(o.e)(this.itemsToDismantle),null==parent.character.slots.elixir){const t=Object(i.c)("candypop");t.length&&equip(t[0].index)}for(const t of Object(i.h)({isCtype:"merchant",isWithinDistance:400}))for(const e in t.slots){const r=t.slots[e];r&&(r.giveaway&&(r.list.includes(parent.character.id)||parent.socket.emit("join_giveaway",{slot:e,id:t.id,rid:r.rid})))}for(const t of Object(i.h)({isCtype:"merchant",isWithinDistance:400}))for(const e in t.slots){const r=t.slots[e];if(r&&(!r.b&&r.rid&&this.itemsToBuy.has(r.name)&&!(r.price>2*G.items[r.name].g||parent.character.gold<r.price)))if(r.q){const n=Math.min(r.q,Math.trunc(parent.character.gold/r.price));parent.socket.emit("trade_buy",{slot:e,id:t.id,rid:r.rid,q:n})}else parent.socket.emit("trade_buy",{slot:e,id:t.id,rid:r.rid,q:1})}}catch(t){console.error(t)}setTimeout(async()=>{this.mainLoop()},Math.max(250,parent.character.ping))}async run(){await this.lootSetup(),await this.infoSetup(),this.infoLoop(),this.healLoop(),this.scareLoop(),await this.moveSetup(),this.moveLoop(),this.mainLoop(),this.attackLoop()}async lootSetup(){parent.socket.on("drop",t=>{if(distance(parent.character,t)>800)return;const e=Object(s.c)();let r=!0;for(const n of parent.party_list){if(n==parent.character.id)continue;const a=parent.entities[n];if(a&&(!(distance(a,t)>800)&&e[n])){if(["chest3","chest4"].includes(t.chest)){if(parent.character.goldm>=e[n].goldm)continue}else if(parent.character.luckm>=e[n].luckm)continue;r=!1;break}}r&&parent.socket.emit("open_chest",{id:t.id})})}async infoSetup(){game.on("hit",t=>{if(!t.kill)return;const e=parent.entities[t.target];if(e&&e.mtype&&["fvampire","greenjr","jr","mvampire"].includes(e.mtype)&&G.monsters[e.mtype].respawn&&G.monsters[e.mtype].respawn>0){const t=2.2*G.monsters[e.mtype].respawn*1e3;console.info(`Setting respawn timer for ${e.mtype} for ${t}ms`),setTimeout(async()=>{const t=Object(s.a)();t[e.mtype]={id:"-1",lastSeen:new Date,map:e.map,x:e.real_x,y:e.real_y},Object(s.e)(t)},t)}})}async infoLoop(){const t=Object(s.c)();t[parent.character.name]={lastSeen:new Date,shouldSwitchServer:this.shouldSwitchServer(),monsterHuntTargets:this.getMonsterHuntTargets(),items:Object(i.i)(),attack:parent.character.attack,frequency:parent.character.frequency,goldm:parent.character.goldm,last_ms:parent.character.last_ms,luckm:parent.character.luckm,map:parent.character.map,x:parent.character.real_x,y:parent.character.real_y,s:parent.character.s},Object(s.g)(t);const e=Object(s.d)();let r=!1;for(const t of Object(i.h)({isPlayer:!0,isPartyMember:!1}))e[t.id]={lastSeen:new Date,rip:t.rip,map:t.map,x:t.real_x,y:t.real_y,s:t.s,ctype:t.ctype},r=!0;r&&Object(s.h)(e);const n=Object(s.b)();r=!1;for(const t of["Angel","Kane"])parent.entities[t]&&(n[t]={lastSeen:new Date,map:parent.entities[t].map,x:parent.entities[t].real_x,y:parent.entities[t].real_y},r=!0);r&&Object(s.f)(n);const a=Object(s.a)();r=!1;for(const t of Object(i.h)({isMonster:!0,isRIP:!1}))["fvampire","goldenbat","greenjr","jr","mvampire","pinkgoo","snowman","wabbit"].includes(t.mtype)&&(a[t.mtype]={lastSeen:new Date,id:t.id,x:t.real_x,y:t.real_y,map:t.map},r=!0);r&&Object(s.e)(a),setTimeout(async()=>{this.infoLoop()},2e3)}getMonsterHuntTargets(){const t=[],e=Object(s.c)();for(const r of parent.party_list){const n=e[r];if(!n)continue;if(!n.s.monsterhunt||0==n.s.monsterhunt.c)continue;const a=n.s.monsterhunt.id;if(!this.targetPriority[a])continue;const o=this.targetPriority[a].coop;if(o){const t=Object(i.j)();if(o.filter(e=>!t.has(e)).length)continue}let s=0;["fvampire","goldenbat","greenjr","jr","mvampire","phoenix","pinkgoo","snowman","wabbit"].includes(a)&&(s=1);const c=n.s.monsterhunt.ms-(Date.now()-n.last_ms.getTime());t.push({target:a,priority:s,timeLeft:c})}return t.sort((t,e)=>t.priority!==e.priority?e.priority-t.priority:t.timeLeft-e.timeLeft),t.reduce((t,e)=>(t.push(e.target),t),[])}shouldSwitchServer(){if("merchant"==parent.character.ctype)return!0;if(!parent.character.s.monsterhunt)return!1;if(0==parent.character.s.monsterhunt.c)return!1;if(this.getMonsterHuntTargets().length)return!1;for(const t in parent.S)if("grinch"!=t&&!(parent.S[t].hp/parent.S[t].max_hp>.9)&&parent.S[t].live&&this.targetPriority[t])return!1;return!0}async attackLoop(){try{const t=this.getTargets(1);t.length&&this.wantToAttack(t[0])&&(await attack(t[0]),reduce_cooldown("attack",Math.min(...parent.pings)))}catch(t){return"cooldown"==t.reason?void setTimeout(async()=>{this.attackLoop()},Math.min(...parent.pings)-t.remaining):(["not_found","disabled"].includes(t.reason)||console.error(t),void setTimeout(async()=>{this.attackLoop()},Object(i.e)("attack")))}setTimeout(async()=>{this.attackLoop()},Object(i.e)("attack",!0))}async scareLoop(){try{const t=Object(i.h)({isAttackingUs:!0,isMonster:!0,isRIP:!1});let e=!1;if(t.length>=3)e=!0;else if(t.length&&parent.character.s.burned)e=!0;else if(t.length&&!this.targetPriority[t[0].mtype])e=!0;else if(parent.character.c.town&&(t.length>1||1==t.length&&distance(t[0],parent.character)-t[0].range-2*t[0].speed))e=!0;else for(const r of t)if(!(distance(r,parent.character)>r.range||6*Object(i.a)(r,parent.character)[1]*r.frequency<=parent.character.hp)){e=!0;break}if(!Object(i.m)("scare")||!e)return void setTimeout(async()=>{this.scareLoop()},Object(i.e)("scare"));if("jacko"==parent.character.slots.orb.name)await use_skill("scare"),reduce_cooldown("scare",Math.min(...parent.pings));else{const t=Object(i.c)("jacko");if(t.length){const e=t[0].index;equip(e),await use_skill("scare"),reduce_cooldown("scare",Math.min(...parent.pings))}}}catch(t){console.error(t)}setTimeout(async()=>{this.scareLoop()},Object(i.e)("scare"))}getMovementLocation(t){if(!this.targetPriority[t])return;if(this.targetPriority[t].farmingPosition&&this.targetPriority[t].holdPositionFarm)return this.targetPriority[t].farmingPosition;if(Object(i.l)().has(t))return;if(this.targetPriority[t].farmingPosition)return distance(parent.character,this.targetPriority[t].farmingPosition)<parent.character.range?void 0:this.targetPriority[t].farmingPosition;if(parent.S[t]){if(!parent.S[t].live)return;return parent.S[t]}const e=Object(i.k)(t);return e||void 0}getMovementTarget(){if(parent.character.rip)return void set_message("RIP");if(parent.character.s.monsterhunt&&0==parent.character.s.monsterhunt.c)return set_message("Finish MH"),{target:"monsterhunter",position:G.maps.main.ref.monsterhunter,range:300};for(const t of Object(i.h)({isMonster:!0,isRIP:!1}))if(["fvampire","goldenbat","greenjr","jr","mvampire","phoenix","pinkgoo","snowman","wabbit"].includes(t.mtype)&&this.targetPriority[t.mtype])return set_message(t.mtype),{target:t.mtype,position:t,range:parent.character.range};const t=Object(s.c)(),e=Object(s.a)();for(const t in e){if(!this.targetPriority[t])continue;const r=e[t],n=this.targetPriority[t].coop;if(n){const t=Object(i.j)();if(n.filter(e=>!t.has(e)).length>0)continue}const a=parent.entities[r.id];if(a&&(r.x=a.real_x,r.y=a.real_y),!(distance(parent.character,r)<2*parent.character.range)||a)return set_message("SP "+t),this.targetPriority[t].farmingPosition&&this.targetPriority[t].holdPositionFarm?{target:t,position:this.targetPriority[t].farmingPosition,range:parent.character.range}:{target:t,position:r,range:parent.character.range};delete e[t],Object(s.e)(e)}if(G.maps.main.ref.newyear_tree&&!parent.character.s.holidayspirit)return set_message("Xmas Tree"),{target:"newyear_tree",position:G.maps.main.ref.newyear_tree,range:300};if(Object(i.n)())return set_message("Full!"),{target:"merchant",position:{map:"main",x:60,y:-325},range:300};for(const t in parent.S)if(parent.S[t].live&&this.targetPriority[t])return set_message(t),{target:t,position:parent.S[t],range:parent.character.range};const r=this.getMonsterHuntTargets();for(const e of r){const r=this.targetPriority[e].coop;if(!r)return set_message("MH "+e),{target:e,position:this.getMovementLocation(e)};{const n=new Set;for(const r of parent.party_list)t[r]&&t[r].monsterHuntTargets&&t[r].monsterHuntTargets[0]==e&&n.add(parent.party[r].type);if(0==r.filter(t=>!n.has(t)).length)return set_message("MH "+e),{target:e,position:this.getMovementLocation(e)}}}const n=[];return this.nGraphMove.graph.forEachNode(t=>{n.push(t.id,t.data)}),parent.character.s.monsterhunt?this.mainTarget?(set_message(this.mainTarget),{target:this.mainTarget,position:this.getMovementLocation(this.mainTarget)}):void 0:(set_message("New MH"),{target:"monsterhunter",position:G.maps.main.ref.monsterhunter,range:300})}async moveSetup(){try{const t=Date.now();this.nGraphMove=await m.getInstance(),console.info(`Took ${Date.now()-t}ms to prepare pathfinding.`),character.on("stacked",()=>{console.info(`Scrambling ${parent.character.id} because we're stacked!`);const t=-25+Math.round(50*Math.random()),e=-25+Math.round(50*Math.random());move(parent.character.real_x+t,parent.character.real_y+e)})}catch(t){console.error(t)}}moveLoop(){try{if(this.holdPosition||smart.moving)return void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping));const t=this.movementTarget;if(this.movementTarget=this.getMovementTarget(),this.movementTarget&&this.movementTarget.position){if(!t||this.movementTarget.target!=t.target)return this.nGraphMove.stop(),this.nGraphMove.move(this.movementTarget.position,this.movementTarget.range),void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping));if(!this.nGraphMove.isMoving())return this.nGraphMove.move(this.movementTarget.position,this.movementTarget.range),void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping))}const e=this.getTargets(1);e.length&&e[0].mtype==this.movementTarget.target&&this.targetPriority[e[0].mtype]&&!this.targetPriority[e[0].mtype].holdPositionFarm&&this.nGraphMove.stop();const r=get_targeted_monster();if(r&&r.rip&&(change_target(null,!0),this.nGraphMove.stop()),this.nGraphMove.isMoving())return Date.now()-this.nGraphMove.searchStartTime>6e4&&this.nGraphMove.stop(),void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping));if(this.targetPriority[this.movementTarget.target]&&this.targetPriority[this.movementTarget.target].holdPositionFarm)return void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping));const n=[],a=[],o=[],s=[],c=[],p=[],h=[],u=[];for(const t in parent.entities){const e=parent.entities[t];if(e.rip)continue;if(!this.targetPriority[e.mtype])continue;const r=distance(parent.character,e),l=Math.max(e.range+e.speed,50);l<parent.character.range&&r<l&&(e.hp>Object(i.a)(parent.character,e)[0]||this.targetPriority[e.mtype].holdAttackInEntityRange||e.target==parent.character.name)&&n.push(e),!e.target&&r<50&&a.push(e),r<parent.character.range?(o.push(e),this.movementTarget.target==e.mtype&&s.push(e)):r<2*parent.character.range&&(c.push(e),this.movementTarget.target==e.mtype&&p.push(e)),h.push(e),this.movementTarget.target==e.mtype&&u.push(e)}if(n.length){const t={x:0,y:0};let e=0;for(const r of n)t.x+=r.real_x,t.y+=r.real_y,r.range+r.speed>e&&(e=r.range+r.speed);t.x/=n.length,t.y/=n.length;const r=Math.atan2(parent.character.real_y-t.y,parent.character.real_x-t.x),a=Math.min(parent.character.range,1.5*e),i=(t,e)=>{const r=Math.cos(t)*e,n=Math.sin(t)*e;return{x:parent.character.real_x+r,y:parent.character.real_y+n}};let o=i(r,a),s=0;for(;!can_move_to(o.x,o.y)&&s<180;)s=s<=0?1-s:-s,o=i(r+s*Math.PI/180,a);return move(o.x,o.y),void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping))}if(s.length)return void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping));if(u.length){let t,e=Number.MAX_VALUE;for(const r of u){const n=distance(parent.character,r);n<e&&(e=n,t=r)}return this.nGraphMove.move(t,parent.character.range),void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping))}if(h.length){let t,e=Number.MAX_VALUE;for(const r of h){const n=distance(parent.character,r);n<e&&(e=n,t=r)}return this.nGraphMove.move(t,parent.character.range),void setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping))}}catch(t){console.error(t)}setTimeout(async()=>{this.moveLoop()},Math.max(400,parent.character.ping))}async healLoop(){try{if(parent.character.rip)return respawn(),void setTimeout(async()=>{this.healLoop()},Object(i.e)("use_town"));if(!Object(i.m)("use_hp"))return void setTimeout(async()=>{this.healLoop()},Object(i.e)("use_hp"));const t=["hpot0","hpot1"],e=["mpot0","mpot1"];let r=null,n=null;for(let a=parent.character.items.length-1;a>=0;a--){const i=parent.character.items[a];if(i&&(!n&&t.includes(i.name)?n=i:!r&&e.includes(i.name)&&(r=i),n&&r))break}const a=parent.character.hp/parent.character.max_hp,o=parent.character.mp/parent.character.max_mp;a<=o&&1!=a&&(!n||"hpot0"==n.name&&(parent.character.hp<=parent.character.max_hp-200||parent.character.hp<50)||"hpot1"==n.name&&(parent.character.hp<=parent.character.max_hp-400||parent.character.hp<50))?(await use_skill("use_hp"),reduce_cooldown("use_hp",Math.min(...parent.pings)),reduce_cooldown("use_mp",Math.min(...parent.pings))):1!=o&&(!r||"mpot0"==r.name&&(parent.character.mp<=parent.character.max_mp-300||parent.character.mp<50)||"mpot1"==r.name&&(parent.character.mp<=parent.character.max_mp-500||parent.character.mp<50))?(await use_skill("use_mp"),reduce_cooldown("use_hp",Math.min(...parent.pings)),reduce_cooldown("use_mp",Math.min(...parent.pings))):a<o?(await use_skill("regen_hp"),reduce_cooldown("use_hp",Math.min(...parent.pings)),reduce_cooldown("use_mp",Math.min(...parent.pings))):o<a&&(await use_skill("regen_mp"),reduce_cooldown("use_hp",Math.min(...parent.pings)),reduce_cooldown("use_mp",Math.min(...parent.pings)))}catch(t){console.error(t)}setTimeout(async()=>{this.healLoop()},Object(i.e)("use_hp"))}getNewYearTreeBuff(){G.maps.main.ref.newyear_tree&&(parent.character.s.holidayspirit||distance(parent.character,G.maps.main.ref.newyear_tree)>400||parent.socket.emit("interaction",{type:"newyear_tree"}))}getMonsterhuntQuest(){distance(parent.character,G.maps.main.ref.monsterhunter)>400||(parent.character.s.monsterhunt?0==parent.character.s.monsterhunt.c&&parent.socket.emit("monsterhunt"):parent.socket.emit("monsterhunt"))}parseCM(t,e){if(parent.party_list.includes(t)||parent.character.name==t||["earthiverse","earthMag","earthMag2"].includes(t)||"monster"==e.message){if("info"==e.message){const r=Object(s.c)();r[t]=e.info,Object(s.g)(r)}else if("monster"==e.message){const t=Object(s.a)();t[e.id]=e.info,Object(s.e)(t)}else if("npc"==e.message){const t=Object(s.b)();t[e.id]=e.info,Object(s.f)(t)}else if("player"==e.message){const t=Object(s.d)();t[e.id]=e.info,Object(s.h)(t)}else if("chests"==e.message)for(const t in e.chests)parent.chests[t]||(parent.chests[t]=e.chests[t])}else game_log("Blocked CM from "+t)}equipBetterItems(){try{const t=Object(i.i)();if(this.movementTarget.target&&this.targetPriority[this.movementTarget.target])for(const e of this.targetPriority[this.movementTarget.target].equip||[]){let r=!1;for(const t in parent.character.slots){const n=parent.character.slots[t];if(n&&n.name==e){r=!0;break}}if(!r)for(const r of t)if(r.name==e){G.classes[parent.character.ctype].doublehand[G.items[e].wtype]&&unequip("offhand"),equip(r.index);break}}for(const e in parent.character.slots){let r,n=parent.character.slots[e];if(n){for(const e of t)e.name==n.name&&(!e.level||e.level<=n.level||(n=e,r=e));r&&equip(r.index,e)}}}catch(t){console.error(t)}}getTargets(t=1,e=parent.character.range){const r=[],n=parent.party_list,o=new Set;for(const t in parent.entities)if(n.includes(t)){const e=parent.entities[t].target;e&&o.add(e)}const s=new a.a((t,e)=>t.priority>e.priority);for(const t in parent.entities){const r=parent.entities[t];if(r.rip)continue;if(parent.party_list.includes(t))continue;if(!is_pvp()&&"monster"!=r.type)continue;if(is_pvp()&&parent.party_list.includes(t))continue;if(!this.targetPriority[r.mtype]&&r.target!=parent.character.name)continue;if(!r.cooperative&&r.target&&!parent.party_list.includes(r.target))continue;let n=this.targetPriority[r.mtype]?this.targetPriority[r.mtype].priority:0;const a=distance(parent.character,r);if(a>e)continue;if(n-=a,o.has(t)&&(this.targetPriority[r.mtype]&&this.targetPriority[r.mtype].coop&&(n+=parent.character.range),r.hp<=Object(i.a)(parent.character,r)[0]&&(n-=parent.character.range)),r.s&&r.s.burned){(r.s.burned.ms-500-r.s.burned.ms%1e3)/1e3*r.s.burned.intensity>r.hp&&(n-=5e3)}r.mtype==this.mainTarget&&(n+=250),this.movementTarget&&r.mtype==this.movementTarget.target&&(n+=1e3),r.target==parent.character.name&&(n+=2e3),r.cooperative&&(n+=1e3*(r.max_hp-r.hp)/r.max_hp);const c={id:r.id,priority:n};s.add(c)}for(;r.length<t&&s.size>0;){const t=parent.entities[s.poll().id];t&&r.push(t)}return r.length>0&&change_target(r[0],!0),r}wantToAttack(t,e="attack"){if(!Object(i.m)(e))return!1;if(parent.character.c.town)return!1;let r=G.skills[e].range?G.skills[e].range:parent.character.range;const n=distance(parent.character,t);if(G.skills[e].range_multiplier&&(r*=G.skills[e].range_multiplier),n>r)return!1;const a=G.skills[e].mp?G.skills[e].mp:parent.character.mp_cost;if(parent.character.mp<a)return!1;if("attack"!=e&&t.immune)return!1;if("attack"!=e&&t["1hp"])return!1;if(!is_pvp()&&"monster"==t.type&&!this.targetPriority[t.mtype])return!1;if(!t.target){if(this.holdAttack)return!1;if((smart.moving||this.nGraphMove.isMoving())&&this.movementTarget&&this.movementTarget.target&&this.movementTarget.target!=t.mtype&&this.targetPriority[t.mtype].holdAttackWhileMoving)return!1;if(this.targetPriority[t.mtype].holdAttackInEntityRange&&n<=t.range)return!1;if(this.targetPriority[t.mtype].coop){const e=[parent.character.ctype];for(const t of parent.party_list){const r=parent.entities[t];r&&(r.rip||"priest"==r.ctype&&distance(parent.character,r)>r.range||e.push(r.ctype))}for(const r of this.targetPriority[t.mtype].coop)if(!e.includes(r))return!1}if(parent.character.s.burned)return!1;if(5*Object(i.a)(t,parent.character)[1]*t.frequency>parent.character.hp&&(this.targetPriority[t.mtype].holdAttackInEntityRange||n<=t.range))return!1}return!0}}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],r=0;r<e.length;++r)if(t.hasOwnProperty(e[r]))throw new Error("Subject cannot be eventified, since it already has property '"+e[r]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(r,n,a){if("function"!=typeof n)throw new Error("callback is expected to be a function");var i=e[r];return i||(i=e[r]=[]),i.push({callback:n,ctx:a}),t},off:function(r,n){if(void 0===r)return e=Object.create(null),t;if(e[r])if("function"!=typeof n)delete e[r];else for(var a=e[r],i=0;i<a.length;++i)a[i].callback===n&&a.splice(i,1);return t},fire:function(r){var n,a=e[r];if(!a)return t;arguments.length>1&&(n=Array.prototype.splice.call(arguments,1));for(var i=0;i<a.length;++i){var o=a[i];o.callback.apply(o.ctx,n)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,r){t.exports=function(t,e){var r=(e=e||{}).oriented,i=e.heuristic;i||(i=o.heuristic);var p=e.distance;p||(p=o.distance);var h=a();return{find:function(e,a){var u=t.getNode(e);if(!u)throw new Error("fromId is not defined in this graph: "+e);var l=t.getNode(a);if(!l)throw new Error("toId is not defined in this graph: "+a);h.reset();var f,m=new Map,d=new n({compare:o.compareFScore,setNodeId:o.setHeapIndex}),g=h.createNewState(u);m.set(e,g),g.fScore=i(u,l),g.distanceToSource=0,d.push(g),g.open=1;for(;d.length>0;){if(f=d.pop(),y=l,f.node===y)return c(f);f.closed=!0,t.forEachLinkedNode(f.node.id,v,r)}var y;return s;function v(t,e){var r=m.get(t.id);if(r||(r=h.createNewState(t),m.set(t.id,r)),!r.closed){0===r.open&&(d.push(r),r.open=1);var n=f.distanceToSource+p(t,f.node,e);n>=r.distanceToSource||(r.parent=f,r.distanceToSource=n,r.fScore=n+i(r.node,l),d.updateItem(r.heapIndex))}}}}};var n=r(3),a=r(7),i=r(4),o=r(5),s=o.NO_PATH;function c(t){for(var e=[t.node],r=t.parent;r;)e.push(r.node),r=r.parent;return e}t.exports.l2=i.l2,t.exports.l1=i.l1},function(t,e,r){t.exports=function(t,e){var r=(e=e||{}).oriented,i=e.heuristic;i||(i=o.heuristic);var c=e.distance;c||(c=o.distance);var p=a();return{find:function(e,a){var h=t.getNode(e);if(!h)throw new Error("fromId is not defined in this graph: "+e);var u=t.getNode(a);if(!u)throw new Error("toId is not defined in this graph: "+a);if(h===u)return[h];p.reset();var l=r?function(t,e){if(1===_){if(e.fromId===w.node.id)return M(t,e,w)}else if(2===_&&e.toId===w.node.id)return M(t,e,w)}:function(t,e){return M(t,e,w)},f=new Map,m=new n({compare:o.compareFScore,setNodeId:o.setHeapIndex}),d=new n({compare:o.compareFScore,setNodeId:o.setHeapIndex}),g=p.createNewState(h);f.set(e,g),g.fScore=i(h,u),g.distanceToSource=0,m.push(g),g.open=1;var y=p.createNewState(u);y.fScore=i(u,h),y.distanceToSource=0,d.push(y),y.open=2;var v,b,k=Number.POSITIVE_INFINITY,x=m,_=1;for(;m.length>0&&d.length>0;){m.length<d.length?(_=1,x=m):(_=2,x=d);var w=x.pop();if(w.closed=!0,!(w.distanceToSource>k)&&(t.forEachLinkedNode(w.node.id,l),v&&b))return T(v,b)}return s;function T(t,e){for(var r=[],n=t;n;)r.push(n.node),n=n.parent;for(var a=e;a;)r.unshift(a.node),a=a.parent;return r}function M(t,e,r){var n=f.get(t.id);if(n||(n=p.createNewState(t),f.set(t.id,n)),!n.closed)if((o=n.open)&&o!==_){var a=n.distanceToSource+r.distanceToSource;a<k&&(v=n,b=r,k=a)}else{var o,s=r.distanceToSource+c(n.node,r.node,e);if(!(s>=n.distanceToSource)){var l=1===_?u:h,m=s+i(n.node,l);m>=k||(n.fScore=m,0===n.open&&(x.push(n),x.updateItem(n.heapIndex),n.open=_),n.parent=r,n.distanceToSource=s)}}}}}};var n=r(3),a=r(7),i=r(4),o=r(5),s=o.NO_PATH;t.exports.l2=i.l2,t.exports.l1=i.l1},function(t,e,r){t.exports=function(t,e){var r=(e=e||{}).oriented,a=e.quitFast,c=e.heuristic;c||(c=i.heuristic);var p=e.distance;p||(p=i.distance);var h=o();return{find:function(e,o){var u=t.getNode(e);if(!u)throw new Error("fromId is not defined in this graph: "+e);var l=t.getNode(o);if(!l)throw new Error("toId is not defined in this graph: "+o);h.reset();var f,m=r?function(t,e){if(e.fromId===w.node.id)return j(t,e)}:j,d=r?function(t,e){if(e.toId===w.node.id)return S(t,e)}:S,g=new Map,y=new n({compare:i.compareF1Score,setNodeId:i.setH1}),v=new n({compare:i.compareF2Score,setNodeId:i.setH2}),b=Number.POSITIVE_INFINITY,k=h.createNewState(u);g.set(e,k),k.g1=0;var x=c(u,l);k.f1=x,y.push(k);var _=h.createNewState(l);g.set(o,_),_.g2=0;var w,T=x;_.f2=T,v.push(_);for(;v.length&&y.length&&(y.length<v.length?M():O(),!a||!f););return function(t){if(!t)return s;var e=[t.node],r=t.p1;for(;r;)e.push(r.node),r=r.p1;var n=t.p2;for(;n;)e.unshift(n.node),n=n.p2;return e}(f);function M(){(w=y.pop()).closed||(w.closed=!0,w.f1<b&&w.g1+T-c(u,w.node)<b&&t.forEachLinkedNode(w.node.id,m),y.length>0&&(x=y.peek().f1))}function O(){(w=v.pop()).closed||(w.closed=!0,w.f2<b&&w.g2+x-c(w.node,l)<b&&t.forEachLinkedNode(w.node.id,d),v.length>0&&(T=v.peek().f2))}function j(t,e){var r=g.get(t.id);if(r||(r=h.createNewState(t),g.set(t.id,r)),!r.closed){var n=w.g1+p(w.node,t,e);n<r.g1&&(r.g1=n,r.f1=n+c(r.node,l),r.p1=w,r.h1<0?y.push(r):y.updateItem(r.h1));var a=r.g1+r.g2;a<b&&(b=a,f=r)}}function S(t,e){var r=g.get(t.id);if(r||(r=h.createNewState(t),g.set(t.id,r)),!r.closed){var n=w.g2+p(w.node,t,e);n<r.g2&&(r.g2=n,r.f2=n+c(u,r.node),r.p2=w,r.h2<0?v.push(r):v.updateItem(r.h2));var a=r.g1+r.g2;a<b&&(b=a,f=r)}}}}};var n=r(3),a=r(4),i=r(5),o=r(16),s=i.NO_PATH;t.exports.l2=a.l2,t.exports.l1=a.l1},function(t,e){function r(t){this.node=t,this.p1=null,this.p2=null,this.closed=!1,this.g1=Number.POSITIVE_INFINITY,this.g2=Number.POSITIVE_INFINITY,this.f1=Number.POSITIVE_INFINITY,this.f2=Number.POSITIVE_INFINITY,this.h1=-1,this.h2=-1}t.exports=function(){var t=0,e=[];return{createNewState:function(n){var a=e[t];a?(a.node=n,a.p1=null,a.p2=null,a.closed=!1,a.g1=Number.POSITIVE_INFINITY,a.g2=Number.POSITIVE_INFINITY,a.f1=Number.POSITIVE_INFINITY,a.f2=Number.POSITIVE_INFINITY,a.h1=-1,a.h2=-1):(a=new r(n),e[t]=a);return t++,a},reset:function(){t=0}}}},,,,,,,function(t,e,r){"use strict";r.r(e),r.d(e,"merchant",(function(){return c}));var n=r(10),a=r(0);var i=r(2),o=r(1);class s extends n.a{constructor(){super(),this.targetPriority={bee:{priority:1},crab:{priority:1},goo:{priority:1},hen:{priority:1},rooster:{priority:1},snowman:{priority:1}},this.mainTarget=null,this.didBankStuff=0,this.luckedCharacters={},this.itemsToKeep.splice(this.itemsToKeep.indexOf("jacko"),1),this.itemsToKeep.splice(this.itemsToKeep.indexOf("lantern"),1),this.itemsToKeep.splice(this.itemsToKeep.indexOf("orbg"),1),this.itemsToKeep.splice(this.itemsToKeep.indexOf("test_orb"),1),this.itemsToKeep.push("cscroll0","cscroll1","cscroll2","scroll0","scroll1","scroll2","stand0","dexscroll","intscroll","strscroll","monstertoken","platinumnugget","bow")}getMovementTarget(){if(parent.character.rip)return void set_message("RIP");let t;if(t=is_pvp()?{map:"woffice",x:0,y:0}:{map:"main",x:60,y:-325},G.maps.main.ref.newyear_tree&&!parent.character.s.holidayspirit)return set_message("Xmas Tree"),{target:"newyear_tree",position:G.maps.main.ref.newyear_tree,range:300};if(Object(a.n)())return set_message("Full!"),"bank"==parent.character.map?void 0:{target:"items4",position:{map:"bank",x:0,y:-400},range:10};for(const t in parent.S){const e=parent.S[t];if(e.live&&(!(e.hp>e.max_hp/2)&&e.target))return set_message(t),{target:t,position:e,range:50}}const e=Object(o.c)();for(const t in e){if(t==parent.character.name)continue;const r=parent.entities[t]?parent.entities[t]:e[t];if(r&&r.s&&(!r.s.mluck||r.s.mluck.f!=parent.character.id))return set_message("ML "+t),{position:r,range:G.skills.mluck.range-20}}const r=Object(o.d)();for(const t in r){if(t==parent.character.name)continue;const e=parent.entities[t]?parent.entities[t]:r[t];if(!(e.s&&e.s.mluck&&e.s.mluck.strong&&e.s.mluck.f!==parent.character.id)){if(distance(parent.character,e)<=G.skills.mluck.range&&(!e.s.mluck||Date.now()-r[t].lastSeen.getTime()>3e6||e.s.mluck.ms<18e5)){delete r[t],Object(o.h)(r);break}if((!e.s.mluck||Date.now()-r[t].lastSeen.getTime()>3e6||e.s.mluck.ms<18e5)&&!e.rip)return set_message("ML "+t),{position:e,range:G.skills.mluck.range-20}}}for(const t in e){if(t==parent.character.name)continue;const r=e[t];if(r&&r.items.length>20)return set_message("INV "+t),{position:r,range:240}}if(Date.now()-this.didBankStuff>24e4||Date.now()-this.didBankStuff<5e3+5*Math.max(...parent.pings))return set_message("Bank"),{position:{map:"bank",x:0,y:-400}};const n=Object(o.b)();if(n.Kane&&Date.now()-n.Kane.lastSeen.getTime()>24e4){if(!(distance(parent.character,n.Kane)<2*parent.character.range)||parent.entities.Kane)return set_message("Find Kane"),{position:n.Kane};delete n.Kane,Object(o.f)(n)}else if(n.Angel&&Date.now()-n.Angel.lastSeen.getTime()>24e4){if(!(distance(parent.character,n.Angel)<2*parent.character.range)||parent.entities.Angel)return set_message("Find Angel"),{position:n.Angel};delete n.Angel,Object(o.f)(n)}const i=Object(o.a)();for(const t in i){const e=i[t],r=parent.entities[e.id];r&&(e.x=r.real_x,e.y=r.real_y),distance(parent.character,e)<2*parent.character.range&&!r&&(delete i[t],Object(o.e)(i))}return set_message("Vendor"),{position:t}}async mainLoop(){try{Object(i.h)(this.itemsToSell);let t=0;for(let e=0;e<42;e++)parent.character.items[e]&&t++;t<25&&Object(i.f)(this.itemsToExchange),await this.newBankStuff(),parent.character.moving?Object(i.d)():Object(i.g)(),function(t){if("bank"!=parent.character.map&&!parent.character.q.upgrade){if(!Object(a.c)("computer").length){let t=!1;for(const e of parent.npcs)if("newupgrade"==e.id&&distance(parent.character,{x:e.position[0],y:e.position[1]})<350){t=!0;break}if(!t)return}for(let e=0;e<42;e++){if(!parent.character.items[e])continue;if(!G.items[parent.character.items[e].name].upgrade)continue;const r=Object(a.c)(parent.character.items[e].name);if(1==r.length)continue;r.sort((t,e)=>t.level-e.level);const n=r[0];if(n.level>=t)continue;const i=item_grade(n);let o;return 0==i?o=Object(a.b)("scroll0"):1==i?o=Object(a.b)("scroll1"):2==i&&(o=Object(a.b)("scroll2")),void(o&&upgrade(n.index,o.index))}}}(8),function(t){if("bank"==parent.character.map)return;if(parent.character.q.compound)return;if(!Object(a.c)("computer").length){let t=!1;for(const e of parent.npcs)if("newupgrade"==e.id&&distance(parent.character,{x:e.position[0],y:e.position[1]})<350){t=!0;break}if(!t)return}const e=[];for(const r of Object(a.i)())G.items[r.name].compound&&(r.level>=t||e.push(r));e.sort((t,e)=>t.name!=e.name?t.name.localeCompare(e.name):t.level-e.level);for(let t=0;t<e.length-2;t++)if(e[t].name==e[t+1].name&&e[t].name==e[t+2].name&&e[t].level==e[t+1].level&&e[t].level==e[t+2].level){const r=item_grade(e[t]);let n;return 0==r?n=Object(a.b)("cscroll0"):1==r?n=Object(a.b)("cscroll1"):2==r&&(n=Object(a.b)("cscroll2")),void compound(e[t].index,e[t+1].index,e[t+2].index,n.index)}}(4);let e=Object(a.b)("monstertoken");e.q>1&&(unequip("trade1"),await Object(a.p)(2*Math.min(...parent.pings)),e=Object(a.b)("monstertoken"),trade(e.index,"trade1",1e6,Math.min(9999,e.q-1)),await Object(a.p)(2*Math.min(...parent.pings))),await Object(i.c)(),await super.mainLoop()}catch(t){console.error(t),setTimeout(async()=>{this.mainLoop()},1e3)}}async run(){await this.lootSetup(),this.attackLoop(),this.healLoop(),this.scareLoop(),await this.moveSetup(),this.moveLoop(),await this.infoSetup(),this.infoLoop(),this.mainLoop(),this.luckLoop(),this.pontyLoop()}pontyLoop(){let t=!1;for(const e of parent.npcs)if("secondhands"==e.id&&distance(parent.character,{x:e.position[0],y:e.position[1]})<350){t=!0;break}t?(Object(i.a)(this.itemsToBuy),setTimeout(async()=>{this.pontyLoop()},15e3)):setTimeout(async()=>{this.pontyLoop()},250)}async newBankStuff(){if("bank"!=parent.character.map)return;if(Date.now()-this.didBankStuff<12e4)return;parent.character.gold>1e8?bank_deposit(parent.character.gold-1e8):parent.character.gold<1e8&&bank_withdraw(1e8-parent.character.gold);let t=Object(a.f)();for(const e of Object(a.i)()){if(0==t.length)break;if(this.itemsToKeep.includes(e.name))continue;if(e.q){let t=!1;for(const r in bank_packs){if(t)break;if(bank_packs[r][0]===parent.character.map)for(const n of Object(a.i)(parent.character.bank[r]))if(e.name==n.name&&e.q+n.q<=G.items[e.name].s){bank_store(e.index,r,n.index),t=!0;break}}if(t)continue}const r=t.shift();bank_store(e.index,r.pack,r.index)}await Object(a.p)(Math.max(...parent.pings));const e=[];for(const t of Object(a.i)())this.itemsToKeep.includes(t.name)||e.push({...t,pack:"items"});for(const t in bank_packs)if("gold"!=t&&bank_packs[t][0]===parent.character.map)for(const r of Object(a.i)(parent.character.bank[t]))e.push({...r,pack:t});function r(t,e,r,n){return t.name==e.name&&t.name==r.name&&t.name==n.name&&(t.p==e.p&&t.p==r.p&&t.p==n.p&&(e.level==r.level&&e.level==n.level&&(!!G.items[t.name].compound&&!(e.level>=Number.parseInt("4")))))}function n(t,e){return t.name==e.name&&(t.p==e.p&&(!!G.items[t.name].upgrade&&!(e.level>=Number.parseInt("8"))))}e.sort((t,e)=>{if(t.name<e.name)return-1;if(t.name>e.name)return 1;if(t.p&&!e.p)return-1;if(t.p&&e.p){if(t.p<e.p)return-1;if(t.p>e.p)return 1}if(t.level>e.level)return-1;if(t.level<e.level)return 1;if(t.q&&e.q){if(t.q>e.q)return-1;if(t.q<e.q)return 1}return 0});const i=t=>!!this.itemsToSell[t.name]&&(!(t.level&&t.level>this.itemsToSell[t.name])&&!t.p);await Object(a.p)(Math.max(...parent.pings));let o=Object(a.g)(parent.character.items);for(let t=1;t<e.length&&!(o.length<3);t++){const r=e[t-1],n=e[t];if(c=n,(s=r).name==c.name&&s.q){const i=G.items[r.name].s;if(r.q+n.q<i)if("items"!=r.pack&&"items"==n.pack)parent.socket.emit("bank",{operation:"swap",inv:n.index,str:-1,pack:r.pack});else if("items"==r.pack&&"items"==n.pack)parent.socket.emit("imove",{a:r.index,b:n.index});else{const t=o.shift();parent.socket.emit("bank",{operation:"swap",inv:-1,str:r.index,pack:r.pack}),parent.socket.emit("bank",{operation:"swap",inv:-1,str:n.index,pack:n.pack}),await Object(a.p)(Math.max(...parent.pings)),parent.socket.emit("bank",{operation:"swap",inv:t,str:r.index,pack:r.pack})}e.splice(t-1,2),t-=1}}var s,c;await Object(a.p)(Math.max(...parent.pings)),o=Object(a.g)(parent.character.items);for(let t=3;t<e.length&&!(o.length<5);t++){const n=e[t-3],a=e[t-2],i=e[t-1],s=e[t];r(n,a,i,s)&&("items"!=n.pack&&parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:n.index,pack:n.pack}),"items"!=n.pack&&parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:a.index,pack:a.pack}),"items"!=a.pack&&parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:i.index,pack:i.pack}),"items"!=i.pack&&parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:s.index,pack:s.pack}),e.splice(t-2,3),t-=1)}for(let t=1;t<e.length&&!(o.length<3);t++){const r=e[t-1],a=e[t];n(r,a)&&("items"!=r.pack&&parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:r.index,pack:r.pack}),"items"!=a.pack&&parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:a.index,pack:a.pack}),e.splice(t-1,2),t-=1)}for(let t=0;t<e.length;t++){const r=e[t];if(o.length<2)break;i(r)&&("items"!=r.pack&&parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:r.index,pack:r.pack}),e.splice(t,1),t-=1)}for(let t=0;t<e.length;t++){const r=e[t];if(o.length<2)break;"items"!=r.pack?this.itemsToExchange.has(r.name)&&(r.q<G.items[r.name].e||(parent.socket.emit("bank",{operation:"swap",inv:o.shift(),str:r.index,pack:r.pack}),e.splice(t,1),t-=1)):(e.splice(t,1),t-=1)}await Object(a.p)(Math.max(...parent.pings)),t=Object(a.f)();for(const e of Object(a.i)()){if("bow"!=e.name)continue;if(e.level<9){if(o.length){const t=o.pop();e.index<t&&swap(e.index,t)}continue}const r=t.shift();bank_store(e.index,r.pack,r.index)}this.didBankStuff=Date.now()}async luckLoop(){try{if(parent.character.mp<10)return void setTimeout(async()=>{this.luckLoop()},Object(a.e)("mluck"));(!parent.character.s.mluck||parent.character.s.mluck.ms<1e4||parent.character.s.mluck.f!=parent.character.name)&&(use_skill("mluck",parent.character),await Object(a.p)(G.skills.mluck.cooldown));for(const t in parent.entities){const e=parent.entities[t];!Object(a.o)(e)||distance(parent.character,e)>G.skills.mluck.range||!Object(a.m)("mluck")||(this.luckedCharacters[e.name]&&this.luckedCharacters[e.name]>Date.now()-2*parent.character.ping||e.s&&e.s.mluck&&e.s.mluck.strong&&e.s.mluck.f!=parent.character.id||(!e.s||!e.s.mluck||e.s.mluck.ms<354e4||e.s.mluck.f!=parent.character.name)&&(this.luckedCharacters[e.name]=Date.now(),use_skill("mluck",e),await Object(a.p)(G.skills.mluck.cooldown)))}}catch(t){console.error(t),console.error(parent.entities)}setTimeout(async()=>{this.luckLoop()},Object(a.e)("mluck"))}}const c=new s}]);