// ==UserScript== // @name anty anty refresz // @version 1.1 // @description rusza sie jak sie pokaze stan nieaktywnosci // @author adrian wilk // @match http://zorza.margonem.pl/ // @match http://zemyna.margonem.pl/ // @match http://telawel.margonem.pl/ // @match http://katahha.margonem.pl/ // @match http://jaruna.margonem.pl/ // @match http://tarhuna.margonem.pl/ // @match http://gefion.margonem.pl/ // @match http://classic.margonem.pl/ // @match http://fobos.margonem.pl/ // @match http://zorza.margonem.pl/ // @match http://lelwani.margonem.pl/ // @match http://nomada.margonem.pl/ // @match http://perkun.margonem.pl/ // @match http://majuna.margonem.pl/ // @match http://hutena.margonem.pl/ // @match http://berufs.margonem.pl/ // @match http://brutal.margonem.pl/ // @grant none // ==/UserScript== (() => { const a = window.hero, b = "last-coordinates-anty-stasis", c = JSON.parse(localStorage.getItem(b)) || { x: null, y: null, name: null }, d = () => { const { x: d, y: e } = a, { name: f } = window.map; Object.assign(c, { x: d, y: e, name: f }), localStorage.setItem(b, JSON.stringify(c)) }, e = () => { Object.assign(c, { x: null, y: null, name: null }), localStorage.setItem(b, JSON.stringify(c)) }, f = (a, b) => { const { x: d, y: e } = c; return null === d && null === e ? 0 : Math.hypot(a - d, b - e) }, g = (a, b, c = !1) => { if (c) return "0" !== window.map.col[b * window.map.x + a]; const d = window.map.nodes.getNode(a, b); return !(d && d.hasOwnProperty("blocked")) || d.blocked }, h = (b = !1) => { const c = [], { x: d, y: e } = a; return c.push({ x: d + 1, y: e }), c.push({ x: d - 1, y: e }), c.push({ x: d, y: e + 1 }), c.push({ x: d, y: e - 1 }), b ? c : c.filter(({ x: a, y: b }) => !g(a, b)) }, i = () => { if (0 !== window.map.col.length) { const { name: a } = c; null !== a && a !== window.map.name && e(); const b = h(); if (0 < b.length) { const { x: a, y: e } = c; if (null === a || null === e) { const [{ x: a, y: c }] = b; d(), window.road = [{ x: a, y: c }] } else if (b.some(({ x: b, y: c }) => a === b && e === c)) d(), window.road = [{ x: a, y: e }]; else { const a = b.map(({ x: a, y: b }) => ({ x: a, y: b, distance: f(a, b) })), c = a.sort((a, b) => a.distance - b.distance), [{ x: d, y: e }] = c; window.road = [{ x: d, y: e }] } } else { const a = h(!0), b = a.filter(({ x: a, y: b }) => !g(a, b, !0)), c = b.map(({ x: a, y: b }) => ({ x: a, y: b, distance: f(a, b) })), e = c.sort((a, b) => a.distance - b.distance), [{ x: i, y: j }] = e; d(), window.road = [{ x: i, y: j }] } } }, j = window.parseInput; window.parseInput = (b, ...c) => { b.h && 1 === b.h.stasis && (Object.assign(a, b.h), i()); const d = j(b, ...c); return b.cl && 1 === a.stasis && i(), d } })();