testing

Press ctrl to execute

As of 01. 11. 2024. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         testing
// @namespace    http://tampermonkey.net/
// @version      2024-11-01
// @description  Press ctrl to execute
// @author       You
// @match        https://pokerogue.net/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pokerogue.net
// @run-at       document-start
// @license      MIT
// ==/UserScript==

let hacks = [
    { name: 'money',      isTrue: true, value: 10000,                            key: "money" },
    { name: 'eggVoucher', isTrue: true, value: { 0: 0, 1: 0, 2: 0, 3: 100 },     key: "gameData.voucherCounts" },
    { name: 'pokeball',   isTrue: true, value: { 0: 0, 1: 0, 2: 0, 3: 3, 4: 1 }, key: "pokeballCounts" },
    { name: 'waveIndex',  isTrue: true, value: 1,                                key: "currentPhase.lastSessionData.waveIndex" },
    // party
    { name: 'partyLevel', isTrue: true, value: 200,  key: "level" },
    { name: 'partyShiny', isTrue: true, value: true, key: "shiny" },
    { name: 'partyLuck',  isTrue: true, value: 14,   key: "luck" },// 0 - 14
    // enemyParty
    { name: 'enemyPartyLevel', isTrue: true, value: 200,   key: "level" },
    { name: 'enemyPartyShiny', isTrue: true, value: true,  key: "shiny" },
    // { name: 'enemyPartyBoss',  isTrue: true, value: true, key: "battleInfo.boss" },
    // arena
    { name: 'Weather', isTrue: true, value: 1, key: "" }, // Sunny: 1, Rain: 2, Sandstorm: 3,Hail: 4, Snow: 5, Fog: 6, Heavy Rain: 7, Harsh Sun: 8, Strong Winds: 9
    { name: 'Terrain', isTrue: true, value: 4, key: "" }, // Misty: 1, Electric: 2, Grassy: 3, Psychic: 4
];


///-------------------------------------------------///
var gameObj;
const origObjDefineProperty = Object.defineProperty;
Object.defineProperty = (...props)=>{
    if(props[2].value === 'Game'){
        const origFunc = props[0];
        props[0] = function(...funcArgs){
            gameObj = this;
            return origFunc.call(this, ...funcArgs);
        };
    }
    return origObjDefineProperty.call(this, ...props);
};
function getNestedProp(obj, path) {
    return path.split('.').reduce((acc, part) => acc && acc[part], obj);
}
function setNestedProp(obj, path, value) {
    const keys = path.split('.');
    const lastKey = keys.pop();
    const lastObj = keys.reduce((acc, key) => acc[key] = acc[key] || {}, obj);
    lastObj[lastKey] = value;
}
// Function to access the Game object later
document.addEventListener('keydown', e =>{
    if(e.ctrlKey){
        hacks.forEach(item => {
            if(item.isTrue){
                if(item.name == 'money'){
                    gameObj.scene.scenes[0].addMoney(item.value)
                }else if(item.name == 'pokeball'){
                    for(let val in item.value){
                        gameObj.scene.scenes[0].pokeballCounts[val] += item.value[val];
                    }
                }else{
                    setNestedProp(gameObj.scene.scenes[0], item.key, item.value);
                }
                if(item.name.includes('party')){
                    gameObj.scene.scenes[0].party.forEach(p =>{
                        // console.log(p[item.key])
                        p[item.key] = item.value
                    })
                }else if(item.name.includes('enemy')){
                    gameObj.scene.scenes[0].currentBattle.enemyParty.forEach(p =>{
                        // console.log(p)
                        setNestedProp(p, item.key, item.value);
                    })
                }else if(item.name.includes('Weather')){
                    gameObj.scene.scenes[0].arena.trySetWeather(item.value, 5)
                }else if(item.name.includes('Terrain')){
                    gameObj.scene.scenes[0].arena.trySetTerrain(item.value, 5)
                }
            }
        });
    }
});