From d2e9615457f1028f9dd3d090a31212ec83728189 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Wed, 20 Aug 2025 22:57:13 +0200 Subject: [PATCH] [UI/UX] Save in starter select screen after moveset changes (#6287) * Save after moveset changes * Saving only when the moveset is actually changed * Removed logs, added docs * Update src/ui/starter-select-ui-handler.ts --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> --- src/ui/starter-select-ui-handler.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 83a38ed7fe0..42ebea5f416 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -401,6 +401,12 @@ export class StarterSelectUiHandler extends MessageUiHandler { private starterPreferences: StarterPreferences; + /** + * Used to check whether any moves were swapped using the reorder menu, to decide + * whether a save should be performed or not. + */ + private hasSwappedMoves = false; + protected blockInput = false; constructor() { @@ -1957,6 +1963,14 @@ export class StarterSelectUiHandler extends MessageUiHandler { handler: () => { this.moveInfoOverlay.clear(); this.clearText(); + // Only saved if moves were actually swapped + if (this.hasSwappedMoves) { + globalScene.gameData.saveSystem().then(success => { + if (!success) { + return globalScene.reset(true); + } + }); + } ui.setMode(UiMode.STARTER_SELECT); return true; }, @@ -1975,6 +1989,7 @@ export class StarterSelectUiHandler extends MessageUiHandler { options.push({ label: i18next.t("starterSelectUiHandler:manageMoves"), handler: () => { + this.hasSwappedMoves = false; showSwapOptions(this.starterMoveset!); // TODO: is this bang correct? return true; }, @@ -2724,8 +2739,8 @@ export class StarterSelectUiHandler extends MessageUiHandler { } else { starterData.moveset = updatedMoveset; } + this.hasSwappedMoves = true; this.setSpeciesDetails(this.lastSpecies, { forSeen: false }); - this.updateSelectedStarterMoveset(speciesId); }