Feature/416 reaction roll query (#445)

* Create files

* before fixing damage roll on main

* g

* Player query for Roll All Save

* Exec Save message as GM for players

* Fix DsN bug
This commit is contained in:
Dapoulp 2025-07-28 17:44:11 +02:00 committed by GitHub
parent 2fbbf98f88
commit 2be4ee8857
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 91 additions and 38 deletions

View file

@ -1,3 +1,5 @@
import DamageReductionDialog from '../applications/dialogs/damageReductionDialog.mjs';
export function handleSocketEvent({ action = null, data = {} } = {}) {
switch (action) {
case socketEvent.GMUpdate:
@ -21,7 +23,8 @@ export const socketEvent = {
export const GMUpdateEvent = {
UpdateDocument: 'DhGMUpdateDocument',
UpdateSetting: 'DhGMUpdateSetting',
UpdateFear: 'DhGMUpdateFear'
UpdateFear: 'DhGMUpdateFear',
UpdateSaveMessage: 'DhGMUpdateSaveMessage'
};
export const RefreshType = {
@ -53,8 +56,12 @@ export const registerSocketHooks = () => {
)
)
);
/* Hooks.callAll(socketEvent.DhpFearUpdate);
await game.socket.emit(`system.${CONFIG.DH.id}`, { action: socketEvent.DhpFearUpdate }); */
break;
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;
}
@ -69,6 +76,11 @@ export const registerSocketHooks = () => {
});
};
export const registerUserQueries = () => {
CONFIG.queries.armorStack = DamageReductionDialog.armorStackQuery;
CONFIG.queries.reactionRoll = game.system.api.models.actions.actionsTypes.base.rollSaveQuery;
}
export const emitAsGM = async (eventName, callback, update, uuid = null) => {
if (!game.user.isGM) {
return await game.socket.emit(`system.${CONFIG.DH.id}`, {