From 90e536b132eeb308e4c6de5fe997139141cce977 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Wed, 30 Jul 2025 20:12:29 +0200 Subject: [PATCH] Restored simple view --- daggerheart.mjs | 4 +-- .../sheets/global/partials/item-resource.hbs | 33 +++++++++++-------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/daggerheart.mjs b/daggerheart.mjs index 0d9d5ae1..1366dc60 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -240,12 +240,12 @@ Hooks.on('moveToken', async (movedToken, data) => { const effectsAutomation = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).effects; if (!effectsAutomation.rangeDependent) return; - const rangeDependantEffects = movedToken.actor.effects.filter(effect => effect.system.rangeDependence.enabled); + const rangeDependantEffects = movedToken.actor.effects.filter(effect => effect.system.rangeDependence?.enabled); const updateEffects = async (disposition, token, effects, effectUpdates) => { const rangeMeasurement = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.RangeMeasurement); - for (let effect of effects.filter(x => x.system.rangeDependence.enabled)) { + for (let effect of effects.filter(x => x.system.rangeDependence?.enabled)) { const { target, range, type } = effect.system.rangeDependence; if ((target === 'friendly' && disposition !== 1) || (target === 'hostile' && disposition !== -1)) return false; diff --git a/templates/sheets/global/partials/item-resource.hbs b/templates/sheets/global/partials/item-resource.hbs index 85977158..b29c818e 100644 --- a/templates/sheets/global/partials/item-resource.hbs +++ b/templates/sheets/global/partials/item-resource.hbs @@ -1,14 +1,21 @@ -
+{{#if (eq item.system.resource.type 'simple')}} +
+ + +
+{{else}} +
{{#times (rollParsed item.system.resource.max item.parent item numerical=true)}} - {{#with (ifThen (lookup ../item.system.resource.diceStates this) (lookup ../item.system.resource.diceStates this) this) as | state |}} - -
- - - {{#if state.used}}{{/if}} -
-
- {{/with}} - {{/times}} - -
\ No newline at end of file + {{#with (ifThen (lookup ../item.system.resource.diceStates this) (lookup ../item.system.resource.diceStates this) this) as | state |}} + +
+ + + {{#if state.used}}{{/if}} +
+
+ {{/with}} + {{/times}} + +
+{{/if}} \ No newline at end of file