diff --git a/README.md b/README.md index 424d47ff1b0..b2955f8c4b5 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,11 @@ PokéRogue is a browser based Pokémon fangame heavily inspired by the roguelite If you have the motivation and experience with Typescript/Javascript (or are willing to learn) please feel free to fork the repository and make pull requests with contributions. If you don't know what to work on but want to help, reference the below **To-Do** section or the **#vote** channel in the discord. ### 💻 Environment Setup -node: 18.3.0 +#### Prerequisites +- node: 18.3.0 +- npm: [how to install](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) +#### Running Locally 1. Clone the repo and in the root directory run `npm install` - *if you run into any errors, reach out in the **#dev-corner** channel in discord* 2. Run `npm run start:dev` to locally run the project in `localhost:8000` diff --git a/public/images/pokemon/1024-stellar.json b/public/images/pokemon/1024-stellar.json index 3f8ffe6c4ca..0972c56328f 100644 --- a/public/images/pokemon/1024-stellar.json +++ b/public/images/pokemon/1024-stellar.json @@ -4,30 +4,30 @@ "image": "1024-stellar.png", "format": "RGBA8888", "size": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, - "scale": 0.5, + "scale": 1, "frames": [ { "filename": "0001.png", "rotated": false, "trimmed": false, "sourceSize": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, "spriteSourceSize": { - "x": 9, + "x": 0, "y": 0, - "w": 78, - "h": 96 + "w": 115, + "h": 119 }, "frame": { "x": 0, "y": 0, - "w": 78, - "h": 96 + "w": 115, + "h": 119 } } ] @@ -36,6 +36,6 @@ "meta": { "app": "https://www.codeandweb.com/texturepacker", "version": "3.0", - "smartupdate": "$TexturePacker:SmartUpdate:c9ee64bda72f2dadb06109338796ccac:1313f1218b7da2c57ad9f290d1323840:c1508f3b01ae78a28a1267fd6caa4f7b$" + "smartupdate": "$TexturePacker:SmartUpdate:bc663acf2e62803fce6c3a525dc8dd98:ccd7d0de8a487235cfbd6f372afa931f:c1508f3b01ae78a28a1267fd6caa4f7b$" } } diff --git a/public/images/pokemon/1024-stellar.png b/public/images/pokemon/1024-stellar.png index 6500eddec8e..7e40fb0043f 100644 Binary files a/public/images/pokemon/1024-stellar.png and b/public/images/pokemon/1024-stellar.png differ diff --git a/public/images/pokemon/back/1024-stellar.json b/public/images/pokemon/back/1024-stellar.json index f80edd88606..ce84b0d4502 100644 --- a/public/images/pokemon/back/1024-stellar.json +++ b/public/images/pokemon/back/1024-stellar.json @@ -4,30 +4,30 @@ "image": "1024-stellar.png", "format": "RGBA8888", "size": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, - "scale": 0.333, + "scale": 1, "frames": [ { "filename": "0001.png", "rotated": false, "trimmed": false, "sourceSize": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, "spriteSourceSize": { - "x": 5, + "x": 0, "y": 0, - "w": 86, - "h": 96 + "w": 115, + "h": 119 }, "frame": { "x": 0, "y": 0, - "w": 86, - "h": 96 + "w": 115, + "h": 119 } } ] @@ -36,6 +36,6 @@ "meta": { "app": "https://www.codeandweb.com/texturepacker", "version": "3.0", - "smartupdate": "$TexturePacker:SmartUpdate:ac5e775f77477eeabd029932804747c4:f7a112a87c35dc81cb0da88b7cbb39e8:c1508f3b01ae78a28a1267fd6caa4f7b$" + "smartupdate": "$TexturePacker:SmartUpdate:210ba1c2e6e58501571ae226d073a3c5:f12bdf191842f7ec3a4be98a43fb8121:c1508f3b01ae78a28a1267fd6caa4f7b$" } } diff --git a/public/images/pokemon/back/1024-stellar.png b/public/images/pokemon/back/1024-stellar.png index 7940444f580..0bb2993d857 100644 Binary files a/public/images/pokemon/back/1024-stellar.png and b/public/images/pokemon/back/1024-stellar.png differ diff --git a/public/images/pokemon/back/shiny/1024-stellar.json b/public/images/pokemon/back/shiny/1024-stellar.json index eeabac109a3..ce84b0d4502 100644 --- a/public/images/pokemon/back/shiny/1024-stellar.json +++ b/public/images/pokemon/back/shiny/1024-stellar.json @@ -4,30 +4,30 @@ "image": "1024-stellar.png", "format": "RGBA8888", "size": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, - "scale": 0.333, + "scale": 1, "frames": [ { "filename": "0001.png", "rotated": false, "trimmed": false, "sourceSize": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, "spriteSourceSize": { - "x": 5, + "x": 0, "y": 0, - "w": 86, - "h": 96 + "w": 115, + "h": 119 }, "frame": { "x": 0, "y": 0, - "w": 86, - "h": 96 + "w": 115, + "h": 119 } } ] @@ -36,6 +36,6 @@ "meta": { "app": "https://www.codeandweb.com/texturepacker", "version": "3.0", - "smartupdate": "$TexturePacker:SmartUpdate:2bd25bae0fabcfbc35e24bd578a7b4b5:aec60788a0d77f38fb599d721e41a0d6:c1508f3b01ae78a28a1267fd6caa4f7b$" + "smartupdate": "$TexturePacker:SmartUpdate:210ba1c2e6e58501571ae226d073a3c5:f12bdf191842f7ec3a4be98a43fb8121:c1508f3b01ae78a28a1267fd6caa4f7b$" } } diff --git a/public/images/pokemon/back/shiny/1024-stellar.png b/public/images/pokemon/back/shiny/1024-stellar.png index 6b9e35174ee..0bb2993d857 100644 Binary files a/public/images/pokemon/back/shiny/1024-stellar.png and b/public/images/pokemon/back/shiny/1024-stellar.png differ diff --git a/public/images/pokemon/shiny/1024-stellar.json b/public/images/pokemon/shiny/1024-stellar.json index dd07eb812f2..ba751e2bc5c 100644 --- a/public/images/pokemon/shiny/1024-stellar.json +++ b/public/images/pokemon/shiny/1024-stellar.json @@ -4,30 +4,30 @@ "image": "1024-stellar.png", "format": "RGBA8888", "size": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, - "scale": 0.5, + "scale": 1, "frames": [ { "filename": "0001.png", "rotated": false, "trimmed": false, "sourceSize": { - "w": 96, - "h": 96 + "w": 119, + "h": 119 }, "spriteSourceSize": { - "x": 9, + "x": 0, "y": 0, - "w": 78, - "h": 96 + "w": 115, + "h": 119 }, "frame": { "x": 0, "y": 0, - "w": 78, - "h": 96 + "w": 115, + "h": 119 } } ] @@ -36,6 +36,6 @@ "meta": { "app": "https://www.codeandweb.com/texturepacker", "version": "3.0", - "smartupdate": "$TexturePacker:SmartUpdate:a7e89af07a22475413df24b510c193f7:45261af90c4a51e3dc73cccb894a2aad:c1508f3b01ae78a28a1267fd6caa4f7b$" + "smartupdate": "$TexturePacker:SmartUpdate:3510deaf42eaa3ee2fdfa22c00a2b30b:3beb6b12ca1bb50ad260593b41939f27:c1508f3b01ae78a28a1267fd6caa4f7b$" } } diff --git a/public/images/pokemon/shiny/1024-stellar.png b/public/images/pokemon/shiny/1024-stellar.png index 42ed145d937..b00b395ec56 100644 Binary files a/public/images/pokemon/shiny/1024-stellar.png and b/public/images/pokemon/shiny/1024-stellar.png differ diff --git a/src/phases.ts b/src/phases.ts index ccb83cc2976..31f631bf4a6 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -794,7 +794,8 @@ export class EncounterPhase extends BattlePhase { pokemon.resetBattleData(); } - this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena), false); + if (!this.loaded) + this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena), false); const enemyField = this.scene.getEnemyField(); this.scene.tweens.add({ @@ -3419,6 +3420,8 @@ export class GameOverPhase extends BattlePhase { handleClearSession(): void { this.scene.gameData.tryClearSession(this.scene, this.scene.sessionSlotId).then((success: boolean | [boolean, boolean]) => { + if (!success[0]) + return this.scene.reset(true); this.scene.time.delayedCall(1000, () => { let firstClear = false; if (this.victory && success[1]) { @@ -4326,7 +4329,7 @@ export class EggLapsePhase extends Phase { const eggsToHatch: Egg[] = this.scene.gameData.eggs.filter((egg: Egg) => { return --egg.hatchWaves < 1 - }) + }); if (eggsToHatch.length) { this.scene.queueMessage('Oh?'); diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 491042777b7..c5b9f32cf9c 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -1,7 +1,7 @@ import BattleScene, { PokeballCounts, bypassLogin } from "../battle-scene"; import Pokemon, { EnemyPokemon, PlayerPokemon } from "../field/pokemon"; import { pokemonEvolutions, pokemonPrevolutions } from "../data/pokemon-evolutions"; -import PokemonSpecies, { SpeciesFormKey, allSpecies, getPokemonSpecies, noStarterFormKeys, speciesStarters } from "../data/pokemon-species"; +import PokemonSpecies, { allSpecies, getPokemonSpecies, noStarterFormKeys, speciesStarters } from "../data/pokemon-species"; import { Species, defaultStarterSpecies } from "../data/enums/species"; import * as Utils from "../utils"; import PokemonData from "./pokemon-data"; @@ -27,7 +27,7 @@ import { Moves } from "../data/enums/moves"; import { speciesEggMoves } from "../data/egg-moves"; import { allMoves } from "../data/move"; import { TrainerVariant } from "../field/trainer"; -import { OutdatedPhase, ReloadSessionPhase, UnavailablePhase } from "#app/phases"; +import { OutdatedPhase, ReloadSessionPhase } from "#app/phases"; import { Variant, variantData } from "#app/data/variant"; const saveKey = 'x0i2O7WRiANTqPmZ'; // Temporary; secure encryption is not yet necessary @@ -722,9 +722,19 @@ export class GameData { Utils.apiFetch(`savedata/delete?datatype=${GameDataType.SESSION}&slot=${slotId}`, true).then(response => { if (response.ok) { loggedInUser.lastSessionSlot = -1; - return resolve(true); + resolve(true); } - resolve(false); + return response.text(); + }).then(error => { + if (error) { + if (error.startsWith('session out of date')) { + this.scene.clearPhaseQueue(); + this.scene.unshiftPhase(new ReloadSessionPhase(this.scene)); + } + console.error(error); + resolve(false); + } + resolve(true); }); }); }); @@ -742,12 +752,19 @@ export class GameData { return resolve([false, false]); const sessionData = this.getSessionSaveData(scene); Utils.apiPost(`savedata/clear?slot=${slotId}`, JSON.stringify(sessionData)).then(response => { - if (response.ok) { + if (response.ok) loggedInUser.lastSessionSlot = -1; - return response.json(); + return response.json(); + }).then(jsonResponse => { + if (!jsonResponse.error) + return resolve([true, jsonResponse.success as boolean]); + if (jsonResponse && jsonResponse.error.startsWith('session out of date')) { + this.scene.clearPhaseQueue(); + this.scene.unshiftPhase(new ReloadSessionPhase(this.scene)); } + console.error(jsonResponse); resolve([false, false]); - }).then(jsonResponse => resolve([true, jsonResponse.success as boolean])); + }); }); }); } diff --git a/src/utils.ts b/src/utils.ts index 3cbbfd84263..7d3f0e761e4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -212,7 +212,7 @@ 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 function setCookie(cName: string, cValue: string): void { const expiration = new Date();