Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name AntyDuch by SM
- // @namespace http://tampermonkey.net/
- // @version 0.26
- // @description https://discord.gg/hPQNfNR
- // @author MiensnyTrzaski
- // @match *://*.margonem.pl/
- // @exclude https://www.margonem.pl/
- // @grant none
- // ==/UserScript==
- let classHandler;
- class heroLife {
- constructor() {
- this.heroX = hero.x;
- this.heroY = hero.y;
- this.back = false;
- }
- goTo(x, y) {
- console.log(`Moving to coordinates: (${x}, ${y})`);
- window.hero.searchPath(x, y);
- }
- hasCollision(x, y) {
- return map.col[map.x * y + x] === "1" ? true : false;
- }
- findFreeCoords() {
- const startX = this.heroX - 1,
- endX = this.heroX + 1,
- startY = this.heroY - 1,
- endY = this.heroY + 1,
- allCoords = [];
- for (let i = startX; i <= endX; i++) {
- for (let j = startY; j <= endY; j++) {
- if (i === this.heroX && j === this.heroY) continue;
- if (!this.hasCollision(i, j)) {
- allCoords.push([i, j]);
- }
- }
- }
- return allCoords;
- }
- nextPos() {
- return this.back ? [[this.heroX, this.heroY]] : this.findFreeCoords();
- }
- sleep(s) {
- return new Promise(res => setTimeout(() => res(1), s));
- }
- async wakeUp() {
- const dest = this.nextPos();
- console.log("Available destinations:", dest);
- await this.sleep(Math.floor(Math.random() * (3000 - 1000) + 1000)); // Opóźnienie między 1-3 sekund
- for (let i = 0; i < dest.length; i++) {
- if (!hero.stasis) {
- this.back = !this.back;
- return;
- }
- console.log(`Navigating to: ${dest[i]}`);
- this.goTo(...dest[i]);
- await this.sleep(1000); // Opóźnienie 1 sekundy między ruchami
- }
- if (!hero.stasis) {
- this.back = !this.back;
- return;
- }
- console.log("Refreshing the page...");
- location.reload();
- }
- }
- setTimeout(() => {
- (oldFun => {
- parseInput = (a, b, c) => {
- console.log(a, b, c);
- oldFun(a, b, c);
- if (isset(a.h) && a.h.hasOwnProperty("stasis") && a.h.stasis && !g.battle && !g.dead) {
- if (!classHandler) classHandler = new heroLife();
- classHandler.wakeUp();
- }
- };
- if (hero.stasis && !classHandler) {
- classHandler = new heroLife();
- classHandler.wakeUp();
- }
- })(parseInput);
- }, 10000); // Opóźnienie inicjalizacji skryptu o 10 sekund
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement