testing

Press ctrl to execute

Stan na 01-11-2024. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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)
                }
            }
        });
    }
});