Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
7 changes: 5 additions & 2 deletions assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
7 changes: 5 additions & 2 deletions assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
5 changes: 4 additions & 1 deletion assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Ajouter un évènement",
"invalid_data": "Données invalides",
"event_title_empty_state": "Commencez à créer un événement !",
"event_description_empty_state": "Vous n'avez pas encore d'événement. Vous pouvez créer un nouvel événement ou importer des événements existants."
"event_description_empty_state": "Vous n'avez pas encore d'événement. Vous pouvez créer un nouvel événement ou importer des événements existants.",
"max_base_stat_value": "Valeur maximum d'une statistique de base",
"base_stat_recommended_limit_warning": "Configurer une statistique avec une valeur supérieure à 255 peut affecter l'équilibrage du jeu ou provoquer des conflits avec les données existantes.",
"add_base_stat_max_value_to_settings": "Ajout du paramètre de statistique de base maximum aux paramètres du projet"
}
7 changes: 5 additions & 2 deletions assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
7 changes: 5 additions & 2 deletions assets/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
7 changes: 5 additions & 2 deletions assets/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
7 changes: 5 additions & 2 deletions assets/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
7 changes: 5 additions & 2 deletions assets/i18n/zh_Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
7 changes: 5 additions & 2 deletions assets/i18n/zh_Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,8 @@
"create_event": "Add event",
"invalid_data": "Invalid data",
"event_title_empty_state": "Start creating an event!",
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones."
}
"event_description_empty_state": "You don't have any event yet. You can create a new event or import existing ones.",
"max_base_stat_value": "Max base stat value",
"base_stat_recommended_limit_warning": "Setting base stats above 255 may affect game balance or compatibility with existing data.",
"add_base_stat_max_value_to_settings": "Adding the max base stat value to project settings"
}
2 changes: 1 addition & 1 deletion src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import i18next, { InitOptions } from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { initReactI18next } from 'react-i18next';

import { languages } from '@root/package.json';

Expand Down
21 changes: 21 additions & 0 deletions src/migrations/addBaseStatMaxValueToSettings.ts
Comment thread
Green00101 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { SETTINGS_CONFIG_VALIDATOR, StudioSettingConfig } from '@modelEntities/config';
import { parseJSON } from '@utils/json/parse';
import { IpcMainEvent } from 'electron';
import fsPromise from 'fs/promises';
import path from 'path';
import { deletePSDKDatFile } from './migrateUtils';

const PRE_MIGRATION_SETTINGS_CONFIG_VALIDATOR = SETTINGS_CONFIG_VALIDATOR.omit({ baseStatMaxValue: true });

export const addBaseStatMaxValueToSettings = async (_: IpcMainEvent, projectPath: string) => {
deletePSDKDatFile(projectPath);
const settingsFilePath = path.join(projectPath, 'Data/configs/settings_config.json');
const settingsFile = await fsPromise.readFile(settingsFilePath, { encoding: 'utf-8' });
const settingsFileParsed = PRE_MIGRATION_SETTINGS_CONFIG_VALIDATOR.safeParse(parseJSON(settingsFile, 'settings_config.json'));
if (!settingsFileParsed.success) throw new Error('Fail to parse settings_config.json file');
const newSettingsFile: StudioSettingConfig = {
...settingsFileParsed.data,
baseStatMaxValue: 999,
};
await fsPromise.writeFile(settingsFilePath, JSON.stringify(newSettingsFile, null, 2));
};
9 changes: 5 additions & 4 deletions src/migrations/addBattleCamera3dToSettings.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { SETTINGS_CONFIG_VALIDATOR, StudioSettingConfig } from '@modelEntities/config';
import { parseJSON } from '@utils/json/parse';
import { IpcMainEvent } from 'electron';
import path from 'path';
import fsPromise from 'fs/promises';
import { parseJSON } from '@utils/json/parse';
import { SETTINGS_CONFIG_VALIDATOR, StudioSettingConfig } from '@modelEntities/config';
import path from 'path';
import { deletePSDKDatFile } from './migrateUtils';

const PRE_MIGRATION_SETTINGS_CONFIG_VALIDATOR = SETTINGS_CONFIG_VALIDATOR.omit({
isUseBattleCamera3d: true,
showContestSummaryPage: true,
showRibbonsSummaryPage: true,
baseStatMaxValue: true,
});

export const addBattleCamera3dToSettings = async (_: IpcMainEvent, projectPath: string) => {
Expand All @@ -20,7 +21,7 @@ export const addBattleCamera3dToSettings = async (_: IpcMainEvent, projectPath:
const settingsFileParsed = PRE_MIGRATION_SETTINGS_CONFIG_VALIDATOR.safeParse(parseJSON(settingsFile, 'settings_config.json'));
if (!settingsFileParsed.success) throw new Error('Fail to parse settings_config.json file');

const newSettingsFile: Omit<StudioSettingConfig, 'showContestSummaryPage' | 'showRibbonsSummaryPage'> = {
const newSettingsFile: Omit<StudioSettingConfig, 'showContestSummaryPage' | 'showRibbonsSummaryPage' | 'baseStatMaxValue'> = {
...settingsFileParsed.data,
isUseBattleCamera3d: false,
};
Expand Down
14 changes: 9 additions & 5 deletions src/migrations/addSummaryPagesOptionsToSettings.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { SETTINGS_CONFIG_VALIDATOR, StudioSettingConfig } from '@modelEntities/config';
import { parseJSON } from '@utils/json/parse';
import { IpcMainEvent } from 'electron';
import path from 'path';
import fsPromise from 'fs/promises';
import { parseJSON } from '@utils/json/parse';
import { SETTINGS_CONFIG_VALIDATOR, StudioSettingConfig } from '@modelEntities/config';
import path from 'path';
import { deletePSDKDatFile } from './migrateUtils';

const PRE_MIGRATION_SETTINGS_CONFIG_VALIDATOR = SETTINGS_CONFIG_VALIDATOR.omit({ showContestSummaryPage: true, showRibbonsSummaryPage: true });
const PRE_MIGRATION_SETTINGS_CONFIG_VALIDATOR = SETTINGS_CONFIG_VALIDATOR.omit({
showContestSummaryPage: true,
showRibbonsSummaryPage: true,
baseStatMaxValue: true,
});

export const addSummaryPagesOptionsToSettings = async (_: IpcMainEvent, projectPath: string) => {
deletePSDKDatFile(projectPath);
Expand All @@ -16,7 +20,7 @@ export const addSummaryPagesOptionsToSettings = async (_: IpcMainEvent, projectP
const settingsFileParsed = PRE_MIGRATION_SETTINGS_CONFIG_VALIDATOR.safeParse(parseJSON(settingsFile, 'settings_config.json'));
if (!settingsFileParsed.success) throw new Error('Fail to parse settings_config.json file');

const newSettingsFile: StudioSettingConfig = {
const newSettingsFile: Omit<StudioSettingConfig, 'baseStatMaxValue'> = {
...settingsFileParsed.data,
showContestSummaryPage: true,
showRibbonsSummaryPage: true,
Expand Down
48 changes: 27 additions & 21 deletions src/migrations/migrationConfig.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import type { MigrationTask } from '@src/backendTasks/migrateData';
import { migrateMapLinks } from './migrateMapLinks';
import { linkResourcesToCreatures } from './linkResourcesToCreatures';
import { migrateHeadbutt } from './migrateHeadbutt';
import { fixBeMethodMoveSelfStatus } from './fixBeMethodMoveSelfStatus';
import { migrationV2 } from './migrationV2';
import { addAvailableLanguagesForTranslation } from './addAvailableLanguagesForTranslation';
import { addVolumeAndPitchInMaps } from './addVolumeAndPitchInMaps';
import { generatingMapOverviews } from './generatingMapOverviews';
import { addOtherLanguages } from './addOtherLanguages';
import { fixCreatureValuesAfterZodChange } from './fixCreatureValuesAfterZodChange';
import { addFormNamesDescriptions } from './addFormNamesDescriptions';
import { migrateNaturesToEntities } from './migrateNaturesToEntities';
import { migrateUndefinedBreedingGroupToUnknown } from './migrateUndefinedBreedingGroupToUnknown';
import { addTrainerAdditionalDialogs } from './addTrainerAdditionalDialogs';
import { migrateQuestsEarnings } from './migrateQuestsEarnings';
import { addBaseStatMaxValueToSettings } from './addBaseStatMaxValueToSettings';
import { addBattleCamera3dToSettings } from './addBattleCamera3dToSettings';
import { addBerryAndCookingDataToItems } from './addBerryAndCookingDataToItems';
import { addCsvForEventFolders } from './addCsvForEventFolders';
import { addCsvForQuestsCustomObjectives } from './addCsvForQuestsCustomObjectives';
import { addEggInCreatureResources } from './addEggInCreatureResources';
import { addBattleCamera3dToSettings } from './addBattleCamera3dToSettings';
import { migrateGroupsFor3v3BattleMode } from './migrateGroupsFor3v3BattleMode';
import { addFormNamesDescriptions } from './addFormNamesDescriptions';
import { addMegaEvolutionParameterToItems } from './addMegaEvolutionParameterToItems';
import { addBerryAndCookingDataToItems } from './addBerryAndCookingDataToItems';
import { addSoundDesignConfig } from './addSoundDesignConfig';
import { addMoveContestData } from './addMoveContestData';
import { addMissingMapLinks } from './addMissingMapLinks';
import { baseForEvents } from './baseForEvents';
import { addCsvForEventFolders } from './addCsvForEventFolders';
import { addMoveContestData } from './addMoveContestData';
import { addOtherLanguages } from './addOtherLanguages';
import { addSoundDesignConfig } from './addSoundDesignConfig';
import { addSummaryPagesOptionsToSettings } from './addSummaryPagesOptionsToSettings';
import { addTrainerAdditionalDialogs } from './addTrainerAdditionalDialogs';
import { addVolumeAndPitchInMaps } from './addVolumeAndPitchInMaps';
import { baseForEvents } from './baseForEvents';
import { fixBeMethodMoveSelfStatus } from './fixBeMethodMoveSelfStatus';
import { fixCreatureValuesAfterZodChange } from './fixCreatureValuesAfterZodChange';
import { generatingMapOverviews } from './generatingMapOverviews';
import { linkResourcesToCreatures } from './linkResourcesToCreatures';
import { migrateGroupsFor3v3BattleMode } from './migrateGroupsFor3v3BattleMode';
import { migrateHeadbutt } from './migrateHeadbutt';
import { migrateMapLinks } from './migrateMapLinks';
import { migrateNaturesToEntities } from './migrateNaturesToEntities';
import { migrateQuestsEarnings } from './migrateQuestsEarnings';
import { migrateUndefinedBreedingGroupToUnknown } from './migrateUndefinedBreedingGroupToUnknown';
import { migrationV2 } from './migrationV2';

type MigrateConfigType = {
migration: MigrationTask;
Expand Down Expand Up @@ -185,4 +186,9 @@ export const MIGRATION_CONFIG: MigrateConfigType[] = [
version: '2.9.1',
message: 'add_summary_pages_options_to_settings',
},
{
migration: addBaseStatMaxValueToSettings,
version: '2.9.1',
message: 'add_base_stat_max_value_to_settings',
},
];
5 changes: 3 additions & 2 deletions src/models/entities/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const CREDIT_CONFIG_VALIDATOR = z.object({
z.object({
title: z.string(),
name: z.string(),
})
}),
),
gameCredits: z.string(),
});
Expand Down Expand Up @@ -105,6 +105,7 @@ export const SETTINGS_CONFIG_VALIDATOR = z.object({
isUseBattleCamera3d: z.boolean(),
showContestSummaryPage: z.boolean(),
showRibbonsSummaryPage: z.boolean(),
baseStatMaxValue: POSITIVE_INT.max(9999).default(999),
});
export type StudioSettingConfig = z.infer<typeof SETTINGS_CONFIG_VALIDATOR>;

Expand Down Expand Up @@ -241,4 +242,4 @@ export type SoundEffectsKeys =
| keyof SoundDesignConfig['backgroundMusic']
| keyof SoundDesignConfig['backgroundSound'];

export type SoundLocated = keyof SoundDesignConfig;
export type SoundLocated = keyof SoundDesignConfig;
14 changes: 7 additions & 7 deletions src/models/entities/creature.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod';
import { POSITIVE_OR_ZERO_INT, POSITIVE_INT, POSITIVE_OR_ZERO_FLOAT } from './common';
import { POSITIVE_INT, POSITIVE_OR_ZERO_FLOAT, POSITIVE_OR_ZERO_INT } from './common';
import { DB_SYMBOL_VALIDATOR } from './dbSymbol';

export const ITEM_HELD_VALIDATOR = z.object({
Expand Down Expand Up @@ -111,12 +111,12 @@ export const CREATURE_FORM_VALIDATOR = z.object({
weight: POSITIVE_OR_ZERO_FLOAT.min(0.01).max(9999.99).step(0.01),
type1: DB_SYMBOL_VALIDATOR,
type2: DB_SYMBOL_VALIDATOR,
baseHp: POSITIVE_INT.max(255),
baseAtk: POSITIVE_INT.max(255),
baseDfe: POSITIVE_INT.max(255),
baseSpd: POSITIVE_INT.max(255),
baseAts: POSITIVE_INT.max(255),
baseDfs: POSITIVE_INT.max(255),
baseHp: POSITIVE_INT.max(9999),
baseAtk: POSITIVE_INT.max(9999),
baseDfe: POSITIVE_INT.max(9999),
baseSpd: POSITIVE_INT.max(9999),
baseAts: POSITIVE_INT.max(9999),
baseDfs: POSITIVE_INT.max(9999),
evHp: POSITIVE_OR_ZERO_INT.max(255),
evAtk: POSITIVE_OR_ZERO_INT.max(255),
evDfe: POSITIVE_OR_ZERO_INT.max(255),
Expand Down
5 changes: 3 additions & 2 deletions src/utils/cleanNaNValue.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { PokemonBattlerFrom } from '@components/pokemonBattler/editors/PokemonBattlerEditorOverlay';
import { StudioDisplayConfig, StudioSaveConfig, StudioSettingConfig, StudioTextConfig } from '@modelEntities/config';
import { StudioCreatureForm } from '@modelEntities/creature';
import { StudioGroup } from '@modelEntities/group';
import { StudioExpandPokemonSetup, StudioGroupEncounter, StudioIvEv } from '@modelEntities/groupEncounter';
import { StudioItem } from '@modelEntities/item';
import { StudioMove } from '@modelEntities/move';
import { StudioTrainer } from '@modelEntities/trainer';
import { StudioZone } from '@modelEntities/zone';
import { StudioGroup } from '@modelEntities/group';
import { ProjectData, State } from '@src/GlobalStateProvider';
import { PokemonBattlerFrom } from '@components/pokemonBattler/editors/PokemonBattlerEditorOverlay';
import { assertUnreachable } from './assertUnreachable';

/**
Expand Down Expand Up @@ -43,6 +43,7 @@ export const cleaningSaveNaNValues = (v: StudioSaveConfig) => {
export const cleaningSettingsNaNValues = (v: StudioSettingConfig) => {
v.pokemonMaxLevel = cleanNaNValue(v.pokemonMaxLevel, 100);
v.maxBagItemCount = cleanNaNValue(v.maxBagItemCount);
v.baseStatMaxValue = cleanNaNValue(v.baseStatMaxValue, 999);
};

export const cleaningTextNaNValues = (v: StudioTextConfig) => {
Expand Down
Loading