fix: stabilize rpg creation entry and opening cg

This commit is contained in:
kdletters
2026-05-21 17:21:38 +08:00
parent 0eed942ce5
commit 41075e41a2
26 changed files with 866 additions and 47 deletions

View File

@@ -27,6 +27,7 @@ import {
CustomWorldNpcVisualGear,
CustomWorldNpcVisualGearType,
CustomWorldNpcVisualRace,
CustomWorldOpeningCgProfile,
CustomWorldPlayableNpc,
CustomWorldProfile,
CustomWorldRoleInitialItem,
@@ -1155,6 +1156,9 @@ function normalizeProfile(value: unknown): CustomWorldProfile | null {
.map((entry, index) => normalizePlayableNpc(entry, index))
.filter((entry): entry is CustomWorldPlayableNpc => Boolean(entry))
: [];
const openingCg = preserveStructuredRecord<CustomWorldOpeningCgProfile>(
value.openingCg,
);
const normalizedProfile = {
id: toText(value.id, `saved-custom-world-${Date.now().toString(36)}`),
settingText,
@@ -1180,6 +1184,7 @@ function normalizeProfile(value: unknown): CustomWorldProfile | null {
.map((entry, index) => normalizeItem(entry, index))
.filter((entry): entry is CustomWorldItem => Boolean(entry))
: [],
openingCg,
camp,
landmarks: normalizeCustomWorldLandmarks({
landmarks: landmarkDrafts,