Fixed DiceValues placement in InventoryItemV2. Fixed parsing of ITEM.@ paths

This commit is contained in:
WBHarry 2025-07-30 19:21:08 +02:00
parent 7bbbdce739
commit e7fcd9af99
3 changed files with 29 additions and 36 deletions

View file

@ -307,8 +307,8 @@ export function updateLinkedItemApps(options, sheet) {
export const itemAbleRollParse = (value, actor, item) => { export const itemAbleRollParse = (value, actor, item) => {
if (!value) return value; if (!value) return value;
const isItemTarget = value.toLowerCase().replace('item.@', '@'); const isItemTarget = value.toLowerCase().includes('item.@');
const slicedValue = isItemTarget ? value.slice(5) : value; const slicedValue = isItemTarget ? value.replaceAll(/item\.@/gi, '@') : value;
try { try {
return Roll.replaceFormulaData(slicedValue, isItemTarget ? item : actor); return Roll.replaceFormulaData(slicedValue, isItemTarget ? item : actor);
} catch (_) { } catch (_) {

View file

@ -241,6 +241,7 @@ Parameters:
{{#unless hideDescription}} {{#unless hideDescription}}
<div class="invetory-description"></div> <div class="invetory-description"></div>
{{/unless}} {{/unless}}
</div>
{{!-- Dice Resource --}} {{!-- Dice Resource --}}
{{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}} {{#if (and (not hideResources) (eq item.system.resource.type 'diceValue'))}}
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}} {{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
@ -255,5 +256,4 @@ Parameters:
{{/each}} {{/each}}
</div> </div>
{{/if}} {{/if}}
</div>
</li> </li>

View file

@ -1,9 +1,3 @@
{{#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" class="inventory-item-resource" value="{{item.system.resource.value}}" min="0" max="{{rollParsed item.system.resource.max item.actor item true}}" />
</div>
{{else}}
<div class="item-resources"> <div class="item-resources">
{{#times (rollParsed item.system.resource.max item.parent item numerical=true)}} {{#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 |}} {{#with (ifThen (lookup ../item.system.resource.diceStates this) (lookup ../item.system.resource.diceStates this) this) as | state |}}
@ -18,4 +12,3 @@
{{/times}} {{/times}}
<a data-action="handleResourceDice" data-tooltip="DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"><i class="fa-solid fa-dice resource-edit"></i></a> <a data-action="handleResourceDice" data-tooltip="DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"><i class="fa-solid fa-dice resource-edit"></i></a>
</div> </div>
{{/if}}