ea0e308891
* Merge tag '2.17' into development (#117) * Updates for 0.8.x Updates for 0.8.x Co-authored-by: megastruktur <astromortis@gmail.com>
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
|
|
import { BladesSheet } from "./blades-sheet.js";
|
|
|
|
/**
|
|
* Extend the basic ActorSheet with some very simple modifications
|
|
* @extends {BladesSheet}
|
|
*/
|
|
export class BladesClockSheet extends BladesSheet {
|
|
|
|
/** @override */
|
|
static get defaultOptions() {
|
|
return foundry.utils.mergeObject(super.defaultOptions, {
|
|
classes: ["blades-in-the-dark", "sheet", "actor"],
|
|
template: "systems/blades-in-the-dark/templates/actors/clock-sheet.html",
|
|
width: 700,
|
|
height: 970,
|
|
});
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/** @override */
|
|
getData() {
|
|
var data = super.getData();
|
|
data.editable = this.options.editable;
|
|
const actorData = data.data;
|
|
data.actor = actorData;
|
|
data.data = actorData.data;
|
|
return data;
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
/** @override */
|
|
async _updateObject(event, formData) {
|
|
let image_path = `/systems/blades-in-the-dark/styles/assets/progressclocks-svg/Progress Clock ${formData['data.type']}-${formData['data.value']}.svg`;
|
|
formData['img'] = image_path;
|
|
formData['token.img'] = image_path;
|
|
let data = [];
|
|
let update = {
|
|
img: image_path,
|
|
width: 1,
|
|
height: 1,
|
|
scale: 1,
|
|
mirrorX: false,
|
|
mirrorY: false,
|
|
tint: "",
|
|
displayName: 50
|
|
};
|
|
|
|
let tokens = this.actor.getActiveTokens();
|
|
tokens.forEach( function( token ) {
|
|
data.push(
|
|
foundry.utils.mergeObject(
|
|
{ _id: token.id },
|
|
update
|
|
)
|
|
);
|
|
});
|
|
await TokenDocument.updateDocuments( data, { parent: game.scenes.current } )
|
|
|
|
// Update the Actor
|
|
return this.object.update(formData);
|
|
}
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
}
|