// ==UserScript== // @name Auto dobijanie + Pościg // @namespace http://tampermonkey.net/ // @version 10.0 // @description try to take over the world! // @author You // @match *://*.margonem.pl // @grant none // ==/UserScript== ! function(e, t, n, a, i) { let r = new Array, o = e.createElement("span"); o.id = "enepere123", o.style = "position: absolute; background: black; color: white; top: 0px; left: 0px; width: auto; height: auto; font-size: 14px", e.body.appendChild(o); let l = e.createElement("span"); l.innerHTML = "UCIECZKA", l.style.fontWeight = "bold", l.tip = "Naciśnij podczas walki, aby po walce automatycznie uciec na Kwieciste Przejście."; let c, s = !1; window.hero.searchPath1 = function(e, t) { if (this.isBlockedSearchPath()) return this.blockedInfoSearchPath(); for (var n = [], a = 128 & hero.opt ? 8 : 20, i = Math.max(0, Math.min(e, this.x) - a), r = Math.min(map.x - 1, Math.max(e, this.x) + a), o = Math.max(0, Math.min(t, this.y) - a), l = Math.min(map.y - 1, Math.max(t, this.y) + a), c = i - 1; r + 1 >= c; c++) { n[c] = []; for (var s = o - 1; l + 1 >= s; s++) n[c][s] = !(c >= i && r >= c && s >= o && l >= s) || isset(g.npccol[c + 256 * s]) || map.col && "0" != map.col.charAt(c + s * map.x) ? -2 : -1 } n[this.x][this.y] = 0, b = -1, road = []; for (var h = { x: -1, y: -1, dist: 99 }, d = 1; r - i + l - o + 3 > d; d++) for (c = i; r >= c; c++) for (s = o; l >= s; s++) { if (-1 != n[c][s] || n[c][s - 1] != d - 1 && n[c][s + 1] != d - 1 && n[c - 1][s] != d - 1 && n[c + 1][s] != d - 1 || (n[c][s] = d), n[e][t] > 0) { c = r + 1; break } h.dist2 = Math.abs(e - c) + Math.abs(t - s), n[c][s] == d && h.dist2 < h.dist && (h.x = c, h.y = s, h.dist = h.dist2) } if (h.hdist = Math.abs(e - hero.x) + Math.abs(t - hero.y), n[e][t] > 0 || h.dist < h.hdist) { n[e][t] < 0 && (e > h.x ? b = 2 : e < h.x ? b = 1 : t > h.y ? b = 0 : t < h.y && (b = 3), e = h.x, t = h.y), road[0] = { x: e, y: t }; for (var p = n[e][t] - 1, y = e, u = t; p > 0; p--) n[y][u - 1] == p ? u-- : n[y][u + 1] == p ? u++ : n[y - 1][u] == p ? y-- : n[y + 1][u] == p ? y++ : p = 0, p && (road[n[e][t] - p] = { x: y, y: u }) } road.length > 1 && null == g.playerCatcher.follow && $("#target").stop().css({ left: 32 * e, top: 32 * t, display: "block", opacity: 1 }).fadeOut(1e3) }, l.addEventListener("click", function() { if (g.battle) if (s) l.style.color = "white", l.innerHTML = "UCIECZKA", s = !1; else for (let e in g.item) if ("g" == g.item[e].loc && "Zwój teleportacji na Kwieciste Przejście" == g.item[e].name) { s = !0, c = e, l.style.color = "green", l.innerHTML = "UCIECZKA AKTYWNA"; break } }), o.appendChild(l); let h = e.createElement("span"); o.appendChild(h); let d, p = e.createElement("style"); p.innerHTML = ".adison9711:hover{background:#686868}", e.head.appendChild(p); let y, u, m, f, w = 0, x = []; e.querySelector("#nick").addEventListener("click", function() { 0 != w && (w = 0, message("Przerwanie pościgu!")) }); let M = new Audio; M.src = "http://www.adiwilk.pl/js/syrena.mp3"; let k, v = e.createElement("span"); function C(t, n, a, i, r, o, l) { let c = e.createElement("span"); c.classList.add("adison9711"), c.innerHTML = `
${t}. `; let s = e.createElement("span"); switch (s.innerHTML = `${a}`, s.tip = "Naciśnij, aby napisać do tej osoby.", s.addEventListener("click", function() { chatTo(`${a}`) }), s.style.fontWeight = "bold", l > 0 && (s.style.color = "gold"), i) { case "fr": s.style.color = "green"; break; case "en": s.style.color = "red"; break; case "cl": s.style.color = "lightblue" } c.appendChild(s); let d = e.createElement("span"); d.innerHTML = ` ${r}${o} `, c.appendChild(d); let p = e.createElement("span"), y = Math.round(Math.sqrt(Math.pow(g.other[n].x - hero.x, 2) + Math.pow(g.other[n].y - hero.y, 2))); p.innerHTML = `[Odl.: ${y}] `, p.tip = "Nacisnij, aby podejsc.", p.addEventListener("click", function() { window.hero.searchPath1(g.other[n].x, g.other[n].y) }), c.appendChild(p); let u = e.createElement("span"); u.innerHTML = "[ATAKUJ]", u.tip = "Nacisnij, aby aktywowac poscig.", u.addEventListener("click", function() { g.battle ? message("Trwa walka!") : 2 == map.pvp ? (w = n, message(`Rozpoczęto pościg za: ${g.other[n].nick}!`)) : message("Nie jesteś na czerwonej mapce!") }), c.appendChild(u), c.addEventListener("mouseover", function() { ! function() { for (let t in g.other) e.querySelector(`#other${t}`).style.backgroundColor = "" }(), e.querySelector(`#other${n}`).style.backgroundColor = "rgb(255, 102, 0, .65)", e.querySelector(`#other${n}`).style.borderRadius = "7px" }), c.addEventListener("mouseleave", function() { g.other[n] && (e.querySelector(`#other${n}`).style.backgroundColor = "") }), h.appendChild(c) } function E(e) { let t = g.npc[e]; if (t.wt > 99) M.play(), v.style.display = "block", message(`
Tytan: ${t.nick} ${t.lvl}lvl

[${t.x}, ${t.y}]
`); else { let e = Math.sqrt(Math.pow(Math.abs(hero.x - t.x), 2)) + Math.sqrt(Math.pow(Math.abs(hero.y - t.y), 2)); !g.battle && e > 8 ? mAlert(`
Heros:

${t.nick} ${t.lvl}lvl
${map.name}(${t.x},${t.y})
Czy chcesz podejść?
`, 2, [function() { miniMapPlus ? miniMapPlus.searchPath(t.x, t.y) : window.hero.searchPath1(t.x, t.y) }, function() { return !1 }]) : message(`
Heros: ${t.nick} ${t.lvl}lvl

[${t.x}, ${t.y}]
`) } } v.id = "adison_zarcik", v.style = "position: absolute; background-color: blue; top: 100px; right: 100px; color: white; font-size: 35px; display: none; text-align: center; padding: 10px; cursor: pointer", v.innerHTML = "Wyłącz syrenę", e.body.appendChild(v), v.addEventListener("click", function() { v.style.display = "none", M.pause() }), parseInput = function(n, a, i) { if (t(n, a, i), n.hasOwnProperty("emo")) for (let e in n.emo) "battle" != n.emo[e].name || x.includes(n.emo[e].source_id) ? "battle" != n.emo[e].name && x.includes(n.emo[e].source_id) && x.splice(x.indexOf(n.emo[e].source_id), 1) : x.push(n.emo[e].source_id); e.querySelector("#enepere123").style.width = e.querySelector("#centerbox").style.left, function() { d = 1, h.innerHTML = ""; for (let e in g.other) { let t = ""; t = d < 10 ? `0${d}` : d; let n = g.other[e]; void 0 !== n.nick && (C(t, n.id, n.nick, n.relation, n.lvl, n.prof, n.rights), d++) } }() }, newNpc = function(e) { n(e); for (let t in e) if (e[t].wt > 79 && 5 != map.mode && "experimental" != g.worldname && !r.includes(e[t].id)) { E(t), r.push(e[t].id); break } }, hero.run = function() { 0 != w && g.other[w] && (y = g.other[w].x, u = g.other[w].y, m = hero.x, f = hero.y, g.battle ? (w = 0, message("Jest walka!")) : (Math.abs(m - y) <= 2 && Math.abs(f - u) <= 2 && (x.includes(Number(w)) || _g(`fight&a=attack&id=${w}`)), m == y && f == u || window.hero.searchPath1(y, u))), a.apply(this, arguments) }, battleMsg = function(e, t) { let n = i(e, t); return e.indexOf("winner=") > -1 && (_g("fight&a=quit"), s && (_g(`moveitem&st=1&id=${c}`), s = !1, l.style.color = "white", l.innerHTML = "UCIECZKA"), k = setInterval(function() { g.battle ? _g("fight&a=quit") : clearInterval(k) }, 100)), n } }(document, parseInput, newNpc, hero.run, battleMsg);