Advertisement
Nolifeq

Untitled

Jan 2nd, 2025
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.61 KB | None | 0 0
  1. // ==UserScript==
  2. // @name         AntiStasis
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  Porusza postacią gdy jest nieaktywna.
  6. // @author       Czogi
  7. // @match        https://*.margonem.pl/
  8. // @icon         https://micc.garmory-cdn.cloud/obrazki/interface/emo/stasis.gif
  9. // @run-at       document-start
  10. // @grant        none
  11. // ==/UserScript==
  12.  
  13. (async () => {
  14.   class Shift {
  15.     constructor(x, y) {
  16.       this.x = x;
  17.       this.y = y;
  18.     }
  19.   }
  20.   while (true) {
  21.     await new Promise((resolve) => setTimeout(resolve, 2e3));
  22.     if (!window?.hero?.stasis) {
  23.       continue;
  24.     }
  25.     const destCords = [];
  26.     const { x, y } = window.hero;
  27.     const possibleShifts = [];
  28.     for (let x = -1; x <= 1; x++) {
  29.       for (let y = -1; y <= 1; y++) {
  30.         if ((x !== 0 && y !== 0) || (!x && !y)) {
  31.           continue;
  32.         }
  33.         possibleShifts.push(new Shift(x, y));
  34.       }
  35.     }
  36.  
  37.     for (const shift of possibleShifts.sort(() => Math.random() - 0.5)) {
  38.       if (document.querySelector(`#gw${x + shift.x + 256 * (y + shift.y)}`)) {
  39.         continue;
  40.       }
  41.       if (g.npccol[x + shift.x + 256 * (y + shift.y)]) {
  42.         continue;
  43.       }
  44.       if (map.col[x + shift.x + (y + shift.y) * map.x] === "1") {
  45.         continue;
  46.       }
  47.  
  48.       road.push(x + shift.x, y + shift.y);
  49.       break;
  50.     }
  51.     _g(`_&ml=${road}&mts=${unix_time(true)}`, async (res) => {
  52.       if (res.h?.back === 1) {
  53.         return;
  54.       }
  55.       await new Promise((resolve) => setTimeout(resolve, 2e2));
  56.       _g(`_&ml=${[x, y]}&mts=${unix_time(true)}`);
  57.     });
  58.   }
  59. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement