From 7709ff5d211c2c38ab1f8b0718c04555904a41d7 Mon Sep 17 00:00:00 2001 From: Frederico Santos Date: Sat, 13 Jul 2024 02:43:26 +0100 Subject: [PATCH] refactor: Update trainerId and secretId in game data This commit updates the `trainerId` and `secretId` properties in the `GameData` class. The values are replaced with the corresponding values from the `this.trainerId` and `this.secretId` variables. This change ensures that the `trainerId` and `secretId` are correctly updated in the game data. --- src/system/game-data.ts | 2 ++ src/ui/menu-ui-handler.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 3f9a6c96b26..9559efd0117 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -573,6 +573,8 @@ export class GameData { // Account for past key oversight dataStr = dataStr.replace(/\$pAttr/g, "$pa"); } + dataStr = dataStr.replace(/"trainerId":\d+/g, `"trainerId":${this.trainerId}`); + dataStr = dataStr.replace(/"secretId":\d+/g, `"secretId":${this.secretId}`); const fromKeys = shorten ? Object.keys(systemShortKeys) : Object.values(systemShortKeys); const toKeys = shorten ? Object.values(systemShortKeys) : Object.keys(systemShortKeys); for (const k in fromKeys) { diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index fa61c989e30..65a9b94146f 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -192,7 +192,7 @@ export default class MenuUiHandler extends MessageUiHandler { }); }; - if (Utils.isLocal) { + if (Utils.isLocal || Utils.isBeta) { manageDataOptions.push({ label: i18next.t("menuUiHandler:importSession"), handler: () => { @@ -223,7 +223,7 @@ export default class MenuUiHandler extends MessageUiHandler { }, keepOpen: true }); - if (Utils.isLocal) { + if (Utils.isLocal || Utils.isBeta) { manageDataOptions.push({ label: i18next.t("menuUiHandler:importData"), handler: () => {