Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Request scraping data from source maybe #47

Closed
JulianStiebler opened this issue Jun 1, 2024 · 1 comment
Closed

Feature: Request scraping data from source maybe #47

JulianStiebler opened this issue Jun 1, 2024 · 1 comment
Assignees
Labels
feature Feature

Comments

@JulianStiebler
Copy link
Collaborator

JulianStiebler commented Jun 1, 2024

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

@JulianStiebler
Copy link
Collaborator Author

JulianStiebler commented Jun 1, 2024

Example Output

UNKNOWN
ACE_TRAINER
ARTIST
BACKERS
BACKPACKER
BAKER
BEAUTY
BIKER
BLACK_BELT
BREEDER
CLERK
CYCLIST
DANCER
DEPOT_AGENT
DOCTOR
FIREBREATHER
FISHERMAN
GUITARIST
HARLEQUIN
HIKER
HOOLIGANS
HOOPSTER
INFIELDER
JANITOR
LINEBACKER
MAID
MUSICIAN
HEX_MANIAC
NURSERY_AIDE
OFFICER
PARASOL_LADY
PILOT
POKEFAN
PRESCHOOLER
PSYCHIC
RANGER
RICH
RICH_KID
ROUGHNECK
SCIENTIST
SMASHER
SNOW_WORKER
STRIKER
SCHOOL_KID
SWIMMER
TWINS
VETERAN
WAITER
WORKER
YOUNGSTER
BROCK
MISTY
LT_SURGE
ERIKA
JANINE
SABRINA
BLAINE
GIOVANNI
FALKNER
BUGSY
WHITNEY
MORTY
CHUCK
JASMINE
PRYCE
CLAIR
ROXANNE
BRAWLY
WATTSON
FLANNERY
NORMAN
WINONA
TATE
LIZA
JUAN
ROARK
GARDENIA
MAYLENE
CRASHER_WAKE
FANTINA
BYRON
CANDICE
VOLKNER
CILAN
CHILI
CRESS
CHEREN
LENORA
ROXIE
BURGH
ELESA
CLAY
SKYLA
BRYCEN
DRAYDEN
MARLON
VIOLA
GRANT
KORRINA
RAMOS
CLEMONT
VALERIE
OLYMPIA
WULFRIC
MILO
NESSA
KABU
BEA
ALLISTER
OPAL
BEDE
GORDIE
MELONY
PIERS
MARNIE
RAIHAN
KATY
BRASSIUS
IONO
KOFU
LARRY
RYME
TULIP
GRUSHA
LORELEI
BRUNO
AGATHA
LANCE
WILL
KOGA
KAREN
SIDNEY
PHOEBE
GLACIA
DRAKE
AARON
BERTHA
FLINT
LUCIAN
SHAUNTAL
MARSHAL
GRIMSLEY
CAITLIN
MALVA
SIEBOLD
WIKSTROM
DRASNA
HALA
MOLAYNE
OLIVIA
ACEROLA
KAHILI
MARNIE_ELITE
NESSA_ELITE
BEA_ELITE
ALLISTER_ELITE
RAIHAN_ELITE
RIKA
POPPY
LARRY_ELITE
HASSEL
CRISPIN
AMARYS
LACEY
DRAYTON
BLUE
RED
LANCE_CHAMPION
STEVEN
WALLACE
CYNTHIA
ALDER
IRIS
DIANTHA
HAU
LEON
GEETA
NEMONA
KIERAN
RIVAL
RIVAL_2
RIVAL_3
RIVAL_4
RIVAL_5
RIVAL_6

@JulianStiebler JulianStiebler pinned this issue Jun 1, 2024
@JulianStiebler JulianStiebler unpinned this issue Jun 1, 2024
@RogueEdit RogueEdit locked and limited conversation to collaborators Jun 2, 2024
@JulianStiebler JulianStiebler converted this issue into a discussion Jun 2, 2024
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature
Projects
Status: Done
Development

No branches or pull requests

3 participants