mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-15 21:02:18 +02:00
Change save threshold from 5 waves to 10 waves or 5 minutes
This commit is contained in:
parent
84413d087f
commit
2010fdc829
@ -88,6 +88,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
public uiInputs: UiInputs;
|
public uiInputs: UiInputs;
|
||||||
|
|
||||||
public sessionPlayTime: integer = null;
|
public sessionPlayTime: integer = null;
|
||||||
|
public lastSavePlayTime: integer = null;
|
||||||
public masterVolume: number = 0.5;
|
public masterVolume: number = 0.5;
|
||||||
public bgmVolume: number = 1;
|
public bgmVolume: number = 1;
|
||||||
public seVolume: number = 1;
|
public seVolume: number = 1;
|
||||||
@ -452,6 +453,8 @@ export default class BattleScene extends SceneBase {
|
|||||||
initSession(): void {
|
initSession(): void {
|
||||||
if (this.sessionPlayTime === null)
|
if (this.sessionPlayTime === null)
|
||||||
this.sessionPlayTime = 0;
|
this.sessionPlayTime = 0;
|
||||||
|
if (this.lastSavePlayTime === null)
|
||||||
|
this.lastSavePlayTime = 0;
|
||||||
|
|
||||||
if (this.playTimeTimer)
|
if (this.playTimeTimer)
|
||||||
this.playTimeTimer.destroy();
|
this.playTimeTimer.destroy();
|
||||||
@ -464,6 +467,8 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.gameData.gameStats.playTime++;
|
this.gameData.gameStats.playTime++;
|
||||||
if (this.sessionPlayTime !== null)
|
if (this.sessionPlayTime !== null)
|
||||||
this.sessionPlayTime++;
|
this.sessionPlayTime++;
|
||||||
|
if (this.lastSavePlayTime !== null)
|
||||||
|
this.lastSavePlayTime++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -330,6 +330,7 @@ export class TitlePhase extends Phase {
|
|||||||
this.scene.newBattle();
|
this.scene.newBattle();
|
||||||
this.scene.arena.init();
|
this.scene.arena.init();
|
||||||
this.scene.sessionPlayTime = 0;
|
this.scene.sessionPlayTime = 0;
|
||||||
|
this.scene.lastSavePlayTime = 0;
|
||||||
this.end();
|
this.end();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -537,6 +538,7 @@ export class SelectStarterPhase extends Phase {
|
|||||||
this.scene.newBattle();
|
this.scene.newBattle();
|
||||||
this.scene.arena.init();
|
this.scene.arena.init();
|
||||||
this.scene.sessionPlayTime = 0;
|
this.scene.sessionPlayTime = 0;
|
||||||
|
this.scene.lastSavePlayTime = 0;
|
||||||
this.end();
|
this.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -790,7 +792,7 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
|
|
||||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
this.scene.gameData.saveAll(this.scene, true, battle.waveIndex % 5 === 1).then(success => {
|
this.scene.gameData.saveAll(this.scene, true, battle.waveIndex % 10 === 1 || this.scene.lastSavePlayTime >= 10).then(success => {
|
||||||
this.scene.disableMenu = false;
|
this.scene.disableMenu = false;
|
||||||
if (!success)
|
if (!success)
|
||||||
return this.scene.reset(true);
|
return this.scene.reset(true);
|
||||||
|
@ -656,6 +656,7 @@ export class GameData {
|
|||||||
console.log('Seed:', scene.seed);
|
console.log('Seed:', scene.seed);
|
||||||
|
|
||||||
scene.sessionPlayTime = sessionData.playTime || 0;
|
scene.sessionPlayTime = sessionData.playTime || 0;
|
||||||
|
scene.lastSavePlayTime = 0;
|
||||||
|
|
||||||
const loadPokemonAssets: Promise<void>[] = [];
|
const loadPokemonAssets: Promise<void>[] = [];
|
||||||
|
|
||||||
@ -903,8 +904,10 @@ export class GameData {
|
|||||||
Utils.apiPost('savedata/updateall', JSON.stringify(request, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v), undefined, true)
|
Utils.apiPost('savedata/updateall', JSON.stringify(request, (k: any, v: any) => typeof v === 'bigint' ? v <= maxIntAttrValue ? Number(v) : v.toString() : v), undefined, true)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(error => {
|
.then(error => {
|
||||||
if (sync)
|
if (sync) {
|
||||||
|
this.scene.lastSavePlayTime = 0;
|
||||||
this.scene.ui.savingIcon.hide();
|
this.scene.ui.savingIcon.hide();
|
||||||
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error.startsWith('client version out of date')) {
|
if (error.startsWith('client version out of date')) {
|
||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
|
Loading…
Reference in New Issue
Block a user