This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
foundryvtt-beam-saber/module/blades-item-sheet.js

56 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-04-17 21:23:57 +00:00
/**
2020-04-21 16:06:33 +00:00
* Extend the basic ItemSheet
2020-04-17 21:23:57 +00:00
* @extends {ItemSheet}
*/
2020-04-21 16:06:33 +00:00
export class BladesItemSheet extends ItemSheet {
2020-04-17 21:23:57 +00:00
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
2020-04-21 16:06:33 +00:00
classes: ["blades-in-the-dark", "sheet", "item"],
width: 560,
height: 'auto',
2020-04-17 21:23:57 +00:00
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
});
}
/* -------------------------------------------- */
2020-04-21 16:06:33 +00:00
/** @override */
get template() {
2020-04-22 07:57:36 +00:00
const path = "systems/blades-in-the-dark/templates/items";
let simple_item_types = ["background", "heritage", "vice", "crew_reputation"];
2020-04-23 16:11:04 +00:00
let template_name = `${this.item.data.type}`;
if (simple_item_types.indexOf(this.item.data.type) >= 0) {
template_name = "simple";
}
return `${path}/${template_name}.html`;
2020-04-21 16:06:33 +00:00
}
/* -------------------------------------------- */
2020-04-17 21:23:57 +00:00
/** @override */
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
}
/* -------------------------------------------- */
2021-04-22 11:27:10 +00:00
/** @override */
getData() {
const data = super.getData();
data.isGm = game.user.isGM;
data.editable = this.options.editable;
const itemData = data.data;
data.actor = itemData;
data.data = itemData.data;
2021-04-22 11:27:10 +00:00
return data;
}
2020-04-17 21:23:57 +00:00
}