Enhance combat
This commit is contained in:
@ -30,8 +30,14 @@ import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
|
||||
/* -------------------------------------------- */
|
||||
onSocketMesssage( msg ) {
|
||||
if (msg.name == 'msg_declare_actions' ) {
|
||||
let combat = game.combats.get( msg.data.combatId); // Get the associated combat
|
||||
combat.setupActorActions( msg.data );
|
||||
if (game.user.isGM) {
|
||||
let combat = game.combats.get( msg.data.combatId); // Get the associated combat
|
||||
combat.setupActorActions( msg.data );
|
||||
}
|
||||
} else if (msg.name == 'msg_close_action') {
|
||||
if (game.user.isGM) {
|
||||
game.combat.closeAction( msg.data.uniqId );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +66,11 @@ import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
|
||||
return list;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateCombat(combat, round, diff, id) {
|
||||
combat.requestActions();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async openDeclareActions( event) {
|
||||
event.preventDefault();
|
||||
@ -71,12 +82,29 @@ import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static closeAction(event) {
|
||||
let uniqId = event.currentTarget.attributes['data-uniq-id'].value;
|
||||
// Delete message !
|
||||
const toDelete = game.messages.filter(it => it.data.content.includes( uniqId ));
|
||||
toDelete.forEach(it => it.delete());
|
||||
|
||||
if ( game.user.isGM ) {
|
||||
game.combat.closeAction( uniqId );
|
||||
} else {
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||
name: "msg_close_action", data: { uniqId: uniqId} } );
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async registerChatCallbacks(html) {
|
||||
html.on("click", '#button-declare-actions', event => {
|
||||
SoSUtility.openDeclareActions( event );
|
||||
});
|
||||
|
||||
html.on("click", '#button-end-action', event => {
|
||||
SoSUtility.closeAction( event );
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user