Merge branch 'main' of https://github.com/Gwendal-R/pokerogue
@ -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`
|
||||
|
@ -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$"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.7 KiB |
@ -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$"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.3 KiB |
@ -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$"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.3 KiB |
@ -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$"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.7 KiB |
@ -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?');
|
||||
|
@ -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]));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ export function executeIf<T>(condition: boolean, promiseFunc: () => Promise<T>):
|
||||
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();
|
||||
|