From d06eb1bcc7ec0e3476745018cc53f332d8ec0a3c Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Thu, 14 Aug 2025 00:18:47 -0400 Subject: [PATCH] Partially fixed some private property issues Left some mocks alone because IDFK what they mean --- src/phases/common-anim-phase.ts | 9 +-------- src/ui/admin-ui-handler.ts | 2 -- src/ui/filter-text.ts | 3 --- src/ui/move-info-overlay.ts | 3 --- src/ui/pokedex-page-ui-handler.ts | 4 ---- src/ui/run-history-ui-handler.ts | 6 ------ src/ui/settings/abstract-settings-ui-handler.ts | 4 ---- src/ui/unavailable-modal-ui-handler.ts | 6 ++---- test/setting-menu/helpers/menu-manip.ts | 4 ---- test/test-utils/text-interceptor.ts | 2 -- 10 files changed, 3 insertions(+), 40 deletions(-) diff --git a/src/phases/common-anim-phase.ts b/src/phases/common-anim-phase.ts index 78da1dcfa2f..c5359fac0f3 100644 --- a/src/phases/common-anim-phase.ts +++ b/src/phases/common-anim-phase.ts @@ -10,19 +10,12 @@ export class CommonAnimPhase extends PokemonPhase { public readonly phaseName: "CommonAnimPhase" | "PokemonHealPhase" | "WeatherEffectPhase" = "CommonAnimPhase"; private anim: CommonAnim | null; private targetIndex?: BattlerIndex; - private playOnEmptyField: boolean; - constructor( - battlerIndex?: BattlerIndex, - targetIndex?: BattlerIndex, - anim: CommonAnim | null = null, - playOnEmptyField = false, - ) { + constructor(battlerIndex?: BattlerIndex, targetIndex?: BattlerIndex, anim: CommonAnim | null = null) { super(battlerIndex); this.anim = anim; this.targetIndex = targetIndex; - this.playOnEmptyField = playOnEmptyField; } setAnimation(anim: CommonAnim) { diff --git a/src/ui/admin-ui-handler.ts b/src/ui/admin-ui-handler.ts index e577368363d..3302dc0410b 100644 --- a/src/ui/admin-ui-handler.ts +++ b/src/ui/admin-ui-handler.ts @@ -17,8 +17,6 @@ export class AdminUiHandler extends FormModalUiHandler { private config: ModalConfig; private readonly buttonGap = 10; - // http response from the server when a username isn't found in the server - private readonly httpUserNotFoundErrorCode: number = 404; private readonly ERR_REQUIRED_FIELD = (field: string) => { if (field === "username") { return `${toTitleCase(field)} is required`; diff --git a/src/ui/filter-text.ts b/src/ui/filter-text.ts index d5809292c25..ac4f67e9b5d 100644 --- a/src/ui/filter-text.ts +++ b/src/ui/filter-text.ts @@ -24,14 +24,12 @@ export class FilterText extends Phaser.GameObjects.Container { private rows: FilterTextRow[] = []; public cursorObj: Phaser.GameObjects.Image; public numFilters = 0; - private lastCursor = -1; private uiTheme: UiTheme; private menuMessageBoxContainer: Phaser.GameObjects.Container; private dialogueMessageBox: Phaser.GameObjects.NineSlice; message: any; private readonly textPadding = 8; - private readonly defaultWordWrapWidth = 1224; private onChange: () => void; @@ -158,7 +156,6 @@ export class FilterText extends Phaser.GameObjects.Container { const cursorOffset = 8; this.cursorObj.setPosition(cursorOffset, this.labels[cursor].y + 3); - this.lastCursor = cursor; } /** diff --git a/src/ui/move-info-overlay.ts b/src/ui/move-info-overlay.ts index f98630260db..b321fcfc041 100644 --- a/src/ui/move-info-overlay.ts +++ b/src/ui/move-info-overlay.ts @@ -41,8 +41,6 @@ const GLOBAL_SCALE = 6; export class MoveInfoOverlay extends Phaser.GameObjects.Container implements InfoToggle { public active = false; - private move: Move; - private desc: Phaser.GameObjects.Text; private descScroll: Phaser.Tweens.Tween | null = null; @@ -177,7 +175,6 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf if (!globalScene.enableMoveInfo) { return false; // move infos have been disabled // TODO:: is `false` correct? i used to be `undeefined` } - this.move = move; this.pow.setText(move.power >= 0 ? move.power.toString() : "---"); this.acc.setText(move.accuracy >= 0 ? move.accuracy.toString() : "---"); this.pp.setText(move.pp >= 0 ? move.pp.toString() : "---"); diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 132039218ca..3e5ef917c5a 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -259,8 +259,6 @@ export class PokedexPageUiHandler extends MessageUiHandler { private instructionRowX = 0; private instructionRowY = 0; private instructionRowTextOffset = 9; - private filterInstructionRowX = 0; - private filterInstructionRowY = 0; private starterAttributes: StarterAttributes; private savedStarterAttributes: StarterAttributes; @@ -2200,8 +2198,6 @@ export class PokedexPageUiHandler extends MessageUiHandler { updateInstructions(): void { this.instructionRowX = 0; this.instructionRowY = 0; - this.filterInstructionRowX = 0; - this.filterInstructionRowY = 0; this.hideInstructions(); this.instructionsContainer.removeAll(); this.filterInstructionsContainer.removeAll(); diff --git a/src/ui/run-history-ui-handler.ts b/src/ui/run-history-ui-handler.ts index 457c48654a3..fe2ca8608be 100644 --- a/src/ui/run-history-ui-handler.ts +++ b/src/ui/run-history-ui-handler.ts @@ -32,8 +32,6 @@ export class RunHistoryUiHandler extends MessageUiHandler { private runsContainer: Phaser.GameObjects.Container; private runs: RunEntryContainer[]; - private runSelectCallback: RunSelectCallback | null; - private scrollCursor = 0; private cursorObj: Phaser.GameObjects.NineSlice | null; @@ -118,7 +116,6 @@ export class RunHistoryUiHandler extends MessageUiHandler { success = true; return success; } - this.runSelectCallback = null; success = true; globalScene.ui.revertMode(); } else if (this.runs.length > 0) { @@ -235,7 +232,6 @@ export class RunHistoryUiHandler extends MessageUiHandler { this.runSelectContainer.setVisible(false); this.setScrollCursor(0); this.clearCursor(); - this.runSelectCallback = null; this.clearRuns(); } @@ -258,13 +254,11 @@ export class RunHistoryUiHandler extends MessageUiHandler { * entryData: the data of an individual run */ class RunEntryContainer extends Phaser.GameObjects.Container { - private slotId: number; public entryData: RunEntry; constructor(entryData: RunEntry, slotId: number) { super(globalScene, 0, slotId * 56); - this.slotId = slotId; this.entryData = entryData; this.setup(this.entryData); diff --git a/src/ui/settings/abstract-settings-ui-handler.ts b/src/ui/settings/abstract-settings-ui-handler.ts index 91d5aec984a..99e64a657f7 100644 --- a/src/ui/settings/abstract-settings-ui-handler.ts +++ b/src/ui/settings/abstract-settings-ui-handler.ts @@ -34,8 +34,6 @@ export class AbstractSettingsUiHandler extends MessageUiHandler { protected navigationIcons: InputsIcons; private cursorObj: Phaser.GameObjects.NineSlice | null; - - private reloadSettings: Array; private reloadRequired: boolean; protected rowsToDisplay: number; @@ -107,8 +105,6 @@ export class AbstractSettingsUiHandler extends MessageUiHandler { this.settingLabels = []; this.optionValueLabels = []; - this.reloadSettings = this.settings.filter(s => s?.requireReload); - let anyReloadRequired = false; this.settings.forEach((setting, s) => { let settingName = setting.label; diff --git a/src/ui/unavailable-modal-ui-handler.ts b/src/ui/unavailable-modal-ui-handler.ts index 5c3dc513473..4c267127c54 100644 --- a/src/ui/unavailable-modal-ui-handler.ts +++ b/src/ui/unavailable-modal-ui-handler.ts @@ -10,7 +10,6 @@ import { removeCookie } from "#utils/cookies"; import i18next from "i18next"; export class UnavailableModalUiHandler extends ModalUiHandler { - private reconnectTimer: NodeJS.Timeout | null; private reconnectDuration: number; private reconnectCallback: () => void; @@ -62,7 +61,6 @@ export class UnavailableModalUiHandler extends ModalUiHandler { tryReconnect(): void { updateUserInfo().then(response => { if (response[0] || [200, 400].includes(response[1])) { - this.reconnectTimer = null; this.reconnectDuration = this.minTime; globalScene.playSound("se/pb_bounce_1"); this.reconnectCallback(); @@ -71,7 +69,7 @@ export class UnavailableModalUiHandler extends ModalUiHandler { globalScene.reset(true, true); } else { this.reconnectDuration = Math.min(this.reconnectDuration * 2, this.maxTime); // Set a max delay so it isn't infinite - this.reconnectTimer = setTimeout( + setTimeout( () => this.tryReconnect(), // Adds a random factor to avoid pendulum effect during long total breakdown this.reconnectDuration + Math.random() * this.randVarianceTime, @@ -88,7 +86,7 @@ export class UnavailableModalUiHandler extends ModalUiHandler { this.reconnectCallback = args[0]; this.reconnectDuration = this.minTime; - this.reconnectTimer = setTimeout(() => this.tryReconnect(), this.reconnectDuration); + setTimeout(() => this.tryReconnect(), this.reconnectDuration); return super.show([config]); } diff --git a/test/setting-menu/helpers/menu-manip.ts b/test/setting-menu/helpers/menu-manip.ts index 276fef2f973..b2dda48337d 100644 --- a/test/setting-menu/helpers/menu-manip.ts +++ b/test/setting-menu/helpers/menu-manip.ts @@ -17,16 +17,12 @@ export class MenuManip { private config; private settingName; private keycode; - private icon; private iconDisplayed; - private specialCaseIcon; constructor(config) { this.config = config; this.settingName = null; - this.icon = null; this.iconDisplayed = null; - this.specialCaseIcon = null; } // TODO: Review this diff --git a/test/test-utils/text-interceptor.ts b/test/test-utils/text-interceptor.ts index 36a5db4c78d..698dfc4dd9c 100644 --- a/test/test-utils/text-interceptor.ts +++ b/test/test-utils/text-interceptor.ts @@ -2,10 +2,8 @@ * Class will intercept any text or dialogue message calls and log them for test purposes */ export class TextInterceptor { - private scene; public logs: string[] = []; constructor(scene) { - this.scene = scene; scene.messageWrapper = this; }