Facebook
From Voluminous Coyote, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 252
  1. // ==UserScript==
  2. // @name         Bot e2/exp z przechodzniem
  3. // @version      2.01
  4. // @description  No se bocik curva lata mordo.
  5. // @author       ---
  6. // @match        *://*/
  7. // @grant        none
  8. // ==/UserScript==
  9.  
  10. $('#tutorial').hide();
  11. ceb = {};
  12. ceb.bestxy = 9999;
  13. ceb.run = 1;
  14. ceb.id = 0;
  15. ceb.block = "";
  16. ceb.xxxx = 0;
  17. ceb.blocked = 1;
  18. ceb.check2 = 0;
  19. ceb.check2 = 0;
  20. ceb.interv1 = "";
  21. ceb.interv2 = "";
  22. ceb.interv3 = "";
  23.  
  24. if (localStorage.getItem('danebot') == null) localStorage.setItem('danebot', 'Wprowadź nazwę/y moba/ów');
  25. if (localStorage.getItem('danebotmap') == null) localStorage.setItem('danebotmap', 'Wprowadź nazwę/y map/y');
  26.  
  27. mAlert = function(a, c, d, b) {};
  28. g.lock.add = function(i) {};
  29.  
  30. $('<div id="ceb_config">').css({
  31.     position: "absolute",
  32.     left: -208,
  33.     top: 250,
  34.     width: 200,
  35.     height: 210,
  36.     color: "#006622",
  37.     "background-color": "#d9d9d9",
  38.     "font-size": "13px",
  39. }).appendTo("#centerbox2");
  40.  
  41. function zapiszdane() {
  42.     var danedobota = document.getElementById("ceb_monster").value;
  43.     var danedobotamap = document.getElementById("ceb_nazmap").value;
  44.     localStorage.setItem('danebot', danedobota);
  45.     localStorage.setItem('danebotmap', danedobotamap);
  46.     var danebot = localStorage.getItem('danebot');
  47.     var danebotmap = localStorage.getItem('danebotmap');
  48.     document.location.reload();
  49. }
  50.  
  51. var danebot = localStorage.getItem('danebot');
  52. var danebotmap = localStorage.getItem('danebotmap');
  53. var mapki = [];
  54. var nazwamapki;
  55.  
  56. ceb_config.innerHTML = '<center>Podaj nazwy mobów:<br><br><input id="ceb_monster" value="' + danebot + '">';
  57. ceb_config.innerHTML += '<br/><center>Podaj nazwy map:<br><br><input id="ceb_nazmap" value="' + danebotmap + '">';
  58. ceb_config.innerHTML += '<br/><br/><center><button id="tynoniewiem">Zapisz</button>';
  59.  
  60. $("#tynoniewiem").click(function() {
  61.     zapiszdane();
  62. });
  63.  
  64. hero.cebgo = function(a, t) {
  65.     if (this.isBlockedSearchPath()) return this.blockedInfoSearchPath();
  66.     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++) {
  67.         h[d] = [];
  68.         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
  69.     }
  70.     h[this.x][this.y] = 0, b = -1, road = [];
  71.     for (var c = {
  72.             x: -1,
  73.             y: -1,
  74.             dist: 99
  75.         }, y = 1; s - r + e - o + 3 > y; y++)
  76.         for (var d = r; s >= d; d++)
  77.             for (var x = o; e >= x; x++) {
  78.                 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) {
  79.                     d = s + 1;
  80.                     break
  81.                 }
  82.                 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)
  83.             }
  84.     if (c.hdist = Math.abs(a - hero.x) + Math.abs(t - hero.y), h[a][t] > 0 || c.dist < c.hdist) {
  85.         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] = {
  86.             x: a,
  87.             y: t
  88.         };
  89.         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] = {
  90.             x: l,
  91.             y: m
  92.         })
  93.     }
  94.     road.length > 1 && null == g.playerCatcher.follow && $("#target").stop().css({
  95.         left: 32 * a,
  96.         top: 32 * t,
  97.         display: "block",
  98.         opacity: 1
  99.     }).fadeOut(1e3)
  100. };
  101.  
  102. ! function(tmpBattleMsg) {
  103.     battleMsg = function(c, t) {
  104.         ceb.run = 1;
  105.         var ret = tmpBattleMsg(c, t);
  106.         if (c.search(/winner=/) >= 0) {
  107.             _g("fight&a=quit");
  108.             ceb.run = 0;
  109.         }
  110.         return ret;
  111.     }
  112. }(battleMsg);
  113.  
  114. ceb.f1 = function() {
  115.     if (localStorage.getItem("mapencje") == null) localStorage.setItem("mapencje", map.name);
  116.     if (localStorage.getItem("mapencje").indexOf(map.name) == -1) {
  117.         var mapencje = localStorage.getItem("mapencje");
  118.         mapencje += "|" + map.name;
  119.         localStorage.setItem("mapencje", mapencje);
  120.     };
  121.     if (ceb.run == 0) {
  122.         hero.nextx = '';
  123.         hero.nexty = '';
  124.         var cango = true;
  125.         ceb.bestxy = 9999;
  126.         for (var i in g.npc) {
  127.             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)) {
  128.                 x1 = Math.pow(Math.abs(hero.x - g.npc[i].x), 2);
  129.                 y1 = Math.pow(Math.abs(hero.y - g.npc[i].y), 2);
  130.                 ceb.bestxy1 = Math.sqrt(x1) + Math.sqrt(y1);
  131.                 if (ceb.bestxy1 < ceb.bestxy) {
  132.                     cango = false;
  133.                     ceb.bestxy = ceb.bestxy1;
  134.                     hero.nextx = g.npc[i].x;
  135.                     hero.nexty = g.npc[i].y;
  136.                     ceb.id = i;
  137.                     ceb.run = 1;
  138.                     ceb.blocked = 0;
  139.                 };
  140.             }
  141.         };
  142.         if (!cango) {
  143.             hero.cebgo(hero.nextx, hero.nexty);
  144.         } else {
  145.             mapki = [];
  146.             for (var i in g.townname) {
  147.                 if (ceb_nazmap.value.indexOf(g.townname[i]) > -1 && localStorage.getItem("mapencje").indexOf(g.townname[i]) == -1) {
  148.                     mapki.push(i);
  149.                 }
  150.             }
  151.         }
  152.         if (mapki.length < 1) {
  153.             localStorage.setItem("mapencje", null);
  154.         } else {
  155.             for (var i in g.gwIds) {
  156.                 if (mapki.includes(i)) {
  157.                     gwx = Number(g.gwIds[i].substring(0, g.gwIds[i].indexOf(".")));
  158.                     gwy = Number(g.gwIds[i].substring(g.gwIds[i].indexOf(".") + 1));
  159.                     x1 = Math.pow(Math.abs(hero.x - gwx), 2);
  160.                     y1 = Math.pow(Math.abs(hero.y - gwy), 2);
  161.                     ceb.bestxy1 = Math.sqrt(x1) + Math.sqrt(y1);
  162.                     if (ceb.bestxy1 < ceb.bestxy) {
  163.                         ceb.bestxy = ceb.bestxy1;
  164.                         hero.nextx = gwx;
  165.                         hero.nexty = gwy;
  166.                         ceb.blocked = 1;
  167.                     };
  168.                 }
  169.             }
  170.             if (cango && hero.nextx != "" && hero.nexty != "") {
  171.                 hero.cebgo(hero.nextx, hero.nexty);
  172.                 ceb.run = 1;
  173.                 if (hero.x == hero.nextx && hero.y == hero.nexty) {
  174.                     _g("walk");
  175.                 }
  176.             }
  177.         }
  178.     }
  179. };
  180.  
  181. ceb.f2 = function() {
  182.     if (road.length == 0 && ceb.blocked == 0) {
  183.         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)) {
  184.             ceb.blocked = 1;
  185.             _g("fight&a=attack&ff=1&id=-" + ceb.id);
  186.         } else {
  187.             if (ceb.check2 == 2) {
  188.                 ceb.blocked = 1;
  189.                 ceb.block = ceb.block + "|" + ceb.id;
  190.                 ceb.run = 0;
  191.                 ceb.check2 = 0;
  192.             } else if (ceb.check2 != 2) {
  193.                 ceb.check2++;
  194.             }
  195.         }
  196.     }
  197. };
  198.  
  199. ceb.f3 = function() {
  200.     if (road.length == 0) {
  201.         if (ceb.check2 < 60) {
  202.             ceb.check2++;
  203.         } else if (ceb.check2 >= 60) {
  204.             ceb.run = 0;
  205.             ceb.check2 = 0;
  206.         }
  207.     } else {
  208.         ceb.check2 = 0;
  209.     }
  210. };
  211.  
  212. ceb.interv1 = setInterval(ceb.f1, 400);
  213. ceb.interv2 = setInterval(ceb.f2, 300);
  214. ceb.interv3 = setInterval(ceb.f3, 50);
  215.  
  216. setInterval(function() {
  217.     ceb.block = "";
  218. }, 30000)