From fa5232a7048019badbf67f207378c3ff9b75d9d3 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Wed, 12 Feb 2025 22:03:44 +0100 Subject: [PATCH] Preventing filter texts from showing gibberish --- src/ui/filter-text.ts | 2 +- src/ui/pokedex-scan-ui-handler.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/filter-text.ts b/src/ui/filter-text.ts index f961fc9b385..f69cf113f05 100644 --- a/src/ui/filter-text.ts +++ b/src/ui/filter-text.ts @@ -133,7 +133,7 @@ export class FilterText extends Phaser.GameObjects.Container { const handler = ui.getHandler() as AwaitableUiHandler; handler.tutorialActive = true; // Switch to the dialog test window - this.selections[index].setText(String(i18next.t(dialogueName))); + this.selections[index].setText( dialogueName === "" ? this.defaultText : String(i18next.t(dialogueName))); ui.revertMode(); this.onChange(); }, diff --git a/src/ui/pokedex-scan-ui-handler.ts b/src/ui/pokedex-scan-ui-handler.ts index 0fc7171842a..b0689f0c370 100644 --- a/src/ui/pokedex-scan-ui-handler.ts +++ b/src/ui/pokedex-scan-ui-handler.ts @@ -169,7 +169,8 @@ export default class PokedexScanUiHandler extends FormModalUiHandler { this.submitAction = (_) => { if (ui.getMode() === Mode.POKEDEX_SCAN) { this.sanitizeInputs(); - const sanitizedName = btoa(unescape(encodeURIComponent(this.inputs[0].text))); + const outputName = this.reducedKeys.includes(this.inputs[0].text) ? this.inputs[0].text : ""; + const sanitizedName = btoa(unescape(encodeURIComponent(outputName))); config.buttonActions[0](sanitizedName); return true; }