.dungeon/module/sheets/GenericItemSheet.mjs

42 lines
No EOL
961 B
JavaScript

import { preloadIcons } from "../handlebars.mjs";
export class GenericItemSheet extends ItemSheet {
_expanded = new Set();
#propogatedSettings = [
`devMode`,
`showAvatarOnSheet`,
`playersCanChangeGroup`,
`resourcesOrSupplies`,
];
activateListeners(html) {
super.activateListeners(html);
if (this.document.isEmbedded) return;
if (!this.isEditable) return;
console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`);
};
async getData() {
const ctx = {};
const item = this.item.toObject(false);
// Send all of the settings that sheets need into their context
ctx.settings = {};
for (const setting of this.#propogatedSettings) {
ctx.settings[setting] = game.settings.get(`dotdungeon`, setting);
};
ctx.isGM = game.users.current.hasRole(CONST.USER_ROLES.ASSISTANT);
ctx.meta = {
expanded: this._expanded,
idp: this.actor.uuid,
};
ctx.icons = await preloadIcons();
return ctx;
};
};