Make Physical Attribute tab work with NPC/Unnatural sheets

This commit is contained in:
jalensailin
2025-07-22 13:18:27 -04:00
parent 14433b55a9
commit 8f050d34d1
4 changed files with 50 additions and 44 deletions
+5
View File
@@ -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;
}
+8 -8
View File
@@ -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,
@@ -1,35 +1,40 @@
<div class="grid grid-3col">
{{#each actor.system.statistics as |statistic key| }}
<div class="flex-group-center flex-mid-border">
<div>
<div class="physical-stats-outer-grid-3col">
<label class="rollable resource-label"
data-action="roll"
data-rolltype="stat"
data-key="{{key}}"
data-tooltip="{{localize (concat 'DG.Attributes.Tooltip.' key)}}"
for="system.statistics.{{key}}.value">
{{localize (concat 'DG.Attributes.' key)}}
</label>
<input class="centered"
type="text"
name="system.statistics.{{key}}.value"
value="{{statistic.value}}"
data-dtype="Number" />
<span class="rollable"
data-action="roll"
data-rolltype="stat"
data-key="{{key}}"
title="{{localize 'DG.Tooltip.x5AttributeLabel'}}">({{numberFormat statistic.x5 decimals=0 sign=false}}% <i class="fas fa-dice"></i>)</span>
</div>
<section class="attributes-wrapper">
<div class="horizontal-bar-section-divider">
<span>{{physicalAttributesTitle}}</span>
</div>
<div class="grid grid-3col">
{{#each actor.system.statistics as |statistic key| }}
<div class="flex-group-center flex-mid-border">
<div>
<input type="text"
name="system.statistics.{{key}}.distinguishing_feature"
value="{{statistic.distinguishing_feature}}"
data-dtype="String"
title="{{localize 'DG.Tooltip.DistinguishingFeature'}}" />
<div class="physical-stats-outer-grid-3col">
<label class="rollable resource-label"
data-action="roll"
data-rolltype="stat"
data-key="{{key}}"
data-tooltip="{{localize (concat 'DG.Attributes.Tooltip.' key)}}"
for="system.statistics.{{key}}.value">
{{localize (concat 'DG.Attributes.' key)}}
</label>
<input class="centered"
type="text"
name="system.statistics.{{key}}.value"
value="{{statistic.value}}"
data-dtype="Number" />
<span class="rollable"
data-action="roll"
data-rolltype="stat"
data-key="{{key}}"
title="{{localize 'DG.Tooltip.x5AttributeLabel'}}">({{numberFormat statistic.x5 decimals=0 sign=false}}% <i class="fas fa-dice"></i>)</span>
</div>
<div>
<input type="text"
name="system.statistics.{{key}}.distinguishing_feature"
value="{{statistic.distinguishing_feature}}"
data-dtype="String"
title="{{localize 'DG.Tooltip.DistinguishingFeature'}}" />
</div>
</div>
</div>
</div>
{{/each}}
</div>
{{/each}}
</div>
</section>
-4
View File
@@ -3,10 +3,6 @@
data-group="primary"
data-tab="physical">
<div class="horizontal-bar-section-divider">
<span>{{localize "DG.Sheet.BlockHeaders.Attributes"}}</span>
</div>
{{> "systems/deltagreen/templates/actor/partials/attributes-grid-partial.html" actorType="agent"}}
<br />