Add an ItemHandler class and prevent players from having more than 1 aspect.

This commit is contained in:
Oliver-Akins 2024-01-13 15:03:00 -07:00
parent 82108bfe5f
commit 38fcb1193a
7 changed files with 49 additions and 6 deletions

View file

@ -1,4 +1,6 @@
export class AspectSheet extends ItemSheet {
import { GenericItemSheet } from "./GenericItemSheet.mjs";
export class AspectSheet extends GenericItemSheet {
static get defaultOptions() {
let opts = mergeObject(
super.defaultOptions,
@ -21,13 +23,13 @@ export class AspectSheet extends ItemSheet {
async getData() {
const ctx = {};
const item = this.item.toObject(false);
const item = this.item;
ctx.name = super.name;
ctx.item = item;
ctx.system = item.system;
ctx.flags = item.flags;
console.log(item.uuid, `context:`, ctx);
return ctx;
};
};

View file

@ -33,7 +33,7 @@ export class PlayerSheet extends GenericActorSheet {
canAddAspect: ctx.items.aspect.length == 0,
};
console.log(ctx)
console.log(actor.uuid, `context:`, ctx)
return ctx;
};
};

View file

@ -18,7 +18,7 @@ export class SpellSheet extends GenericItemSheet {
super.activateListeners(html);
if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`);
console.debug(`.dungeon | Adding event listeners for Spell Item: ${this.id}`);
};
async getData() {