Advertisement
Nolifeq

duch SM

Apr 8th, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. // ==UserScript==
  2. // @name AntyDuch by SM
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.25
  5. // @description https://discord.gg/hPQNfNR
  6. // @author MiensnyTrzaski
  7. // @match *://*.margonem.pl/
  8. // @exclude https://www.margonem.pl/
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. let classHandler; //Wiem bebe sprawa
  13.  
  14. class heroLife {
  15. constructor() {
  16. this.heroX = hero.x;
  17. this.heroY = hero.y;
  18. this.back = false;
  19. }
  20.  
  21. goTo(x, y) {
  22. const off = $("#ground").offset();
  23. const newObj = {
  24. clientX: (x << 5) + off.left,
  25. clientY: (y << 5) + off.top
  26. };
  27. hero.mClick(newObj);
  28. }
  29.  
  30. hasCollision(x, y) {
  31. return map.col[map.x * y + x] === "1" ? true : false;
  32. }
  33.  
  34. findFreeCoords() {
  35. const startX = this.heroX - 1,
  36. endX = this.heroX + 1,
  37. startY = this.heroY - 1,
  38. endY = this.heroY + 1,
  39. allCoords=[];
  40. for (let i = startX; i <= endX; i++) {
  41. for (let j = startY; j <= endY; j++) {
  42. if (i === this.heroX && j === this.heroY) continue;
  43. if (!this.hasCollision(i, j)) {
  44. allCoords.push([i, j]);
  45. }
  46. }
  47. }
  48. return allCoords;
  49.  
  50. }
  51.  
  52. nextPos() {
  53. return this.back ? [[this.heroX, this.heroY]] : this.findFreeCoords();
  54. }
  55.  
  56. sleep(s) {
  57. return new Promise(res => setTimeout(() => res(1), s))
  58. }
  59. async wakeUp() {
  60. const dest = this.nextPos();
  61. console.log(dest)
  62. await this.sleep(Math.floor(Math.random() * (3e3 - 1e3) + 1e3));
  63. console.log(dest)
  64. for (let i=0;i<dest.length;i++) {
  65. if(!hero.stasis){
  66. this.back = this.back ? false : true;
  67. return;
  68. }
  69. console.log(dest[i])
  70. this.goTo(...dest[i]);
  71. await this.sleep(1000);
  72. }
  73.  
  74. if(!hero.stasis){
  75. this.back = this.back ? false : true;
  76. return;
  77. }
  78. location.reload();
  79.  
  80. }
  81. }
  82.  
  83. setTimeout(() => {
  84. (oldFun => {
  85. parseInput = (a, b, c) => {
  86. console.log(a, b, c)
  87. oldFun(a, b, c);
  88. if (isset(a.h) && a.h.hasOwnProperty('stasis') && a.h.stasis && !g.battle && !g.dead) {
  89. if (!classHandler) classHandler = new heroLife();
  90.  
  91. classHandler.wakeUp();
  92. }
  93. };
  94. console.log(hero.stasis)
  95.  
  96. if (hero.stasis && !classHandler) {
  97. classHandler = new heroLife();
  98. classHandler.wakeUp();
  99. }
  100. })(parseInput);
  101.  
  102. }, 1e4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement