Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.30 KB | None | 0 0
  1.  
  2. function on(){
  3. $('#tutorial').hide();
  4. MBob = {};
  5. MBob.bestxy = 9999;
  6. MBob.run = 1;
  7. MBob.id = 0;
  8. MBob.blok = "";
  9. MBob.xxxx = 0;
  10. MBob.blokuj = 1;
  11. MBob.checker = 0;
  12. MBob.checker2 = 0;
  13. MBob.interv1 = "";
  14. MBob.interv2 = "";
  15. MBob.interv3 = "";
  16. mAlert = function(a, c, d, b) {};
  17. g.lock.add = function(i) {};
  18. $('<div id="MBob_config">').css({
  19. position: "absolute",
  20. left: -208,
  21. top: -7,
  22. width: 199,
  23. height: 549,
  24. border: "1px gold solid",
  25. color: "white",
  26. "background-color": "black",
  27. "font-size": "13px",
  28. }).appendTo("#centerbox2");
  29. MBob_config.innerHTML = '<center><input id="MBob_nazpotwor" placeholder="Nazwy potworów">';
  30. MBob_config.innerHTML = MBob_config.innerHTML + '<br/><br/><center><input id="MBob_healerhp" placeholder="%HP<Healer" type="number">';
  31. MBob_config.innerHTML = MBob_config.innerHTML + '<br/><br/><center><button onclick="MBob.start1()">Start</button>';
  32. MBob_config.innerHTML = MBob_config.innerHTML + '<br/><center><button onclick="MBob.stop1()">Stop</button>';
  33.  
  34. MBob.heal = function() {
  35. for (var i in g.item) {
  36. if (g.item[i].cl == 16 && hero.hp <= hero.maxhp * Number(MBob_healerhp.value) / 100 && MBob_healerhp.value != "") {
  37. $("#item" + i).dblclick();
  38. }
  39. }
  40. };
  41.  
  42. MBob.rel = function() {
  43. var sukces = false;
  44. for (var i in g.item) {
  45. itemek = $("#item" + i);
  46. if (g.item[i].cl == 21 && itemek.css("top") == "183px" && itemek.css("left") == "92px") {
  47. var stat = g.item[i].stat;
  48. var name = g.item[i].name;
  49. var id = g.item[i].id;
  50. sukces = true;
  51. break;
  52. }
  53. }
  54. if (sukces) {
  55. var nrilosc = stat.indexOf("ammo");
  56. var ilosc = 51;
  57. if (nrilosc != -1) {
  58. ilosc = stat.slice(nrilosc + 5, nrilosc + 9);
  59. ilosc = parseInt(ilosc);
  60. }
  61. if (ilosc < 50) {
  62. for (var i in g.item) {
  63. if (name == g.item[i].name && id != g.item[i].id) {
  64. _g("moveitem&st=1&id=" + g.item[i].id);
  65. break;
  66. }
  67. }
  68. }
  69. }
  70. };
  71.  
  72. hero.MBobgo = function(y, w) {
  73. var x = [],
  74. t = (hero.opt & 128) ? 8 : 20;
  75. var l = Math.max(0, Math.min(y, this.x) - t),
  76. h = Math.min(map.x - 1, Math.max(y, this.x) + t);
  77. var v = Math.max(0, Math.min(w, this.y) - t),
  78. u = Math.min(map.y - 1, Math.max(w, this.y) + t);
  79. for (var q = l - 1; q <= h + 1; q++) {
  80. x[q] = [];
  81. for (var p = v - 1; p <= u + 1; p++) {
  82. 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
  83. }
  84. }
  85. x[this.x][this.y] = 0;
  86. b = -1;
  87. road = [];
  88. var s = {
  89. x: -1,
  90. y: -1,
  91. dist: 599
  92. };
  93. for (var r = 1; r < h - l + u - v + 3; r++) {
  94. for (var q = l; q <= h; q++) {
  95. for (var p = v; p <= u; p++) {
  96. 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))) {
  97. x[q][p] = r
  98. }
  99. if (x[y][w] > 0) {
  100. q = h + 1;
  101. break
  102. }
  103. s.dist2 = Math.abs(y - q) + Math.abs(w - p);
  104. if ((x[q][p] == r) && (s.dist2 < s.dist)) {
  105. s.x = q;
  106. s.y = p;
  107. s.dist = s.dist2
  108. }
  109. }
  110. }
  111. }
  112. s.hdist = Math.abs(y - hero.x) + Math.abs(w - hero.y);
  113. if (x[y][w] > 0 || s.dist < s.hdist) {
  114. if (x[y][w] < 0) {
  115. if (y > s.x) {
  116. b = 2
  117. } else {
  118. if (y < s.x) {
  119. b = 1
  120. } else {
  121. if (w > s.y) {
  122. b = 0
  123. } else {
  124. if (w < s.y) {
  125. b = 3
  126. }
  127. }
  128. }
  129. }
  130. y = s.x;
  131. w = s.y;
  132. }
  133. road[0] = {
  134. x: y,
  135. y: w
  136. };
  137. for (var o = x[y][w] - 1, n = y, m = w; o > 0; o--) {
  138. if (x[n][m - 1] == o) {
  139. m--
  140. } else {
  141. if (x[n][m + 1] == o) {
  142. m++
  143. } else {
  144. if (x[n - 1][m] == o) {
  145. n--
  146. } else {
  147. if (x[n + 1][m] == o) {
  148. n++
  149. } else {
  150. o = 0
  151. }
  152. }
  153. }
  154. }
  155. if (o) {
  156. road[x[y][w] - o] = {
  157. x: n,
  158. y: m
  159. }
  160. }
  161. }
  162. }
  163. if (road.length > 1 && g.playerCatcher.follow == null) {
  164. $("#target").stop().css({
  165. left: y * 32,
  166. top: w * 32,
  167. display: "block",
  168. opacity: 1
  169. }).fadeOut(1000)
  170. }
  171. };
  172.  
  173. var tmpBattleMsg = battleMsg;
  174. battleMsg = function(c, t) {
  175. MBob.run = 0;
  176. var ret = tmpBattleMsg(c, t);
  177. if (c.search(/winner=/) >= 0) {
  178. _g("fight&a=quit");
  179. $('#loots_button').click();
  180. MBob.drop();
  181. MBob.rel();
  182. MBob.heal();
  183. MBob.run = 0;
  184. }
  185. return ret;
  186. };
  187.  
  188.  
  189. MBob.func1 = function() {
  190. if (MBob.run == 0) {
  191. hero.nextx = '';
  192. hero.nexty = '';
  193. MBob.bestxy = 9999;
  194. for (var i in g.npc) {
  195. if (MBob_nazpotwor.value.search(g.npc[i].nick) != -1 && MBob.blok.search(i) == -1 && (g.npc[i].type == 2 || g.npc[i].type == 3)) {
  196. x1 = Math.pow(Math.abs(hero.x - g.npc[i].x), 2);
  197. y1 = Math.pow(Math.abs(hero.y - g.npc[i].y), 2);
  198. MBob.bestxy1 = Math.sqrt(x1) + Math.sqrt(y1);
  199. if (MBob.bestxy1 < MBob.bestxy) {
  200. MBob.bestxy = MBob.bestxy1;
  201. hero.nextx = g.npc[i].x;
  202. hero.nexty = g.npc[i].y;
  203. MBob.id = i;
  204. MBob.run = 1;
  205. MBob.blokuj = 0;
  206. };
  207. };
  208. };
  209. if (hero.nextx != '' && hero.nexty != '') {
  210. g.stop = false;
  211. hero.MBobgo(hero.nextx, hero.nexty);
  212. }
  213. }
  214. };
  215.  
  216. MBob.func2 = function() {
  217. if (road.length == 0 && MBob.blokuj == 0) {
  218. if ((Math.abs(hero.rx - g.npc[MBob.id].x) <= 1 && Math.abs(hero.ry - g.npc[MBob.id].y) <= 1) && (g.npc[MBob.id].type == 2 || g.npc[MBob.id].type == 3)) {
  219. MBob.blokuj = 1;
  220. _g("fight&a=attack&ff=1&id=-" + MBob.id);
  221. } else {
  222. if (MBob.checker2 == 2){
  223. MBob.blokuj = 1;
  224. MBob.blok = MBob.blok + "|" + MBob.id;
  225. MBob.run = 0;
  226. MBob.checker2 = 0;
  227. } else if(MBob.checker2 != 2){
  228. MBob.checker2++;
  229. }
  230. }
  231. }
  232. };
  233.  
  234. MBob.func3 = function() {
  235. if (road.length == 0) {
  236. if (MBob.checker < 60) {
  237. MBob.checker++;
  238. } else if (MBob.checker >= 60) {
  239. MBob.run = 0;
  240. MBob.checker = 0;
  241. }
  242. } else {
  243. MBob.checker = 0;
  244. }
  245. };
  246.  
  247. MBob.start1 = function() {
  248. MBob.interv1 = setInterval(MBob.func1, 400);
  249. MBob.interv2 = setInterval(MBob.func2, 300);
  250. MBob.interv3 = setInterval(MBob.func3, 50);
  251. };
  252.  
  253. MBob.stop1 = function() {
  254. MBob.interv1 = setInterval(MBob.func1, 400);
  255. MBob.interv2 = setInterval(MBob.func2, 300);
  256. MBob.interv3 = setInterval(MBob.func3, 50);
  257. };
  258.  
  259. setInterval(function() {
  260. MBob.blok = "";
  261. }, 30000)
  262.  
  263. setInterval(function() {
  264. location.reload();
  265. }, 60000)
  266.  
  267. document.getElementById("MBob_nazpotwor").value = "Południowy niedźwiedź szary";
  268. MBob.start1();
  269. }
  270.  
  271. window.onload = function(){
  272. on();
  273. }
  274. (function (e) {
  275. e.cookie = function (t, n, r) {
  276. if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(n)) || n === null || n === undefined)) {
  277. r = e.extend({}, r);
  278. if (n === null || n === undefined) {
  279. r.expires = -1
  280. }
  281. if (typeof r.expires === "number") {
  282. var i = r.expires,
  283. s = r.expires = new Date;
  284. s.setDate(s.getDate() + i)
  285. }
  286. n = String(n);
  287. return document.cookie = [encodeURIComponent(t), "=", r.raw ? n : encodeURIComponent(n), r.expires ? "; expires=" + r.expires.toUTCString() : "", r.path ? "; path=" + r.path : "", r.domain ? "; domain=" + r.domain : "", r.secure ? "; secure" : ""].join("")
  288. }
  289. r = n || {};
  290. var o = r.raw ? function (e) {
  291. return e
  292. } : decodeURIComponent;
  293. var u = document.cookie.split("; ");
  294. for (var a = 0, f; f = u[a] && u[a].split("="); a++) {
  295. if (o(f[0]) === t) return o(f[1] || "")
  296. }
  297. return null
  298. }
  299. })(jQuery);
  300.  
  301. /*
  302. Ostatnie zmiany: 01-03-2017, dodanie nowych itemów leczą?cych, pozdrawiam ;)
  303. */
  304.  
  305. g.loadQueue.push({
  306. fun: function () {
  307. new(function () {
  308. this.niceForHealing = [
  309. "Duża pomarańczowa mikstura",
  310. "",
  311. "",
  312. "",
  313. "",
  314. "",
  315. "",
  316. "",
  317. "",
  318. "",
  319. "",
  320. "",
  321. ""
  322. ];
  323. this.getCookie = function (name) {
  324. return $.cookie(name);
  325. }
  326. this.setCookie = function (name, value) {
  327. $.cookie(name, value, {
  328. expires: 365
  329. });
  330. }
  331. this.isNiceForHealing = function (name) {
  332. for (var i in this.niceForHealing)
  333. if (this.niceForHealing[i] == name) return true;
  334. return false;
  335. }
  336. this.isStatOk = function(item) {
  337. var stats = item.stat.split(";");
  338. for(var i in stats) {
  339. var stat = stats[i].split("=");
  340. if(stat[0] == "lvl") {
  341. if(stat[1] > hero.lvl)
  342. return false;
  343. else
  344. return true;
  345. } else if(stat[0] == "timelimit") {
  346. var times = stat[1].split(",");
  347. if(times.length == 2) {
  348. var nextTime = parseInt(times[1]) * 1000;
  349. return nextTime - new Date().getTime() < 0;
  350. }
  351. }
  352. }
  353. return true;
  354. }
  355. this.hp = hero.hp;
  356.  
  357. this.items = new Array();
  358.  
  359. this.sortItems = function() {
  360. var t = this;
  361. t.items = new Array();
  362. for(var i in g.item){
  363. var item = g.item[i];
  364.  
  365. if(item.cl != 16 || item.loc != 'g' || item.stat.indexOf('leczy=') == -1 || !t.isNiceForHealing(item.name) || !t.isStatOk(item))
  366. continue;
  367.  
  368. t.items[t.items.length] = i;
  369. }
  370. t.items.sort();
  371. }
  372.  
  373. this.tryToHeal = function () {
  374. var t = this;
  375. if (hero.hp == hero.maxhp) return false;
  376.  
  377. t.sortItems();
  378.  
  379. for( var i in t.items) {
  380. var item = g.item[t.items[i]];
  381. var healHp = parseInt(item.stat.substr(item.stat.indexOf('leczy') + 6));
  382. if (healHp <= 0) return false;
  383. if (hero.maxhp - hero.hp >= healHp) {
  384. _g("moveitem&st=1&id=" + item.id);
  385. t.hp += healHp;
  386. setTimeout(function () {
  387. if (t.hp != hero.maxhp) t.tryToHeal();
  388. }, 700);
  389. return false;
  390. }
  391. }
  392. }
  393.  
  394. this.createPanel = function () {
  395. var t = this;
  396. $('<div></div>')
  397. .insertBefore('#centerbox')
  398. .attr('id', 'auto-leczenie')
  399. .attr('tip', "Kliknij dwukrotnie, aby zobaczyą? listą? obsł?ugiwanych przedmiotów")
  400. .css('padding', '5px')
  401. .css('position', 'absolute')
  402. .css('top', parseInt(t.getCookie('auto-leczenie-y')))
  403. .css('left', parseInt(t.getCookie('auto-leczenie-x')))
  404. .css('z-index', 500)
  405. .css('background', "url(http://www.margonem.pl/img/menuback.png)")
  406. .css('border', '1px solid gold')
  407. .css('fontSize', 12)
  408. .css('fontFamily', 'Arial')
  409. .css('cursor', 'move')
  410. .css('width', 50)
  411. .css('textAlign', 'center')
  412. .html(
  413. '<span>Auto Leczenie</span>' +
  414. '<input type="checkbox"/>'
  415. )
  416. .draggable({
  417. containment: 'window',
  418. start: function (event, ui) {
  419. g.lock.add('auto-leczenie');
  420. },
  421. stop: function (event, ui) {
  422. t.setCookie('auto-leczenie-x', ui.position.left);
  423. t.setCookie('auto-leczenie-y', ui.position.top);
  424. g.lock.remove('auto-leczenie');
  425. }
  426. })
  427. .dblclick(function () {
  428. var c = t.niceForHealing.length;
  429. var firstLetter = '';
  430. var com = '<h2>List obsł?ugiwanych przedmiotów:</h2><br/>';
  431. com += 'Jeżeli brakuje jakiegoł? przedmiotu, napisz o tym w komentarzu pod dodatkiem podają?c <u>bezpoł?redni link do przedmiotu na <a href="http://www.emargo.pl">emargo.pl</a></u>. Przedmioty z tzw. "peł?nym leczeniem" (<i>pozostał?o X punktów uleczania</i>) <b>NIE</b> są? obsł?ugiwane! Dokł?adnie zapoznaj sią? z ważnymi informacjami zawartymi w opisie dodatku!';
  432. com += '<div style="height:300px; overflow-y:auto; margin-top:10px; border: 1px solid #550; background-color:#fff; padding:10px;">';
  433. for (var i = 0; i < c; i++) {
  434. var m = t.niceForHealing[i];
  435. var f = m.substring(0, 1);
  436. if (firstLetter != f) {
  437. firstLetter = f;
  438. if(i != 0) com += '<br/>';
  439. com += '<b>' + f + '</b><br/>';
  440. }
  441. com += m + '<br/>';
  442. }
  443. com += '</div>';
  444. mAlert(com);
  445. });
  446. if (t.getCookie('auto-leczenie') == 'on')
  447. $('#auto-leczenie > input').attr('checked', 'checked');
  448. $('#auto-leczenie > input').click(function () {
  449. if ($(this).is(':checked')) {
  450. t.setCookie('auto-leczenie', 'on');
  451. } else {
  452. t.setCookie('auto-leczenie', 'off');
  453. }
  454. });
  455. }
  456. this.run = function () {
  457. if (!this.getCookie('auto-leczenie')) {
  458. this.setCookie('auto-leczenie', 'on');
  459. this.setCookie('auto-leczenie-x', 0);
  460. this.setCookie('auto-leczenie-y', 0);
  461. }
  462. this.createPanel();
  463. var th = this;
  464. var oldBattleMsg = battleMsg;
  465. battleMsg = function (c, t) {
  466. var ret = oldBattleMsg(c, t);
  467. if (c.indexOf("winner=") >= 0 && hero.hp < hero.maxhp && th.getCookie('auto-leczenie') == 'on' && !g.dead) {
  468. th.tryToHeal();
  469. }
  470. return ret;
  471. }
  472. }
  473. })().run();
  474. },
  475. data: ""
  476. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement