Cap campaign save string lists
This commit is contained in:
@@ -266,6 +266,10 @@ const campaignInventoryCaps: Record<string, number> = {
|
||||
['\uD0C1\uC8FC']: 80
|
||||
};
|
||||
|
||||
const maxCampaignStringListEntries = 128;
|
||||
const maxCampaignStringListLength = 96;
|
||||
const maxCampaignRewardNoteLength = 180;
|
||||
|
||||
export const campaignReserveTrainingFocusDefinitions: CampaignReserveTrainingFocusDefinition[] = [
|
||||
{
|
||||
id: 'balanced',
|
||||
@@ -881,9 +885,9 @@ function uniqueStrings(value: unknown): string[] {
|
||||
arrayOrEmpty<unknown>(value)
|
||||
.filter((entry): entry is string => typeof entry === 'string')
|
||||
.map((entry) => entry.trim())
|
||||
.filter((entry) => entry.length > 0)
|
||||
.filter((entry) => entry.length > 0 && entry.length <= maxCampaignStringListLength)
|
||||
)
|
||||
];
|
||||
].slice(0, maxCampaignStringListEntries);
|
||||
}
|
||||
|
||||
function normalizedRosterUnitIds(roster: UnitData[]) {
|
||||
@@ -1532,6 +1536,7 @@ function cloneCampaignRewardSnapshot(rewards?: CampaignRewardSnapshot): Campaign
|
||||
}
|
||||
|
||||
const rewardRecord = recordOrEmpty(rewards);
|
||||
const note = typeof rewardRecord.note === 'string' ? rewardRecord.note.trim() : '';
|
||||
return {
|
||||
supplies: uniqueStrings(rewardRecord.supplies),
|
||||
equipment: uniqueStrings(rewardRecord.equipment),
|
||||
@@ -1550,7 +1555,7 @@ function cloneCampaignRewardSnapshot(rewards?: CampaignRewardSnapshot): Campaign
|
||||
title: typeof unlock.title === 'string' ? unlock.title.trim() : ''
|
||||
}))
|
||||
.filter((unlock) => unlock.battleId && unlock.title),
|
||||
note: typeof rewardRecord.note === 'string' && rewardRecord.note.trim().length > 0 ? rewardRecord.note.trim() : undefined
|
||||
note: note.length > 0 && note.length <= maxCampaignRewardNoteLength ? note : undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user