Advertisement
spidhrum

Untitled

Jan 16th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.90 KB | None | 0 0
  1. (()=>{new class{constructor(){this.interface=\"object\"==typeof window.Engine?\"ni\":\"si\",this.npcsOutOfView=[],this.initAjaxParser(),this.actual=0}get hero(){return\"ni\"===this.interface?window.Engine.hero.d:window.hero}get map(){return\"ni\"===this.interface?window.Engine.map.d:window.map}get npcs(){return\"ni\"===this.interface?this.npcsOnNewInterface:window.g.npc}get npcsOnNewInterface(){const d={};for(const[a,b]of Object.entries(window.Engine.npcs.check()))d[a]=b.d;return d}npcInOutOfRange({x:e,y:a},{x:b,y:c}){return Math.abs(b-e)>this.map.visibility||Math.abs(c-a)>this.map.visibility}initAjaxParser(){const e=this,a=window.$.ajax;window.$.ajax=(...d)=>{if(-1<d[0].url.indexOf(\"/engine?t=\")){const a=d[0].success;d[0].success=(...b)=>{const c=\"object\"==typeof b[0]&&null!==b[0]&&\"ok\"===b[0].e;return c&&(b[0]=e.parseInput(b[0])),a.apply(this,b)}}return a.apply(this,d)}}parseInput(e){if(this.actual!=this.map.id&&(this.actual=this.map.id,this.npcsOutOfView=[]),0!==this.map.visibility&&e.hasOwnProperty(\"npc\")&&void 0!==e.npc)for(const[a,b]of Object.entries(e.npc))b.hasOwnProperty(\"del\")&&1===b.del&&void 0!==this.npcs[a]&&[2,3].includes(this.npcs[a].type)&&this.npcInOutOfRange(this.hero,this.npcs[a])&&(this.npcsOutOfView.push(a),delete e.npc[a]);if(e.hasOwnProperty(\"h\")&&e.h.hasOwnProperty(\"x\")&&e.h.hasOwnProperty(\"y\")){const a=[];for(const[b,c]of Object.entries(this.npcs))this.npcsOutOfView.includes(b)&&!this.npcInOutOfRange(e.h,c)&&(this.npcsOutOfView.splice(this.npcsOutOfView.indexOf(b),1),(e.hasOwnProperty(\"npc\")&&void 0===e.npc[b]||!e.hasOwnProperty(\"npc\"))&&a.push(b));if(0<a.length){e.hasOwnProperty(\"npc\")||(e.npc={});for(const b of a)e.npc[b]={del:2}}}return e}}})();\n(()=>{new class{constructor(){this.interface=window.getCookie(`interface`);const a=this;window.hero._Move=function(){return a.m.apply(a,arguments)},window.hero._Closest=function(){return a.c.apply(a,arguments)}}b(c,a){const b=[],d=this;for(let d=0;d<this.map.y;d++){b[d]=[];for(let a,c=0;c<this.map.x;c++)a=(a,b)=>this.npccol(a,b),b[d][c]=this.npccol(c,d)||(`undefined`==typeof window._0x4270?window.cols:window.map.col)&&\"0\"!=(`undefined`==typeof window._0x4270?window.cols:window.map.col).charAt(c+d*this.map.x)?-2:-1}const f={x:c,y:a};var g=!1;return b[this.hero.y][this.hero.x]=\"S\",-2==b[f.y][f.x]&&(b[f.y][f.x]=-1,g=!0),this.npc.forEach(a=>{(2==a.type||3==a.type)&&(b[a.y][a.x]=-1)}),new class{constructor(a,b,c){this.a=a,this.b=b,this.n=c,this.r=[],this.r.push({x:this.b,y:this.a})}nP(){let c=[];for(let a in this.r){if(b[this.r[a].y-1]&&b[this.r[a].y-1][this.r[a].x]&&-1==b[this.r[a].y-1][this.r[a].x]&&(b[this.r[a].y-1][this.r[a].x]=this.n,c.push({x:this.r[a].x,y:this.r[a].y-1}),this.r[a].y-1==f.y&&this.r[a].x==f.x))return this.r=[{x:this.r[a].x,y:this.r[a].y-1}],this.gP(this.n-1);if(b[this.r[a].y]&&b[this.r[a].y][this.r[a].x+1]&&-1==b[this.r[a].y][this.r[a].x+1]&&(b[this.r[a].y][this.r[a].x+1]=this.n,c.push({x:this.r[a].x+1,y:this.r[a].y}),this.r[a].y==f.y&&this.r[a].x+1==f.x))return this.r=[{x:this.r[a].x+1,y:this.r[a].y}],this.gP(this.n-1);if(b[this.r[a].y+1]&&b[this.r[a].y+1][this.r[a].x]&&-1==b[this.r[a].y+1][this.r[a].x]&&(b[this.r[a].y+1][this.r[a].x]=this.n,c.push({x:this.r[a].x,y:this.r[a].y+1}),this.r[a].y+1==f.y&&this.r[a].x==f.x))return this.r=[{x:this.r[a].x,y:this.r[a].y+1}],this.gP(this.n-1);if(b[this.r[a].y]&&b[this.r[a].y][this.r[a].x-1]&&-1==b[this.r[a].y][this.r[a].x-1]&&(b[this.r[a].y][this.r[a].x-1]=this.n,c.push({x:this.r[a].x-1,y:this.r[a].y}),this.r[a].y==f.y&&this.r[a].x-1==f.x))return this.r=[{x:this.r[a].x-1,y:this.r[a].y}],this.gP(this.n-1)}return 0!=c.length&&(this.n+=1,this.r=c,this.nP())}gP(a){let c=this.r[this.r.length-1].x,e=this.r[this.r.length-1].y;return 0<a?(b[e-1]&&b[e-1][c]&&b[e-1][c]==a?this.r.push({x:c,y:e-1}):b[e]&&b[e][c+1]&&b[e][c+1]==a?this.r.push({x:c+1,y:e}):b[e+1]&&b[e+1][c]&&b[e+1][c]==a?this.r.push({x:c,y:e+1}):b[e]&&b[e][c-1]&&b[e][c-1]==a&&this.r.push({x:c-1,y:e}),d.npccol(this.r[this.r.length-1].x,this.r[this.r.length-1].y)?d.m(this.r[this.r.length-1].x,this.r[this.r.length-1].y):this.gP(a-1)):(d.road([]),g&&this.r.shift(),d.road(this.r))}}(this.hero.y,this.hero.x,1).nP()}m(a,b){if(a>this.map.x||b>this.map.y)return!1;const c=[],d=this;for(let d=0;d<this.map.y;d++){c[d]=[];for(let a,b=0;b<this.map.x;b++)a=(a,b)=>this.npccol(a,b),c[d][b]=this.npccol(b,d)||(`undefined`==typeof window._0x4270?window.cols:window.map.col)&&\"0\"!=(`undefined`==typeof window._0x4270?window.cols:window.map.col).charAt(b+d*this.map.x)?-2:-1}const f={x:a,y:b};var g=!1;c[this.hero.y][this.hero.x]=\"S\",-2==c[f.y][f.x]&&(c[f.y][f.x]=-1,g=!0),new class{constructor(a,b,c){this.a=a,this.b=b,this.n=c,this.r=[],this.r.push({x:this.b,y:this.a})}nP(){let b=[];for(let a in this.r){if(c[this.r[a].y-1]&&c[this.r[a].y-1][this.r[a].x]&&-1==c[this.r[a].y-1][this.r[a].x]&&(c[this.r[a].y-1][this.r[a].x]=this.n,b.push({x:this.r[a].x,y:this.r[a].y-1}),this.r[a].y-1==f.y&&this.r[a].x==f.x))return this.r=[{x:this.r[a].x,y:this.r[a].y-1}],this.gP(this.n-1);if(c[this.r[a].y]&&c[this.r[a].y][this.r[a].x+1]&&-1==c[this.r[a].y][this.r[a].x+1]&&(c[this.r[a].y][this.r[a].x+1]=this.n,b.push({x:this.r[a].x+1,y:this.r[a].y}),this.r[a].y==f.y&&this.r[a].x+1==f.x))return this.r=[{x:this.r[a].x+1,y:this.r[a].y}],this.gP(this.n-1);if(c[this.r[a].y+1]&&c[this.r[a].y+1][this.r[a].x]&&-1==c[this.r[a].y+1][this.r[a].x]&&(c[this.r[a].y+1][this.r[a].x]=this.n,b.push({x:this.r[a].x,y:this.r[a].y+1}),this.r[a].y+1==f.y&&this.r[a].x==f.x))return this.r=[{x:this.r[a].x,y:this.r[a].y+1}],this.gP(this.n-1);if(c[this.r[a].y]&&c[this.r[a].y][this.r[a].x-1]&&-1==c[this.r[a].y][this.r[a].x-1]&&(c[this.r[a].y][this.r[a].x-1]=this.n,b.push({x:this.r[a].x-1,y:this.r[a].y}),this.r[a].y==f.y&&this.r[a].x-1==f.x))return this.r=[{x:this.r[a].x-1,y:this.r[a].y}],this.gP(this.n-1)}return 0==b.length?d.b(f.x,f.y):(this.n+=1,this.r=b,this.nP())}gP(a){let b=this.r[this.r.length-1].x,e=this.r[this.r.length-1].y;if(0<a){if(c[e-1]&&c[e-1][b]&&c[e-1][b]==a)return this.r.push({x:b,y:e-1}),this.gP(a-1);if(c[e]&&c[e][b+1]&&c[e][b+1]==a)return this.r.push({x:b+1,y:e}),this.gP(a-1);if(c[e+1]&&c[e+1][b]&&c[e+1][b]==a)return this.r.push({x:b,y:e+1}),this.gP(a-1);if(c[e]&&c[e][b-1]&&c[e][b-1]==a)return this.r.push({x:b-1,y:e}),this.gP(a-1)}else d.road([]),g&&this.r.shift(),d.road(this.r)}}(this.hero.y,this.hero.x,1).nP()}c(a,b){if(a>this.map.x||b>this.map.y)return-1;if(1>=Math.abs(this.hero.x-a)&&1>=Math.abs(this.hero.y-b))return 0;const c=[];for(let d=0;d<this.map.y;d++){c[d]=[];for(let a,b=0;b<this.map.x;b++)a=(a,b)=>this.npccol(a,b),c[d][b]=this.npccol(b,d)||(`undefined`==typeof window._0x4270?window.cols:window.map.col)&&\"0\"!=(`undefined`==typeof window._0x4270?window.cols:window.map.col).charAt(b+d*this.map.x)?-2:-1}const d={x:a,y:b};var f=!1;return c[this.hero.y][this.hero.x]=\"S\",-2==c[d.y][d.x]&&(c[d.y][d.x]=-1,f=!0),this.npc.forEach(a=>{(2==a.type||3==a.type)&&(c[a.y][a.x]=-1)}),new class{constructor(a,b,c){this.a=a,this.b=b,this.n=c,this.r=[],this.r.push({x:this.b,y:this.a})}nP(){let b=[];for(let a in this.r){if(c[this.r[a].y-1]&&c[this.r[a].y-1][this.r[a].x]&&-1==c[this.r[a].y-1][this.r[a].x]&&(c[this.r[a].y-1][this.r[a].x]=this.n,b.push({x:this.r[a].x,y:this.r[a].y-1}),this.r[a].y-1==d.y&&this.r[a].x==d.x))return this.r=[{x:this.r[a].x,y:this.r[a].y-1}],this.gP(this.n-1);if(c[this.r[a].y]&&c[this.r[a].y][this.r[a].x+1]&&-1==c[this.r[a].y][this.r[a].x+1]&&(c[this.r[a].y][this.r[a].x+1]=this.n,b.push({x:this.r[a].x+1,y:this.r[a].y}),this.r[a].y==d.y&&this.r[a].x+1==d.x))return this.r=[{x:this.r[a].x+1,y:this.r[a].y}],this.gP(this.n-1);if(c[this.r[a].y+1]&&c[this.r[a].y+1][this.r[a].x]&&-1==c[this.r[a].y+1][this.r[a].x]&&(c[this.r[a].y+1][this.r[a].x]=this.n,b.push({x:this.r[a].x,y:this.r[a].y+1}),this.r[a].y+1==d.y&&this.r[a].x==d.x))return this.r=[{x:this.r[a].x,y:this.r[a].y+1}],this.gP(this.n-1);if(c[this.r[a].y]&&c[this.r[a].y][this.r[a].x-1]&&-1==c[this.r[a].y][this.r[a].x-1]&&(c[this.r[a].y][this.r[a].x-1]=this.n,b.push({x:this.r[a].x-1,y:this.r[a].y}),this.r[a].y==d.y&&this.r[a].x-1==d.x))return this.r=[{x:this.r[a].x-1,y:this.r[a].y}],this.gP(this.n-1)}return 0==b.length?-1:(this.n+=1,this.r=b,this.nP())}gP(a){let b=this.r[this.r.length-1].x,d=this.r[this.r.length-1].y;return 0<a?(c[d-1]&&c[d-1][b]&&c[d-1][b]==a?this.r.push({x:b,y:d-1}):c[d]&&c[d][b+1]&&c[d][b+1]==a?this.r.push({x:b+1,y:d}):c[d+1]&&c[d+1][b]&&c[d+1][b]==a?this.r.push({x:b,y:d+1}):c[d]&&c[d][b-1]&&c[d][b-1]==a&&this.r.push({x:b-1,y:d}),this.gP(a-1)):(f&&this.r.shift(),this.r.length)}}(this.hero.y,this.hero.x,1).nP()}convert(a){const b=[];for(let c in a)b[c]=a[c];return b}road(a){`ni`==this.interface?(window.Engine.hero.autoPath.clear(),window.Engine.hero.autoPath.road=a):window.road=a}get hero(){return`ni`==this.interface?window.Engine.hero.d:window.hero}get map(){return`ni`==this.interface?window.Engine.map.d:window.map}get npc(){return`ni`==this.interface?this.convert(window.Engine.npcs.check()):window.g.npc}npccol(a,b){return`ni`==this.interface?window.ncol[a+256*b]:window.g.npccol[a+256*b]}}})();\n\nif(typeof g !== `undefined`){\n g.loadQueue.push({\n fun: () => {\n if (typeof miniMapPlus != `undefined`) miniMapPlus.searchPath = hero._Move;\n if(typeof window._0x4270==`undefined`&&typeof window.cols == `undefined`)message(`Zaktualizuj skrypt!!!<a style=\"color:aqua\" href=\"https://menogram.pl/bot/user/malpka.user.js\" target=\"_blank\">link</a>`);\n }\n });\n hero.margoMove=function(a,b){if(this.isBlockedSearchPath())return this.blockedInfoSearchPath();var c=map.nodes.getNode(hero.x,hero.y),d=map.nodes.getNode(a,b);c.hasSameGroup(d)||(map.nodes.clearAllNodes(),c.setScore(0,map.hce8(d,c)),d=map.nodeSetLoop(d,c,map.findStep)),map.nodes.clearAllNodes(),c.setScore(0,map.hce(c,d)),map.nodeSetLoop(c,d,map.mapStep);var e=d;for(road=[];null!==e&&e.id!=c.id;)road.push({x:e.x,y:e.y}),e=e.from;null!==e&&road.push({x:e.x,y:e.y}),1<road.length&&null==g.playerCatcher.follow&&$(\"#target\").stop().css({left:32*road[0].x,top:32*road[0].y,display:\"block\",opacity:1}).fadeOut(1e3)};\n}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement