feat: add sync new content debug tool
CI / Lint, Build & Test (push) Failing after 51s
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 1m9s

Adds a new debug panel button that injects any adventurers, quests,
bosses, equipment, upgrades, achievements, zones, and exploration areas
that exist in the current game data but are missing from an existing
player save (e.g. content added after the save was first created).
This commit is contained in:
2026-03-23 18:10:39 -07:00
committed by Naomi Carrigan
parent 26d30c271d
commit e92cf3c9a1
6 changed files with 356 additions and 2 deletions
+55
View File
@@ -44,6 +44,7 @@ import {
craftRecipe as craftRecipeApi,
debugHardReset as debugHardResetApi,
forceUnlocks as forceUnlocksApi,
syncNewContent as syncNewContentApi,
loadGame,
prestige as prestigeApi,
resetProgress as resetProgressApi,
@@ -574,6 +575,21 @@ interface GameContextValue {
*/
debugHardReset: ()=> Promise<void>;
/**
* Syncs any content added to the game after the player's save was created.
* @returns Counts of what was added per content type.
*/
syncNewContent: ()=> Promise<{
achievementsAdded: number;
adventurersAdded: number;
bossesAdded: number;
equipmentAdded: number;
explorationAreasAdded: number;
questsAdded: number;
upgradesAdded: number;
zonesAdded: number;
}>;
/**
* Last auto-boss fight result — null until the first auto fight completes or
* when auto-boss is toggled off.
@@ -2151,6 +2167,43 @@ export const GameProvider = ({
}
}, []);
const syncNewContent = useCallback(async() => {
try {
const data = await syncNewContentApi();
setState(data.state);
if (data.signature !== undefined) {
signatureReference.current = data.signature;
localStorage.setItem("elysium_save_signature", data.signature);
}
return {
achievementsAdded: data.achievementsAdded,
adventurersAdded: data.adventurersAdded,
bossesAdded: data.bossesAdded,
equipmentAdded: data.equipmentAdded,
explorationAreasAdded: data.explorationAreasAdded,
questsAdded: data.questsAdded,
upgradesAdded: data.upgradesAdded,
zonesAdded: data.zonesAdded,
};
} catch (error_: unknown) {
setError(
error_ instanceof Error
? error_.message
: "Failed to sync new content",
);
return {
achievementsAdded: 0,
adventurersAdded: 0,
bossesAdded: 0,
equipmentAdded: 0,
explorationAreasAdded: 0,
questsAdded: 0,
upgradesAdded: 0,
zonesAdded: 0,
};
}
}, []);
const debugHardReset = useCallback(async() => {
setIsLoading(true);
setError(null);
@@ -2260,6 +2313,7 @@ export const GameProvider = ({
unlockedAchievements,
unlockedCodexEntryIds,
unlockedStoryChapterIds,
syncNewContent,
};
}, [
apotheosis,
@@ -2323,6 +2377,7 @@ export const GameProvider = ({
startQuest,
state,
syncError,
syncNewContent,
toggleAutoAdventurer,
toggleAutoBoss,
toggleAutoPrestige,