X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fhooks%2Ftracker.js;h=ce01c4b94079dd646e17f9263882a85544bc3153;hb=816690cc4fadff954f4407999550f7feec2884da;hp=30bf2426a7a125781f2aa5579e9e9a389f74511e;hpb=d2e89b06bd80faa5085c454709c7e48c829cc6f2;p=alttp.git diff --git a/resources/js/hooks/tracker.js b/resources/js/hooks/tracker.js index 30bf242..ce01c4b 100644 --- a/resources/js/hooks/tracker.js +++ b/resources/js/hooks/tracker.js @@ -5,6 +5,7 @@ import { CONFIG, DUNGEONS, applyLogic, + configureDungeons, makeEmptyState, mergeStates, } from '../helpers/tracker'; @@ -37,25 +38,7 @@ export const TrackerProvider = ({ children }) => { }, []); React.useEffect(() => { - const newDungeons = DUNGEONS.map(dungeon => { - const newDungeon = JSON.parse(JSON.stringify(dungeon)); - if (config.wildMap && dungeon.map) { - ++newDungeon.items; - } - if (config.wildCompass && dungeon.compass) { - ++newDungeon.items; - } - if (config.wildSmall) { - newDungeon.items += dungeon.sk; - } - if (config.wildBig && dungeon.bk && !dungeon.dropBk) { - ++newDungeon.items; - } - if (!config.bossShuffle && dungeon.boss) { - newDungeon.bosses = [dungeon.boss]; - } - return newDungeon; - }); + const newDungeons = configureDungeons(config); setDungeons(newDungeons); }, [config]); @@ -68,7 +51,6 @@ export const TrackerProvider = ({ children }) => { }, [config, dungeons, state]); const value = React.useMemo(() => { - console.log(logic); return { config, dungeons, logic, saveConfig, setAutoState, setManualState, state }; }, [config, dungeons, logic, state]);