Created
October 12, 2018 19:13
-
-
Save d0peCode/30cc9a7400c9ef8f4787e74848959392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
if (!getCookie('run')) setCookie('run', "false"); | |
if (!getCookie('tryb')) setCookie('tryb', 9); | |
var bot = { | |
run: getCookie('run'), | |
id: 0, | |
x: 0, | |
y: 0, | |
}; | |
$("<div style='left:7px;px;width:150px;color:white;top:-100px;background:black;text-align:center;position:absolute;' id='menubot'></div>").appendTo('#centerbox2'); | |
$('<button id="autor" style="margin:1px;border:2px solid;height:26px;font-size:14px;width:36;">Patix0331</button><button id="wl" style="margin:1px;border:2px solid;height:26px;font-size:14px;width:36px;">WŁ.</button><button id="wyl" style="margin:1px;border:2px solid;height:26px;font-size:14px;width:44px;">WYŁ.</button><button id="tryb" style="margin:1px;border:2px solid;height:26px;font-size:14px;width:63px;" onclick="bot.ref()">TRYB</button><button id="ans">Ans</button>').appendTo("#menubot"); | |
if (getCookie('bot')) { | |
bot.run = getCookie('bot'); | |
} | |
if (bot.run != "false") { | |
g.stop = true; | |
$("#menubot").css("border", "3px green double"); | |
} else { | |
$("#menubot").css("border", "3px red double"); | |
}; | |
var trybi = getCookie('tryb'); | |
if (trybi == 9) $("#tryb").text("Elity"); | |
else $("#tryb").text("Elity II"); | |
setTimeout(function() { | |
if (bot.run == "true") | |
location.reload(); | |
}, 600000); | |
var id; | |
var road; | |
var Npcik = newNpc; | |
newNpc = function(b) { | |
Npcik(b); | |
for (var i in b) { | |
if ((b[i].wt > trybi) && (bot.run == "true")) { | |
if (trybi == 9) { | |
setTimeout(function() { | |
_g("fight&a=attack&ff=1&id=-" + b[i].id); | |
}, 1500); | |
return 0; | |
}; | |
road = PathL(b[i].x, b[i].y); | |
bot.id = b[i].id; | |
if (b[i].grp > 0) { | |
for (var z in g.npc) { | |
if (g.npc[z].grp == b[i].grp) | |
if (road >= PathL(g.npc[z].x, g.npc[z].y)) { | |
id = z; | |
road = PathL(g.npc[z].x, g.npc[z].y); | |
} | |
} | |
}; | |
droga(g.npc[id].x, g.npc[id].y, g.npc[id].id) | |
}; | |
}; | |
}; | |
function droga(x, y, id) { | |
Path(x, y); | |
kolejny = setInterval(function() { | |
if ((Math.abs(hero.rx - x) <= 1) && (Math.abs(hero.ry - y) <= 1)) { | |
_g("fight&a=attack&ff=1&id=-" + id); | |
clearInterval(kolejny); | |
}; | |
}, 1500); | |
}; | |
function Path(dx, dy) { | |
var path = [], | |
bord = (hero.opt & 128) ? 8 : 20; | |
var x1 = Math.max(0, Math.min(dx, hero.x) - bord), | |
x2 = Math.min(map.x - 1, Math.max(dx, hero.x) + bord); | |
var y1 = Math.max(0, Math.min(dy, hero.y) - bord), | |
y2 = Math.min(map.y - 1, Math.max(dy, hero.y) + bord); | |
for (var i = x1 - 1; i <= x2 + 1; i++) { | |
path[i] = []; | |
for (var j = y1 - 1; j <= y2 + 1; j++) | |
path[i][j] = (i >= x1 && i <= x2 && j >= y1 && j <= y2 && !isset(g.npccol[i + j * 256]) && | |
(!map.col || map.col.charAt(i + j * map.x) == '0')) ? -1 : -2; | |
} | |
path[hero.x][hero.y] = 0; | |
roaddir = -1; | |
road = []; | |
var f = { | |
x: -1, | |
y: -1, | |
dist: 99 | |
}; | |
for (var loop = 1; loop < x2 - x1 + y2 - y1 + 3; loop++) { | |
for (var i = x1; i <= x2; i++) | |
for (var j = y1; j <= y2; j++) { | |
if (path[i][j] == -1 && ((path[i][j - 1] == loop - 1) || (path[i][j + 1] == loop - 1) || | |
(path[i - 1][j] == loop - 1) || (path[i + 1][j] == loop - 1))) path[i][j] = loop; | |
if (path[dx][dy] > 0) { | |
i = x2 + 1; | |
break; | |
} | |
f.dist2 = Math.abs(dx - i) + Math.abs(dy - j); | |
if ((path[i][j] == loop) && (f.dist2 < f.dist)) { | |
f.x = i; | |
f.y = j; | |
f.dist = f.dist2; | |
} | |
} // j-for | |
} | |
f.hdist = Math.abs(dx - hero.x) + Math.abs(dy - hero.y); | |
if (path[dx][dy] > 0 || f.dist < f.hdist) { | |
if (path[dx][dy] < 0) { | |
if (dx > f.x) roaddir = 2; | |
else if (dx < f.x) roaddir = 1; | |
else | |
if (dy > f.y) roaddir = 0; | |
else if (dy < f.y) roaddir = 3; | |
dx = f.x; | |
dy = f.y; | |
} | |
road[0] = { | |
x: dx, | |
y: dy | |
}; | |
for (var k = path[dx][dy] - 1, cx = dx, cy = dy; k > 0; k--) { | |
if (path[cx][cy - 1] == k) cy--; | |
else if (path[cx][cy + 1] == k) cy++; | |
else | |
if (path[cx - 1][cy] == k) cx--; | |
else if (path[cx + 1][cy] == k) cx++; | |
else k = 0; | |
if (k) road[path[dx][dy] - k] = { | |
x: cx, | |
y: cy | |
}; | |
} | |
} | |
if (road.length > 1 && g.playerCatcher.follow == null) { | |
$('#target').stop().css({ | |
left: dx * 32, | |
top: dy * 32, | |
display: 'block', | |
opacity: 1 | |
}).fadeOut(1000); | |
} | |
} | |
function PathL(y, w) { | |
var x = [], | |
t = (hero.opt & 128) ? 8 : 20; | |
var l = Math.max(0, Math.min(y, hero.x) - t), | |
h = Math.min(map.x - 1, Math.max(y, hero.x) + t); | |
var v = Math.max(0, Math.min(w, hero.y) - t), | |
u = Math.min(map.y - 1, Math.max(w, hero.y) + t); | |
for (var q = l - 1; q <= h + 1; q++) { | |
x[q] = []; | |
for (var p = v - 1; p <= u + 1; p++) { | |
x[q][p] = (q >= l && q <= h && p >= v && p <= u && !isset(g.npccol[q + p * 256]) && (!map.col || map.col.charAt(q + p * map.x) == "0")) ? -1 : -2 | |
} | |
} | |
x[hero.x][hero.y] = 0; | |
b = -1; | |
roadL = []; | |
var s = { | |
x: -1, | |
y: -1, | |
dist: 99 | |
}; | |
for (var r = 1; r < h - l + u - v + 3; r++) { | |
for (var q = l; q <= h; q++) { | |
for (var p = v; p <= u; p++) { | |
if (x[q][p] == -1 && ((x[q][p - 1] == r - 1) || (x[q][p + 1] == r - 1) || (x[q - 1][p] == r - 1) || (x[q + 1][p] == r - 1))) { | |
x[q][p] = r | |
} | |
if (x[y][w] > 0) { | |
q = h + 1; | |
break | |
} | |
s.dist2 = Math.abs(y - q) + Math.abs(w - p); | |
if ((x[q][p] == r) && (s.dist2 < s.dist)) { | |
s.x = q; | |
s.y = p; | |
s.dist = s.dist2 | |
} | |
} | |
} | |
} | |
s.hdist = Math.abs(y - hero.x) + Math.abs(w - hero.y); | |
if (x[y][w] > 0 || s.dist < s.hdist) { | |
if (x[y][w] < 0) { | |
if (y > s.x) { | |
b = 2 | |
} else { | |
if (y < s.x) { | |
b = 1 | |
} else { | |
if (w > s.y) { | |
b = 0 | |
} else { | |
if (w < s.y) b = 3 | |
} | |
} | |
} | |
y = s.x; | |
w = s.y | |
} | |
roadL[0] = { | |
x: y, | |
y: w | |
}; | |
for (var o = x[y][w] - 1, n = y, m = w; o > 0; o--) { | |
if (x[n][m - 1] == o) { | |
m-- | |
} else { | |
if (x[n][m + 1] == o) { | |
m++ | |
} else { | |
if (x[n - 1][m] == o) { | |
n-- | |
} else { | |
if (x[n + 1][m] == o) { | |
n++ | |
} else { | |
o = 0 | |
} | |
} | |
} | |
} | |
if (o) { | |
roadL[x[y][w] - o] = { | |
x: n, | |
y: m | |
} | |
} | |
} | |
} | |
return roadL.length; | |
} | |
$('#wyl').click(function() { | |
if (bot.run == "true") { | |
bot.run = "false"; | |
setCookie('bot', 'false'); | |
g.stop = false; | |
$("#menubot").css("border", "3px red double"); | |
} | |
}); | |
$('#wl').click(function() { | |
if (bot.run == "false") { | |
bot.run = "true"; | |
setCookie('bot', 'true'); | |
g.stop = true; | |
$("#menubot").css("border", "3px green double"); | |
} | |
}); | |
$('#tryb').click(function() { | |
if (trybi == 9) { | |
setCookie('tryb', 19); | |
trybi = 19; | |
message('Elity II włączone'); | |
$("#tryb").text("Elity II"); | |
} else { | |
setCookie('tryb', 9); | |
trybi = 9; | |
message('Elity włączone'); | |
$("#tryb").text("Elity"); | |
} | |
}); | |
$('#ans').click(function() { | |
ansgame.close; | |
}) | |
} catch (e) { | |
__mxPluginsArray[20052].broken = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment