smithHelper

Помощь кузнецу

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name           smithHelper
// @author         omne
// @namespace      omne
// @description    Помощь кузнецу
// @version        0.2
// @include        /^https{0,1}:\/\/((www|qrator|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/inventory.php/
// @license        GNU GPLv3
// ==/UserScript==

(function() {
    if (/inventory/.test(location.href)) {
        let transfers = document.querySelectorAll(".inv_request_info");
        for (let i = 0; i < transfers.length; i++) {
            if (transfers[i].innerHTML.indexOf("ремонт") > 0) {
                let art_id = transfers[i].innerHTML.match(/art_info.php.id=([^\"]+)/)[1];
                let gold = Number(transfers[i].querySelectorAll("b")[1].innerHTML.replace(",", ""));
                let perc = Number(transfers[i].innerHTML.match(/\(([0-9]+)%\)/)[1]);
                let repair_cost = Math.round(gold/perc*100);
                let repair_score = (repair_cost/4000).toFixed(2);
                let date = new Date(Date.now() + Math.round(repair_cost/4*60*60));
                let profit = gold - repair_cost;
                let divs = transfers[i].querySelectorAll("div");
                console.log(divs);
                for (let j = 0; j < divs.length; j++) {
                    if (divs[j].innerHTML.indexOf("Прочноcть:") >= 0) {
                        divs[j].innerHTML += "<BR>+<B>" + repair_score + "</b> ГК, до <b>" + date.getHours() + ":" + (date.getMinutes() < 10 ? "0" + date.getMinutes():date.getMinutes()) + "</b>, прибыль <b style = 'color:" + (profit >= 0 ? "green":"red") + "'>" + profit + "</b>";
                    }
                }
            }
        }
    }
})();