64 lines
1.9 KiB
JavaScript
64 lines
1.9 KiB
JavaScript
import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs";
|
|
|
|
/**
|
|
* Extend the basic ActorSheet with some very simple modifications
|
|
* @extends {ActorSheet}
|
|
*/
|
|
export class TotemActorSheet extends ActorSheet {
|
|
|
|
/** @override */
|
|
static get defaultOptions() {
|
|
return mergeObject(super.defaultOptions, {
|
|
classes: ["totem", "sheet", "actor"],
|
|
template: "systems/totem/templates/actor/actor-sheet.html",
|
|
width: 690,
|
|
height: 800,
|
|
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
|
|
});
|
|
}
|
|
|
|
/** @override */
|
|
get template() {
|
|
return `systems/totem/templates/actor/actor-${this.actor.type}-sheet.html`;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/** @override */
|
|
getData() {
|
|
// Retrieve the data structure from the base sheet. You can inspect or log
|
|
// the context variable to see the structure, but some key properties for
|
|
// sheets are the actor object, the data object, whether or not it's
|
|
// editable, the items array, and the effects array.
|
|
const context = super.getData();
|
|
|
|
// Use a safe clone of the actor data for further operations.
|
|
const actorData = this.actor.toObject(false);
|
|
|
|
// Add the actor's data to context.data for easier access, as well as flags.
|
|
context.system = actorData.system;
|
|
context.flags = actorData.flags;
|
|
context.config = CONFIG.TOTEM;
|
|
|
|
// Prepare character data and items.
|
|
if (actorData.type == 'character') {
|
|
this._prepareItems(context);
|
|
}
|
|
|
|
// Prepare NPC data and items.
|
|
if (actorData.type == 'npc') {
|
|
this._prepareItems(context);
|
|
}
|
|
|
|
// Add roll data for TinyMCE editors.
|
|
context.rollData = context.actor.getRollData();
|
|
|
|
// Prepare active effects
|
|
context.effects = prepareActiveEffectCategories(this.actor.effects);
|
|
|
|
return context;
|
|
}
|
|
|
|
|
|
}
|