]> git.localhorst.tv Git - alttp.git/commitdiff
pendant auto tracking
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 4 Apr 2024 15:00:44 +0000 (17:00 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 4 Apr 2024 15:00:44 +0000 (17:00 +0200)
resources/js/helpers/tracker.js

index f73aa669823ad24db0e345dcd39bc582dadd3fae..06513cc8cbbde446bcac77f1da3650e603a8d086 100644 (file)
@@ -1863,7 +1863,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';
+                               }
+                       }
                }
        });
 };