`;
- if (sdNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.SDdownload")} `;
- if (msNok) content += `Material Server `;
+ if (sdNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.SDdownload")} `;
+ if (msNok) content += `Material Companion `;
content += " "
- const myDialog = new Dialog({
+ new Dialog({
title: game.i18n.localize("MaterialDeck.UpdateRequired.Title"),
content,
buttons: {
@@ -101,7 +129,7 @@ async function analyzeWSmessage(msg){
}).render(true);
}
- console.log("streamdeck connected to server", msVersion);
+ console.log("streamdeck connected to server", versions.materialCompanion.current);
streamDeck.resetImageBuffer();
}
@@ -128,8 +156,6 @@ async function analyzeWSmessage(msg){
streamDeck.setScreen(action);
await streamDeck.setContext(device,data.size,data.deviceIteration,action,context,coordinates,settings,name,type);
- if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
-
if (action == 'token'){
tokenControl.active = true;
tokenControl.pushData(canvas.tokens.controlled[0]?.id,settings,context,device);
@@ -156,7 +182,6 @@ async function analyzeWSmessage(msg){
}
else if (event == 'keyDown'){
- if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
if (action == 'token')
tokenControl.keyPress(settings);
@@ -177,7 +202,6 @@ async function analyzeWSmessage(msg){
}
else if (event == 'keyUp'){
- if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
if (action == 'soundboard'){
soundboard.keyPressUp(settings);
@@ -211,8 +235,13 @@ function startWebsocket() {
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+address);
wsOpen = true;
const msg = {
- target: "server",
- module: "MD"
+ target: "MaterialCompanion",
+ source: "MaterialDeck_Foundry",
+ sourceTarget: "MaterialDeck_Device",
+ type: "connected",
+ userId: game.userId,
+ userName: game.user.name,
+ version: game.modules.get(moduleName).version
}
ws.send(JSON.stringify(msg));
transmitInitData();
@@ -228,8 +257,9 @@ let messageCount = 0;
function transmitInitData() {
const msg = {
- target: "SD",
+ target: "MaterialDeck_Device",
type: "init",
+ userId: game.userId,
system: getGamingSystem(),
systemData: {
conditions: tokenHelper.getConditionList(),
@@ -343,8 +373,9 @@ Hooks.once('ready', async()=>{
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
getGamingSystem();
- minimumMSversion = game.modules.get(moduleName).flags.minimumMSVersion;
- minimumSDversion = game.modules.get(moduleName).flags.minimumPluginVersion;
+ versions.module.current = game.modules.get('MaterialDeck').version;
+ versions.materialCompanion.minimum = game.modules.get(moduleName).flags.minimumMaterialCompanionVersion;
+ versions.plugin.minimum = game.modules.get(moduleName).flags.minimumPluginVersion;
soundboard = new SoundboardControl();
streamDeck = new StreamDeck();
@@ -447,7 +478,8 @@ Hooks.once('ready', async()=>{
});
function updateActor(id) {
- const token = tokenHelper.getTokenFromActorId(id)
+ const token = tokenHelper.getTokenFromActorId(id);
+ if (token == undefined) return;
tokenControl.update(token.id);
}
@@ -704,4 +736,21 @@ Hooks.on('globalAmbientVolumeChanged', () => {
Hooks.on('globalInterfaceVolumeChanged', () => {
if (enableModule == false || ready == false || otherControls == undefined) return;
otherControls.updateAll();
-})
\ No newline at end of file
+})
+
+Hooks.on('MaterialDeck', (data) => {
+ if (data.type == 'setButton') {
+ //Get the buttonContext and device from streamDeck.buttonContext using data.buttonId
+ const buttonContext = streamDeck.buttonContext[0]?.buttons[data.button]?.context;
+ const device = streamDeck.buttonContext[0]?.device;
+
+ //Set icon on SD
+ streamDeck.setIcon(buttonContext, device, data.icon, data.options);
+
+ //Set text on SD
+ streamDeck.setTitle(data.text, buttonContext);
+ }
+ else {
+ //reserved for future MD hooks
+ }
+});
\ No newline at end of file
diff --git a/changelog.md b/changelog.md
index 713676f..3548626 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,18 @@
# Changelog Material Deck Module
+### v1.5.2 - xx-xx-2023
+Starting from this version you have to use Material Companion instead of Material Server.
+
+Fixes:
+
+
(PF2e) Token Action => Toggle Condition: Condition icons work again
+
+
+Other:
+
+
Material Deck is no longer compatible with Material Server, you now have to use Material Companion
+
Removed 'Device Config' because this is now handled by Material Companion
+
+
### v1.5.1 - 28-06-2023
Fixes:
diff --git a/lang/en.json b/lang/en.json
index b59fc46..325a7c9 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -1,6 +1,6 @@
{
- "MaterialDeck.Notifications.Disconnected": "Disconnected from Material Server, attempting to reconnect",
- "MaterialDeck.Notifications.ConnectFail": "Can't connect to Material Server, retrying",
+ "MaterialDeck.Notifications.Disconnected": "Disconnected from Material Companion, attempting to reconnect",
+ "MaterialDeck.Notifications.ConnectFail": "Can't connect to Material Companion, retrying",
"MaterialDeck.Notifications.Connected": "Connected",
"MaterialDeck.Notifications.Soundboard.NoPermission": "You do not have permission to configure the soundboard",
"MaterialDeck.Notifications.Macroboard.NoPermission": "You do not have permission to configure the macroboard",
@@ -12,9 +12,9 @@
"MaterialDeck.EnableDialog.No": "No",
"MaterialDeck.UpdateRequired.Title": "Material Deck: Update Required",
- "MaterialDeck.UpdateRequired.MS": "The Material Server version you are using is incompatible with this version of Material Deck.",
+ "MaterialDeck.UpdateRequired.MC": "The Material Companion version you are using is incompatible with this version of Material Deck.",
"MaterialDeck.UpdateRequired.SD": "The Stream Deck plugin you are using is incompatible with this version of Material Deck.",
- "MaterialDeck.UpdateRequired.Both": "The Stream Deck plugin and Material Server you are using are incompatible with this version of Material Deck.",
+ "MaterialDeck.UpdateRequired.Both": "The Stream Deck plugin and Material Companion you are using are incompatible with this version of Material Deck.",
"MaterialDeck.UpdateRequired.Update": "Please update using the Download Utility or click the link below.",
"MaterialDeck.UpdateRequired.SDdownload": "Stream Deck Plugin",
@@ -22,18 +22,17 @@
"MaterialDeck.Sett.EnableHint": "Enabling the module for this client is required if you want to use Material Deck on your computer. If you do not have a Stream Deck connected or don't want to use it for Material Deck, disable the module here.",
"MaterialDeck.Sett.Help": "Help",
"MaterialDeck.Sett.Permission": "User Permission Configuration",
- "MaterialDeck.DeviceConfig.Title": "Device Configuration",
"MaterialDeck.Sett.PlaylistConfig": "Playlist Configuration",
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
- "MaterialDeck.Sett.ServerAddr": "Material Server Address",
- "MaterialDeck.Sett.ServerAddrHint": "The IP address and port of Material Server. The default value will work for 99% of people, only change this if you know what you're doing. Must follow the format [ip_address]:[port], for example: 'localhost:3001' or '192.168.1.1:4000'.",
+ "MaterialDeck.Sett.ServerAddr": "Material Companion Address",
+ "MaterialDeck.Sett.ServerAddrHint": "The IP address and port of Material Companion. The default value will work for 99% of people, only change this if you know what you're doing. Must follow the format [ip_address]:[port], for example: 'localhost:3001' or '192.168.1.1:4000'.",
"MaterialDeck.Sett.ImageBuffer": "Image Cache Size",
"MaterialDeck.Sett.ImageBufferHint": "Sets the amount of images to store in the image cache. The image cache will locally store all images sent to the Stream Deck. This improves the update speed, but increases memory usage.",
"MaterialDeck.Sett.ImageBrightness": "Image Brightness",
"MaterialDeck.Sett.ImageBrightnessHint": "Sets the brightness of the default white images. If the Image Cache Size is bigger than 0, perform a refresh for instant results.",
"MaterialDeck.Sett.NrOfConnMessages": "Number of Connection Warnings",
- "MaterialDeck.Sett.NrOfConnMessagesHint": "Sets the number of times a connection warning is displayed if Material Deck cannot connect to Material Server. If set to 0, it will give not be limited.",
+ "MaterialDeck.Sett.NrOfConnMessagesHint": "Sets the number of times a connection warning is displayed if Material Deck cannot connect to Material Companion. If set to 0, it will give not be limited.",
"MaterialDeck.Sett.SystemOverride": "System Override",
"MaterialDeck.Sett.SystemOverrideHint": "Overrides the automatic gaming system detection. Unsupported systems default to dnd5e, but if an unsupported system is similar to a different system you can specify that system here.",
@@ -210,7 +209,7 @@
"MaterialDeck.SimpleCalendar.Of": "of",
"MaterialDeck.DownloadUtility.Title": "Download Utility",
- "MaterialDeck.DownloadUtility.Plugin": "Module, Stream Deck Plugin & Material Server",
+ "MaterialDeck.DownloadUtility.Plugin": "Module, Stream Deck Plugin & Material Companion",
"MaterialDeck.DownloadUtility.Minimum": "Minimum",
"MaterialDeck.DownloadUtility.Current": "Current",
"MaterialDeck.DownloadUtility.Latest": "Latest",
@@ -218,7 +217,7 @@
"MaterialDeck.DownloadUtility.Download": "Download",
"MaterialDeck.DownloadUtility.module": "Module",
"MaterialDeck.DownloadUtility.SDplugin": "SD Plugin",
- "MaterialDeck.DownloadUtility.MSserver": "Material Server",
+ "MaterialDeck.DownloadUtility.MSserver": "Material Companion",
"MaterialDeck.DownloadUtility.Windows": "Windows",
"MaterialDeck.DownloadUtility.MacosM1": "MacOS (M1)",
"MaterialDeck.DownloadUtility.MacosIntel": "MacOS (Intel)",
diff --git a/module.json b/module.json
index 2b30602..4d53974 100644
--- a/module.json
+++ b/module.json
@@ -3,7 +3,7 @@
"id": "MaterialDeck",
"title": "Material Deck",
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
- "version": "1.5.1",
+ "version": "1.5.2_pre",
"author": "CDeenen",
"authors": [
{
@@ -28,8 +28,8 @@
"verified": "11"
},
"flags": {
- "minimumMSVersion": "1.1.0",
- "minimumPluginVersion": "1.5.0"
+ "minimumMaterialCompanionVersion": "1.0.2",
+ "minimumPluginVersion": "1.5.2"
},
"languages": [
{
diff --git a/src/actions/external.js b/src/actions/external.js
index 4724ee3..d70acb7 100644
--- a/src/actions/external.js
+++ b/src/actions/external.js
@@ -916,8 +916,10 @@ export class ExternalModules{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateMonksActiveTiles(settings,context,device) {
const id = settings.monksActiveTilesId;
+
if (id == undefined || id == '') return;
let tile = canvas.tiles.placeables.find(t => t.id == id);
+
if (tile == undefined) return;
const tileData = tile.document.flags?.['monks-active-tiles'];
if (tileData == undefined) return;
@@ -929,7 +931,7 @@ export class ExternalModules{
ring = 2;
ringColor = '#00ff00'
}
- let src = tile.document.texture.sr;
+ let src = tile.document.texture.src;
streamDeck.setTitle('',context);
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
@@ -946,6 +948,7 @@ export class ExternalModules{
if (tileData == undefined) return;
if (mode == 'toggle') tile.document.setFlag('monks-active-tiles','active',!tileData.active);
+ else tile.document.setFlag('monks-active-tiles','active',mode == 'enable');
}
}
diff --git a/src/misc.js b/src/misc.js
index 80822ee..e0410f0 100644
--- a/src/misc.js
+++ b/src/misc.js
@@ -1,4 +1,4 @@
-import { sdVersion, msVersion, moduleName, getPermission, enableModule, streamDeck, macroControl,soundboard,playlistControl, minimumMSversion, minimumSDversion } from "../MaterialDeck.js";
+import { moduleName, getPermission, enableModule, macroControl, soundboard, playlistControl, releaseURLs, versions } from "../MaterialDeck.js";
export function compareVersions(checkedVersion, requiredVersion) {
requiredVersion = requiredVersion.split(".");
@@ -1041,21 +1041,7 @@ export class importConfigForm extends FormApplication {
export class downloadUtility extends FormApplication {
constructor(data, options) {
super(data, options);
- this.localSDversion = sdVersion;
- this.masterSDversion;
- this.localMSversion = msVersion;
- this.masterMSversion;
- this.masterModuleVersion;
- this.releaseAssets = [];
- this.profiles = [];
-
- let parent = this;
- setTimeout(function(){
- parent.checkForUpdate('SD');
- parent.checkForUpdate('MS');
- parent.checkForUpdate('Module');
- parent.getReleaseData();
- },100)
+ this.releases = {}
}
/**
@@ -1074,33 +1060,20 @@ export class downloadUtility extends FormApplication {
/**
* Provide data to the template
*/
- getData() {
+ async getData() {
let dlDisabled = true;
- this.profiles = [];
- let iteration = 0;
- for (let asset of this.releaseAssets) {
- let split = asset.name.split('.');
- if (split[split.length-1] == 'streamDeckProfile') {
- this.profiles.push({id: iteration, label:split[0], url:asset.browser_download_url});
- iteration++;
- dlDisabled = false;
- }
+ this.releases = {
+ module: await this.checkForUpdate('module'),
+ plugin: await this.checkForUpdate('plugin'),
+ materialCompanion: await this.checkForUpdate('materialCompanion')
}
- if (this.localMSversion == undefined) this.localMSversion = 'unknown';
return {
- minimumSdVersion: minimumSDversion,
- localSdVersion: this.localSDversion,
- masterSdVersion: this.masterSDversion,
- sdDlDisable: this.masterSDversion == undefined,
- minimumMsVersion: minimumMSversion,
- localMsVersion: this.localMSversion,
- masterMsVersion: this.masterMSversion,
- msDlDisable: this.masterMSversion == undefined,
- localModuleVersion: game.modules.get('MaterialDeck').version,
- masterModuleVersion: this.masterModuleVersion,
- profiles: this.profiles,
+ releases: this.releases,
+ versions,
+ sdDlDisable: this.releases.plugin == undefined,
+ msDlDisable: this.releases.materialCompanion == undefined,
profileDlDisable: dlDisabled
}
}
@@ -1118,38 +1091,22 @@ export class downloadUtility extends FormApplication {
super.activateListeners(html);
const downloadSd = html.find("button[id='materialDeck_dlUtil_downloadSd']");
- const downloadMs = html.find("button[id='materialDeck_dlUtil_downloadMs']");
+ const downloadMc = html.find("button[id='materialDeck_dlUtil_downloadMc']");
const downloadProfile = html.find("button[name='downloadProfile']")
const refresh = html.find("button[id='materialDeck_dlUtil_refresh']");
+ //releaseURLs
+
downloadSd.on('click', () => {
- const version = document.getElementById('materialDeck_dlUtil_masterSdVersion').innerHTML;
- if (version == '' || version == undefined || version == 'Error') return;
- const url = `https://github.com/CDeenen/MaterialDeck_SD/releases/download/v${version}/com.cdeenen.materialdeck.streamDeckPlugin`;
- this.downloadURI(url,'com.cdeenen.materialdeck.streamDeckPlugin')
+ this.downloadURI(this.releases.plugin.url)
})
- downloadMs.on('click', () => {
- const version = document.getElementById('materialDeck_dlUtil_masterMsVersion').innerHTML;
+ downloadMc.on('click', () => {
const os = document.getElementById('materialDeck_dlUtil_os').value;
- if (version == '' || version == undefined || version == 'Error') return;
- let name = `MaterialServer-${os}.zip`;
- let url;
- if (os == 'source') url = `https://github.com/CDeenen/MaterialServer/archive/refs/tags/v${version}.zip`;
- else url = `https://github.com/CDeenen/MaterialServer/releases/download/v${version}/${name}`;
- this.downloadURI(url,name)
+ this.downloadURI(this.releases.materialCompanion.variants.find(v => v.name.includes(os)).url)
})
downloadProfile.on('click',(event) => {
- let id = event.currentTarget.id.replace('materialDeck_dlUtil_dlProfile-','');
- this.downloadURI(this.profiles[id].url,`${this.profiles[id].label}.streamDeckProfile`);
- })
- refresh.on('click', () => {
- document.getElementById('materialDeck_dlUtil_masterSdVersion').value = 'Getting data';
- this.checkForUpdate('SD');
- document.getElementById('materialDeck_dlUtil_masterMsVersion').value = 'Getting data';
- this.checkForUpdate('MS');
- document.getElementById('materialDeck_dlUtil_masterModuleVersion').value = 'Getting data';
- this.checkForUpdate('Module');
- this.getReleaseData();
+ let name = event.currentTarget.id.replace('materialDeck_dlUtil_dlProfile-','');
+ this.downloadURI(this.releases.plugin.profiles.find(p => p.name.includes(name)).url);
})
}
@@ -1181,8 +1138,53 @@ export class downloadUtility extends FormApplication {
}
checkForUpdate(reqType) {
- let parent = this;
- let url;
+ return new Promise((resolve) => {
+ const url = releaseURLs?.[reqType].api;
+ if (url == undefined) return;
+
+ $.getJSON(url).done(function(releases) {
+ const release = releases[0];
+ if (reqType == 'plugin') {
+ const url = release.assets.find(a => a.name.includes('streamDeckPlugin'))?.browser_download_url;
+ let profiles = [];
+ for (let profile of release.assets.filter(a => a.name.includes('streamDeckProfile'))) {
+ profiles.push({
+ name: profile.name.replace('.streamDeckProfile', ''),
+ url: profile.browser_download_url
+ })
+ }
+ resolve({
+ release: releases[0],
+ version: release.tag_name,
+ url,
+ profiles
+ });
+ }
+ else if (reqType == 'materialCompanion') {
+ let variants = [];
+ for (let variant of release.assets) {
+ variants.push({
+ name: variant.name,
+ url: variant.browser_download_url
+ })
+ }
+ resolve({
+ release: releases[0],
+ version: release.tag_name,
+ url,
+ variants
+ });
+ }
+ else if (reqType == 'module') {
+ resolve({
+ release: releases[0],
+ version: release.tag_name
+ });
+ }
+ });
+ });
+
+ /*
let elementId;
if (reqType == 'SD') {
elementId = 'materialDeck_dlUtil_masterSdVersion';
@@ -1194,7 +1196,7 @@ export class downloadUtility extends FormApplication {
}
else if (reqType == 'Module') {
elementId = 'materialDeck_dlUtil_masterModuleVersion';
- url = 'https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json';
+ url = game.modules.get('MaterialDeck').manifest;
}
var request = new XMLHttpRequest();
@@ -1215,92 +1217,6 @@ export class downloadUtility extends FormApplication {
request.onerror = function () {
document.getElementById(elementId).innerHTML = 'Error';
}
+ */
}
-}
-
-export class deviceConfig extends FormApplication {
- constructor(data, options) {
- super(data, options);
-
- this.devices = [];
- }
-
- /**
- * Default Options for this FormApplication
- */
- static get defaultOptions() {
- return mergeObject(super.defaultOptions, {
- id: "materialDeck_deviceConfig",
- title: "Material Deck: " + game.i18n.localize("MaterialDeck.DeviceConfig.Title"),
- template: "./modules/MaterialDeck/templates/deviceConfig.html",
- width: 500,
- height: "auto"
- });
- }
-
- /**
- * Provide data to the template
- */
- getData() {
- this.devices = [];
- let dConfig = game.settings.get(moduleName, 'devices');
- if (Object.prototype.toString.call(game.settings.get('MaterialDeck', 'devices')) === "[object String]") {
- dConfig = {};
- game.settings.set(moduleName, 'devices', dConfig);
- }
- for (let d of streamDeck.buttonContext) {
- if (d == undefined) continue;
- let type;
- if (d.type == 0) type = 'Stream Deck';
- else if (d.type == 1) type = 'Stream Deck Mini';
- else if (d.type == 2) type = 'Stream Deck XL';
- else if (d.type == 3) type = 'Stream Deck Mobile';
- else if (d.type == 4) type = 'Corsair G Keys';
-
- const name = d.name;
- const id = d.device;
- let enable;
- if (dConfig?.[id] == undefined) enable = true;
- else enable = dConfig?.[id].enable;
-
- const device = {
- id,
- name,
- type,
- en: enable
- }
- this.devices.push(device);
- }
-
- return {
- devices: this.devices
- }
- }
-
- /**
- * Update on form submit
- * @param {*} event
- * @param {*} formData
- */
- async _updateObject(event, formData) {
-
- }
-
- activateListeners(html) {
- super.activateListeners(html);
-
- html.find("input[name='enable']").on('change', (event) => {
- const id = event.currentTarget.id.replace('materialDeck_devConf_','');;
- for (let d of this.devices) {
- if (d.id == id) {
- let dConfig = game.settings.get(moduleName, 'devices');
- delete dConfig[id];
- dConfig[id] = {enable: event.currentTarget.checked}
- game.settings.set(moduleName, 'devices', dConfig);
- }
- }
- })
- }
-
-
}
\ No newline at end of file
diff --git a/src/settings.js b/src/settings.js
index fe0bd4a..7f37b7d 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -1,5 +1,5 @@
import { moduleName, isEmpty } from "../MaterialDeck.js";
-import { playlistConfigForm, macroConfigForm, soundboardConfigForm, downloadUtility, deviceConfig } from "./misc.js";
+import { playlistConfigForm, macroConfigForm, soundboardConfigForm, downloadUtility } from "./misc.js";
let userPermissions = {};
const defaultEnable = [true,true,true,true];
@@ -173,21 +173,6 @@ export const registerSettings = async function() {
restricted: false
});
- game.settings.registerMenu(moduleName, 'deviceConfig',{
- name: "MaterialDeck.DeviceConfig.Title",
- label: "MaterialDeck.DeviceConfig.Title",
- type: deviceConfig,
- restricted: false
- });
-
- game.settings.register(moduleName, 'devices', {
- name: "devices",
- scope: "client",
- type: Object,
- config: false,
- default: {}
- });
-
game.settings.registerMenu(moduleName, 'permissionConfig',{
name: "MaterialDeck.Sett.Permission",
label: "MaterialDeck.Sett.Permission",
diff --git a/src/streamDeck.js b/src/streamDeck.js
index 99a6b94..2032a5b 100644
--- a/src/streamDeck.js
+++ b/src/streamDeck.js
@@ -205,16 +205,20 @@ export class StreamDeck{
setTitle(txt,context){
if (txt == null || txt == undefined) txt = '';
txt = this.formatTitle(txt);
-
+ let thisDevice;
for (let device of this.buttonContext) {
if (device == undefined) continue;
const btn = device.buttons.find(b => b?.context == context);
if (btn == undefined) continue;
btn.txt = txt;
+ thisDevice = device;
}
let msg = {
- target: "SD",
+ target: "MaterialDeck_Device",
+ source: "MaterialDeck_Foundry",
+ userId: game.userId,
+ device: thisDevice,
event: 'setTitle',
context: context,
payload: {
@@ -226,8 +230,16 @@ export class StreamDeck{
}
setColor(context,color = '#000000'){
+let thisDevice;
+ for (let device of this.buttonContext) {
+ if (device == undefined) continue;
+ thisDevice = device.buttons.find(b => b?.context == context);
+ }
let msg = {
- target: "SD",
+ target: "MaterialDeck_Device",
+ source: "MaterialDeck_Foundry",
+ userId: game.userId,
+ device: thisDevice,
event: 'setIcon',
context: context,
url: '',
@@ -239,7 +251,9 @@ export class StreamDeck{
setImage(image,context,device,nr,id){
var json = {
- target: "SD",
+ target: "MaterialDeck_Device",
+ source: "MaterialDeck_Foundry",
+ userId: game.userId,
event: "setImage",
context: context,
device: device,
@@ -255,7 +269,9 @@ export class StreamDeck{
setBufferImage(context,device,nr,id){
var json = {
- target: "SD",
+ target: "MaterialDeck_Device",
+ source: "MaterialDeck_Foundry",
+ userId: game.userId,
event: "setBufferImage",
context: context,
device: device,
@@ -322,7 +338,9 @@ export class StreamDeck{
let split2 = split[0].split('-');
if (split2[0] == 'fa') format = 'icon';
let msg = {
- target: "SD",
+ target: "MaterialDeck_Device",
+ source: "MaterialDeck_Foundry",
+ userId: game.userId,
event: 'setIcon',
context: context,
device: device,
@@ -339,9 +357,17 @@ export class StreamDeck{
}
setState(state,context,action){
+ let thisDevice;
+ for (let device of this.buttonContext) {
+ if (device == undefined) continue;
+ thisDevice = device.buttons.find(b => b?.context == context);
+ }
let msg = {
- target: "SD",
+ target: "MaterialDeck_Device",
+ source: "MaterialDeck_Foundry",
+ userId: game.userId,
event: 'setStateCustom',
+ device: thisDevice,
context: context,
action: action,
state: state
@@ -354,8 +380,9 @@ export class StreamDeck{
if (action == 'playlistcontrol')
profile = 'MaterialDeck-Playlist'
var json = {
- target: "SD",
- source: 1,
+ target: "MaterialDeck_Device",
+ source: "MaterialDeck_Foundry",
+ userId: game.userId,
event: "switchToProfile",
context: this.pluginId,
device: device,
diff --git a/src/systems/pf2e.js b/src/systems/pf2e.js
index 803e4ca..863d1f3 100644
--- a/src/systems/pf2e.js
+++ b/src/systems/pf2e.js
@@ -239,7 +239,7 @@ export class pf2e{
getConditionIcon(condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll') return window.CONFIG.controlIcons.effects;
- else return `${CONFIG.PF2E.statusEffects.effectsIconFolder}${condition}.webp`;
+ else return `${CONFIG.PF2E.statusEffects.iconDir}${condition}.webp`;
}
getConditionActive(token,condition) {
@@ -281,6 +281,7 @@ export class pf2e{
}
async toggleCondition(token,condition) {
+ console.log(token,condition)
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
for( let effect of token.actor.items.filter(i => i.type == 'condition'))
@@ -288,6 +289,7 @@ export class pf2e{
}
else {
const effect = this.getCondition(token,condition);
+ console.log('eff',effect)
if (effect == undefined) {
const newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
diff --git a/templates/deviceConfig.html b/templates/deviceConfig.html
deleted file mode 100644
index da156a9..0000000
--- a/templates/deviceConfig.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
\ No newline at end of file
diff --git a/templates/downloadUtility.html b/templates/downloadUtility.html
index f6d0c40..802e733 100644
--- a/templates/downloadUtility.html
+++ b/templates/downloadUtility.html
@@ -13,9 +13,9 @@