6 Commits

Author SHA1 Message Date
CDeenen
2947c54eb8 v1.2.0 2020-12-28 05:31:59 +01:00
CDeenen
561e3f4bd0 Update README.md 2020-12-19 08:01:28 +01:00
CDeenen
33f27047b1 changelog fix 2020-12-12 19:32:07 +01:00
CDeenen
7c532f5155 v1.1.1 2020-12-12 19:17:34 +01:00
CDeenen
e62e82795b v1.1.1 2020-12-12 19:16:07 +01:00
CDeenen
91e07e79c5 changelog fix 2020-12-09 03:32:32 +01:00
32 changed files with 340 additions and 26 deletions

View File

@@ -7,6 +7,7 @@ import {CombatTracker} from "./src/combattracker.js";
import {PlaylistControl} from "./src/playlist.js";
import {SoundboardControl} from "./src/soundboard.js";
import {OtherControls} from "./src/othercontrols.js";
import {ExternalModules} from "./src/external.js";
export var streamDeck;
export var tokenControl;
var move;
@@ -15,6 +16,7 @@ export var combatTracker;
export var playlistControl;
export var soundboard;
export var otherControls;
export var externalModules;
export const moduleName = "MaterialDeck";
export var selectedTokenId;
@@ -82,6 +84,8 @@ async function analyzeWSmessage(msg){
soundboard.update(settings,context);
else if (action == 'other')
otherControls.update(settings,context);
else if (action == 'external')
externalModules.update(settings,context);
}
else if (event == 'willDisappear'){
@@ -103,6 +107,8 @@ async function analyzeWSmessage(msg){
soundboard.keyPressDown(settings);
else if (action == 'other')
otherControls.keyPress(settings);
else if (action == 'external')
externalModules.keyPress(settings,context);
}
else if (event == 'keyUp'){
@@ -203,6 +209,7 @@ Hooks.once('ready', ()=>{
combatTracker = new CombatTracker();
playlistControl = new PlaylistControl();
otherControls = new OtherControls();
externalModules = new ExternalModules();
let soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
@@ -320,6 +327,7 @@ Hooks.on('renderSidebarTab',()=>{
Hooks.on('updateScene',()=>{
if (enableModule == false || ready == false) return;
otherControls.updateAll();
externalModules.updateAll();
});
Hooks.on('renderSceneControls',()=>{

View File

@@ -71,7 +71,7 @@ Instructions and more info can be found in the <a href="https://github.com/CDeen
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>Foundry VTT:</b> Tested on 0.7.5-0.7.9<br>
<b>Module Incompatibilities:</b> None known.<br>
## Feedback
@@ -81,6 +81,8 @@ If you have any suggestions or bugs to report, feel free to create an issue, con
<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
<br>
Please consider supporting me on <a href="https://www.patreon.com/materialfoundry">Patreon</a>, and feel free to join the Material Foundry <a href="https://discord.gg/3hd4G6TkmA">Discord</a> server.
## 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>

View File

@@ -1,19 +1,45 @@
# Changelog Material Deck Module
### v1.2.0 - 28-12-2020
Fixes
<ul>
<li>Incorrect link to some black backgrounds fixed</li>
<li>Token Action: Movement speed wouldn't be displayed for DnD5e 1.2.0</li>
<li>Macro Action => Hotbar: 10th macro would not trigger and display correctly</li>
<li>Combat Tracker Action => Function: Default value would not properly initialize</li>
<li>Other Actions => Darkness Control => Display would not function correctly</li>
<li>Fixed some issues in the SD plugin where correct settings would not be displayed</li>
</ul>
Additions:
<ul>
<li>Added new 'External Modules Action', which will contain all module integrations that don't fit anywhere else</li>
<li>Added support for the Custom Hotbar module in 'Macro Action' => Mode: 'Custom Hotbar'. Link to module: https://foundryvtt.com/packages/custom-hotbar/</li>
<li>Added support for the FxMaster module in 'External Modules Action' => Mode: 'Fx Master'. Link to module: https://foundryvtt.com/packages/fxmaster/</li>
</ul>
### v1.1.1 - 12-12-2020
Fixes
<ul>
<li>Fixed issue where deleting a playlist would cause an error preventing the Soundboard Configuration to show up</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.1.0 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### 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:
<li>API has been improved, making integration with other hardware/software easier, and making future changes/additions easier</li>
</ul>
Additions:
<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>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>

BIN
img/external/.thumb/external.png.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
img/external/.thumb/external@2x.png.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
img/external/.thumb/fxmaster.png.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

2
img/external/SOURCES.txt vendored Normal file
View File

@@ -0,0 +1,2 @@
external.png: Edited from https://fontawesome.com/icons/external-link-alt?style=solid
fxmaster.png: Edited from https://fontawesome.com/icons/magic?style=solid

BIN
img/external/external.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
img/external/external@2x.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
img/external/fxmaster.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@@ -1 +1,2 @@
other.png: Made using https://www.elgato.com/en/gaming/keycreator
other.png: Made using https://www.elgato.com/en/gaming/keycreator
cogs.png: Edited from https://fontawesome.com/icons/cogs?style=solid

BIN
img/other/cogs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -40,6 +40,9 @@
"MaterialDeck.Off": "Off",
"MaterialDeck.Name": "Name",
"MaterialDeck.None": "None",
"MaterialDeck.Save": "Save"
"MaterialDeck.Save": "Save",
"MaterialDeck.FxMaster.Colorize": "Colorize",
"MaterialDeck.FxMaster.Clear": "Clear All"
}

View File

@@ -2,14 +2,14 @@
"name": "MaterialDeck",
"title": "Material Deck",
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
"version": "1.1.0",
"version": "1.2.0",
"author": "CDeenen",
"esmodules": [
"./MaterialDeck.js"
],
"socket": true,
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.8",
"compatibleCoreVersion": "0.7.9",
"languages": [
{
"lang": "en",

View File

@@ -19,7 +19,7 @@ export class CombatTracker{
update(settings,context){
this.active = true;
let ctFunction = settings.combatTrackerFunction;
if (ctFunction == undefined) ctFunction == 'startStop';
if (ctFunction == undefined) ctFunction = 'startStop';
let combat = game.combat;
@@ -119,7 +119,7 @@ export class CombatTracker{
if (combat == null || combat == undefined) return;
let ctFunction = settings.combatTrackerFunction;
if (ctFunction == undefined) ctFunction == 'startStop';
if (ctFunction == undefined) ctFunction = 'startStop';
if (ctFunction == 'startStop'){
let src;
let background;

234
src/external.js Normal file
View File

@@ -0,0 +1,234 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
export class ExternalModules{
constructor(){
this.active = false;
}
async updateAll(){
if (this.active == false) return;
for (let i=0; i<32; i++){
let data = streamDeck.buttonContext[i];
if (data == undefined || data.action != 'external') continue;
await this.update(data.settings,data.context);
}
}
update(settings,context){
this.active = true;
let module = settings.module;
if (module == undefined) module = 'fxmaster';
if (module == 'fxmaster') this.updateFxMaster(settings,context);
}
keyPress(settings,context){
if (this.active == false) return;
let module = settings.module;
if (module == undefined) module = 'fxmaster';
if (module == 'fxmaster') { //scene
this.keyPressFxMaster(settings,context);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//FxMaster
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateFxMaster(settings,context){
const fxmaster = game.modules.get("fxmaster");
if (fxmaster == undefined || fxmaster.active == false) return;
const type = (settings.fxMasterType == undefined) ? 'weatherControls' : settings.fxMasterType;
const displayIcon = settings.displayFxMasterIcon;
const displayName = settings.displayFxMasterName;
let ring = 0;
let ringColor = "#000000";
let background = "#000000"
let icon = '';
let name = '';
if (type == 'weatherControls') {
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
name = CONFIG.weatherEffects[effect].label;
icon = CONFIG.weatherEffects[effect].icon;
ring = this.findWeatherEffect(effect) != undefined ? 2 : 1;
ringColor = ring < 2 ? '#000000' : "#00ff00";
}
else if (type == 'colorize') {
background = (settings.fxMasterColorizeColor == undefined) ? '#000000' : settings.fxMasterColorizeColor;
icon = "fas fa-palette";
name = game.i18n.localize("MaterialDeck.FxMaster.Colorize");
const filters = canvas.scene.getFlag("fxmaster", "filters");
ring = 2;
if (filters == undefined || filters['core_color'] == undefined) {
ringColor = "#000000";
}
else {
const colors = filters['core_color'].options;
let red = Math.ceil(colors.red*255).toString(16);
if (red.length == 1) red = '0' + red;
let green = Math.ceil(colors.green*255).toString(16);
if (green.length == 1) green = '0' + green;
let blue = Math.ceil(colors.blue*255).toString(16);
if (blue.length == 1) blue = '0' + blue;
ringColor = "#" + red + green + blue;
}
}
else if (type == 'filters') {
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
name = CONFIG.fxmaster.filters[filter].label;
background = "#340057";
if (displayIcon){
if (filter == 'underwater') icon = "fas fa-water";
else if (filter == 'predator') icon = "fas fa-wave-square";
else if (filter == 'oldfilm') icon = "fas fa-film";
else if (filter == 'bloom') icon = "fas fa-ghost";
}
const fxmaster = canvas.scene.getFlag("fxmaster", "filters");
ring = 1;
if (fxmaster != undefined) {
const objKeys = Object.keys(fxmaster);
for (let i=0; i<objKeys.length; i++){
if (objKeys[i] == "core_"+filter) {
ring = 2;
ringColor = "#A600FF";
break;
}
}
}
}
else if (type == 'clear'){
icon = "fas fa-trash";
name = game.i18n.localize("MaterialDeck.FxMaster.Clear");
}
if (displayIcon) streamDeck.setIcon(context,icon,background,ring,ringColor);
else streamDeck.setIcon(context, "", background,ring,ringColor);
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
red: parseInt(result[1], 16)/256,
green: parseInt(result[2], 16)/256,
blue: parseInt(result[3], 16)/256
} : null;
}
keyPressFxMaster(settings,context){
const fxmaster = game.modules.get("fxmaster");
if (fxmaster == undefined || fxmaster.active == false) return;
const type = (settings.fxMasterType == undefined) ? 'weatherControls' : settings.fxMasterType;
if (type == 'weatherControls') {
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
let exists = false;
let newEffects = {};
let effects = canvas.scene.getFlag("fxmaster", "effects");
if (effects != undefined){
const weatherIds = Object.keys(effects);
for (let i=0; i<weatherIds.length; i++){
const weather = effects[weatherIds[i]].type;
if (weather === effect) {
exists = true;
continue;
}
newEffects[weatherIds[i]] = effects[weatherIds[i]];
}
}
const density = (settings.densitySlider == undefined) ? 50 : settings.densitySlider;
const speed = (settings.speedSlider == undefined) ? 50 : settings.speedSlider;
const direction = (settings.directionSlider == undefined) ? 50 : settings.directionSlider;
const scale = (settings.scaleSlider == undefined) ? 50 : settings.scaleSlider;
const color = (settings.fxMasterWeatherColor == undefined) ? "#000000" : settings.fxMasterWeatherColor;
const applyColor = (settings.fxWeatherEnColor == undefined) ? false : settings.fxWeatherEnColor;
if (exists == false) {
newEffects[randomID()] = {
type: effect,
options: {
density: density,
speed: speed,
scale: scale,
tint: color,
direction: direction,
apply_tint: applyColor
}
};
}
canvas.scene.unsetFlag("fxmaster", "effects").then(() => {
canvas.scene.setFlag("fxmaster", "effects", newEffects);
});
}
else if (type == 'colorize') {
const color = (settings.fxMasterColorizeColor == undefined) ? '#000000' : settings.fxMasterColorizeColor;
const filters = canvas.scene.getFlag("fxmaster", "filters");
let newFilters = {};
if (filters != undefined){
const filterObjects = Object.keys(filters);
for (let i=0; i<filterObjects.length; i++){
if (filterObjects[i] == 'core_color'){
//continue;
}
newFilters[filterObjects[i]] = filters[filterObjects[i]];
}
}
newFilters['core_color'] = {
type : 'color',
options: this.hexToRgb(color)
};
canvas.scene.unsetFlag("fxmaster", "filters").then(() => {
canvas.scene.setFlag("fxmaster", "filters", newFilters);
});
}
else if (type == 'filters') {
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
const filters = canvas.scene.getFlag("fxmaster", "filters");
let newFilters = {};
let exists = false;
if (filters != undefined){
const filterObjects = Object.keys(filters);
for (let i=0; i<filterObjects.length; i++){
if (filterObjects[i] == 'core_'+filter){
exists = true;
continue;
}
newFilters[filterObjects[i]] = filters[filterObjects[i]];
}
}
if (exists == false) {
newFilters['core_'+filter] = {type : filter};
}
canvas.scene.unsetFlag("fxmaster", "filters").then(() => {
canvas.scene.setFlag("fxmaster", "filters", newFilters);
});
}
else if (type == 'clear'){
canvas.scene.unsetFlag("fxmaster", "filters");
canvas.scene.unsetFlag("fxmaster", "effects");
}
}
findWeatherEffect(effect){
const effects = canvas.scene.getFlag("fxmaster", "effects");
if (effects == undefined) return undefined;
const weatherIds = Object.keys(effects);
for (let i = 0; i < weatherIds.length; ++i) {
const weather = effects[weatherIds[i]].type;
if (weather === effect) return weatherIds[i];
}
return undefined;
}
}

View File

@@ -52,7 +52,6 @@ export class MacroControl{
else ringColor = ringOffColor;
ring = 2;
//streamDeck.setIcon(context, "", background,ring,ringColor);
}
else { //Execute macro
macroNumber += this.offset - 1;
@@ -76,12 +75,16 @@ export class MacroControl{
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
else { //Macro Hotbar
let macroId
if (mode == 'hotbar') macroId = game.user.data.hotbar[macroNumber];
else {
let macros = game.macros.apps[0].macros;
let macros;
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
macros = ui.customHotbar.macros;
}
else macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
for (let j=0; j<10; j++){
if (macros[j].key == macroNumber){
if (macros[j].macro == null) macroId == undefined;
@@ -121,16 +124,17 @@ export class MacroControl{
if(macroNumber == undefined || isNaN(parseInt(macroNumber))){
macroNumber = 1;
}
if (mode == undefined) mode = 0;
if (mode == 2) continue;
if (mode == undefined) mode = 'hotbar';
if (mode == 'Macro Board') continue;
if (displayName == undefined) displayName = false;
if (background == undefined) background = '#000000';
let macroId;
if (mode == 0){
if (mode == 'hotbar'){
macroId = game.user.data.hotbar[macroNumber];
}
else {
if (macroNumber > 9) macroNumber = 0;
for (let j=0; j<10; j++){
if (macros[j].key == macroNumber){
if (macros[j].macro == null) macroId == undefined;
@@ -159,7 +163,7 @@ export class MacroControl{
macroNumber = 0;
}
if (mode == 'hotbar' || mode == 'visibleHotbar')
if (mode == 'hotbar' || mode == 'visibleHotbar' || mode == 'customHotbar')
this.executeHotbar(macroNumber,mode);
else {
if (settings.macroBoardMode == 'offset') {
@@ -175,9 +179,14 @@ export class MacroControl{
executeHotbar(macroNumber,mode){
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;
let macros;
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
macros = ui.customHotbar.macros;
}
else macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
for (let j=0; j<10; j++){
if (macros[j].key == macroNumber){
if (macros[j].macro == null) macroId == undefined;

View File

@@ -359,8 +359,14 @@ export class soundboardConfigForm extends FormApplication {
else if (this.settings.selectedPlaylists[iteration] == 'FP') selectedPlaylist = 'FP';
else {
const pl = game.playlists.entities.find(p => p._id == this.settings.selectedPlaylists[iteration]);
selectedPlaylist = pl._id;
sounds = pl.sounds;
if (pl == undefined){
selectedPlaylist = 'none';
sounds = [];
}
else {
sounds = pl.sounds;
selectedPlaylist = pl._id;
}
}
let styleSS = "";
let styleFP ="display:none";

View File

@@ -136,6 +136,7 @@ export class OtherControls{
//////////////////////////////////////////////////////////////////////////////////////////////////
updateScene(settings,context){
if (canvas.scene == null) return;
let func = settings.sceneFunction;
if (func == undefined) func = 'visible';
@@ -171,7 +172,8 @@ export class OtherControls{
}
}
else if (func == 'any') { //all scenes
let scene = game.scenes.apps[1].entities.find(p=>p.data.name == name);
if (settings.sceneName == undefined || settings.sceneName == '') return;
let scene = game.scenes.apps[1].entities.find(p=>p.data.name == settings.sceneName);
if (scene != undefined){
if (scene.isView)
ringColor = ringOnColor;
@@ -211,6 +213,26 @@ export class OtherControls{
}
}
}
else if (func == 'any'){ //any scene
if (settings.sceneName == undefined || settings.sceneName == '') return;
const scenes = game.scenes.entries;
let scene = game.scenes.apps[1].entities.find(p=>p.data.name == settings.sceneName);
if (scene == undefined) return;
let viewFunc = settings.sceneViewFunction;
if (viewFunc == undefined) viewFunc = 'view';
if (viewFunc == 'view'){
scene.view();
}
else if (viewFunc == 'activate'){
scene.activate();
}
else {
if (scene.isView) scene.activate();
scene.view();
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -391,7 +413,7 @@ export class OtherControls{
if (value < 0) src = 'modules/MaterialDeck/img/other/darkness/decreasedarkness.png';
else src = 'modules/MaterialDeck/img/other/darkness/increasedarkness.png';
}
else if (func == 'display'){ //display darkness
else if (func == 'disp'){ //display darkness
src = 'modules/MaterialDeck/img/other/darkness/darkness.png';
let darkness = '';
if (canvas.scene != null) darkness = Math.floor(canvas.scene.data.darkness*100)/100;

View File

@@ -51,6 +51,7 @@ export class StreamDeck{
else if (action == 'playlist') MODULE.playlistControl.active = false;
else if (action == 'soundboard') MODULE.soundboard.active = false;
else if (action == 'other') MODULE.otherControls.active = false;
else if (action == 'external') MODULE.externalModules.active = false;
}
}

View File

@@ -53,7 +53,7 @@ export class TokenControl{
else if (stats == 'AC') txt += attributes.ac.value;
else if (stats == 'Speed'){
let speed = "";
if (attributes.speed._deprecated){
if (attributes.movement != undefined){
if (attributes.movement.burrow > 0) speed += game.i18n.localize("DND5E.MovementBurrow") + ': ' + attributes.movement.burrow + attributes.movement.units;
if (attributes.movement.climb > 0) {
if (speed.length > 0) speed += '\n';