Get the PlayerSheet working and actually saving data, using the data models instead of the template.json

This commit is contained in:
Oliver-Akins 2023-11-29 00:08:19 -07:00
parent 6e3510ddd4
commit 58facf1490
11 changed files with 339 additions and 234 deletions

View file

@ -1,26 +0,0 @@
/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
export class CharacterSheet extends ActorSheet {
static get defaultOptions() {
let opts = mergeObject(
super.defaultOptions,
{
template: "systems/dotdungeon/templates/actors/char-sheet-mvp/sheet.hbs"
}
);
opts.classes.push("dotdungeon");
return opts;
};
activateListeners(html) {
super.activateListeners(html);
if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Actor${this.id}`)
// Modal openings
html.find(`button.stat-prompt`).on("click", () => {});
}
}

View file

@ -0,0 +1,36 @@
export class PlayerSheet extends ActorSheet {
static get defaultOptions() {
let opts = mergeObject(
super.defaultOptions,
{
template: "systems/dotdungeon/templates/actors/char-sheet-mvp/sheet.hbs"
}
);
opts.classes.push("dotdungeon");
return opts;
};
activateListeners(html) {
super.activateListeners(html);
if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`);
// Modal openings
// html.find(`button.stat-prompt`).on("click", () => {});
};
getData() {
const ctx = super.getData();
const actor = this.actor.toObject(false);
ctx.system = actor.system;
ctx.flags = actor.flags;
console.group(`PlayerSheet.getData`);
console.log(`ctx`, ctx);
console.log(`actor`, actor);
console.groupEnd();
return ctx;
};
}