11b5b3b5b0
- Closes #51 - Adds Dice Rolling buttons to Character Sheet - Adds Dice Rolling button to Tools panel - Refactors file names
75 lines
1.9 KiB
JavaScript
75 lines
1.9 KiB
JavaScript
|
|
import { BladesSheet } from "./blades-sheet.js";
|
|
|
|
/**
|
|
* Extend the basic ActorSheet with some very simple modifications
|
|
* @extends {BladesSheet}
|
|
*/
|
|
export class BladesActorSheet extends BladesSheet {
|
|
|
|
/** @override */
|
|
static get defaultOptions() {
|
|
return mergeObject(super.defaultOptions, {
|
|
classes: ["blades-in-the-dark", "sheet", "actor"],
|
|
template: "systems/blades-in-the-dark/templates/actor-sheet.html",
|
|
width: 700,
|
|
height: 970,
|
|
tabs: [{navSelector: ".tabs", contentSelector: ".tab-content", initial: "abilities"}]
|
|
});
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/** @override */
|
|
getData() {
|
|
const data = super.getData();
|
|
|
|
// Calculate Load
|
|
let loadout = 0;
|
|
data.items.forEach(i => {loadout += (i.type === "item") ? parseInt(i.data.load) : 0});
|
|
data.data.loadout = loadout;
|
|
return data;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/** @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");
|
|
const item = this.actor.getOwnedItem(element.data("itemId"));
|
|
item.sheet.render(true);
|
|
});
|
|
|
|
// Delete Inventory Item
|
|
html.find('.item-delete').click(ev => {
|
|
const element = $(ev.currentTarget).parents(".item");
|
|
this.actor.deleteOwnedItem(element.data("itemId"));
|
|
element.slideUp(200, () => this.render(false));
|
|
});
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/** @override */
|
|
_updateObject(event, formData) {
|
|
|
|
// Update the Actor
|
|
return this.object.update(formData);
|
|
}
|
|
|
|
/** override */
|
|
_getFormData(form) {
|
|
const FD = BladesHelpers.getFormDataHelper(form, this.editors);
|
|
return FD;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
}
|