/**
* Extend the basic ActorSheet with some very simple modifications
* @extends {ActorSheet}
*/
export class BladesSheet extends ActorSheet {
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
super.activateListeners(html);
html.find(".item-add-popup").click(this._onItemAddClick.bind(this));
// This is a workaround until is being fixed in FoundryVTT.
if ( this.options.submitOnChange ) {
html.on("change", "textarea", this._onChangeInput.bind(this)); // Use delegated listener on the form
}
html.find(".roll-die-attribute").click(this._onRollAttributeDieClick.bind(this));
}
/* -------------------------------------------- */
async _onItemAddClick(event) {
event.preventDefault();
const item_type = $(event.currentTarget).data("itemType")
const distinct = $(event.currentTarget).data("distinct")
let input_type = "checkbox";
if (typeof distinct !== "undefined") {
input_type = "radio";
}
let items = await BladesHelpers.getAllItemsByType(item_type, game);
let html = `
`;
items.forEach(e => {
let addition_price_load = ``;
if (typeof e.data.load !== "undefined") {
addition_price_load += `(${e.data.load})`
} else if (typeof e.data.price !== "undefined") {
addition_price_load += `(${e.data.price})`
}
html += ``;
html += ``;
});
html += `