Advertisement
Guest User

Untitled

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