Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9242cf4978 | ||
|
|
2cfa8c3ac9 | ||
|
|
b07f0a6454 | ||
|
|
631fdbcccb |
1
.gitignore
vendored
@@ -1 +0,0 @@
|
||||
MaterialDeck.zip
|
||||
275
MaterialDeck.js
@@ -8,11 +8,37 @@ import { SoundboardControl } from "./src/actions/soundboard.js";
|
||||
import { OtherControls } from "./src/actions/othercontrols.js";
|
||||
import { ExternalModules } from "./src/actions/external.js";
|
||||
import { SceneControl } from "./src/actions/scene.js";
|
||||
import { downloadUtility, compareVersions, compatibleCore } from "./src/misc.js";
|
||||
import { downloadUtility, compareVersions } from "./src/misc.js";
|
||||
import { TokenHelper } from "./src/systems/tokenHelper.js";
|
||||
|
||||
export const minimumSDversion = "1.4.11";
|
||||
export const minimumMSversion = "1.0.2";
|
||||
export const releaseURLs = {
|
||||
module: {
|
||||
api: "https://api.github.com/repos/MaterialFoundry/MaterialDeck/releases",
|
||||
url: "https://github.com/MaterialFoundry/MaterialDeck/releases"
|
||||
},
|
||||
plugin: {
|
||||
api: "https://api.github.com/repos/MaterialFoundry/MaterialDeck_SD/releases",
|
||||
url: "https://github.com/MaterialFoundry/MaterialDeck_SD/releases"
|
||||
},
|
||||
materialCompanion: {
|
||||
api: "https://api.github.com/repos/MaterialFoundry/MaterialCompanion/releases",
|
||||
url: "https://github.com/MaterialFoundry/MaterialCompanion/releases"
|
||||
}
|
||||
}
|
||||
|
||||
export let versions = {
|
||||
materialCompanion: {
|
||||
current: 'Unknown',
|
||||
minimum: 'Unknown'
|
||||
},
|
||||
plugin: {
|
||||
current: 'Unknown',
|
||||
minimum: 'Unknown'
|
||||
},
|
||||
module: {
|
||||
current: 'Unknown'
|
||||
}
|
||||
}
|
||||
|
||||
export var streamDeck;
|
||||
export var tokenControl;
|
||||
@@ -28,19 +54,10 @@ export const moduleName = "MaterialDeck";
|
||||
export let gamingSystem = "dnd5e";
|
||||
export let hotbarUses = false;
|
||||
export let calculateHotbarUses;
|
||||
export let sdVersion;
|
||||
export let msVersion;
|
||||
|
||||
let ready = false;
|
||||
let controlTokenTimer;
|
||||
let updateDialog;
|
||||
|
||||
//CONFIG.debug.hooks = true;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Global variables
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
export var enableModule;
|
||||
|
||||
//Websocket variables
|
||||
@@ -49,7 +66,8 @@ let wsOpen = false; //Bool for checking if websocket has ever been o
|
||||
let wsInterval; //Interval timer to detect disconnections
|
||||
let WSconnected = false;
|
||||
|
||||
//let furnace = game.modules.get("furnace");
|
||||
|
||||
//CONFIG.debug.hooks = true;
|
||||
|
||||
/*
|
||||
* Analyzes the message received
|
||||
@@ -60,62 +78,41 @@ async function analyzeWSmessage(msg){
|
||||
if (enableModule == false) return;
|
||||
const data = JSON.parse(msg);
|
||||
//console.log("Received",data);
|
||||
|
||||
if (data.type == "connected" && data.data == "SD"){
|
||||
const msg = {
|
||||
target: "SD",
|
||||
type: "init",
|
||||
system: getGamingSystem(),
|
||||
coreVersion: game.version.split('.')[0]
|
||||
}
|
||||
ws.send(JSON.stringify(msg));
|
||||
if (data.MSversion) msVersion = data.MSversion;
|
||||
if (data.SDversion) sdVersion = data.SDversion;
|
||||
|
||||
console.log("streamdeck connected to server", msVersion);
|
||||
streamDeck.resetImageBuffer();
|
||||
if (data.type == 'connected') {
|
||||
console.log('rec',data)
|
||||
}
|
||||
|
||||
if (data.type == "version" && data.source == "SD") {
|
||||
sdVersion = data.version;
|
||||
if (data.type == "connected" && data.source == "MaterialCompanion"){
|
||||
//console.log('data',data)
|
||||
//transmitInitData();
|
||||
let sdNok = false;
|
||||
let msNok = false;
|
||||
if (data.materialCompanionVersion) {
|
||||
versions.materialCompanion.current = data.materialCompanionVersion;
|
||||
if (!compareVersions(versions.materialCompanion.minimum, versions.materialCompanion.current)) {
|
||||
msNok = true;
|
||||
}
|
||||
}
|
||||
if (data.pluginVersion) {
|
||||
versions.plugin.current = data.pluginVersion;
|
||||
if (!compareVersions(versions.plugin.minimum, versions.plugin.current)) {
|
||||
sdNok = true;
|
||||
}
|
||||
}
|
||||
if (msNok || sdNok) {
|
||||
let content = '';
|
||||
if (sdNok && msNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.Both")}<br><br>`;
|
||||
else if (sdNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.SD")}<br><br>`;
|
||||
else if (msNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.MC")}<br><br>`;
|
||||
|
||||
const sdCompatible = compareVersions(minimumSDversion,sdVersion);
|
||||
const msCompatible = compareVersions(minimumMSversion,msVersion);
|
||||
content += `${game.i18n.localize("MaterialDeck.UpdateRequired.Update")}<br><br>`;
|
||||
|
||||
if ((!sdCompatible || !msCompatible) && updateDialog == undefined) {
|
||||
let content = "";
|
||||
if (sdNok) content += `<a href="${releaseURLs.plugin.url}">${game.i18n.localize("MaterialDeck.UpdateRequired.SDdownload")}</a><br>`;
|
||||
if (msNok) content += `<a href="${releaseURLs.materialCompanion.url}">Material Companion</a><br>`;
|
||||
content += "<br>"
|
||||
|
||||
if (!sdCompatible && !msCompatible)
|
||||
content = game.i18n.localize("MaterialDeck.SdMsUpdateRequired")
|
||||
else if (!sdCompatible)
|
||||
content = game.i18n.localize("MaterialDeck.SdUpdateRequired")
|
||||
else
|
||||
content = game.i18n.localize("MaterialDeck.MsUpdateRequired")
|
||||
const sd = sdCompatible ? 'display:none' : ''
|
||||
const ms = msCompatible ? 'display:none' : ''
|
||||
content += `
|
||||
<table>
|
||||
<tr>
|
||||
<th style='width:40%'>
|
||||
<th style='width:30%'>${game.i18n.localize("MaterialDeck.DownloadUtility.Current")}</th>
|
||||
<th style='width:30%'>${game.i18n.localize("MaterialDeck.DownloadUtility.Minimum")}</th>
|
||||
</tr>
|
||||
<tr style="${sd}">
|
||||
<td>Stream Deck Plugin</td>
|
||||
<td><center>${sdVersion}</center></td>
|
||||
<td><center>${minimumSDversion}</center></td>
|
||||
</tr>
|
||||
<tr style="${ms}">
|
||||
<td>Material Server</th>
|
||||
<td><center>${msVersion}</center></td>
|
||||
<td><center>${minimumMSversion}</center></td>
|
||||
<tr>
|
||||
</table>
|
||||
`
|
||||
//else if (!sdCompatible) contents += `The Stream Deck plugin version you're using is v${data.version}, which is incompatible with this version of the module.<br>Update to v${minimumSDversion} or newer.`;
|
||||
|
||||
updateDialog = new Dialog({
|
||||
title: "Material Deck: Update Needed",
|
||||
new Dialog({
|
||||
title: game.i18n.localize("MaterialDeck.UpdateRequired.Title"),
|
||||
content,
|
||||
buttons: {
|
||||
download: {
|
||||
@@ -129,9 +126,11 @@ async function analyzeWSmessage(msg){
|
||||
}
|
||||
},
|
||||
default: "download"
|
||||
});
|
||||
updateDialog.render(true);
|
||||
}).render(true);
|
||||
}
|
||||
|
||||
console.log("streamdeck connected to server", versions.materialCompanion.current);
|
||||
streamDeck.resetImageBuffer();
|
||||
}
|
||||
|
||||
if (data.type == 'newDevice') {
|
||||
@@ -157,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);
|
||||
@@ -185,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);
|
||||
@@ -206,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);
|
||||
@@ -240,17 +235,16 @@ 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));
|
||||
const msg2 = {
|
||||
target: "SD",
|
||||
type: "init",
|
||||
system: getGamingSystem(),
|
||||
coreVersion: game.version.split('.')[0]
|
||||
}
|
||||
ws.send(JSON.stringify(msg2));
|
||||
transmitInitData();
|
||||
clearInterval(wsInterval);
|
||||
wsInterval = setInterval(resetWS, 5000);
|
||||
}
|
||||
@@ -259,6 +253,34 @@ function startWebsocket() {
|
||||
wsInterval = setInterval(resetWS, 10000);
|
||||
}
|
||||
let messageCount = 0;
|
||||
|
||||
function transmitInitData() {
|
||||
|
||||
const msg = {
|
||||
target: "MaterialDeck_Device",
|
||||
type: "init",
|
||||
userId: game.userId,
|
||||
system: getGamingSystem(),
|
||||
systemData: {
|
||||
conditions: tokenHelper.getConditionList(),
|
||||
abilities: tokenHelper.getAbilityList(),
|
||||
saves: tokenHelper.getSavesList(),
|
||||
skills: tokenHelper.getSkillList(),
|
||||
itemTypes: tokenHelper.getItemTypes(),
|
||||
weaponRollModes: tokenHelper.getWeaponRollModes(),
|
||||
featureTypes: tokenHelper.getFeatureTypes(),
|
||||
spellLevels: tokenHelper.getSpellLevels(),
|
||||
spellTypes: tokenHelper.getSpellTypes(),
|
||||
stats: tokenHelper.getStatsList(),
|
||||
onClick: tokenHelper.getOnClickList(),
|
||||
rollTypes: tokenHelper.getRollTypes(),
|
||||
attackModes: tokenHelper.getAttackModes()
|
||||
},
|
||||
coreVersion: game.version.split('.')[0]
|
||||
}
|
||||
ws.send(JSON.stringify(msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to reset the websocket if a connection is lost
|
||||
*/
|
||||
@@ -313,6 +335,24 @@ function getGamingSystem() {
|
||||
// Hooks
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
async function enableSettingDialog() {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const dialog = new Dialog({
|
||||
title: game.i18n.localize("MaterialDeck.EnableDialog.Title"),
|
||||
content: game.i18n.localize("MaterialDeck.EnableDialog.Content"),
|
||||
buttons: {
|
||||
yes: { label: game.i18n.localize("MaterialDeck.EnableDialog.Yes"), callback: () => { resolve('yes') } },
|
||||
no: { label: game.i18n.localize("MaterialDeck.EnableDialog.No"), callback: () => { resolve('no') } },
|
||||
},
|
||||
default: 'no',
|
||||
close: () => { reject() }
|
||||
});
|
||||
|
||||
dialog.render(true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ready hook
|
||||
@@ -320,9 +360,22 @@ function getGamingSystem() {
|
||||
*/
|
||||
Hooks.once('ready', async()=>{
|
||||
await registerSettings();
|
||||
|
||||
if (game.settings.get(moduleName, 'Enable')) game.settings.set(moduleName,'EnableDialogShown',true);
|
||||
else if (!game.settings.get(moduleName,'EnableDialogShown')) {
|
||||
const response = await enableSettingDialog();
|
||||
await game.settings.set(moduleName,'EnableDialogShown',true);
|
||||
if (response == "yes") await game.settings.set(moduleName, 'Enable', true);
|
||||
else await game.settings.set(moduleName, 'Enable', false);
|
||||
|
||||
}
|
||||
|
||||
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
|
||||
|
||||
getGamingSystem();
|
||||
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();
|
||||
@@ -425,15 +478,17 @@ 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);
|
||||
}
|
||||
|
||||
Hooks.on('updateToken',(scene,token)=>{
|
||||
Hooks.on('updateToken',(document,changes)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
let tokenId = token._id;
|
||||
let tokenId = changes._id;
|
||||
if (tokenId == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||
if (macroControl != undefined) macroControl.updateAll();
|
||||
if (changes.hidden != undefined && combatTracker != undefined) combatTracker.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('updateActor',(actor)=>{
|
||||
@@ -463,7 +518,7 @@ Hooks.on('onActorSetCondition',(data)=>{
|
||||
Hooks.on('controlToken',(token,controlled)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (controlled) {
|
||||
tokenControl.update(compatibleCore('10.0') ? token.id : token.data._id);
|
||||
tokenControl.update(token.id);
|
||||
if (controlTokenTimer != undefined) {
|
||||
clearTimeout(controlTokenTimer);
|
||||
controlTokenTimer = undefined;
|
||||
@@ -492,7 +547,9 @@ Hooks.on('render', (app)=>{
|
||||
|
||||
Hooks.on('renderCombatTracker',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (combatTracker != undefined) combatTracker.updateAll();
|
||||
if (combatTracker != undefined) {
|
||||
combatTracker.updateAll();
|
||||
}
|
||||
if (tokenControl != undefined) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||
});
|
||||
|
||||
@@ -512,6 +569,11 @@ Hooks.on('closeplaylistConfigForm', (form)=>{
|
||||
playlistControl.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('updatePlaylistSound', ()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (playlistControl != undefined) playlistControl.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('lightingRefresh',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (tokenControl != undefined) tokenControl.update();
|
||||
@@ -623,12 +685,12 @@ Hooks.on('NotYourTurn', ()=>{
|
||||
externalModules.updateAll();
|
||||
})
|
||||
|
||||
Hooks.on('pseudoclockSet', ()=>{
|
||||
Hooks.on('simple-calendar-date-time-change', ()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
externalModules.updateAll();
|
||||
})
|
||||
|
||||
Hooks.on('about-time.clockRunningStatus', ()=>{
|
||||
Hooks.on('simple-calendar-clock-start-stop', ()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
externalModules.updateAll();
|
||||
})
|
||||
@@ -651,3 +713,44 @@ Hooks.once('canvasReady',()=>{
|
||||
Hooks.on("soundscape", (data) => {
|
||||
externalModules.newSoundscapeData(data);
|
||||
});
|
||||
|
||||
Hooks.on("globalAmbientVolumeChanged", (volume) => {
|
||||
soundboard.ambientVolumeChanged(volume);
|
||||
})
|
||||
|
||||
Hooks.on('updateMacro', () => {
|
||||
if (enableModule == false || ready == false || macroControl == undefined) return;
|
||||
macroControl.updateAll();
|
||||
})
|
||||
|
||||
Hooks.on('globalPlaylistVolumeChanged', () => {
|
||||
if (enableModule == false || ready == false || otherControls == undefined) return;
|
||||
otherControls.updateAll();
|
||||
})
|
||||
|
||||
Hooks.on('globalAmbientVolumeChanged', () => {
|
||||
if (enableModule == false || ready == false || otherControls == undefined) return;
|
||||
otherControls.updateAll();
|
||||
})
|
||||
|
||||
Hooks.on('globalInterfaceVolumeChanged', () => {
|
||||
if (enableModule == false || ready == false || otherControls == undefined) return;
|
||||
otherControls.updateAll();
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
});
|
||||
@@ -66,7 +66,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.9 - 0.8.5<br>
|
||||
<b>Foundry VTT:</b> v10 - v11<br>
|
||||
<b>Module Incompatibilities:</b> None known.<br>
|
||||
|
||||
## Developer Guide
|
||||
|
||||
81
changelog.md
@@ -1,6 +1,85 @@
|
||||
# Changelog Material Deck Module
|
||||
### v1.4.11 - 05-09-2022
|
||||
### v1.5.2 - xx-xx-2023
|
||||
<b>Starting from this version you have to use <a href="https://github.com/MaterialFoundry/MaterialCompanion">Material Companion</a> instead of Material Server.</b>
|
||||
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>(PF2e) Token Action => Toggle Condition: Condition icons work again</li>
|
||||
</ul>
|
||||
|
||||
Other:
|
||||
<ul>
|
||||
<li>Material Deck is no longer compatible with Material Server, you now have to use Material Companion</li>
|
||||
<li>Removed 'Device Config' because this is now handled by Material Companion</li>
|
||||
</ul>
|
||||
|
||||
### v1.5.1 - 28-06-2023
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Token Action => Toggle Condition: Fixed PF2e conditions</li>
|
||||
<li>Macro Action => Macro by name: Fixed macro arguments not working in v10</li>
|
||||
<li>Download Utility: Latest module version is now displayed correctly</li>
|
||||
</ul>
|
||||
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Other Actions => Open Journal: Added option to open journal pages by page name or number</li>
|
||||
<li>Playlist Action: Added option to select playlists and tracks by name</li>
|
||||
</ul>
|
||||
|
||||
### v1.5.0 - 28-05-2023
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Most settings in the plugin are now hyperlinks. Clicking them opens a window opening the relevant section on the wiki describing that setting.</li>
|
||||
<li>Token Action => Stats: Added support for simple if-statements in the custom stats function</li>
|
||||
<li>(dnd5e) Token Action => Added option to filter spells by preparedness</li>
|
||||
<li>Added an 'Icon Override' option to each action. Filling in a path to an icon on your Foundry server will make the button use that icon instead of the default one</li>
|
||||
<li>Added a one-time popup asking users if they want to enable the module for their client. This should hopefully solve one of the most common connection issues</li>
|
||||
<li>Token Action: Added background color option for items, abilities and spells</li>
|
||||
<li>Added the current and latest module version to the download utility</li>
|
||||
<li>Combat Tracker: Added option to filter combatants in order to not display neutral, hostile or hidden tokens</li>
|
||||
<li>Macro Action => Macroboard: Added a label to each macro. By default this is the name of the macro, but this can be edited to your liking. If 'Display Name/Label' is selected in the SD app, the label will be displayed. This allows you to distinguish macros when the same macro is used for multiple functions (using macro arguments)</li>
|
||||
<li>(dnd5e) Other: Added 'Attack Roll Modes' where you can configure weapon rolls to roll for 'to hit', 'damage', 'crit damage', etc</li>
|
||||
<li>Scene Action: Added option to specify a ring color for the active scene</li>
|
||||
<li>Other Controls => Darkness Control: Added animation time option for 'Transition to Day/Night'</li>
|
||||
<li>Other Controls: Added 'Global Volume Controls' to control the playlist, ambient and interface volume</li>
|
||||
</ul>
|
||||
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>External Modules => Monk's Active Tile Triggers: Was no longer working, should now be fixed</li>
|
||||
<li>Soundboard: Changing the 'Ambient' volume slider now instantaneously changes the volume of any currently playing sounds</li>
|
||||
<li>Token Action => On Click => Handle Condition: Fixed some issues with conditions not being there or not working</li>
|
||||
<li>Token Action => On Click: Fixed item offset</li>
|
||||
<li>Fixed issue where long text would result in an error if Foundry was set to Russian</li>
|
||||
<li>Macro Action => Macroboard: Arguments are stored again</li>
|
||||
<li>Macro Action: Arguments were broken due to an update to Advanced Macros, this is now fixed</li>
|
||||
<li>Macro Action: Fixed issue with icons on SD turning black when changing the icon in Foundry or moving the macro on the macrobar</li>
|
||||
<li>Playlist Action: Playlist with shuffle enabled now play shuffled</li>
|
||||
<li>Other => Control Buttons: Changing controls now loads the correct canvas layer</li>
|
||||
<li>Combat Tracker: Token image, name and stats would not always display (if a new Combat Tracker action was created without changing 'Mode')</li>
|
||||
</ul>
|
||||
|
||||
Other:
|
||||
<ul>
|
||||
<li>Made compatible with Foundry v11, dropped compatibility with Foundry v9</li>
|
||||
<li>Moved most of the system-dependent code from the plugin to the module. This makes implementing new system or modifying/fixing current systems easier. It also automates some stuff (for example grabbing all conditions from Foundry instead of hardcoding them)</li>
|
||||
<li>External Modules => About Time: Has been replaced with 'Simple Calendar' since About Time no longer functions as time/calendar management. It still functions exactly the same</li>
|
||||
<li>External Modules => Mook AI: Has been removed since the module hasn't been updated for Foundry v10 or v11</li>
|
||||
<li>Changed the logo in the Stream Deck app from the Foundry VTT logo to the Material Foundry logo</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.5.0 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v1.4.12 - 07-09-2022
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Some settings did not have a default value, which caused errors for new users in v10</li>
|
||||
</ul>
|
||||
|
||||
### v1.4.11 - 05-09-2022
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Fixed system autodetection bug, where it would not always correctly detect the system</li>
|
||||
|
||||
BIN
img/.thumb/MaterialFoundry2560x1440.jpg.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/MaterialFoundry2560x1440.jpg
Normal file
|
After Width: | Height: | Size: 483 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
48
lang/en.json
@@ -1,26 +1,38 @@
|
||||
{
|
||||
"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",
|
||||
"MaterialDeck.Notifications.Playlist.NoPermission": "You do not have permission to configure the playlists",
|
||||
|
||||
"MaterialDeck.Sett.Enable": "Enable module",
|
||||
"MaterialDeck.EnableDialog.Title": "Material Deck: Enable for this Client",
|
||||
"MaterialDeck.EnableDialog.Content": "Do you want to enable Material Deck for this client?<br><br>If you don't have a Stream Deck connected, or don't want to use it for Material Deck, please click no.<br><br>You can always change this in the Material Deck module settings.<br><br>Foundry will refresh after this.<br>",
|
||||
"MaterialDeck.EnableDialog.Yes": "Yes",
|
||||
"MaterialDeck.EnableDialog.No": "No",
|
||||
|
||||
"MaterialDeck.UpdateRequired.Title": "Material Deck: Update Required",
|
||||
"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 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",
|
||||
|
||||
"MaterialDeck.Sett.Enable": "Enable Module for This Client",
|
||||
"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.",
|
||||
|
||||
@@ -63,6 +75,7 @@
|
||||
"MaterialDeck.Filename": "Filename",
|
||||
"MaterialDeck.Id": "Id",
|
||||
"MaterialDeck.Type": "Type",
|
||||
"MaterialDeck.Label": "Label",
|
||||
|
||||
"MaterialDeck.ExportDialog.Title": "Export",
|
||||
"MaterialDeck.ExportDialog.SoundboardContent": "Export the soundboard data. Please note that only the metadata is exported, so you will have to make sure the audio files are in the same relative location when you import them.",
|
||||
@@ -189,21 +202,22 @@
|
||||
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "Observer",
|
||||
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "Allow users access to tokens with observer permission",
|
||||
|
||||
"MaterialDeck.AboutTime.First": "st",
|
||||
"MaterialDeck.AboutTime.Second": "nd",
|
||||
"MaterialDeck.AboutTime.Third": "rd",
|
||||
"MaterialDeck.AboutTime.Fourth": "th",
|
||||
"MaterialDeck.AboutTime.Of": "of",
|
||||
"MaterialDeck.SimpleCalendar.First": "st",
|
||||
"MaterialDeck.SimpleCalendar.Second": "nd",
|
||||
"MaterialDeck.SimpleCalendar.Third": "rd",
|
||||
"MaterialDeck.SimpleCalendar.Fourth": "th",
|
||||
"MaterialDeck.SimpleCalendar.Of": "of",
|
||||
|
||||
"MaterialDeck.DownloadUtility.Title": "Download Utility",
|
||||
"MaterialDeck.DownloadUtility.Plugin": "Plugin & Material Server",
|
||||
"MaterialDeck.DownloadUtility.Plugin": "Module, Stream Deck Plugin & Material Companion",
|
||||
"MaterialDeck.DownloadUtility.Minimum": "Minimum",
|
||||
"MaterialDeck.DownloadUtility.Current": "Current",
|
||||
"MaterialDeck.DownloadUtility.Latest": "Latest",
|
||||
"MaterialDeck.DownloadUtility.OS": "OS",
|
||||
"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)",
|
||||
@@ -211,9 +225,5 @@
|
||||
"MaterialDeck.DownloadUtility.Source": "Source",
|
||||
"MaterialDeck.DownloadUtility.Profiles": "Profiles",
|
||||
"MaterialDeck.DownloadUtility.Name": "Name",
|
||||
"MaterialDeck.DownloadUtility.Refresh": "Refresh",
|
||||
|
||||
"MaterialDeck.SdMsUpdateRequired": "The Stream Deck plugin and Material Server version you are using are incompatible with this version of the module.<br>Please update them.",
|
||||
"MaterialDeck.SdUpdateRequired": "The Stream Deck plugin you are using is incompatible with this version of the module.<br>Please update it.",
|
||||
"MaterialDeck.MsUpdateRequired": "The Material Server version you are using is incompatible with this version of the module.<br>Please update it."
|
||||
"MaterialDeck.DownloadUtility.Refresh": "Refresh"
|
||||
}
|
||||
10
lang/ja.json
@@ -184,11 +184,11 @@
|
||||
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "オブザーバー",
|
||||
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "オブザーバー権限を持つトークンへのユーザーアクセスを許可する",
|
||||
|
||||
"MaterialDeck.AboutTime.First": "1",
|
||||
"MaterialDeck.AboutTime.Second": "2",
|
||||
"MaterialDeck.AboutTime.Third": "3",
|
||||
"MaterialDeck.AboutTime.Fourth": "4",
|
||||
"MaterialDeck.AboutTime.Of": "/",
|
||||
"MaterialDeck.SimpleCalendar.First": "1",
|
||||
"MaterialDeck.SimpleCalendar.Second": "2",
|
||||
"MaterialDeck.SimpleCalendar.Third": "3",
|
||||
"MaterialDeck.SimpleCalendar.Fourth": "4",
|
||||
"MaterialDeck.SimpleCalendar.Of": "/",
|
||||
|
||||
"MaterialDeck.DownloadUtility.Title": "ダウンロード・ユーティリティ",
|
||||
"MaterialDeck.DownloadUtility.Plugin": "プラグイン&Material Server",
|
||||
|
||||
43
module.json
@@ -1,24 +1,35 @@
|
||||
{
|
||||
"name": "MaterialDeck",
|
||||
"id": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.4.11",
|
||||
"version": "1.5.2_pre",
|
||||
"author": "CDeenen",
|
||||
"authors": {
|
||||
"authors": [
|
||||
{
|
||||
"name": "CDeenen",
|
||||
"email": "cdeenen@outlook.com",
|
||||
"discord": "Cris#6864",
|
||||
"patreon": "MaterialFoundry",
|
||||
"reddit": "CDeenen123"
|
||||
},
|
||||
"esmodules": ["./MaterialDeck.js"],
|
||||
"styles": ["./css/style.css"],
|
||||
}
|
||||
],
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
],
|
||||
"styles": [
|
||||
"./css/style.css"
|
||||
],
|
||||
"socket": true,
|
||||
"minimumCoreVersion": "9",
|
||||
"compatibleCoreVersion": "10",
|
||||
"minimumCoreVersion": "10",
|
||||
"compatibleCoreVersion": "11",
|
||||
"compatibility": {
|
||||
"minimum": "9",
|
||||
"verified": "10"
|
||||
"minimum": "10",
|
||||
"verified": "11"
|
||||
},
|
||||
"flags": {
|
||||
"minimumMaterialCompanionVersion": "1.0.2",
|
||||
"minimumPluginVersion": "1.5.2"
|
||||
},
|
||||
"languages": [
|
||||
{
|
||||
@@ -35,11 +46,19 @@
|
||||
"media": [
|
||||
{
|
||||
"type": "icon",
|
||||
"url": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/img/MaterialFoundry512x512.png"
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry512x512.png"
|
||||
},
|
||||
{
|
||||
"type": "setup",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
||||
},
|
||||
{
|
||||
"type": "cover",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
||||
}
|
||||
],
|
||||
"manifestPlusVersion": "1.1.0",
|
||||
"url": "https://github.com/CDeenen/MaterialDeck",
|
||||
"manifest": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json",
|
||||
"download": "https://github.com/CDeenen/MaterialDeck/archive/Master.zip"
|
||||
"manifest": "https://github.com/CDeenen/MaterialDeck/releases/latest/download/module.json",
|
||||
"download": "https://github.com/CDeenen/MaterialDeck/releases/download/v1.5.1/module.zip"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { streamDeck, tokenControl, getPermission } from "../../MaterialDeck.js";
|
||||
import { } from "../misc.js";
|
||||
|
||||
export class CombatTracker{
|
||||
constructor(){
|
||||
@@ -18,40 +19,70 @@ export class CombatTracker{
|
||||
}
|
||||
}
|
||||
|
||||
applyFilter(combatant, settings) {
|
||||
let conf = {
|
||||
forceIcon: undefined,
|
||||
hideName: false
|
||||
}
|
||||
const disposition = combatant.token.disposition;
|
||||
const hidden = combatant.token.hidden;
|
||||
const visibilityMode = settings.visibilityMode ? settings.visibilityMode : 'remove';
|
||||
const dispositionMode = settings.dispositionMode ? settings.dispositionMode : 'remove';
|
||||
if (hidden && (settings.visibilityFilter == 'all' || (settings.visibilityFilter == 'hostileNeutral' && disposition != 1) || (settings.visibilityFilter == 'hostile' && disposition == -1))) {
|
||||
if (visibilityMode == 'black' || visibilityMode == 'remove') conf.forceIcon = "modules/MaterialDeck/img/black.png";
|
||||
else if (visibilityMode == 'mysteryMan') conf.forceIcon = "modules/MaterialDeck/img/token/mystery-man.png";
|
||||
else if (visibilityMode == 'hideName') conf.hideName = true;
|
||||
}
|
||||
if ((settings.dispositionFilter == 'friendlyNeutral' && disposition == -1) || (settings.dispositionFilter == 'friendly' && disposition != 1)) {
|
||||
if (conf.forceIcon == undefined && (dispositionMode == 'black' || dispositionMode == 'remove')) conf.forceIcon = "modules/MaterialDeck/img/black.png";
|
||||
else if (conf.forceIcon == undefined && dispositionMode == 'mysteryMan') conf.forceIcon = "modules/MaterialDeck/img/token/mystery-man.png";
|
||||
else if (dispositionMode == 'hideName') conf.hideName = true;
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
|
||||
update(settings,context,device){
|
||||
this.active = true;
|
||||
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
|
||||
const mode = settings.combatTrackerMode ? settings.combatTrackerMode : 'combatants';
|
||||
settings.combatTrackerMode = mode;
|
||||
const combat = game.combat;
|
||||
let src = "modules/MaterialDeck/img/black.png";
|
||||
let txt = "";
|
||||
let background = "#000000";
|
||||
settings.combat = true;
|
||||
settings.icon = settings.displayIcon ? 'tokenIcon' : 'none';
|
||||
|
||||
if (mode == 'combatants'){
|
||||
if (getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
||||
streamDeck.noPermission(context,device,device,false,"combat tracker");
|
||||
return;
|
||||
}
|
||||
if (combat != null && combat != undefined && combat.turns.length != 0){
|
||||
const initiativeOrder = combat.turns;
|
||||
let nr = settings.combatantNr - 1;
|
||||
if (nr == undefined || nr < 1) nr = 0;
|
||||
const combatantState = (nr == combat.turn) ? 2 : 1;
|
||||
let initiativeOrder = combat.turns;
|
||||
const dispositionMode = settings.dispositionMode ? settings.dispositionMode : 'remove';
|
||||
if (dispositionMode == 'remove' && settings.dispositionFilter == 'friendly') initiativeOrder = initiativeOrder.filter(c => c.token.disposition == 1);
|
||||
else if (dispositionMode == 'remove' && settings.dispositionFilter == 'friendlyNeutral') initiativeOrder = initiativeOrder.filter(c => c.token.disposition != -1);
|
||||
const visibilityMode = settings.visibilityMode ? settings.visibilityMode : 'none';
|
||||
if (visibilityMode == 'remove' && settings.visibilityFilter == 'hostile') initiativeOrder = initiativeOrder.filter(c => c.token.disposition != -1 && c.token.hidden == false)
|
||||
else if (visibilityMode == 'remove' && settings.visibilityFilter == 'hostileNeutral') initiativeOrder = initiativeOrder.filter(c => c.token.disposition == 1 && c.token.hidden == false)
|
||||
else if (visibilityMode == 'remove' && settings.visibilityFilter == 'all') initiativeOrder = initiativeOrder.filter(c => c.token.hidden == false)
|
||||
const nr = settings.combatantNr ? settings.combatantNr - 1 : 0;
|
||||
const combatant = initiativeOrder[nr]
|
||||
|
||||
const combatantState = (combatant?.token.id == combat.current.tokenId) ? 2 : 1;
|
||||
if (combatant != undefined){
|
||||
const tokenId = combatant.data.tokenId;
|
||||
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00');
|
||||
const filterConfig = this.applyFilter(combatant, settings);
|
||||
const tokenId = combatant.token.id;
|
||||
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00', filterConfig.forceIcon, filterConfig.hideName);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
@@ -62,10 +93,12 @@ export class CombatTracker{
|
||||
return;
|
||||
}
|
||||
if (combat != null && combat != undefined && combat.started){
|
||||
const tokenId = combat.combatant.data.tokenId;
|
||||
tokenControl.pushData(tokenId,settings,context,device);
|
||||
const filterConfig = this.applyFilter(combat.combatant, settings);
|
||||
const tokenId = combat.combatant.token.id;
|
||||
tokenControl.pushData(tokenId,settings,context,device,undefined,undefined, filterConfig.forceIcon, filterConfig.hideName);
|
||||
}
|
||||
else {
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
@@ -131,6 +164,11 @@ export class CombatTracker{
|
||||
else if (ctFunction == 'rollInitiative' || ctFunction == 'rollInitiativeNPC')
|
||||
src = "modules/MaterialDeck/img/token/init.png";
|
||||
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
src = settings.iconOverride;
|
||||
background = settings.background ? settings.background : '#000000'
|
||||
}
|
||||
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
@@ -193,12 +231,12 @@ export class CombatTracker{
|
||||
if (nr == undefined || nr < 1) nr = 0;
|
||||
const combatant = initiativeOrder[nr]
|
||||
if (combatant == undefined) return;
|
||||
tokenId = combatant.data.tokenId;
|
||||
tokenId = combatant.token.id;
|
||||
}
|
||||
}
|
||||
else if (mode == 'currentCombatant')
|
||||
if (combat != null && combat != undefined && combat.started)
|
||||
tokenId = combat.combatant.data.tokenId;
|
||||
tokenId = combat.combatant.token.id;
|
||||
|
||||
let token = (canvas.tokens.children[0] != undefined) ? canvas.tokens.children[0].children.find(p => p.id == tokenId) : undefined;
|
||||
if (token == undefined) return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { streamDeck } from "../../MaterialDeck.js";
|
||||
import { compatibleCore } from "../misc.js";
|
||||
import { } from "../misc.js";
|
||||
|
||||
export class ExternalModules{
|
||||
soundscapeSettings = {
|
||||
@@ -60,15 +60,13 @@ export class ExternalModules{
|
||||
update(settings,context,device){
|
||||
this.active = true;
|
||||
const module = settings.module ? settings.module : 'fxmaster';
|
||||
|
||||
if (module == 'fxmaster') this.updateFxMaster(settings,context,device);
|
||||
else if (module == 'gmscreen') this.updateGMScreen(settings,context,device);
|
||||
else if (module == 'triggerHappy') this.updateTriggerHappy(settings,context,device);
|
||||
else if (module == 'sharedVision') this.updateSharedVision(settings,context,device);
|
||||
else if (module == 'mookAI') this.updateMookAI(settings,context,device);
|
||||
else if (module == 'notYourTurn') this.updateNotYourTurn(settings,context,device);
|
||||
else if (module == 'lockView') this.updateLockView(settings,context,device);
|
||||
else if (module == 'aboutTime') this.updateAboutTime(settings,context,device);
|
||||
else if (module == 'simpleCalendar') this.updateSimpleCalendar(settings,context,device);
|
||||
else if (module == 'soundscape') this.updateSoundscape(settings,context,device);
|
||||
else if (module == 'monksActiveTiles') this.updateMonksActiveTiles(settings,context,device);
|
||||
}
|
||||
@@ -81,10 +79,9 @@ export class ExternalModules{
|
||||
else if (module == 'gmscreen') this.keyPressGMScreen(settings,context,device);
|
||||
else if (module == 'triggerHappy') this.keyPressTriggerHappy(settings,context,device);
|
||||
else if (module == 'sharedVision') this.keyPressSharedVision(settings,context,device);
|
||||
else if (module == 'mookAI') this.keyPressMookAI(settings,context,device);
|
||||
else if (module == 'notYourTurn') this.keyPressNotYourTurn(settings,context,device);
|
||||
else if (module == 'lockView') this.keyPressLockView(settings,context,device);
|
||||
else if (module == 'aboutTime') this.keyPressAboutTime(settings,context,device);
|
||||
else if (module == 'simpleCalendar') this.keyPressSimpleCalendar(settings,context,device);
|
||||
else if (module == 'soundscape') this.keyPressSoundscape(settings,context,device);
|
||||
else if (module == 'monksActiveTiles') this.keyPressMonksActiveTiles(settings,context,device);
|
||||
}
|
||||
@@ -114,14 +111,14 @@ export class ExternalModules{
|
||||
let name = '';
|
||||
if (type == 'weatherControls') {
|
||||
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
|
||||
name = compatibleCore('10.0') ? game.i18n.localize(CONFIG.fxmaster.particleEffects[effect].label) : CONFIG.fxmaster.weather[effect].label;
|
||||
icon = compatibleCore('10.0') ? CONFIG.fxmaster.particleEffects[effect].icon : CONFIG.fxmaster.weather[effect].icon;
|
||||
name =game.i18n.localize(CONFIG.fxmaster.particleEffects[effect].label);
|
||||
icon = CONFIG.fxmaster.particleEffects[effect].icon;
|
||||
ring = canvas.scene.getFlag("fxmaster", "effects")?.[`core_${effect}`] ? 2 : 1;
|
||||
ringColor = ring < 2 ? '#000000' : "#00ff00";
|
||||
}
|
||||
else if (type == 'filters') {
|
||||
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
|
||||
name = compatibleCore('10.0') ? game.i18n.localize(CONFIG.fxmaster.filterEffects[filter].label) : CONFIG.fxmaster.filters[filter].label;
|
||||
name = game.i18n.localize(CONFIG.fxmaster.filterEffects[filter].label);
|
||||
background = "#340057";
|
||||
if (displayIcon){
|
||||
if (filter == 'lightning') icon = "fas fa-bolt";
|
||||
@@ -150,6 +147,7 @@ export class ExternalModules{
|
||||
name = game.i18n.localize("MaterialDeck.FxMaster.Clear");
|
||||
}
|
||||
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
|
||||
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:ring,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device, "", {background:background,ring:ring,ringColor:ringColor});
|
||||
if (displayName == 0) name = "";
|
||||
@@ -175,7 +173,7 @@ export class ExternalModules{
|
||||
applyColor: (settings.fxWeatherEnColor == undefined) ? false : settings.fxWeatherEnColor
|
||||
}
|
||||
|
||||
Hooks.call(compatibleCore('10.0') ? "fxmaster.switchParticleEffect" : "fxmaster.switchWeather", {
|
||||
Hooks.call("fxmaster.switchParticleEffect", {
|
||||
name: `core_${effect}`,
|
||||
type: effect,
|
||||
options,
|
||||
@@ -236,7 +234,6 @@ export class ExternalModules{
|
||||
updateGMScreen(settings,context,device){
|
||||
if (this.getModuleEnable("gm-screen") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
const background = settings.gmScreenBackground ? settings.gmScreenBackground : '#000000';
|
||||
let ring = 1;
|
||||
const ringColor = '#00FF00'
|
||||
@@ -246,6 +243,7 @@ export class ExternalModules{
|
||||
if (this.gmScreenOpen) ring = 2;
|
||||
|
||||
if (settings.displayGmScreenIcon) src = "fas fa-book-reader";
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
if (settings.displayGmScreenName) txt = game.i18n.localize(`GMSCR.gmScreen.Open`);
|
||||
streamDeck.setTitle(txt,context);
|
||||
@@ -272,7 +270,9 @@ export class ExternalModules{
|
||||
const ringColor = game.settings.get("trigger-happy", "enableTriggers") ? "#A600FF" : "#340057";
|
||||
|
||||
let txt = '';
|
||||
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-grin-squint-tears",{background:background,ring:2,ringColor:ringColor});
|
||||
let src = "fas fa-grin-squint-tears";
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
if (displayIcon) streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName) txt = 'Trigger Happy';
|
||||
|
||||
@@ -313,7 +313,9 @@ export class ExternalModules{
|
||||
const ringColor = game.settings.get("SharedVision", "enable") ? "#A600FF" : "#340057";
|
||||
|
||||
let txt = '';
|
||||
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-eye",{background:background,ring:2,ringColor:ringColor});
|
||||
let src = "fas fa-eye";
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
if (displayIcon) streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName) txt = 'Shared Vision';
|
||||
streamDeck.setTitle(txt,context);
|
||||
@@ -330,34 +332,6 @@ export class ExternalModules{
|
||||
else if (mode == 'disable') Hooks.call("setShareVision",{enable:false});
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Mook AI
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateMookAI(settings,context,device) {
|
||||
if (this.getModuleEnable("mookAI") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
const displayName = settings.mookName ? settings.mookName : false;
|
||||
const displayIcon = settings.mookIcon ? settings.mookIcon : false;
|
||||
|
||||
const background = "#000000";
|
||||
|
||||
let txt = '';
|
||||
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-brain",{background:'#000000'});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName) txt = 'Mook AI';
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
async keyPressMookAI(settings,context,device) {
|
||||
if (this.getModuleEnable("mookAI") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
let mook = await import('../../mookAI/scripts/mookAI.js');
|
||||
let mookAI = new mook.MookAI ();
|
||||
mookAI.takeNextTurn();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Not Your Turn!
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -385,6 +359,7 @@ export class ExternalModules{
|
||||
txt = "Block Non-Combat Movement";
|
||||
ringColor = game.settings.get('NotYourTurn','nonCombat') ? "#A600FF": "#340057" ;
|
||||
}
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
|
||||
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName == false) txt = '';
|
||||
@@ -439,6 +414,7 @@ export class ExternalModules{
|
||||
ringColor = canvas.scene.getFlag('LockView', 'boundingBox') ? "#A600FF": "#340057" ;
|
||||
}
|
||||
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
|
||||
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName == false) txt = '';
|
||||
@@ -465,20 +441,20 @@ export class ExternalModules{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//About Time
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateAboutTime(settings,context,device) {
|
||||
if (this.getModuleEnable("about-time") == false) return;
|
||||
updateSimpleCalendar(settings,context,device) {
|
||||
if (this.getModuleEnable("foundryvtt-simple-calendar") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
const displayTime = settings.aboutTimeDisplayTime ? settings.aboutTimeDisplayTime : 'none';
|
||||
const displayDate = settings.aboutTimeDisplayDate ? settings.aboutTimeDisplayDate : 'none';
|
||||
const background = settings.aboutTimeBackground ? settings.aboutTimeBackground : '#000000';
|
||||
const ringOffColor = settings.aboutTimeOffRing ? settings.aboutTimeOffRing : '#000000';
|
||||
const ringOnColor = settings.aboutTimeOnRing ? settings.aboutTimeOnRing : '#00FF00';
|
||||
const displayTime = settings.simpleCalendarDisplayTime ? settings.simpleCalendarDisplayTime : 'none';
|
||||
const displayDate = settings.simpleCalendarDisplayDate ? settings.simpleCalendarDisplayDate : 'none';
|
||||
const background = settings.simpleCalendarBackground ? settings.simpleCalendarBackground : '#000000';
|
||||
const ringOffColor = settings.simpleCalendarOffRing ? settings.simpleCalendarOffRing : '#000000';
|
||||
const ringOnColor = settings.simpleCalendarOnRing ? settings.simpleCalendarOnRing : '#00FF00';
|
||||
|
||||
let ring = 0;
|
||||
let ringColor = '#000000';
|
||||
let txt = '';
|
||||
let currentTime = game.Gametime.DTNow().longDateExtended();
|
||||
let currentTime = SimpleCalendar.api.currentDateTime();
|
||||
let clock = 'none';
|
||||
|
||||
if (displayTime == 'clock') {
|
||||
@@ -504,172 +480,112 @@ export class ExternalModules{
|
||||
}
|
||||
if (displayTime == 'hours24h' || displayTime == 'hours12h') txt = hours;
|
||||
else if (displayTime == 'minutes') txt = currentTime.minute;
|
||||
else if (displayTime == 'seconds') txt = currentTime.second;
|
||||
else if (displayTime == 'seconds') txt = currentTime.seconds;
|
||||
else {
|
||||
if (currentTime.minute < 10) currentTime.minute = '0' + currentTime.minute;
|
||||
if (currentTime.second < 10) currentTime.second = '0' + currentTime.second;
|
||||
if (currentTime.seconds < 10) currentTime.seconds = '0' + currentTime.seconds;
|
||||
txt += hours + ':' + currentTime.minute;
|
||||
if (displayTime == 'full24h' || displayTime == 'full12h') txt += ':' + currentTime.second;
|
||||
if (displayTime == 'full24h' || displayTime == 'full12h') txt += ':' + currentTime.seconds;
|
||||
}
|
||||
if (displayTime == 'compact12h' || displayTime == 'full12h' || displayTime == 'hours12h') txt += AMPM;
|
||||
}
|
||||
if (displayTime != 'none' && displayTime != 'clock' && displayDate != 'none') txt += '\n';
|
||||
|
||||
if (displayDate == 'day') txt += currentTime.day;
|
||||
else if (displayDate == 'dayName') txt += currentTime.dowString;
|
||||
else if (displayDate == 'dayName') txt += SimpleCalendar.api.getCurrentWeekday().name;
|
||||
else if (displayDate == 'month') txt += currentTime.month;
|
||||
else if (displayDate == 'monthName') txt += currentTime.monthString;
|
||||
else if (displayDate == 'monthName') txt += SimpleCalendar.api.getCurrentMonth().name;
|
||||
else if (displayDate == 'year') txt += currentTime.year;
|
||||
else if (displayDate == 'small') txt += currentTime.day + '-' + currentTime.month;
|
||||
else if (displayDate == 'smallInv') txt += currentTime.month + '-' + currentTime.day;
|
||||
else if (displayDate == 'full') txt += currentTime.day + '-' + currentTime.month + '-' + currentTime.year;
|
||||
else if (displayDate == 'fullInv') txt += currentTime.month + '-' + currentTime.day + '-' + currentTime.year;
|
||||
else if (displayDate == 'text' || displayDate == 'textDay') {
|
||||
|
||||
if (displayDate == 'textDay') txt += currentTime.dowString + ' ';
|
||||
else if (displayDate == 'text' || displayDate == 'textDay' || displayDate == 'textAbbr' || displayDate == 'textDayAbbr') {
|
||||
if (displayDate == 'textDay') txt += SimpleCalendar.api.getCurrentWeekday().name + ' ';
|
||||
else if (displayDate == 'textDayAbbr') txt += SimpleCalendar.api.getCurrentWeekday().abbreviation + ' ';
|
||||
txt += currentTime.day;
|
||||
if (currentTime.day % 10 == 1 && currentTime != 11) txt += game.i18n.localize("MaterialDeck.AboutTime.First");
|
||||
else if (currentTime.day % 10 == 2 && currentTime != 12) txt += game.i18n.localize("MaterialDeck.AboutTime.Second");
|
||||
else if (currentTime.day % 10 == 3 && currentTime != 13) txt += game.i18n.localize("MaterialDeck.AboutTime.Third");
|
||||
else txt += game.i18n.localize("MaterialDeck.AboutTime.Fourth");
|
||||
txt += ' ' + game.i18n.localize("MaterialDeck.AboutTime.Of") + ' ' + currentTime.monthString + ', ' + currentTime.year;
|
||||
if (currentTime.day % 10 == 1 && currentTime != 11) txt += game.i18n.localize("MaterialDeck.SimpleCalendar.First");
|
||||
else if (currentTime.day % 10 == 2 && currentTime != 12) txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Second");
|
||||
else if (currentTime.day % 10 == 3 && currentTime != 13) txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Third");
|
||||
else txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Fourth");
|
||||
txt += ' ' + game.i18n.localize("MaterialDeck.SimpleCalendar.Of") + ' '
|
||||
if (displayDate == 'textAbbr' || displayDate == 'textDayAbbr') txt += SimpleCalendar.api.getCurrentMonth().abbreviation
|
||||
else txt += SimpleCalendar.api.getCurrentMonth().name
|
||||
txt += ', ' + currentTime.year;
|
||||
}
|
||||
|
||||
if (settings.aboutTimeActive) {
|
||||
const clockRunning = game.Gametime.isRunning();
|
||||
if (settings.simpleCalendarActive) {
|
||||
const clockRunning = SimpleCalendar.api.clockStatus().started;
|
||||
ringColor = clockRunning ? ringOnColor : ringOffColor;
|
||||
ring = 2;
|
||||
}
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setTitle(txt.toString(),context);
|
||||
streamDeck.setIcon(context,device,'',{background:background,ring:ring,ringColor:ringColor, clock:clock});
|
||||
}
|
||||
|
||||
keyPressAboutTime(settings,context,device) {
|
||||
if (this.getModuleEnable("about-time") == false) return;
|
||||
keyPressSimpleCalendar(settings,context,device) {
|
||||
if (this.getModuleEnable("foundryvtt-simple-calendar") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
const onClick = settings.aboutTimeOnClick ? settings.aboutTimeOnClick : 'none';
|
||||
const onClick = settings.simpleCalendarOnClick ? settings.simpleCalendarOnClick : 'none';
|
||||
if (onClick == 'none') return;
|
||||
else if (onClick == 'startStop') {
|
||||
const clockRunning = game.Gametime.isRunning();
|
||||
const startMode = settings.aboutTimeStartStopMode ? settings.aboutTimeStartStopMode : 'toggle';
|
||||
if ((startMode == 'toggle' && clockRunning) || startMode == 'stop') game.Gametime.stopRunning();
|
||||
else if ((startMode == 'toggle' && !clockRunning) || startMode == 'start') game.Gametime.startRunning();
|
||||
const clockRunning = SimpleCalendar.api.clockStatus().started;
|
||||
const startMode = settings.simpleCalendarStartStopMode ? settings.simpleCalendarStartStopMode : 'toggle';
|
||||
if (clockRunning && (startMode == 'toggle' || startMode == 'stop')) SimpleCalendar.api.stopClock();
|
||||
else if (!clockRunning && (startMode == 'toggle' || startMode == 'start')) SimpleCalendar.api.startClock();
|
||||
}
|
||||
else if (onClick == 'advance') {
|
||||
const advanceMode = settings.aboutTimeAdvanceMode ? settings.aboutTimeAdvanceMode : 'dawn';
|
||||
let now = Gametime.DTNow();
|
||||
if (advanceMode == 'dawn') {
|
||||
let newDT = now.add({
|
||||
days: now.hours < 7 ? 0 : 1
|
||||
}).setAbsolute({
|
||||
hours: 7,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
}
|
||||
else if (advanceMode == 'noon') {
|
||||
let newDT = now.add({
|
||||
days: now.hours < 12 ? 0 : 1
|
||||
}).setAbsolute({
|
||||
hours: 12,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
}
|
||||
else if (advanceMode == 'dusk') {
|
||||
let newDT = now.add({
|
||||
days: now.hours < 20 ? 0 : 1
|
||||
}).setAbsolute({
|
||||
hours: 20,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
}
|
||||
else if (advanceMode == 'midnight') {
|
||||
let newDT = Gametime.DTNow().add({
|
||||
days: 1
|
||||
}).setAbsolute({
|
||||
hours: 0,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
}
|
||||
else if (advanceMode == '1s')
|
||||
game.Gametime.advanceClock(1);
|
||||
else if (advanceMode == '30s')
|
||||
game.Gametime.advanceClock(30);
|
||||
|
||||
else if (advanceMode == '1m')
|
||||
game.Gametime.advanceTime({ minutes: 1 });
|
||||
else if (advanceMode == '5m')
|
||||
game.Gametime.advanceTime({ minutes: 5 });
|
||||
else if (advanceMode == '15m')
|
||||
game.Gametime.advanceTime({ minutes: 15 });
|
||||
else if (advanceMode == '1h')
|
||||
game.Gametime.advanceTime({ hours: 1 });
|
||||
const advanceMode = settings.simpleCalendarAdvanceMode ? settings.simpleCalendarAdvanceMode : 'dawn';
|
||||
if (advanceMode == 'sunrise') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunrise);
|
||||
if (advanceMode == 'midday') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midday);
|
||||
if (advanceMode == 'sunset') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunset);
|
||||
if (advanceMode == 'midnight') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midnight);
|
||||
else if (advanceMode == '1s') SimpleCalendar.api.changeDate({seconds: 1});
|
||||
else if (advanceMode == '30s') SimpleCalendar.api.changeDate({seconds: 30});
|
||||
else if (advanceMode == '1m') SimpleCalendar.api.changeDate({minute: 1});
|
||||
else if (advanceMode == '5m') SimpleCalendar.api.changeDate({minute: 5});
|
||||
else if (advanceMode == '15m') SimpleCalendar.api.changeDate({minute: 15});
|
||||
else if (advanceMode == '1h') SimpleCalendar.api.changeDate({hour: 1});
|
||||
else if (advanceMode == '6h') SimpleCalendar.api.changeDate({hour: 6});
|
||||
else if (advanceMode == '12h') SimpleCalendar.api.changeDate({hour: 12});
|
||||
else if (advanceMode == '1d') SimpleCalendar.api.changeDate({day: 1});
|
||||
else if (advanceMode == '7d') SimpleCalendar.api.changeDate({day: 7});
|
||||
else if (advanceMode == '1M') SimpleCalendar.api.changeDate({month: 1});
|
||||
else if (advanceMode == '1y') SimpleCalendar.api.changeDate({year: 1});
|
||||
}
|
||||
else if (onClick == 'recede') {
|
||||
const advanceMode = settings.aboutTimeAdvanceMode ? settings.aboutTimeAdvanceMode : 'dawn';
|
||||
let now = Gametime.DTNow();
|
||||
if (advanceMode == 'dawn') {
|
||||
let newDT = now.add({
|
||||
days: now.hours < 7 ? -1 : 0
|
||||
}).setAbsolute({
|
||||
hours: 7,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
const advanceMode = settings.simpleCalendarAdvanceMode ? settings.simpleCalendarAdvanceMode : 'dawn';
|
||||
let now = SimpleCalendar.api.currentDateTime();
|
||||
if (advanceMode == 'sunrise') {
|
||||
SimpleCalendar.api.changeDate({day: -1});
|
||||
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunrise);
|
||||
}
|
||||
else if (advanceMode == 'noon') {
|
||||
let newDT = now.add({
|
||||
days: now.hours < 12 ? -1 : 0
|
||||
}).setAbsolute({
|
||||
hours: 12,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
else if (advanceMode == 'midday') {
|
||||
SimpleCalendar.api.changeDate({day: -1});
|
||||
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midday);
|
||||
}
|
||||
else if (advanceMode == 'dusk') {
|
||||
let newDT = now.add({
|
||||
days: now.hours < 20 ? -1 : 0
|
||||
}).setAbsolute({
|
||||
hours: 20,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
else if (advanceMode == 'sunset') {
|
||||
SimpleCalendar.api.changeDate({day: -1});
|
||||
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunset);
|
||||
}
|
||||
else if (advanceMode == 'midnight') {
|
||||
let newDT = Gametime.DTNow().add({
|
||||
days: -1
|
||||
}).setAbsolute({
|
||||
hours: 0,
|
||||
minutes: 0,
|
||||
seconds: 0
|
||||
});
|
||||
Gametime.setAbsolute(newDT);
|
||||
SimpleCalendar.api.changeDate({day: -1});
|
||||
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midnight);
|
||||
}
|
||||
else if (advanceMode == '1s')
|
||||
game.Gametime.advanceClock(-1);
|
||||
else if (advanceMode == '30s')
|
||||
game.Gametime.advanceClock(-30);
|
||||
|
||||
else if (advanceMode == '1m')
|
||||
game.Gametime.advanceTime({ minutes: -1 });
|
||||
else if (advanceMode == '5m')
|
||||
game.Gametime.advanceTime({ minutes: -5 });
|
||||
else if (advanceMode == '15m')
|
||||
game.Gametime.advanceTime({ minutes: -15 });
|
||||
else if (advanceMode == '1h')
|
||||
game.Gametime.advanceTime({ hours: -1 });
|
||||
else if (advanceMode == '1s') SimpleCalendar.api.changeDate({seconds: -1});
|
||||
else if (advanceMode == '30s') SimpleCalendar.api.changeDate({seconds: -30});
|
||||
else if (advanceMode == '1m') SimpleCalendar.api.changeDate({minute: -1});
|
||||
else if (advanceMode == '5m') SimpleCalendar.api.changeDate({minute: -5});
|
||||
else if (advanceMode == '15m') SimpleCalendar.api.changeDate({minute: -15});
|
||||
else if (advanceMode == '1h') SimpleCalendar.api.changeDate({hour: -1});
|
||||
else if (advanceMode == '6h') SimpleCalendar.api.changeDate({hour: -6});
|
||||
else if (advanceMode == '12h') SimpleCalendar.api.changeDate({hour: -12});
|
||||
else if (advanceMode == '1d') SimpleCalendar.api.changeDate({day: -1});
|
||||
else if (advanceMode == '7d') SimpleCalendar.api.changeDate({day: -7});
|
||||
else if (advanceMode == '1M') SimpleCalendar.api.changeDate({month: -1});
|
||||
else if (advanceMode == '1y') SimpleCalendar.api.changeDate({year: -1});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -792,6 +708,7 @@ export class ExternalModules{
|
||||
}
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
}
|
||||
|
||||
@@ -999,10 +916,12 @@ export class ExternalModules{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateMonksActiveTiles(settings,context,device) {
|
||||
const id = settings.monksActiveTilesId;
|
||||
|
||||
if (id == undefined || id == '') return;
|
||||
let tile = canvas.background.placeables.find(t => t.id == id);
|
||||
let tile = canvas.tiles.placeables.find(t => t.id == id);
|
||||
|
||||
if (tile == undefined) return;
|
||||
const tileData = tile.data.flags?.['monks-active-tiles'];
|
||||
const tileData = tile.document.flags?.['monks-active-tiles'];
|
||||
if (tileData == undefined) return;
|
||||
|
||||
let ring = 1;
|
||||
@@ -1012,9 +931,10 @@ export class ExternalModules{
|
||||
ring = 2;
|
||||
ringColor = '#00ff00'
|
||||
}
|
||||
let src = tile.data.img;
|
||||
let src = tile.document.texture.src;
|
||||
|
||||
streamDeck.setTitle('',context);
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
}
|
||||
|
||||
@@ -1022,12 +942,13 @@ export class ExternalModules{
|
||||
const mode = settings.monksActiveTilesMode ? settings.monksActiveTilesMode : 'toggle';
|
||||
const id = settings.monksActiveTilesId;
|
||||
if (id == undefined || id == '') return;
|
||||
let tile = canvas.background.placeables.find(t => t.id == id);
|
||||
let tile = canvas.tiles.placeables.find(t => t.id == id);
|
||||
if (tile == undefined) return;
|
||||
const tileData = tile.data.flags?.['monks-active-tiles'];
|
||||
const tileData = tile.document.flags?.['monks-active-tiles'];
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export class MacroControl{
|
||||
let src = "";
|
||||
let macroId = undefined;
|
||||
let uses = undefined;
|
||||
let macroLabel = "";
|
||||
|
||||
if (mode == 'macroBoard') { //Macro board
|
||||
if ((getPermission('MACRO','MACROBOARD') == false )) {
|
||||
@@ -56,8 +57,14 @@ export class MacroControl{
|
||||
else { //Execute macro
|
||||
macroNumber += this.offset - 1;
|
||||
if (macroNumber < 0) macroNumber = 0;
|
||||
macroId = game.settings.get(moduleName,'macroSettings').macros[macroNumber];
|
||||
background = game.settings.get(moduleName,'macroSettings').color[macroNumber];
|
||||
const macroSettings = game.settings.get(moduleName,'macroSettings');
|
||||
macroId = macroSettings.macros[macroNumber];
|
||||
background = macroSettings.color[macroNumber];
|
||||
try {
|
||||
macroLabel = macroSettings.labels[macroNumber];
|
||||
}
|
||||
catch (err) {}
|
||||
if ((macroLabel == undefined || macroLabel == "") && game.macros.get(macroId)) macroLabel = game.macros.get(macroId).name;
|
||||
if (background == undefined) background = '#000000';
|
||||
ring = 0;
|
||||
}
|
||||
@@ -72,7 +79,7 @@ export class MacroControl{
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
if (mode == 'hotbar') macroId = compatibleCore('10.0') ? game.user.hotbar[macroNumber] : game.user.data.hotbar[macroNumber];
|
||||
if (mode == 'hotbar') macroId = game.user.hotbar[macroNumber];
|
||||
else {
|
||||
let macros;
|
||||
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined)
|
||||
@@ -88,7 +95,8 @@ export class MacroControl{
|
||||
let macro = game.macros._source.find(p => p._id == macroId);
|
||||
|
||||
if (macro != undefined) {
|
||||
if (displayName) name = macro.name;
|
||||
if (displayName && mode == 'macroBoard') name = macroLabel;
|
||||
else if (displayName) name = macro.name;
|
||||
if (displayIcon) src = macro.img;
|
||||
if (hotbarUses && displayUses) uses = await this.getUses(macro);
|
||||
}
|
||||
@@ -98,6 +106,7 @@ export class MacroControl{
|
||||
if (displayIcon) src = "modules/MaterialDeck/img/black.png";
|
||||
}
|
||||
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,uses:uses});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
@@ -114,8 +123,7 @@ export class MacroControl{
|
||||
if (device?.buttons == undefined) continue;
|
||||
for (let i=0; i<device.buttons.length; i++){
|
||||
const data = device.buttons[i];
|
||||
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
|
||||
|
||||
if (data == undefined || data.action != 'macro' || data.settings.macroMode != 'hotbar') continue;
|
||||
const context = data.context;
|
||||
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
|
||||
const displayName = data.settings.displayName ? data.settings.displayName : false;
|
||||
@@ -137,7 +145,7 @@ export class MacroControl{
|
||||
|
||||
let macroId;
|
||||
if (mode == 'hotbar'){
|
||||
macroId = game.user.data.hotbar[macroNumber];
|
||||
macroId = game.user.hotbar[macroNumber];
|
||||
}
|
||||
else {
|
||||
if (macroNumber > 9) macroNumber = 0;
|
||||
@@ -151,6 +159,7 @@ export class MacroControl{
|
||||
if (displayIcon) src += macro.img;
|
||||
if (hotbarUses && displayUses) uses = await this.getUses(macro);
|
||||
}
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,uses:uses});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
@@ -177,20 +186,36 @@ export class MacroControl{
|
||||
const args = settings.macroArgs ? settings.macroArgs : "";
|
||||
|
||||
let advancedMacrosEnabled = false;
|
||||
if (compatibleCore('11.0')) {
|
||||
advancedMacrosEnabled = true;
|
||||
}
|
||||
else {
|
||||
let advancedMacros = game.modules.get("advanced-macros");
|
||||
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
|
||||
}
|
||||
|
||||
if (args == "" || args == " ") advancedMacrosEnabled = false;
|
||||
|
||||
if (advancedMacrosEnabled == false) macro.execute({token:target});
|
||||
else {
|
||||
if (compatibleCore('11.0')) {
|
||||
let argument;
|
||||
try {
|
||||
argument = JSON.parse(args)
|
||||
macro.execute(argument);
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
else {
|
||||
let chatData = {
|
||||
user: game.user._id,
|
||||
speaker: ChatMessage.getSpeaker(),
|
||||
content: "/'" + macro.name + "' " + args
|
||||
content: "/amacro '" + macro.name + "' " + args
|
||||
};
|
||||
ChatMessage.create(chatData, {});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -208,7 +233,7 @@ export class MacroControl{
|
||||
|
||||
executeHotbar(macroNumber,mode,target){
|
||||
let macroId
|
||||
if (mode == 'hotbar') macroId = compatibleCore('10.0') ? game.user.hotbar[macroNumber] : game.user.data.hotbar[macroNumber];
|
||||
if (mode == 'hotbar') macroId = game.user.hotbar[macroNumber];
|
||||
else {
|
||||
let macros;
|
||||
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
|
||||
@@ -234,21 +259,37 @@ export class MacroControl{
|
||||
if (macro != undefined && macro != null) {
|
||||
const args = game.settings.get(moduleName,'macroSettings').args;
|
||||
let advancedMacrosEnabled = false;
|
||||
if (compatibleCore('11.0')) {
|
||||
advancedMacrosEnabled = true;
|
||||
}
|
||||
else {
|
||||
let advancedMacros = game.modules.get("advanced-macros");
|
||||
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
|
||||
}
|
||||
|
||||
if (args == undefined || args[macroNumber] == undefined || args[macroNumber] == "") advancedMacrosEnabled = false;
|
||||
|
||||
if (advancedMacrosEnabled == false) macro.execute();
|
||||
else {
|
||||
if (compatibleCore('11.0')) {
|
||||
let argument;
|
||||
try {
|
||||
argument = JSON.parse(args[macroNumber])
|
||||
macro.execute(argument);
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
else {
|
||||
let chatData = {
|
||||
user: game.user._id,
|
||||
speaker: ChatMessage.getSpeaker(),
|
||||
content: "/'" + macro.name + "' " + args
|
||||
content: "/amacro '" + macro.name + "' " + args[macroNumber]
|
||||
};
|
||||
ChatMessage.create(chatData, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { streamDeck, gamingSystem, getPermission } from "../../MaterialDeck.js";
|
||||
import { compatibleCore } from "../misc.js";
|
||||
import { } from "../misc.js";
|
||||
|
||||
export class OtherControls{
|
||||
constructor(){
|
||||
@@ -8,6 +8,7 @@ export class OtherControls{
|
||||
this.rollOption = 'dialog';
|
||||
this.controlsOffset = 0;
|
||||
this.toolsOffset = 0;
|
||||
this.attackMode = 'chat';
|
||||
}
|
||||
|
||||
setRollOption(option) {
|
||||
@@ -15,6 +16,11 @@ export class OtherControls{
|
||||
this.updateAll();
|
||||
}
|
||||
|
||||
setAttackMode(option) {
|
||||
this.attackMode = option;
|
||||
this.updateAll();
|
||||
}
|
||||
|
||||
async updateAll(options={}){
|
||||
if (this.active == false) return;
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
@@ -55,8 +61,12 @@ export class OtherControls{
|
||||
this.updateChatMessage(settings,context,device,options);
|
||||
else if (mode == 'rollOptions')
|
||||
this.updateRollOptions(settings,context,device,options);
|
||||
else if (mode == 'attackModes')
|
||||
this.updateAttackMode(settings,context,device,options);
|
||||
else if (mode == 'rollMode')
|
||||
this.updateRollMode(settings,context,device,options);
|
||||
else if (mode == 'globalVolumeControls')
|
||||
this.updateGlobalVolumeControls(settings, context, device, options);
|
||||
}
|
||||
|
||||
keyPress(settings,context,device){
|
||||
@@ -86,8 +96,12 @@ export class OtherControls{
|
||||
this.keyPressChatMessage(settings);
|
||||
else if (mode == 'rollOptions')
|
||||
this.keyPressRollOptions(settings);
|
||||
else if (mode == 'attackModes')
|
||||
this.keyPressAttackMode(settings);
|
||||
else if (mode == 'rollMode')
|
||||
this.keyPressRollMode(settings);
|
||||
else if (mode == 'globalVolumeControls')
|
||||
this.keyPressGlobalVolumeControls(settings);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -113,7 +127,12 @@ export class OtherControls{
|
||||
}
|
||||
else if (pauseFunction == 'toggle') //toggle
|
||||
src = 'modules/MaterialDeck/img/other/pause/playpause.png';
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor,overlay:true});
|
||||
let overlay = true;
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
src = settings.iconOverride;
|
||||
overlay = false;
|
||||
}
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor,overlay});
|
||||
streamDeck.setTitle('',context);
|
||||
}
|
||||
|
||||
@@ -163,8 +182,12 @@ export class OtherControls{
|
||||
url = "modules/MaterialDeck/img/move/zoomin.png";
|
||||
else if (dir == 'zoomOut')
|
||||
url = "modules/MaterialDeck/img/move/zoomout.png";
|
||||
|
||||
streamDeck.setIcon(context,device,url,{background:background,overlay:true});
|
||||
let overlay = true;
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
url = settings.iconOverride;
|
||||
overlay = false;
|
||||
}
|
||||
streamDeck.setIcon(context,device,url,{background:background,overlay});
|
||||
streamDeck.setTitle('',context);
|
||||
}
|
||||
|
||||
@@ -185,7 +208,7 @@ export class OtherControls{
|
||||
}
|
||||
else {
|
||||
let viewPosition = canvas.scene._viewPosition;
|
||||
const gridSize = compatibleCore('10.0') ? canvas.scene.grid.size : canvas.scene.data.grid;
|
||||
const gridSize = canvas.scene.grid.size;
|
||||
viewPosition.duration = 100;
|
||||
|
||||
if (dir == 'up') viewPosition.y -= gridSize;
|
||||
@@ -324,6 +347,7 @@ export class OtherControls{
|
||||
}
|
||||
}
|
||||
}
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
@@ -345,20 +369,8 @@ export class OtherControls{
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
if (compatibleCore('10.0')) {
|
||||
ui.controls.initialize({layer: selectedControl.layer});
|
||||
}
|
||||
else {
|
||||
ui.controls.activeControl = selectedControl.name;
|
||||
selectedControl.activeTool = selectedControl.activeTool;
|
||||
for (let layer of canvas.layers) {
|
||||
if (layer.options == undefined) continue;
|
||||
if (layer.options.name == selectedControl.layer) {
|
||||
layer.activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||
}
|
||||
}
|
||||
else if (control == 'dispTools'){ //displayed tools
|
||||
@@ -385,12 +397,8 @@ export class OtherControls{
|
||||
selectedTool.onClick();
|
||||
}
|
||||
else {
|
||||
if (compatibleCore('10.0')) {
|
||||
ui.controls.initialize({layer: selectedControl.layer, tool: selectedTool.name});
|
||||
}
|
||||
else {
|
||||
selectedControl.activeTool = selectedTool.name;
|
||||
}
|
||||
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -414,21 +422,8 @@ export class OtherControls{
|
||||
return;
|
||||
}
|
||||
if (tool == 'open'){ //open category
|
||||
if (compatibleCore('10.0')) {
|
||||
ui.controls.initialize({layer: selectedControl.layer});
|
||||
}
|
||||
else {
|
||||
ui.controls.activeControl = control;
|
||||
selectedControl.activeTool = selectedControl.activeTool;
|
||||
for (let layer of canvas.layers) {
|
||||
if (layer.options == undefined) continue;
|
||||
if (layer.options.name == selectedControl.layer) {
|
||||
layer.activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||
}
|
||||
else {
|
||||
const selectedTool = selectedControl.tools.find(t => t.name == tool);
|
||||
@@ -437,37 +432,21 @@ export class OtherControls{
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
if (compatibleCore('10.0')) {
|
||||
if (selectedTool.toggle) {
|
||||
ui.controls.initialize({layer: selectedControl.layer});
|
||||
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||
selectedTool.active = !selectedTool.active;
|
||||
selectedTool.onClick(selectedTool.active);
|
||||
}
|
||||
else if (selectedTool.button){
|
||||
ui.controls.initialize({layer: selectedControl.layer});
|
||||
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||
selectedTool.onClick();
|
||||
}
|
||||
else
|
||||
ui.controls.initialize({layer: selectedControl.layer, tool: selectedTool.name});
|
||||
}
|
||||
else {
|
||||
ui.controls.activeControl = control;
|
||||
for (let layer of canvas.layers) {
|
||||
if (layer.options == undefined) continue;
|
||||
if (layer.options.name == selectedControl.layer) {
|
||||
layer.activate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedTool.toggle) {
|
||||
selectedTool.active = !selectedTool.active;
|
||||
selectedTool.onClick(selectedTool.active);
|
||||
}
|
||||
else if (selectedTool.button){
|
||||
selectedTool.onClick();
|
||||
}
|
||||
else
|
||||
selectedControl.activeTool = tool;
|
||||
|
||||
ui.controls.initialize({layer: selectedControl.layer, tool: selectedTool.name});
|
||||
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -500,11 +479,16 @@ export class OtherControls{
|
||||
}
|
||||
else if (func == 'disp'){ //display darkness
|
||||
src = 'modules/MaterialDeck/img/other/darkness/darkness.png';
|
||||
const darkness = canvas.scene != null ? compatibleCore('10.0') ? Math.floor(canvas.scene.darkness*100)/100 : Math.floor(canvas.scene.data.darkness*100)/100 : '';
|
||||
const darkness = canvas.scene != null ? Math.floor(canvas.scene.darkness*100)/100 : '';
|
||||
txt += darkness;
|
||||
}
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,device,src,{background:background,overlay:true});
|
||||
let overlay = true;
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
src = settings.iconOverride;
|
||||
overlay = false;
|
||||
}
|
||||
streamDeck.setIcon(context,device,src,{background:background,overlay});
|
||||
}
|
||||
|
||||
keyPressDarkness(settings) {
|
||||
@@ -517,16 +501,16 @@ export class OtherControls{
|
||||
if (func == 'value') //value
|
||||
canvas.scene.update({darkness: value}, {animateDarkness});
|
||||
else if (func == 'incDec'){ //increase/decrease
|
||||
let darkness = compatibleCore('10.0') ? canvas.scene.darkness - value : canvas.scene.data.darkness - value;
|
||||
let darkness = canvas.scene.darkness - value;
|
||||
if (darkness > 1) darkness = 1;
|
||||
if (darkness < 0) darkness = 0;
|
||||
canvas.scene.update({darkness: darkness}, {animateDarkness});
|
||||
}
|
||||
else if (func == 'transitionDay') {
|
||||
canvas.scene.update({darkness: 0}, {animateDarkness: 10000})
|
||||
canvas.scene.update({darkness: 0}, {animateDarknes})
|
||||
}
|
||||
else if (func == 'transitionNight') {
|
||||
canvas.scene.update({darkness: 1}, {animateDarkness: 10000})
|
||||
canvas.scene.update({darkness: 1}, {animateDarknes})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,7 +528,9 @@ export class OtherControls{
|
||||
if (settings.displayDiceName) txt = 'Roll: ' + formula;
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,device,'',{background:background});
|
||||
let src = '';
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
}
|
||||
|
||||
keyPressRollDice(settings,context,device){
|
||||
@@ -599,7 +585,7 @@ export class OtherControls{
|
||||
if (table == undefined) return;
|
||||
|
||||
let txt = settings.displayRollName ? table.name : '';
|
||||
let src = settings.displayRollIcon ? (compatibleCore('10.0') ? table.img : table.data.img) : '';
|
||||
let src = settings.displayRollIcon ? table.img : '';
|
||||
|
||||
if (table == undefined) {
|
||||
src = '';
|
||||
@@ -613,6 +599,7 @@ export class OtherControls{
|
||||
}
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
}
|
||||
|
||||
@@ -642,7 +629,6 @@ export class OtherControls{
|
||||
|
||||
getSidebarName(nr){
|
||||
let name;
|
||||
if (compatibleCore('10.0')) {
|
||||
if (nr == 'chat') name = game.i18n.localize("DOCUMENT.ChatMessages");
|
||||
else if (nr == 'combat') name = game.i18n.localize("DOCUMENT.Combats");
|
||||
else if (nr == 'scenes') name = game.i18n.localize("DOCUMENT.Scenes");
|
||||
@@ -655,21 +641,6 @@ export class OtherControls{
|
||||
else if (nr == 'compendium') name = game.i18n.localize("SIDEBAR.TabCompendium");
|
||||
else if (nr == 'settings') name = game.i18n.localize("SIDEBAR.TabSettings");
|
||||
else if (nr == 'collapse') name = game.i18n.localize("SIDEBAR.CollapseToggle");
|
||||
}
|
||||
else {
|
||||
if (nr == 'chat') name = game.i18n.localize("SIDEBAR.TabChat");
|
||||
else if (nr == 'combat') name = game.i18n.localize("SIDEBAR.TabCombat");
|
||||
else if (nr == 'scenes') name = game.i18n.localize("SIDEBAR.TabScenes");
|
||||
else if (nr == 'actors') name = game.i18n.localize("SIDEBAR.TabActors");
|
||||
else if (nr == 'items') name = game.i18n.localize("SIDEBAR.TabItems");
|
||||
else if (nr == 'journal') name = game.i18n.localize("SIDEBAR.TabJournal");
|
||||
else if (nr == 'tables') name = game.i18n.localize("SIDEBAR.TabTables");
|
||||
else if (nr == 'cards') name = game.i18n.localize("SIDEBAR.TabCards");
|
||||
else if (nr == 'playlists') name = game.i18n.localize("SIDEBAR.TabPlaylists");
|
||||
else if (nr == 'compendium') name = game.i18n.localize("SIDEBAR.TabCompendium");
|
||||
else if (nr == 'settings') name = game.i18n.localize("SIDEBAR.TabSettings");
|
||||
else if (nr == 'collapse') name = game.i18n.localize("SIDEBAR.CollapseToggle");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -708,9 +679,10 @@ export class OtherControls{
|
||||
}
|
||||
else if (popOut == false) ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
|
||||
const name = settings.displaySidebarName ? this.getSidebarName(sidebarTab) : '';
|
||||
const icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
|
||||
let icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
|
||||
|
||||
streamDeck.setTitle(name,context);
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
@@ -745,7 +717,9 @@ export class OtherControls{
|
||||
const txt = settings.displayCompendiumName ? name : '';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
let src = '';
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressCompendiumBrowser(settings){
|
||||
@@ -785,7 +759,9 @@ export class OtherControls{
|
||||
const txt = settings.displayCompendiumName ? name : '';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
let src = '';
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressCompendium(settings){
|
||||
@@ -804,11 +780,21 @@ export class OtherControls{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateJournal(settings,context,device,options={}){
|
||||
const name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
const name = settings.journalName;
|
||||
const pageName = settings.journalPageName;
|
||||
let pageId;
|
||||
let journalMode = settings.journalMode ? settings.journalMode : 'openJournal';
|
||||
let txt = '';
|
||||
if (name == undefined) {
|
||||
streamDeck.setTitle('',context);
|
||||
return;
|
||||
}
|
||||
|
||||
const journal = game.journal.getName(name);
|
||||
if (journal == undefined) return;
|
||||
if (journal == undefined) {
|
||||
streamDeck.setTitle('',context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (getPermission('OTHER','JOURNAL') == false ) {
|
||||
streamDeck.noPermission(context,device);
|
||||
@@ -827,28 +813,77 @@ export class OtherControls{
|
||||
else
|
||||
if (document.getElementById("journalentry-sheet-"+journal.id) != null) rendered = true;
|
||||
|
||||
txt = settings.displayJournalName == 'journal' ? name : '';
|
||||
|
||||
if (journalMode == 'openPageNr') {
|
||||
pageId = journal.pages.contents[pageName]?.id
|
||||
}
|
||||
if (journalMode == 'openPageName') {
|
||||
pageId = journal.pages.getName(pageName)?.id;
|
||||
}
|
||||
if (pageId != undefined) {
|
||||
const page = journal.pages.get(pageId);
|
||||
if (settings.displayJournalName == 'page') txt = page.name;
|
||||
else if (settings.displayJournalName == 'journal+page') txt = name + ' - ' + page.name
|
||||
|
||||
if (rendered && page != undefined) {
|
||||
const currentPage = journal.pages.contents[journal.sheet.pageIndex]
|
||||
if (currentPage.id != pageId) rendered = false;
|
||||
}
|
||||
}
|
||||
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const ringColor = rendered ? ringOnColor : ringOffColor;
|
||||
const txt = settings.displayCompendiumName ? name : '';
|
||||
//const txt = settings.displayCompendiumName ? name : '';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
let src = '';
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressJournal(settings){
|
||||
const name = settings.compendiumName;
|
||||
async keyPressJournal(settings){
|
||||
const name = settings.journalName;
|
||||
const pageName = settings.journalPageName;
|
||||
let pageId;
|
||||
let journalMode = settings.journalMode ? settings.journalMode : 'openJournal';
|
||||
if (name == undefined) return;
|
||||
|
||||
const journal = game.journal.getName(name);
|
||||
if (journal == undefined) return;
|
||||
|
||||
if (getPermission('OTHER','JOURNAL') == false ) return;
|
||||
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) return;
|
||||
if (journal.sheet.rendered == false) {
|
||||
if (journalMode == 'openPageNr') pageId = journal.pages.contents[pageName]?.id
|
||||
else if (journalMode == 'openPageName') pageId = journal.pages.getName(pageName)?.id
|
||||
else {
|
||||
await journal.sheet.render(true);
|
||||
return;
|
||||
}
|
||||
const page = journal.pages.get(pageId);
|
||||
if (page == undefined) return;
|
||||
await journal.sheet.render(true);
|
||||
setTimeout(() => {
|
||||
journal.sheet.goToPage(pageId)
|
||||
},10)
|
||||
}
|
||||
else {
|
||||
if (journalMode == 'openPageNr') pageId = journal.pages.contents[pageName]?.id
|
||||
else if (journalMode == 'openPageName') pageId = journal.pages.getName(pageName)?.id
|
||||
else {
|
||||
await journal.sheet.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (journal.sheet.rendered == false) journal.sheet.render(true);
|
||||
else journal.sheet.close();
|
||||
const currentPage = journal.pages.contents[journal.sheet.pageIndex]
|
||||
if (currentPage.id == pageId) journal.sheet.close();
|
||||
else {
|
||||
let page = journal.pages.get(pageId)
|
||||
if (page != undefined) journal.sheet.goToPage(pageId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -860,7 +895,9 @@ export class OtherControls{
|
||||
}
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
streamDeck.setTitle("",context);
|
||||
streamDeck.setIcon(context,device,"",{background:background});
|
||||
let src = '';
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
}
|
||||
|
||||
keyPressChatMessage(settings){
|
||||
@@ -881,11 +918,16 @@ export class OtherControls{
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
||||
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'normal';
|
||||
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
||||
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'dialog';
|
||||
const ringColor = (rollOption == this.rollOption) ? ringOnColor : ringOffColor;
|
||||
streamDeck.setTitle("",context);
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay:true});
|
||||
let overlay = true;
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
iconSrc = settings.iconOverride;
|
||||
overlay = false;
|
||||
}
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay});
|
||||
}
|
||||
|
||||
keyPressRollOptions(settings){
|
||||
@@ -896,17 +938,49 @@ export class OtherControls{
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
updateAttackMode(settings,context,device,options={}){
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
||||
const attackMode = settings.attackMode ? settings.attackMode : 'chat';
|
||||
const ringColor = (attackMode == this.attackMode) ? ringOnColor : ringOffColor;
|
||||
streamDeck.setTitle("",context);
|
||||
let overlay = true;
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
iconSrc = settings.iconOverride;
|
||||
overlay = false;
|
||||
}
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay});
|
||||
}
|
||||
|
||||
keyPressAttackMode(settings){
|
||||
const attackMode = settings.attackMode ? settings.attackMode : 'chat';
|
||||
if (this.attackMode != attackMode) {
|
||||
this.setAttackMode(attackMode)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateRollMode(settings,context,device,options={}){
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
||||
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
||||
const rollMode = settings.rollMode ? settings.rollMode : 'roll';
|
||||
const ringColor = (rollMode == game.settings.get('core','rollMode')) ? ringOnColor : ringOffColor;
|
||||
streamDeck.setTitle("",context);
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay:true});
|
||||
let overlay = true;
|
||||
let src = '';
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
iconSrc = settings.iconOverride;
|
||||
overlay = false;
|
||||
}
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay});
|
||||
}
|
||||
|
||||
async keyPressRollMode(settings){
|
||||
@@ -914,4 +988,48 @@ export class OtherControls{
|
||||
await game.settings.set('core','rollMode',rollMode);
|
||||
this.updateAll();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
async updateGlobalVolumeControls(settings,context,device,options={}){
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
let iconSrc = "modules/MaterialDeck/img/transparant.png";
|
||||
const type = settings.globalVolumeType ? settings.globalVolumeType : 'playlists';
|
||||
let txt = "";
|
||||
|
||||
if (settings.displayGlobalVolumeValue) {
|
||||
if (type == 'playlists') txt += Math.round(AudioHelper.volumeToInput(await game.settings.get("core", "globalPlaylistVolume"))*100)/100;
|
||||
else if (type == 'ambient') txt += Math.round(AudioHelper.volumeToInput(await game.settings.get("core", "globalAmbientVolume"))*100)/100;
|
||||
else if (type == 'interface') txt += Math.round(AudioHelper.volumeToInput(await game.settings.get("core", "globalInterfaceVolume"))*100)/100;
|
||||
}
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
iconSrc = settings.iconOverride;
|
||||
}
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background});
|
||||
}
|
||||
|
||||
async keyPressGlobalVolumeControls(settings){
|
||||
const type = settings.globalVolumeType ? settings.globalVolumeType : 'playlists';
|
||||
const mode = settings.globalVolumeMode ? settings.globalVolumeMode : 'incDec';
|
||||
const value = settings.globalVolumeValue ? settings.globalVolumeValue : 0.1;
|
||||
let settingLabel = '';
|
||||
let newVolume = 0;
|
||||
if (type == 'playlists') settingLabel = "globalPlaylistVolume";
|
||||
else if (type == 'ambient') settingLabel = "globalAmbientVolume";
|
||||
else if (type == 'interface') settingLabel = "globalInterfaceVolume";
|
||||
|
||||
if (mode == 'incDec') newVolume = AudioHelper.volumeToInput(await game.settings.get("core", settingLabel)) + parseFloat(value);
|
||||
else if (mode == 'set') newVolume = value;
|
||||
|
||||
if (newVolume > 1) newVolume = 1;
|
||||
else if (newVolume < 0) newVolume = 0;
|
||||
|
||||
await game.settings.set("core", settingLabel, AudioHelper.inputToVolume(newVolume));
|
||||
document.getElementsByName(settingLabel)[0].value = newVolume;
|
||||
|
||||
this.updateAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,40 +27,53 @@ export class PlaylistControl{
|
||||
this.active = true;
|
||||
const mode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||
|
||||
if (mode == 'playlist'){
|
||||
if (mode == 'playlist' || mode == 'playlistName'){
|
||||
this.updatePlaylist(settings,context,device);
|
||||
}
|
||||
else if (mode == 'track'){
|
||||
else if (mode == 'track' || mode == 'trackName'){
|
||||
this.updateTrack(settings,context,device);
|
||||
}
|
||||
else {
|
||||
const src = mode == 'stopAll' ? 'modules/MaterialDeck/img/playlist/stop.png' : 'modules/MaterialDeck/img/playlist/pause.png';
|
||||
let src = mode == 'stopAll' ? 'modules/MaterialDeck/img/playlist/stop.png' : 'modules/MaterialDeck/img/playlist/pause.png';
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringColor = (game.playlists.playing.length > 0) ? '#00FF00' : '#000000';
|
||||
const ring = (game.playlists.playing.length > 0) ? 2 : 1;
|
||||
const txt = settings.displayPlaylistName ? this.getPlaylist(this.playlistOffset).name : '';
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,overlay:true});
|
||||
let overlay = true;
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||
src = settings.iconOverride;
|
||||
overlay = false;
|
||||
}
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,overlay});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
|
||||
updatePlaylist(settings,context,device){
|
||||
|
||||
let name = "";
|
||||
let ringColor = "#000000"
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||
let src = "modules/MaterialDeck/img/transparant.png";
|
||||
|
||||
//Play/Stop
|
||||
if (playlistType == 'playStop'){
|
||||
let playlist;
|
||||
if (playlistMode == 'playlist') {
|
||||
let playlistNr = parseInt(settings.playlistNr);
|
||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||
playlistNr--;
|
||||
playlistNr += this.playlistOffset;
|
||||
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
playlist = this.getPlaylist(playlistNr);
|
||||
}
|
||||
else {
|
||||
playlist = game.playlists.getName(settings.playlistNr);
|
||||
}
|
||||
|
||||
if (playlist != undefined){
|
||||
if (playlist.playing)
|
||||
@@ -88,6 +101,8 @@ export class PlaylistControl{
|
||||
const targetPlaylist = this.getPlaylist(number);
|
||||
if (targetPlaylist != undefined) name = targetPlaylist.name;
|
||||
}
|
||||
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
@@ -99,22 +114,33 @@ export class PlaylistControl{
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||
let src = "modules/MaterialDeck/img/transparant.png";
|
||||
|
||||
//Play/Stop
|
||||
if (playlistType == 'playStop'){
|
||||
if (playlistType == 'playStop' || playlistType == 'incDecVol' || playlistType == 'setVol'){
|
||||
let playlist;
|
||||
let trackNr;
|
||||
if (playlistMode == 'track') {
|
||||
let playlistNr = parseInt(settings.playlistNr);
|
||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||
playlistNr--;
|
||||
playlistNr += this.playlistOffset;
|
||||
let trackNr = parseInt(settings.trackNr);
|
||||
trackNr = parseInt(settings.trackNr);
|
||||
if (isNaN(trackNr) || trackNr < 1) trackNr = 1;
|
||||
trackNr--;
|
||||
trackNr += this.trackOffset;
|
||||
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
playlist = this.getPlaylist(playlistNr);
|
||||
}
|
||||
else {
|
||||
playlist = game.playlists.getName(settings.playlistNr);
|
||||
}
|
||||
|
||||
if (playlist != undefined){
|
||||
const track = playlist.sounds.contents[trackNr];
|
||||
let track;
|
||||
if (playlistMode == 'track') track = playlist.sounds.contents[trackNr];
|
||||
else track = playlist.sounds.getName(settings.trackNr);
|
||||
if (track != undefined){
|
||||
if (track.playing)
|
||||
ringColor = ringOnColor;
|
||||
@@ -122,6 +148,11 @@ export class PlaylistControl{
|
||||
ringColor = ringOffColor;
|
||||
if (settings.displayName)
|
||||
name = track.name;
|
||||
if (settings.displayTrackVolume) {
|
||||
if (settings.displayName) name += ' ';
|
||||
name += Math.round(AudioHelper.volumeToInput(track.volume)*100)/100
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,6 +165,7 @@ export class PlaylistControl{
|
||||
//Relative Offset
|
||||
else if (playlistType == 'relativeOffset') {
|
||||
}
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
@@ -214,8 +246,11 @@ export class PlaylistControl{
|
||||
this.pauseAll();
|
||||
}
|
||||
else {
|
||||
if (playlistType == 'playStop') {
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
let playlist;
|
||||
if (playlistMode == 'playlist' || playlistMode == 'track') playlist = this.getPlaylist(playlistNr);
|
||||
else playlist = game.playlists.getName(settings.playlistNr);
|
||||
|
||||
if (playlistType == 'playStop' && (playlistMode == 'playlist' || playlistMode == 'track')) {
|
||||
if (playlist != undefined){
|
||||
if (playlistMode == 'playlist')
|
||||
this.playPlaylist(playlist,playlistNr);
|
||||
@@ -227,11 +262,28 @@ export class PlaylistControl{
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (playlistType == 'playStop') {
|
||||
if (playlist != undefined) {
|
||||
if (playlistMode == 'playlistName' && playlist.playing)
|
||||
playlist.stopAll();
|
||||
else if (playlistMode == 'playlistName')
|
||||
playlist.playAll();
|
||||
else {
|
||||
const track = playlist.sounds.getName(settings.trackNr);
|
||||
if (track != undefined && track.playing){
|
||||
playlist.stopSound(track);
|
||||
}
|
||||
else if (track != undefined) {
|
||||
playlist.playSound(track);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (playlistType == 'playNext') {
|
||||
this.getPlaylist(playlistNr).playNext();
|
||||
playlist.playNext();
|
||||
}
|
||||
else if (playlistType == 'playPrev') {
|
||||
this.getPlaylist(playlistNr).playNext(null,{direction:-1});
|
||||
playlist.playNext(null,{direction:-1});
|
||||
}
|
||||
else if (playlistType == 'offset'){
|
||||
if (playlistMode == 'playlist') {
|
||||
@@ -261,6 +313,30 @@ export class PlaylistControl{
|
||||
}
|
||||
this.updateAll();
|
||||
}
|
||||
else if (playlistType == 'incDecVol' || playlistType == 'setVol') {
|
||||
|
||||
const value = settings.trackVolumeValue ? parseFloat(settings.trackVolumeValue) : 0.1;
|
||||
let playlist = playlistMode == 'track' ? this.getPlaylist(playlistNr) : game.playlists.getName(settings.playlistNr);
|
||||
if (playlist != undefined){
|
||||
if (playlistMode != 'track' && playlistMode != 'trackName') return;
|
||||
const track = playlistMode == 'track' ? playlist.sounds.contents[trackNr] : playlist.sounds.getName(settings.trackNr);
|
||||
if (track != undefined){
|
||||
let newVolume = playlistType == 'incDecVol' ? AudioHelper.volumeToInput(track.volume) + value : value;
|
||||
if (newVolume > 1) newVolume = 1;
|
||||
else if (newVolume < 0) newVolume = 0;
|
||||
track.updateSource({volume:AudioHelper.inputToVolume(newVolume)})
|
||||
track.sound?.fade(track.effectiveVolume, {duration: PlaylistSound.VOLUME_DEBOUNCE_MS});
|
||||
if ( track.isOwner ) track.debounceVolume(AudioHelper.inputToVolume(newVolume));
|
||||
for (let elmnt of document.getElementById('currently-playing').getElementsByClassName('sound')) {
|
||||
if (elmnt.getAttribute('data-sound-id') == track.id) {
|
||||
elmnt.getElementsByClassName('sound-volume')[0].value = newVolume;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.updateAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -280,14 +356,14 @@ export class PlaylistControl{
|
||||
return;
|
||||
}
|
||||
let mode = game.settings.get(moduleName,'playlists').playlistMode[playlistNr];
|
||||
const originalPlayMode = playlist.mode;
|
||||
await playlist.update({mode: CONST.PLAYLIST_MODES.SEQUENTIAL});
|
||||
//const originalPlayMode = playlist.mode;
|
||||
//await playlist.update({mode: CONST.PLAYLIST_MODES.SEQUENTIAL});
|
||||
if (mode == 0) {
|
||||
mode = game.settings.get(moduleName,'playlists').playMode;
|
||||
if (mode == 2) await this.stopAll(true);
|
||||
}
|
||||
playlist.playAll();
|
||||
await playlist.update({mode: originalPlayMode});
|
||||
//await playlist.update({mode: originalPlayMode});
|
||||
}
|
||||
|
||||
async playTrack(track,playlist,playlistNr){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { streamDeck, getPermission } from "../../MaterialDeck.js";
|
||||
import { compatibleCore } from "../misc.js";
|
||||
import { } from "../misc.js";
|
||||
|
||||
export class SceneControl{
|
||||
constructor(){
|
||||
@@ -27,6 +27,7 @@ export class SceneControl{
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const ringActiveColor = settings.activeRing ? settings.activeRing : '#FFFF00'
|
||||
let ringColor = "#000000";
|
||||
let ring = 2;
|
||||
|
||||
@@ -46,7 +47,7 @@ export class SceneControl{
|
||||
if (scene != undefined){
|
||||
ringColor = scene.isView ? ringOnColor : ringOffColor;
|
||||
if (settings.displaySceneName) name = scene.name;
|
||||
if (settings.displaySceneIcon) src = compatibleCore('10.0') ? scene.background.src : scene.img;
|
||||
if (settings.displaySceneIcon) src = scene.background.src;
|
||||
if (scene.active) name += "\n(Active)";
|
||||
}
|
||||
}
|
||||
@@ -60,34 +61,24 @@ export class SceneControl{
|
||||
nr--;
|
||||
|
||||
let sceneList = [];
|
||||
if (compatibleCore('10.0')) {
|
||||
sceneList = ui.scenes.documents;
|
||||
}
|
||||
else {
|
||||
for (let i=0; i<ui.scenes.tree.children.length; i++){
|
||||
const scenesInFolder = ui.scenes.tree.children[i].contents;
|
||||
for (let j=0; j<scenesInFolder.length; j++)
|
||||
sceneList.push(scenesInFolder[j])
|
||||
}
|
||||
for (let i=0; i<ui.scenes.tree.content.length; i++)
|
||||
sceneList.push(ui.scenes.tree.content[i])
|
||||
}
|
||||
|
||||
|
||||
const scene = sceneList[nr+this.sceneOffset];
|
||||
|
||||
if (scene != undefined){
|
||||
if (scene.isView)
|
||||
if (scene.active)
|
||||
ringColor = ringActiveColor;
|
||||
else if (scene.isView)
|
||||
ringColor = ringOnColor;
|
||||
else if ((compatibleCore('10.0') && scene.navigation && scene.permission.default == 0) || (!compatibleCore('10.0') && scene.data.navigation && scene.data.permission.default == 0))
|
||||
else if (scene.navigation && scene.permission.default == 0)
|
||||
ringColor = '#000791';
|
||||
else if ((compatibleCore('10.0') && scene.navigation) || (!compatibleCore('10.0') && scene.data.navigation))
|
||||
else if (scene.navigation)
|
||||
ringColor = '#2d2d2d';
|
||||
else
|
||||
ringColor = ringOffColor;
|
||||
|
||||
if (settings.displaySceneName) name = scene.name;
|
||||
if (settings.displaySceneIcon) src = compatibleCore('10.0') ? scene.background.src : scene.img;
|
||||
if (settings.displaySceneIcon) src = scene.background.src;
|
||||
if (scene.active) name += "\n(Active)";
|
||||
}
|
||||
}
|
||||
@@ -100,9 +91,12 @@ export class SceneControl{
|
||||
let scene = game.scenes.getName(settings.sceneName);
|
||||
|
||||
if (scene != undefined){
|
||||
ringColor = scene.isView ? ringOnColor : ringOffColor;
|
||||
if (scene.active)
|
||||
ringColor = ringActiveColor;
|
||||
else if (scene.isView)
|
||||
ringColor = ringOnColor;
|
||||
if (settings.displaySceneName) name = scene.name;
|
||||
if (settings.displaySceneIcon) src = compatibleCore('10.0') ? scene.background.src : scene.img;
|
||||
if (settings.displaySceneIcon) src = scene.background.src;
|
||||
if (scene.active) name += "\n(Active)";
|
||||
}
|
||||
}
|
||||
@@ -114,7 +108,7 @@ export class SceneControl{
|
||||
const scene = game.scenes.active;
|
||||
if (scene == undefined) return;
|
||||
if (settings.displaySceneName) name = scene.name;
|
||||
if (settings.displaySceneIcon) src = compatibleCore('10.0') ? scene.background.src : scene.img;
|
||||
if (settings.displaySceneIcon) src = scene.background.src;
|
||||
ring = 0;
|
||||
}
|
||||
else if (func == 'offset'){
|
||||
@@ -124,6 +118,7 @@ export class SceneControl{
|
||||
src = "modules/MaterialDeck/img/transparant.png";
|
||||
}
|
||||
streamDeck.setTitle(name,context);
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
}
|
||||
|
||||
@@ -159,18 +154,7 @@ export class SceneControl{
|
||||
nr--;
|
||||
|
||||
let sceneList = [];
|
||||
if (compatibleCore('10.0')) {
|
||||
sceneList = ui.scenes.documents;
|
||||
}
|
||||
else {
|
||||
for (let i=0; i<ui.scenes.tree.children.length; i++){
|
||||
const scenesInFolder = ui.scenes.tree.children[i].contents;
|
||||
for (let j=0; j<scenesInFolder.length; j++)
|
||||
sceneList.push(scenesInFolder[j])
|
||||
}
|
||||
for (let i=0; i<ui.scenes.tree.content.length; i++)
|
||||
sceneList.push(ui.scenes.tree.content[i])
|
||||
}
|
||||
|
||||
const scene = sceneList[nr+this.sceneOffset];
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ export class SoundboardControl{
|
||||
if (settings.displayIcon && soundboardSettings.img != undefined) src = soundboardSettings.img[soundNr];
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
else if (mode == 'offset') { //Offset
|
||||
@@ -57,7 +58,9 @@ export class SoundboardControl{
|
||||
else ringColor = ringOffColor;
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
let src = '';
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
else if (mode == 'stopAll') { //Stop all sounds
|
||||
let src = 'modules/MaterialDeck/img/playlist/stop.png';
|
||||
@@ -66,6 +69,7 @@ export class SoundboardControl{
|
||||
for (let i=0; i<this.activeSounds.length; i++)
|
||||
if (this.activeSounds[i])
|
||||
soundPlaying = true;
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||
if (soundPlaying)
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:'#00FF00',overlay:true});
|
||||
else
|
||||
@@ -184,4 +188,14 @@ export class SoundboardControl{
|
||||
}
|
||||
this.updateAll();
|
||||
}
|
||||
|
||||
ambientVolumeChanged(ambientVolume) {
|
||||
for (let i = 0; i<this.activeSounds.length; i++) {
|
||||
let sound = this.activeSounds[i];
|
||||
if (sound == undefined) continue;
|
||||
let volume = game.settings.get(moduleName,'soundboardSettings').volume[i]/100;
|
||||
volume = AudioHelper.inputToVolume(volume) * ambientVolume;
|
||||
sound.gain.value = volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { streamDeck, macroControl, otherControls, tokenHelper, getPermission } from "../../MaterialDeck.js";
|
||||
import { compatibleCore } from "../misc.js";
|
||||
import { } from "../misc.js";
|
||||
|
||||
export class TokenControl{
|
||||
constructor(){
|
||||
@@ -20,21 +20,20 @@ export class TokenControl{
|
||||
}
|
||||
}
|
||||
|
||||
async pushData(tokenId,settings,context,device,ring=0,ringColor='#000000'){
|
||||
async pushData(tokenId,settings,context,device,ring=0,ringColor='#000000',forceIcon,hideName=false){
|
||||
const name = settings.displayName ? settings.displayName : false;
|
||||
const icon = settings.icon ? settings.icon : 'none';
|
||||
const background = settings.background ? settings.background : "#000000";
|
||||
let stats = settings.stats ? settings.stats : 'none';
|
||||
const selection = settings.selection ? settings.selection : 'selected';
|
||||
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
||||
const prependTitle = settings.prependTitle ? settings.prependTitle : '';
|
||||
const mode = settings.tokenMode ? settings.tokenMode : 'token';
|
||||
const background = (mode == 'inventory') ? (settings.inventoryBackground ? settings.inventoryBackground : "#000000") : (settings.background ? settings.background : "#000000");
|
||||
|
||||
let validToken = false;
|
||||
let token;
|
||||
if (settings.combatTrackerMode) token = tokenHelper.getTokenFromTokenId(tokenId);
|
||||
else token = tokenHelper.getToken(selection,tokenIdentifier);
|
||||
|
||||
if (token != undefined) validToken = true;
|
||||
let txt = "";
|
||||
let iconSrc = "";
|
||||
@@ -78,21 +77,7 @@ export class TokenControl{
|
||||
|
||||
if (stats == 'custom'){
|
||||
const custom = settings.custom ? settings.custom : '';
|
||||
let split = custom.split('[');
|
||||
for (let i=0; i<split.length; i++) split[i] = split[i].split(']');
|
||||
for (let i=0; i<split.length; i++)
|
||||
for (let j=0; j<split[i].length; j++){
|
||||
if (split[i][j][0] != '@') txt += split[i][j];
|
||||
else {
|
||||
const dataPath = split[i][j].split('@')[1].split('.');
|
||||
let data = token;
|
||||
|
||||
for (let i=0; i<dataPath.length; i++)
|
||||
data = data?.[dataPath[i]];
|
||||
if (data == undefined) txt += '[undef]';
|
||||
else txt += data;
|
||||
}
|
||||
}
|
||||
txt += this.decodeCustomStat(custom, token);
|
||||
}
|
||||
|
||||
if (stats == 'HP' || stats == 'Wounds') {
|
||||
@@ -236,7 +221,7 @@ export class TokenControl{
|
||||
return;
|
||||
}
|
||||
ring = 1;
|
||||
if (compatibleCore('10.0') ? token.document.hidden : token.data.hidden){
|
||||
if (token.document.hidden){
|
||||
ring = 2;
|
||||
ringColor = "#FF7B00";
|
||||
}
|
||||
@@ -392,7 +377,7 @@ export class TokenControl{
|
||||
if (item != undefined && displayUses) uses = tokenHelper.getFeatureUses(item);
|
||||
}
|
||||
else if (mode == 'spellbook') {
|
||||
items = tokenHelper.getSpells(token,settings.spellType);
|
||||
items = tokenHelper.getSpells(token,settings.spellType,settings.spellMode);
|
||||
items = this.sortItems(items);
|
||||
if (selectionMode == 'order') item = items[itemNr];
|
||||
else if (selectionMode == 'name') item = items.filter(i => i.name == settings.itemName)[0];
|
||||
@@ -533,14 +518,19 @@ export class TokenControl{
|
||||
}
|
||||
}
|
||||
|
||||
if (forceIcon) {
|
||||
iconSrc = forceIcon;
|
||||
txt = "";
|
||||
}
|
||||
else if (hideName) txt = "";
|
||||
if (settings.iconOverride != '' && settings.iconOverride != undefined) iconSrc = settings.iconOverride;
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:ring,ringColor:ringColor,overlay:overlay,uses:uses,hp:hp});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
sortItems(items) {
|
||||
let sorted = Object.values(items);
|
||||
if (compatibleCore('10.0')) sorted.sort((a,b) => a.sort - b.sort);
|
||||
else sorted.sort((a,b) => a.data.sort - b.data.sort);
|
||||
sorted.sort((a,b) => a.sort - b.sort);
|
||||
return sorted;
|
||||
}
|
||||
|
||||
@@ -640,24 +630,15 @@ export class TokenControl{
|
||||
|
||||
//Vision basic config
|
||||
if (settings.visionEnabled && settings.visionEnabled != 'noChange') {
|
||||
if (compatibleCore('10.0')) {
|
||||
if (settings.visionEnabled == 'toggle')
|
||||
sight.enabled = !token.document.sight.enabled;
|
||||
else
|
||||
sight.enabled = settings.visionEnabled == 'enable';
|
||||
}
|
||||
else {
|
||||
if (settings.visionEnabled == 'toggle')
|
||||
sight.vision = !token.data.vision;
|
||||
else
|
||||
sight.vision = settings.visionEnabled == 'enable';
|
||||
}
|
||||
}
|
||||
if (settings.visionRange && isNaN(settings.visionRange) == false) sight.range = parseInt(settings.visionRange);
|
||||
if (settings.visionDimRange && isNaN(settings.visionDimRange) == false) sight.dimSight = parseInt(settings.visionDimRange);
|
||||
if (settings.visionBrightRange && isNaN(settings.visionBrightRange) == false) sight.brightSight = parseInt(settings.visionBrightRange);
|
||||
if (compatibleCore('10.0') && settings.visionAngle && isNaN(settings.visionAngle) == false) sight.angle = parseInt(settings.visionAngle);
|
||||
else if (!compatibleCore('10.0') && settings.visionAngle && isNaN(settings.visionAngle) == false) sight.sightAngle = parseInt(settings.visionAngle);
|
||||
if (settings.visionAngle && isNaN(settings.visionAngle) == false) sight.angle = parseInt(settings.visionAngle);
|
||||
if (settings.visionMode && settings.visionMode != 'noChange') sight.visionMode = settings.visionMode;
|
||||
|
||||
//Vision detection modes
|
||||
@@ -691,7 +672,7 @@ export class TokenControl{
|
||||
if (settings.lightAnimationSpeedEnable) light.animation.speed = settings.lightAnimationSpeed ? parseFloat(settings.lightAnimationSpeed) : 5;
|
||||
if (settings.lightAnimationReverseDirection && settings.lightAnimationReverseDirection != 'noChange') {
|
||||
if (settings.lightAnimationReverseDirection == 'toggle')
|
||||
light.animation.reverse = compatibleCore('10.0') ? !token.document.light.animation.reverse : !token.data.light.animation.reverse;
|
||||
light.animation.reverse = !token.document.light.animation.reverse;
|
||||
else if (settings.lightAnimationReverseDirection == 'enable')
|
||||
light.animation.reverse = true;
|
||||
else if (settings.lightAnimationReverseDirection == 'disable')
|
||||
@@ -716,16 +697,10 @@ export class TokenControl{
|
||||
if (settings.lightShadowsEnable) light.shadows = settings.lightShadows ? parseFloat(settings.lightShadows) : 0;
|
||||
|
||||
let data;
|
||||
if (compatibleCore('10.0')) {
|
||||
data = {
|
||||
sight,
|
||||
light
|
||||
}
|
||||
}
|
||||
else {
|
||||
data = sight;
|
||||
data.light = light;
|
||||
}
|
||||
token.document.update(data);
|
||||
}
|
||||
else if (onClick == 'initiative'){
|
||||
@@ -927,7 +902,8 @@ export class TokenControl{
|
||||
}
|
||||
else {
|
||||
const allItems = token.actor.items;
|
||||
const itemNr = settings.itemNr ? settings.itemNr - 1 : 0;
|
||||
let itemNr = settings.itemNr ? settings.itemNr - 1 : 0;
|
||||
itemNr += this.itemOffset;
|
||||
const selectionMode = settings.inventorySelection ? settings.inventorySelection : 'order';
|
||||
let items = allItems;
|
||||
if (mode == 'inventory') {
|
||||
@@ -945,7 +921,7 @@ export class TokenControl{
|
||||
else if (selectionMode == 'name') item = items.filter(i => i.name == settings.itemName)[0];
|
||||
else if (selectionMode == 'id') item = items.filter(i => i.id == settings.itemName)[0];
|
||||
if (item != undefined) {
|
||||
tokenHelper.rollItem(item, settings, otherControls.rollOption);
|
||||
tokenHelper.rollItem(item, settings, otherControls.rollOption, otherControls.attackMode);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -985,4 +961,64 @@ export class TokenControl{
|
||||
pf2eCondition(condition){
|
||||
return "systems/pf2e/icons/conditions-2/" + condition + ".png";
|
||||
}
|
||||
|
||||
decodeCustomStat(custom, token) {
|
||||
let txt = "";
|
||||
|
||||
let split = custom.split(/\[|\]/g)
|
||||
|
||||
for (let segment of split) {
|
||||
if (segment.startsWith('if')) {
|
||||
let ifA;
|
||||
let ifMode;
|
||||
let ifB;
|
||||
let ifThen;
|
||||
let ifElse;
|
||||
|
||||
let spaceSplit = segment.split(' ');
|
||||
let count = 0;
|
||||
for (let segment of spaceSplit) {
|
||||
if (segment.startsWith('if')) ifA = this.decodeIfSegment(segment, token);
|
||||
else if (segment.startsWith('then')) ifThen = this.decodeIfSegment(segment, token);
|
||||
else if (segment.startsWith('else')) ifElse = this.decodeIfSegment(segment, token);
|
||||
else {
|
||||
segment = segment.split(')')[0];
|
||||
if (count == 1) ifMode = segment;
|
||||
else if (count == 2) ifB = segment.startsWith('@') ? this.getCustomDataPath(segment, token) : segment;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
if (ifMode == '>') txt += ifA > ifB ? ifThen : ifElse;
|
||||
else if (ifMode == '>=') txt += ifA >= ifB ? ifThen : ifElse;
|
||||
else if (ifMode == '<') txt += ifA < ifB ? ifThen : ifElse;
|
||||
else if (ifMode == '<=') txt += ifA <= ifB ? ifThen : ifElse;
|
||||
else if (ifMode == '==') txt += ifA == ifB ? ifThen : ifElse;
|
||||
}
|
||||
else if (segment.startsWith('@')) txt += this.getCustomDataPath(segment, token);
|
||||
else txt += segment;
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
decodeIfSegment(segment, token) {
|
||||
let split = segment.split(/\(|\)/g);
|
||||
if (split[1].startsWith('@')) return this.getCustomDataPath(split[1], token);
|
||||
return split[1];
|
||||
}
|
||||
|
||||
getCustomDataPath(path, token) {
|
||||
const dataPath = path.split('@')[1].split('.');
|
||||
let data;
|
||||
if (dataPath[0] == 'actor') data = token.actor;
|
||||
else if (dataPath[0] == 'token') data = token;
|
||||
|
||||
for (let i=1; i<dataPath.length; i++) {
|
||||
data = data?.[dataPath[i]];
|
||||
}
|
||||
|
||||
if (data == undefined) return '[undef]';
|
||||
return data;
|
||||
}
|
||||
}
|
||||
278
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(".");
|
||||
@@ -27,8 +27,8 @@ export function compatibleCore(compatibleVersion){
|
||||
export function compatibleSystem(compatibleVersion){
|
||||
const split = compatibleVersion.split(".");
|
||||
if (split.length == 2) compatibleVersion = `0.${compatibleVersion}`;
|
||||
let coreVersion = game.system.data.version;
|
||||
return compareVersions(compatibleVersion, coreVersion);
|
||||
let coreVersion = game.system.version;
|
||||
return compareVersions(coreVersion, compatibleVersion);
|
||||
}
|
||||
|
||||
export class playlistConfigForm extends FormApplication {
|
||||
@@ -190,29 +190,38 @@ export class macroConfigForm extends FormApplication {
|
||||
return;
|
||||
}
|
||||
//Get the settings
|
||||
var selectedMacros = game.settings.get(moduleName,'macroSettings').macros;
|
||||
var color = game.settings.get(moduleName,'macroSettings').color;
|
||||
var args = game.settings.get(moduleName,'macroSettings').args;
|
||||
const settings = game.settings.get(moduleName,'macroSettings');
|
||||
var selectedMacros = settings.macros;
|
||||
var color = settings.color;
|
||||
var args = settings.args;
|
||||
var labels = settings.labels;
|
||||
|
||||
//Check if the settings are defined
|
||||
if (selectedMacros == undefined) selectedMacros = [];
|
||||
if (color == undefined) color = [];
|
||||
if (args == undefined) args = [];
|
||||
if (labels == undefined) labels = [];
|
||||
|
||||
//Check if the Furnace is installed and enabled
|
||||
let height = 95;
|
||||
let advancedMacrosEnabled = false;
|
||||
if (compatibleCore('11.0')) {
|
||||
advancedMacrosEnabled = true;
|
||||
}
|
||||
else {
|
||||
let advancedMacros = game.modules.get("advanced-macros");
|
||||
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
|
||||
if (advancedMacrosEnabled) {
|
||||
advancedMacrosEnabled = true;
|
||||
height += 50;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let iteration = this.page*32;
|
||||
let macroData = [];
|
||||
for (let j=0; j<4; j++){
|
||||
let macroThis = [];
|
||||
let macroRowConfig = [];
|
||||
|
||||
for (let i=0; i<8; i++){
|
||||
let colorData = color[iteration];
|
||||
@@ -227,18 +236,20 @@ export class macroConfigForm extends FormApplication {
|
||||
}
|
||||
else
|
||||
colorData = '#000000';
|
||||
|
||||
const label = labels[iteration] == undefined || labels[iteration] == "" ? game.macros.get(selectedMacros[iteration])?.name : labels[iteration];
|
||||
let dataThis = {
|
||||
iteration: iteration+1,
|
||||
macro: selectedMacros[iteration],
|
||||
color: colorData,
|
||||
args: args[iteration]
|
||||
args: args[iteration],
|
||||
label
|
||||
}
|
||||
macroThis.push(dataThis);
|
||||
macroRowConfig.push(dataThis);
|
||||
iteration++;
|
||||
}
|
||||
macroData.push({dataThis: macroThis});
|
||||
macroData.push({macroRowConfig});
|
||||
}
|
||||
|
||||
return {
|
||||
height: height,
|
||||
macros: game.macros,
|
||||
@@ -271,6 +282,7 @@ export class macroConfigForm extends FormApplication {
|
||||
const macro = html.find("select[name='macros']");
|
||||
const args = html.find("input[name='args']");
|
||||
const color = html.find("input[name='colorPicker']");
|
||||
const label = html.find("input[name='macroLabel']")
|
||||
|
||||
importBtn.on('click', async(event) => {
|
||||
let importDialog = new importConfigForm();
|
||||
@@ -360,13 +372,18 @@ export class macroConfigForm extends FormApplication {
|
||||
macro.on("change", event => {
|
||||
let id = event.target.id.replace('materialDeck_macroConfig_macros','');
|
||||
let settings = game.settings.get(moduleName,'macroSettings');
|
||||
settings.macros[id-1]=event.target.value;
|
||||
settings.macros[id-1] = event.target.value;
|
||||
if (settings.labels == undefined) settings.labels = [];
|
||||
const macroLabel = event.target.value == '' ? '' : game.macros.get(event.target.value).name;
|
||||
settings.labels[id-1] = macroLabel;
|
||||
document.getElementById(`materialDeck_macroConfig_label${id}`).value = macroLabel;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
|
||||
args.on("change", event => {
|
||||
let id = event.target.id.replace('materialDeck_macroConfig_args','');
|
||||
let settings = game.settings.get(moduleName,'macroSettings');
|
||||
if (settings.args == undefined) settings.args = [];
|
||||
settings.args[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
@@ -377,6 +394,14 @@ export class macroConfigForm extends FormApplication {
|
||||
settings.color[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
|
||||
label.on("change", event => {
|
||||
let id = event.target.id.replace('materialDeck_macroConfig_label','');
|
||||
let settings = game.settings.get(moduleName,'macroSettings');
|
||||
if (settings.labels == undefined) settings.labels = [];
|
||||
settings.labels[id-1] = event.target.value;
|
||||
this.updateSettings(settings);
|
||||
})
|
||||
}
|
||||
|
||||
async updateSettings(settings){
|
||||
@@ -1016,19 +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.releaseAssets = [];
|
||||
this.profiles = [];
|
||||
|
||||
let parent = this;
|
||||
setTimeout(function(){
|
||||
parent.checkForUpdate('SD');
|
||||
parent.checkForUpdate('MS');
|
||||
parent.getReleaseData();
|
||||
},100)
|
||||
this.releases = {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1047,31 +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,
|
||||
profiles: this.profiles,
|
||||
releases: this.releases,
|
||||
versions,
|
||||
sdDlDisable: this.releases.plugin == undefined,
|
||||
msDlDisable: this.releases.materialCompanion == undefined,
|
||||
profileDlDisable: dlDisabled
|
||||
}
|
||||
}
|
||||
@@ -1089,36 +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');
|
||||
this.getReleaseData();
|
||||
let name = event.currentTarget.id.replace('materialDeck_dlUtil_dlProfile-','');
|
||||
this.downloadURI(this.releases.plugin.profiles.find(p => p.name.includes(name)).url);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1150,11 +1138,66 @@ export class downloadUtility extends FormApplication {
|
||||
}
|
||||
|
||||
checkForUpdate(reqType) {
|
||||
let parent = this;
|
||||
let url;
|
||||
if (reqType == 'SD') url = 'https://raw.githubusercontent.com/CDeenen/MaterialDeck_SD/master/Plugin/com.cdeenen.materialdeck.sdPlugin/manifest.json';
|
||||
else if (reqType == 'MS') url = 'https://raw.githubusercontent.com/CDeenen/MaterialServer/master/package.json';
|
||||
const elementId = reqType == 'SD' ? 'materialDeck_dlUtil_masterSdVersion' : 'materialDeck_dlUtil_masterMsVersion';
|
||||
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';
|
||||
url = 'https://raw.githubusercontent.com/CDeenen/MaterialDeck_SD/master/Plugin/com.cdeenen.materialdeck.sdPlugin/manifest.json';
|
||||
}
|
||||
else if (reqType == 'MS') {
|
||||
elementId = 'materialDeck_dlUtil_masterMsVersion';
|
||||
url = 'https://raw.githubusercontent.com/CDeenen/MaterialServer/master/package.json';
|
||||
}
|
||||
else if (reqType == 'Module') {
|
||||
elementId = 'materialDeck_dlUtil_masterModuleVersion';
|
||||
url = game.modules.get('MaterialDeck').manifest;
|
||||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', url, true);
|
||||
@@ -1165,6 +1208,7 @@ export class downloadUtility extends FormApplication {
|
||||
if (type.indexOf("text") !== 1) {
|
||||
if (reqType == 'SD') parent.masterSDversion = JSON.parse(request.responseText).Version;
|
||||
else if (reqType == 'MS') parent.masterMSversion = JSON.parse(request.responseText).version;
|
||||
else if (reqType == 'Module') parent.masterModuleVersion = JSON.parse(request.responseText).version;
|
||||
parent.render(true);
|
||||
return;
|
||||
}
|
||||
@@ -1173,94 +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);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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];
|
||||
@@ -72,6 +72,7 @@ export const registerSettings = async function() {
|
||||
//Enabled the module
|
||||
game.settings.register(moduleName,'Enable', {
|
||||
name: "MaterialDeck.Sett.Enable",
|
||||
hint: "MaterialDeck.Sett.EnableHint",
|
||||
scope: "client",
|
||||
config: true,
|
||||
default: false,
|
||||
@@ -79,6 +80,14 @@ export const registerSettings = async function() {
|
||||
onChange: x => window.location.reload()
|
||||
});
|
||||
|
||||
game.settings.register(moduleName,'EnableDialogShown', {
|
||||
name: "MaterialDeck_EnableDialogShown",
|
||||
scope: "client",
|
||||
config: false,
|
||||
default: false,
|
||||
type: Boolean
|
||||
});
|
||||
|
||||
/**
|
||||
* System override
|
||||
*/
|
||||
@@ -164,20 +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
|
||||
});
|
||||
|
||||
game.settings.registerMenu(moduleName, 'permissionConfig',{
|
||||
name: "MaterialDeck.Sett.Permission",
|
||||
label: "MaterialDeck.Sett.Permission",
|
||||
@@ -234,7 +229,8 @@ export const registerSettings = async function() {
|
||||
name: "macroArgs",
|
||||
scope: "world",
|
||||
type: Object,
|
||||
config: false
|
||||
config: false,
|
||||
default: {}
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,12 +47,16 @@ export class StreamDeck{
|
||||
device: device.id,
|
||||
name: device.name,
|
||||
type: device.type,
|
||||
size: size,
|
||||
size: deckSize,
|
||||
buttons: buttons
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeDevice(iteration) {
|
||||
this.buttonContext[iteration] = undefined;
|
||||
}
|
||||
|
||||
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings, name, type){
|
||||
if (device == undefined) return;
|
||||
if (this.buttonContext[iteration] == undefined) {
|
||||
@@ -131,6 +135,7 @@ export class StreamDeck{
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
let txtNew = "";
|
||||
let newTxtArray = ['','','','','','','','','','','','','','','','','','','',''];
|
||||
counter = 0;
|
||||
@@ -139,8 +144,20 @@ export class StreamDeck{
|
||||
let txtNewPart = txtArray[i];
|
||||
|
||||
if (txtNewPart != undefined && txtNewPart.length > 10){
|
||||
let syllables = this.syllabify(txtNewPart);
|
||||
|
||||
let syllables = [];
|
||||
if (game.i18n.lang == "ru") {
|
||||
newTxtArray[counter] = txtNewPart.slice(0,txtNewPart.length/2) + '-';
|
||||
counter++;
|
||||
newTxtArray[counter] = txtNewPart.slice(txtNewPart.length/2+1,txtNewPart.length);
|
||||
counter++;
|
||||
}
|
||||
else {
|
||||
syllables = this.syllabify(txtNewPart);
|
||||
if (syllables == null) {
|
||||
newTxtArray[counter] = txtNewPart;
|
||||
counter++;
|
||||
}
|
||||
else {
|
||||
for (let j=0; j<syllables.length; j++){
|
||||
if (syllables.length == 0){
|
||||
newTxtArray[counter] = txtNewPart;
|
||||
@@ -163,6 +180,8 @@ export class StreamDeck{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
newTxtArray[counter] = txtNewPart;
|
||||
counter++;
|
||||
@@ -186,17 +205,20 @@ 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;
|
||||
if (this.buttonContext[i].context == context) {
|
||||
if (this.buttonContext[i].txt != undefined)
|
||||
if (this.buttonContext[i].txt == txt)
|
||||
return;
|
||||
this.buttonContext[i].txt = 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: {
|
||||
@@ -208,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: '',
|
||||
@@ -221,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,
|
||||
@@ -237,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,
|
||||
@@ -304,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,
|
||||
@@ -321,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
|
||||
@@ -336,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,
|
||||
|
||||
@@ -1,16 +1,42 @@
|
||||
import { compatibleCore } from "../misc.js";
|
||||
|
||||
export class demonlord{
|
||||
conf;
|
||||
|
||||
constructor(){
|
||||
console.log("Material Deck: Using system 'Shadow of the Demon Lord'");
|
||||
this.conf = CONFIG.DL;
|
||||
}
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
getStatsList() {
|
||||
return [
|
||||
{value:'HP', name:'HP'},
|
||||
{value:'HPbox', name:'HP (box)'},
|
||||
{value:'AC', name:'AC'},
|
||||
{value:'Speed', name:'Speed'},
|
||||
{value:'Init', name:'Initiative'},
|
||||
{value:'Ability', name:'Ability Score'},
|
||||
{value:'AbilityMod', name:'Ability Score Modifier'}
|
||||
]
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return [
|
||||
{value:'attack', name:'Attack'},
|
||||
{value:'damage', name:'Damage'},
|
||||
{value:'damageCrit', name:'Critical Damage'},
|
||||
{value:'versatile', name:'Versatile Damage'},
|
||||
{value:'versatileCrit', name:'Versatile Critical Damage'},
|
||||
{value:'otherFormula', name:'Other Formula'},
|
||||
]
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
@@ -71,6 +97,17 @@ export class demonlord{
|
||||
return;
|
||||
}
|
||||
|
||||
getSavesList() {
|
||||
return [];
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
const keys = Object.keys(this.conf.attributes);
|
||||
let abilities = [];
|
||||
for (let k of keys) abilities.push({value:k, name:this.conf.attributes?.[k]})
|
||||
return abilities;
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
if (skill == undefined) skill = 'acr';
|
||||
const val = this.getActorData(token).skills?.[skill].total;
|
||||
@@ -92,6 +129,12 @@ export class demonlord{
|
||||
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
let conditions = [];
|
||||
for (let c of CONFIG.statusEffects) if (c.disabled != undefined) conditions.push({value:c.id, name:c.label});
|
||||
return conditions;
|
||||
}
|
||||
|
||||
async toggleCondition(token,condition) {
|
||||
if (condition == undefined) condition = 'removeAll';
|
||||
if (condition == 'removeAll'){
|
||||
@@ -128,7 +171,7 @@ export class demonlord{
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
getSpells(token,level) {
|
||||
getSpells(token,level,type) {
|
||||
if (level == undefined) level = 'any';
|
||||
const allItems = token.actor.items;
|
||||
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
||||
@@ -139,6 +182,11 @@ export class demonlord{
|
||||
return;
|
||||
}
|
||||
|
||||
getSpellTypes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
rollItem(item) {
|
||||
return item.roll()
|
||||
}
|
||||
@@ -153,4 +201,46 @@ export class demonlord{
|
||||
getSaveRingColor(token, save) {
|
||||
return;
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
return [];
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return [{value:'initiative',name:'Toggle Initiative'}]
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
return []
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return []
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return []
|
||||
}
|
||||
|
||||
getFeatureTypes() {
|
||||
return [
|
||||
{value:'class', name:'Class'},
|
||||
{value:'feat', name:'Abilities'}
|
||||
]
|
||||
}
|
||||
|
||||
getSpellLevels() {
|
||||
return [
|
||||
{value:'0', name:'Cantrip'},
|
||||
{value:'1', name:'1st Level'},
|
||||
{value:'2', name:'2nd Level'},
|
||||
{value:'3', name:'3rd Level'},
|
||||
{value:'4', name:'4th Level'},
|
||||
{value:'5', name:'5th Level'},
|
||||
{value:'6', name:'6th Level'},
|
||||
{value:'7', name:'7th Level'},
|
||||
{value:'8', name:'8th Level'},
|
||||
{value:'9', name:'9th Level'}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,47 @@
|
||||
import { compatibleCore } from "../misc.js";
|
||||
|
||||
export class dnd35e{
|
||||
constructor(){
|
||||
conf;
|
||||
system;
|
||||
|
||||
constructor(gamingSystem){
|
||||
console.log("Material Deck: Using system 'Dungeons & Dragons 3.5e'/'Pathfinder 1e'");
|
||||
if (gamingSystem == 'D35E') this.conf = CONFIG.D35E;
|
||||
else if (gamingSystem == 'pf1') this.conf = CONFIG.PF1;
|
||||
this.system = gamingSystem;
|
||||
}
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
getStatsList() {
|
||||
return [
|
||||
{value:'HP', name:'HP'},
|
||||
{value:'HPbox', name:'HP (box)'},
|
||||
{value:'TempHP', name:'Temp HP'},
|
||||
{value:'AC', name:'AC'},
|
||||
{value:'Speed', name:'Speed'},
|
||||
{value:'Init', name:'Initiative'},
|
||||
{value:'Ability', name:'Ability Score'},
|
||||
{value:'AbilityMod', name:'Ability Score Modifier'},
|
||||
{value:'Save', name:'Saving Throw Modifier'},
|
||||
{value:'Skill', name:'Skill Modifier'},
|
||||
{value:'Prof', name:'Proficiency'}
|
||||
]
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return []
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
@@ -94,12 +125,36 @@ export class dnd35e{
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
const keys = Object.keys(this.conf.abilities);
|
||||
let abilities = [];
|
||||
for (let k of keys) abilities.push({value:this.conf.abilityAbbreviations?.[k], name:this.conf.abilities?.[k]})
|
||||
return abilities;
|
||||
}
|
||||
|
||||
getSavesList() {
|
||||
const keys = Object.keys(this.conf.savingThrows);
|
||||
let saves = [];
|
||||
for (let k of keys) saves.push({value:k, name:this.conf.savingThrows?.[k]})
|
||||
return saves;
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
if (skill == undefined) skill = 'apr';
|
||||
const val = this.getActorData(token).skills?.[skill].mod;
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
const keys = Object.keys(this.conf.skills);
|
||||
let skills = [];
|
||||
for (let s of keys) {
|
||||
const skill = this.conf.skills?.[s];
|
||||
skills.push({value:s, name:skill})
|
||||
}
|
||||
return skills;
|
||||
}
|
||||
|
||||
getProficiency(token) {
|
||||
const val = this.getActorData(token).attributes.prof;
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
@@ -129,6 +184,12 @@ export class dnd35e{
|
||||
return true;
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
let conditions = [];
|
||||
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
|
||||
return conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll
|
||||
*/
|
||||
@@ -151,6 +212,27 @@ export class dnd35e{
|
||||
else if (roll == 'ranged') token.actor.rollRanged(options);
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
if (this.system == 'D35E') {
|
||||
return [
|
||||
{value:'initiative', name:'Initiative'},
|
||||
{value:'grapple', name:'Grapple'},
|
||||
{value:'bab', name:'Base Attack Bonus'},
|
||||
{value:'melee', name:'Melee'},
|
||||
{value:'ranged', name:'Ranged'}
|
||||
]
|
||||
}
|
||||
else if (this.system == 'pf1') {
|
||||
return [
|
||||
{value:'initiative', name:'Initiative'},
|
||||
{value:'cmb', name:'Combat Maneuver Bonus'},
|
||||
{value:'bab', name:'Base Attack Bonus'},
|
||||
{value:'attack', name:'Attack'},
|
||||
{value:'defenses', name:'Defenses'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@@ -170,6 +252,23 @@ export class dnd35e{
|
||||
return {available: this.getItemData(item).quantity};
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return [
|
||||
{value:'weapon', name:'Weapons'},
|
||||
{value:'equipment', name:'Armor/Equipment'},
|
||||
{value:'consumable', name:'Consumables'},
|
||||
{value:'gear', name:'Gear'},
|
||||
{value:'ammo', name:'Ammunition'},
|
||||
{value:'misc', name:'Miscellaneous'},
|
||||
{value:'tradeGoods', name:'Trade Goods'},
|
||||
{value:'container', name:'Containers'}
|
||||
]
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* Features
|
||||
*/
|
||||
@@ -188,10 +287,17 @@ export class dnd35e{
|
||||
};
|
||||
}
|
||||
|
||||
getFeatureTypes() {
|
||||
return [
|
||||
{value:'class', name:'Class'},
|
||||
{value:'feat', name:'Abilities'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
getSpells(token,level) {
|
||||
getSpells(token,level,type) {
|
||||
if (level == undefined) level = 'any';
|
||||
const allItems = token.actor.items;
|
||||
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
||||
@@ -207,6 +313,18 @@ export class dnd35e{
|
||||
}
|
||||
}
|
||||
|
||||
getSpellLevels() {
|
||||
const keys = Object.keys(this.conf.spellLevels);
|
||||
let levels = [];
|
||||
for (let l of keys) levels.push({value:l, name:this.conf.spellLevels?.[l]});
|
||||
return levels;
|
||||
}
|
||||
|
||||
getSpellTypes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
rollItem(item) {
|
||||
return item.roll()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { compatibleCore } from "../misc.js";
|
||||
import { compatibleCore, compatibleSystem } from "../misc.js";
|
||||
|
||||
const proficiencyColors = {
|
||||
0: "#000000",
|
||||
@@ -8,16 +8,52 @@ const proficiencyColors = {
|
||||
}
|
||||
|
||||
export class dnd5e{
|
||||
conf;
|
||||
|
||||
constructor(){
|
||||
console.log("Material Deck: Using system 'Dungeons & Dragons 5e'");
|
||||
this.conf = game.system.config;
|
||||
}
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
getStatsList() {
|
||||
return [
|
||||
{value:'HP', name:'HP'},
|
||||
{value:'HPbox', name:'HP (box)'},
|
||||
{value:'TempHP', name:'Temp HP'},
|
||||
{value:'AC', name:'AC'},
|
||||
{value:'Speed', name:'Speed'},
|
||||
{value:'Init', name:'Initiative'},
|
||||
{value:'Ability', name:'Ability Score'},
|
||||
{value:'AbilityMod', name:'Ability Score Modifier'},
|
||||
{value:'Save', name:'Saving Throw Modifier'},
|
||||
{value:'Skill', name:'Skill Modifier'},
|
||||
{value:'PassivePerception', name:'Passive Perception'},
|
||||
{value:'PassiveInvestigation', name:'Passive Investigation'},
|
||||
{value:'Prof', name:'Proficiency'}
|
||||
]
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return [
|
||||
{value:'attack', name:'Attack'},
|
||||
{value:'damage', name:'Damage'},
|
||||
{value:'damageCrit', name:'Critical Damage'},
|
||||
{value:'versatile', name:'Versatile Damage'},
|
||||
{value:'versatileCrit', name:'Versatile Critical Damage'},
|
||||
{value:'otherFormula', name:'Other Formula'},
|
||||
]
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return []
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
@@ -107,12 +143,36 @@ export class dnd5e{
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
const keys = Object.keys(this.conf.abilities);
|
||||
let abilities = [];
|
||||
if (compatibleSystem("2.2.0"))
|
||||
for (let k of keys) abilities.push({value:this.conf.abilityAbbreviations?.[k], name:this.conf.abilities?.[k]})
|
||||
else
|
||||
for (let k of keys) abilities.push({value:this.conf.abilities?.[k].abbreviation, name:this.conf.abilities?.[k].label})
|
||||
return abilities;
|
||||
}
|
||||
|
||||
getSavesList() {
|
||||
return this.getAbilityList();
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
if (skill == undefined) skill = 'acr';
|
||||
const val = this.getActorData(token).skills?.[skill].total;
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
const keys = Object.keys(this.conf.skills);
|
||||
let skills = [];
|
||||
for (let s of keys) {
|
||||
const skill = this.conf.skills?.[s];
|
||||
skills.push({value:s, name:skill.label})
|
||||
}
|
||||
return skills;
|
||||
}
|
||||
|
||||
getProficiency(token) {
|
||||
const val = this.getActorData(token).attributes.prof;
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
@@ -129,6 +189,12 @@ export class dnd5e{
|
||||
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
let conditions = [];
|
||||
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
|
||||
return conditions;
|
||||
}
|
||||
|
||||
async toggleCondition(token,condition) {
|
||||
if (condition == undefined) condition = 'removeAll';
|
||||
if (condition == 'removeAll'){
|
||||
@@ -161,6 +227,13 @@ export class dnd5e{
|
||||
else if (roll == 'deathSave') token.actor.rollDeathSave(options);
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
return [
|
||||
{value:'initiative', name:'Initiative'},
|
||||
{value:'deathSave', name:'Death Save'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@@ -175,6 +248,29 @@ export class dnd5e{
|
||||
return {available: this.getItemData(item).quantity};
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return [
|
||||
{value:'weapon', name:'Weapons'},
|
||||
{value:'equipment', name:'Equipment'},
|
||||
{value:'consumable', name:'Consumables'},
|
||||
{value:'tool', name:'Tools'},
|
||||
{value:'backpack', name:'Containers'},
|
||||
{value:'loot', name:'Loot'}
|
||||
]
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return [
|
||||
{value:'default', name:'Default'},
|
||||
{value:'attack', name:'Attack'},
|
||||
{value:'damage', name:'Damage'},
|
||||
{value:'damageCrit', name:'Damage (Critical)'},
|
||||
{value:'versatile', name:'Versatile'},
|
||||
{value:'versatileCrit', name:'Versatile (Critical)'},
|
||||
{value:'otherFormula', name:'Other Formula'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Features
|
||||
*/
|
||||
@@ -196,14 +292,26 @@ export class dnd5e{
|
||||
};
|
||||
}
|
||||
|
||||
getFeatureTypes() {
|
||||
return [
|
||||
{value:'class', name:'Class'},
|
||||
{value:'feat', name:'Abilities'},
|
||||
{value:'activeAbilities', name:'Active Abilities'},
|
||||
{value:'passiveAbilities', name:'Passive Abilities'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
getSpells(token,level) {
|
||||
getSpells(token,level,type) {
|
||||
if (level == undefined) level = 'any';
|
||||
if (type == undefined) type = 'any';
|
||||
const allItems = token.actor.items;
|
||||
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
||||
else return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level)
|
||||
else if (type == 'any') return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level)
|
||||
else if (type == 'prepared') return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level && i.system.preparation.prepared == true)
|
||||
else if (type == 'unprepared') return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level && i.system.preparation.prepared == false)
|
||||
}
|
||||
|
||||
getSpellUses(token,level,item) {
|
||||
@@ -215,40 +323,47 @@ export class dnd5e{
|
||||
}
|
||||
}
|
||||
|
||||
rollItem(item, settings, rollOption) {
|
||||
getSpellLevels() {
|
||||
const keys = Object.keys(this.conf.spellLevels);
|
||||
let levels = [];
|
||||
for (let l of keys) levels.push({value:l, name:this.conf.spellLevels?.[l]});
|
||||
return levels;
|
||||
}
|
||||
|
||||
|
||||
getSpellTypes() {
|
||||
return [
|
||||
{value: 'prepared', name:'Prepared'},
|
||||
{value: 'unprepared', name:'Unprepared'}
|
||||
]
|
||||
}
|
||||
|
||||
rollItem(item, settings, rollOption, attackMode) {
|
||||
let options = {
|
||||
fastForward: rollOption != 'dialog',
|
||||
advantage: rollOption == 'advantage',
|
||||
disadvantage: rollOption == 'disadvantage'
|
||||
}
|
||||
if (settings.inventoryType == 'weapon') {
|
||||
if (settings.weaponRollMode == 'attack') {
|
||||
if (settings.tokenMode == 'inventory' && settings.inventoryType == 'weapon') {
|
||||
const mode = settings.weaponRollMode == 'default' ? attackMode : settings.weaponRollMode;
|
||||
if (mode == 'attack') {
|
||||
options.fastForward = true;
|
||||
return item.rollAttack(options);
|
||||
}
|
||||
else if (settings.weaponRollMode == 'damage' || settings.weaponRollMode == 'versatile') {
|
||||
options.fastForward = true;
|
||||
return item.rollDamage({
|
||||
options,
|
||||
critical:false,
|
||||
versatile: settings.weaponRollMode == 'versatile'
|
||||
});
|
||||
}
|
||||
else if (settings.weaponRollMode == 'damageCrit' || settings.weaponRollMode == 'versatileCrit') {
|
||||
options.fastForward = true;
|
||||
return item.rollDamage({
|
||||
options,
|
||||
critical:true,
|
||||
versatile: settings.weaponRollMode == 'versatile' || settings.weaponRollMode == 'versatileCrit'
|
||||
});
|
||||
}
|
||||
else if (settings.weaponRollMode == 'otherFormula') {
|
||||
else if (mode == 'otherFormula') {
|
||||
return item.rollFormula(options);
|
||||
}
|
||||
else if (mode != 'default' && mode != 'chat') {
|
||||
options.fastForward = true;
|
||||
return item.rollDamage({
|
||||
options,
|
||||
critical: (mode == 'damageCrit' || mode == 'versatileCrit'),
|
||||
versatile: (mode == 'versatile' || mode == 'versatileCrit')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (compatibleCore('10.0')) item.use(options)
|
||||
else item.roll(options)
|
||||
item.use(options)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,41 @@
|
||||
import { compatibleCore } from "../misc.js";
|
||||
|
||||
export class forbiddenlands{
|
||||
conf;
|
||||
|
||||
constructor(){
|
||||
console.log("Material Deck: Using system 'Forbidden Lands'");
|
||||
this.conf = CONFIG.fbl;
|
||||
}
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
getStatsList() {
|
||||
return [
|
||||
{value:'HP', name:'Strength'},
|
||||
{value:'HPbox', name:'Strength (box)'},
|
||||
{value:'Agility', name:'Agility'},
|
||||
{value:'Wits', name:'Wits'},
|
||||
{value:'Empathy', name:'Empathy'},
|
||||
{value:'WillPower', name:'Will Power'},
|
||||
{value:'AC', name:'Armor'},
|
||||
{value:'Skill', name:'Skill'}
|
||||
]
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return []
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
@@ -103,6 +128,17 @@ export class forbiddenlands{
|
||||
return this.getAbility(token, ability);
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
const abilityList = this.conf.attributes;
|
||||
let abilities = [];
|
||||
for (let a of abilityList) abilities.push({value:a, name:a.charAt(0).toUpperCase() + a.slice(1)})
|
||||
return abilities;
|
||||
}
|
||||
|
||||
getSavesList() {
|
||||
return this.getAbilityList();
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
if (skill == undefined) skill = 'might';
|
||||
let skillComp = token.actor.sheet.getSkill(skill);
|
||||
@@ -110,6 +146,18 @@ export class forbiddenlands{
|
||||
return game.i18n.localize(skillComp.skill.label)+`-${val}`;
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
const keys = Object.keys(this.conf.skillAttributeMap);
|
||||
let skills = [];
|
||||
for (let s of keys) {
|
||||
const nameArr = s.split('-');
|
||||
let name = '';
|
||||
for (let p of nameArr) name += p.charAt(0).toUpperCase() + p.slice(1) + ' ';
|
||||
skills.push({value:s, name})
|
||||
}
|
||||
return skills;
|
||||
}
|
||||
|
||||
getProficiency(token) {
|
||||
return;
|
||||
}
|
||||
@@ -138,6 +186,12 @@ export class forbiddenlands{
|
||||
return true;
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
let conditions = [];
|
||||
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
|
||||
return conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll
|
||||
*/
|
||||
@@ -159,6 +213,17 @@ export class forbiddenlands{
|
||||
//else if (roll == 'initiative') token.actor.rollInitiative(options);
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
return [
|
||||
{value:'rollFood', name:'Roll Food'},
|
||||
{value:'rollWater', name:'Roll Water'},
|
||||
{value:'rollArrows', name:'Roll Arrows'},
|
||||
{value:'rollTorches', name:'Roll Torches'},
|
||||
{value:'rollArmor', name:'Roll Armor'},
|
||||
{value:'monsterAttack', name:'Roll Monster Attack'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@@ -180,6 +245,19 @@ export class forbiddenlands{
|
||||
maximum: this.getItemData(item).bonus.max};
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return [
|
||||
{value:'armor', name: "Armour"},
|
||||
{value:'gear', name: "Gear"},
|
||||
{value:'weapon', name: "Weapons"},
|
||||
{value:'rawMaterial', name: "Raw Material"}
|
||||
]
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* Features
|
||||
*/
|
||||
@@ -198,10 +276,14 @@ export class forbiddenlands{
|
||||
};
|
||||
}
|
||||
|
||||
getFeatureTypes() {
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
getSpells(token,level) {
|
||||
getSpells(token,level,type) {
|
||||
if (level == undefined) level = 'any';
|
||||
const allItems = token.actor.items;
|
||||
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
||||
@@ -217,6 +299,15 @@ export class forbiddenlands{
|
||||
}
|
||||
}
|
||||
|
||||
getSpellLevels() {
|
||||
return [];
|
||||
}
|
||||
|
||||
getSpellTypes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
rollItem(item) {
|
||||
const sheet = item.actor.sheet;
|
||||
if (item.type === "armor")
|
||||
|
||||
@@ -12,19 +12,49 @@ const proficiencyColors =
|
||||
};
|
||||
|
||||
export class pf2e{
|
||||
conf;
|
||||
|
||||
constructor(){
|
||||
console.log("Material Deck: Using system 'Pathfinder 2e'");
|
||||
this.conf = CONFIG.PF2E;
|
||||
}
|
||||
|
||||
tokenSpellData = new Map();
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
getStatsList() {
|
||||
return [
|
||||
{value:'HP', name:'HP'},
|
||||
{value:'HPbox', name:'HP (box)'},
|
||||
{value:'TempHP', name:'Temp HP'},
|
||||
{value:'AC', name:'AC'},
|
||||
{value:'ShieldHP', name:'Shield HP'},
|
||||
{value:'Speed', name:'Speed'},
|
||||
{value:'Init', name:'Initiative'},
|
||||
{value:'Ability', name:'Ability Score'},
|
||||
{value:'AbilityMod', name:'Ability Score Modifier'},
|
||||
{value:'Save', name:'Saving Throw Modifier'},
|
||||
{value:'Skill', name:'Skill Modifier'},
|
||||
{value:'Prof', name:'Proficiency'},
|
||||
{value:'Condition', name: 'Condition'},
|
||||
{value:'Perception', name: 'Perception'}
|
||||
]
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return []
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
@@ -116,24 +146,41 @@ export class pf2e{
|
||||
}
|
||||
|
||||
getAbilitySave(token, ability) {
|
||||
ability = this.fixSave(ability);
|
||||
if (ability == undefined) return 'fortitude';
|
||||
//ability = this.fixSave(ability);
|
||||
const save = this.findSave(token, ability);
|
||||
if (save == undefined) return '';
|
||||
let val = save?.value;
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
const keys = Object.keys(this.conf.abilities);
|
||||
let abilities = [];
|
||||
for (let k of keys) abilities.push({value:k, name:game.i18n.localize(this.conf.abilities?.[k])})
|
||||
return abilities;
|
||||
}
|
||||
|
||||
findSave(token, ability) {
|
||||
if (this.isLimitedSheet(token.actor)) return;
|
||||
return this.getActorData(token).saves?.[ability];
|
||||
}
|
||||
|
||||
/*
|
||||
fixSave(ability) {
|
||||
if (ability == undefined) return 'fortitude';
|
||||
else if (ability == 'fort') return 'fortitude';
|
||||
else if (ability == 'ref') return 'reflex';
|
||||
else if (ability == 'will') return 'will';
|
||||
}
|
||||
*/
|
||||
|
||||
getSavesList() {
|
||||
const keys = Object.keys(this.conf.saves);
|
||||
let saves = [];
|
||||
for (let k of keys) saves.push({value:k, name:game.i18n.localize(this.conf.saves?.[k])})
|
||||
return saves;
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
const tokenSkill = this.findSkill(token, skill);
|
||||
@@ -162,6 +209,16 @@ export class pf2e{
|
||||
return this.getActorData(token).skills?.[skill];
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
const keys = Object.keys(this.conf.skills);
|
||||
let skills = [];
|
||||
for (let s of keys) {
|
||||
skills.push({value:s, name:game.i18n.localize(this.conf.skills?.[s])})
|
||||
}
|
||||
for (let i=1; i<4; i++) skills.push({value:`lor_${i}`, name: `${game.i18n.localize(this.conf.skillList.lore)} #${i}`})
|
||||
return skills;
|
||||
}
|
||||
|
||||
getLoreSkills(token) {
|
||||
if (this.isLimitedSheet(token.actor)) return [];
|
||||
const skills = this.getActorData(token).skills;
|
||||
@@ -176,13 +233,13 @@ export class pf2e{
|
||||
if (condition == undefined || condition == 'removeAll') return undefined;
|
||||
const Condition = this.getConditionName(condition);
|
||||
const effects = token.actor.items.filter(i => i.type == 'condition');
|
||||
return effects.find(e => e.name === Condition);
|
||||
return effects.find(e => e.name.split(' ')[0] === Condition);
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -203,7 +260,8 @@ export class pf2e{
|
||||
const effect = this.getConditionValue(token,condition);
|
||||
if (effect == undefined) {
|
||||
if (delta > 0) {
|
||||
await game.pf2e.ConditionManager.addConditionToToken(condition, token);
|
||||
const newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
|
||||
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -223,23 +281,32 @@ export class pf2e{
|
||||
}
|
||||
|
||||
async toggleCondition(token,condition) {
|
||||
console.log(token,condition)
|
||||
if (condition == undefined) condition = 'removeAll';
|
||||
if (condition == 'removeAll'){
|
||||
for( let existing of token.actor.items.filter(i => i.type == 'condition'))
|
||||
await game.pf2e.ConditionManager.removeConditionFromToken(existing.data._id, token);
|
||||
for( let effect of token.actor.items.filter(i => i.type == 'condition'))
|
||||
await effect.delete();
|
||||
}
|
||||
else {
|
||||
const effect = this.getCondition(token,condition);
|
||||
console.log('eff',effect)
|
||||
if (effect == undefined) {
|
||||
await game.pf2e.ConditionManager.addConditionToToken(condition, token);
|
||||
const newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
|
||||
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
|
||||
}
|
||||
else {
|
||||
await game.pf2e.ConditionManager.removeConditionFromToken(effect.data._id, token);
|
||||
effect.delete();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
let conditions = [];
|
||||
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
|
||||
return conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll
|
||||
*/
|
||||
@@ -289,6 +356,13 @@ export class pf2e{
|
||||
game.pf2e.Check.roll(checkModifier, {type:type, actor: actor, skipDialog: true}, null);
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
return [
|
||||
{value:'initiative', name:'Initiative'},
|
||||
{value:'perception', name:'Perception'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@@ -305,6 +379,20 @@ export class pf2e{
|
||||
return {available: item.quantity};
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return [
|
||||
{value:'weapon', name:'Weapons'},
|
||||
{value:'armor', name:'Armor'},
|
||||
{value:'equipment', name:'Equipment'},
|
||||
{value:'consumable', name:'Consumables'},
|
||||
{value:'treasure', name:'Treasure'}
|
||||
]
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* Features
|
||||
*/
|
||||
@@ -347,6 +435,30 @@ export class pf2e{
|
||||
else return;
|
||||
}
|
||||
|
||||
getFeatureTypes() {
|
||||
return [
|
||||
{value:'ancestry', name:'Ancestry'},
|
||||
{value:'ancestryfeature', name:'Ancestry Feature'},
|
||||
{value:'heritage', name: 'Heritage'},
|
||||
{value:'background', name: 'Background'},
|
||||
{value:'class', name:'Class'},
|
||||
{value:'classfeature', name:'Class Feature'},
|
||||
{value:'deity', name: 'Deity'},
|
||||
{value:'feat-any', name:'Feats - Any'},
|
||||
{value:'feat-anc', name:'Feats - Ancestry'},
|
||||
{value:'feat-arc', name: 'Feats - Archetype'},
|
||||
{value:'feat-ded', name: 'Feats - Dedication'},
|
||||
{value:'feat-cla', name: 'Feats - Class'},
|
||||
{value:'feat-gen', name: 'Feats - General'},
|
||||
{value:'feat-ski', name: 'Feats - Skill'},
|
||||
{value:'action-any', name:'Actions - Any'},
|
||||
{value:'action-def', name:'Actions - Defensive'},
|
||||
{value:'action-int', name:'Actions - Interaction'},
|
||||
{value:'action-off', name:'Actions - Offensive'},
|
||||
{value:'strike', name:'Strikes'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
@@ -402,7 +514,7 @@ export class pf2e{
|
||||
return spell.level;
|
||||
}
|
||||
|
||||
getSpells(token,level) {
|
||||
getSpells(token,level,type) {
|
||||
if (this.isLimitedSheet(token.actor)) return '';
|
||||
if (level == undefined) level = 'any';
|
||||
let spellData = this.getSpellData(token);
|
||||
@@ -468,6 +580,21 @@ export class pf2e{
|
||||
return result;
|
||||
}
|
||||
|
||||
getSpellLevels() {
|
||||
const keys = Object.keys(this.conf.spellLevels);
|
||||
let levels = [
|
||||
{value:'f', name: game.i18n.localize("PF2E.SpellCategoryFocus")},
|
||||
{value:'0', name: game.i18n.localize("PF2E.SpellCantripLabel")}
|
||||
];
|
||||
for (let l of keys) levels.push({value:l, name:game.i18n.localize(this.conf.spellLevels?.[l])});
|
||||
return levels;
|
||||
}
|
||||
|
||||
getSpellTypes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
rollItem(item, settings) {
|
||||
let variant = 0;
|
||||
if (otherControls.rollOption == 'map1') variant = 1;
|
||||
@@ -514,7 +641,7 @@ export class pf2e{
|
||||
}
|
||||
|
||||
getSaveRingColor(token, save) {
|
||||
save = this.fixSave(save);
|
||||
//save = this.fixSave(save);
|
||||
return this.getRingColor(this.findSave(token, save));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,16 +8,44 @@ const proficiencyColors = {
|
||||
}
|
||||
|
||||
export class starfinder{
|
||||
conf;
|
||||
|
||||
constructor(){
|
||||
console.log("Material Deck: Using system 'Starfinder'");
|
||||
this.conf = CONFIG.SFRPG;
|
||||
}
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
getStatsList() {
|
||||
return [
|
||||
{value:'HP', name:'HP'},
|
||||
{value:'HPbox', name:'HP (box)'},
|
||||
{value:'Stamina', name:'Stamina'},
|
||||
{value:'AC', name:'Energy AC'},
|
||||
{value:'KinAC', name:'Kinetic AC'},
|
||||
{value:'Speed', name:'Speed'},
|
||||
{value:'Init', name:'Initiative'},
|
||||
{value:'Ability', name:'Ability Score'},
|
||||
{value:'AbilityMod', name:'Ability Score Modifier'},
|
||||
{value:'Save', name:'Saving Throw Modifier'},
|
||||
{value:'Skill', name:'Skill Modifier'}
|
||||
]
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return []
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
@@ -110,12 +138,36 @@ export class starfinder{
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
const keys = Object.keys(this.conf.abilities);
|
||||
let abilities = [];
|
||||
for (let k of keys) abilities.push({value:k, name:this.conf.abilities?.[k]})
|
||||
return abilities;
|
||||
}
|
||||
|
||||
getSavesList() {
|
||||
const keys = Object.keys(this.conf.saves);
|
||||
let saves = [];
|
||||
for (let k of keys) saves.push({value:k, name:this.conf.saves?.[k]})
|
||||
return saves;
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
if (skill == undefined) skill = 'acr';
|
||||
const val = this.getActorData(token).skills?.[skill].mod;
|
||||
return (val >= 0) ? `+${val}` : val;
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
const keys = Object.keys(this.conf.skills);
|
||||
let skills = [];
|
||||
for (let s of keys) {
|
||||
const skill = this.conf.skills?.[s];
|
||||
skills.push({value:s, name:skill.label})
|
||||
}
|
||||
return skills;
|
||||
}
|
||||
|
||||
getProficiency(token) {
|
||||
return;
|
||||
}
|
||||
@@ -144,6 +196,12 @@ export class starfinder{
|
||||
return true;
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
let conditions = [];
|
||||
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:c.label});
|
||||
return conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll
|
||||
*/
|
||||
@@ -163,6 +221,13 @@ export class starfinder{
|
||||
else if (roll == 'deathSave') token.actor.rollDeathSave(options);
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
return [
|
||||
{value:'initiative', name:'Initiative'},
|
||||
{value:'deathSave', name:'Death Save'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@@ -178,6 +243,25 @@ export class starfinder{
|
||||
return {available: this.getItemData(item).quantity};
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return [
|
||||
{value:'weapon', name:'Weapons'},
|
||||
{value:'shield', name:'Shields'},
|
||||
{value:'equipment', name:'Armor'},
|
||||
{value:'ammunition', name:'Ammunition'},
|
||||
{value:'consumable', name:'Consumables'},
|
||||
{value:'goods', name:'Goods'},
|
||||
{value:'container', name:'Containers'},
|
||||
{value:'technological', name:'Technological, Magical, and Hybrid Items'},
|
||||
{value:'enhancers', name:'Equipment Enhancers'},
|
||||
{value:'augmentation', name:'Augmentations'}
|
||||
]
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* Features
|
||||
*/
|
||||
@@ -201,10 +285,23 @@ export class starfinder{
|
||||
};
|
||||
}
|
||||
|
||||
getFeatureTypes() {
|
||||
return [
|
||||
{value:'class', name:'Class'},
|
||||
{value:'race', name:'Race'},
|
||||
{value:'theme', name:'Theme'},
|
||||
{value:'asi', name:'Ability Score Increases'},
|
||||
{value:'archetypes', name:'Archetypes'},
|
||||
{value:'activeFeat', name:'Active Feats'},
|
||||
{value:'passiveFeat', name:'Passive Feats'},
|
||||
{value:'actorResource', name:'Actor Resources'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
getSpells(token,level) {
|
||||
getSpells(token,level,type) {
|
||||
if (level == undefined) level = 'any';
|
||||
const allItems = token.actor.items;
|
||||
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
||||
@@ -232,6 +329,18 @@ export class starfinder{
|
||||
return uses;
|
||||
}
|
||||
|
||||
getSpellLevels() {
|
||||
const keys = Object.keys(this.conf.spellLevels);
|
||||
let levels = [{label:'innate', name:game.i18n.localize("SFRPG.SpellPreparationModesInnate")}];
|
||||
for (let l of keys) levels.push({value:l, name:this.conf.spellLevels?.[l]});
|
||||
return levels;
|
||||
}
|
||||
|
||||
getSpellTypes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
rollItem(item) {
|
||||
return item.roll()
|
||||
}
|
||||
|
||||
@@ -24,16 +24,54 @@ const proficiencyColors = {
|
||||
|
||||
//Rename 'template' to the name of your system
|
||||
export class template{
|
||||
conf; //this variable stores the configuration data for the system, set in the constructor
|
||||
|
||||
constructor(){
|
||||
console.log("Material Deck: Using system 'SystemName'");
|
||||
this.conf = CONFIG.DND5E; //You can use this to get various things like the list of ability scores, conditions, etc. Make sure you set it to the correct value for your system
|
||||
}
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
/**
|
||||
* This generates a list of stats to be displayed on the SD: Token Action => Stats.
|
||||
* Choose the ones you want to use and change the 'name' value if desired. If you add new ones, you will need to add a function to handle them in src/token.js.
|
||||
* After each option you'll find what function it will call after the button is pressed on the SD
|
||||
*/
|
||||
getStatsList() {
|
||||
return [
|
||||
{value:'HP', name:'HP'}, //will call getHP()
|
||||
{value:'HPbox', name:'HP (box)'}, //will call getHP()
|
||||
{value:'TempHP', name:'Temp HP'}, //will call getTempHP()
|
||||
{value:'AC', name:'AC'}, //will call getAC()
|
||||
{value:'ShieldHP', name:'Shield HP'}, //will call getShieldHP()
|
||||
{value:'Speed', name:'Speed'}, //will call getSpeed()
|
||||
{value:'Init', name:'Initiative'}, //will call getInitiative()
|
||||
{value:'Ability', name:'Ability Score'}, //will call getAbility()
|
||||
{value:'AbilityMod', name:'Ability Score Modifier'}, //will call getAbilityModifier()
|
||||
{value:'Save', name:'Saving Throw Modifier'}, //will call getAbilitySave()
|
||||
{value:'Skill', name:'Skill Modifier'}, //will call getSkill()
|
||||
{value:'PassivePerception', name:'Passive Perception'}, //will call getPassivePerception()
|
||||
{value:'PassiveInvestigation', name:'Passive Investigation'}, //will call getPassiveInvestigation()
|
||||
{value:'Prof', name:'Proficiency'}, //will call getProficiency()
|
||||
{value:'Condition', name: 'Condition'}, //will call getConditionValue()
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an on click option to the SD: Token Action => On Click
|
||||
* Currently only supports toggling initiative (for Shadow of the Demonlord)
|
||||
*/
|
||||
getOnClickList() {
|
||||
return [
|
||||
//{value:'initiative',name:'Toggle Initiative'}
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,6 +187,17 @@ export class template{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of abilities available to the system
|
||||
* Each array item must be {value:'abilityId', name:'abilityName'}
|
||||
* 'abilityId' is defined by the system, the name can be anything you want
|
||||
* @returns
|
||||
*/
|
||||
getAbilityList() {
|
||||
let abilities = [];
|
||||
return abilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the skill value of the token
|
||||
* @param {Token} token Token instance to get the skill value from
|
||||
|
||||
@@ -8,7 +8,6 @@ import { starfinder } from "./starfinder.js";
|
||||
import { compatibleCore } from "../misc.js";
|
||||
import { gamingSystem } from "../../MaterialDeck.js";
|
||||
|
||||
|
||||
export class TokenHelper{
|
||||
constructor(){
|
||||
this.system;
|
||||
@@ -16,7 +15,7 @@ export class TokenHelper{
|
||||
}
|
||||
|
||||
setSystem() {
|
||||
if (gamingSystem == 'D35E' || gamingSystem == 'pf1') this.system = new dnd35e();
|
||||
if (gamingSystem == 'D35E' || gamingSystem == 'pf1') this.system = new dnd35e(gamingSystem);
|
||||
else if (gamingSystem == 'pf2e') this.system = new pf2e();
|
||||
else if (gamingSystem == 'demonlord') this.system = new demonlord();
|
||||
else if (gamingSystem == 'wfrp4e') this.system = new wfrp4e();
|
||||
@@ -58,7 +57,7 @@ export class TokenHelper{
|
||||
|
||||
moveToken(token,dir){
|
||||
if (dir == undefined) dir = 'up';
|
||||
const gridSize = compatibleCore('10.0') ? canvas.scene.grid.size : canvas.scene.data.grid;
|
||||
const gridSize = canvas.scene.grid.size;
|
||||
let x = token.x;
|
||||
let y = token.y;
|
||||
|
||||
@@ -99,7 +98,7 @@ export class TokenHelper{
|
||||
value = isNaN(parseInt(value)) ? 0 : parseInt(value);
|
||||
|
||||
let rotationVal;
|
||||
if (move == 'by') rotationVal = compatibleCore('10.0') ? token.document.rotation + value : token.data.rotation + value;
|
||||
if (move == 'by') rotationVal = token.document.rotation + value;
|
||||
else rotationVal = value;
|
||||
|
||||
token.document.update({rotation: rotationVal});
|
||||
@@ -128,16 +127,29 @@ export class TokenHelper{
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
getTokenIcon(token) {
|
||||
return compatibleCore('10.0') ? token.document.texture.src : token.data.img;
|
||||
return token.document.texture.src;
|
||||
}
|
||||
|
||||
getActorIcon(token) {
|
||||
return compatibleCore('10.0') ? token.actor.img : token.actor.data.img;
|
||||
return token.actor.img;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* System specific functions
|
||||
***********************************************************************/
|
||||
|
||||
getStatsList() {
|
||||
return this.system.getStatsList();
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return this.system.getAttackModes();
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return this.system.getOnClickList();
|
||||
}
|
||||
|
||||
getHP(token) {
|
||||
return this.system.getHP(token);
|
||||
}
|
||||
@@ -186,10 +198,22 @@ export class TokenHelper{
|
||||
return this.system.getAbilitySave(token, ability);
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
return this.system.getAbilityList();
|
||||
}
|
||||
|
||||
getSavesList() {
|
||||
return this.system.getSavesList();
|
||||
}
|
||||
|
||||
getSkill(token, skill) {
|
||||
return this.system.getSkill(token, skill);
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
return this.system.getSkillList();
|
||||
}
|
||||
|
||||
getProficiency(token) {
|
||||
return this.system.getProficiency(token);
|
||||
}
|
||||
@@ -279,6 +303,10 @@ export class TokenHelper{
|
||||
return this.system.toggleCondition(token,condition);
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
return this.system.getConditionList();
|
||||
}
|
||||
|
||||
/* PF2E */
|
||||
getConditionValue(token,condition) {
|
||||
return this.system.getConditionValue(token,condition);
|
||||
@@ -296,6 +324,10 @@ export class TokenHelper{
|
||||
return this.system.roll(token,roll,options,ability,skill,save);
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
return this.system.getRollTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Items
|
||||
*/
|
||||
@@ -307,6 +339,14 @@ export class TokenHelper{
|
||||
return this.system.getItemUses(item);
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return this.system.getItemTypes();
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return this.system.getWeaponRollModes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Features
|
||||
*/
|
||||
@@ -318,19 +358,31 @@ export class TokenHelper{
|
||||
return this.system.getFeatureUses(item);
|
||||
}
|
||||
|
||||
getFeatureTypes() {
|
||||
return this.system.getFeatureTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Spells
|
||||
*/
|
||||
getSpells(token,level) {
|
||||
return this.system.getSpells(token,level);
|
||||
getSpells(token,level,type) {
|
||||
return this.system.getSpells(token,level,type);
|
||||
}
|
||||
|
||||
getSpellUses(token,level,item) {
|
||||
return this.system.getSpellUses(token,level,item);
|
||||
}
|
||||
|
||||
rollItem(item, settings, rollOption) {
|
||||
return this.system.rollItem(item, settings, rollOption);
|
||||
rollItem(item, settings, rollOption, attackMode) {
|
||||
return this.system.rollItem(item, settings, rollOption, attackMode);
|
||||
}
|
||||
|
||||
getSpellLevels() {
|
||||
return this.system.getSpellLevels();
|
||||
}
|
||||
|
||||
getSpellTypes() {
|
||||
return this.system.getSpellTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,44 @@
|
||||
import { compatibleCore } from "../misc.js";
|
||||
|
||||
export class wfrp4e {
|
||||
conf;
|
||||
|
||||
constructor(){
|
||||
console.log("Material Deck: Using system 'Warhammer Fantasy Roleplaying 4e'");
|
||||
this.conf = game.wfrp4e.config;
|
||||
}
|
||||
|
||||
getActorData(token) {
|
||||
return compatibleCore('10.0') ? token.actor.system : token.actor.data.data;
|
||||
return token.actor.system;
|
||||
}
|
||||
|
||||
getItemData(item) {
|
||||
return compatibleCore('10.0') ? item.system : item.data.data;
|
||||
return item.system;
|
||||
}
|
||||
|
||||
getStatsList() {
|
||||
return [
|
||||
{value: 'Advantage', name: 'Advantage'},
|
||||
{value: 'Corruption', name: 'Corruption'},
|
||||
{value: 'CriticalWounds', name: 'Critical Wounds'},
|
||||
{value: 'Encumbrance', name: 'Encumbrance'},
|
||||
{value: 'Fate', name: 'Fate'},
|
||||
{value: 'Fortune', name: 'Fortune'},
|
||||
{value: 'Wounds', name: 'Wounds'},
|
||||
{value: 'Movement', name: 'Movement'},
|
||||
{value: 'Resilience', name: 'Resilience'},
|
||||
{value: 'Resolve', name: 'Resolve'},
|
||||
{value: 'Ability', name: 'Characteristics' } //value is ability to conform to the interface
|
||||
]
|
||||
}
|
||||
|
||||
getAttackModes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
getOnClickList() {
|
||||
return []
|
||||
}
|
||||
|
||||
getFate(token) {
|
||||
@@ -27,7 +55,6 @@ export class wfrp4e {
|
||||
value: wounds.value,
|
||||
max: wounds.max
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getCriticalWounds(token) {
|
||||
@@ -58,6 +85,13 @@ export class wfrp4e {
|
||||
return this.getCharacteristics(token, abilityName);
|
||||
}
|
||||
|
||||
getAbilityList() {
|
||||
const keys = Object.keys(this.conf.characteristics);
|
||||
let abilities = [];
|
||||
for (let k of keys) abilities.push({value:k, name:this.conf.characteristics?.[k]})
|
||||
return abilities;
|
||||
}
|
||||
|
||||
getCharacteristics(token, characteristicName) {
|
||||
if (characteristicName == undefined ) characteristicName = `AG`;
|
||||
const characteristic = this.getActorData(token).characteristics[characteristicName.toLowerCase()]
|
||||
@@ -71,7 +105,14 @@ export class wfrp4e {
|
||||
if (featureType == 'any') return allItems.filter(i => i.type == 'skill' || i.type == 'talent' || i.type == "career" || i.type == 'trait');
|
||||
return allItems.filter(i => i.type == featureType);
|
||||
}
|
||||
getSpells(token,spellType) {
|
||||
|
||||
getFeatureTypes() {
|
||||
return [
|
||||
{value: 'skill', name: 'Skills'}
|
||||
]
|
||||
}
|
||||
|
||||
getSpells(token,spellLevel,type) {
|
||||
const allItems = token.actor.items;
|
||||
return allItems.filter(i => i.type == 'spell')
|
||||
}
|
||||
@@ -80,6 +121,26 @@ export class wfrp4e {
|
||||
return;
|
||||
}
|
||||
|
||||
getSpellLevels() {
|
||||
return [
|
||||
{value:'0', name:'Cantrip'},
|
||||
{value:'1', name:'1st Level'},
|
||||
{value:'2', name:'2nd Level'},
|
||||
{value:'3', name:'3rd Level'},
|
||||
{value:'4', name:'4th Level'},
|
||||
{value:'5', name:'5th Level'},
|
||||
{value:'6', name:'6th Level'},
|
||||
{value:'7', name:'7th Level'},
|
||||
{value:'8', name:'8th Level'},
|
||||
{value:'9', name:'9th Level'}
|
||||
]
|
||||
}
|
||||
|
||||
getSpellTypes() {
|
||||
return [
|
||||
]
|
||||
}
|
||||
|
||||
getFeatureUses(item) {
|
||||
return {available: `+${this.getItemData(item).total.value}`};
|
||||
}
|
||||
@@ -92,6 +153,13 @@ export class wfrp4e {
|
||||
return game.wfrp4e.utility.rollItemMacro(item.name, item.type, false);
|
||||
}
|
||||
|
||||
getRollTypes() {
|
||||
return [
|
||||
{value:'initiative', name:'Initiative'},
|
||||
{value:'deathSave', name:'Death Save'}
|
||||
]
|
||||
}
|
||||
|
||||
getSpeed(token) {
|
||||
return this.getActorData(token).details.move.value;
|
||||
}
|
||||
@@ -110,13 +178,17 @@ export class wfrp4e {
|
||||
return true;
|
||||
}
|
||||
|
||||
getConditionList() {
|
||||
let conditions = [];
|
||||
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
|
||||
return conditions;
|
||||
}
|
||||
|
||||
roll(token,roll,options,ability,skill,save) {
|
||||
if (ability == undefined) ability = 'ag';
|
||||
return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
getItems(token,itemType) {
|
||||
if (itemType == undefined) itemType = 'any';
|
||||
const allItems = token.actor.items;
|
||||
@@ -129,7 +201,6 @@ export class wfrp4e {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getItemUses(item) {
|
||||
if ( item.type == 'ammunition') {
|
||||
return {available: this.getItemData(item).quantity.value};
|
||||
@@ -139,6 +210,20 @@ export class wfrp4e {
|
||||
}
|
||||
}
|
||||
|
||||
getItemTypes() {
|
||||
return [
|
||||
{value:'weapon', name: "Weapons"},
|
||||
{value:'ammunition', name: "Ammunition"},
|
||||
{value:'trapping', name: "Trapping"},
|
||||
{value:'armour', name: "Armour"},
|
||||
{value:'cargo', name: "Cargo"}
|
||||
]
|
||||
}
|
||||
|
||||
getSkillList() {
|
||||
return this.getAbilityList();
|
||||
}
|
||||
|
||||
|
||||
/* this is all cargo-culted in and some of it could be deleted once the interface is resolved
|
||||
to not be the superset of all possible systems
|
||||
@@ -173,6 +258,14 @@ export class wfrp4e {
|
||||
return;
|
||||
}
|
||||
|
||||
getSavesList() {
|
||||
return [];
|
||||
}
|
||||
|
||||
getWeaponRollModes() {
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* Ring Colors
|
||||
*/
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<form autocomplete="off" onsubmit="event.preventDefault()">
|
||||
<table style="width:100%; min-width:400px">
|
||||
<tr>
|
||||
<th class='materialDeck_devConf_columnLabel'>{{localize "MaterialDeck.Name"}}</th>
|
||||
<th class='materialDeck_devConf_columnLabel'>{{localize "MaterialDeck.Type"}}</th>
|
||||
<th class='materialDeck_devConf_columnId'>{{localize "MaterialDeck.Id"}}</th>
|
||||
<th class='materialDeck_devConf_columnCB'>{{localize "MaterialDeck.Perm.ENABLE.ENABLE.label"}}</th>
|
||||
</tr>
|
||||
{{#each devices as |d|}}
|
||||
<tr>
|
||||
<td class='materialDeck_devConf_columnLabel'>{{d.name}}</td>
|
||||
<td class='materialDeck_devConf_columnLabel'>{{d.type}}</td>
|
||||
<td class='materialDeck_devConf_columnId'><input type="text" value={{d.id}} disabled></td>
|
||||
<td class='materialDeck_devConf_columnCB'><input type="checkbox" name="enable" id="materialDeck_devConf_{{d.id}}" {{checked d.en}}></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
</form>
|
||||
@@ -11,11 +11,23 @@
|
||||
<th class='materialDeck_dlUtil_columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.module"}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>v{{versions.module.current}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'></td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>{{releases.module.version}}</td>
|
||||
<td class='materialDeck_dlUtil_columnOS'></td>
|
||||
<td class='materialDeck_dlUtil_columnButton'><button type="button" class='materialDeck_dlUtil_button' style="visibility:hidden">
|
||||
<i class="fas fa-download"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.SDplugin"}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>{{localSdVersion}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>{{minimumSdVersion}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion' id='materialDeck_dlUtil_masterSdVersion'>{{masterSdVersion}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>v{{versions.plugin.current}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>v{{versions.plugin.minimum}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>{{releases.plugin.version}}</td>
|
||||
<td class='materialDeck_dlUtil_columnOS'></td>
|
||||
<td class='materialDeck_dlUtil_columnButton'>
|
||||
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_downloadSd' {{#if sdDlDisable}}disabled{{/if}}>
|
||||
@@ -26,20 +38,22 @@
|
||||
|
||||
<tr>
|
||||
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.MSserver"}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>{{localMsVersion}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>{{minimumMsVersion}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion' id='materialDeck_dlUtil_masterMsVersion'>{{masterMsVersion}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>v{{versions.materialCompanion.current}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>v{{versions.materialCompanion.minimum}}</td>
|
||||
<td class='materialDeck_dlUtil_columnVersion'>{{releases.materialCompanion.version}}</td>
|
||||
<td class='materialDeck_dlUtil_columnOS'>
|
||||
<select id="materialDeck_dlUtil_os" default="" {{#if msDlDisable}}disabled{{/if}}>
|
||||
<option value="win32-x64">{{localize "MaterialDeck.DownloadUtility.Windows"}}</option>
|
||||
<option value="macos-x64">{{localize "MaterialDeck.DownloadUtility.MacosIntel"}}</option>
|
||||
<option value="macos-arm64">{{localize "MaterialDeck.DownloadUtility.MacosM1"}}</option>
|
||||
<option value="macos-x64.dmg">{{localize "MaterialDeck.DownloadUtility.MacosIntel"}} - dmg</option>
|
||||
<option value="macos-x64.zip">{{localize "MaterialDeck.DownloadUtility.MacosIntel"}} - zip</option>
|
||||
<option value="macos-arm64.dmg">{{localize "MaterialDeck.DownloadUtility.MacosM1"}} - dmg</option>
|
||||
<option value="macos-arm64.zip">{{localize "MaterialDeck.DownloadUtility.MacosM1"}} - zip</option>
|
||||
<option value="linux-x64">{{localize "MaterialDeck.DownloadUtility.Linux"}}</option>
|
||||
<option value="source">{{localize "MaterialDeck.DownloadUtility.Source"}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class='materialDeck_dlUtil_columnButton'>
|
||||
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_downloadMs' {{#if msDlDisable}}disabled{{/if}}>
|
||||
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_downloadMc' {{#if msDlDisable}}disabled{{/if}}>
|
||||
<i class="fas fa-download"></i>
|
||||
</button>
|
||||
</td>
|
||||
@@ -54,11 +68,11 @@
|
||||
<th class='materialDeck_dlUtil_columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
|
||||
</tr>
|
||||
<div id='profileContents'>
|
||||
{{#each profiles as |p|}}
|
||||
{{#each releases.plugin.profiles as |p|}}
|
||||
<tr>
|
||||
<td>{{p.label}}</td>
|
||||
<td>{{p.name}}</td>
|
||||
<td class='materialDeck_dlUtil_columnButton'>
|
||||
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_dlProfile-{{p.id}}' name='downloadProfile' {{#if ../profileDlDisable}}disabled{{/if}}>
|
||||
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_dlProfile-{{p.name}}' name='downloadProfile'>
|
||||
<i class="fas fa-download"></i>
|
||||
</button>
|
||||
</td>
|
||||
@@ -66,10 +80,4 @@
|
||||
{{/each}}
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<button type="button" id='materialDeck_dlUtil_refresh'>
|
||||
<i class="fas fa-redo"></i>
|
||||
{{localize "MaterialDeck.DownloadUtility.Refresh"}}
|
||||
</button>
|
||||
|
||||
</form>
|
||||
@@ -12,7 +12,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div style="width:1200px">
|
||||
<div style="width:1200px; height:700px">
|
||||
|
||||
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/down.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Introduction</h1>
|
||||
<div class="">
|
||||
@@ -24,15 +24,15 @@
|
||||
between the combat tracker, soundboard, or any other (custom) configuration.<br>
|
||||
<br>
|
||||
Material Deck is a very large module with tons of features and ways of customizing your experience. This menu will only cover the basics to get you started,
|
||||
the full documentation can be found on <a href="https://github.com/CDeenen/MaterialDeck/wiki">Github</a>. Please also check the <a href="https://github.com/CDeenen/MaterialDeck/wiki/FAQ">FAQ</a> which answers some common questions, including some basic troubleshooting.<br>
|
||||
the full documentation can be found on <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki">Github</a>. Please also check the <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/FAQ">FAQ</a> which answers some common questions, including some basic troubleshooting.<br>
|
||||
</div>
|
||||
|
||||
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Latest Releases</h1>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
<a href="https://github.com/CDeenen/MaterialDeck/releases">Module</a><br>
|
||||
<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Stream Deck</a><br>
|
||||
<a href="https://github.com/CDeenen/MaterialServer/releases">Server</a><br>
|
||||
You can use the download utility in the module settings to download the Stream Deck plugin, Stream Deck profiles and Material Server.
|
||||
<a href="https://github.com/MaterialFoundry/MaterialDeck/releases">Module</a><br>
|
||||
<a href="https://github.com/MaterialFoundry/MaterialDeck_SD/releases">Stream Deck</a><br>
|
||||
<a href="https://github.com/MaterialFoundry/MaterialCompanion/releases">Material Companion</a><br>
|
||||
You can use the download utility in the module settings to download the Stream Deck plugin, Stream Deck profiles and Material Companion.
|
||||
</div>
|
||||
|
||||
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Getting Started</h1>
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<h3>Manually</h3>
|
||||
<ol>
|
||||
<li>Download the latest plugin file using the download utility in the module settings, or download it (com.cdeenen.materialdeck.streamDeckPlugin) from <a href="https://github.com/CDeenen/MaterialDeck_SD/releases">here</a></li>
|
||||
<li>Download the latest plugin file using the download utility in the module settings, or download it (com.cdeenen.materialdeck.streamDeckPlugin) from <a href="https://github.com/MaterialFoundry/MaterialDeck_SD/releases">here</a></li>
|
||||
<li>Double-click the file, this should open the Stream Deck software</li>
|
||||
<li>Press 'Install' in the pop-up</li>
|
||||
</ol>
|
||||
@@ -67,22 +67,22 @@
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
You can create your own profile, but it is recommended to start with one of the pre-made profiles. Currently, there is a profile for the normal and XL Stream Deck variants.
|
||||
<ol>
|
||||
<li>Download the latest plugin file using the download utility in the module settings, or download one (ending with .streamDeckProfile) from <a href="https://github.com/CDeenen/MaterialDeck_SD/releases">here</a></li>
|
||||
<li>Download the latest plugin file using the download utility in the module settings, or download one (ending with .streamDeckProfile) from <a href="https://github.com/MaterialFoundry/MaterialDeck_SD/releases">here</a></li>
|
||||
<li>Double-click the file, this should load the profile into the Stream Deck software</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Downloading and Starting Material Server</h2>
|
||||
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Downloading and Starting Material Companion</h2>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
Material Server acts as a bridge application, bridging the communication between the Stream Deck and Material Deck.
|
||||
Material Companion acts as a bridge application, bridging the communication between the Stream Deck and Material Deck.
|
||||
<ol>
|
||||
<li>Download the latest version for your operating system <a href="https://github.com/CDeenen/MaterialServer/releases">here</a> or through the download utility</li>
|
||||
<li>Download the latest version for your operating system <a href="https://github.com/MaterialFoundry/MaterialCompanion/releases">here</a> or through the download utility</li>
|
||||
<li>Extract the archive</li>
|
||||
<li>Run 'materialserver.exe' (Windows) or 'materialserver' (MacOS and Linux)</li>
|
||||
<li>Run 'MaterialCompanion.exe' (Windows) or 'MaterialCompanion' (MacOS and Linux)</li>
|
||||
</ol>
|
||||
<b>You need to always have Material Server running when you want to use Material Deck</b><br>
|
||||
<b>You need to always have Material Companion running when you want to use Material Deck</b><br>
|
||||
<br>
|
||||
<a href="https://github.com/CDeenen/MaterialServer/wiki">Material Server documentation</a>
|
||||
<a href="https://github.com/MaterialFoundry/MaterialCompanion/wiki">Material Companion documentation</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -103,15 +103,15 @@
|
||||
Below the buttons you will find the following settings:
|
||||
<ul>
|
||||
<li><b>Enable Module</b> - Ticking this box enabled the module for the client</li>
|
||||
<li><b>Material Server Address</b> - Fill in the address of Material Server (usually if you run it on the same computer as
|
||||
<li><b>Material Companion Address</b> - Fill in the address of Material Companion (usually if you run it on the same computer as
|
||||
you're using for Foundry, this can be localhost:3001). This is not necessarily the IP address of Foundry! It is the IP
|
||||
address of the computer that's running Material Server. The default value will work for 99% of people, only change it if
|
||||
you know what you're doing. More info on Material Server can be found <a href="https://github.com/CDeenen/MaterialServer/blob/master/README.md">here</a></li>
|
||||
address of the computer that's running Material Companion. The default value will work for 99% of people, only change it if
|
||||
you know what you're doing. More info on Material Companion can be found <a href="https://github.com/MaterialFoundry/MaterialCompanion/blob/master/README.md">here</a></li>
|
||||
<li><b>Image Cache Size</b> - 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.</li>
|
||||
<li><b>Image Brightness</b> - Sets the brightness of the default white images for better readibility of the text. If Image Cache Size is large, it'll take a while for
|
||||
the new brightness setting to be applied. A refresh will give instantaneous results.</li>
|
||||
<li><b>Number of Connection Warnings</b> - Sets the number of times you will get a warning when Material Deck cannot connect to Material Server. Will be unlimited if set to 0.</li>
|
||||
<li><b>Number of Connection Warnings</b> - Sets the number of times you will get a warning when Material Deck cannot connect to Material Companion. Will be unlimited if set to 0.</li>
|
||||
</ul>
|
||||
|
||||
<BR CLEAR="right" />
|
||||
@@ -131,12 +131,10 @@
|
||||
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Download Utility</h2>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
<img src="modules/MaterialDeck/wiki/img/DownloadUtility.png" align="right" HSPACE="5" width="350">
|
||||
The download utility allows you to easily check the current version of the Stream Deck plugin and Material Server, and gives you the option to download the latest version.<br>
|
||||
Please note that the current version of Material Server is at the moment not supported.<br>
|
||||
The download utility allows you to easily check the current version of the Stream Deck plugin and Material Companion, and gives you the option to download the latest version.<br>
|
||||
Please note that the current version of Material Companion is at the moment not supported.<br>
|
||||
<br>
|
||||
At the bottom you can also download the default profiles from <a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Github</a><div class=""></div><br>
|
||||
<br>
|
||||
The refresh button at the bottom refreshes the page in case there was a connection issue.
|
||||
At the bottom you can also download the default profiles from <a href="https://github.com/MaterialFoundry/MaterialDeck_SD/releases">Github</a>.<div class=""></div><br>
|
||||
|
||||
<BR CLEAR="right" />
|
||||
</div>
|
||||
@@ -144,7 +142,7 @@
|
||||
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Playlist Configuration</h2>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
<img src="modules/MaterialDeck/wiki/img/PlaylistConfig.png" align="right" HSPACE="5" width="350">
|
||||
The playlist configuration screen configures the playlists that you control using the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Playlist-Action">Playlist action</a>.<br>
|
||||
The playlist configuration screen configures the playlists that you control using the <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Playlist-Action">Playlist action</a>.<br>
|
||||
There are 2 sections: 'Settings', and 'Playlists'.
|
||||
|
||||
<h3><b>Settings</b></h3>
|
||||
@@ -174,7 +172,7 @@
|
||||
|
||||
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Macro Configuration</h2>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
The Macro Configuration screen is to configure the macroboard for the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Macro-Action">Macro action</a>.<br>
|
||||
The Macro Configuration screen is to configure the macroboard for the <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Macro-Action">Macro action</a>.<br>
|
||||
<br>
|
||||
The screen is divided into 32 boxes, each labeled 'Macro #', where each represents a single macro and its settings. This screen will be refered to as a page.
|
||||
By pressing the arrows at the top right and top left, you can go to the next or previous page. There is no limit to the amount of pages you can add, but if you
|
||||
@@ -206,7 +204,7 @@
|
||||
|
||||
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Soundboard Configuration</h2>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
The Soundboard Configuration screen is used to configure the soundboard for the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Soundboard-Action">Soundboard action</a>.<br>
|
||||
The Soundboard Configuration screen is used to configure the soundboard for the <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Soundboard-Action">Soundboard action</a>.<br>
|
||||
<br>
|
||||
Similar to the Macro Configuration screen, the screen is divided into boxes, each labeled 'Sound #', where each represents a single sound and its settings. This screen will be refered to as a page.
|
||||
By pressing the arrows at the top right and top left, you can go to the next or previous page. There is no limit to the amount of pages you can add, but if you
|
||||
@@ -223,7 +221,7 @@
|
||||
For example, if you have the sounds 'Thunder.wav', 'Thunder2.wav' and 'Thunder3.wav' in the folder 'Assets', you could fill in the following: 'Assets/Thunder*', which
|
||||
will play one of the three sounds randomly when you press the button on the Stream Deck.</li>
|
||||
<li><b>Icon</b> - Here you can select an icon that will be displayed on the SD button if 'Display Icon' is selected in the property inspector.
|
||||
Please read <a href="https://github.com/CDeenen/MaterialDeck/wiki/Getting-Started#important-notes-on-foundry-assigned-text-and-icons">these</a> notes on rules regarding icon selection.</li>
|
||||
Please read <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Getting-Started#important-notes-on-foundry-assigned-text-and-icons">these</a> notes on rules regarding icon selection.</li>
|
||||
<li><b>On</b> - Clicking the colored box you'll be presented with a color picker. This sets the color of the ring that's shown on the button when the sound is playing.</li>
|
||||
<li><b>Off</b> - Clicking the colored box you'll be presented with a color picker. This sets the color of the ring that's shown on the button when the sound is not playing.</li>
|
||||
<li><b>Playback</b> - This sets the playback mode, you can select from:
|
||||
@@ -254,31 +252,31 @@
|
||||
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Customization</h1>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
Material Deck is extremely flexible, but most of this flexibility must be performed in the Stream Deck software.<br>
|
||||
Some basic instructions on using the software can be found <a href="https://github.com/CDeenen/MaterialDeck/wiki/Getting-Started#basic-stream-deck-setup-instructions">here</a>.<br>
|
||||
Some basic instructions on using the software can be found <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Getting-Started#basic-stream-deck-setup-instructions">here</a>.<br>
|
||||
<br>
|
||||
Some of the things you can change are:
|
||||
<ul>
|
||||
<li><b>Button location</b> - You can drag buttons around into any order you want</li>
|
||||
<li><b>Changing button text and icon</b> - All the text and icons on the Stream Deck can be customized, see <a href="https://github.com/CDeenen/MaterialDeck/wiki/Getting-Started#changing-the-button-text-and-icon">here</a></li>
|
||||
<li><b>Changing button text and icon</b> - All the text and icons on the Stream Deck can be customized, see <a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Getting-Started#changing-the-button-text-and-icon">here</a></li>
|
||||
<li><b>Customize the behavior of buttons</b> - See below</li>
|
||||
</ul>
|
||||
All the buttons have many settings to fine-tune your experience. Due to the large amount of things you can change, they will not be discussed here, instead you can read about it at the following links:
|
||||
<ul>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Combat-Tracker-Action">Combat Tracker Action</a></li>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/External-Modules">External Modules</a></li>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Macro-Action">Macro Action</a></li>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Other-Actions">Other Actions</a></li>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Playlist-Action">Playlist Action</a></li>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Scene-Action">Scene Action</a></li>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Soundboard-Action">Soundboard Action</a></li>
|
||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Token-Action">Token Action</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Combat-Tracker-Action">Combat Tracker Action</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/External-Modules">External Modules</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Macro-Action">Macro Action</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Other-Actions">Other Actions</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Playlist-Action">Playlist Action</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Scene-Action">Scene Action</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Soundboard-Action">Soundboard Action</a></li>
|
||||
<li><a href="https://github.com/MaterialFoundry/MaterialDeck/wiki/Token-Action">Token Action</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Feedback & Credits</h1>
|
||||
<div class="materialDeck_helpMenu_collapsed">
|
||||
If you have any suggestions or bugs to report, feel free to create an issue, contact me on Discord (Cris#6864), or send me an email: cdeenen@outlook.com.<br>
|
||||
If you have any suggestions or bugs to report, feel free to create an issue, contact me on Discord (Cris#6864), or send me an email: info@materialfoundry.nl.<br>
|
||||
<br>
|
||||
<b>Author:</b> Cristian Deenen (Cris#6864 on Discord)<br>
|
||||
<br>
|
||||
|
||||
@@ -14,12 +14,19 @@
|
||||
|
||||
{{#each macroData}}
|
||||
<div class="form-group" style="width:100%">
|
||||
{{#each this.dataThis}}
|
||||
{{#each this.macroRowConfig}}
|
||||
<div class="materialDeck_macroConfig_boxed">
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Macro"}} {{this.iteration}}
|
||||
</div>
|
||||
<div>
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Label"}}
|
||||
</div>
|
||||
<input type="text" value="{{this.label}}" name="macroLabel" id="materialDeck_macroConfig_label{{this.iteration}}" style="width:100%;" >
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Macro"}}
|
||||
</div>
|
||||
<select name="macros" class="macros-select" id="materialDeck_macroConfig_macros{{this.iteration}}" default="" style="width:100%;">
|
||||
{{#select this.macro}}
|
||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||
|
||||