From 7935a85188d36153db03e0ae9cc8ee173ac41be3 Mon Sep 17 00:00:00 2001 From: Eldritch-Oliver Date: Sun, 12 Oct 2025 01:42:05 -0600 Subject: [PATCH] Initialize the BookGeistSheet --- module/Apps/ActorSheets/BookGeistSheet.mjs | 99 ++++++++++++++++++++++ module/hooks/init.mjs | 16 ++-- templates/Apps/BookGeistSheet/header.hbs | 7 ++ templates/Apps/BookGeistSheet/image.hbs | 3 + templates/Apps/BookGeistSheet/items.hbs | 1 + templates/Apps/BookGeistSheet/layout.hbs | 10 +++ templates/Apps/BookGeistSheet/stats.hbs | 11 +++ templates/Apps/BookGeistSheet/style.css | 13 +++ templates/Apps/apps.css | 1 + 9 files changed, 153 insertions(+), 8 deletions(-) create mode 100644 module/Apps/ActorSheets/BookGeistSheet.mjs create mode 100644 templates/Apps/BookGeistSheet/header.hbs create mode 100644 templates/Apps/BookGeistSheet/image.hbs create mode 100644 templates/Apps/BookGeistSheet/items.hbs create mode 100644 templates/Apps/BookGeistSheet/layout.hbs create mode 100644 templates/Apps/BookGeistSheet/stats.hbs create mode 100644 templates/Apps/BookGeistSheet/style.css 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 @@ +
+ +
diff --git a/templates/Apps/BookGeistSheet/image.hbs b/templates/Apps/BookGeistSheet/image.hbs new file mode 100644 index 0000000..8df65cc --- /dev/null +++ b/templates/Apps/BookGeistSheet/image.hbs @@ -0,0 +1,3 @@ +
+ IMAGE +
diff --git a/templates/Apps/BookGeistSheet/items.hbs b/templates/Apps/BookGeistSheet/items.hbs new file mode 100644 index 0000000..156fe1b --- /dev/null +++ b/templates/Apps/BookGeistSheet/items.hbs @@ -0,0 +1 @@ +
ITEMS
diff --git a/templates/Apps/BookGeistSheet/layout.hbs b/templates/Apps/BookGeistSheet/layout.hbs new file mode 100644 index 0000000..13e8fea --- /dev/null +++ b/templates/Apps/BookGeistSheet/layout.hbs @@ -0,0 +1,10 @@ +
+ {{#if imageVisible}} +
+ {{/if}} +
+
+
+
+
+
diff --git a/templates/Apps/BookGeistSheet/stats.hbs b/templates/Apps/BookGeistSheet/stats.hbs new file mode 100644 index 0000000..716671a --- /dev/null +++ b/templates/Apps/BookGeistSheet/stats.hbs @@ -0,0 +1,11 @@ +
+ +
diff --git a/templates/Apps/BookGeistSheet/style.css b/templates/Apps/BookGeistSheet/style.css new file mode 100644 index 0000000..0d47ece --- /dev/null +++ b/templates/Apps/BookGeistSheet/style.css @@ -0,0 +1,13 @@ +.BookGeistSheet { + > .window-content { + display: flex; + flex-direction: row; + gap: 4px; + } + + .info { + display: flex; + flex-direction: column; + gap: 4px; + } +} diff --git a/templates/Apps/apps.css b/templates/Apps/apps.css index e170ca0..82b7eb5 100644 --- a/templates/Apps/apps.css +++ b/templates/Apps/apps.css @@ -8,6 +8,7 @@ @import url("./RichEditor/style.css"); @import url("./ArmourSheet/style.css"); @import url("./TraitSheet/style.css"); +@import url("./BookGeistSheet/style.css"); @import url("./popover.css"); @import url("./popovers/AmmoTracker/style.css");