daggerheart/templates/sheets/global/partials/item-resource.hbs
Carlos Fernandez fe80b4d0f8
[PR] [Feature] Refocus consumable quantity and simple resource fields on change (#1401)
* Refocus quantity and simple resource fields on change

* Swap to uuid
2025-12-20 23:08:24 +01:00

28 lines
No EOL
1.9 KiB
Handlebars

{{#if (eq item.system.resource.type 'simple')}}
<div class="item-resource">
<i class="{{#if item.system.resource.icon}}{{item.system.resource.icon}}{{else}}fa-solid fa-hashtag{{/if}}"></i>
<input type="number" id="{{item.uuid}}-resource" class="inventory-item-resource" value="{{item.system.resource.value}}" min="0" max="{{rollParsed item.system.resource.max item.actor item true}}" />
</div>
{{else if (eq item.system.resource.type 'diceValue')}}
<div class="item-resources">
{{#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 |}}
<a class="item-resource" data-action="toggleResourceDice" data-dice="{{#if ../../this}}{{../this}}{{else}}{{state}}{{/if}}">
<div class="item-dice-resource">
<label>{{ifThen state.value state.value '?'}}</label>
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/" (ifThen ../../item.system.resource.dieFaces ../../item.system.resource.dieFaces ../item.system.resource.dieFaces) ".svg"}}" />
{{#if state.used}}<i class="fa-solid fa-x"></i>{{/if}}
</div>
</a>
{{/with}}
{{/times}}
<a data-action="handleResourceDice" data-tooltip="DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"><i class="fa-solid fa-dice resource-edit"></i></a>
</div>
{{else if (eq item.system.resource.type 'die')}}
<a class="item-resource die" data-action="advanceResourceDie">
<div class="item-dice-resource">
<label>{{#if item.system.resource.value}}{{item.system.resource.value}}{{/if}}</label>
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/" item.system.resource.dieFaces ".svg"}}" />
</div>
</a>
{{/if}}