]> git.localhorst.tv Git - alttp.git/commitdiff
alternative dungeon counting
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 4 Apr 2024 14:12:05 +0000 (16:12 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 4 Apr 2024 14:12:05 +0000 (16:12 +0200)
resources/js/components/tracker/ConfigDialog.js
resources/js/helpers/alttp-ram.js
resources/js/helpers/tracker.js
resources/js/i18n/de.js
resources/js/i18n/en.js

index 2a5fbd68645d367609b46de019536653a4e67c7d..db6df71418af5e73a59ed92bec4c9e7e1f75773c 100644 (file)
@@ -301,6 +301,27 @@ const ConfigDialog = ({
                                                </Form.Select>
                                        </Form.Group>
                                </Col>
+                               <Col sm={6}>
+                                       <h3>{t('tracker.config.calculation')}</h3>
+                                       <Form.Group
+                                               className="d-flex justify-content-between my-2"
+                                               controlId="tracker.checkCalculation"
+                                       >
+                                               <Form.Label>{t('tracker.config.checkCalculation')}</Form.Label>
+                                               <Form.Select
+                                                       className="w-auto"
+                                                       name="checkCalculation"
+                                                       onChange={handleChange}
+                                                       value={getConfigValue(config, 'checkCalculation', 'room-data')}
+                                               >
+                                                       {['inventory', 'room-data'].map(n =>
+                                                               <option key={n} value={n}>
+                                                                       {t(`tracker.config.checkCalculations.${n}`)}
+                                                               </option>
+                                                       )}
+                                               </Form.Select>
+                                       </Form.Group>
+                               </Col>
                        </Row>
                </Modal.Body>
        </Modal>;
index d5bfa1bf2ef8f581c78907a09814b456664286ee..975f256fb7f72fc7433b9d7abb721fd5c31c375a 100644 (file)
@@ -76,6 +76,8 @@ export const INV_ADDR = {
        RANDO_POWDER: 0x4C,
        RANDO_FLUTE: 0x4C,
        RANDO_BOW: 0x4E,
+       RANDO_CHECKS_START: 0x180,
+       RANDO_CHECKS_END: 0x18F,
        RANDO_KEY_START: 0x1A0,
        RANDO_KEY_END: 0x1AF,
 };
index 6307eda6f026824251eb6e36ebdede95728bbcd0..f73aa669823ad24db0e345dcd39bc582dadd3fae 100644 (file)
@@ -84,6 +84,7 @@ export const BOSSES = [
 
 export const CONFIG = {
        bossShuffle: false,
+       checkCalculation: 'room-data',
        glitches: 'none',
        mapLayout: 'horizontal',
        showMap: 'situational',
@@ -1857,6 +1858,8 @@ const collectInventory = (state, data, prizeMap) => {
                state[`${dungeon.id}-compass`] = !!(compass & dungeon.mask);
                state[`${dungeon.id}-small-key`] = data[INV_ADDR.RANDO_KEY_START + dungeon.offset];
                state[`${dungeon.id}-big-key`] = !!(bigKey & dungeon.mask);
+               state[`${dungeon.id}-checks-collected`] =
+                       data[INV_ADDR.RANDO_CHECKS_START + dungeon.offset];
                if (dungeon.prize) {
                        const isCrystal = prizeMap[dungeon.offset].isCrystal;
                        const prizeFlags = data[isCrystal ? INV_ADDR.CRYSTALS : INV_ADDR.PENDANTS];
@@ -1885,11 +1888,15 @@ const getDungeonAmounts = (config, state) => {
        DUNGEONS.forEach(dungeon => {
                let amount = 0;
                let total = dungeon.checks.length;
-               dungeon.checks.forEach(check => {
-                       if (state[check]) {
-                               ++amount;
-                       }
-               });
+               if (config.checkCalculation === 'inventory') {
+                       amount = state[`${dungeon.id}-checks-collected`];
+               } else {
+                       dungeon.checks.forEach(check => {
+                               if (state[check]) {
+                                       ++amount;
+                               }
+                       });
+               }
                if (!config.wildMap && state[`${dungeon.id}-map`]) {
                        --amount;
                        --total;
index 4f010bd1ab7c6c14ef7fafd683960c0000380cb6..5bba519c84e001835e4bb6d51c6b8a8e30c491f7 100644 (file)
@@ -503,6 +503,12 @@ export default {
                tracker: {
                        config: {
                                bossShuffle: 'Boss Shuffle',
+                               calculation:  'Berechnung',
+                               checkCalculation: 'Dungeon Checks',
+                               checkCalculations: {
+                                       inventory: 'Inventar (Doors)',
+                                       'room-data': 'Raumdaten (Glitched)',
+                               },
                                ganonCrystals: 'Ganon Crystals',
                                glitches: 'Glitches',
                                glitchRules: {
index b1cd6d9ee51d688b4512fd2599e0ed1675506fc6..b14fa9449001ba6a06215ee46c95c5b42b8a49c9 100644 (file)
@@ -503,6 +503,12 @@ export default {
                tracker: {
                        config: {
                                bossShuffle: 'Boss Shuffle',
+                               calculation:  'Calculation',
+                               checkCalculation: 'Dungeon checks',
+                               checkCalculations: {
+                                       inventory: 'Inventory (Doors)',
+                                       'room-data': 'Room data (glitched)',
+                               },
                                ganonCrystals: 'Ganon Crystals',
                                glitches: 'Glitches',
                                glitchRules: {