4 Commits

Author SHA1 Message Date
CDeenen
fc471ce400 v1.1.0 2020-12-09 03:22:22 +01:00
CDeenen
1370544f03 v1.0.1 2020-11-26 02:59:36 +01:00
CDeenen
7bd2084209 readme update 2020-11-24 18:49:11 +01:00
CDeenen
0ae6336f52 v1.0.0 2020-11-24 18:48:25 +01:00
113 changed files with 649 additions and 709 deletions

View File

@@ -50,11 +50,8 @@ async function analyzeWSmessage(msg){
console.log("streamdeck connected to server");
}
if (data == undefined || data.payload == undefined) return;
//console.log("Received",data);
const action = data.action;
const event = data.event;
const context = data.context;
@@ -62,7 +59,6 @@ async function analyzeWSmessage(msg){
if (coordinates == undefined) coordinates = 0;
const settings = data.payload.settings;
if (data.data == 'init'){
}
@@ -74,6 +70,8 @@ async function analyzeWSmessage(msg){
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')
@@ -181,7 +179,6 @@ export function sendWS(txt){
Hooks.once('ready', ()=>{
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
game.socket.on(`module.MaterialDeck`, (payload) =>{
//console.log(payload);
if (payload.msgType != "playSound") return;
@@ -368,61 +365,3 @@ Hooks.once('init', ()=>{
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;
else if (i == 9) val = data.j;
else if (i == 10) val = data.k;
else if (i == 11) val = data.l;
else if (i == 12) val = data.m;
else if (i == 13) val = data.n;
else if (i == 14) val = data.o;
else if (i == 15) val = data.p;
else if (i == 16) val = data.q;
else if (i == 17) val = data.r;
else if (i == 18) val = data.s;
else if (i == 19) val = data.t;
else if (i == 20) val = data.u;
else if (i == 21) val = data.v;
else if (i == 22) val = data.w;
else if (i == 23) val = data.x;
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;
else if (i == 9) data.j = val;
else if (i == 10) data.k = val;
else if (i == 11) data.l = val;
else if (i == 12) data.m = val;
else if (i == 13) data.n = val;
else if (i == 14) data.o = val;
else if (i == 15) data.p = val;
else if (i == 16) data.q = val;
else if (i == 17) data.r = val;
else if (i == 18) data.s = val;
else if (i == 19) data.t = val;
else if (i == 20) data.u = val;
else if (i == 21) data.v = val;
else if (i == 22) data.w = val;
else if (i == 23) data.x = val;
}

View File

@@ -1,8 +1,12 @@
<b>Note:</b> At the moment only Windows support has been confirmed. Right now it doesn't appear to work on MacOS. 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>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>
<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.
[![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.<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>
@@ -21,8 +25,10 @@ The functions are categorized into actions. Here is a list of the available acti
</ul>
<li>Token Action: Display token info</li>
<ul>
<li>Display selected token's name, icon or stats (HP/AC/Movement/Initiative)</li>
<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>

View File

@@ -1,4 +1,44 @@
# 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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

1
img/macro/SOURCES.txt Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/macro/macro@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
img/move/.thumb/up.png.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

2
img/move/SOURCES.txt Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/move/center@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/move/down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
img/move/downleft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
img/move/downright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
img/move/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
img/move/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
img/move/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
img/move/upleft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
img/move/upright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
img/move/zoomin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
img/move/zoomout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

1
img/other/SOURCES.txt Normal file
View File

@@ -0,0 +1 @@
other.png: Made using https://www.elgato.com/en/gaming/keycreator

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
img/other/other.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/other/other@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
img/other/pause/resume.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

2
img/playlist/SOURCES.txt Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
img/playlist/play@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/playlist/stop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
img/soundboard/stop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
img/token/.thumb/hp.png.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

5
img/token/SOURCES.txt Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
img/token/hp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
img/token/init.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

BIN
img/token/mystery-man.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
img/token/speed.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -1,15 +1,15 @@
{
"name": "MaterialDeck",
"title": "Material Deck",
"description": "",
"version": "0.9.2",
"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.7",
"compatibleCoreVersion": "0.7.8",
"languages": [
{
"lang": "en",

View File

@@ -19,17 +19,17 @@ 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;
@@ -44,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){
@@ -108,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;
@@ -135,63 +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
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();
}
}
}

View File

@@ -29,16 +29,57 @@ export class MacroControl{
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);
//Macro Hotbar
if (mode < 2){
if (mode == 'macroBoard') { //Macro board
let name = "";
let src = '';
if (settings.macroBoardMode == 'offset') { //Offset
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(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++){
@@ -58,56 +99,18 @@ export class MacroControl{
src += macro.img;
}
}
if (icon) streamDeck.setIcon(1,context,src,background);
else streamDeck.setIcon(0, context, "", background);
if (icon) streamDeck.setIcon(context,src,background);
else streamDeck.setIcon(context, "", background);
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
else { //Macro board
let name = "";
let src = '';
if (settings.macroBoardMode == 0) { //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;
}
}
}
else { //Offset
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;
}
if (icon) streamDeck.setIcon(1, context,src,background,ring,ringColor);
else streamDeck.setIcon(0, context, "", background,ring,ringColor);
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;
@@ -141,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);
}
@@ -149,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);
}
}
@@ -196,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,'macroSettings').args[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 = {

View File

@@ -72,10 +72,6 @@ export class playlistConfigForm extends FormApplication {
* @param {*} formData
*/
async _updateObject(event, formData) {
// await game.settings.set(MODULE.moduleName,'selectedPlaylists', formData["selectedPlaylist"]);
// await game.settings.set(MODULE.moduleName,'playlistMethod',formData["playMethod"]);
// await game.settings.set(MODULE.moduleName,'numberOfPlaylists',formData["plNum"]);
// await game.settings.set(MODULE.moduleName,'selectedPlaylistMode',formData["playlistMethod"]);
}
@@ -228,19 +224,7 @@ export class macroConfigForm extends FormApplication {
* @param {*} formData
*/
async _updateObject(event, formData) {
/*
await game.settings.set(MODULE.moduleName,'macroSettings',{
macros: formData["macros"],
color: formData["colorPicker"],
args: formData["args"]
});
let furnace = game.modules.get("furnace");
if (furnace != undefined && furnace.active)
await game.settings.set(MODULE.moduleName,'macroArgs', formData["args"]);
if (MODULE.enableModule)
macroControl.updateAll();
*/
}
activateListeners(html) {
@@ -284,7 +268,6 @@ export class soundboardConfigForm extends FormApplication {
constructor(data, options) {
super(data, options);
this.data = data;
//this.soundData = {};
this.playlists = [];
this.updatePlaylist = false;
this.update = false;
@@ -330,18 +313,6 @@ export class soundboardConfigForm extends FormApplication {
return {soundData: this.data};
}
this.settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
/*
let selectedSounds = this.settings.sounds;
let colorOn = this.settings.colorOn;
let colorOff = this.settings.colorOff;
let mode = this.settings.mode;
let volume = this.settings.volume;
let img = this.settings.img;
let name = this.settings.name;
let selectedPlaylists = this.settings.selectedPlaylists;
let src = this.settings.src;
*/
let playlists = [];
playlists.push({id:"none",name:game.i18n.localize("MaterialDeck.None")});
playlists.push({id:"FP",name:game.i18n.localize("MaterialDeck.FilePicker")})
@@ -434,32 +405,7 @@ export class soundboardConfigForm extends FormApplication {
* @param {*} formData
*/
async _updateObject(event, formData) {
/*
let length = formData["sounds"].length;
let img = [];
let soundSrc = []
for (let i=0; i<length; i++){
let name = "img"+(i+1);
let src = formData[name];
img[i] = src;
name = "src"+(i+1);
src = formData[name];
soundSrc[i] = src;
}
await game.settings.set(MODULE.moduleName,'soundboardSettings',{
selectedPlaylists: formData["playlist"],
sounds: formData["sounds"],
colorOn: formData["colorOn"],
colorOff: formData["colorOff"],
mode: formData["mode"],
img: img,
volume: formData["volume"],
name: formData["namebox"],
src: soundSrc
});
*/
}
async activateListeners(html) {
@@ -475,23 +421,21 @@ export class soundboardConfigForm extends FormApplication {
const volume = html.find("input[name='volume']");
nameField.on("change",event => {
let id = event.target.id.replace('name','');
let id = event.target.id.replace('name','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].name=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
//console.log('settings',settings);
this.settings.name[id-1]=event.target.value;
this.settings.name[id]=event.target.value;
this.updateSettings(this.settings);
});
if (playlistSelect.length > 0) {
playlistSelect.on("change", event => {
let id = event.target.id.replace('playlists','');
let id = event.target.id.replace('playlists','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].selectedPlaylist=event.target.value;
let selectedPlaylist;
@@ -516,93 +460,85 @@ export class soundboardConfigForm extends FormApplication {
this.data[j].dataThis[i].styleFP=styleFP;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.selectedPlaylists[id-1]=event.target.value;
this.settings.selectedPlaylists[id]=event.target.value;
this.updateSettings(this.settings);
});
}
soundSelect.on("change", event => {
let id = event.target.id.replace('soundSelect','');
let id = event.target.id.replace('soundSelect','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].sound=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.sounds[id-1]=event.target.value;
this.settings.sounds[id]=event.target.value;
this.updateSettings(this.settings);
});
soundFP.on("change",event => {
let id = event.target.id.replace('srcPath','');
let id = event.target.id.replace('srcPath','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].srcPath=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.src[id-1]=event.target.value;
this.settings.src[id]=event.target.value;
this.updateSettings(this.settings);
});
imgFP.on("change",event => {
let id = event.target.id.replace('imgPath','');
let id = event.target.id.replace('imgPath','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].imgPath=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.img[id-1]=event.target.value;
this.settings.img[id]=event.target.value;
this.updateSettings(this.settings);
});
onCP.on("change",event => {
let id = event.target.id.replace('colorOn','');
let id = event.target.id.replace('colorOn','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].colorOn=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.colorOn[id-1]=event.target.value;
this.settings.colorOn[id]=event.target.value;
this.updateSettings(this.settings);
});
offCP.on("change",event => {
let id = event.target.id.replace('colorOff','');
let id = event.target.id.replace('colorOff','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].colorOff=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.colorOff[id-1]=event.target.value;
this.settings.colorOff[id]=event.target.value;
this.updateSettings(this.settings);
});
playMode.on("change",event => {
let id = event.target.id.replace('playmode','');
let id = event.target.id.replace('playmode','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].mode=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.mode[id-1]=event.target.value;
this.settings.mode[id]=event.target.value;
this.updateSettings(this.settings);
});
volume.on("change",event => {
let id = event.target.id.replace('volume','');
let id = event.target.id.replace('volume','')-1;
let j = Math.floor(id/this.jMax);
let i = id % this.jMax-1;
let i = id % this.jMax;
this.data[j].dataThis[i].volume=event.target.value;
this.update = true;
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
this.settings.volume[id-1]=event.target.value;
this.settings.volume[id]=event.target.value;
this.updateSettings(this.settings);
});
}

Some files were not shown because too many files have changed in this diff Show More