Update the Actor sheets to not be prefixed with Hero in their files/classes
This commit is contained in:
parent
5b74fd6beb
commit
cfc744e42f
14 changed files with 84 additions and 81 deletions
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
import { AmmoTracker } from "./Apps/popovers/AmmoTracker.mjs";
|
||||
import { CombinedHeroSheet } from "./Apps/ActorSheets/CombinedHeroSheet.mjs";
|
||||
import { DicePool } from "./Apps/DicePool.mjs";
|
||||
import { HeroSkillsCardV1 } from "./Apps/ActorSheets/HeroSkillsCardV1.mjs";
|
||||
import { HeroSummaryCardV1 } from "./Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
||||
import { RichEditor } from "./Apps/RichEditor.mjs";
|
||||
import { SkillsCardV1 } from "./Apps/ActorSheets/SkillsCardV1.mjs";
|
||||
import { StatsCardV1 } from "./Apps/ActorSheets/StatsCardV1.mjs";
|
||||
|
||||
// Util imports
|
||||
import { distanceBetweenFates, nextFate, previousFate } from "./utils/fates.mjs";
|
||||
|
|
@ -25,8 +25,8 @@ Object.defineProperty(
|
|||
AmmoTracker,
|
||||
DicePool,
|
||||
CombinedHeroSheet,
|
||||
HeroSummaryCardV1,
|
||||
HeroSkillsCardV1,
|
||||
StatsCardV1,
|
||||
SkillsCardV1,
|
||||
RichEditor,
|
||||
},
|
||||
utils: {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
// Applications
|
||||
import { AllItemSheetV1 } from "../Apps/ItemSheets/AllItemSheetV1.mjs";
|
||||
import { CombinedHeroSheet } from "../Apps/ActorSheets/CombinedHeroSheet.mjs";
|
||||
import { CraftCardV1 } from "../Apps/ActorSheets/CraftCardV1.mjs";
|
||||
import { DelveDiceHUD } from "../Apps/DelveDiceHUD.mjs";
|
||||
import { HeroCraftCardV1 } from "../Apps/ActorSheets/HeroCraftCardV1.mjs";
|
||||
import { HeroSkillsCardV1 } from "../Apps/ActorSheets/HeroSkillsCardV1.mjs";
|
||||
import { HeroSummaryCardV1 } from "../Apps/ActorSheets/HeroSummaryCardV1.mjs";
|
||||
import { RipCryptCombatTracker } from "../Apps/sidebar/CombatTracker.mjs";
|
||||
import { SkillsCardV1 } from "../Apps/ActorSheets/SkillsCardV1.mjs";
|
||||
import { StatsCardV1 } from "../Apps/ActorSheets/StatsCardV1.mjs";
|
||||
|
||||
// Data Models
|
||||
import { AmmoData } from "../data/Item/Ammo.mjs";
|
||||
import { ArmourData } from "../data/Item/Armour.mjs";
|
||||
import { CraftData } from "../data/Item/Craft.mjs";
|
||||
import { GeistData } from "../data/Actor/Geist.mjs";
|
||||
import { GoodData } from "../data/Item/Good.mjs";
|
||||
import { HeroData } from "../data/Actor/Hero.mjs";
|
||||
import { ShieldData } from "../data/Item/Shield.mjs";
|
||||
|
|
@ -53,7 +54,8 @@ Hooks.once(`init`, () => {
|
|||
|
||||
// #region Datamodels
|
||||
CONFIG.Actor.dataModels.hero = HeroData;
|
||||
CONFIG.Item.dataModels.ammo = AmmoData,
|
||||
CONFIG.Actor.dataModels.geist = GeistData;
|
||||
CONFIG.Item.dataModels.ammo = AmmoData;
|
||||
CONFIG.Item.dataModels.armour = ArmourData;
|
||||
CONFIG.Item.dataModels.craft = CraftData;
|
||||
CONFIG.Item.dataModels.good = GoodData;
|
||||
|
|
@ -83,20 +85,20 @@ Hooks.once(`init`, () => {
|
|||
label: `RipCrypt.sheet-names.CombinedHeroSheet`,
|
||||
themes: CombinedHeroSheet.themes,
|
||||
});
|
||||
Actors.registerSheet(game.system.id, HeroSummaryCardV1, {
|
||||
Actors.registerSheet(game.system.id, StatsCardV1, {
|
||||
types: [`hero`],
|
||||
label: `RipCrypt.sheet-names.HeroSummaryCardV1`,
|
||||
themes: HeroSummaryCardV1.themes,
|
||||
label: `RipCrypt.sheet-names.StatsCardV1`,
|
||||
themes: StatsCardV1.themes,
|
||||
});
|
||||
Actors.registerSheet(game.system.id, HeroSkillsCardV1, {
|
||||
Actors.registerSheet(game.system.id, SkillsCardV1, {
|
||||
types: [`hero`],
|
||||
label: `RipCrypt.sheet-names.HeroSkillsCardV1`,
|
||||
themes: HeroSkillsCardV1.themes,
|
||||
label: `RipCrypt.sheet-names.SkillsCardV1`,
|
||||
themes: SkillsCardV1.themes,
|
||||
});
|
||||
Actors.registerSheet(game.system.id, HeroCraftCardV1, {
|
||||
Actors.registerSheet(game.system.id, CraftCardV1, {
|
||||
types: [`hero`],
|
||||
label: `RipCrypt.sheet-names.HeroCraftCardV1`,
|
||||
themes: HeroCraftCardV1.themes,
|
||||
label: `RipCrypt.sheet-names.CraftCardV1`,
|
||||
themes: CraftCardV1.themes,
|
||||
});
|
||||
// #endregion
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue