Greasy Fork

Greasy Fork is available in English.

[Pokeclicker] Omega Protein Gains

Removes the cap on the amount of Proteins that you can use on Pokémon which effectively makes them infinite use.

当前为 2022-06-03 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        [Pokeclicker] Omega Protein Gains
// @namespace   Pokeclicker Scripts
// @match       https://www.pokeclicker.com/
// @grant       none
// @version     1.0
// @author      Ephenia
// @description Removes the cap on the amount of Proteins that you can use on Pokémon which effectively makes them infinite use.
// ==/UserScript==

var proteinTable;
var awaitProteinTable;
var awaitOmegaProtein;
var newSave;
var trainerCards;

function initOmegaProtein() {
    document.getElementById('itemBag').querySelectorAll('div')[2].addEventListener('click', initProtein, true);
    
    function initProtein() {
        //This setInterval is one of the few required ones because this table does not exist until loaded once
        awaitProteinTable = setInterval(function () {
            proteinTable = document.getElementById('pokemonSelectorModal').querySelectorAll('tbody')
            if (proteinTable.length != 0) {
                clearInterval(awaitProteinTable);
                proteinTable[0].addEventListener('click', bypassProtein, true);
                function bypassProtein(event) {
                    var child = event.target.closest('tr').rowIndex - 1;
                    var protein = player.itemList.Protein();
                    var setProtein = VitaminController.getMultiplier()
                    var usedProtein = protein - setProtein;
                    var pokeProtein = PartyController.getProteinSortedList()[child].proteinsUsed()
                    if (setProtein == Infinity && protein > 0) {
                        PartyController.getProteinSortedList()[child].proteinsUsed(pokeProtein + protein)
                        player.itemList.Protein(0)
                    } else if (usedProtein >= 0) {
                        PartyController.getProteinSortedList()[child].proteinsUsed(pokeProtein + setProtein)
                        player.itemList.Protein(usedProtein)
                    } else {
                        Notifier.notify({
                            message: `You don't have any Proteins left...`,
                            type: NotificationConstants.NotificationOption.danger,
                        });
                    }
                    event.stopImmediatePropagation();
                }
            }
        }, 50);
    }
}

function loadScript(){
    var oldInit = Preload.hideSplashScreen

    Preload.hideSplashScreen = function(){
        var result = oldInit.apply(this, arguments)
        initOmegaProtein()
        return result
    }
}

var scriptName = 'omegaproteingains'

if (document.getElementById('scriptHandler') != undefined){
    var scriptElement = document.createElement('div')
    scriptElement.id = scriptName
    document.getElementById('scriptHandler').appendChild(scriptElement)
    if (localStorage.getItem(scriptName) != null){
        if (localStorage.getItem(scriptName) == 'true'){
            loadScript()
        }
    }
    else{
        localStorage.setItem(scriptName, 'true')
        loadScript()
    }
}
else{
    loadScript();
}