import { filePath } from "../../consts.mjs"; import { GenericAppMixin } from "../mixins/GenericApp.mjs"; import { LaidOutAppMixin } from "../mixins/LaidOutAppMixin.mjs"; import { localizer } from "../../utils/Localizer.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; const fate = system.fate; if (fate) { ctx.path = { full: localizer(`RipCrypt.common.ordinals.${fate}.full`), abbv: localizer(`RipCrypt.common.ordinals.${fate}.abbv`), }; } else { ctx.path = { full: null, abbv: localizer(`RipCrypt.common.empty`), }; }; 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 };