testing

Press ctrl to execute

ของเมื่อวันที่ 31-10-2024 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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" },
];


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