define shared parts in base-actor-sheet

This commit is contained in:
jalensailin
2025-07-22 14:16:24 -04:00
parent 00c8531f46
commit bafeb402be
5 changed files with 42 additions and 44 deletions
+5 -17
View File
@@ -31,15 +31,9 @@ export default class DGAgentSheet extends DGActorSheet {
});
static PARTS = /** @type {const} */ ({
header: {
template: `${this.TEMPLATE_PATH}/parts/header.html`,
},
tabs: super.PARTS.tabs,
skills: {
template: `${this.TEMPLATE_PATH}/parts/skills-tab.html`,
templates: [`${this.TEMPLATE_PATH}/partials/custom-skills-partial.html`],
scrollable: [""],
},
header: this.BASE_PARTS.header,
tabs: this.BASE_PARTS.tabs,
skills: this.BASE_PARTS.skills,
physical: {
template: `${this.TEMPLATE_PATH}/parts/physical-tab.html`,
templates: [
@@ -50,10 +44,7 @@ export default class DGAgentSheet extends DGActorSheet {
motivations: {
template: `${this.TEMPLATE_PATH}/parts/motivations-tab.html`,
},
gear: {
template: `${this.TEMPLATE_PATH}/parts/gear-tab.html`,
scrollable: [""],
},
gear: this.BASE_PARTS.gear,
bio: {
template: `${this.TEMPLATE_PATH}/parts/bio-tab.html`,
templates: [`${this.TEMPLATE_PATH}/partials/cv-partial.html`],
@@ -63,10 +54,7 @@ export default class DGAgentSheet extends DGActorSheet {
template: `${this.TEMPLATE_PATH}/parts/bonds-tab.html`,
scrollable: [""],
},
about: {
template: `${this.TEMPLATE_PATH}/parts/about-tab.html`,
scrollable: [""],
},
about: this.BASE_PARTS.about,
});
/* -------------------------------------------- */
+21 -3
View File
@@ -30,13 +30,31 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) {
},
});
static TEMPLATE_PATH = `${super.TEMPLATE_PATH}/actor`;
/** @override - Singular reference to the actor templates path */
static TEMPLATE_PATH = /** @type {const} */ (`${super.TEMPLATE_PATH}/actor`);
static PARTS = {
/** Holds base/shared parts of sheets for subclasses to reference. */
static BASE_PARTS = /** @type {const} */ ({
header: {
template: `${this.TEMPLATE_PATH}/parts/header.html`,
},
tabs: {
template: `templates/generic/tab-navigation.hbs`, // From FoundryVTT
},
};
skills: {
template: `${this.TEMPLATE_PATH}/parts/skills-tab.html`,
templates: [`${this.TEMPLATE_PATH}/partials/custom-skills-partial.html`],
scrollable: [""],
},
gear: {
template: `${this.TEMPLATE_PATH}/parts/gear-tab.html`,
scrollable: [""],
},
about: {
template: `${this.TEMPLATE_PATH}/parts/about-tab.html`,
scrollable: [""],
},
});
/** @override */
async _prepareContext(options) {
+6 -18
View File
@@ -17,26 +17,14 @@ export default class DGNPCSheet extends DGActorSheet {
/** @override */
static PARTS = /** @type {const} */ ({
header: {
template: `${this.TEMPLATE_PATH}/parts/header.html`,
},
physical: {
header: this.BASE_PARTS.header,
statistics: {
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: [""],
},
gear: {
template: `${this.TEMPLATE_PATH}/parts/gear-tab.html`,
scrollable: [""],
},
about: {
template: `${this.TEMPLATE_PATH}/parts/about-tab.html`,
scrollable: [""],
},
tabs: this.BASE_PARTS.tabs,
skills: this.BASE_PARTS.skills,
gear: this.BASE_PARTS.gear,
about: this.BASE_PARTS.about,
});
/* -------------------------------------------- */
+6 -4
View File
@@ -1,11 +1,13 @@
<input type="text"
<input class="centered"
type="text"
name="system.sanity.value"
value="{{actor.system.sanity.value}}"
data-dtype="Number"
title="{{localize 'DG.Tooltip.CurrentSanityPartOne'}}{{actor.system.sanity.currentBreakingPoint}}{{localize 'DG.Tooltip.CurrentSanityPartTwo'}}" />
data-tooltip="{{localize 'DG.Tooltip.CurrentSanityPartOne'}}{{actor.system.sanity.currentBreakingPoint}}{{localize 'DG.Tooltip.CurrentSanityPartTwo'}}" />
<span>{{localize 'DG.NPCSheet.BreakPointAbbreviation'}}:</span>
<input type="text"
<input class="centered"
type="text"
name="system.sanity.currentBreakingPoint"
value="{{actor.system.sanity.currentBreakingPoint}}"
data-dtype="Number"
title="{{localize 'DG.Tooltip.BreakPoint'}}" />
data-tooltip="{{localize 'DG.Tooltip.BreakPoint'}}" />
@@ -1,7 +1,9 @@
<input type="text"
<input class="centered"
type="text"
name="system.sanity.successLoss"
value="{{actor.system.sanity.successLoss}}" />
<span>/</span>
<input type="text"
<input class="centered"
type="text"
name="system.sanity.failedLoss"
value="{{actor.system.sanity.failedLoss}}" />