Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1370544f03 | ||
|
|
7bd2084209 | ||
|
|
0ae6336f52 | ||
|
|
8f1a5271dd | ||
|
|
199f9b2d3b | ||
|
|
f178245152 |
@@ -50,9 +50,6 @@ async function analyzeWSmessage(msg){
|
||||
console.log("streamdeck connected to server");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (data == undefined || data.payload == undefined) return;
|
||||
|
||||
const action = data.action;
|
||||
@@ -62,7 +59,6 @@ async function analyzeWSmessage(msg){
|
||||
if (coordinates == undefined) coordinates = 0;
|
||||
const settings = data.payload.settings;
|
||||
|
||||
|
||||
if (data.data == 'init'){
|
||||
|
||||
}
|
||||
@@ -181,7 +177,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;
|
||||
@@ -367,62 +362,4 @@ 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;
|
||||
}
|
||||
});
|
||||
10
README.md
@@ -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.
|
||||
|
||||
[](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>
|
||||
|
||||
31
changelog.md
@@ -1,18 +1,45 @@
|
||||
# Changelog Material Deck Module
|
||||
### 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: https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v0.9.1 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<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>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "",
|
||||
"version": "0.9.1",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.0.1",
|
||||
"author": "CDeenen",
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
|
||||
@@ -46,8 +46,7 @@ export class CombatTracker{
|
||||
else {
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
@@ -63,8 +62,6 @@ export class CombatTracker{
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (mode == 2){
|
||||
|
||||
@@ -139,7 +136,8 @@ export class CombatTracker{
|
||||
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
|
||||
return;
|
||||
|
||||
@@ -196,11 +196,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[number] == undefined || args[macroNumber] == "") furnaceEnabled = false;
|
||||
if (furnaceEnabled == false) macro.execute();
|
||||
else {
|
||||
let chatData = {
|
||||
|
||||
184
src/misc.js
@@ -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"]);
|
||||
|
||||
}
|
||||
|
||||
@@ -135,7 +131,7 @@ export class macroConfigForm extends FormApplication {
|
||||
if (streamDeckModel == 0)
|
||||
width = 550;
|
||||
else if (streamDeckModel == 1)
|
||||
width= 885;
|
||||
width= 1500;
|
||||
else
|
||||
width = 1400;
|
||||
*/
|
||||
@@ -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,12 +268,12 @@ export class soundboardConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
this.data = data;
|
||||
//this.soundData = {};
|
||||
this.playlists = [];
|
||||
this.updatePlaylist = false;
|
||||
this.update = false;
|
||||
this.iMax;
|
||||
this.jMax;
|
||||
this.settings = {};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,17 +311,8 @@ export class soundboardConfigForm extends FormApplication {
|
||||
if (this.update) {
|
||||
this.update=false;
|
||||
return {soundData: this.data};
|
||||
}
|
||||
let selectedSounds = game.settings.get(MODULE.moduleName,'soundboardSettings').sounds;
|
||||
let colorOn = game.settings.get(MODULE.moduleName,'soundboardSettings').colorOn;
|
||||
let colorOff = game.settings.get(MODULE.moduleName,'soundboardSettings').colorOff;
|
||||
let mode = game.settings.get(MODULE.moduleName,'soundboardSettings').mode;
|
||||
let volume = game.settings.get(MODULE.moduleName,'soundboardSettings').volume;
|
||||
let img = game.settings.get(MODULE.moduleName,'soundboardSettings').img;
|
||||
let name = game.settings.get(MODULE.moduleName,'soundboardSettings').name;
|
||||
let selectedPlaylists = game.settings.get(MODULE.moduleName,'soundboardSettings').selectedPlaylists;
|
||||
let src = game.settings.get(MODULE.moduleName,'soundboardSettings').src;
|
||||
|
||||
}
|
||||
this.settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
let playlists = [];
|
||||
playlists.push({id:"none",name:game.i18n.localize("MaterialDeck.None")});
|
||||
playlists.push({id:"FP",name:game.i18n.localize("MaterialDeck.FilePicker")})
|
||||
@@ -345,14 +320,15 @@ export class soundboardConfigForm extends FormApplication {
|
||||
playlists.push({id:game.playlists.entities[i]._id,name:game.playlists.entities[i].name});
|
||||
}
|
||||
|
||||
if (selectedSounds == undefined) selectedSounds = [];
|
||||
if (colorOn == undefined) colorOn = [];
|
||||
if (colorOff == undefined) colorOff = [];
|
||||
if (mode == undefined) mode = [];
|
||||
if (img == undefined) img = [];
|
||||
if (name == undefined) name = [];
|
||||
if (selectedPlaylists == undefined) selectedPlaylists = [];
|
||||
if (src == undefined) src = [];
|
||||
if (this.settings.sounds == undefined) this.settings.sounds = [];
|
||||
if (this.settings.colorOn == undefined) this.settings.colorOn = [];
|
||||
if (this.settings.colorOff == undefined) this.settings.colorOff = [];
|
||||
if (this.settings.mode == undefined) this.settings.mode = [];
|
||||
if (this.settings.img == undefined) this.settings.img = [];
|
||||
if (this.settings.volume == undefined) this.settings.volume = [];
|
||||
if (this.settings.name == undefined) this.settings.name = [];
|
||||
if (this.settings.selectedPlaylists == undefined) this.settings.selectedPlaylists = [];
|
||||
if (this.settings.src == undefined) this.settings.src = [];
|
||||
let soundData = [];
|
||||
|
||||
let streamDeckModel = game.settings.get(MODULE.moduleName,'streamDeckModel');
|
||||
@@ -377,12 +353,12 @@ export class soundboardConfigForm extends FormApplication {
|
||||
for (let i=0; i<this.iMax; i++){
|
||||
let selectedPlaylist;
|
||||
let sounds = [];
|
||||
if (volume == undefined) volume = 50;
|
||||
if (selectedPlaylists[iteration]==undefined) selectedPlaylist = 'none';
|
||||
else if (selectedPlaylists[iteration] == 'none') selectedPlaylist = 'none';
|
||||
else if (selectedPlaylists[iteration] == 'FP') selectedPlaylist = 'FP';
|
||||
if (this.settings.volume[iteration] == undefined) this.settings.volume[iteration] = 50;
|
||||
if (this.settings.selectedPlaylists[iteration]==undefined) selectedPlaylist = 'none';
|
||||
else if (this.settings.selectedPlaylists[iteration] == 'none') selectedPlaylist = 'none';
|
||||
else if (this.settings.selectedPlaylists[iteration] == 'FP') selectedPlaylist = 'FP';
|
||||
else {
|
||||
const pl = game.playlists.entities.find(p => p._id == selectedPlaylists[iteration]);
|
||||
const pl = game.playlists.entities.find(p => p._id == this.settings.selectedPlaylists[iteration]);
|
||||
selectedPlaylist = pl._id;
|
||||
sounds = pl.sounds;
|
||||
}
|
||||
@@ -396,15 +372,15 @@ export class soundboardConfigForm extends FormApplication {
|
||||
iteration: iteration+1,
|
||||
playlists: playlists,
|
||||
selectedPlaylist: selectedPlaylist,
|
||||
sound: selectedSounds[iteration],
|
||||
sound: this.settings.sounds[iteration],
|
||||
sounds: sounds,
|
||||
srcPath: src[iteration],
|
||||
colorOn: colorOn[iteration],
|
||||
colorOff: colorOff[iteration],
|
||||
mode: mode[iteration],
|
||||
volume: volume[iteration],
|
||||
imgPath: img[iteration],
|
||||
name: name[iteration],
|
||||
srcPath: this.settings.src[iteration],
|
||||
colorOn: this.settings.colorOn[iteration],
|
||||
colorOff: this.settings.colorOff[iteration],
|
||||
mode: this.settings.mode[iteration],
|
||||
volume: this.settings.volume[iteration],
|
||||
imgPath: this.settings.img[iteration],
|
||||
name: this.settings.name[iteration],
|
||||
styleSS: styleSS,
|
||||
styleFP: styleFP
|
||||
}
|
||||
@@ -429,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) {
|
||||
@@ -470,22 +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');
|
||||
settings.name[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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;
|
||||
@@ -510,94 +460,86 @@ export class soundboardConfigForm extends FormApplication {
|
||||
this.data[j].dataThis[i].styleFP=styleFP;
|
||||
this.update = true;
|
||||
|
||||
let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
settings.selectedPlaylists[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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');
|
||||
settings.sounds[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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');
|
||||
settings.src[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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');
|
||||
settings.img[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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');
|
||||
settings.colorOn[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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');
|
||||
settings.colorOff[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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');
|
||||
settings.mode[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
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');
|
||||
settings.volume[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
this.settings.volume[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export class Move{
|
||||
}
|
||||
|
||||
keyPress(settings){
|
||||
console.log('move',settings)
|
||||
if (canvas.scene == null) return;
|
||||
let dir = settings.dir;
|
||||
let mode = settings.mode;
|
||||
if (mode == undefined) mode = 0;
|
||||
|
||||
@@ -133,6 +133,7 @@ export class OtherControls{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateScene(settings,context){
|
||||
if (canvas.scene == null) return;
|
||||
let func = settings.sceneFunction;
|
||||
if (func == undefined) func = 0;
|
||||
|
||||
@@ -168,7 +169,6 @@ export class OtherControls{
|
||||
if (settings.displaySceneIcon) src = scene.img;
|
||||
if (scene.active) name += "\n(Active)";
|
||||
}
|
||||
|
||||
}
|
||||
else if (func == 1) { //all scenes
|
||||
let scene = game.scenes.apps[1].entities.find(p=>p.data.name == name);
|
||||
@@ -305,6 +305,7 @@ export class OtherControls{
|
||||
}
|
||||
|
||||
keyPressControl(settings){
|
||||
if (canvas.scene == null) return;
|
||||
let control = settings.control;
|
||||
if (control == undefined) control = 0;
|
||||
|
||||
@@ -474,7 +475,8 @@ export class OtherControls{
|
||||
}
|
||||
else if (func == 2){ //display darkness
|
||||
src = 'action/images/other/darkness/darkness.png';
|
||||
let darkness = Math.floor(canvas.scene.data.darkness*100)/100;
|
||||
let darkness = '';
|
||||
if (canvas.scene != null) darkness = Math.floor(canvas.scene.data.darkness*100)/100;
|
||||
txt += darkness;
|
||||
}
|
||||
streamDeck.setTitle(txt,context);
|
||||
@@ -482,6 +484,7 @@ export class OtherControls{
|
||||
}
|
||||
|
||||
keyPressDarkness(settings) {
|
||||
if (canvas.scene == null) return;
|
||||
let func = settings.darknessFunction;
|
||||
if (func == undefined) func = 0;
|
||||
|
||||
@@ -659,7 +662,6 @@ export class OtherControls{
|
||||
let ringOnColor = settings.onRing;
|
||||
if (ringOnColor == undefined) ringOnColor = '#00FF00';
|
||||
|
||||
|
||||
if (compendium.rendered) ringColor = ringOnColor;
|
||||
else ringColor = ringOffColor;
|
||||
|
||||
@@ -698,8 +700,6 @@ export class OtherControls{
|
||||
|
||||
let ringOnColor = settings.onRing;
|
||||
if (ringOnColor == undefined) ringOnColor = '#00FF00';
|
||||
|
||||
|
||||
|
||||
if (journal.sheet.rendered) ringColor = ringOnColor;
|
||||
else ringColor = ringOffColor;
|
||||
@@ -714,7 +714,7 @@ export class OtherControls{
|
||||
|
||||
const journal = game.journal.entries.find(p=>p.name == name);
|
||||
if (journal == undefined) return;
|
||||
//if (journal.sheet.rendered) journal.close();
|
||||
|
||||
journal.render(true);
|
||||
}
|
||||
}
|
||||
@@ -143,13 +143,14 @@ export class PlaylistControl{
|
||||
const mode = settings.playlistMode[playlistNr];
|
||||
if (mode == 0) playing[i].stopAll();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
getPlaylist(num){
|
||||
let playlistId = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist[num];
|
||||
return game.playlists.entities.find(p => p._id == playlistId);
|
||||
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
|
||||
if (selectedPlaylists != undefined)
|
||||
return game.playlists.entities.find(p => p._id == selectedPlaylists[num]);
|
||||
else return undefined;
|
||||
}
|
||||
|
||||
keyPress(settings,context){
|
||||
@@ -225,7 +226,4 @@ export class PlaylistControl{
|
||||
await playlist.updateEmbeddedEntity("PlaylistSound", {_id: track._id, playing: play});
|
||||
playlist.update({playing: play});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -45,8 +45,8 @@ export class SoundboardControl{
|
||||
else
|
||||
ringColor = soundboardSettings.colorOn[soundNr];
|
||||
|
||||
if (settings.displayName) txt = soundboardSettings.name[soundNr];
|
||||
if (settings.displayIcon) src = soundboardSettings.img[soundNr];
|
||||
if (settings.displayName && soundboardSettings.name != undefined) txt = soundboardSettings.name[soundNr];
|
||||
if (settings.displayIcon && soundboardSettings.img != undefined) src = soundboardSettings.img[soundNr];
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(1,context,src,background,2,ringColor);
|
||||
}
|
||||
@@ -119,7 +119,8 @@ export class SoundboardControl{
|
||||
|
||||
async playSound(soundNr,repeat,play){
|
||||
const soundBoardSettings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
const playlistId = soundBoardSettings.selectedPlaylists[soundNr];
|
||||
let playlistId;
|
||||
if (soundBoardSettings.selectedPlaylists != undefined) playlistId = soundBoardSettings.selectedPlaylists[soundNr];
|
||||
let src;
|
||||
if (playlistId == "" || playlistId == undefined) return;
|
||||
if (playlistId == 'none') return;
|
||||
@@ -176,6 +177,5 @@ export class SoundboardControl{
|
||||
this.activeSounds[soundNr] = false;
|
||||
}
|
||||
this.updateAll();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,6 @@ export class StreamDeck{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get syllables of a word. Taken from: https://stackoverflow.com/a/49407494
|
||||
@@ -70,7 +69,7 @@ export class StreamDeck{
|
||||
return words.match(this.syllableRegex);
|
||||
}
|
||||
|
||||
formatTitle(txt){
|
||||
formatTitle(txt=''){
|
||||
let txtArrayOriginal = txt.split("\n");
|
||||
let txtArray = [];
|
||||
let counter = 0;
|
||||
@@ -136,6 +135,7 @@ export class StreamDeck{
|
||||
}
|
||||
|
||||
setTitle(txt,context){
|
||||
if (txt == null || txt == undefined) txt = '';
|
||||
txt = this.formatTitle(txt);
|
||||
for (let i=0; i<32; i++){
|
||||
if (this.buttonContext[i] == undefined) continue;
|
||||
@@ -171,8 +171,6 @@ export class StreamDeck{
|
||||
}
|
||||
|
||||
setImage(image,context){
|
||||
//var image = "data:image/svg+xml;charset=utf8,<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 288 288\" style=\"enable-background:new 0 0 288 288;\" xml:space=\"preserve\"> <style> .text { font-family: sans-serif; fill: red; font-size: 10em; } </style><g> <text x=\"0px\" y=\"100px\" class=\"text\">GPUUTILIZATION</text></g></svg>";
|
||||
|
||||
var json = {
|
||||
target: "SD",
|
||||
event: "setImage",
|
||||
@@ -185,7 +183,8 @@ export class StreamDeck{
|
||||
MODULE.sendWS(JSON.stringify(json));
|
||||
}
|
||||
|
||||
setIcon(iconLocation, context,src,background = '#000000',ring=0,ringColor = "#000000",overlay=false){
|
||||
setIcon(iconLocation, context,src='',background = '#000000',ring=0,ringColor = "#000000",overlay=false){
|
||||
if (src == null || src == undefined) src = '';
|
||||
for (let i=0; i<32; i++){
|
||||
if (this.buttonContext[i] == undefined) continue;
|
||||
if (this.buttonContext[i].context == context) {
|
||||
@@ -269,7 +268,6 @@ export class StreamDeck{
|
||||
getImage(data){
|
||||
if (data == undefined)
|
||||
return;
|
||||
//console.log('image',data)
|
||||
const context = data.context;
|
||||
var url = data.url;
|
||||
const format = data.format;
|
||||
@@ -291,7 +289,7 @@ export class StreamDeck{
|
||||
canvas.id = canvasId;
|
||||
canvas.width="144";
|
||||
canvas.height="144";
|
||||
canvas.style="background-color:transparent";
|
||||
canvas.style="background-color:transparent;visibility:hidden";
|
||||
document.getElementById('sdCanvasBox').appendChild(canvas); // adds the canvas to #someBox
|
||||
}
|
||||
this.counter++;
|
||||
|
||||
@@ -16,7 +16,6 @@ export class TokenControl{
|
||||
}
|
||||
|
||||
pushData(tokenId,settings,context,ring=0,ringColor='#000000'){
|
||||
console.log('token',settings);
|
||||
let name = false;
|
||||
let icon = false;
|
||||
let stats = settings.stats;
|
||||
@@ -258,7 +257,7 @@ export class TokenControl{
|
||||
const tokenId = MODULE.selectedTokenId;
|
||||
|
||||
let onClick = settings.onClick;
|
||||
if (onClick == undefined) conClick = 0;
|
||||
if (onClick == undefined) onClick = 0;
|
||||
|
||||
const token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||
if (token == undefined) return;
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Name"}}
|
||||
</div>
|
||||
<input type="text" name="namebox" value="{{this.name}}" id="name{{this.iteration}}">
|
||||
<input type="text" name="namebox" value="{{this.name}}" id="name{{this.iteration}}" style="width:100%;" >
|
||||
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Playlist"}}
|
||||
</div>
|
||||
<div>
|
||||
<select name="playlist" class="playlist-select" default="" style="width:132px;" id="playlists{{this.iteration}}">
|
||||
<select name="playlist" class="playlist-select" default="" style="width:100%;" id="playlists{{this.iteration}}">
|
||||
{{#select this.selectedPlaylist}}
|
||||
{{#each playlists}}
|
||||
<option value="{{this.id}}">{{this.name}}</option>
|
||||
@@ -37,7 +37,7 @@
|
||||
{{localize "MaterialDeck.Sound"}}
|
||||
</div>
|
||||
<div class="form-fields" style={{this.styleSS}}>
|
||||
<select name="sounds" class="sounds-select" default="" style="width:132px;" id="soundSelect{{this.iteration}}">
|
||||
<select name="sounds" class="sounds-select" default="" style="width:100%;" id="soundSelect{{this.iteration}}">
|
||||
{{#select this.sound}}
|
||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||
{{#each sounds}}
|
||||
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 21 KiB |
BIN
wiki/img/.thumb/Youtube.png.jpg
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 204 KiB |
BIN
wiki/img/Youtube.png
Normal file
|
After Width: | Height: | Size: 96 KiB |