2024-07-26 09:20:48 +02:00
|
|
|
// Our Item Sheet extends the default
|
2024-08-15 22:25:07 +02:00
|
|
|
export default class RMFRPWeaponSheet extends ItemSheet {
|
2024-07-26 09:20:48 +02:00
|
|
|
|
|
|
|
// Set the height and width
|
|
|
|
static get defaultOptions() {
|
2024-07-26 12:51:32 +02:00
|
|
|
return foundry.utils.mergeObject(super.defaultOptions, {
|
2024-07-26 09:20:48 +02:00
|
|
|
width: 530,
|
|
|
|
height: 440,
|
2024-08-15 22:25:07 +02:00
|
|
|
template: "systems/fvtt-rolemaster-frp/templates/sheets/items/rmfrp-weapon-sheet.html",
|
|
|
|
classes: ["rmfrp", "sheet", "item"]
|
2024-07-26 09:20:48 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// If our sheet is called here it is.
|
|
|
|
get template() {
|
2024-08-15 22:25:07 +02:00
|
|
|
return "systems/fvtt-rolemaster-frp/templates/sheets/items/rmfrp-weapon-sheet.html";
|
2024-07-26 09:20:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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,
|
2024-08-15 22:25:07 +02:00
|
|
|
config: CONFIG.rmfrp,
|
2024-08-23 11:45:23 +02:00
|
|
|
skills: {},
|
|
|
|
criticalTables: {},
|
|
|
|
attackTables: game.rmfrp.attackTables.getTableDef(),
|
2024-09-30 13:41:44 +02:00
|
|
|
fumbleTables: {},
|
2024-07-26 09:20:48 +02:00
|
|
|
enrichedDescription: enrichedDescription
|
2024-08-23 11:45:23 +02:00
|
|
|
}
|
|
|
|
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);
|
2024-07-26 09:20:48 +02:00
|
|
|
return sheetData;
|
|
|
|
}
|
|
|
|
}
|