Proper navigation when filtering with forms

This commit is contained in:
Wlowscha 2025-03-29 02:42:57 +01:00
parent a2c4f7eaf4
commit 711306041f
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -681,9 +681,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
form: 0,
};
this.formIndex = this.savedStarterAttributes.form ?? 0;
this.filteredIndices = args[2] ?? null;
this.filteredFormIndices = args[3] ?? null;
this.starterSetup();
this.filteredIndices = args[2] ? [...args[2]] : null;
this.filteredFormIndices = args[3] ? [...args[3]] : null;
if (args[4] instanceof Function) {
this.exitCallback = args[4];
@ -699,11 +698,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.starterAttributes = this.initStarterPrefs();
console.log(this.filteredIndices);
console.log(this.filteredFormIndices);
console.log(this.savedStarterAttributes);
console.log(this.starterAttributes);
if (this.filteredIndices) {
this.filteredIndex = this.filteredIndices.findIndex(id => id === this.species.speciesId);
}
@ -711,10 +705,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
if (this.filteredFormIndices) {
const newForm = this.filteredFormIndices[this.filteredIndex];
if (!isNullOrUndefined(newForm)) {
this.savedStarterAttributes.form = newForm;
this.starterAttributes.form = newForm;
this.formIndex = newForm;
}
}
this.starterSetup();
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
this.menuContainer.setVisible(true);
@ -1164,7 +1162,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
const starterAttributes = this.previousStarterAttributes.pop();
this.moveInfoOverlay.clear();
this.clearText();
ui.setModeForceTransition(Mode.POKEDEX_PAGE, species, starterAttributes);
ui.setModeForceTransition(
Mode.POKEDEX_PAGE,
species,
starterAttributes,
this.filteredIndices,
this.filteredFormIndices,
);
success = true;
});
this.blockInput = false;
@ -1608,7 +1612,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.savedStarterAttributes.form = newFormIndex;
this.moveInfoOverlay.clear();
this.clearText();
ui.setMode(Mode.POKEDEX_PAGE, newSpecies, this.savedStarterAttributes);
ui.setMode(
Mode.POKEDEX_PAGE,
newSpecies,
this.savedStarterAttributes,
this.filteredIndices,
this.filteredFormIndices,
);
return true;
},
onHover: () => this.showText(conditionText),
@ -1650,7 +1660,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.savedStarterAttributes.form = newFormIndex;
this.moveInfoOverlay.clear();
this.clearText();
ui.setMode(Mode.POKEDEX_PAGE, evoSpecies, this.savedStarterAttributes);
ui.setMode(
Mode.POKEDEX_PAGE,
evoSpecies,
this.savedStarterAttributes,
this.filteredIndices,
this.filteredFormIndices,
);
return true;
},
onHover: () => this.showText(conditionText),