Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name New Userscript
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match http://fobos.margonem.pl/
- // @grant none
- // @run-at document-idle
- // ==/UserScript==
- (function() {
- 'use strict';
- //81 - q, 70 - f
- let monsters = [];
- const startFight = new KeyboardEvent('keypress', {
- keyCode: 81,
- which: 81
- });
- const autoFight = new KeyboardEvent('keypress', {
- keyCode: 70,
- which: 70
- });
- const takeDrop = new KeyboardEvent('keypress', {
- keyCode: 79,
- which: 79
- });
- const takePotion = new KeyboardEvent('keypress', {
- keyCode: 49,
- which: 49
- });
- let i = 0;
- window.onload = () => {
- console.log(window.Engine.hero.d.warrior_stats)
- const hero = new Proxy({stop: false, hp: window.Engine.hero.d.warrior_stats.hp}, {
- set: (obj, prop, value) => {
- if (prop === 'stop' && value) {
- document.dispatchEvent(startFight);
- setTimeout(() => document.dispatchEvent(autoFight), 500);
- setTimeout(() => {
- document.dispatchEvent(takeDrop);
- }, 500);
- i++;
- }
- if (prop === 'hp' && value <= window.Engine.hero.d.warrior_stats.maxhp / 3) {
- document.dispatchEvent(takePotion);
- }
- obj[prop] = value;
- return true;
- }
- });
- console.log(hero);
- setInterval(() => {
- hero.stop = window.Engine.hero.stop;
- hero.hp = window.Engine.hero.d.warrior_stats.hp;
- }, 800);
- setInterval(() => {
- const npcs = window.Engine.npcs.check()
- monsters = [];
- for (const key in npcs) {
- if (npcs[key].d.lvl > 9) monsters.push(npcs[key])
- }
- if (!monsters[i]) i=0;
- window.Engine.hero.autoGoTo({
- x: monsters[i].d.x,
- y: monsters[i].d.y
- });
- }, i === 0 ? 10000 : 2000);
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement