testing

Press ctrl to execute

As of 06.11.2024. See апошняя версія.

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-06
// @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: false, 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
    // Execute without pressing ctrl
    { name: 'unlockAllPokemon',    isTrue: false, value: {seenAttr: 479n, caughtAttr: 255n, natureAttr: 100, seenCount: 50,
                                                          caughtCount: 50, hatchedCount: 50, ivs: [31, 31, 31, 31, 31, 31] }, key: "" },
    { name: 'unlockAllEverything', isTrue: false, value: { moveset: null, eggMoves: 15, candyCount: 100, friendship: 90,
                                                          abilityAttr: 7, passiveAttr: 0, valueReduction: 8, classicWinCount: 1 }, key: "" },
    { name: 'resetDexData',        isTrue: false, value: "", key: "" },
];


///-------------------------------------------------///
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;
}
// press ctrl to execute
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)
                }
            }
        });
    }
});
//
const pokemon = [1, 4, 7, 10, 13, 16, 19, 21, 23, 25, 27, 29, 32, 35, 37, 39, 41, 43, 46, 48, 50, 52, 54, 56, 58, 60, 63, 66, 69, 72, 74, 77, 79, 81, 83, 84, 86, 88, 90, 92, 95, 96, 98, 100, 102, 104, 106, 107, 108, 109, 111, 113, 114, 115, 116, 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 131, 132, 133, 137, 138, 140, 142, 143, 144, 145, 146, 147, 150, 151, 152, 155, 158, 161, 163, 165, 167, 170, 172, 173, 174, 175, 177, 179, 183, 185, 187, 190, 191, 193, 194, 198, 200, 201, 202, 203, 204, 206, 207, 209, 211, 213, 214, 215, 216, 218, 220, 222, 223, 225, 226, 227, 228, 231, 234, 235, 236, 238, 239, 240, 241, 243, 244, 245, 246, 249, 250, 251, 252, 255, 258, 261, 263, 265, 270, 273, 276, 278, 280, 283, 285, 287, 290, 293, 296, 298, 299, 300, 302, 303, 304, 307, 309, 311, 312, 313, 314, 315, 316, 318, 320, 322, 324, 325, 327, 328, 331, 333, 335, 336, 337, 338, 339, 341, 343, 345, 347, 349, 351, 352, 353, 355, 357, 358, 359, 360, 361, 363, 366, 369, 370, 371, 374, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 390, 393, 396, 399, 401, 403, 406, 408, 410, 412, 415, 417, 418, 420, 422, 425, 427, 431, 433, 434, 436, 438, 439, 440, 441, 442, 443, 446, 447, 449, 451, 453, 455, 456, 458, 459, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 498, 501, 504, 506, 509, 511, 513, 515, 517, 519, 522, 524, 527, 529, 531, 532, 535, 538, 539, 540, 543, 546, 548, 550, 551, 554, 556, 557, 559, 561, 562, 564, 566, 568, 570, 572, 574, 577, 580, 582, 585, 587, 588, 590, 592, 594, 595, 597, 599, 602, 605, 607, 610, 613, 615, 616, 618, 619, 621, 622, 624, 626, 627, 629, 631, 632, 633, 636, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 653, 656, 659, 661, 664, 667, 669, 672, 674, 676, 677, 679, 682, 684, 686, 688, 690, 692, 694, 696, 698, 701, 702, 703, 704, 707, 708, 710, 712, 714, 716, 717, 718, 719, 720, 721, 722, 725, 728, 731, 734, 736, 739, 741, 742, 744, 746, 747, 749, 751, 753, 755, 757, 759, 761, 764, 765, 766, 767, 769, 771, 772, 774, 775, 776, 777, 778, 779, 780, 781, 782, 785, 786, 787, 788, 789, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 805, 806, 807, 808, 810, 813, 816, 819, 821, 824, 827, 829, 831, 833, 835, 837, 840, 843, 845, 846, 848, 850, 852, 854, 856, 859, 868, 870, 871, 872, 874, 875, 876, 877, 878, 880, 881, 882, 883, 884, 885, 888, 889, 890, 891, 893, 894, 895, 896, 897, 898, 905, 906, 909, 912, 915, 917, 919, 921, 924, 926, 928, 931, 932, 935, 938, 940, 942, 944, 946, 948, 950, 951, 953, 955, 957, 960, 962, 963, 965, 967, 968, 969, 971, 973, 974, 976, 977, 978, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 999, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1012, 1014, 1015, 1016, 1017, 1020, 1021, 1022, 1023, 1024, 1025, 2670, 2019, 2027, 2037, 2050, 2052, 2074, 2088, 4052, 4077, 4079, 4083, 4122, 4144, 4145, 4146, 4222, 4263, 4554, 4562, 4618, 6058, 6100, 6211, 6215, 6570, 8128, 8194, 8901];
const Starters = [1, 4, 7, 152, 155, 158, 252, 255, 258, 387, 390, 393, 495, 498, 501, 650, 653, 656, 722, 725, 728, 810, 813, 816, 906, 909, 912];

(()=>{
    let unlockAllPokemon = hacks.find(hack => hack.name === 'unlockAllPokemon');
    let unlockAllEverything = hacks.find(hack => hack.name === 'unlockAllEverything');
    let resetDexData = hacks.find(hack => hack.name === 'resetDexData');
    let StartersDexData = {seenAttr: 149n, caughtAttr: 157n, natureAttr: 524288, seenCount: 0,
                           caughtCount: 0, hatchedCount: 0, ivs: [10, 10, 10, 10, 10, 10]};
    let resetDexData1 = {seenAttr: 0n, caughtAttr: 0n, natureAttr: 0, seenCount: 0,
                         caughtCount: 0, hatchedCount: 0, ivs: [0, 0, 0, 0, 0, 0]};
    let StartersStarterData = { moveset: null, eggMoves: 0, candyCount: 0, friendship: 0,
                               abilityAttr: 1, passiveAttr: 0, valueReduction: 0, classicWinCount: 0};
    let resetStarterData = { moveset: null, eggMoves: 0, candyCount: 0, friendship: 0,
                            abilityAttr: 0, passiveAttr: 0, valueReduction: 0, classicWinCount: 0};
    const originalConsoleDebug = unsafeWindow.console.debug;
    unsafeWindow.console.debug = function(...args){
        args.forEach(arg =>{
            if(arg && arg.dexData !== undefined && unlockAllPokemon.isTrue === true){
                pokemon.forEach(index =>{
                    arg.dexData[index] = unlockAllPokemon.value;
                });
            }
            if(arg && arg.starterData !== undefined && unlockAllEverything.isTrue === true){
                pokemon.forEach(index =>{
                    arg.starterData[index] = unlockAllEverything.value;
                });
            }
            if(arg && arg.starterData !== undefined && resetDexData.isTrue === true){
                Object.keys(arg.dexData).forEach(index =>{
                    arg.dexData[index] = Starters.includes(Number(index)) ? StartersDexData : resetDexData1;
                })
                Object.keys(arg.starterData).forEach(index =>{
                    arg.starterData[index] = Starters.includes(Number(index)) ? StartersStarterData : resetStarterData;
                })
            }
        });
    }
})();