sanitize all money when saving session data to server (#4485)
* sanitize all money when saving session data to server * update money sanitization --------- Co-authored-by: ImperialSympathizer <imperialsympathizer@gmail.com>
This commit is contained in:
parent
3def9fc15d
commit
5d819aacf2
|
@ -238,7 +238,7 @@ export class GameOverPhase extends BattlePhase {
|
||||||
enemyModifiers: this.scene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)),
|
enemyModifiers: this.scene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)),
|
||||||
arena: new ArenaData(this.scene.arena),
|
arena: new ArenaData(this.scene.arena),
|
||||||
pokeballCounts: this.scene.pokeballCounts,
|
pokeballCounts: this.scene.pokeballCounts,
|
||||||
money: this.scene.money,
|
money: Math.floor(this.scene.money),
|
||||||
score: this.scene.score,
|
score: this.scene.score,
|
||||||
waveIndex: this.scene.currentBattle.waveIndex,
|
waveIndex: this.scene.currentBattle.waveIndex,
|
||||||
battleType: this.scene.currentBattle.battleType,
|
battleType: this.scene.currentBattle.battleType,
|
||||||
|
|
|
@ -957,7 +957,7 @@ export class GameData {
|
||||||
enemyModifiers: scene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)),
|
enemyModifiers: scene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)),
|
||||||
arena: new ArenaData(scene.arena),
|
arena: new ArenaData(scene.arena),
|
||||||
pokeballCounts: scene.pokeballCounts,
|
pokeballCounts: scene.pokeballCounts,
|
||||||
money: scene.money,
|
money: Math.floor(scene.money),
|
||||||
score: scene.score,
|
score: scene.score,
|
||||||
waveIndex: scene.currentBattle.waveIndex,
|
waveIndex: scene.currentBattle.waveIndex,
|
||||||
battleType: scene.currentBattle.battleType,
|
battleType: scene.currentBattle.battleType,
|
||||||
|
@ -1047,7 +1047,7 @@ export class GameData {
|
||||||
scene.pokeballCounts = Overrides.POKEBALL_OVERRIDE.pokeballs;
|
scene.pokeballCounts = Overrides.POKEBALL_OVERRIDE.pokeballs;
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.money = sessionData.money || 0;
|
scene.money = Math.floor(sessionData.money || 0);
|
||||||
scene.updateMoneyText();
|
scene.updateMoneyText();
|
||||||
|
|
||||||
if (scene.money > this.gameStats.highestMoney) {
|
if (scene.money > this.gameStats.highestMoney) {
|
||||||
|
|
|
@ -6,6 +6,10 @@ const LATEST_VERSION = "1.0.5";
|
||||||
|
|
||||||
export function applySessionDataPatches(data: SessionSaveData) {
|
export function applySessionDataPatches(data: SessionSaveData) {
|
||||||
const curVersion = data.gameVersion;
|
const curVersion = data.gameVersion;
|
||||||
|
|
||||||
|
// Always sanitize money as a safeguard
|
||||||
|
data.money = Math.floor(data.money);
|
||||||
|
|
||||||
if (curVersion !== LATEST_VERSION) {
|
if (curVersion !== LATEST_VERSION) {
|
||||||
switch (curVersion) {
|
switch (curVersion) {
|
||||||
case "1.0.0":
|
case "1.0.0":
|
||||||
|
|
Loading…
Reference in New Issue