v0.9.2
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
# Changelog Material Deck Module
|
||||
### 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>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "",
|
||||
"version": "0.9.1",
|
||||
"version": "0.9.2",
|
||||
"author": "CDeenen",
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
|
||||
@@ -139,7 +139,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;
|
||||
|
||||
124
src/misc.js
124
src/misc.js
@@ -135,7 +135,7 @@ export class macroConfigForm extends FormApplication {
|
||||
if (streamDeckModel == 0)
|
||||
width = 550;
|
||||
else if (streamDeckModel == 1)
|
||||
width= 885;
|
||||
width= 1500;
|
||||
else
|
||||
width = 1400;
|
||||
*/
|
||||
@@ -290,6 +290,7 @@ export class soundboardConfigForm extends FormApplication {
|
||||
this.update = false;
|
||||
this.iMax;
|
||||
this.jMax;
|
||||
this.settings = {};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,16 +328,19 @@ 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 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")});
|
||||
@@ -345,14 +349,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 +382,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 +401,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
|
||||
}
|
||||
@@ -476,9 +481,10 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
//console.log('settings',settings);
|
||||
this.settings.name[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
if (playlistSelect.length > 0) {
|
||||
@@ -510,9 +516,9 @@ 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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.selectedPlaylists[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -523,9 +529,9 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.sounds[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
soundFP.on("change",event => {
|
||||
@@ -535,9 +541,9 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.src[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
imgFP.on("change",event => {
|
||||
@@ -547,9 +553,9 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.img[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
onCP.on("change",event => {
|
||||
@@ -559,9 +565,9 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.colorOn[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
offCP.on("change",event => {
|
||||
@@ -571,9 +577,9 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.colorOff[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
playMode.on("change",event => {
|
||||
@@ -583,9 +589,9 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.mode[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
volume.on("change",event => {
|
||||
@@ -595,9 +601,9 @@ export class soundboardConfigForm extends FormApplication {
|
||||
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);
|
||||
//let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings.volume[id-1]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ export class Move{
|
||||
}
|
||||
|
||||
keyPress(settings){
|
||||
console.log('move',settings)
|
||||
if (canvas.scene == null) return;
|
||||
//console.log('move',settings)
|
||||
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;
|
||||
|
||||
@@ -216,6 +217,7 @@ export class OtherControls{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateControl(settings,context){
|
||||
//if (canvas.scene == null) return;
|
||||
let control = settings.control;
|
||||
if (control == undefined) control = 0;
|
||||
|
||||
@@ -305,6 +307,7 @@ export class OtherControls{
|
||||
}
|
||||
|
||||
keyPressControl(settings){
|
||||
if (canvas.scene == null) return;
|
||||
let control = settings.control;
|
||||
if (control == undefined) control = 0;
|
||||
|
||||
@@ -474,7 +477,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 +486,7 @@ export class OtherControls{
|
||||
}
|
||||
|
||||
keyPressDarkness(settings) {
|
||||
if (canvas.scene == null) return;
|
||||
let func = settings.darknessFunction;
|
||||
if (func == undefined) func = 0;
|
||||
|
||||
|
||||
@@ -148,8 +148,10 @@ export class PlaylistControl{
|
||||
}
|
||||
|
||||
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){
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -70,7 +70,7 @@ export class StreamDeck{
|
||||
return words.match(this.syllableRegex);
|
||||
}
|
||||
|
||||
formatTitle(txt){
|
||||
formatTitle(txt=''){
|
||||
let txtArrayOriginal = txt.split("\n");
|
||||
let txtArray = [];
|
||||
let counter = 0;
|
||||
@@ -185,7 +185,7 @@ 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){
|
||||
for (let i=0; i<32; i++){
|
||||
if (this.buttonContext[i] == undefined) continue;
|
||||
if (this.buttonContext[i].context == context) {
|
||||
@@ -291,7 +291,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,7 @@ export class TokenControl{
|
||||
}
|
||||
|
||||
pushData(tokenId,settings,context,ring=0,ringColor='#000000'){
|
||||
console.log('token',settings);
|
||||
//console.log('token',settings);
|
||||
let name = false;
|
||||
let icon = false;
|
||||
let stats = settings.stats;
|
||||
@@ -258,7 +258,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;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
{{localize "MaterialDeck.Macro"}} {{this.iteration}}
|
||||
</div>
|
||||
<div>
|
||||
<select name="macros" class="macros-select" id="macros{{this.iteration}}" default="" style="max-width:140px;">
|
||||
<select name="macros" class="macros-select" id="macros{{this.iteration}}" default="" style="min-width:140px;">
|
||||
{{#select this.macro}}
|
||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||
{{#each macros}}
|
||||
|
||||
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user