Add the capacity display (closes #96)
This commit is contained in:
parent
b6ca477be7
commit
aab71df1fc
3 changed files with 16 additions and 4 deletions
|
|
@ -10,6 +10,10 @@ export class CommonItemData extends foundry.abstract.TypeDataModel {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
integer: true,
|
integer: true,
|
||||||
}),
|
}),
|
||||||
|
uses_inventory_slot: new fields.BooleanField({
|
||||||
|
initial: true,
|
||||||
|
nullable: false,
|
||||||
|
}),
|
||||||
buy: new fields.NumberField({
|
buy: new fields.NumberField({
|
||||||
initial: null,
|
initial: null,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ export class PlayerSheetv2 extends GenericActorSheet {
|
||||||
canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`),
|
canAddAspect: !await actor.proxyFunction.bind(actor)(`atAspectLimit`),
|
||||||
stats: this.#statData,
|
stats: this.#statData,
|
||||||
itemFilters: this.#itemFilters,
|
itemFilters: this.#itemFilters,
|
||||||
|
capacity: this.#inventoryCapacity,
|
||||||
};
|
};
|
||||||
console.log(ctx)
|
console.log(ctx)
|
||||||
return ctx;
|
return ctx;
|
||||||
|
|
@ -134,6 +135,14 @@ export class PlayerSheetv2 extends GenericActorSheet {
|
||||||
return filters;
|
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) {
|
_updateObject(...args) {
|
||||||
console.log(args)
|
console.log(args)
|
||||||
super._updateObject(...args);
|
super._updateObject(...args);
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,9 @@
|
||||||
{{> dotdungeon.pc.v2.item-list }}
|
{{> dotdungeon.pc.v2.item-list }}
|
||||||
<div class="e-1dp panel capacity-panel">
|
<div class="e-1dp panel capacity-panel">
|
||||||
<h2>Capacity</h2>
|
<h2>Capacity</h2>
|
||||||
{{!-- This will need some aria love --}}
|
<span class="used">{{computed.capacity.used}}</span>
|
||||||
<span class="used">X</span>
|
<span aria-label="inventory slots used out of">/</span>
|
||||||
<span>/</span>
|
<span class="total">{{computed.capacity.max}}</span>
|
||||||
<span class="total">Y</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="e-1dp panel bytes-panel">
|
<div class="e-1dp panel bytes-panel">
|
||||||
<label
|
<label
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue