Update the Actor sheets to not be prefixed with Hero in their files/classes

This commit is contained in:
Oliver-Akins 2025-04-12 13:12:28 -06:00
parent 5b74fd6beb
commit cfc744e42f
14 changed files with 84 additions and 81 deletions

View file

@ -1,9 +1,9 @@
import { CraftCardV1 } from "./CraftCardV1.mjs";
import { filePath } from "../../consts.mjs";
import { GenericAppMixin } from "../GenericApp.mjs";
import { HeroCraftCardV1 } from "./HeroCraftCardV1.mjs";
import { HeroSkillsCardV1 } from "./HeroSkillsCardV1.mjs";
import { HeroSummaryCardV1 } from "./HeroSummaryCardV1.mjs";
import { Logger } from "../../utils/Logger.mjs";
import { SkillsCardV1 } from "./SkillsCardV1.mjs";
import { StatsCardV1 } from "./StatsCardV1.mjs";
const { HandlebarsApplicationMixin } = foundry.applications.api;
const { ActorSheetV2 } = foundry.applications.sheets;
@ -32,10 +32,10 @@ export class CombinedHeroSheet extends GenericAppMixin(HandlebarsApplicationMixi
static PARTS = {
summary: {
template: filePath(`templates/Apps/HeroSummaryCardV1/content.hbs`),
template: filePath(`templates/Apps/StatsCardV1/content.hbs`),
},
skills: {
template: filePath(`templates/Apps/HeroSkillsCardV1/content.hbs`),
template: filePath(`templates/Apps/SkillsCardV1/content.hbs`),
},
craft: {
template: filePath(`templates/Apps/CombinedHeroSheet/crafts.hbs`),
@ -47,8 +47,8 @@ export class CombinedHeroSheet extends GenericAppMixin(HandlebarsApplicationMixi
async _onRender(context, options) {
await super._onRender(context, options);
const summaryElement = this.element.querySelector(`.HeroSummaryCardV1`);
HeroSummaryCardV1._onRender(
const summaryElement = this.element.querySelector(`.StatsCardV1`);
StatsCardV1._onRender(
context,
{
...options,
@ -57,8 +57,8 @@ export class CombinedHeroSheet extends GenericAppMixin(HandlebarsApplicationMixi
},
);
const skillsElement = this.element.querySelector(`.HeroSkillsCardV1`);
HeroSkillsCardV1._onRender.bind(this)(
const skillsElement = this.element.querySelector(`.SkillsCardV1`);
SkillsCardV1._onRender.bind(this)(
context,
{
...options,
@ -68,7 +68,7 @@ export class CombinedHeroSheet extends GenericAppMixin(HandlebarsApplicationMixi
);
const craftsElement = this.element.querySelector(`.crafts-summary`);
HeroCraftCardV1._onRender.bind(this)(
CraftCardV1._onRender.bind(this)(
context,
{
...options,
@ -84,23 +84,23 @@ export class CombinedHeroSheet extends GenericAppMixin(HandlebarsApplicationMixi
switch (partId) {
case `summary`: {
ctx = await HeroSummaryCardV1.prepareGuts(ctx);
ctx = await HeroSummaryCardV1.prepareWeapons(ctx);
ctx = await HeroSummaryCardV1.prepareArmor(ctx);
ctx = await HeroSummaryCardV1.prepareFatePath(ctx);
ctx = await HeroSummaryCardV1.prepareAbilityRow(ctx);
ctx = await HeroSummaryCardV1.prepareSpeed(ctx);
ctx = await HeroSummaryCardV1.prepareLevelData(ctx);
ctx = await StatsCardV1.prepareGuts(ctx);
ctx = await StatsCardV1.prepareWeapons(ctx);
ctx = await StatsCardV1.prepareArmor(ctx);
ctx = await StatsCardV1.prepareFatePath(ctx);
ctx = await StatsCardV1.prepareAbilityRow(ctx);
ctx = await StatsCardV1.prepareSpeed(ctx);
ctx = await StatsCardV1.prepareLevelData(ctx);
break;
};
case `skills`: {
ctx = await HeroSkillsCardV1.prepareGear(ctx);
ctx = await HeroSkillsCardV1.prepareAmmo(ctx);
ctx = await HeroSkillsCardV1.prepareSkills(ctx);
ctx = await SkillsCardV1.prepareGear(ctx);
ctx = await SkillsCardV1.prepareAmmo(ctx);
ctx = await SkillsCardV1.prepareSkills(ctx);
break;
};
case `craft`: {
ctx = await HeroCraftCardV1.prepareCraft(ctx);
ctx = await CraftCardV1.prepareCraft(ctx);
break;
};
};

View file

@ -10,13 +10,13 @@ const { ActorSheetV2 } = foundry.applications.sheets;
const { ContextMenu } = foundry.applications.ui;
const { deepClone } = foundry.utils;
export class HeroCraftCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2)) {
export class CraftCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2)) {
// #region Options
static DEFAULT_OPTIONS = {
classes: [
`ripcrypt--actor`,
`ripcrypt--HeroCraftCardV1`,
`ripcrypt--CraftCardV1`,
],
position: {
width: `auto`,
@ -35,7 +35,7 @@ export class HeroCraftCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(
static PARTS = {
content: {
template: filePath(`templates/Apps/HeroCraftCardV1/content.hbs`),
template: filePath(`templates/Apps/CraftCardV1/content.hbs`),
},
};
// #endregion
@ -43,7 +43,7 @@ export class HeroCraftCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(
// #region Lifecycle
async _onRender(context, options) {
await super._onRender(context, options);
HeroCraftCardV1._onRender.bind(this)(context, options);
CraftCardV1._onRender.bind(this)(context, options);
};
static async _onRender(_context, options) {
@ -80,8 +80,8 @@ export class HeroCraftCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(
ctx = await super._preparePartContext(partId, ctx, opts);
ctx.actor = this.document;
ctx = await HeroCraftCardV1.prepareAura(ctx);
ctx = await HeroCraftCardV1.prepareCraft(ctx);
ctx = await CraftCardV1.prepareAura(ctx);
ctx = await CraftCardV1.prepareCraft(ctx);
Logger.debug(`Context:`, ctx);
return ctx;

View file

@ -13,13 +13,13 @@ const { ActorSheetV2 } = foundry.applications.sheets;
const { ContextMenu } = foundry.applications.ui;
const { deepClone } = foundry.utils;
export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2)) {
export class SkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2)) {
// #region Options
static DEFAULT_OPTIONS = {
classes: [
`ripcrypt--actor`,
`ripcrypt--HeroSkillsCardV1`,
`ripcrypt--SkillsCardV1`,
],
position: {
width: `auto`,
@ -38,7 +38,7 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
static PARTS = {
content: {
template: filePath(`templates/Apps/HeroSkillsCardV1/content.hbs`),
template: filePath(`templates/Apps/SkillsCardV1/content.hbs`),
},
};
// #endregion
@ -46,8 +46,8 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
// #region Lifecycle
async _onRender(context, options) {
await super._onRender(context, options);
HeroSkillsCardV1._onRender.bind(this)(context, options);
HeroSkillsCardV1._createPopoverListeners.bind(this)();
SkillsCardV1._onRender.bind(this)(context, options);
SkillsCardV1._createPopoverListeners.bind(this)();
};
static async _onRender(_context, options) {
@ -80,7 +80,7 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
);
};
/** @this {HeroSkillsCardV1} */
/** @this {SkillsCardV1} */
static async _createPopoverListeners() {
const ammoInfoIcon = this.element.querySelector(`.ammo-info-icon`);
const idPrefix = this.actor.uuid;
@ -96,9 +96,9 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
ctx = await super._preparePartContext(partId, ctx, opts);
ctx.actor = this.document;
ctx = await HeroSkillsCardV1.prepareGear(ctx);
ctx = await HeroSkillsCardV1.prepareAmmo(ctx);
ctx = await HeroSkillsCardV1.prepareSkills(ctx);
ctx = await SkillsCardV1.prepareGear(ctx);
ctx = await SkillsCardV1.prepareAmmo(ctx);
ctx = await SkillsCardV1.prepareSkills(ctx);
ctx.aura = deepClone(ctx.actor.system.aura);

View file

@ -9,13 +9,13 @@ const { HandlebarsApplicationMixin } = foundry.applications.api;
const { ActorSheetV2 } = foundry.applications.sheets;
const { ContextMenu } = foundry.applications.ui;
export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2)) {
export class StatsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2)) {
// #region Options
static DEFAULT_OPTIONS = {
classes: [
`ripcrypt--actor`,
`ripcrypt--HeroSummaryCardV1`,
`ripcrypt--StatsCardV1`,
],
position: {
width: `auto`,
@ -34,7 +34,7 @@ export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixi
static PARTS = {
content: {
template: filePath(`templates/Apps/HeroSummaryCardV1/content.hbs`),
template: filePath(`templates/Apps/StatsCardV1/content.hbs`),
},
};
// #endregion
@ -42,7 +42,7 @@ export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixi
// #region Lifecycle
async _onRender(context, options) {
await super._onRender(context, options);
HeroSummaryCardV1._onRender.bind(this)(context, options);
StatsCardV1._onRender.bind(this)(context, options);
};
static async _onRender(context, options) {
@ -79,13 +79,13 @@ export class HeroSummaryCardV1 extends GenericAppMixin(HandlebarsApplicationMixi
ctx = await super._preparePartContext(partId, ctx, opts);
ctx.actor = this.document;
ctx = await HeroSummaryCardV1.prepareGuts(ctx);
ctx = await HeroSummaryCardV1.prepareWeapons(ctx);
ctx = await HeroSummaryCardV1.prepareArmor(ctx);
ctx = await HeroSummaryCardV1.prepareFatePath(ctx);
ctx = await HeroSummaryCardV1.prepareAbilityRow(ctx);
ctx = await HeroSummaryCardV1.prepareSpeed(ctx);
ctx = await HeroSummaryCardV1.prepareLevelData(ctx);
ctx = await StatsCardV1.prepareGuts(ctx);
ctx = await StatsCardV1.prepareWeapons(ctx);
ctx = await StatsCardV1.prepareArmor(ctx);
ctx = await StatsCardV1.prepareFatePath(ctx);
ctx = await StatsCardV1.prepareAbilityRow(ctx);
ctx = await StatsCardV1.prepareSpeed(ctx);
ctx = await StatsCardV1.prepareLevelData(ctx);
Logger.debug(`Context:`, ctx);
return ctx;