From 5214cdfbf26bc0bdee5d669a237fb8aefffb78d5 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 30 Aug 2023 21:35:28 +0200 Subject: story! --- resources/js/memory.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'resources/js/memory.js') diff --git a/resources/js/memory.js b/resources/js/memory.js index 709a084..b403037 100644 --- a/resources/js/memory.js +++ b/resources/js/memory.js @@ -181,6 +181,7 @@ const Memory = { */ const loadedState = saveData; + Memory.state.Settings.name = loadedState.Settings.name; Memory.state.Settings.language = loadedState.Settings.language; await fetchTranslation(Memory.state.Settings.language); applyTranslation(); @@ -197,6 +198,8 @@ const Memory = { } Memory.state.currentArea = await loadArea(loadedState.currentArea); Memory.state.lastVisitedTown = loadedState.lastVisitedTown; + Memory.state.storyProgress = loadedState.storyProgress; + Memory.state.currentStory = loadedState.currentStory; Memory.state.turn = loadedState.turn; Memory.state.money = loadedState.money; @@ -227,6 +230,8 @@ const Memory = { UI.drawArea(); UI.drawStatus(); UI.closeAllPopups(); + + Story.progress(Memory.state.currentStory); }, /** @@ -240,3 +245,10 @@ const Memory = { Memory.loadFromString(localStorage.getItem('state')); }, }; + +async function initializeState () { + Memory.state.currentArea = await fetchArea('paper-town'); + Memory.state.player = new Trainer({ monsters: [] }); + Memory.state.opponent = new Trainer({ monsters: [] }); + Memory.state.activeTechnique = await fetchTechnique('all_in'); +} -- cgit v1.2.3