Require valid campaign save for continue
This commit is contained in:
@@ -30,6 +30,7 @@ try {
|
||||
applyCampBondExp,
|
||||
applyCampVisitReward,
|
||||
getCampaignState,
|
||||
hasCampaignSave,
|
||||
loadCampaignState,
|
||||
normalizeCampaignSortieItemAssignments,
|
||||
resetCampaignState,
|
||||
@@ -660,6 +661,7 @@ try {
|
||||
storage.set(campaignStorageKey, JSON.stringify({ version: 99, step: 'sixty-sixth-camp' }));
|
||||
const unsupported = loadCampaignState();
|
||||
assert(unsupported.step === 'new', `Expected unsupported future save version to be ignored: ${JSON.stringify(unsupported)}`);
|
||||
assert(!hasCampaignSave(), 'Expected unsupported base save without valid slots to be ignored by hasCampaignSave');
|
||||
|
||||
storage.clear();
|
||||
storage.set(campaignStorageKey, JSON.stringify({ version: 99, step: 'sixty-sixth-camp' }));
|
||||
@@ -673,6 +675,7 @@ try {
|
||||
gold: 260
|
||||
})
|
||||
);
|
||||
assert(hasCampaignSave(), 'Expected valid slotted save fallback to be visible to hasCampaignSave');
|
||||
const fallback = loadCampaignState();
|
||||
assert(fallback.step === 'second-camp' && fallback.activeSaveSlot === 2, `Expected valid slotted save fallback: ${JSON.stringify(fallback)}`);
|
||||
|
||||
|
||||
@@ -568,7 +568,7 @@ export function resetCampaignState() {
|
||||
}
|
||||
|
||||
export function hasCampaignSave() {
|
||||
return Boolean(tryStorage()?.getItem(campaignStorageKey) ?? readLatestSlottedCampaignState());
|
||||
return Boolean(readStoredCampaignState() ?? readLatestSlottedCampaignState());
|
||||
}
|
||||
|
||||
export function listCampaignSaveSlots(): CampaignSaveSlotSummary[] {
|
||||
|
||||
Reference in New Issue
Block a user