Update location of sheets to keep them more organized
This commit is contained in:
parent
6fbb480f83
commit
e284529a45
5 changed files with 7 additions and 5 deletions
35
module/sheets/Items/AspectSheet.mjs
Normal file
35
module/sheets/Items/AspectSheet.mjs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { GenericItemSheet } from "./GenericItemSheet.mjs";
|
||||
|
||||
export class AspectSheet extends GenericItemSheet {
|
||||
static get defaultOptions() {
|
||||
let opts = mergeObject(
|
||||
super.defaultOptions,
|
||||
{
|
||||
template: `systems/dotdungeon/templates/items/aspect.hbs`,
|
||||
width: 280,
|
||||
height: 340,
|
||||
}
|
||||
);
|
||||
opts.classes.push(`dotdungeon`);
|
||||
return opts;
|
||||
};
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
if (!this.isEditable) return;
|
||||
console.debug(`.dungeon | Adding event listeners for Item: ${this.id}`);
|
||||
};
|
||||
|
||||
async getData() {
|
||||
const ctx = {};
|
||||
const item = this.item;
|
||||
|
||||
ctx.item = item;
|
||||
ctx.system = item.system;
|
||||
ctx.flags = item.flags;
|
||||
|
||||
console.log(item.uuid, `context:`, ctx);
|
||||
return ctx;
|
||||
};
|
||||
};
|
||||
41
module/sheets/Items/GenericItemSheet.mjs
Normal file
41
module/sheets/Items/GenericItemSheet.mjs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import DOTDUNGEON from "../../config.mjs";
|
||||
|
||||
export class GenericItemSheet extends ItemSheet {
|
||||
_expanded = new Set();
|
||||
|
||||
#propogatedSettings = [
|
||||
`devMode`,
|
||||
`showAvatarOnSheet`,
|
||||
`playersCanChangeGroup`,
|
||||
`resourcesOrSupplies`,
|
||||
];
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
if (!this.isEditable) return;
|
||||
console.debug(`.dungeon | Adding event listeners for Generic Item: ${this.id}`);
|
||||
};
|
||||
|
||||
async getData() {
|
||||
const ctx = {};
|
||||
|
||||
// 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.item.uuid,
|
||||
};
|
||||
|
||||
ctx.config = DOTDUNGEON;
|
||||
ctx.icons = CONFIG.CACHE.icons;
|
||||
|
||||
return ctx;
|
||||
};
|
||||
};
|
||||
32
module/sheets/Items/PetSheet.mjs
Normal file
32
module/sheets/Items/PetSheet.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { GenericItemSheet } from "./GenericItemSheet.mjs";
|
||||
|
||||
export class PetSheet extends GenericItemSheet {
|
||||
static get defaultOptions() {
|
||||
let opts = mergeObject(
|
||||
super.defaultOptions,
|
||||
{
|
||||
template: `systems/dotdungeon/templates/items/pet.hbs`,
|
||||
width: 280,
|
||||
height: 340,
|
||||
}
|
||||
);
|
||||
opts.classes.push(`dotdungeon`);
|
||||
return opts;
|
||||
};
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
if (!this.isEditable) return;
|
||||
console.debug(`.dungeon | Adding event listeners for Pet Item: ${this.id}`);
|
||||
};
|
||||
|
||||
async getData() {
|
||||
const ctx = await super.getData();
|
||||
|
||||
ctx.item = this.item;
|
||||
ctx.system = this.item.system;
|
||||
ctx.flags = this.item.flags;
|
||||
return ctx;
|
||||
};
|
||||
};
|
||||
32
module/sheets/Items/SpellSheet.mjs
Normal file
32
module/sheets/Items/SpellSheet.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { GenericItemSheet } from "./GenericItemSheet.mjs";
|
||||
|
||||
export class SpellSheet extends GenericItemSheet {
|
||||
static get defaultOptions() {
|
||||
let opts = mergeObject(
|
||||
super.defaultOptions,
|
||||
{
|
||||
template: `systems/dotdungeon/templates/items/spell.hbs`,
|
||||
width: 280,
|
||||
height: 340,
|
||||
}
|
||||
);
|
||||
opts.classes.push(`dotdungeon`);
|
||||
return opts;
|
||||
};
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
if (!this.isEditable) return;
|
||||
console.debug(`.dungeon | Adding event listeners for Spell Item: ${this.id}`);
|
||||
};
|
||||
|
||||
async getData() {
|
||||
const ctx = await super.getData();
|
||||
|
||||
ctx.item = this.item;
|
||||
ctx.system = this.item.system;
|
||||
ctx.flags = this.item.flags;
|
||||
return ctx;
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue