diff --git a/module/Apps/ActorSheets/BookGeistSheet.mjs b/module/Apps/ActorSheets/BookGeistSheet.mjs index 5c39a1d..7a6aa06 100644 --- a/module/Apps/ActorSheets/BookGeistSheet.mjs +++ b/module/Apps/ActorSheets/BookGeistSheet.mjs @@ -124,7 +124,6 @@ export class BookGeistSheet extends }; async _prepareItemsContext(ctx) { - ctx.attacks = []; ctx.defense = { locations: `None`, protection: 0, @@ -136,9 +135,15 @@ export class BookGeistSheet extends switch (item.type) { case `weapon`: { if (!item.system.equipped) { continue }; + ctx.attacks ??= []; ctx.attacks.push(this._prepareWeapon(item)); break; }; + case `craft`: { + ctx.crafts ??= []; + ctx.crafts.push(this._prepareCraft(item)); + break; + }; case `trait`: { ctx.traits.push(this._prepareTrait(item)); break; @@ -148,14 +153,25 @@ export class BookGeistSheet extends }; _prepareWeapon(weapon) { + const hasShortRange = weapon.system.range.short != null; + const hasLongRange = weapon.system.range.long != null; + const isRanged = hasShortRange || hasLongRange; return { uuid: weapon.uuid, name: weapon.name, damage: weapon.system.damage, + isRanged, range: weapon.system.range, }; }; + _prepareCraft(craft) { + return { + uuid: craft.uuid, + name: craft.name, + }; + }; + _prepareTrait(trait) { return { uuid: trait.uuid, diff --git a/templates/Apps/BookGeistSheet/items.hbs b/templates/Apps/BookGeistSheet/items.hbs index 937f546..c60ba24 100644 --- a/templates/Apps/BookGeistSheet/items.hbs +++ b/templates/Apps/BookGeistSheet/items.hbs @@ -1,18 +1,38 @@