Facebook
From antyduch, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 151
  1. // ==UserScript==
  2. // @name         anty anty refresz
  3. // @version      1.1
  4. // @description  rusza sie jak sie pokaze stan nieaktywnosci
  5. // @author       adrian wilk
  6. // @match        http://zorza.margonem.pl/
  7. // @match        http://zemyna.margonem.pl/
  8. // @match        http://telawel.margonem.pl/
  9. // @match        http://katahha.margonem.pl/
  10. // @match        http://jaruna.margonem.pl/
  11. // @match        http://tarhuna.margonem.pl/
  12. // @match        http://gefion.margonem.pl/
  13. // @match        http://classic.margonem.pl/
  14. // @match        http://fobos.margonem.pl/
  15. // @match        http://zorza.margonem.pl/
  16. // @match        http://lelwani.margonem.pl/
  17. // @match        http://nomada.margonem.pl/
  18. // @match        http://perkun.margonem.pl/
  19. // @match        http://majuna.margonem.pl/
  20. // @match        http://hutena.margonem.pl/
  21. // @match        http://berufs.margonem.pl/
  22. // @match        http://brutal.margonem.pl/
  23. // @grant        none
  24. // ==/UserScript==
  25. (() => {
  26.     const a = window.hero,
  27.         b = "last-coordinates-anty-stasis",
  28.         c = JSON.parse(localStorage.getItem(b)) || {
  29.             x: null,
  30.             y: null,
  31.             name: null
  32.         },
  33.         d = () => {
  34.             const {
  35.                 x: d,
  36.                 y: e
  37.             } = a, {
  38.                 name: f
  39.             } = window.map;
  40.             Object.assign(c, {
  41.                 x: d,
  42.                 y: e,
  43.                 name: f
  44.             }), localStorage.setItem(b, JSON.stringify(c))
  45.         },
  46.         e = () => {
  47.             Object.assign(c, {
  48.                 x: null,
  49.                 y: null,
  50.                 name: null
  51.             }), localStorage.setItem(b, JSON.stringify(c))
  52.         },
  53.         f = (a, b) => {
  54.             const {
  55.                 x: d,
  56.                 y: e
  57.             } = c;
  58.             return null === d && null === e ? 0 : Math.hypot(a - d, b - e)
  59.         },
  60.         g = (a, b, c = !1) => {
  61.             if (c) return "0" !== window.map.col[b * window.map.x + a];
  62.             const d = window.map.nodes.getNode(a, b);
  63.             return !(d && d.hasOwnProperty("blocked")) || d.blocked
  64.         },
  65.         h = (b = !1) => {
  66.             const c = [],
  67.                 {
  68.                     x: d,
  69.                     y: e
  70.                 } = a;
  71.             return c.push({
  72.                 x: d + 1,
  73.                 y: e
  74.             }), c.push({
  75.                 x: d - 1,
  76.                 y: e
  77.             }), c.push({
  78.                 x: d,
  79.                 y: e + 1
  80.             }), c.push({
  81.                 x: d,
  82.                 y: e - 1
  83.             }), b ? c : c.filter(({
  84.                 x: a,
  85.                 y: b
  86.             }) => !g(a, b))
  87.         },
  88.         i = () => {
  89.             if (0 !== window.map.col.length) {
  90.                 const {
  91.                     name: a
  92.                 } = c;
  93.                 null !== a && a !== window.map.name && e();
  94.                 const b = h();
  95.                 if (0 < b.length) {
  96.                     const {
  97.                         x: a,
  98.                         y: e
  99.                     } = c;
  100.                     if (null === a || null === e) {
  101.                         const [{
  102.                             x: a,
  103.                             y: c
  104.                         }] = b;
  105.                         d(), window.road = [{
  106.                             x: a,
  107.                             y: c
  108.                         }]
  109.                     } else if (b.some(({
  110.                             x: b,
  111.                             y: c
  112.                         }) => a === b && e === c)) d(), window.road = [{
  113.                         x: a,
  114.                         y: e
  115.                     }];
  116.                     else {
  117.                         const a = b.map(({
  118.                                 x: a,
  119.                                 y: b
  120.                             }) => ({
  121.                                 x: a,
  122.                                 y: b,
  123.                                 distance: f(a, b)
  124.                             })),
  125.                             c = a.sort((a, b) => a.distance - b.distance),
  126.                             [{
  127.                                 x: d,
  128.                                 y: e
  129.                             }] = c;
  130.                         window.road = [{
  131.                             x: d,
  132.                             y: e
  133.                         }]
  134.                     }
  135.                 } else {
  136.                     const a = h(!0),
  137.                         b = a.filter(({
  138.                             x: a,
  139.                             y: b
  140.                         }) => !g(a, b, !0)),
  141.                         c = b.map(({
  142.                             x: a,
  143.                             y: b
  144.                         }) => ({
  145.                             x: a,
  146.                             y: b,
  147.                             distance: f(a, b)
  148.                         })),
  149.                         e = c.sort((a, b) => a.distance - b.distance),
  150.                         [{
  151.                             x: i,
  152.                             y: j
  153.                         }] = e;
  154.                     d(), window.road = [{
  155.                         x: i,
  156.                         y: j
  157.                     }]
  158.                 }
  159.             }
  160.         },
  161.         j = window.parseInput;
  162.     window.parseInput = (b, ...c) => {
  163.         b.h && 1 === b.h.stasis && (Object.assign(a, b.h), i());
  164.         const d = j(b, ...c);
  165.         return b.cl && 1 === a.stasis && i(), d
  166.     }
  167. })();