Enhance sheets

This commit is contained in:
2021-02-03 15:33:07 +01:00
parent c65f1b8246
commit d248411e90
10 changed files with 276 additions and 13 deletions

View File

@ -1,5 +1,8 @@
/* -------------------------------------------- */
import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
export class SoSUtility {
/* -------------------------------------------- */
export class SoSUtility {
/* -------------------------------------------- */
static async preloadHandlebarsTemplates() {
@ -24,6 +27,14 @@ export class SoSUtility {
return Array(end - start + 1).fill().map((item, index) => start + index);
}
/* -------------------------------------------- */
onSocketMesssage( msg ) {
if (msg.name == 'msg_declare_actions' ) {
let combat = game.combats.get( msg.data.combatId); // Get the associated combat
combat.setupActorActions( msg.data );
}
}
/* -------------------------------------------- */
static async loadCompendiumNames(compendium) {
const pack = game.packs.get(compendium);
@ -49,4 +60,21 @@ export class SoSUtility {
return list;
}
/* -------------------------------------------- */
static async openDeclareActions( event) {
event.preventDefault();
let round = event.currentTarget.attributes['data-round'].value;
let combatId = event.currentTarget.attributes['data-combat-id'].value;
let d = await SoSDialogCombatActions.create( combatId, round );
d.render(true);
}
/* -------------------------------------------- */
static async registerChatCallbacks(html) {
html.on("click", '#button-declare-actions', event => {
SoSUtility.openDeclareActions( event );
});
}
}