From 6c840cbf59f25ce675e2f53b7723101be5fef537 Mon Sep 17 00:00:00 2001 From: CDeenen Date: Tue, 27 Jul 2021 21:56:50 +0200 Subject: [PATCH] v1.4.5 --- MaterialDeck.js | 51 +++--- README.md | 2 +- changelog.md | 24 +++ module.json | 4 +- src/combattracker.js | 22 ++- src/external.js | 358 +++++++++++++++++++++++++++++++++++++ src/macro.js | 10 ++ src/misc.js | 18 +- src/othercontrols.js | 23 +++ src/streamDeck.js | 10 +- src/systems/pf2e.js | 38 +++- src/systems/tokenHelper.js | 15 ++ src/token.js | 29 +++ 13 files changed, 565 insertions(+), 39 deletions(-) diff --git a/MaterialDeck.js b/MaterialDeck.js index 7e5ea67..c546e21 100644 --- a/MaterialDeck.js +++ b/MaterialDeck.js @@ -32,6 +32,8 @@ let controlTokenTimer; export let sdVersion; export let msVersion; + +let updateDialog; //CONFIG.debug.hooks = true; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -86,8 +88,8 @@ async function analyzeWSmessage(msg){ sdVersion = data.version; - if (data.version < minimumSDversion) { - let d = new Dialog({ + if (data.version < minimumSDversion && updateDialog == undefined) { + updateDialog = new Dialog({ title: "Material Deck: Update Needed", content: "

The Stream Deck plugin version you're using is v" + data.version + ", which is incompatible with this verion of the module.
Update to v" + minimumSDversion + " or newer.

", buttons: { @@ -103,7 +105,7 @@ async function analyzeWSmessage(msg){ }, default: "download" }); - d.render(true); + updateDialog.render(true); } } @@ -225,19 +227,22 @@ let messageCount = 0; */ function resetWS(){ const maxMessages = game.settings.get(moduleName, 'nrOfConnMessages'); - if (maxMessages == 0 || maxMessages > messageCount) { - messageCount++; - const countString = maxMessages == 0 ? "" : " (" + messageCount + "/" + maxMessages + ")"; - if (wsOpen) { - ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.Disconnected")); - wsOpen = false; - messageCount = 0; - } - else ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.ConnectFail") + countString); + if (wsOpen) { + ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.Disconnected")); + wsOpen = false; + messageCount = 0; + WSconnected = false; + startWebsocket(); + } + else if (ws.readyState == 3){ + if (maxMessages == 0 || maxMessages > messageCount) { + messageCount++; + const countString = maxMessages == 0 ? "" : " (" + messageCount + "/" + maxMessages + ")"; + ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.ConnectFail") + countString); + } + WSconnected = false; + startWebsocket(); } - - WSconnected = false; - startWebsocket(); } export function sendWS(txt){ @@ -275,8 +280,6 @@ Hooks.once('ready', async()=>{ registerSettings(); enableModule = (game.settings.get(moduleName,'Enable')) ? true : false; - - soundboard = new SoundboardControl(); streamDeck = new StreamDeck(); tokenControl = new TokenControl(); @@ -365,12 +368,6 @@ Hooks.once('ready', async()=>{ } } - - - - - - if (enableModule == false) return; if (getPermission('ENABLE') == false) { ready = true; @@ -472,6 +469,10 @@ Hooks.on('renderSidebarTab',(app)=>{ if (enableModule == false || ready == false) return; if (otherControls != undefined) otherControls.updateAll(options); if (sceneControl != undefined) sceneControl.updateAll(); + if (document.getElementsByClassName("roll-type-select")[0] != undefined) + document.getElementsByClassName("roll-type-select")[0].addEventListener('change',function(){ + if (otherControls != undefined) otherControls.updateAll(options); + }) }); Hooks.on('closeSidebarTab',(app)=>{ @@ -578,4 +579,8 @@ Hooks.once('init', ()=>{ Hooks.once('canvasReady',()=>{ ready = true; +}); + +Hooks.on("soundscape", (data) => { + externalModules.newSoundscapeData(data); }); \ No newline at end of file diff --git a/README.md b/README.md index a4bec5d..931e2b8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ I created a Discord server to discuss this and other hardware-based Foundry modules. Feel free to join if you'd like to join the discussion and be updated on this module. -[![Youtube Video](https://github.com/CDeenen/Soundscape/tree/master/img/Youtube.png)](https://youtu.be/7h5Ew8cJYxg "FoundryVTT Material Deck Demonstration") +[![Youtube Video](https://github.com/CDeenen/MaterialDeck/blob/Master/wiki/img/Youtube.png)](https://youtu.be/7h5Ew8cJYxg "FoundryVTT Material Deck Demonstration") # Material Deck Material Deck is a Foundry VTT module that allows you to control certain Foundry functions using an Elgato Stream Deck. A Stream Deck is a device that has physical buttons with displays behind them. Material Deck uses this to, for example, control playlists, execute macros, display and control the combat tracker.

diff --git a/changelog.md b/changelog.md index bc96dd0..c2af909 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,28 @@ # Changelog Material Deck Module +### v1.4.5 - 27-07-2021 +Fixes: + + +Additions: + + +
+Compatible server app and SD plugin:
+Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases
+SD plugin v1.4.5 (must be updated!): https://github.com/CDeenen/MaterialDeck_SD/releases
+ ### v1.4.4 - 26-05-2021 Fixes: