Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc471ce400 | ||
|
|
1370544f03 | ||
|
|
7bd2084209 | ||
|
|
0ae6336f52 | ||
|
|
8f1a5271dd | ||
|
|
199f9b2d3b | ||
|
|
f178245152 | ||
|
|
cd4c9e129e | ||
|
|
fb26eacc8d | ||
|
|
d809217d23 | ||
|
|
e4cdf1c355 | ||
|
|
0a4d32aaac | ||
|
|
5c2357edd6 | ||
|
|
47ca57b9da | ||
|
|
f7e98cbd50 | ||
|
|
d1c059df7d | ||
|
|
92f4db9e73 | ||
|
|
11851bba1e | ||
|
|
3f7998934b | ||
|
|
4eea123fac |
156
MaterialDeck.js
@@ -11,26 +11,26 @@ export var streamDeck;
|
||||
export var tokenControl;
|
||||
var move;
|
||||
export var macroControl;
|
||||
var combatTracker;
|
||||
var playlistControl;
|
||||
var soundboard;
|
||||
var otherControls;
|
||||
export var combatTracker;
|
||||
export var playlistControl;
|
||||
export var soundboard;
|
||||
export var otherControls;
|
||||
|
||||
export const moduleName = "MaterialDeck";
|
||||
export var selectedTokenId;
|
||||
|
||||
let ready = false;
|
||||
let activeSounds = [];
|
||||
|
||||
//CONFIG.debug.hooks = true;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Global variables
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
var enableModule;
|
||||
export var enableModule;
|
||||
|
||||
//Websocket variables
|
||||
let ip = "localhost"; //Ip address of the websocket server
|
||||
let port = "3003"; //Port of the websocket server
|
||||
var ws; //Websocket variable
|
||||
let wsOpen = false; //Bool for checking if websocket has ever been opened => changes the warning message if there's no connection
|
||||
let wsInterval; //Interval timer to detect disconnections
|
||||
@@ -41,11 +41,17 @@ let WSconnected = false;
|
||||
*
|
||||
* @param {*} msg Message received
|
||||
*/
|
||||
async function analyzeWSmessage(msg,passthrough = false){
|
||||
async function analyzeWSmessage(msg){
|
||||
if (enableModule == false) return;
|
||||
const data = JSON.parse(msg);
|
||||
//console.log("Received",data);
|
||||
|
||||
if (data.type == "connected" && data.data == "SD"){
|
||||
console.log("streamdeck connected to server");
|
||||
}
|
||||
|
||||
if (data == undefined || data.payload == undefined) return;
|
||||
//console.log(data);
|
||||
//console.log("Received",data);
|
||||
const action = data.action;
|
||||
const event = data.event;
|
||||
const context = data.context;
|
||||
@@ -53,7 +59,6 @@ async function analyzeWSmessage(msg,passthrough = false){
|
||||
if (coordinates == undefined) coordinates = 0;
|
||||
const settings = data.payload.settings;
|
||||
|
||||
|
||||
if (data.data == 'init'){
|
||||
|
||||
}
|
||||
@@ -62,9 +67,11 @@ async function analyzeWSmessage(msg,passthrough = false){
|
||||
streamDeck.setContext(action,context,coordinates,settings);
|
||||
|
||||
if (action == 'token'){
|
||||
if (selectedTokenId != undefined)
|
||||
tokenControl.update(selectedTokenId);
|
||||
}
|
||||
tokenControl.active = true;
|
||||
tokenControl.update(selectedTokenId);
|
||||
}
|
||||
else if (action == 'move')
|
||||
move.update(settings,context);
|
||||
else if (action == 'macro')
|
||||
macroControl.update(settings,context);
|
||||
else if (action == 'combattracker')
|
||||
@@ -92,17 +99,16 @@ async function analyzeWSmessage(msg,passthrough = false){
|
||||
combatTracker.keyPress(settings,context);
|
||||
else if (action == 'playlist')
|
||||
playlistControl.keyPress(settings,context);
|
||||
else if (action == 'soundboard'){
|
||||
else if (action == 'soundboard')
|
||||
soundboard.keyPressDown(settings);
|
||||
}
|
||||
else if (action == 'other')
|
||||
otherControls.keyPress(settings);
|
||||
}
|
||||
|
||||
else if (event == 'keyUp'){
|
||||
if (action == 'soundboard'){
|
||||
soundboard.keyPressUp(settings);
|
||||
}
|
||||
else if (action == 'other')
|
||||
otherControls.keyPress(settings);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -113,12 +119,11 @@ async function analyzeWSmessage(msg,passthrough = false){
|
||||
* If message is received, reset the interval, and send the message to analyzeWSmessage()
|
||||
*/
|
||||
function startWebsocket() {
|
||||
//ip = localhost;
|
||||
ws = new WebSocket('ws://'+ip+':'+port+'/1');
|
||||
const address = game.settings.get(moduleName,'address');
|
||||
ws = new WebSocket('ws://'+address+'/');
|
||||
|
||||
ws.onmessage = function(msg){
|
||||
//console.log(msg);
|
||||
|
||||
analyzeWSmessage(msg.data);
|
||||
clearInterval(wsInterval);
|
||||
wsInterval = setInterval(resetWS, 5000);
|
||||
@@ -126,12 +131,18 @@ function startWebsocket() {
|
||||
|
||||
ws.onopen = function() {
|
||||
WSconnected = true;
|
||||
ui.notifications.info("Material Deck Connected: "+ip+':'+port);
|
||||
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+address);
|
||||
wsOpen = true;
|
||||
let msg = {
|
||||
type: "Foundry"
|
||||
const msg = {
|
||||
target: "server",
|
||||
module: "MD"
|
||||
}
|
||||
ws.send(JSON.stringify(msg));
|
||||
const msg2 = {
|
||||
target: "SD",
|
||||
type: "init"
|
||||
}
|
||||
ws.send(JSON.stringify(msg2));
|
||||
clearInterval(wsInterval);
|
||||
wsInterval = setInterval(resetWS, 5000);
|
||||
}
|
||||
@@ -167,28 +178,30 @@ export function sendWS(txt){
|
||||
*/
|
||||
Hooks.once('ready', ()=>{
|
||||
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
|
||||
if (enableModule == false) return;
|
||||
|
||||
game.socket.on(`module.MaterialDeck`, (payload) =>{
|
||||
//console.log(payload);
|
||||
if (payload.msgType != "playSound") return;
|
||||
playTrack(payload.trackNr,payload.play,payload.repeat,payload.volume);
|
||||
playTrack(payload.trackNr,payload.src,payload.play,payload.repeat,payload.volume);
|
||||
});
|
||||
|
||||
for (let i=0; i<64; i++)
|
||||
activeSounds[i] = false;
|
||||
|
||||
if (enableModule == false) return;
|
||||
if (game.user.isGM == false) {
|
||||
ready = true;
|
||||
return;
|
||||
}
|
||||
|
||||
startWebsocket();
|
||||
|
||||
soundboard = new SoundboardControl();
|
||||
streamDeck = new StreamDeck();
|
||||
tokenControl = new TokenControl();
|
||||
move = new Move();
|
||||
macroControl = new MacroControl();
|
||||
combatTracker = new CombatTracker();
|
||||
playlistControl = new PlaylistControl();
|
||||
soundboard = new SoundboardControl();
|
||||
otherControls = new OtherControls();
|
||||
|
||||
|
||||
@@ -221,18 +234,9 @@ Hooks.once('ready', ()=>{
|
||||
|
||||
});
|
||||
|
||||
export function playTrack(soundNr,play,repeat,volume){
|
||||
export function playTrack(soundNr,src,play,repeat,volume){
|
||||
if (play){
|
||||
let trackId = game.settings.get(moduleName,'soundboardSettings').sounds[soundNr];
|
||||
let playlistId = game.settings.get(moduleName,'soundboardSettings').playlist;
|
||||
let sounds = game.playlists.entities.find(p => p._id == playlistId).data.sounds;
|
||||
let sound = sounds.find(p => p._id == trackId);
|
||||
if (sound == undefined){
|
||||
activeSounds[soundNr] = false;
|
||||
return;
|
||||
}
|
||||
volume *= game.settings.get("core", "globalInterfaceVolume");
|
||||
let src = sound.path;
|
||||
|
||||
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
|
||||
if (repeat == false){
|
||||
@@ -246,7 +250,8 @@ export function playTrack(soundNr,play,repeat,volume){
|
||||
activeSounds[soundNr] = howl;
|
||||
}
|
||||
else {
|
||||
activeSounds[soundNr].stop();
|
||||
activeSounds[soundNr].stop();
|
||||
activeSounds[soundNr] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,6 +262,18 @@ Hooks.on('updateToken',(scene,token)=>{
|
||||
tokenControl.update(selectedTokenId);
|
||||
});
|
||||
|
||||
Hooks.on('updateActor',(scene,actor)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
let children = canvas.tokens.children[0].children;
|
||||
for (let i=0; i<children.length; i++){
|
||||
if (children[i].actor.id == actor._id){
|
||||
let tokenId = children[i].id;
|
||||
if (tokenId == selectedTokenId)
|
||||
tokenControl.update(selectedTokenId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Hooks.on('controlToken',(token,controlled)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (controlled) {
|
||||
@@ -276,6 +293,7 @@ Hooks.on('renderHotbar', (hotbar)=>{
|
||||
Hooks.on('renderCombatTracker',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
combatTracker.updateAll();
|
||||
tokenControl.update(selectedTokenId);
|
||||
});
|
||||
|
||||
Hooks.on('renderPlaylistDirectory', (playlistDirectory)=>{
|
||||
@@ -309,39 +327,41 @@ Hooks.on('renderSceneControls',()=>{
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.once('init', ()=>{
|
||||
Hooks.on('targetToken',(user,token,targeted)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (token.id == selectedTokenId) tokenControl.update(selectedTokenId);
|
||||
});
|
||||
|
||||
Hooks.on('sidebarCollapse',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('renderCompendium',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('closeCompendium',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('renderJournalSheet',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('closeJournalSheet',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.once('init', ()=>{
|
||||
//CONFIG.debug.hooks = true;
|
||||
registerSettings(); //in ./src/settings.js
|
||||
});
|
||||
|
||||
Hooks.once('canvasReady',()=>{
|
||||
ready = true;
|
||||
});
|
||||
|
||||
export function getFromJSONArray(data,i){
|
||||
if (i>9) return 'nul';
|
||||
let val;
|
||||
if (i == 0) val = data.a;
|
||||
else if (i == 1) val = data.a;
|
||||
else if (i == 2) val = data.c;
|
||||
else if (i == 3) val = data.d;
|
||||
else if (i == 4) val = data.e;
|
||||
else if (i == 5) val = data.f;
|
||||
else if (i == 6) val = data.g;
|
||||
else if (i == 7) val = data.h;
|
||||
else if (i == 8) val = data.i;
|
||||
return val;
|
||||
}
|
||||
|
||||
export function setToJSONArray(data,i,val){
|
||||
if (i>9) return 'nul';
|
||||
if (i == 0) data.a = val;
|
||||
else if (i == 1) data.b = val;
|
||||
else if (i == 2) data.c = val;
|
||||
else if (i == 3) data.d = val;
|
||||
else if (i == 4) data.e = val;
|
||||
else if (i == 5) data.f = val;
|
||||
else if (i == 6) data.g = val;
|
||||
else if (i == 7) data.h = val;
|
||||
else if (i == 8) data.i = val;
|
||||
}
|
||||
});
|
||||
94
README.md
@@ -1,12 +1,96 @@
|
||||
# Stream Deck
|
||||
Material Deck is a Foundry VTT module that allows you to control certain Foundry functions using an Elgato Stream Deck.
|
||||
<b>Note:</b> At the moment Windows and OSX support has been confirmed. Linux support is unknown, there is no official Linux support for the Stream Deck, but there exist a 3rd party <a href="https://timothycrosley.com/project-7-streamdeck_ui">Stream Deck UI</a> that might be compatible.<br>
|
||||
<b>In any case: Proceed at your own risk, I will not take any responsibility if you spent money and the module doesn't work!</b>
|
||||
|
||||
## Instructions
|
||||
Instructions are on the <a href="https://github.com/CDeenen/MaterialDeck/wiki">wiki</a>.
|
||||
<b>Please read the documentation carefully, especially if you want to modify the default profile!</b>
|
||||
|
||||
I created a <a href="https://discord.gg/3hd4G6TkmA">Discord server</a> 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.
|
||||
|
||||
[](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.<br><br>
|
||||
The module allows a high degree of customization, where each button on the Stream Deck can be assigned any desired function. Furthermore, it supports folder structures, allowing easy switching between various button configurations so you can easily switch between the combat tracker, soundboard, or any other (custom) configuration.<br><br>
|
||||
The functions are categorized into actions. Here is a list of the available actions and their most important functions:
|
||||
<ul>
|
||||
<li>Playlist Action: Control Foundry's playlists</li>
|
||||
<ul>
|
||||
<li>Play/Stop playlists</li>
|
||||
<li>Play/Stop tracks</li>
|
||||
<li>Stop all tracks & playlists</li>
|
||||
</ul>
|
||||
<li>Soundboard Action: Play sounds</li>
|
||||
<ul>
|
||||
<li>Play/Stop sound</li>
|
||||
<li>Stop all sounds</li>
|
||||
</ul>
|
||||
<li>Token Action: Display token info</li>
|
||||
<ul>
|
||||
<li>Display selected token's name, icon or stats (HP/AC/Movement/etc)</li>
|
||||
<li>Open selected token's character sheet or token config</li>
|
||||
<li>Target token</li>
|
||||
<li>Toggle token visibility, combat state, conditions</li>
|
||||
</ul>
|
||||
<li>Move Action: Move selected token or the canvas</li>
|
||||
<ul>
|
||||
<li>Move token (in a specified direction)</li>
|
||||
<li>Move canvas (in a specified direction)</li>
|
||||
<li>Zoom canvas in/out</li>
|
||||
</ul>
|
||||
<li>Macro Actions: Execute macros</li>
|
||||
<ul>
|
||||
<li>Execute macro from hotbar</li>
|
||||
<li>Execute macro from macro board</li>
|
||||
</ul>
|
||||
<li>Combat Tracker Actions: Control and display the combat tracker</li>
|
||||
<ul>
|
||||
<li>Display combatants</li>
|
||||
<li>Start/Stop combat</li>
|
||||
<li>Next/Previous turn/round</li>
|
||||
</ul>
|
||||
<li>Other Actions: Misc other actions</li>
|
||||
<ul>
|
||||
<li>Pause/Resume game</li>
|
||||
<li>Scene selection/activation</li>
|
||||
<li>Toggle control buttons</li>
|
||||
<li>Control darkness level</li>
|
||||
<li>Open/Roll from a roll table</li>
|
||||
<li>Open sidebar tab</li>
|
||||
<li>Open compendium pack</li>
|
||||
<li>Open journal entry</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
## Instructions and More Info
|
||||
Instructions and more info can be found in the <a href="https://github.com/CDeenen/MaterialDeck/wiki">wiki</a>.
|
||||
|
||||
## Latest releases
|
||||
<a href="https://github.com/CDeenen/MaterialDeck/releases">Module</a><br>
|
||||
<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Stream Deck</a><br>
|
||||
<a href="https://github.com/CDeenen/MaterialDeck_Server/releases">Server</a><br>
|
||||
<a href="https://github.com/CDeenen/MaterialServer/releases">Server</a><br>
|
||||
<br>
|
||||
Module manifest: https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json
|
||||
|
||||
## Software Versions & Module Incompatibilities
|
||||
<b>Foundry VTT:</b> Tested on 0.7.7<br>
|
||||
<b>Module Incompatibilities:</b> None known.<br>
|
||||
|
||||
## Feedback
|
||||
If you have any suggestions or bugs to report, feel free to create an issue, contact me on Discord (Cris#6864), or send me an email: cdeenen@outlook.com.
|
||||
|
||||
## Credits
|
||||
<b>Author:</b> Cristian Deenen (Cris#6864 on Discord)<br>
|
||||
<br>
|
||||
Special thanks to Asmodeus#7588 who made this module possible by generously donating a Stream Deck XL
|
||||
|
||||
## Abandonment
|
||||
Abandoned modules are a (potential) problem for Foundry, because users and/or other modules might rely on abandoned modules, which might break in future Foundry updates.<br>
|
||||
I consider this module abandoned if all of the below cases apply:
|
||||
<ul>
|
||||
<li>This module/github page has not received any updates in at least 3 months</li>
|
||||
<li>I have not posted anything on "the Foundry", "the League of Extraordinary Foundry VTT Developers" or the "Material Foundry" Discord servers in at least 3 months</li>
|
||||
<li>I have not responded to emails or PMs on Discord in at least 1 month</li>
|
||||
<li>I have not announced a temporary break from development, unless the announced end date of this break has been passed by at least 3 months</li>
|
||||
</ul>
|
||||
If the above cases apply (as judged by the "League of Extraordinary Foundry VTT Developers" admins), I give permission to the "League of Extraordinary Foundry VTT Developers" admins to assign one or more developers to take over this module, including requesting the Foundry team to reassign the module to the new developer(s).<br>
|
||||
I require the "League of Extraordinary Foundry VTT Developers" admins to send me an email 2 weeks before the reassignment takes place, to give me one last chance to prevent the reassignment.<br>
|
||||
I require to be credited for my work in all future releases.
|
||||
|
||||
106
changelog.md
@@ -1,4 +1,108 @@
|
||||
# Changelog Material Deck Module
|
||||
### v1.1.0 - 09-12-2020
|
||||
Fixes
|
||||
<ul>
|
||||
<li>Settings would not show for Combat Tracker action</li>
|
||||
<li>Macro Action => Macro Board default settings fixed</li>
|
||||
</li>
|
||||
Additions/changes:
|
||||
<ul>
|
||||
<li>Added support for Pathfinder 1e and Shadow of the Demon Lord</li>
|
||||
<li>All dialogs that are openable using the SD can now be closed by pressing the button while the dialog is open</li>
|
||||
<li>Playlist Action & Soundboard Action => Stop All now indicates if there are tracks/playlists/sounds playing</li>
|
||||
<li>Confirmed Foundry 0.7.8 compatibility</li>
|
||||
<li>API has been improved, making integration with other hardware/software easier, and making future changes/additions easier</li>
|
||||
<li>Moved default images to Foundry module side instead of Stream Deck plugin</li>
|
||||
</li>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v1.1.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### V1.0.1 - 26-11-2020
|
||||
<ul>
|
||||
<li>Fixed issue where macro from macroboard wouldn't execute if furnace arguments were not defined</li>
|
||||
<li>Fixed issue where soundboard wouldn't save if no previous data existed for that sound</li>
|
||||
</ul>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v1.0.0 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v1.0.0 - 24-11-2020
|
||||
Release
|
||||
<ul>
|
||||
<li>Fixed issue where the last column in 'Soundboard Configuration' would not work properly</li>
|
||||
</ul>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.2: https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v1.0.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v0.9.2 - 24-11-2020
|
||||
<ul>
|
||||
<li>Removed unnecessary errors when module is not fully configured</li>
|
||||
<li>Solved issue that soundboard config couldn't be saved on a world that hadn't run Material Deck previously</li>
|
||||
</ul>
|
||||
|
||||
### v0.9.1 - 23-11-2020
|
||||
<ul>
|
||||
<li>Fixed 'Playlist' action issue where 'TrackNr' wouldn't show</li>
|
||||
<li>Fixed 'Soundboard Configuration' issue where changing the playlist would reset everything you've changed since last save</li>
|
||||
<li>'Soundboard Configuration', 'Macro Configuration' and 'Playlist Configuration' now save after each change, and update the SD instantly</li>
|
||||
<li>Save button has been removed from configuration screens, since it is now redundant</li>
|
||||
<li>Added support for DnD3.5e and Pathfinder 2e</li>
|
||||
</ul>
|
||||
|
||||
<b>Note1:</b> In 'Macro Configuration', previously saved Furnace arguments have to be filled in again.<br>
|
||||
<b>Note2:</b> Any settings set in 'Playlist Configuration' have to be set again<br>
|
||||
<br>
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.1 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v0.9.1: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v0.9.0 - 19-11-2020
|
||||
<ul>
|
||||
<li>Added support for more playlists</li>
|
||||
<li>Added playmode setting for each playlist, which overrides the default playmode</li>
|
||||
<li>Added option to use the file picker to select Soundboard sounds, including support for wildcard names</li>
|
||||
<li>Fixed issue where macro config screen would not close if the module was disabled</li>
|
||||
<li>Fixed issue where the layout of the configuration screens would be messed up depending on browser/screen size</li>
|
||||
<li>Added option to open compendia and journal entries</li>
|
||||
</ul>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.1: https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v0.9.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v0.8.6 - 18-11-2020
|
||||
<ul>
|
||||
<li>Added support for the new Material Server app</li>
|
||||
</ul>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.0: https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v0.7.3: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v0.8.5 - 17-11-2020
|
||||
<ul>
|
||||
<li>Added 'Display Icon' to Macro action</li>
|
||||
<li>Removed background option from 'Macro' => 'Macro Board' => 'Trigger Macro', this is handled in the macro configuration screen</li>
|
||||
<li>Added 'Background' option in 'Macro' => 'Macro Board' => 'Offset'</li>
|
||||
<li>Fixed control buttons from not performing action when clicked</li>
|
||||
<li>Added check for each function to prevent unnecessary searching through the button buffer</li>
|
||||
<li>Added 'Target', 'Visibility', 'Toggle Combat State' and 'Set Condition' options to the 'Token' action (under 'on click')</li>
|
||||
<li>Added 'Zoom In' and 'Zoom Out' functions to 'Move' action</li>
|
||||
<li>Added ability to load icons from web sources</li>
|
||||
<li>Added support for localization (module only)</li>
|
||||
<li>Fixed issue where SD buttons would not load properly if Foundry was initialized before the SD, or if Foundry was refreshed</li>
|
||||
<li>Long words now split up onto multiple lines</li>
|
||||
<li>Confirmed compatibility with Foundry v0.7.7</li>
|
||||
</ul>
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Server v0.2.4 (no change)<br>
|
||||
SD plugin v0.7.2<br>
|
||||
|
||||
### v0.8.4 - 11-11-2020
|
||||
<ul>
|
||||
<li>In 'Other' action, 'Control Button' mode, add 'Displayed Controls' option</li>
|
||||
@@ -9,7 +113,7 @@
|
||||
<li>Newly created actions now show the correct options at the start</li>
|
||||
</ul>
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Server v0.2.4<br>
|
||||
Server v0.2.4 (no change)<br>
|
||||
SD plugin v0.7.1<br>
|
||||
|
||||
### v0.8.3 - 10-11-2020
|
||||
|
||||
BIN
img/combattracker/.thumb/combattracker.png.jpg
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
img/combattracker/.thumb/combattracker@2x.png.jpg
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
img/combattracker/.thumb/nextround.png.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
img/combattracker/.thumb/nextturn.png.jpg
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
img/combattracker/.thumb/previousround.png.jpg
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
img/combattracker/.thumb/previousturn.png.jpg
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
img/combattracker/.thumb/startcombat.png.jpg
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
img/combattracker/.thumb/stopcombat.png.jpg
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
5
img/combattracker/SOURCES.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
combattracker.png: Edited from https://fontawesome.com/icons/fist-raised?style=solid
|
||||
nextturn.png, previousturn.png: Edited from https://fontawesome.com/icons/arrow-right?style=solid
|
||||
nextround.png, previousround.png: Edited from https://fontawesome.com/icons/step-forward?style=solid
|
||||
startcombat.png: Edited from https://fontawesome.com/icons/play?style=solid
|
||||
stopcombat.png: Edited from https://fontawesome.com/icons/stop?style=solid
|
||||
BIN
img/combattracker/combattracker.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/combattracker/combattracker@2x.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/combattracker/nextround.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
img/combattracker/nextturn.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
img/combattracker/previousround.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
img/combattracker/previousturn.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
img/combattracker/startcombat.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
img/combattracker/stopcombat.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
img/macro/.thumb/macro.png.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/macro/.thumb/macro@2x.png.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
1
img/macro/SOURCES.txt
Normal file
@@ -0,0 +1 @@
|
||||
macro.png: Foundry's icon folder, converted from .svg, original name: dice-target.svg
|
||||
BIN
img/macro/macro.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/macro/macro@2x.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/move/.thumb/center.png.jpg
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
img/move/.thumb/center@2x.png.jpg
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
img/move/.thumb/down.png.jpg
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
img/move/.thumb/downleft.png.jpg
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
img/move/.thumb/downright.png.jpg
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
img/move/.thumb/left.png.jpg
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
img/move/.thumb/right.png.jpg
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
img/move/.thumb/up.png.jpg
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
img/move/.thumb/upleft.png.jpg
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
img/move/.thumb/upright.png.jpg
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
img/move/.thumb/zoomin.png.jpg
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
img/move/.thumb/zoomout.png.jpg
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
2
img/move/SOURCES.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
center.png: made by me
|
||||
All other images taken from freepngimg.com, iverted color and rotated. Source: https://freepngimg.com/png/24691-right-arrow-hd
|
||||
BIN
img/move/center.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/move/center@2x.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/move/down.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
img/move/downleft.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
img/move/downright.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
img/move/left.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
img/move/right.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
img/move/up.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
img/move/upleft.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
img/move/upright.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
img/move/zoomin.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
img/move/zoomout.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
img/other/.thumb/other.png.jpg
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
img/other/.thumb/other@2x.png.jpg
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
1
img/other/SOURCES.txt
Normal file
@@ -0,0 +1 @@
|
||||
other.png: Made using https://www.elgato.com/en/gaming/keycreator
|
||||
BIN
img/other/darkness/.thumb/darkness.png.jpg
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
img/other/darkness/.thumb/decreasedarkness.png.jpg
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
img/other/darkness/.thumb/increasedarkness.png.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
2
img/other/darkness/SOURCES.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
decreasedarkness.png: Made using https://www.elgato.com/en/gaming/keycreator
|
||||
increasedarkness.png: Made using https://www.elgato.com/en/gaming/keycreator
|
||||
BIN
img/other/darkness/darkness.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
img/other/darkness/decreasedarkness.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
img/other/darkness/increasedarkness.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
img/other/other.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/other/other@2x.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/other/pause/.thumb/pause.png.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
img/other/pause/.thumb/playpause.png.jpg
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
img/other/pause/.thumb/resume.png.jpg
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
3
img/other/pause/SOURCES.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
resume.png: Edited from https://fontawesome.com/icons/play?style=solid
|
||||
pause.png: Edited from https://fontawesome.com/icons/pause?style=solid
|
||||
playpause.png: Combined resume.png and pause.png
|
||||
BIN
img/other/pause/pause.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
img/other/pause/playpause.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
BIN
img/other/pause/resume.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
img/playlist/.thumb/play.png.jpg
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
img/playlist/.thumb/play@2x.png.jpg
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
img/playlist/.thumb/play_redBrightness.png.jpg
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
img/playlist/.thumb/stop.png.jpg
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
2
img/playlist/SOURCES.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
play.png: Edited from https://fontawesome.com/icons/play?style=solid
|
||||
stop.png: Edited from https://fontawesome.com/icons/stop?style=solid
|
||||
BIN
img/playlist/play.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
img/playlist/play@2x.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
img/playlist/play_redBrightness.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/playlist/stop.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
img/soundboard/.thumb/soundboard.png.jpg
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
img/soundboard/.thumb/soundboard@2x.png.jpg
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
img/soundboard/.thumb/stop.png.jpg
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
2
img/soundboard/SOURCES.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
soundboard.png: Edited from https://fontawesome.com/icons/music?style=solid
|
||||
play.png: Edited from https://fontawesome.com/icons/play?style=solid
|
||||
BIN
img/soundboard/soundboard.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/soundboard/soundboard@2x.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
img/soundboard/stop.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
img/token/.thumb/hp.png.jpg
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
img/token/.thumb/init.png.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
img/token/.thumb/mystery-man.png.jpg
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
img/token/.thumb/mystery-man@2x.png.jpg
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
5
img/token/SOURCES.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
ac.webp: Foundry's icon folder, original name: heater-steel-worn.webp
|
||||
hp.png: made using Elgato's key creator: https://www.elgato.com/en/gaming/keycreator
|
||||
init.png: freepngimg.com, color inverted, from: https://freepngimg.com/png/81025-art-dice-dungeons-system-dragons-d20-triangle/icon
|
||||
speed.webp: Foundry's icon folder, original name: shoes-collared-leather-blue.webp
|
||||
mystery-man.png: Foundry's icon folder, converted from .svg
|
||||
BIN
img/token/ac.webp
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
img/token/hp.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
img/token/init.png
Normal file
|
After Width: | Height: | Size: 121 KiB |
BIN
img/token/mystery-man.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
img/token/mystery-man@2x.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
img/token/speed.webp
Normal file
|
After Width: | Height: | Size: 65 KiB |
74
lang/en.json
@@ -1,39 +1,45 @@
|
||||
{
|
||||
"MaterialDeck.Notifications.Disconnected": "Disconnected from mdServer, attempting to reconnect",
|
||||
"MaterialDeck.Notifications.ConnectFail": "Can't connect to mdServer, retrying",
|
||||
|
||||
"MaterialDeck.Sett.PlaylistConfig": "Playlist Configuration",
|
||||
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
|
||||
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
|
||||
"MaterialDeck.Sett.Brightness": "Brightness",
|
||||
"MaterialDeck.Sett.Brightness_Hint": "LED brightness level",
|
||||
"MaterialDeck.Sett.Enable": "Enable module",
|
||||
"MaterialDeck.Notifications.Disconnected": "Disconnected from Material Server, attempting to reconnect",
|
||||
"MaterialDeck.Notifications.ConnectFail": "Can't connect to Material Server, retrying",
|
||||
"MaterialDeck.Notifications.Connected": "Connected",
|
||||
|
||||
"MaterialDeck.Playlist.Clear": "Clear data",
|
||||
"MaterialDeck.Playlist.Playmethod.Header": "Play Method",
|
||||
"MaterialDeck.Playlist.Playmethod.Label": "Method",
|
||||
"MaterialDeck.Playlist.Playmethod.Unrestricted": "Unrestricted",
|
||||
"MaterialDeck.Playlist.Playmethod.OneTrackPlaylist": "One track per playlist",
|
||||
"MaterialDeck.Playlist.Playmethod.OneTrackTotal": "One track in total",
|
||||
"MaterialDeck.Playlist.Playlists": "Playlists",
|
||||
"MaterialDeck.Playlist.Playlist": "Playlist",
|
||||
"MaterialDeck.Playlist.None": "None",
|
||||
"MaterialDeck.Playlist.Save": "Save",
|
||||
"MaterialDeck.Soundboard.Volume": "Volume",
|
||||
"MaterialDeck.Sett.Enable": "Enable module",
|
||||
"MaterialDeck.Sett.Model": "Stream Deck Model",
|
||||
"MaterialDeck.Sett.Model_Hint": "Reduces the amount of macros and sounds in the macro and soundboard configuration screens. Gives a better overview, but if desired it can be set to XL to get the maximum number. This doesn't influence the operation of the module.",
|
||||
"MaterialDeck.Sett.Model_Mini": "Mini",
|
||||
"MaterialDeck.Sett.Model_Normal": "Normal or Mobile",
|
||||
"MaterialDeck.Sett.Model_XL": "XL",
|
||||
"MaterialDeck.Sett.PlaylistConfig": "Playlist Configuration",
|
||||
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
|
||||
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
|
||||
"MaterialDeck.Sett.ServerAddr": "Material Server Address",
|
||||
"MaterialDeck.Sett.ServerAddrHint": "Fill in the IP address and port of the Material Server. Must follow the format [ip_address]:[port], for example: 'localhost:3001' or '192.168.1.1:4000'.",
|
||||
|
||||
"MaterialDeck.Soundboard.Sound": "Sound",
|
||||
"MaterialDeck.Soundboard.Icon": "Icon",
|
||||
"MaterialDeck.Soundboard.Playback": "Playback",
|
||||
"MaterialDeck.Soundboard.Once": "Once",
|
||||
"MaterialDeck.Soundboard.Repeat": "Repeat",
|
||||
"MaterialDeck.Soundboard.Hold": "Hold",
|
||||
"MaterialDeck.Soundboard.On": "On",
|
||||
"MaterialDeck.Soundboard.Off": "Off",
|
||||
|
||||
"MaterialDeck.Macro.Macro": "Macro",
|
||||
"MaterialDeck.Macro.Background": "Background",
|
||||
"MaterialDeck.Macro.FurnaceArgs": "Furnace arguments",
|
||||
|
||||
"MaterialDeck.Name": "Name"
|
||||
"MaterialDeck.PL.Unrestricted": "Unrestricted",
|
||||
"MaterialDeck.PL.OneTrackPlaylist": "One track per playlist",
|
||||
"MaterialDeck.PL.OneTrackTotal": "One track in total",
|
||||
"MaterialDeck.PL.OneTrack": "One track",
|
||||
"MaterialDeck.PL.Settings": "Settings",
|
||||
"MaterialDeck.PL.Mode": "Default Play Mode",
|
||||
"MaterialDeck.PL.Nr": "Number of playlists",
|
||||
|
||||
"MaterialDeck.Playlists": "Playlists",
|
||||
"MaterialDeck.Playlist": "Playlist",
|
||||
"MaterialDeck.FilePicker": "File Picker",
|
||||
"MaterialDeck.FurnaceArgs": "Furnace arguments",
|
||||
"MaterialDeck.Background": "Background",
|
||||
"MaterialDeck.Macro": "Macro",
|
||||
"MaterialDeck.Sound": "Sound",
|
||||
"MaterialDeck.Icon": "Icon",
|
||||
"MaterialDeck.Once": "Once",
|
||||
"MaterialDeck.Repeat": "Repeat",
|
||||
"MaterialDeck.Hold": "Hold",
|
||||
"MaterialDeck.Playback": "Playback",
|
||||
"MaterialDeck.Volume": "Volume",
|
||||
"MaterialDeck.On": "On",
|
||||
"MaterialDeck.Off": "Off",
|
||||
"MaterialDeck.Name": "Name",
|
||||
"MaterialDeck.None": "None",
|
||||
"MaterialDeck.Save": "Save"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "",
|
||||
"version": "0.8.4",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.1.0",
|
||||
"author": "CDeenen",
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
],
|
||||
"socket": true,
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.6",
|
||||
"compatibleCoreVersion": "0.7.8",
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
|
||||
@@ -3,11 +3,12 @@ import {streamDeck, tokenControl} from "../MaterialDeck.js";
|
||||
|
||||
export class CombatTracker{
|
||||
constructor(){
|
||||
this.active = false;
|
||||
this.combatantLength = 0;
|
||||
}
|
||||
|
||||
async updateAll(){
|
||||
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
let data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'combattracker') continue;
|
||||
@@ -16,18 +17,19 @@ export class CombatTracker{
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
this.active = true;
|
||||
let ctFunction = settings.combatTrackerFunction;
|
||||
if (ctFunction == undefined) ctFunction == 0;
|
||||
if (ctFunction == undefined) ctFunction == 'startStop';
|
||||
|
||||
|
||||
let combat = game.combat;
|
||||
let src = "action/images/black.png";
|
||||
let src = "modules/MaterialDeck/img/black.png";
|
||||
let txt = "";
|
||||
let background = "#000000";
|
||||
let mode = settings.combatTrackerMode;
|
||||
if (mode == undefined) mode = 0;
|
||||
if (mode == undefined) mode = 'combatants';
|
||||
|
||||
if (mode == 0){
|
||||
if (mode == 'combatants'){
|
||||
if (combat != null && combat != undefined && combat.turns.length != 0){
|
||||
let initiativeOrder = combat.turns;
|
||||
let nr = settings.combatantNr - 1;
|
||||
@@ -42,60 +44,57 @@ export class CombatTracker{
|
||||
return;
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setIcon(context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setIcon(context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
else if (mode == 1){
|
||||
else if (mode == 'currentCombatant'){
|
||||
if (combat != null && combat != undefined && combat.started){
|
||||
let tokenId = combat.combatant.tokenId;
|
||||
tokenControl.pushData(tokenId,settings,context);
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setIcon(context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (mode == 2){
|
||||
else if (mode == 'function'){
|
||||
|
||||
if (ctFunction == 0) {
|
||||
if (ctFunction == 'startStop') {
|
||||
if (combat == null || combat == undefined || combat.combatants.length == 0) {
|
||||
src = "action/images/combattracker/startcombat.png";
|
||||
src = "modules/MaterialDeck/img/combattracker/startcombat.png";
|
||||
background = "#000000";
|
||||
}
|
||||
else {
|
||||
if (combat.started == false) {
|
||||
src = "action/images/combattracker/startcombat.png";
|
||||
src = "modules/MaterialDeck/img/combattracker/startcombat.png";
|
||||
background = "#008000";
|
||||
}
|
||||
else {
|
||||
src = "action/images/combattracker/stopcombat.png";
|
||||
src = "modules/MaterialDeck/img/combattracker/stopcombat.png";
|
||||
background = "#FF0000";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ctFunction == 1) {
|
||||
src = "action/images/combattracker/nextturn.png";
|
||||
else if (ctFunction == 'nextTurn') {
|
||||
src = "modules/MaterialDeck/img/combattracker/nextturn.png";
|
||||
}
|
||||
else if (ctFunction == 2) {
|
||||
src = "action/images/combattracker/previousturn.png";
|
||||
else if (ctFunction == 'prevTurn') {
|
||||
src = "modules/MaterialDeck/img/combattracker/previousturn.png";
|
||||
}
|
||||
else if (ctFunction == 3) {
|
||||
src = "action/images/combattracker/nextround.png";
|
||||
else if (ctFunction == 'nextRound') {
|
||||
src = "modules/MaterialDeck/img/combattracker/nextround.png";
|
||||
}
|
||||
else if (ctFunction == 4) {
|
||||
src = "action/images/combattracker/previousround.png";
|
||||
else if (ctFunction == 'prevRound') {
|
||||
src = "modules/MaterialDeck/img/combattracker/previousround.png";
|
||||
}
|
||||
else if (ctFunction == 5){
|
||||
src = "action/images/black.png";
|
||||
else if (ctFunction == 'turnDisplay'){
|
||||
src = "modules/MaterialDeck/img/black.png";
|
||||
let round = 0;
|
||||
let turn = 0;
|
||||
if (combat != null && combat != undefined && combat.started != false){
|
||||
@@ -106,21 +105,50 @@ export class CombatTracker{
|
||||
if (txt != "") txt += "\n";
|
||||
if (settings.displayTurn) txt += "Turn\n"+turn;
|
||||
}
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setIcon(context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
|
||||
keyPress(settings,context){
|
||||
let mode = parseInt(settings.combatTrackerMode);
|
||||
if (isNaN(mode)) mode = 0;
|
||||
let mode = settings.combatTrackerMode;
|
||||
if (mode == undefined) mode = 'combatants';
|
||||
|
||||
if (mode < 2) {
|
||||
if (mode == 'function'){
|
||||
let combat = game.combat;
|
||||
if (combat == null || combat == undefined) return;
|
||||
|
||||
let ctFunction = settings.combatTrackerFunction;
|
||||
if (ctFunction == undefined) ctFunction == 'startStop';
|
||||
if (ctFunction == 'startStop'){
|
||||
let src;
|
||||
let background;
|
||||
if (game.combat.started){
|
||||
game.combat.endCombat();
|
||||
src = "modules/MaterialDeck/img/combattracker/startcombat.png";
|
||||
background = "#000000";
|
||||
}
|
||||
else {
|
||||
game.combat.startCombat();
|
||||
src = "modules/MaterialDeck/img/combattracker/stopcombat.png";
|
||||
background = "#FF0000";
|
||||
}
|
||||
streamDeck.setIcon(context,src,background);
|
||||
return;
|
||||
}
|
||||
if (game.combat.started == false) return;
|
||||
|
||||
if (ctFunction == 'nextTurn') game.combat.nextTurn();
|
||||
else if (ctFunction == 'prevTurn') game.combat.previousTurn();
|
||||
else if (ctFunction == 'nextRound') game.combat.nextRound();
|
||||
else if (ctFunction == 'prevRound') game.combat.previousRound();
|
||||
}
|
||||
else {
|
||||
let onClick = settings.onClick;
|
||||
if (onClick == undefined) onClick = 0;
|
||||
if (onClick == undefined) onClick = 'doNothing';
|
||||
let tokenId;
|
||||
let combat = game.combat;
|
||||
if (mode == 0) {
|
||||
if (mode == 'combatants') {
|
||||
if (combat != null && combat != undefined && combat.turns.length != 0){
|
||||
let initiativeOrder = combat.turns;
|
||||
let nr = settings.combatantNr - 1;
|
||||
@@ -133,62 +161,38 @@ export class CombatTracker{
|
||||
tokenId = combatant.tokenId;
|
||||
}
|
||||
}
|
||||
else if (mode == 1)
|
||||
else if (mode == 'currentCombatant')
|
||||
if (combat != null && combat != undefined && combat.started)
|
||||
tokenId = combat.combatant.tokenId;
|
||||
|
||||
let token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||
let token
|
||||
if (canvas.tokens.children[0] != undefined) token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||
if (token == undefined) return;
|
||||
if (onClick == 0) //Do nothing
|
||||
if (onClick == 'doNothing') //Do nothing
|
||||
return;
|
||||
else if (onClick == 1){ //select token
|
||||
else if (onClick == 'select'){ //select token
|
||||
token.control();
|
||||
}
|
||||
else if (onClick == 2){ //center on token
|
||||
else if (onClick == 'center'){ //center on token
|
||||
let location = token.getCenter(token.x,token.y);
|
||||
canvas.animatePan(location);
|
||||
}
|
||||
else if (onClick == 3){ //center on token and select
|
||||
else if (onClick == 'centerSelect'){ //center on token and select
|
||||
let location = token.getCenter(token.x,token.y);
|
||||
canvas.animatePan(location);
|
||||
token.control();
|
||||
}
|
||||
else if (onClick == 4){ //Open character sheet
|
||||
token.actor.sheet.render(true);
|
||||
else if (onClick == 'charSheet'){ //Open character sheet
|
||||
const element = document.getElementById(token.actor.sheet.id);
|
||||
if (element == null) token.actor.sheet.render(true);
|
||||
else token.actor.sheet.close();
|
||||
}
|
||||
else { //Open token config
|
||||
token.sheet._render(true);
|
||||
else if (onClick == 'tokenConfig'){ //Open token config
|
||||
const element = document.getElementById(token.sheet.id);
|
||||
if (element == null) token.sheet.render(true);
|
||||
else token.sheet.close();
|
||||
}
|
||||
}
|
||||
else if (mode == 2){
|
||||
let combat = game.combat;
|
||||
if (combat == null || combat == undefined) return;
|
||||
|
||||
let ctFunction = settings.combatTrackerFunction;
|
||||
if (ctFunction == undefined) ctFunction == 0;
|
||||
|
||||
if (ctFunction == 0){
|
||||
let src;
|
||||
let background;
|
||||
if (game.combat.started){
|
||||
game.combat.endCombat();
|
||||
src = "action/images/combattracker/startcombat.png";
|
||||
background = "#000000";
|
||||
}
|
||||
else {
|
||||
game.combat.startCombat();
|
||||
src = "action/images/combattracker/stopcombat.png";
|
||||
background = "#FF0000";
|
||||
}
|
||||
streamDeck.setIcon(context,src,background);
|
||||
return;
|
||||
}
|
||||
if (game.combat.started == false) return;
|
||||
|
||||
if (ctFunction == 1) game.combat.nextTurn();
|
||||
else if (ctFunction == 2) game.combat.previousTurn();
|
||||
else if (ctFunction == 3) game.combat.nextRound();
|
||||
else if (ctFunction == 4) game.combat.previousRound();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
115
src/macro.js
@@ -3,10 +3,12 @@ import {streamDeck} from "../MaterialDeck.js";
|
||||
|
||||
export class MacroControl{
|
||||
constructor(){
|
||||
this.active = false;
|
||||
this.offset = 0;
|
||||
}
|
||||
|
||||
async updateAll(){
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
let data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'macro') continue;
|
||||
@@ -15,25 +17,69 @@ export class MacroControl{
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
this.active = true;
|
||||
let mode = settings.macroMode;
|
||||
let displayName = settings.displayName;
|
||||
let macroNumber = settings.macroNumber;
|
||||
let background = settings.background;
|
||||
let icon = false;
|
||||
if (settings.displayIcon) icon = true;
|
||||
let ringColor = "#000000";
|
||||
let ring = 0;
|
||||
if(macroNumber == undefined || isNaN(parseInt(macroNumber))){
|
||||
macroNumber = 0;
|
||||
}
|
||||
if (mode == undefined) mode = 0;
|
||||
if (mode == undefined) mode = 'hotbar';
|
||||
if (displayName == undefined) displayName = false;
|
||||
if (background == undefined) background = '#000000';
|
||||
|
||||
macroNumber = parseInt(macroNumber);
|
||||
|
||||
if (mode == 'macroBoard') { //Macro board
|
||||
let name = "";
|
||||
let src = '';
|
||||
if (settings.macroBoardMode == 'offset') { //Offset
|
||||
let ringOffColor = settings.offRing;
|
||||
if (ringOffColor == undefined) ringOffColor = '#000000';
|
||||
|
||||
//Macro Hotbar
|
||||
if (mode < 2){
|
||||
let ringOnColor = settings.onRing;
|
||||
if (ringOnColor == undefined) ringOnColor = '#00FF00';
|
||||
|
||||
let macroOffset = parseInt(settings.macroOffset);
|
||||
if (macroOffset == undefined || isNaN(macroOffset)) macroOffset = 0;
|
||||
|
||||
if (macroOffset == parseInt(this.offset)) ringColor = ringOnColor;
|
||||
else ringColor = ringOffColor;
|
||||
|
||||
ring = 2;
|
||||
//streamDeck.setIcon(context, "", background,ring,ringColor);
|
||||
}
|
||||
else { //Execute macro
|
||||
macroNumber += this.offset - 1;
|
||||
if (macroNumber < 0) macroNumber = 0;
|
||||
var macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
|
||||
background = game.settings.get(MODULE.moduleName,'macroSettings').color[macroNumber];
|
||||
|
||||
if (background == undefined) background = '#000000';
|
||||
src = "";
|
||||
if (macroId != undefined){
|
||||
let macro = game.macros._source.find(p => p._id == macroId);
|
||||
if (macro != undefined) {
|
||||
name += macro.name;
|
||||
src += macro.img;
|
||||
}
|
||||
}
|
||||
ring = 0;
|
||||
}
|
||||
if (icon) streamDeck.setIcon(context,src,background,ring,ringColor);
|
||||
else streamDeck.setIcon(context, "", background,ring,ringColor);
|
||||
if (displayName == 0) name = "";
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
|
||||
else { //Macro Hotbar
|
||||
let macroId
|
||||
if (mode == 0) macroId = game.user.data.hotbar[macroNumber];
|
||||
if (mode == 'hotbar') macroId = game.user.data.hotbar[macroNumber];
|
||||
else {
|
||||
let macros = game.macros.apps[0].macros;
|
||||
for (let j=0; j<10; j++){
|
||||
@@ -53,55 +99,18 @@ export class MacroControl{
|
||||
src += macro.img;
|
||||
}
|
||||
}
|
||||
|
||||
streamDeck.setIcon(1,context,src,background);
|
||||
if (displayName == 0) name = "";
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
else {
|
||||
let name = "";
|
||||
let src = '';
|
||||
if (settings.macroBoardMode == 0) {
|
||||
macroNumber += this.offset - 1;
|
||||
if (macroNumber < 0) macroNumber = 0;
|
||||
var macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
|
||||
background = game.settings.get(MODULE.moduleName,'macroSettings').color[macroNumber];
|
||||
|
||||
if (background == undefined) background = '#000000';
|
||||
src = "";
|
||||
if (macroId != undefined){
|
||||
let macro = game.macros._source.find(p => p._id == macroId);
|
||||
if (macro != undefined) {
|
||||
name += macro.name;
|
||||
src += macro.img;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
let ringOffColor = settings.offRing;
|
||||
if (ringOffColor == undefined) ringOffColor = '#000000';
|
||||
|
||||
let ringOnColor = settings.onRing;
|
||||
if (ringOnColor == undefined) ringOnColor = '#00FF00';
|
||||
|
||||
let macroOffset = parseInt(settings.macroOffset);
|
||||
if (macroOffset == undefined || isNaN(macroOffset)) macroOffset = 0;
|
||||
|
||||
if (macroOffset == parseInt(this.offset)) ringColor = ringOnColor;
|
||||
else ringColor = ringOffColor;
|
||||
|
||||
ring = 2;
|
||||
}
|
||||
streamDeck.setIcon(1, context,src,background,ring,ringColor);
|
||||
if (icon) streamDeck.setIcon(context,src,background);
|
||||
else streamDeck.setIcon(context, "", background);
|
||||
if (displayName == 0) name = "";
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
hotbar(macros){
|
||||
for (let i=0; i<32; i++){
|
||||
let data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'macro') continue;
|
||||
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
|
||||
let context = data.context;
|
||||
let mode = data.settings.macroMode;
|
||||
let displayName = data.settings.displayName;
|
||||
@@ -135,7 +144,7 @@ export class MacroControl{
|
||||
name += macro.name;
|
||||
src += macro.img;
|
||||
}
|
||||
streamDeck.setIcon(1,context,src,background);
|
||||
streamDeck.setIcon(context,src,background);
|
||||
if (displayName == 0) name = "";
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
@@ -143,24 +152,24 @@ export class MacroControl{
|
||||
|
||||
keyPress(settings){
|
||||
let mode = settings.macroMode;
|
||||
if (mode == undefined) mode = 0;
|
||||
if (mode == undefined) mode = 'hotbar';
|
||||
|
||||
let macroNumber = settings.macroNumber;
|
||||
if(macroNumber == undefined || isNaN(parseInt(macroNumber))){
|
||||
macroNumber = 0;
|
||||
}
|
||||
|
||||
if (mode == 0 || mode == 1)
|
||||
if (mode == 'hotbar' || mode == 'visibleHotbar')
|
||||
this.executeHotbar(macroNumber,mode);
|
||||
else {
|
||||
if (settings.macroBoardMode == 0)
|
||||
this.executeBoard(macroNumber);
|
||||
else {
|
||||
if (settings.macroBoardMode == 'offset') {
|
||||
let macroOffset = settings.macroOffset;
|
||||
if (macroOffset == undefined) macroOffset = 0;
|
||||
this.offset = macroOffset;
|
||||
this.updateAll();
|
||||
}
|
||||
else
|
||||
this.executeBoard(macroNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,11 +199,11 @@ export class MacroControl{
|
||||
if (macroId != undefined){
|
||||
let macro = game.macros.get(macroId);
|
||||
if (macro != undefined && macro != null) {
|
||||
const args = game.settings.get(MODULE.moduleName,'macroArgs')[macroNumber];
|
||||
const args = game.settings.get(MODULE.moduleName,'macroSettings').args;
|
||||
let furnaceEnabled = false;
|
||||
let furnace = game.modules.get("furnace");
|
||||
if (furnace != undefined && furnace.active) furnaceEnabled = true;
|
||||
if (args == "") furnaceEnabled = false;
|
||||
if (args == undefined || args[macroNumber] == undefined || args[macroNumber] == "") furnaceEnabled = false;
|
||||
if (furnaceEnabled == false) macro.execute();
|
||||
else {
|
||||
let chatData = {
|
||||
|
||||