mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Exec Save message as GM for players
This commit is contained in:
parent
9674b90967
commit
c36fa38df2
2 changed files with 20 additions and 4 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { emitAsGM, GMUpdateEvent } from "../../systemRegistration/socket.mjs";
|
||||||
|
|
||||||
export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLog {
|
export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLog {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
|
|
@ -98,7 +100,16 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
if (message.system.source.item && message.system.source.action) {
|
if (message.system.source.item && message.system.source.action) {
|
||||||
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||||
if (!action || !action?.hasSave) return;
|
if (!action || !action?.hasSave) return;
|
||||||
action.rollSave(token.actor, event, message).then(result => action.updateSaveMessage(result, message, token.id));
|
action.rollSave(token.actor, event, message).then(result => emitAsGM(
|
||||||
|
GMUpdateEvent.UpdateSaveMessage,
|
||||||
|
action.updateSaveMessage.bind(action, result, message, token.id),
|
||||||
|
{
|
||||||
|
action: action.uuid,
|
||||||
|
message: message._id,
|
||||||
|
token: token.id,
|
||||||
|
result
|
||||||
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ export const socketEvent = {
|
||||||
export const GMUpdateEvent = {
|
export const GMUpdateEvent = {
|
||||||
UpdateDocument: 'DhGMUpdateDocument',
|
UpdateDocument: 'DhGMUpdateDocument',
|
||||||
UpdateSetting: 'DhGMUpdateSetting',
|
UpdateSetting: 'DhGMUpdateSetting',
|
||||||
UpdateFear: 'DhGMUpdateFear'
|
UpdateFear: 'DhGMUpdateFear',
|
||||||
|
UpdateSaveMessage: 'DhGMUpdateSaveMessage'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RefreshType = {
|
export const RefreshType = {
|
||||||
|
|
@ -55,8 +56,12 @@ export const registerSocketHooks = () => {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
/* Hooks.callAll(socketEvent.DhpFearUpdate);
|
break;
|
||||||
await game.socket.emit(`system.${CONFIG.DH.id}`, { action: socketEvent.DhpFearUpdate }); */
|
case GMUpdateEvent.UpdateSaveMessage:
|
||||||
|
const action = await fromUuid(data.update.action),
|
||||||
|
message = game.messages.get(data.update.message);
|
||||||
|
if(!action || !message) return;
|
||||||
|
action.updateSaveMessage(data.update.result, message, data.update.token);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue