// ==UserScript== // @name AUTOHEAL NOWY INTERFEJS // @version 1.0 // @author PAPIG TO NIGGER // @match https://tempest.margonem.pl/ // @grant none // ==/UserScript== (async (window, sleep) => { const useItem = (item) => { const { id } = item; window._g(`moveitem&st=1&id=${id}`); } const autoHeal = async () => { while (true) { if (!Engine.allInit) { await sleep(2000); continue; } let hp = parseInt(document.querySelector('.hpp > .value').getInnerHTML()); const potions = Engine.items.fetchLocationItems("g") .filter(item => item._cachedStats.hasOwnProperty("fullheal") || item._cachedStats.hasOwnProperty("leczy")); if (hp < 70) { if (potions != undefined) { useItem(potions[0]); } }else break; await sleep(150); } } window.API.addCallbackToEvent("close_battle", autoHeal); })(typeof unsafeWindow !== "undefined" ? unsafeWindow : window, (ms) => new Promise((resolve) => setTimeout(resolve, ms)))