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.
This commit is contained in:
Frederico Santos 2024-07-13 02:43:26 +01:00
parent b2ced623fd
commit 7709ff5d21
2 changed files with 4 additions and 2 deletions

View File

@ -573,6 +573,8 @@ export class GameData {
// Account for past key oversight // Account for past key oversight
dataStr = dataStr.replace(/\$pAttr/g, "$pa"); 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 fromKeys = shorten ? Object.keys(systemShortKeys) : Object.values(systemShortKeys);
const toKeys = shorten ? Object.values(systemShortKeys) : Object.keys(systemShortKeys); const toKeys = shorten ? Object.values(systemShortKeys) : Object.keys(systemShortKeys);
for (const k in fromKeys) { for (const k in fromKeys) {

View File

@ -192,7 +192,7 @@ export default class MenuUiHandler extends MessageUiHandler {
}); });
}; };
if (Utils.isLocal) { if (Utils.isLocal || Utils.isBeta) {
manageDataOptions.push({ manageDataOptions.push({
label: i18next.t("menuUiHandler:importSession"), label: i18next.t("menuUiHandler:importSession"),
handler: () => { handler: () => {
@ -223,7 +223,7 @@ export default class MenuUiHandler extends MessageUiHandler {
}, },
keepOpen: true keepOpen: true
}); });
if (Utils.isLocal) { if (Utils.isLocal || Utils.isBeta) {
manageDataOptions.push({ manageDataOptions.push({
label: i18next.t("menuUiHandler:importData"), label: i18next.t("menuUiHandler:importData"),
handler: () => { handler: () => {