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.25
- // @description https://discord.gg/hPQNfNR
- // @author MiensnyTrzaski
- // @match *://*.margonem.pl/
- // @exclude https://www.margonem.pl/
- // @grant none
- // ==/UserScript==
- let classHandler; //Wiem bebe sprawa
- class heroLife {
- constructor() {
- this.heroX = hero.x;
- this.heroY = hero.y;
- this.back = false;
- }
- goTo(x, y) {
- const off = $("#ground").offset();
- const newObj = {
- clientX: (x << 5) + off.left,
- clientY: (y << 5) + off.top
- };
- hero.mClick(newObj);
- }
- 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(dest)
- await this.sleep(Math.floor(Math.random() * (3e3 - 1e3) + 1e3));
- console.log(dest)
- for (let i=0;i<dest.length;i++) {
- if(!hero.stasis){
- this.back = this.back ? false : true;
- return;
- }
- console.log(dest[i])
- this.goTo(...dest[i]);
- await this.sleep(1000);
- }
- if(!hero.stasis){
- this.back = this.back ? false : true;
- return;
- }
- 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();
- }
- };
- console.log(hero.stasis)
- if (hero.stasis && !classHandler) {
- classHandler = new heroLife();
- classHandler.wakeUp();
- }
- })(parseInput);
- }, 1e4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement