- // ==UserScript==
- // @name Bot e2/exp z przechodzniem
- // @version 2.01
- // @description No se bocik curva lata mordo.
- // @author ---
- // @match *://*/
- // @grant none
- // ==/UserScript==
- $('#tutorial').hide();
- ceb = {};
- ceb.bestxy = 9999;
- ceb.run = 1;
- ceb.id = 0;
- ceb.block = "";
- ceb.xxxx = 0;
- ceb.blocked = 1;
- ceb.check2 = 0;
- ceb.check2 = 0;
- ceb.interv1 = "";
- ceb.interv2 = "";
- ceb.interv3 = "";
- if (localStorage.getItem('danebot') == null) localStorage.setItem('danebot', 'Wprowadź nazwę/y moba/ów');
- if (localStorage.getItem('danebotmap') == null) localStorage.setItem('danebotmap', 'Wprowadź nazwę/y map/y');
- mAlert = function(a, c, d, b) {};
- g.lock.add = function(i) {};
- $('<div id="ceb_config">').css({
- position: "absolute",
- left: -208,
- top: 250,
- width: 200,
- height: 210,
- color: "#006622",
- "background-color": "#d9d9d9",
- "font-size": "13px",
- }).appendTo("#centerbox2");
- function zapiszdane() {
- var danedobota = document.getElementById("ceb_monster").value;
- var danedobotamap = document.getElementById("ceb_nazmap").value;
- localStorage.setItem('danebot', danedobota);
- localStorage.setItem('danebotmap', danedobotamap);
- var danebot = localStorage.getItem('danebot');
- var danebotmap = localStorage.getItem('danebotmap');
- document.location.reload();
- }
- var danebot = localStorage.getItem('danebot');
- var danebotmap = localStorage.getItem('danebotmap');
- var mapki = [];
- var nazwamapki;
- ceb_config.innerHTML = '<center>Podaj nazwy mobów:<br><br><input id="ceb_monster" value="' + danebot + '">';
- ceb_config.innerHTML += '<br/><center>Podaj nazwy map:<br><br><input id="ceb_nazmap" value="' + danebotmap + '">';
- ceb_config.innerHTML += '<br/><br/><center><button id="tynoniewiem">Zapisz</button>';
- $("#tynoniewiem").click(function() {
- zapiszdane();
- });
- hero.cebgo = function(a, t) {
- if (this.isBlockedSearchPath()) return this.blockedInfoSearchPath();
- for (var h = [], i = 128 & hero.opt ? 8 : 20, r = Math.max(0, Math.min(a, this.x) - i), s = Math.min(map.x - 1, Math.max(a, this.x) + i), o = Math.max(0, Math.min(t, this.y) - i), e = Math.min(map.y - 1, Math.max(t, this.y) + i), d = r - 1; s + 1 >= d; d++) {
- h[d] = [];
- for (var x = o - 1; e + 1 >= x; x++) h[d][x] = !(d >= r && s >= d && x >= o && e >= x) || isset(g.npccol[d + 256 * x]) || map.col && "0" != map.col.charAt(d + x * map.x) ? -2 : -1
- }
- h[this.x][this.y] = 0, b = -1, road = [];
- for (var c = {
- x: -1,
- y: -1,
- dist: 99
- }, y = 1; s - r + e - o + 3 > y; y++)
- for (var d = r; s >= d; d++)
- for (var x = o; e >= x; x++) {
- if (-1 != h[d][x] || h[d][x - 1] != y - 1 && h[d][x + 1] != y - 1 && h[d - 1][x] != y - 1 && h[d + 1][x] != y - 1 || (h[d][x] = y), h[a][t] > 0) {
- d = s + 1;
- break
- }
- c.dist2 = Math.abs(a - d) + Math.abs(t - x), h[d][x] == y && c.dist2 < c.dist && (c.x = d, c.y = x, c.dist = c.dist2)
- }
- if (c.hdist = Math.abs(a - hero.x) + Math.abs(t - hero.y), h[a][t] > 0 || c.dist < c.hdist) {
- h[a][t] < 0 && (a > c.x ? b = 2 : a < c.x ? b = 1 : t > c.y ? b = 0 : t < c.y && (b = 3), a = c.x, t = c.y), road[0] = {
- x: a,
- y: t
- };
- for (var f = h[a][t] - 1, l = a, m = t; f > 0; f--) h[l][m - 1] == f ? m-- : h[l][m + 1] == f ? m++ : h[l - 1][m] == f ? l-- : h[l + 1][m] == f ? l++ : f = 0, f && (road[h[a][t] - f] = {
- x: l,
- y: m
- })
- }
- road.length > 1 && null == g.playerCatcher.follow && $("#target").stop().css({
- left: 32 * a,
- top: 32 * t,
- display: "block",
- opacity: 1
- }).fadeOut(1e3)
- };
- ! function(tmpBattleMsg) {
- battleMsg = function(c, t) {
- ceb.run = 1;
- var ret = tmpBattleMsg(c, t);
- if (c.search(/winner=/) >= 0) {
- _g("fight&a=quit");
- ceb.run = 0;
- }
- return ret;
- }
- }(battleMsg);
- ceb.f1 = function() {
- if (localStorage.getItem("mapencje") == null) localStorage.setItem("mapencje", map.name);
- if (localStorage.getItem("mapencje").indexOf(map.name) == -1) {
- var mapencje = localStorage.getItem("mapencje");
- mapencje += "|" + map.name;
- localStorage.setItem("mapencje", mapencje);
- };
- if (ceb.run == 0) {
- hero.nextx = '';
- hero.nexty = '';
- var cango = true;
- ceb.bestxy = 9999;
- for (var i in g.npc) {
- if (ceb_monster.value.indexOf(g.npc[i].nick) > -1 && ceb.block.indexOf(i) < 0 && g.npc[i].fake === undefined && (g.npc[i].type == 2 || g.npc[i].type == 3)) {
- x1 = Math.pow(Math.abs(hero.x - g.npc[i].x), 2);
- y1 = Math.pow(Math.abs(hero.y - g.npc[i].y), 2);
- ceb.bestxy1 = Math.sqrt(x1) + Math.sqrt(y1);
- if (ceb.bestxy1 < ceb.bestxy) {
- cango = false;
- ceb.bestxy = ceb.bestxy1;
- hero.nextx = g.npc[i].x;
- hero.nexty = g.npc[i].y;
- ceb.id = i;
- ceb.run = 1;
- ceb.blocked = 0;
- };
- }
- };
- if (!cango) {
- hero.cebgo(hero.nextx, hero.nexty);
- } else {
- mapki = [];
- for (var i in g.townname) {
- if (ceb_nazmap.value.indexOf(g.townname[i]) > -1 && localStorage.getItem("mapencje").indexOf(g.townname[i]) == -1) {
- mapki.push(i);
- }
- }
- }
- if (mapki.length < 1) {
- localStorage.setItem("mapencje", null);
- } else {
- for (var i in g.gwIds) {
- if (mapki.includes(i)) {
- gwx = Number(g.gwIds[i].substring(0, g.gwIds[i].indexOf(".")));
- gwy = Number(g.gwIds[i].substring(g.gwIds[i].indexOf(".") + 1));
- x1 = Math.pow(Math.abs(hero.x - gwx), 2);
- y1 = Math.pow(Math.abs(hero.y - gwy), 2);
- ceb.bestxy1 = Math.sqrt(x1) + Math.sqrt(y1);
- if (ceb.bestxy1 < ceb.bestxy) {
- ceb.bestxy = ceb.bestxy1;
- hero.nextx = gwx;
- hero.nexty = gwy;
- ceb.blocked = 1;
- };
- }
- }
- if (cango && hero.nextx != "" && hero.nexty != "") {
- hero.cebgo(hero.nextx, hero.nexty);
- ceb.run = 1;
- if (hero.x == hero.nextx && hero.y == hero.nexty) {
- _g("walk");
- }
- }
- }
- }
- };
- ceb.f2 = function() {
- if (road.length == 0 && ceb.blocked == 0) {
- if ((Math.abs(hero.rx - g.npc[ceb.id].x) <= 1 && Math.abs(hero.ry - g.npc[ceb.id].y) <= 1) && (g.npc[ceb.id].type == 2 || g.npc[ceb.id].type == 3)) {
- ceb.blocked = 1;
- _g("fight&a=attack&ff=1&id=-" + ceb.id);
- } else {
- if (ceb.check2 == 2) {
- ceb.blocked = 1;
- ceb.block = ceb.block + "|" + ceb.id;
- ceb.run = 0;
- ceb.check2 = 0;
- } else if (ceb.check2 != 2) {
- ceb.check2++;
- }
- }
- }
- };
- ceb.f3 = function() {
- if (road.length == 0) {
- if (ceb.check2 < 60) {
- ceb.check2++;
- } else if (ceb.check2 >= 60) {
- ceb.run = 0;
- ceb.check2 = 0;
- }
- } else {
- ceb.check2 = 0;
- }
- };
- ceb.interv1 = setInterval(ceb.f1, 400);
- ceb.interv2 = setInterval(ceb.f2, 300);
- ceb.interv3 = setInterval(ceb.f3, 50);
- setInterval(function() {
- ceb.block = "";
- }, 30000)