99 lines
2.2 KiB
JavaScript
99 lines
2.2 KiB
JavaScript
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
|
|
};
|