]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/hooks/tracker.js
pendant auto tracking
[alttp.git] / resources / js / hooks / tracker.js
index 4004152eba0db9b53d975a3ea552cf37a3d508c9..ce01c4b94079dd646e17f9263882a85544bc3153 100644 (file)
@@ -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]);