2021-04-22 11:27:10 +00:00
|
|
|
|
|
|
|
import { BladesSheet } from "./blades-sheet.js";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @extends {BladesSheet}
|
|
|
|
*/
|
|
|
|
export class BladesFactionSheet extends BladesSheet {
|
|
|
|
|
|
|
|
/** @override */
|
|
|
|
static get defaultOptions() {
|
2021-05-25 10:27:40 +00:00
|
|
|
return foundry.utils.mergeObject(super.defaultOptions, {
|
2023-11-28 22:06:09 +00:00
|
|
|
classes: ["beam-saber", "sheet", "actor", "faction"],
|
|
|
|
template: "systems/beam-saber/templates/faction-sheet.html",
|
2021-04-22 11:27:10 +00:00
|
|
|
width: 900,
|
|
|
|
height: 'auto',
|
|
|
|
tabs: [{navSelector: ".tabs", contentSelector: ".tab-content"}]
|
|
|
|
});
|
|
|
|
}
|
2021-05-25 10:27:40 +00:00
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
|
|
|
/** @override */
|
2022-09-03 15:44:26 +00:00
|
|
|
getData(options) {
|
|
|
|
const superData = super.getData( options );
|
|
|
|
const sheetData = superData.data;
|
|
|
|
sheetData.owner = superData.owner;
|
|
|
|
sheetData.editable = superData.editable;
|
|
|
|
sheetData.isGM = game.user.isGM;
|
|
|
|
return sheetData;
|
2021-05-25 10:27:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
2021-04-22 11:27:10 +00:00
|
|
|
/** @override */
|
|
|
|
activateListeners(html) {
|
|
|
|
super.activateListeners(html);
|
|
|
|
|
|
|
|
// Everything below here is only needed if the sheet is editable
|
|
|
|
if (!this.options.editable) return;
|
|
|
|
|
|
|
|
// Update Inventory Item
|
|
|
|
html.find('.item-body').click(ev => {
|
|
|
|
const element = $(ev.currentTarget).parents(".item");
|
2021-05-25 10:27:40 +00:00
|
|
|
const item = this.actor.items.get(element.data("itemId"));
|
2021-04-22 11:27:10 +00:00
|
|
|
item.sheet.render(true);
|
|
|
|
});
|
2022-09-03 15:44:26 +00:00
|
|
|
|
2021-04-22 11:27:10 +00:00
|
|
|
// Delete Inventory Item
|
2021-05-25 10:27:40 +00:00
|
|
|
html.find('.item-delete').click( async ev => {
|
2021-04-22 11:27:10 +00:00
|
|
|
const element = $(ev.currentTarget).parents(".item");
|
2021-05-25 10:27:40 +00:00
|
|
|
await this.actor.deleteEmbeddedDocuments("Item", [element.data("itemId")]);
|
2021-04-22 11:27:10 +00:00
|
|
|
element.slideUp(200, () => this.render(false));
|
|
|
|
});
|
2022-09-03 15:44:26 +00:00
|
|
|
|
2021-04-22 11:27:10 +00:00
|
|
|
}
|
2022-01-24 04:22:50 +00:00
|
|
|
}
|