From bd839a1ffb64361ff1da12f98016b0c7c01b3ab2 Mon Sep 17 00:00:00 2001 From: Benjamin Odom Date: Tue, 7 May 2024 13:42:07 -0500 Subject: [PATCH 1/2] FIx Sceptile and Blaziken Learnsets (#606) These got missed in the transition from looking at Serebii and Bulbapedia for data. --- src/data/pokemon-level-moves.ts | 36 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/data/pokemon-level-moves.ts b/src/data/pokemon-level-moves.ts index 79530d98546..2823170b13d 100644 --- a/src/data/pokemon-level-moves.ts +++ b/src/data/pokemon-level-moves.ts @@ -4305,12 +4305,12 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [Species.GROVYLE]: [ [ 1, Moves.POUND ], [ 1, Moves.LEER ], + [ 1, Moves.LEAFAGE ], [ 1, Moves.QUICK_ATTACK ], [ 1, Moves.FALSE_SWIPE ], [ 1, Moves.FURY_CUTTER ], [ 1, Moves.X_SCISSOR ], - [ 1, Moves.ENERGY_BALL ], - [ 1, Moves.LEAFAGE ], + [ 1, Moves.ENERGY_BALL ], [ 9, Moves.MEGA_DRAIN ], [ 12, Moves.DETECT ], [ 15, Moves.QUICK_GUARD ], @@ -4324,15 +4324,16 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 55, Moves.LEAF_STORM ], ], [Species.SCEPTILE]: [ - [ 0, Moves.DUAL_CHOP ], + [ 0, Moves.LEAF_BLADE ], [ 1, Moves.POUND ], [ 1, Moves.LEER ], + [ 1, Moves.LEAFAGE ], [ 1, Moves.QUICK_ATTACK ], [ 1, Moves.FALSE_SWIPE ], [ 1, Moves.FURY_CUTTER ], [ 1, Moves.X_SCISSOR ], - [ 1, Moves.ENERGY_BALL ], - [ 1, Moves.LEAFAGE ], + [ 1, Moves.ENERGY_BALL ], + [ 1, Moves.SHED_TAIL ], [ 5, Moves.MEGA_DRAIN ], [ 12, Moves.DETECT ], [ 15, Moves.QUICK_GUARD ], @@ -4340,10 +4341,9 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 25, Moves.GIGA_DRAIN ], [ 30, Moves.SLAM ], [ 35, Moves.DOUBLE_TEAM ], - [ 42, Moves.LEAF_BLADE ], - [ 49, Moves.SCREECH ], - [ 56, Moves.ENDEAVOR ], - [ 63, Moves.LEAF_STORM ], + [ 42, Moves.SCREECH ], + [ 49, Moves.ENDEAVOR ], + [ 56, Moves.LEAF_STORM ], ], [Species.TORCHIC]: [ [ 1, Moves.SCRATCH ], @@ -4367,9 +4367,9 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 1, Moves.SCRATCH ], [ 1, Moves.GROWL ], [ 1, Moves.EMBER ], + [ 1, Moves.QUICK_ATTACK ], [ 1, Moves.FLAMETHROWER ], - [ 1, Moves.QUICK_ATTACK ], - [ 1, Moves.FEATHER_DANCE ], + [ 1, Moves.FEATHER_DANCE ], [ 9, Moves.FLAME_CHARGE ], [ 12, Moves.DETECT ], [ 15, Moves.SAND_ATTACK ], @@ -4399,10 +4399,10 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 25, Moves.SLASH ], [ 30, Moves.BOUNCE ], [ 35, Moves.FOCUS_ENERGY ], - [ 42, Moves.BLAZE_KICK ], - [ 49, Moves.BULK_UP ], - [ 56, Moves.REVERSAL ], - [ 63, Moves.FLARE_BLITZ ], + [ 42, Moves.BULK_UP ], + [ 49, Moves.REVERSAL ], + [ 56, Moves.FLARE_BLITZ ], + [ 63, Moves.BRAVE_BIRD ], ], [Species.MUDKIP]: [ [ 1, Moves.TACKLE ], @@ -4426,8 +4426,6 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 1, Moves.TACKLE ], [ 1, Moves.GROWL ], [ 1, Moves.WATER_GUN ], - [ 1, Moves.SURF ], - [ 1, Moves.EARTHQUAKE ], [ 1, Moves.ROCK_SMASH ], [ 9, Moves.ROCK_THROW ], [ 12, Moves.PROTECT ], @@ -4442,13 +4440,13 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = { [ 55, Moves.HYDRO_PUMP ], ], [Species.SWAMPERT]: [ + [ 1, Moves.MUD_SHOT ], [ 1, Moves.TACKLE ], [ 1, Moves.GROWL ], [ 1, Moves.WATER_GUN ], [ 1, Moves.SURF ], [ 1, Moves.EARTHQUAKE ], - [ 1, Moves.ROCK_SMASH ], - [ 1, Moves.MUD_SHOT ], + [ 1, Moves.ROCK_SMASH ], [ 1, Moves.HAMMER_ARM ], [ 9, Moves.ROCK_THROW ], [ 12, Moves.PROTECT ], From 08067d993747cf14da03fe3b4ca537397bfd4e6b Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 7 May 2024 16:16:22 -0400 Subject: [PATCH 2/2] Revert "Revert API URL change" This reverts commit 4ef670733320ba23e1fa44e7abe28515a17f5f35. --- src/utils.ts | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 822f02f053e..ef277630dc4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -222,7 +222,8 @@ export function executeIf(condition: boolean, promiseFunc: () => Promise): export const sessionIdKey = 'pokerogue_sessionId'; export const isLocal = window.location.hostname === 'localhost'; export const serverUrl = isLocal ? 'http://localhost:8001' : ''; -export const apiUrl = isLocal ? serverUrl : 'api'; +export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net'; +export const fallbackApiUrl = isLocal ? serverUrl : 'api'; export function setCookie(cName: string, cValue: string): void { const expiration = new Date(); @@ -243,7 +244,7 @@ export function getCookie(cName: string): string { return ''; } -export function apiFetch(path: string, authed: boolean = false): Promise { +export function apiFetch(path: string, authed: boolean = false, fallback: boolean = false): Promise { return new Promise((resolve, reject) => { const request = {}; if (authed) { @@ -251,13 +252,22 @@ export function apiFetch(path: string, authed: boolean = false): Promise resolve(response)) - .catch(err => reject(err)); + fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, request) + .then(response => { + if (!response.ok && response.status === 404 && !fallback) + return apiFetch(path, authed, true).then(res => resolve(res)); + resolve(response); + }) + .catch(err => { + if (fallback) + reject(err); + else + apiFetch(path, authed, true).then(res => resolve(res)); + }); }); } -export function apiPost(path: string, data?: any, contentType: string = 'application/json', authed: boolean = false): Promise { +export function apiPost(path: string, data?: any, contentType: string = 'application/json', authed: boolean = false, fallback: boolean = false): Promise { return new Promise((resolve, reject) => { const headers = { 'Accept': contentType, @@ -268,9 +278,14 @@ export function apiPost(path: string, data?: any, contentType: string = 'applica if (sId) headers['Authorization'] = sId; } - fetch(`${apiUrl}/${path}`, { method: 'POST', headers: headers, body: data }) + fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, { method: 'POST', headers: headers, body: data }) .then(response => resolve(response)) - .catch(err => reject(err)); + .catch(err => { + if (fallback) + reject(err); + else + apiPost(path, data, contentType, authed, true).then(res => resolve(res)); + }); }); }