Uppdate DS4ItemSheet#getData

This commit is contained in:
Johannes Loher 2021-06-30 13:26:15 +02:00
parent 5bf9ee534d
commit d85d335799

View file

@ -6,13 +6,12 @@
import { DS4 } from "../config"; import { DS4 } from "../config";
import notifications from "../ui/notifications"; import notifications from "../ui/notifications";
import { DS4Item } from "./item";
import { isDS4ItemDataTypePhysical } from "./item-data-source"; import { isDS4ItemDataTypePhysical } from "./item-data-source";
/** /**
* The Sheet class for DS4 Items * The Sheet class for DS4 Items
*/ */
export class DS4ItemSheet extends ItemSheet { export class DS4ItemSheet extends ItemSheet<ItemSheet.Options, DS4ItemSheetData> {
/** @override */ /** @override */
static get defaultOptions(): ItemSheet.Options { static get defaultOptions(): ItemSheet.Options {
// TODO: Improve // TODO: Improve
@ -32,17 +31,18 @@ export class DS4ItemSheet extends ItemSheet {
const basePath = "systems/ds4/templates/sheets/item"; const basePath = "systems/ds4/templates/sheets/item";
return `${basePath}/${this.item.data.type}-sheet.hbs`; return `${basePath}/${this.item.data.type}-sheet.hbs`;
} }
// /** @override */
// async getData(): Promise<ItemSheet.Data<DS4Item>> { /** @override */
// const data = { async getData(): Promise<DS4ItemSheetData> {
// ...(await super.getData()), return {
// config: DS4, ...(await super.getData()),
// isOwned: this.item.isOwned, config: DS4,
// actor: this.item.actor, isOwned: this.item.isOwned,
// isPhysical: isDS4ItemDataTypePhysical(this.item.data.data), actor: this.item.actor,
// }; isPhysical: isDS4ItemDataTypePhysical(this.item.data.data),
// return data; };
// } }
/** @override */ /** @override */
setPosition(options: Partial<Application.Position> = {}): (Application.Position & { height: number }) | undefined { setPosition(options: Partial<Application.Position> = {}): (Application.Position & { height: number }) | undefined {
const position = super.setPosition(options); const position = super.setPosition(options);
@ -109,3 +109,10 @@ export class DS4ItemSheet extends ItemSheet {
return ActiveEffect.create(createData, { parent: this.item }); return ActiveEffect.create(createData, { parent: this.item });
} }
} }
interface DS4ItemSheetData extends ItemSheet.Data<ItemSheet.Options> {
config: typeof DS4;
isOwned: boolean;
actor: DS4ItemSheet["item"]["actor"];
isPhysical: boolean;
}