Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name AntiStasis
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Porusza postacią gdy jest nieaktywna.
- // @author Czogi
- // @match https://*.margonem.pl/
- // @icon https://micc.garmory-cdn.cloud/obrazki/interface/emo/stasis.gif
- // @run-at document-start
- // @grant none
- // ==/UserScript==
- (async () => {
- class Shift {
- constructor(x, y) {
- this.x = x;
- this.y = y;
- }
- }
- while (true) {
- await new Promise((resolve) => setTimeout(resolve, 2e3));
- if (!window?.hero?.stasis) {
- continue;
- }
- const destCords = [];
- const { x, y } = window.hero;
- const possibleShifts = [];
- for (let x = -1; x <= 1; x++) {
- for (let y = -1; y <= 1; y++) {
- if ((x !== 0 && y !== 0) || (!x && !y)) {
- continue;
- }
- possibleShifts.push(new Shift(x, y));
- }
- }
- for (const shift of possibleShifts.sort(() => Math.random() - 0.5)) {
- if (document.querySelector(`#gw${x + shift.x + 256 * (y + shift.y)}`)) {
- continue;
- }
- if (g.npccol[x + shift.x + 256 * (y + shift.y)]) {
- continue;
- }
- if (map.col[x + shift.x + (y + shift.y) * map.x] === "1") {
- continue;
- }
- road.push(x + shift.x, y + shift.y);
- break;
- }
- _g(`_&ml=${road}&mts=${unix_time(true)}`, async (res) => {
- if (res.h?.back === 1) {
- return;
- }
- await new Promise((resolve) => setTimeout(resolve, 2e2));
- _g(`_&ml=${[x, y]}&mts=${unix_time(true)}`);
- });
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement