// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.margonem.pl/ // @grant none // ==/UserScript== (function() { 'use strict'; // Your code here... })();$('#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 = ""; 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) }; var lol = 0; ceb.f1 = function() { hero.nextx = ''; hero.nexty = ''; var cango = true; ceb.bestxy = 9999; for (var i in g.npc) { var npc = g.npc[i]; if((npc.wt > 19 && npc.wt < 30)) { if (g.npc[i].fake !== true && (g.npc[i].type == 2 || g.npc[i].type == 3)) { lol++; if(lol>2) { 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; }; hero.cebgo(hero.nextx, hero.nexty); } } } } }; ceb.f2 = function() { if (road.length == 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)) { _g("fight&a=attack&ff=1&id=-" + ceb.id); lol = 0; } } }; var partyInvite = function(id){ _g("party&a=inv&id="+id); } ceb.f3 = function() { if(g.party && g.party[hero.id].r == 0) return; Object.keys(g.other).filter(function(key){ return g.party[key] === undefined && (g.other[key].relation == 'fr' || g.other[key].relation == 'cl'); }).forEach(function(key){ if(g.other[key].relation == 'fr' || g.other[key].relation == 'cl') partyInvite(key); }); }; ceb.interv1 = setInterval(ceb.f1, 550); ceb.interv2 = setInterval(ceb.f2, 650); ceb.interv3 = setInterval(ceb.f3, 10000);