[Pokeclicker] Challenge Mode Changer

Lets you enable/disable any of the Challenges at any given point in time. This is compatiable with any save and will work on pre-existing saves. It's best to backup your save before using this.

目前为 2022-01-12 提交的版本。查看 最新版本

// ==UserScript==
// @name        [Pokeclicker] Challenge Mode Changer
// @namespace   Pokeclicker Scripts
// @match       https://www.pokeclicker.com/
// @grant       none
// @version     1.1
// @author      Ephenia
// @description Lets you enable/disable any of the Challenges at any given point in time. This is compatiable with any save and will work on pre-existing saves. It's best to backup your save before using this.
// ==/UserScript==

var awaitChallenger;
var chalList;
var chalNames = [];
var newSave = document.querySelectorAll('label')[0];
var trainerCards = document.querySelectorAll('.trainer-card');

function initChallenger() {
    chalList = App.game.challenges.list;
    for (var chal in chalList) {
        chalNames.push(chal)
    }
    remDisable();

    function remDisable() {
        var buttons = document.getElementById('challengeModeModal').querySelectorAll('button.btn');
        buttons.forEach((element, index) => {
            if (element.outerText == "ACTIVE" || element.outerText == "DISABLED") {
                element.setAttribute("data-index", index);
                element.classList.remove("disabled");
                element.addEventListener("click", toggleChallenge, false);
            }
        })
    }

    function toggleChallenge() {
        var index = this.getAttribute("data-index");
        chalCheck(index) ? chalChange(index, false) : chalChange(index, true);
        setTimeout(remDisable, 50);
    }

    function chalCheck(index) {
        return chalList[chalNames[index]].active();
    }

    function chalChange(index, boolean) {
        return chalList[chalNames[index]].active(boolean);
    }
}

for (var i = 0; i < trainerCards.length; i++) {
    trainerCards[i].addEventListener('click', checkChallenger, false);
}
newSave.addEventListener('click', checkChallenger, false);

function checkChallenger() {
    awaitChallenger = setInterval(function () {
        var gameState;
        try {
            gameState = App.game.gameState;
        } catch (err) { }
        if (gameState >= 2 && App.game.keyItems.hasKeyItem(3)) {
            initChallenger();
            clearInterval(awaitChallenger)
        }
    }, 1000);
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址