avatar
Untitled

Guest 75 15th Apr, 2024

MARKUP 1.32 KB
                                           
                         // ==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)))
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM