Target Corruption

Reroll to whatever corruption you want!

当前为 2021-04-02 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Target Corruption
// @namespace   http://tampermonkey.net
// @match       https://melvoridle.com
// @match       https://melvoridle.com/*
// @match       https://www.melvoridle.com/*
// @match       https://test.melvoridle.com/*
// @grant       none
// @version     1.02
// @author      Gardens#3738
// @description Reroll to whatever corruption you want!
// ==/UserScript==

window.targetReroll = function(equipmentSlot, targetMods, rollsLeft = 100, lastMods = "default") {
    let cost = getRandomModifierCost(equipmentSlot);
    let element = document.getElementById("corruption-equipment-slot-" + equipmentSlot);
    // if modding possible
    if (rollsLeft > 0 && gp >= cost && equippedItems[equipmentSlot] > 0) {
        // let currentText;
        // get current mods
        if (lastMods == "default")
            lastMods = element.innerHTML;

        // reroll
        getEquipmentCorruption(equipmentSlot);

        let modHTML = element.innerHTML;
        // if same mods or bad mods, reroll
        let goodMod = false;
        for (let child of element.children) {
            if (child.outerHTML.indexOf("success") != -1) {
                for (let targetMod of targetMods) {
                    if (child.innerHTML.toLowerCase().indexOf(targetMod) != -1) {
                        goodMod = true;
                    }
                }
            }
        }

        if (goodMod == false || modHTML == lastMods) {
            setTimeout(() => {
                targetReroll(equipmentSlot, targetMods, rollsLeft - 1, modHTML)
            }, 50);
        } else
            return;
    }
}

// usage:
// targetReroll(2, ["mining", "doubling", "preservation", "smithing"], 200)