]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/helpers/tracker.js
adlib chat
[alttp.git] / resources / js / helpers / tracker.js
index f73aa669823ad24db0e345dcd39bc582dadd3fae..f3d4bb4120b92665b0716f2213d94e652fc794af 100644 (file)
@@ -85,6 +85,7 @@ export const BOSSES = [
 export const CONFIG = {
        bossShuffle: false,
        checkCalculation: 'room-data',
+       compactKeysanity: true,
        glitches: 'none',
        mapLayout: 'horizontal',
        showMap: 'situational',
@@ -1619,12 +1620,21 @@ export const shouldShowDungeonItem = (config, which) => {
                case 'always':
                        return true;
                case 'situational':
-                       return wild;
+                       return wild || (which === 'Compass' && config.bossShuffle);
                case 'never':
                        return false;
        }
 };
 
+export const showsFullKeysanity = (config) =>
+       shouldShowDungeonItem(config, 'Map') &&
+       shouldShowDungeonItem(config, 'Compass') &&
+       shouldShowDungeonItem(config, 'Small') &&
+       shouldShowDungeonItem(config, 'Big');
+
+export const shouldCompactKeysanity = (config) =>
+       config.compactKeysanity && showsFullKeysanity(config);
+
 export const toggleBoolean = name => state => ({
        ...state,
        [name]: !state[name],
@@ -1863,7 +1873,21 @@ const collectInventory = (state, data, prizeMap) => {
                if (dungeon.prize) {
                        const isCrystal = prizeMap[dungeon.offset].isCrystal;
                        const prizeFlags = data[isCrystal ? INV_ADDR.CRYSTALS : INV_ADDR.PENDANTS];
-                       state[`${dungeon.id}-prize-acquired`] = !!(prizeFlags & prizeMap[dungeon.offset].mask);
+                       const prizeAcquired = !!(prizeFlags & prizeMap[dungeon.offset].mask);
+                       state[`${dungeon.id}-prize-acquired`] = prizeAcquired;
+                       if (prizeAcquired) {
+                               if (!isCrystal) {
+                                       if (prizeMap[dungeon.offset].mask === 1) {
+                                               state[`${dungeon.id}-prize`] = 'red-pendant';
+                                       } else if (prizeMap[dungeon.offset].mask === 2) {
+                                               state[`${dungeon.id}-prize`] = 'blue-pendant';
+                                       } else if (prizeMap[dungeon.offset].mask === 4) {
+                                               state[`${dungeon.id}-prize`] = 'green-pendant';
+                                       }
+                               } else {
+                                       state[`${dungeon.id}-prize`] = 'crystal';
+                               }
+                       }
                }
        });
 };