diff --git a/module/Apps/ActorSheets/BookGeistSheet.mjs b/module/Apps/ActorSheets/BookGeistSheet.mjs new file mode 100644 index 0000000..1a789e1 --- /dev/null +++ b/module/Apps/ActorSheets/BookGeistSheet.mjs @@ -0,0 +1,99 @@ +import { filePath } from "../../consts.mjs"; +import { GenericAppMixin } from "../mixins/GenericApp.mjs"; +import { LaidOutAppMixin } from "../mixins/LaidOutAppMixin.mjs"; + +const { HandlebarsApplicationMixin } = foundry.applications.api; +const { ActorSheetV2 } = foundry.applications.sheets; + +export class BookGeistSheet extends LaidOutAppMixin(GenericAppMixin(HandlebarsApplicationMixin(ActorSheetV2))) { + // #region Options + static DEFAULT_OPTIONS = { + classes: [ + `ripcrypt--actor`, + `BookGeistSheet`, + ], + // position: { + // width: ``, + // height: ``, + // }, + window: { + resizable: true, + }, + form: { + submitOnChange: true, + closeOnSubmite: false, + }, + }; + + static PARTS = { + layout: { + root: true, + template: filePath(`templates/Apps/BookGeistSheet/layout.hbs`), + }, + image: { + template: filePath(`templates/Apps/BookGeistSheet/image.hbs`), + }, + header: { + template: filePath(`templates/Apps/BookGeistSheet/header.hbs`), + }, + stats: { + template: filePath(`templates/Apps/BookGeistSheet/stats.hbs`), + }, + items: { + template: filePath(`templates/Apps/BookGeistSheet/items.hbs`), + }, + }; + // #endregion Options + + // #region Lifecycle + // #endregion Lifecycle + + // #region Data Prep + _preparePartContext(partID, ctx) { + + switch (partID) { + case `layout`: this._prepareLayoutContext(ctx); break; + case `image`: this._prepareImageContext(ctx); break; + case `header`: this._prepareHeaderContext(ctx); break; + case `stats`: this._prepareStatsContext(ctx); break; + case `items`: this._prepareItemsContext(ctx); break; + }; + + return ctx; + }; + + _prepareLayoutContext(ctx) { + ctx.imageVisible = true; + }; + + _prepareImageContext(ctx) { + ctx.url = this.actor.img; + }; + + _prepareHeaderContext(ctx) { + ctx.name = this.actor.name; + ctx.description = null; // this.actor.system.description; + }; + + _prepareStatsContext(ctx) { + const system = this.actor.system; + ctx.path = system.fate; + Object.assign(ctx, system.ability); + ctx.guts = system.guts; + ctx.speed = system.speed; + }; + + _prepareItemsContext(ctx) { + ctx.attacks = []; + ctx.defense = { + locations: `None`, + protection: 0, + shield: false, + }; + ctx.traits = []; + }; + // #endregion Data Prep + + // #region Actions + // #endregion Actions +}; diff --git a/module/hooks/init.mjs b/module/hooks/init.mjs index f74514d..4b46bc0 100644 --- a/module/hooks/init.mjs +++ b/module/hooks/init.mjs @@ -1,6 +1,7 @@ // Applications import { AllItemSheetV1 } from "../Apps/ItemSheets/AllItemSheetV1.mjs"; import { ArmourSheet } from "../Apps/ItemSheets/ArmourSheet.mjs"; +import { BookGeistSheet } from "../Apps/ActorSheets/BookGeistSheet.mjs"; import { CombinedHeroSheet } from "../Apps/ActorSheets/CombinedHeroSheet.mjs"; import { CraftCardV1 } from "../Apps/ActorSheets/CraftCardV1.mjs"; import { DelveDiceHUD } from "../Apps/DelveDiceHUD.mjs"; @@ -90,22 +91,21 @@ Hooks.once(`init`, () => { label: `RipCrypt.sheet-names.StatsCardV1`, themes: StatsCardV1.themes, }); - Actors.registerSheet(game.system.id, StatsCardV1, { - makeDefault: true, - types: [`geist`], - label: `RipCrypt.sheet-names.StatsCardV1`, - themes: StatsCardV1.themes, - }); Actors.registerSheet(game.system.id, SkillsCardV1, { - types: [`hero`, `geist`], + types: [`hero`], label: `RipCrypt.sheet-names.SkillsCardV1`, themes: SkillsCardV1.themes, }); Actors.registerSheet(game.system.id, CraftCardV1, { - types: [`hero`, `geist`], + types: [`hero`], label: `RipCrypt.sheet-names.CraftCardV1`, themes: CraftCardV1.themes, }); + Actors.registerSheet(game.system.id, BookGeistSheet, { + types: [`geist`], + label: `RipCrypt.sheet-names.BookGeistSheet`, + themes: BookGeistSheet.themes, + }); // #endregion // #region Items diff --git a/templates/Apps/BookGeistSheet/header.hbs b/templates/Apps/BookGeistSheet/header.hbs new file mode 100644 index 0000000..02b4b14 --- /dev/null +++ b/templates/Apps/BookGeistSheet/header.hbs @@ -0,0 +1,7 @@ +