mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +01:00
.
This commit is contained in:
parent
2487c200e5
commit
4dfc18f727
3 changed files with 12 additions and 2 deletions
|
|
@ -134,6 +134,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
});
|
||||
htmlElement.querySelectorAll('.inventory-item-quantity').forEach(element => {
|
||||
element.addEventListener('change', this.updateItemQuantity.bind(this));
|
||||
element.addEventListener('click', e => e.stopPropagation());
|
||||
});
|
||||
|
||||
// Add listener for armor marks input
|
||||
|
|
@ -679,7 +680,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
})
|
||||
});
|
||||
|
||||
if(result) game.system.api.fields.ActionFields.CostField.execute.call(this, result);
|
||||
if (result) game.system.api.fields.ActionFields.CostField.execute.call(this, result);
|
||||
}
|
||||
|
||||
//TODO: redo toggleEquipItem method
|
||||
|
|
|
|||
|
|
@ -28,4 +28,13 @@ export default class DHConsumable extends BaseDataItem {
|
|||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/round-potion.svg';
|
||||
|
||||
async _preUpdate(changes, options, userId) {
|
||||
const allowed = await super._preUpdate(changes, options, userId);
|
||||
if (allowed === false) return;
|
||||
|
||||
if (changes.system?.quantity !== undefined && Number(changes.system.quantity) === 0) {
|
||||
this.parent.delete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ Parameters:
|
|||
{{#if (and (not hideResources) (eq item.system.resource.type 'simple'))}}
|
||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||
{{/if}}
|
||||
{{#if (and (not hideResources) item.system.quantity)}}
|
||||
{{#if (and (not hideResources) (gte item.system.quantity 0))}}
|
||||
<div class="item-resource">
|
||||
<input type="number" class="inventory-item-quantity" value="{{item.system.quantity}}" min="0" />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue