fvtt-rolemaster-frp/module/sheets/items/rmfrp_weapon_sheet.js

46 lines
1.4 KiB
JavaScript

// Our Item Sheet extends the default
export default class RMFRPWeaponSheet extends ItemSheet {
// Set the height and width
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
width: 530,
height: 440,
template: "systems/fvtt-rolemaster-frp/templates/sheets/items/rmfrp-weapon-sheet.html",
classes: ["rmfrp", "sheet", "item"]
});
}
// If our sheet is called here it is.
get template() {
return "systems/fvtt-rolemaster-frp/templates/sheets/items/rmfrp-weapon-sheet.html";
}
// Make the data available to the sheet template
async getData() {
const baseData = await super.getData();
let enrichedDescription = await TextEditor.enrichHTML(this.item.system.description, {async: true});
let sheetData = {
owner: this.item.isOwner,
editable: this.isEditable,
item: baseData.item,
system: baseData.item.system,
config: CONFIG.rmfrp,
skills: {},
criticalTables: {},
attackTables: game.rmfrp.attackTables.getTableDef(),
fumbleTables: {},
enrichedDescription: enrichedDescription
}
console.log("Parent", this.object)
// Add the skill data to the sheet if the item is owned
if (this.object.actor) {
sheetData.skills = this.object.actor.getOwnedItemsByType("skill");
}
console.log(sheetData);
return sheetData;
}
}