From 822094077b2a0d45faf7dd31b5f780ca0074b92d Mon Sep 17 00:00:00 2001 From: Eldritch-Oliver Date: Wed, 8 Oct 2025 23:05:57 -0600 Subject: [PATCH 1/3] Make the devMode game unpause be broadcasted --- module/hooks/ready.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/hooks/ready.mjs b/module/hooks/ready.mjs index ad9122c..71e9c99 100644 --- a/module/hooks/ready.mjs +++ b/module/hooks/ready.mjs @@ -16,7 +16,7 @@ Hooks.once(`ready`, () => { if (game.settings.get(`ripcrypt`, `devMode`)) { ui.sidebar.expand(); - if (game.paused) { game.togglePause() }; + if (game.paused) { game.togglePause(false, { broadcast: true }) }; }; ui.delveDice.render({ force: true }); From e06c500b5c58ac5765b7f135dca7ac556b49193c Mon Sep 17 00:00:00 2001 From: Eldritch-Oliver Date: Wed, 8 Oct 2025 23:06:17 -0600 Subject: [PATCH 2/3] Add a notify websocket event --- module/sockets/_index.mjs | 2 ++ module/sockets/notify.mjs | 56 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 module/sockets/notify.mjs diff --git a/module/sockets/_index.mjs b/module/sockets/_index.mjs index e866530..bcb2b5e 100644 --- a/module/sockets/_index.mjs +++ b/module/sockets/_index.mjs @@ -1,8 +1,10 @@ import { localizer } from "../utils/Localizer.mjs"; import { Logger } from "../utils/Logger.mjs"; +import { notify } from "./notify.mjs"; import { updateSands } from "./updateSands.mjs"; const events = { + notify, updateSands, }; diff --git a/module/sockets/notify.mjs b/module/sockets/notify.mjs new file mode 100644 index 0000000..072e5af --- /dev/null +++ b/module/sockets/notify.mjs @@ -0,0 +1,56 @@ +import { localizer } from "../utils/Localizer.mjs"; + +export function notify(payload) { + // #region Payload Validity + const { + message, + users = [], + type = `info`, + permanent = false, + } = payload; + + if (!message) { + ui.notifications.error(localizer( + `RipCrypt.notifs.error.malformed-socket-payload`, + { + event: `notify`, + details: `A message must be provided`, + }, + )); + return; + }; + + if (users && !Array.isArray(users)) { + ui.notifications.error(localizer( + `RipCrypt.notifs.error.malformed-socket-payload`, + { + event: `notify`, + details: `"users" must be an array of user IDs`, + }, + )); + return; + }; + + if (![`info`, `error`, `success`].includes(type)) { + ui.notifications.error(localizer( + `RipCrypt.notifs.error.malformed-socket-payload`, + { + event: `notify`, + details: `An invalid notification type was provided.`, + }, + )); + return; + } + // #endregion Payload Validity + + // Act + if (users.length === 0 || users.includes(game.user.id)) { + ui.notifications[type]?.( + localizer(message), + { + console: false, + permanent, + }, + ); + }; +}; From dad9ab860cb7dc196e60d201abc5503a4752304a Mon Sep 17 00:00:00 2001 From: Eldritch-Oliver Date: Wed, 8 Oct 2025 23:06:40 -0600 Subject: [PATCH 3/3] Broadcast the notify event when a cryptic event happens --- module/Apps/DelveDiceHUD.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/Apps/DelveDiceHUD.mjs b/module/Apps/DelveDiceHUD.mjs index 6dd69fe..e9a6f2f 100644 --- a/module/Apps/DelveDiceHUD.mjs +++ b/module/Apps/DelveDiceHUD.mjs @@ -228,6 +228,13 @@ export class DelveDiceHUD extends HandlebarsApplicationMixin(ApplicationV2) { localizer(`RipCrypt.notifs.info.cryptic-event-alert`), { console: false }, ); + game.socket.emit(`system.ripcrypt`, { + event: `notify`, + payload: { + message: `RipCrypt.notifs.info.cryptic-event-alert`, + type: `info`, + }, + }); }; if ([`both`, `pause`].includes(alertType) && game.user.isGM) {