Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match http://fobos.margonem.pl/
  8. // @grant none
  9. // @run-at document-idle
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. //81 - q, 70 - f
  14. let monsters = [];
  15.  
  16.  
  17. const startFight = new KeyboardEvent('keypress', {
  18. keyCode: 81,
  19. which: 81
  20. });
  21. const autoFight = new KeyboardEvent('keypress', {
  22. keyCode: 70,
  23. which: 70
  24. });
  25.  
  26. const takeDrop = new KeyboardEvent('keypress', {
  27. keyCode: 79,
  28. which: 79
  29. });
  30.  
  31. const takePotion = new KeyboardEvent('keypress', {
  32. keyCode: 49,
  33. which: 49
  34. });
  35.  
  36. let i = 0;
  37. window.onload = () => {
  38. console.log(window.Engine.hero.d.warrior_stats)
  39. const hero = new Proxy({stop: false, hp: window.Engine.hero.d.warrior_stats.hp}, {
  40. set: (obj, prop, value) => {
  41. if (prop === 'stop' && value) {
  42. document.dispatchEvent(startFight);
  43. setTimeout(() => document.dispatchEvent(autoFight), 500);
  44. setTimeout(() => {
  45. document.dispatchEvent(takeDrop);
  46. }, 500);
  47.  
  48. i++;
  49. }
  50. if (prop === 'hp' && value <= window.Engine.hero.d.warrior_stats.maxhp / 3) {
  51. document.dispatchEvent(takePotion);
  52. }
  53. obj[prop] = value;
  54. return true;
  55. }
  56.  
  57. });
  58.  
  59. console.log(hero);
  60. setInterval(() => {
  61. hero.stop = window.Engine.hero.stop;
  62. hero.hp = window.Engine.hero.d.warrior_stats.hp;
  63. }, 800);
  64. setInterval(() => {
  65. const npcs = window.Engine.npcs.check()
  66. monsters = [];
  67. for (const key in npcs) {
  68. if (npcs[key].d.lvl > 9) monsters.push(npcs[key])
  69. }
  70.  
  71. if (!monsters[i]) i=0;
  72. window.Engine.hero.autoGoTo({
  73. x: monsters[i].d.x,
  74. y: monsters[i].d.y
  75. });
  76. }, i === 0 ? 10000 : 2000);
  77. }
  78. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement