diff --git a/module/models/Item/CommonItemData.mjs b/module/models/Item/CommonItemData.mjs index fb32dc7..abcbb5a 100644 --- a/module/models/Item/CommonItemData.mjs +++ b/module/models/Item/CommonItemData.mjs @@ -10,6 +10,10 @@ export class CommonItemData extends foundry.abstract.TypeDataModel { nullable: false, integer: true, }), + uses_inventory_slot: new fields.BooleanField({ + initial: true, + nullable: false, + }), buy: new fields.NumberField({ initial: null, nullable: true, diff --git a/module/sheets/Actors/PC/PlayerSheetV2.mjs b/module/sheets/Actors/PC/PlayerSheetV2.mjs index 0b5b47c..feac28a 100644 --- a/module/sheets/Actors/PC/PlayerSheetV2.mjs +++ b/module/sheets/Actors/PC/PlayerSheetV2.mjs @@ -58,6 +58,7 @@ export class PlayerSheetv2 extends GenericActorSheet { canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`), stats: this.#statData, itemFilters: this.#itemFilters, + capacity: this.#inventoryCapacity, }; console.log(ctx) return ctx; @@ -134,6 +135,14 @@ export class PlayerSheetv2 extends GenericActorSheet { return filters; }; + get #inventoryCapacity() { + return { + used: this.actor.items + .reduce((sum, i) => sum + i.system.uses_inventory_slot ? i.system.quantity : 0, 0), + max: this.actor.system.inventory_slots, + }; + }; + _updateObject(...args) { console.log(args) super._updateObject(...args); diff --git a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs index 5dc0340..0270e40 100644 --- a/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/inventory/player.v2.pc.hbs @@ -5,10 +5,9 @@ {{> dotdungeon.pc.v2.item-list }}