From fc07ee9f46460e75a452a9f2f5a197100a794c62 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Thu, 28 Jul 2022 12:27:25 +0200 Subject: [PATCH] Fixed sync between GM for Combat tracker "initiative encounter type" and "initiative prepared" --- CHANGELOG.md | 1 + system/scripts/dice/dice-picker-dialog.js | 7 +++++-- system/scripts/gm/gm-toolbox.js | 1 + system/scripts/hooks.js | 9 ++------- system/scripts/settings.js | 1 + system/scripts/socket-handler.js | 2 +- wiki/dev/sockets.md | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f3a07..15ff2f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ __! Be certain to carefully back up any critical user data before installing thi - Added `itemUuid` to Roll/RnK for technique and weapons to be readable in ChatMessage (use `fromUuid()` / `fromUuidSync()` to get the object). - Added wiki link in system tab. - Removed restriction on technique types when dropping a technique (Sheet and 20Q. #39). +- Fixed sync between GM for Combat tracker `initiative encounter type` and `initiative prepared`. ### OpenDicePicker API usage #### Fitness skill roll for the all combat targets diff --git a/system/scripts/dice/dice-picker-dialog.js b/system/scripts/dice/dice-picker-dialog.js index e7a92a3..5e3f6d7 100644 --- a/system/scripts/dice/dice-picker-dialog.js +++ b/system/scripts/dice/dice-picker-dialog.js @@ -190,8 +190,11 @@ export class DicePickerDialog extends FormApplication { * @param {ActorL5r5e} actor */ set actor(actor) { - if (!actor || !(actor instanceof Actor) || !actor.isOwner) { - console.info("L5R5E | DP | Actor rejected", actor); + if (!actor) { + return; + } + if (actor instanceof Actor || !actor.isOwner) { + console.warn("L5R5E | DP | Actor rejected : Not a valid Actor instance or permission was denied", actor); return; } this._actor = actor; diff --git a/system/scripts/gm/gm-toolbox.js b/system/scripts/gm/gm-toolbox.js index 2d4c14b..5272630 100644 --- a/system/scripts/gm/gm-toolbox.js +++ b/system/scripts/gm/gm-toolbox.js @@ -25,6 +25,7 @@ export class GmToolbox extends FormApplication { closeOnSubmit: false, submitOnClose: false, submitOnChange: true, + minimizable: false, }); } diff --git a/system/scripts/hooks.js b/system/scripts/hooks.js index de1ea4b..530dbff 100644 --- a/system/scripts/hooks.js +++ b/system/scripts/hooks.js @@ -145,7 +145,6 @@ export default class HooksL5r5e { } // Buttons Listeners - // TODO event for multiple GM html.find(".encounter-control").on("click", (event) => { event.preventDefault(); event.stopPropagation(); @@ -153,9 +152,7 @@ export default class HooksL5r5e { if (!encounterTypeList.includes(encounter)) { return; } - game.settings - .set("l5r5e", "initiative-encounter", encounter) - .then(() => HooksL5r5e._gmCombatBar(app, html, data)); + game.settings.set("l5r5e", "initiative-encounter", encounter); }); html.find(".prepared-control").on("mousedown", (event) => { @@ -171,9 +168,7 @@ export default class HooksL5r5e { true: rev ? "null" : "false", null: rev ? "false" : "true", }; - game.settings - .set("l5r5e", `initiative-prepared-${preparedId}`, nextValue[prepared[preparedId]]) - .then(() => HooksL5r5e._gmCombatBar(app, html, data)); + game.settings.set("l5r5e", `initiative-prepared-${preparedId}`, nextValue[prepared[preparedId]]); }); } diff --git a/system/scripts/settings.js b/system/scripts/settings.js index 86911f0..009b867 100644 --- a/system/scripts/settings.js +++ b/system/scripts/settings.js @@ -77,6 +77,7 @@ export const RegisterSettings = function () { if (game.settings.get("l5r5e", "initiative-setTn1OnTypeChange")) { game.settings.set("l5r5e", "initiative-difficulty-value", 1); } + ui.combat.render(true); }, }); game.settings.register("l5r5e", "initiative-prepared-character", { diff --git a/system/scripts/socket-handler.js b/system/scripts/socket-handler.js index 4ab16f1..5d98dce 100644 --- a/system/scripts/socket-handler.js +++ b/system/scripts/socket-handler.js @@ -61,7 +61,7 @@ export class SocketHandlerL5r5e { } /** - * Refresh a app by it's htmlId, not windowsId (ex "l5r5e-twenty-questions-dialog-kZHczAFghMNYFRWe", not "65") + * Refresh an app by his "id", not "appId" (ex "l5r5e-twenty-questions-dialog-kZHczAFghMNYFRWe", not "65") * * Usage : game.l5r5e.sockets.refreshAppId(appId); * diff --git a/wiki/dev/sockets.md b/wiki/dev/sockets.md index f933a3d..d975ea8 100644 --- a/wiki/dev/sockets.md +++ b/wiki/dev/sockets.md @@ -12,7 +12,7 @@ game.l5r5e.sockets.deleteChatMessage(messageId); ## refreshAppId -Refresh a application windows by it's `htmlId` (not `windowsId`). Used in RnK. +Refresh an application windows by his `id` (not `appId`). Used in RnK.
Ex : `l5r5e-twenty-questions-dialog-kZHczAFghMNYFRWe`, not `65`. Usage :