testing

Press ctrl to execute

Από την 28/10/2024. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         testing
// @namespace    http://tampermonkey.net/
// @version      2024-10-26
// @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: 2,                                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: 0, 4: 10 }, key: "currentPhase.lastSessionData.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" },
];


///-------------------------------------------------///
var gameObj;
const origObjDefineProperty = Object.defineProperty;
Object.defineProperty = (...props)=>{
    if(props[2].value === 'Game'){
        const origFunc = props[0];
        console.log(origFunc);
        props[0] = function(...funcArgs){
            gameObj = this;
            console.log(gameObj);
            // gameObj.scene.scenes[0].currentBattle.enemyParty.battleInfo.boss = true
            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){
        console.log(gameObj.scene.scenes[0]);
        hacks.forEach(item => {
            if(item.isTrue){
                // console.log(getNestedProp(gameObj.scene.scenes[0], item.key));
                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);
                    })
                }
            }
        })
    }
});