foundryvtt-frostgrave/module/item/item-sheet.js

65 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-05-28 18:16:02 +02:00
/**
* Extend the basic ItemSheet with some very simple modifications
* @extends {ItemSheet}
*/
export class frostgraveItemSheet extends ItemSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
2021-05-29 23:20:50 +02:00
classes: ["foundryvtt-frostgrave", "sheet", "item"],
2021-05-28 18:16:02 +02:00
width: 450,
height: 500,
tabs: [{
navSelector: ".sheet-tabs",
contentSelector: ".sheet-body",
initial: "attributes",
}, ],
});
}
/** @override */
get template() {
2021-05-29 23:20:50 +02:00
const path = "systems/foundryvtt-frostgrave/templates/item";
2021-05-28 18:16:02 +02:00
// Return a single sheet for all item types.
// return `${path}/item-sheet.html`;
// Alternatively, you could use the following return statement to do a
// unique item sheet by type, like `weapon-sheet.html`.
return `${path}/item-${this.item.data.type}-sheet.html`;
}
/* -------------------------------------------- */
/** @override */
getData() {
const data = super.getData();
2021-05-29 23:20:50 +02:00
let formData = duplicate(data.data)
console.log("ITEM", formData);
return formData;
2021-05-28 18:16:02 +02:00
}
/* -------------------------------------------- */
/** @override */
setPosition(options = {}) {
const position = super.setPosition(options);
const sheetBody = this.element.find(".sheet-body");
const bodyHeight = position.height - 192;
sheetBody.css("height", bodyHeight);
return position;
}
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
// Roll handlers, click handlers, etc. would go here.
}
}