Improved the datastructure some to avoid errors and simplify useage (#361)

This commit is contained in:
WBHarry 2025-07-17 19:07:11 +02:00 committed by GitHub
parent f15483c722
commit 1d5e267285
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 14 deletions

View file

@ -3,14 +3,14 @@
{{#times (rollParsed item.system.resource.max actor item numerical=true)}}
{{#with (ifThen (lookup ../diceStates this) (lookup ../diceStates this) this) as | state |}}
<div class="resource-item" data-dice="{{#if ../../this}}{{../this}}{{else}}{{state}}{{/if}}">
<input type="number" data-dtype="Number" name={{concat "diceStates." (ifThen ../../this ../this state) ".value" }} value="{{state.value}}" />
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/d" (ifThen ../../item.system.resource.dieFaces ../../item.system.resource.dieFaces ../item.system.resource.dieFaces) ".svg"}}" />
<input type="number" data-dtype="Number" name={{concat "diceStates." (ifThen ../../this ../this state) ".value" }} value="{{state.value}}" min="1" />
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/" (ifThen ../../item.system.resource.dieFaces ../../item.system.resource.dieFaces ../item.system.resource.dieFaces) ".svg"}}" />
</div>
{{/with}}
{{/times}}
</div>
<footer>
<button data-action="save">{{localize 'Save'}}</button>
<button data-action="rerollDice">{{localize "DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"}}</button>
<button type="button" data-action="save">{{localize 'Save'}}</button>
<button type="button" data-action="rerollDice">{{localize "DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"}}</button>
</footer>
</section>