[Bug] Fixing continue error when game finishes

This commit is contained in:
podar 2024-09-16 15:20:58 -05:00
parent 009fd3fc5c
commit fb30fe8f7e

View File

@ -1174,6 +1174,9 @@ export class GameData {
});
}
/**
* Attempt to clear session data. After session data is removed, attempt to update user info so the menu updates
*/
tryClearSession(scene: BattleScene, slotId: integer): Promise<[success: boolean, newClear: boolean]> {
return new Promise<[boolean, boolean]>(resolve => {
if (bypassLogin) {
@ -1181,10 +1184,6 @@ export class GameData {
return resolve([true, true]);
}
updateUserInfo().then(success => {
if (success !== null && !success) {
return resolve([false, false]);
}
const sessionData = this.getSessionSaveData(scene);
Utils.apiPost(`savedata/session/clear?slot=${slotId}&trainerId=${this.trainerId}&secretId=${this.secretId}&clientSessionId=${clientSessionId}`, JSON.stringify(sessionData), undefined, true).then(response => {
if (response.ok) {
@ -1203,7 +1202,15 @@ export class GameData {
console.error(jsonResponse);
resolve([false, false]);
});
}).then(result => {
updateUserInfo().then(success => {
if (success !== null && !success) {
return new Promise<[boolean, boolean]>(resolve => {
return resolve([false, false]);
});
}
});
return result;
});
}