Add a datasheet for untyped items and foils

This commit is contained in:
Oliver-Akins 2024-03-30 12:59:16 -06:00
parent 3d8d041915
commit 0f28e23b5c
7 changed files with 201 additions and 0 deletions

View file

@ -33,6 +33,7 @@ import "./hooks/hotReload.mjs";
// Misc Imports
import loadSettings from "./settings/index.mjs";
import { devInit } from "./hooks/devInit.mjs";
import DOTDUNGEON from "./config.mjs";
@ -101,6 +102,9 @@ Hooks.once(`init`, async () => {
label: "dotdungeon.sheet-names.PetSheet"
});
if (game.settings.get(`dotdungeon`, `devMode`)) {
devInit();
};
hbs.registerHandlebarsHelpers();
hbs.preloadHandlebarsTemplates();

17
module/hooks/devInit.mjs Normal file
View file

@ -0,0 +1,17 @@
/*
Initialization of dev-specific features for the init hook, this is primarily
used to register all of the data sheets of various entity types.
*/
import { UntypedDataSheet } from "../sheets/Datasheets/UntypedDataSheet.mjs";
export function devInit() {
Items.registerSheet(
`dotdungeon`,
UntypedDataSheet,
{
types: [`untyped`, `foil`],
label: `dotdungeon.sheet-names.UntypedDataSheet`,
}
);
};

View file

@ -0,0 +1,27 @@
export class UntypedDataSheet extends ItemSheet {
static get defaultOptions() {
let opts = foundry.utils.mergeObject(
super.defaultOptions,
{
template: `systems/dotdungeon/templates/datasheets/untyped.hbs`,
width: 650,
height: 700
},
);
opts.classes.push(`dotdungeon`, `style-v3`);
return opts;
};
async getData() {
const ctx = {};
ctx.item = this.item;
ctx.system = this.item.system;
ctx.meta = {
idp: this.item.uuid,
};
return ctx;
};
};