From cd69228e680b3f2d680ad058df4d8db02e95bf81 Mon Sep 17 00:00:00 2001 From: Eldritch-Oliver Date: Mon, 13 Oct 2025 21:29:56 -0600 Subject: [PATCH] Add Craft as it's own section item. Display the attack range --- module/Apps/ActorSheets/BookGeistSheet.mjs | 18 +++++++- templates/Apps/BookGeistSheet/items.hbs | 48 +++++++++++++++------- templates/Apps/BookGeistSheet/style.css | 1 + 3 files changed, 52 insertions(+), 15 deletions(-) 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 @@
-
Attacks
-
- {{#each attacks as |attack|}} -
- {{attack.name}} -
- {{else}} - Unarmed! - {{/each}} -
+ {{#if attacks}} +
Attacks
+
+ {{#each attacks as |attack|}} +
+ {{attack.name}} + {{attack.damage}} + {{#if attack.isRanged}} + + ({{attack.range.short}} / {{attack.range.long}}) + + {{/if}} +
+ {{/each}} +
+ {{/if}} + {{#if crafts}} +
Craft
+
+ {{#each crafts as |craft|}} +
+ {{craft.name}} +
+ {{/each}} +
+ {{/if}}
Defense
Armour diff --git a/templates/Apps/BookGeistSheet/style.css b/templates/Apps/BookGeistSheet/style.css index e698743..60cd1bc 100644 --- a/templates/Apps/BookGeistSheet/style.css +++ b/templates/Apps/BookGeistSheet/style.css @@ -19,6 +19,7 @@ display: flex; justify-content: center; align-items: center; + flex-shrink: 0; img { width: 150px;