From e9e1ccc9f8b4a6fc0d4d4ce54a710832227e3da0 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 4 Apr 2024 16:12:05 +0200 Subject: [PATCH] alternative dungeon counting --- .../js/components/tracker/ConfigDialog.js | 21 +++++++++++++++++++ resources/js/helpers/alttp-ram.js | 2 ++ resources/js/helpers/tracker.js | 17 ++++++++++----- resources/js/i18n/de.js | 6 ++++++ resources/js/i18n/en.js | 6 ++++++ 5 files changed, 47 insertions(+), 5 deletions(-) diff --git a/resources/js/components/tracker/ConfigDialog.js b/resources/js/components/tracker/ConfigDialog.js index 2a5fbd6..db6df71 100644 --- a/resources/js/components/tracker/ConfigDialog.js +++ b/resources/js/components/tracker/ConfigDialog.js @@ -301,6 +301,27 @@ const ConfigDialog = ({ + +

{t('tracker.config.calculation')}

+ + {t('tracker.config.checkCalculation')} + + {['inventory', 'room-data'].map(n => + + )} + + + ; diff --git a/resources/js/helpers/alttp-ram.js b/resources/js/helpers/alttp-ram.js index d5bfa1b..975f256 100644 --- a/resources/js/helpers/alttp-ram.js +++ b/resources/js/helpers/alttp-ram.js @@ -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, }; diff --git a/resources/js/helpers/tracker.js b/resources/js/helpers/tracker.js index 6307eda..f73aa66 100644 --- a/resources/js/helpers/tracker.js +++ b/resources/js/helpers/tracker.js @@ -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; diff --git a/resources/js/i18n/de.js b/resources/js/i18n/de.js index 4f010bd..5bba519 100644 --- a/resources/js/i18n/de.js +++ b/resources/js/i18n/de.js @@ -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: { diff --git a/resources/js/i18n/en.js b/resources/js/i18n/en.js index b1cd6d9..b14fa94 100644 --- a/resources/js/i18n/en.js +++ b/resources/js/i18n/en.js @@ -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: { -- 2.39.2