FEAT: getTags and getLabels for weapons items

This commit is contained in:
Joaquin Pereyra 2025-07-28 23:37:19 -03:00
parent e6bfe08d83
commit 4d965c5dc2
4 changed files with 124 additions and 56 deletions

View file

@ -15,40 +15,33 @@ Parameters:
- showActions {boolean} : If true show feature's actions.
--}}
<li class="inventory-item" {{#if (or (eq type 'action' ) (eq type 'attack'))}}data-action-id="{{item.id}}" {{/if}}
<li class="inventory-item" {{#if (or (eq type 'action' ) (eq type 'attack' ))}}data-action-id="{{item.id}}" {{/if}}
data-item-uuid="{{item.uuid}}" data-type="{{type}}" draggable="true">
<div class="inventory-item-header" {{#unless noExtensible}}data-action="toggleExtended" {{/unless}}>
{{!-- Image --}}
<div class="img-portait"
data-action='{{ifThen (or (hasProperty item "use") (eq type 'attack')) "useItem" (ifThen (hasProperty item "toChat") "toChat" "editDoc") }}'
{{#unless hideTooltip}}
{{#if (eq type 'attack')}}
data-tooltip="#attack#{{item.actor.uuid}}"
{{else}}
data-tooltip="#item#{{item.uuid}}"
{{/if}}
{{/unless}}
>
<div class="img-portait" data-action='{{ifThen (or (hasProperty item "use") (eq type ' attack')) "useItem" (ifThen
(hasProperty item "toChat" ) "toChat" "editDoc" ) }}' {{#unless hideTooltip}} {{#if (eq type 'attack' )}}
data-tooltip="#attack#{{item.actor.uuid}}" {{else}} data-tooltip="#item#{{item.uuid}}" {{/if}} {{/unless}}>
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" />
<img class="roll-img" src="systems/daggerheart/assets/icons/dice/default/d20.svg" alt="d20">
</div>
{{!-- Name & Tags --}}
<div class="item-label {{#if hideResources}}fullWidth{{/if}}">
<div class="item-label">
{{!-- Item Name --}}
<div class="item-name">{{localize item.name}}</div>
{{!-- Attack Block Start --}}
{{#if (eq type 'attack')}}
<div class="item-tags">
<div class="tag">
{{localize 'DAGGERHEART.GENERAL.unarmed'}}
</div>
<div class="tag">
{{localize 'DAGGERHEART.CONFIG.ActionType.action'}}
</div>
</div>
{{#if (eq type 'attack')}}
<div class="item-tags">
<div class="tag">
{{localize 'DAGGERHEART.GENERAL.unarmed'}}
</div>
<div class="tag">
{{localize 'DAGGERHEART.CONFIG.ActionType.action'}}
</div>
</div>
{{/if}}
{{!-- Attack Block End --}}
@ -56,43 +49,27 @@ Parameters:
{{#if (eq type 'weapon')}}
{{#if (not hideTags)}}
<div class="item-tags">
{{#each item.getTags as |tag|}}
<div class="tag">
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
</div>
<div class="tag">
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
</div>
<div class="tag">
{{item.system.attack.damage.parts.0.value.dice}}
{{#if item.system.attack.damage.parts.0.value.bonus}} +
{{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
(
{{#each item.system.attack.damage.parts.0.type as |type|}}
{{localize (concat 'DAGGERHEART.CONFIG.DamageType.' type '.abbreviation')}}
{{#unless @last}}|{{/unless}}
{{/each}}
)
</div>
<div class="tag">
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
{{tag}}
</div>
{{/each}}
</div>
{{else if (not hideLabels)}}
<div class="item-labels">
{{#each item.getLabels as |label|}}
<div class="label">
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}}
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.short')}}
<span> - </span>
{{item.system.attack.damage.parts.0.value.dice}}
{{#if item.system.attack.damage.parts.0.value.bonus}} +
{{item.system.attack.damage.parts.0.value.bonus}}
{{ifThen label.value label.value label}}
{{log label.icons}}
{{#each label.icons as |icon|}}
<i class="fa-solid {{icon}}"></i>
{{/each}}
{{#if (not @last)}}
<span>-</span>
{{/if}}
{{#with (lookup @root.config.GENERAL.damageTypes item.system.attack.damage.parts.0.type)}}
{{#each icon}}<i class="fa-solid {{this}}"></i>{{/each}}
{{/with}}
</div>
{{/each}}
</div>
{{/if}}
{{/if}}