Coder Social home page Coder Social logo

pyrogue's Introduction

pyRogue

pyRogue is a educational project. Not longer updated.

This project was alive before they released any ToC, Usage Policy's and such. Since they set down some policys, this project is no longer maintained or updated. Hence, the codebase may or may not work.

You accessing the API with this codebase is against they're usage policy's and ToS. Please read them thoroughly.

Stars Watchers GitHub Forks

Release Version Release Date Docstring Coverage Downloads

Badge Last Commit Badge Security Policy Badge Open Issues Badge Open Pull Requests Badge Contributors


Preview Image Preview Image

All Previews

Table of Contents

Important foreword

We learned enough about freezing python to binarys so from here on out it will be source code only.

We will not sent you any files or contact you about anything. You can see who contributed and everything regarding us will be only done on GitHub. We will not contact you in any matter or will send you files. There are scammers out there. Here you can read the full source code, compile it from scratch and such or download a VT-checked official release.

Attention: When ever this tool detects you are trying to manipulate a daily seeded run it will abort. We only do this for educating us and provide the source code opensource in compliance with PokeRogue's License.

  • We take no responsibility for your actions when using this tool. Whenever you startup tho a backup is created and stand: 03.07.2024 - they are applicable no matter created when.

  • Security Notice

FAQ

  • How do i revert my changes?

    • The programm will always create backups everytime you login! When you load the first time it will create a base_gameData(trainerID)_03.07.2024_18.03.22.json unique based on your trainerID coupled with a timestamp. This applies for slot' data aswell; backup_slotData(slotNumber_trainerID)_03.07.2024_18.03.22.json. All subsequent backups will be prefixed with backup_ and you can restore to any file back in time.

    Preview Image

  • Will this get me banned?

  • Where can i donate?

    • We will not accept any money or any form of payment. If you want to help then only by contributing. We do it for education only, any critique welcome.

How to run from code

Prerequisites

  • Python: Ensure that Python 3 is installed on your system. You can download it from python.org.

Downloading the Source Code

You can either download the source code as a ZIP file and extract it, or clone the repository using Git.

Option 1: Download and Extract

  1. Download the ZIP file containing the source code.
  2. Extract the contents to your desired location.

Option 2: Clone the Repository

  1. Open a terminal or command prompt.
  2. Use the following command to clone the repository, including submodules:
    git clone --recursive https://github.com/RogueEdit/pyRogue
    

Running the Project

Some Enviroments use python3 (Microsoft Store) and some need to write py only.

Windows

  1. Navigate to the Source Directory:
    • Open a terminal (Command Prompt or PowerShell).
    • Navigate to the source directory:
      cd [extracted_folder]/src/
  2. Install Dependencies:
    • Use pip to install the required packages:
      python -m pip install -r requirements.txt
  3. Run the Application:
    • Run the main script:
      python main.py

Linux

  1. Navigate to the Source Directory:
    • Open a terminal.
    • Navigate to the source directory:
      cd [extracted_folder]/src/
  2. Make the Main Script Executable:
    • Use the following command to ensure the script is executable:
      chmod +x main.py
  3. Install Dependencies:
    • Use pip to install the required packages:
      python3 -m pip install -r requirements.txt
  4. Run the Application:
    • Execute the main script:
      ./main.py

macOS

The steps for macOS are generally similar to those for Linux:

  1. Navigate to the Source Directory:
    • Open Terminal.
    • Navigate to the source directory:
      cd [extracted_folder]/src/
  2. Make the Main Script Executable:
    • Ensure the script is executable:
      chmod +x main.py
  3. Install Dependencies:
    • Use pip to install the required packages:
      python3 -m pip install -r requirements.txt
  4. Run the Application:
    • Execute the main script:
      ./main.py

License

In compliance with Pokerogue's License this project here is also released under AGPL3.

No copyright or trademark infringement is intended in using Pokémon related names and IDs. Pokémon © 2002-2024 Pokémon. © 1995-2024 Nintendo/Creatures Inc./GAME FREAK inc. TM, ® and Pokémon character names are trademarks of Nintendo.


Reversed Stuff

  • Extensive logging for easy debug in a log file

  • When logging in it will automatically create backups for you.
    • You can restore backups easily see preview above

  • Change selected slot
    • This will fetch the chosen new slot_x.json containing your session save data

  • Edit a starter - This will ask you to take any input:

Preview Image


  • Unlock all starters | same as above but for all pokemons

    • This will unlock every single Pokemon depending on your choosings like above

    alt text


  • Modify the number of egg-tickets you have

    • This allows you to set the amount of egg gacha tickets you have of every tier

    alt text


  • Edit a pokemon in your party
    • Let's you edit g-max, fusions, moves, species, level, luck, fusion etc...

grafik


  • Item Editor

Preview Image


  • Unlock all game modes

    • Unlocks: classic, endless, spliced endless
  • Add one or unlock all

    • Vouchers

    Preview Image

    • Achievements

    Preview Image

    Preview Image


  • Edit amount of money
    • alt text
  • Edit pokeballs amount
    • alt text
  • Edit biome
  • Edit candies on a pokemon

  • Generate eggs

    • Depending on your liking, whatever rarity - gacha type and such

    preview

  • Set your eggs to hatch

  • Edit account stats

    preview

    • Randomize all
    • Set all in a loop
    • Set specific ones

    preview


  • Unlock everything
    • Just calls mulitiple features from above
    • Will also edit account stats with "legit" constraints. Based on your seen variables and such and randomized between reasonable values.

  • Display all Pokemon with their names and id
  • Display all Biomes IDs
  • Display all Moves IDs
  • Display all Voucher IDs
  • Display all Natures
  • Display all Nature Slot IDs
  • Save data to server via open accesible API calls

alt text

Regarding Bans and Limited Accounts

https://www.reddit.com/r/pokerogue/comments/1d8hncf/cheats_and_exploits_post_followup_bannable/

https://www.reddit.com/r/pokerogue/comments/1d8ldlw/a_cheating_and_account_deletionwipe_followup/

pyrogue's People

Contributors

julianstiebler avatar claudiunderthehood avatar mour0 avatar dependabot[bot] avatar

Stargazers

Nathan Pham-Le avatar  avatar  avatar  avatar RalseiMods avatar  avatar  avatar Ethan avatar  avatar  avatar  avatar Etronie DENG avatar  avatar  avatar HelloWorld avatar Ilya Zaytsev avatar  avatar Mark avatar  avatar Pedro Poli avatar  avatar  avatar  avatar BUtane avatar  avatar  avatar  avatar  avatar  avatar Nue avatar  avatar  avatar  avatar  avatar Helzoph avatar  avatar Rushvanth avatar Julian Strohm avatar CrimsonKiss avatar Katelynn Cusanelli avatar  avatar  avatar  avatar ViPro (京京) avatar Johan A. Puerta Santos avatar  avatar Nedzad Winter avatar  avatar  avatar Federico Rossi avatar Luca Capanna avatar

Watchers

 avatar  avatar Nue avatar  avatar RalseiMods avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyrogue's Issues

Feature: Request rework of some user relevant stuff

User Input Fields renaming maybe?

  • Username:
  • Password (hidden input):

After login and when chrome opens we should print in console multiple times before we go to sleep and wait for the fields to appear:
"Please do not log-in manually now in the new opened browser. Wait until the browser closes and do not touch anything."
"Please do not log-in manually now in the new opened browser. Wait until the browser closes and do not touch anything."
"Please do not log-in manually now in the new opened browser. Wait until the browser closes and do not touch anything."
"Please do not log-in manually now in the new opened browser. Wait until the browser closes and do not touch anything."
"Please do not log-in manually now in the new opened browser. Wait until the browser closes and do not touch anything."
Even if people dont see it cause the browser and so they maybe see it when scrolling up

i got 3 people that couldn't wait any longer and logged in :'D

maybe we should look into some method to not ahve to sleep but when we find both user & password field

Question: Attention needed

I have a problem whenever I try and save it says I saved it Then I open my game up and its not changed

option 2 problem

I try in version 1.8 to enter with option 2 and it waits about 1 minute waiting for the login after logging in and from there the last thing comes to mind, I share 2 images of the problem,
pokerogue error
pokerogue error2

Feature: Reduce Starters Cost or Increase Points Limit

Is your feature request related to a problem? Please describe.
When starting a new game, the user is currently limited to a maximum of 10 (classic) or 15 (endless) points. This restriction prevents users from selecting any combination of starters they desire.

Describe the solution you'd like to see implemented
Either increase the limit or reduce the cost of every starter.

Feature: Requested ability to unlock all passives

data["starterData"][entry] = {
                    "moveset": None,
                    "eggMoves": 15,
                    "candyCount": caught + 20,
                    "friendship": 0,
                    "abilityAttr": 7,
                    "passiveAttr": 0 if entry in self.NO_PASSIVE else 3,
                    "valueReduction": 2,
                    "classicWinCount": 0,
                }

Set those to 0
NO_PASSIVE = [
"25",
"35",
"39",
"106",
"107",
"113",
"122",
"124",
"125",
"126",
"143",
"183",
"185",
"202",
"226",
"315",
"358",
"4122",
]

everything else to 3

maybe add possibility to unlock passive at edit starter aswell
i htink that was wht the guy lost #7

Bug: Option 2 bug

What Operating System are you on - Windows, Ubuntu, Mac, ...

  • windows

Describe the bug - A clear and concise description of what the bug is.

If you enter and run ID information after selecting option 2, you can still wait for login data... After 1 to 2 minutes
Session ID: None
Token: None
Request Headers: null
These values are output

The language I use is Korean, but I wonder if I can't find it or if there is a solution because the Korean system is different.

For option 1, a 403 error appears.

화면 캡처 2024-06-07 105051

Bug: Need attention immediately

Describe the bug
Screenshot says it all

To Reproduce
I just logged in

Expected behavior
Login should happen

Screenshots
grafik

What Operating System are you on
Windows

Additional context
options.add_argument('--ignore-certificate-errors')
options.add_argument('--allow-running-insecure-content')

might solve it.

Feature: Requested rewrite of converter.js to python

Requesting a rewrite of the converter to work in python.

  • the tool will ask first for online or offline

    • if offlnie then look for .prsv in folder
    • convert
    • put in data in dicts
    • loop back into main routine
  • Saving option checks for

    • if online; updateall-API call
    • if offline; convert data and save as .prsv

Explanation

  • Reading the Encrypted File: The encrypted content is read from the specified file path.
  • Base64 Decoding: The encrypted content is decoded from Base64 since CryptoJS typically outputs in Base64.
  • Creating the AES Cipher: An AES cipher object is created using the provided key with ECB mode.
  • Decrypting: The content is decrypted using the cipher.
  • Unpadding: The decrypted content is unpadded to remove any padding added during encryption.

Example code

from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
import base64

def decrypt_file(file_path, key):
    # Read the encrypted content from the file
    with open(file_path, 'rb') as f:
        encrypted_content = f.read()

    # Decode the base64 encoded content
    encrypted_content = base64.b64decode(encrypted_content)

    # Create an AES cipher object with the given key
    cipher = AES.new(key.encode('utf-8'), AES.MODE_ECB)

    # Decrypt the content
    decrypted_content = cipher.decrypt(encrypted_content)

    # Unpad the decrypted content
    decrypted_content = unpad(decrypted_content, AES.block_size)

    return decrypted_content

# Replace 'encrypted_file.prsv' with the path to your encrypted file
file_path = 'encrypted_file.prsv'

# The key used for encryption
key = 'x0i2O7WRiANTqPmZ'

# Decrypt the file and get the content
decrypted_content = decrypt_file(file_path, key)

# Print the decrypted content
print(decrypted_content.decode('latin-1'))

-------- This code example was autogenerated by Git CoPilot. It is not tested!!!!!!!!!

403 Forbidden - before you post here

pkrogue
As I saw that it no longer left the 1st option, I tried the second one and it doesn't work in version 1.7 of the application, this error occurs

Bug: Need attention immediately

What Operating System are you on - Windows, Ubuntu, Mac, ...

  • Windows

Describe the bug - A clear and concise description of what the bug is.

To Reproduce - Describe the steps needed to reproduce the bug.

  • Every time I try to enter my account information

Expected behavior A clear and concise description of what you expected to happen.

  • Bring up the typical menu

Screenshots - If applicable, add screenshots to help explain your problem.

2e7346ef9abf7a619eb6054137643951

NatureType can't choose

What Operating System are you on - Windows, Ubuntu, Mac, ...

  • windows

Describe the bug - A clear and concise description of what the bug is.

  • MENU 4 Unlock all starters has not choose NatureType

Feature: Requested ability to set all forms on pokemon's

_MAX_BIG_INT = (2 ** 53) - 1
def unlock_all_starters(self):
    try:
        total_caught = 0
        total_seen = 0
        data = self.get_trainer_data()

        for entry in list(data["dexData"]):

            caught = random.randint(150, 250)
            seen = random.randint(150, 350)
            total_caught += caught
            total_seen += seen

            data["dexData"][entry] = {
                "seenAttr": 479,
                "caughtAttr": self._MAX_BIG_INT,
                "natureAttr": 67108862,
                "seenCount": seen,
                "caughtCount": caught,
                "hatchedCount": 0,
                "ivs": [31, 31, 31, 31, 31, 31],
            }

            data["starterData"][entry] = {
                "moveset": None,
                "eggMoves": 15,
                "candyCount": caught + 20,
                "abilityAttr": 7,
                "passiveAttr": 0,
                "valueReduction": 2,
            }

            data["starterData"][entry] = {
                "moveset": None,
                "eggMoves": 15,
                "candyCount": caught + 20,
                "friendship": 0,
                "abilityAttr": 7,
                "passiveAttr": 0 if entry in self.NO_PASSIVE else 3,
                "valueReduction": 2,
                "classicWinCount": 0,
            }

            data["gameStats"]["battles"] = total_caught + random.randint(
                1, total_caught
            )
            data["gameStats"]["pokemonCaught"] = total_caught
            data["gameStats"]["pokemonSeen"] = total_seen
            data["gameStats"]["shinyPokemonCaught"] = len(list(data["dexData"])) * 2

        self.update_trainer_data(data)
        logger.info("All starter Pokemon has been updated!")

    except Exception as e:
        logger.exception(e)

also solves #18

Question: Attention needed

A clear and concise description of what the question is.

  • ...After completing editing, I try to upload, but an error occurs. I don't know why.
    f

Feature: Requested merge offline with online

See issue #26 aswell

Whenever we launch the tool we want to ask

  1. Online
  2. Offline

if we are Online, we construct data by API and hop in the main routine
if we are offline, we decrypt data from .prsv and hop in the main routine

Main routine should be the same

If we are Online, we sent to UpdateAll
if we are offline we convert to .prsv

Question: Attention needed

idk if this is a dumb question or not as i could just be doing something wrong but every time i put i my credentials it says "Login failed with requests: 500 Server Error: Internal Server Error for url: https://api.pokerogue.net/account/login" I am putting i the write credentials so idk if
this is a issue o my part or not

Triage: Need attention immediately

I broke the function to edit biomes.

I wanted to print the biomes first so the user can better choose.
We should do the same on species-edit and such aswell.

But i messed up :'(

Q: Linux-Cannot execute binary file

What Operating System are you on - Windows, Ubuntu, Mac, ...

  • Linux

Describe the bug - A clear and concise description of what the bug is.

  • I can't run the script, everytime I try, I get: cannot execute binary file
  • I did my research on stack overflow and other forums, but after everything I still get the same error... Maybe there is something beyond but I'm totally clueless

To Reproduce - Describe the steps needed to reproduce the bug.

  • on Linux, after using chmod +x on the script, run it using bash /pathofscript
  • I also reproduced it on termux to be sure that my laptop wasn't the problem
    And I got the same problem

Expected behavior A clear and concise description of what you expected to happen.

  • I expected it to run as described, being able to access the pokerogue online editor prompt

Screenshots - If applicable, add screenshots to help explain your problem.
My laptop is down right now but there is the exact same error reproduced on my phone

Screenshot_20240601-050221

Feature: Request scraping data from source maybe

Issue #48
Duplicate of #19 kinda

We need to do this for




Example part in source code

export const fixedBattles: FixedBattleConfigs = {
  [5]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(scene => new Trainer(scene, TrainerType.YOUNGSTER, Utils.randSeedInt(2) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
  [8]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
  [25]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_2, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
  [55]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_3, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
  [95]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_4, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
  [145]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_5, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
  [182]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.LORELEI, TrainerType.WILL, TrainerType.SIDNEY, TrainerType.AARON, TrainerType.SHAUNTAL, TrainerType.MALVA, [ TrainerType.HALA, TrainerType.MOLAYNE ],TrainerType.MARNIE_ELITE, TrainerType.RIKA, TrainerType.CRISPIN ])),
  [184]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(182)
    .setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.BRUNO, TrainerType.KOGA, TrainerType.PHOEBE, TrainerType.BERTHA, TrainerType.MARSHAL, TrainerType.SIEBOLD, TrainerType.OLIVIA, TrainerType.NESSA_ELITE, TrainerType.POPPY, TrainerType.AMARYS ])),
  [186]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(182)
    .setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.AGATHA, TrainerType.BRUNO, TrainerType.GLACIA, TrainerType.FLINT, TrainerType.GRIMSLEY, TrainerType.WIKSTROM, TrainerType.ACEROLA, [TrainerType.BEA_ELITE,TrainerType.ALLISTER_ELITE], TrainerType.LARRY_ELITE, TrainerType.LACEY ])),
  [188]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(182)
    .setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.LANCE, TrainerType.KAREN, TrainerType.DRAKE, TrainerType.LUCIAN, TrainerType.CAITLIN, TrainerType.DRASNA, TrainerType.KAHILI,TrainerType.RAIHAN_ELITE, TrainerType.HASSEL, TrainerType.DRAYTON ])),
  [190]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(182)
    .setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.BLUE, [ TrainerType.RED, TrainerType.LANCE_CHAMPION ], [ TrainerType.STEVEN, TrainerType.WALLACE ], TrainerType.CYNTHIA, [ TrainerType.ALDER, TrainerType.IRIS ], TrainerType.DIANTHA, TrainerType.HAU,TrainerType.LEON, [ TrainerType.GEETA, TrainerType.NEMONA ], TrainerType.KIERAN])),
  [195]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
    .setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_6, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT))
};

Example Code to Fetch data

import requests
import re

# URL of the raw content
url = "https://raw.githubusercontent.com/pagefaultgames/pokerogue/main/src/data/trainer-config.ts"

# Send a GET request to the URL and get the content
response = requests.get(url)

# Extract the JavaScript code
js_code = response.text

# Extract TrainerType entries using regular expressions
trainer_entries = re.findall(r"\[TrainerType\.(.*?)\]:", js_code)

# Print out the TrainerType entries
for entry in trainer_entries:
    print(entry)

We only need to sanitize data. And do this for all types from data.json

Feature: Development-Relevant add docstrings and typehinting


Docstrings

Docstrings are string literals that appear right after the definition of a function, method, class, or module. They are used to document the purpose, parameters, return values, and other details of the code.

Example:

def add(a, b):
    """
    Add two numbers.

    Parameters:
    a (int): The first number.
    b (int): The second number.

    Returns:
    int: The sum of the two numbers.
    """
    return a + b

Pros

  • Improves Readability: Provides clear explanations of what a function, method, class, or module does.
  • Helps Documentation: Tools like Sphinx can generate documentation from docstrings.
  • Ease of Use: Easy to add and does not require any external tools or libraries.
  • Standardized Format: Encourages consistent documentation practices across a codebase.
  • Integrated in IDEs: Many IDEs and code editors display docstrings as tooltips, aiding in code understanding.

Cons

  • Maintenance Overhead: Docstrings need to be updated whenever the corresponding code changes, which can be a burden.
  • Potential for Inconsistency: If not updated regularly, docstrings can become outdated or incorrect, misleading developers.
  • Can Be Verbose: Long docstrings can make the code look cluttered if not managed properly.

Type Hinting

Pros

  • Improves Readability: Makes it clear what types are expected, enhancing code readability and understanding.
  • Aids in Debugging: Type hints can catch type-related errors early, before runtime, using static type checkers.
  • Better Tooling Support: IDEs and code editors can provide better autocomplete and type checking features.
  • Documentation: Serves as a form of documentation, showing the expected types of parameters and return values.
  • Encourages Good Practices: Promotes more rigorous and disciplined coding practices.

Cons

  • Initial Overhead: Adding type hints to an existing codebase can be time-consuming.
  • Runtime Ignorance: Python itself ignores type hints at runtime; they are only for static analysis.
  • Limited by Python’s Dynamic Nature: Python's dynamic typing means type hints cannot enforce type constraints at runtime.
  • Can Be Verbose: For complex types (e.g., nested data structures), type hints can become verbose and hard to read.

Summary

  • Docstrings are useful for providing detailed explanations and context for your code. They help in understanding the functionality and usage of code elements and can be leveraged for generating documentation.
  • Type Hinting improves code readability and can catch type-related errors early. It makes expected types explicit, aiding developers and tools in understanding and working with the code.

Using both docstrings and type hinting together can greatly enhance the clarity, maintainability, and reliability of your code. Docstrings provide the "why" and "how" while type hints provide the "what", complementing each other to create a well-documented and type-safe codebase.

Triage: Some people experience black screening in the browser due to flagged as bots

Some people experience blackscreening during load up and cannot use the tool.
They are beeing flagged as bots.

Solution:
Generate access headers dynamically.

The code below will generate a header in this style:

{'Accept': 'application/json', 'Accept-Language': 'it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3', 'Accept-Encoding': 'gzip, deflate, br, zstd', 'Referer': 'https://pokerogue.net/', 'Content-Type': 'application/json', 'content-encoding': 'br', 'Origin': 'https://pokerogue.net/', 'Connection': 'keep-alive', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'same-site', 'Priority': 'u=1', 'authorization': 'your_auth_token_here', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Firefox/88.0.4324.150 Safari/537.36'}
['Chrome', 'Firefox', 'Safari', 'Edge', 'Opera', 'Internet Explorer']
{'Windows': ['Windows NT 10.0', 'Windows NT 6.1'], 'Macintosh': ['Macintosh; Intel Mac OS X 10_15_7'], 'X11': ['X11; Linux x86_64'], 'Linux': ['X11; Linux x86_64'], 'Android': ['Android 10', 'Android 9'], 'iPhone': ['iPhone; CPU iPhone OS 14_0 like Mac OS X', 'iPhone; CPU iPhone OS 13_0 like Mac OS X']}
['Windows', 'Macintosh', 'X11', 'Linux', 'Android', 'iPhone']

This code generates partially more than we need.
Please revise and apply the code so we get a usable header. The minima information we need is this.
Ideally the UserAgent is already enough to be changed.

        self.headers = {
            "authorization": self.auth_token,
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0",
            "Accept": "application/json",
            "Accept-Language": "it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3",
            "Accept-Encoding": "gzip, deflate, br, zstd",
            "Referer": "https://pokerogue.net/",
            "Content-Type": "application/json",
            "content-encoding": "br",
            "Origin": "https://pokerogue.net/",
            "Connection": "keep-alive",
            "Sec-Fetch-Dest": "empty",
            "Sec-Fetch-Mode": "cors",
            "Sec-Fetch-Site": "same-site",
            "Priority": "u=1",
        }

import random
from typing import List, Dict

class HeaderGenerator:
    """
    A class to generate randomized but valid HTTP headers with User-Agent strings.
    The class maintains lists of different components used to construct User-Agent strings and headers.
    
    Attributes
    ----------
    browsers : List[str]
        A list of web browsers.
    operating_systems : Dict[str, List[str]]
        A dictionary mapping device types to lists of operating systems.
    devices : List[str]
        A list of device types.
    static_headers : Dict[str, str]
        A dictionary of static HTTP headers.
    """
    
    browsers: List[str] = [
        'Chrome', 'Firefox', 'Safari', 'Edge', 'Opera', 'Internet Explorer'
    ]
    
    operating_systems: Dict[str, List[str]] = {
        'Windows': ['Windows NT 10.0', 'Windows NT 6.1'],
        'Macintosh': ['Macintosh; Intel Mac OS X 10_15_7'],
        'X11': ['X11; Linux x86_64'],
        'Linux': ['X11; Linux x86_64'],
        'Android': ['Android 10', 'Android 9'],
        'iPhone': ['iPhone; CPU iPhone OS 14_0 like Mac OS X', 'iPhone; CPU iPhone OS 13_0 like Mac OS X']
    }
    
    devices: List[str] = list(operating_systems.keys())
    
    static_headers: Dict[str, str] = {
        "Accept": "application/json",
        "Accept-Language": "it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3",
        "Accept-Encoding": "gzip, deflate, br, zstd",
        "Referer": "https://pokerogue.net/",
        "Content-Type": "application/json",
        "content-encoding": "br",
        "Origin": "https://pokerogue.net/",
        "Connection": "keep-alive",
        "Sec-Fetch-Dest": "empty",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Site": "same-site",
        "Priority": "u=1",
    }
    
    @classmethod
    def generate_user_agent(cls, device: str, os: str, browser: str) -> str:
        """
        Generate a User-Agent string based on given device, operating system, and browser.

        Parameters
        ----------
        device : str
            The type of device.
        os : str
            The operating system.
        browser : str
            The web browser.

        Returns
        -------
        str
            A User-Agent string constructed from the given parameters.
        """
        return f"Mozilla/5.0 ({os}) AppleWebKit/537.36 (KHTML, like Gecko) {browser}/88.0.4324.150 Safari/537.36"

    @classmethod
    def generate_headers(cls, auth_token: str) -> Dict[str, str]:
        """
        Generate randomized but valid HTTP headers including a User-Agent string.

        Parameters
        ----------
        auth_token : str
            The authorization token to be included in the headers.

        Returns
        -------
        Dict[str, str]
            A dictionary containing HTTP headers.
        """
        device: str = random.choice(cls.devices)
        os: str = random.choice(cls.operating_systems[device])
        browser: str = random.choice(cls.browsers)
        user_agent: str = cls.generate_user_agent(device, os, browser)
        
        headers: Dict[str, str] = cls.static_headers.copy()
        headers.update({
            "authorization": auth_token,
            "User-Agent": user_agent,
        })
        
        return headers

    @classmethod
    def get_browsers(cls) -> List[str]:
        """
        Get the list of browsers.

        Returns
        -------
        List[str]
            A list of browser names.
        """
        return cls.browsers

    @classmethod
    def get_operating_systems(cls) -> Dict[str, List[str]]:
        """
        Get the dictionary of operating systems.

        Returns
        -------
        Dict[str, List[str]]
            A dictionary of device types to operating system lists.
        """
        return cls.operating_systems

    @classmethod
    def get_devices(cls) -> List[str]:
        """
        Get the list of devices.

        Returns
        -------
        List[str]
            A list of device types.
        """
        return cls.devices


if __name__ == "__main__":
    # Generate fake HTTP headers with an authorization token
    auth_token = "your_auth_token_here"
    headers = HeaderGenerator.generate_headers(auth_token)
    print(headers)

    # Get the list of browsers
    browsers = HeaderGenerator.get_browsers()
    print(browsers)

    # Get the dictionary of operating systems
    operating_systems = HeaderGenerator.get_operating_systems()
    print(operating_systems)

    # Get the list of devices
    devices = HeaderGenerator.get_devices()
    print(devices)

v0.1.8-testbuild4 Bug

I know that this is due to a testing phase but just in case I put it here, I downloaded build 4 of 1.8 and when it opened it automatically closed I had to run it in the Windows console and I got these lines of code from the program
pokerogue error3
pokerogue error4

Login Failed in Edit Program

A clear and concise description of what the question is.
Hi, I'm really enjoying the program you made. Thank you
But I can't login to the program at the moment, so I'm going to ask you a question
I don't know why it was rejected after using it well

I modified the starter
When I changed Pokemon to shiny, it was Luck 3 but the color of Luck 3 didn't come out
I changed it to Luck 1 and sent the data to pokerogue.net sever
After that, I tried to check if it went well, but I got an error if I sent the data in the lobby of the new game, and I don't think I saved the data, so I tried to try again later, but the program couldn't login

If you look at the log

[Login failed. 403 Client Error: Forbidden for url: https://api.pokerogue.net/account/login
Wrong credentials.]

That's what it says

I login well on pokerogue.net and I have no problem playing games, but I only want to edit the Pokemon I want

Ps. Even if you try to create a new account, your program does not login the same way
Is it an IP problem?

Ps2. For your information, I am not a native of English-speaking culture, but I asked the question through the translator, so I hope you understand even if the sentence is weird

Additional contents
0.1.4V can be login, but data cannot be send data on the server (No. 26)
writing at 19:30PM Korean time
(UTC+9:00)

Feature: Requested feature for more constraints on edit_stats

Add more constraints to stats

Example

grafik

  • Ribbons owned, just set to 1 so its 1082 total

  • Classic Wins set to 1082 / 5 = 216

  • Daily Run wins randint between 50 and 150

  • Highest Wave Endless randint between 300 and 1000

  • Highest Damage randint between 10000 and 12000 (theres an achievement with 10k dmg)

  • Pokemon encountered randint between 50000 and 150000

  • Total battles randint between 20000 and 80000

  • Clasic Runs make ClassicWins * 4 so 216*4 = 1024

  • Daily Run Attempts: randint between 1000 and 2000

  • Endless Runs randint between 500 and 1000

  • Highest Money randint between 3000000 and 80000000

  • Highest HP Healed 10000 and 150000

  • Pokemon defeated randint between 70000 and 100000

Bug: Need attention

What Operating System are you on - Windows, Ubuntu, Mac, ...
Windows
Describe the bug - A clear and concise description of what the bug is.
On version 0.1.2, an attempt to edit starters on the first save slot made the save unusable. The save cannot be overwritten, it cannot be manually opened, and pressing "continue" on the main screen gives the error "Your session data could not be loaded. It may be corrupted."
To Reproduce - Describe the steps needed to reproduce the bug.
Opening the first save slot (which had data at the time), and editing one of my starters (Nacli) produced the issue. The change to the starter was successful.
Expected behavior A clear and concise description of what you expected to happen.
Expected behavior was the change in the starter without making the save unusable.
Screenshots - If applicable, add screenshots to help explain your problem.
Screenshot 2024-06-06 113436
Screenshot 2024-06-06 113515

Ideally, if there is a way to remove the save from the slot so I am not stuck with a corrupted save that would be appreciated. Not too worried about recovering the save itself. Thank you!

Nature doesn't unlock issue

What Operating System are you on - Windows, Ubuntu, Mac, ...

  • Windows

Describe the bug - A clear and concise description of what the bug is.

  • When I use 3 or 4 to unlock starter, it doesn't work unlock nature.

image

All pokemon's nature fixed with Hardy

Please check for this, and thanks for your effort! :)

Triage: Need attention immediately!!!!

Rewrite data handling to remove any association with previous owners despite .json parsing is no derivative work anyway but to be sure.

  • Merge offline with online #28 - pending
  • Rewrite the .prsv converter to python, #26 - in progress
  • add docstrings, typehinting, cleanup codebase #27 - done
  • rewrite header logic due to issues #33 - partially done
  • rewrite some stuff to generator logic from source
    • game data such as
      • nature IDs #19 - raw
      • or for example trainer data #47 - raw

Research: Requested ability to edit unavaible species

Feature: Requested enhance of backup

We should revise our backup function.
We should create more backups, were as

/editor/backup/clone/backup_save.json -> create only once ever, when starting the tool first time
/editor/backup/backup_save.json
/editor/backup/backup_slot().json

When someone requests backup and does not have a valid backup, we can construct from clone.

This to prevent maybe arising issues because of the online/offline merge and the prsv_parser.py and a little more security overhead.

Question: Attention needed

A clear and concise description of what the question is.

  • I tried logging into the editor but it wouldn't let me. It keeps saying login failed. 403 Client error: forbidden for url : https://api.pokerogue.net/account/login . I tried 3 different accounts to see if it worked and nothing. Do you know how I could fix this by chance?

Feature: Generate Nature IDs, we just need a source which can be dict and code cleanup - IDGenerator alredy finished

https://github.com/pagefaultgames/pokerogue/blob/main/src%2Fdata%2Fnature.ts
https://github.com/pagefaultgames/pokerogue/blob/main/src%2Fsystem%2Fgame-data.ts

Functions to reconstruct the ID

Formula to reconstruct ID

print([
    2 ** (n + 1)
    for n in range(25)
])

Generator

# Authors: RogueEdit Organization https://github.com/RogueEdit/
from typing import Dict, Optional, List
from enum import Enum, auto

class Nature(Enum):
    HARDY = auto()
    LONELY = auto()
    BRAVE = auto()
    ADAMANT = auto()
    NAUGHTY = auto()
    BOLD = auto()
    DOCILE = auto()
    RELAXED = auto()
    IMPISH = auto()
    LAX = auto()
    TIMID = auto()
    HASTY = auto()
    SERIOUS = auto()
    JOLLY = auto()
    NAIVE = auto()
    MODEST = auto()
    MILD = auto()
    QUIET = auto()
    BASHFUL = auto()
    RASH = auto()
    CALM = auto()
    GENTLE = auto()
    SASSY = auto()
    CAREFUL = auto()
    QUIRKY = auto()
    UNLOCK_ALL = auto()  # New member for "Unlock All"

class NatureIDGenerator:
    """
    A class for generating nature names and IDs, and retrieving the ID for the 'unlock_all' nature.
    """

    def __init__(self, nature_names: Optional[List[str]] = None) -> None:
        """
        Initialize the NatureIDGenerator object.

        Args:
            nature_names (Optional[List[str]]): Optional list of nature names as strings. If provided, it will be used to initialize
            self.nature_names. If not provided, all names from the Nature enum will be used.
        """
        if nature_names is not None:
            self.nature_names: List[str] = nature_names
        else:
            self.nature_names: List[str] = [nature.name for nature in Nature if nature != Nature.UNLOCK_ALL]
        self.nature_ids: List[int] = [2 ** i for i in range(1, len(self.nature_names) + 1)]
        self.max_id: int = 2  # Start with ID 2

    def generate_nature_id_dict(self) -> Dict[str, int]:
        """
        Generate nature names and IDs and return them as a dictionary.

        Returns:
            Dict[str, int]: A dictionary containing nature names as keys and their corresponding IDs as values.
        """
        nature_dict: Dict[str, int] = {}
        for nature_name, nature_id in zip(self.nature_names, self.nature_ids):
            nature_dict[nature_name] = nature_id

        # Add 'unlock_all' nature to the dictionary
        nature_dict['Unlock all Natures'] = self.nature_ids[-1] * 2

        return nature_dict

    def generate_enum_id_dict(self) -> Dict[Nature, int]:
        """
        Generate nature IDs and return them as a dictionary with Nature enum members as keys.

        Returns:
            Dict[Nature, int]: A dictionary containing Nature enum members as keys and their corresponding IDs as values.
        """
        enum_id_dict: Dict[Nature, int] = {}
        for nature, nature_id in zip(Nature, self.nature_ids + [self.nature_ids[-1] * 2]):
            enum_id_dict[nature] = nature_id

        return enum_id_dict

    def get_unlock_all_nature_ids(self) -> Optional[int]:
        """
        Get the ID for the 'unlock_all' nature.

        Returns:
            Optional[int]: The ID for the 'unlock_all' nature, or None if not found.
        """
        enum_id_dict = self.generate_enum_id_dict()
        return enum_id_dict.get(Nature.UNLOCK_ALL, None)

#custom_names = ["ADAMANT", "TEST"]
#generator = NatureIDGenerator(custom_names)

# Example usage without custom list of nature names
generator = NatureIDGenerator()

# Generate full list of nature names and IDs as a dictionary
nature_dict = generator.generate_nature_id_dict()
print(nature_dict)

# Generate a dictionary with Nature enum members and their corresponding IDs
enum_id_dict = generator.generate_enum_id_dict()
print("\nEnum to ID dictionary:")
for nature, nature_id in enum_id_dict.items():
    print(f"{nature}: {nature_id}")

# Get value for 'unlock_all' nature
unlock_all_value = generator.get_unlock_all_nature_ids()
print("\nValue for 'unlock_all' nature:", unlock_all_value)

Output:

Enum to ID dictionary:
Nature.HARDY: 2
Nature.LONELY: 4
Nature.BRAVE: 8
Nature.ADAMANT: 16
Nature.NAUGHTY: 32
Nature.BOLD: 64
Nature.DOCILE: 128
Nature.RELAXED: 256
Nature.IMPISH: 512
Nature.LAX: 1024
Nature.TIMID: 2048
Nature.HASTY: 4096
Nature.SERIOUS: 8192
Nature.JOLLY: 16384
Nature.NAIVE: 32768
Nature.MODEST: 65536
Nature.MILD: 131072
Nature.QUIET: 262144
Nature.BASHFUL: 524288
Nature.RASH: 1048576
Nature.CALM: 2097152
Nature.GENTLE: 4194304
Nature.SASSY: 8388608
Nature.CAREFUL: 16777216
Nature.QUIRKY: 33554432
Nature.UNLOCK_ALL: 67108864

Value for 'unlock_all' nature: 67108864

Nature Enum: Defines various natures and includes the special member UNLOCK_ALL.

NatureIDGenerator Class:

  • Initialization: Generates nature IDs and assigns them to the Nature enum members.
  • assign_ids_to_enum Method: Updates each Nature enum member with its calculated ID.
  • generate_nature_id_dict Method: Creates a dictionary of nature names and their IDs.
  • generate_enum_id_dict Method: Creates a dictionary of Nature enum members and their IDs.
  • get_unlock_all_nature_ids Method: Retrieves the ID for Nature.UNLOCK_ALL.

Usage:

  • Instantiates the NatureIDGenerator.
  • Generates and prints the nature ID dictionary.
  • Generates and prints the enum ID dictionary.
  • Retrieves and prints the ID for Nature.UNLOCK_ALL.
  • Verifies that the IDs are assigned to the Nature enum members.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.