From 8f050d34d13e36a5b6fa5c3d51b7e8a8cf4383f3 Mon Sep 17 00:00:00 2001 From: jalensailin Date: Tue, 22 Jul 2025 13:18:27 -0400 Subject: [PATCH] Make Physical Attribute tab work with NPC/Unnatural sheets --- module/sheets/base-actor-sheet.js | 5 ++ module/sheets/npc-sheet.js | 16 ++--- .../partials/attributes-grid-partial.html | 69 ++++++++++--------- templates/actor/parts/physical-tab.html | 4 -- 4 files changed, 50 insertions(+), 44 deletions(-) diff --git a/module/sheets/base-actor-sheet.js b/module/sheets/base-actor-sheet.js index 20cb78e..fff05d7 100644 --- a/module/sheets/base-actor-sheet.js +++ b/module/sheets/base-actor-sheet.js @@ -173,6 +173,11 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) { this.actor.system.sortedCustomSkills = sortedCustomSkills; } + // Set title for Physical Attributes. + context.physicalAttributesTitle = game.i18n.localize( + "DG.Sheet.BlockHeaders.Attributes", + ); + return context; } diff --git a/module/sheets/npc-sheet.js b/module/sheets/npc-sheet.js index 510f2a3..79260ad 100644 --- a/module/sheets/npc-sheet.js +++ b/module/sheets/npc-sheet.js @@ -9,7 +9,6 @@ export default class DGNPCSheet extends DGActorSheet { labelPrefix: "DG.Navigation", tabs: [ { id: "skills", label: "Skills" }, - { id: "physical", label: "Physical" }, { id: "gear", label: "Gear" }, { id: "about", icon: "fas fa-question-circle", label: "" }, ], @@ -21,19 +20,15 @@ export default class DGNPCSheet extends DGActorSheet { header: { template: `${this.TEMPLATE_PATH}/parts/header.html`, }, + physical: { + template: `${this.TEMPLATE_PATH}/partials/attributes-grid-partial.html`, + }, tabs: super.PARTS.tabs, skills: { template: `${this.TEMPLATE_PATH}/parts/skills-tab.html`, templates: [`${this.TEMPLATE_PATH}/partials/custom-skills-partial.html`], scrollable: [""], }, - physical: { - template: `${this.TEMPLATE_PATH}/parts/physical-tab.html`, - templates: [ - `${this.TEMPLATE_PATH}/partials/attributes-grid-partial.html`, - ], - scrollable: [""], - }, gear: { template: `${this.TEMPLATE_PATH}/parts/gear-tab.html`, scrollable: [""], @@ -50,6 +45,11 @@ export default class DGNPCSheet extends DGActorSheet { async _prepareContext(options) { const context = await super._prepareContext(options); + // Override physical attribute title. + context.physicalAttributesTitle = game.i18n.localize( + "DG.Sheet.BlockHeaders.Statistics", + ); + context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML( this.actor.system.notes, diff --git a/templates/actor/partials/attributes-grid-partial.html b/templates/actor/partials/attributes-grid-partial.html index 25aff6f..6d9a53c 100644 --- a/templates/actor/partials/attributes-grid-partial.html +++ b/templates/actor/partials/attributes-grid-partial.html @@ -1,35 +1,40 @@ -
- {{#each actor.system.statistics as |statistic key| }} -
-
-
- - - ({{numberFormat statistic.x5 decimals=0 sign=false}}% ) -
+
+
+ {{physicalAttributesTitle}} +
+
+ {{#each actor.system.statistics as |statistic key| }} +
- +
+ + + ({{numberFormat statistic.x5 decimals=0 sign=false}}% ) +
+
+ +
-
- {{/each}} -
+ {{/each}} +
+ diff --git a/templates/actor/parts/physical-tab.html b/templates/actor/parts/physical-tab.html index 66e5f22..14b5f09 100644 --- a/templates/actor/parts/physical-tab.html +++ b/templates/actor/parts/physical-tab.html @@ -3,10 +3,6 @@ data-group="primary" data-tab="physical"> -
- {{localize "DG.Sheet.BlockHeaders.Attributes"}} -
- {{> "systems/deltagreen/templates/actor/partials/attributes-grid-partial.html" actorType="agent"}}