testing

Press ctrl to execute

2024/11/01のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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)
                }
            }
        });
    }
});