Initialize the BookGeistSheet

This commit is contained in:
Eldritch-Oliver 2025-10-12 01:42:05 -06:00
parent 163423ea5b
commit 7935a85188
9 changed files with 153 additions and 8 deletions

View file

@ -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
};

View file

@ -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