Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
484b7a0b7f | ||
|
|
bf8c5c0076 |
@@ -22,7 +22,6 @@ export var externalModules;
|
|||||||
export var sceneControl;
|
export var sceneControl;
|
||||||
|
|
||||||
export const moduleName = "MaterialDeck";
|
export const moduleName = "MaterialDeck";
|
||||||
export var selectedTokenId;
|
|
||||||
|
|
||||||
let ready = false;
|
let ready = false;
|
||||||
let activeSounds = [];
|
let activeSounds = [];
|
||||||
@@ -30,7 +29,7 @@ let activeSounds = [];
|
|||||||
export let hotbarUses = false;
|
export let hotbarUses = false;
|
||||||
export let calculateHotbarUses;
|
export let calculateHotbarUses;
|
||||||
|
|
||||||
|
let controlTokenTimer;
|
||||||
|
|
||||||
//CONFIG.debug.hooks = true;
|
//CONFIG.debug.hooks = true;
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -116,7 +115,7 @@ async function analyzeWSmessage(msg){
|
|||||||
|
|
||||||
if (action == 'token'){
|
if (action == 'token'){
|
||||||
tokenControl.active = true;
|
tokenControl.active = true;
|
||||||
tokenControl.update(device,selectedTokenId,device);
|
tokenControl.pushData(canvas.tokens.controlled[0]?.id,settings,context,device);
|
||||||
}
|
}
|
||||||
else if (action == 'move')
|
else if (action == 'move')
|
||||||
move.update(settings,context,device);
|
move.update(settings,context,device);
|
||||||
@@ -317,6 +316,43 @@ Hooks.once('ready', async()=>{
|
|||||||
for (let i=0; i<64; i++)
|
for (let i=0; i<64; i++)
|
||||||
activeSounds[i] = false;
|
activeSounds[i] = false;
|
||||||
|
|
||||||
|
if (game.user.isGM) {
|
||||||
|
let soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
|
||||||
|
let macroSettings = game.settings.get(moduleName, 'macroSettings');
|
||||||
|
let array = [];
|
||||||
|
for (let i=0; i<64; i++) array[i] = "";
|
||||||
|
let arrayVolume = [];
|
||||||
|
for (let i=0; i<64; i++) arrayVolume[i] = "50";
|
||||||
|
let arrayZero = [];
|
||||||
|
for (let i=0; i<64; i++) arrayZero[i] = "0";
|
||||||
|
|
||||||
|
if (macroSettings.color == undefined){
|
||||||
|
game.settings.set(moduleName,'macroSettings',{
|
||||||
|
macros: array,
|
||||||
|
color: arrayZero
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const settings = {
|
||||||
|
playlist: "",
|
||||||
|
sounds: array,
|
||||||
|
colorOn: arrayZero,
|
||||||
|
colorOff: arrayZero,
|
||||||
|
mode: arrayZero,
|
||||||
|
toggle: arrayZero,
|
||||||
|
volume: arrayVolume
|
||||||
|
};
|
||||||
|
if (soundBoardSettings.colorOff == undefined){
|
||||||
|
game.settings.set(moduleName,'soundboardSettings',settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (enableModule == false) return;
|
if (enableModule == false) return;
|
||||||
if (getPermission('ENABLE') == false) {
|
if (getPermission('ENABLE') == false) {
|
||||||
ready = true;
|
ready = true;
|
||||||
@@ -325,45 +361,14 @@ Hooks.once('ready', async()=>{
|
|||||||
|
|
||||||
startWebsocket();
|
startWebsocket();
|
||||||
|
|
||||||
let soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
|
|
||||||
let macroSettings = game.settings.get(moduleName, 'macroSettings');
|
|
||||||
let array = [];
|
|
||||||
for (let i=0; i<64; i++) array[i] = "";
|
|
||||||
let arrayVolume = [];
|
|
||||||
for (let i=0; i<64; i++) arrayVolume[i] = "50";
|
|
||||||
let arrayZero = [];
|
|
||||||
for (let i=0; i<64; i++) arrayZero[i] = "0";
|
|
||||||
|
|
||||||
if (macroSettings.color == undefined){
|
|
||||||
game.settings.set(moduleName,'macroSettings',{
|
|
||||||
macros: array,
|
|
||||||
color: arrayZero
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (soundBoardSettings.colorOff == undefined){
|
|
||||||
game.settings.set(moduleName,'soundboardSettings',{
|
|
||||||
playlist: "",
|
|
||||||
sounds: array,
|
|
||||||
colorOn: arrayZero,
|
|
||||||
colorOff: arrayZero,
|
|
||||||
mode: arrayZero,
|
|
||||||
toggle: arrayZero,
|
|
||||||
volume: arrayVolume
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const hotbarUsesTemp = game.modules.get("illandril-hotbar-uses");
|
const hotbarUsesTemp = game.modules.get("illandril-hotbar-uses");
|
||||||
if (hotbarUsesTemp != undefined) {
|
if (hotbarUsesTemp != undefined) hotbarUses = true;
|
||||||
hotbarUses = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on('updateToken',(scene,token)=>{
|
Hooks.on('updateToken',(scene,token)=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
let tokenId = token._id;
|
let tokenId = token._id;
|
||||||
if (tokenId == selectedTokenId)
|
if (tokenId == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||||
tokenControl.update(selectedTokenId);
|
|
||||||
if (macroControl != undefined) macroControl.updateAll();
|
if (macroControl != undefined) macroControl.updateAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -373,8 +378,10 @@ Hooks.on('updateActor',(scene,actor)=>{
|
|||||||
for (let i=0; i<children.length; i++){
|
for (let i=0; i<children.length; i++){
|
||||||
if (children[i].actor.id == actor._id){
|
if (children[i].actor.id == actor._id){
|
||||||
let tokenId = children[i].id;
|
let tokenId = children[i].id;
|
||||||
if (tokenId == selectedTokenId)
|
if (tokenId == canvas.tokens.controlled[0]?.id) {
|
||||||
tokenControl.update(selectedTokenId);
|
tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (macroControl != undefined) macroControl.updateAll();
|
if (macroControl != undefined) macroControl.updateAll();
|
||||||
@@ -383,12 +390,16 @@ Hooks.on('updateActor',(scene,actor)=>{
|
|||||||
Hooks.on('controlToken',(token,controlled)=>{
|
Hooks.on('controlToken',(token,controlled)=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
if (controlled) {
|
if (controlled) {
|
||||||
selectedTokenId = token.data._id;
|
tokenControl.update(token.data._id);
|
||||||
|
if (controlTokenTimer != undefined) {
|
||||||
|
clearTimeout(controlTokenTimer);
|
||||||
|
controlTokenTimer = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
selectedTokenId = undefined;
|
controlTokenTimer = setTimeout(function(){tokenControl.update(canvas.tokens.controlled[0]?.id);},10)
|
||||||
}
|
}
|
||||||
tokenControl.update(selectedTokenId);
|
|
||||||
if (macroControl != undefined) macroControl.updateAll();
|
if (macroControl != undefined) macroControl.updateAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -397,7 +408,6 @@ Hooks.on('updateOwnedItem',()=>{
|
|||||||
})
|
})
|
||||||
|
|
||||||
Hooks.on('renderHotbar', (hotbar)=>{
|
Hooks.on('renderHotbar', (hotbar)=>{
|
||||||
if (compatibleCore("0.8.1")) return;
|
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
if (macroControl != undefined) macroControl.hotbar(hotbar.macros);
|
if (macroControl != undefined) macroControl.hotbar(hotbar.macros);
|
||||||
});
|
});
|
||||||
@@ -412,7 +422,7 @@ Hooks.on('render', (app)=>{
|
|||||||
Hooks.on('renderCombatTracker',()=>{
|
Hooks.on('renderCombatTracker',()=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
if (combatTracker != undefined) combatTracker.updateAll();
|
if (combatTracker != undefined) combatTracker.updateAll();
|
||||||
if (tokenControl != undefined) tokenControl.update(selectedTokenId);
|
if (tokenControl != undefined) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on('renderPlaylistDirectory', (playlistDirectory)=>{
|
Hooks.on('renderPlaylistDirectory', (playlistDirectory)=>{
|
||||||
@@ -469,7 +479,7 @@ Hooks.on('renderSceneControls',()=>{
|
|||||||
|
|
||||||
Hooks.on('targetToken',(user,token,targeted)=>{
|
Hooks.on('targetToken',(user,token,targeted)=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
if (token.id == selectedTokenId) tokenControl.update(selectedTokenId);
|
if (token.id == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on('sidebarCollapse',()=>{
|
Hooks.on('sidebarCollapse',()=>{
|
||||||
|
|||||||
51
changelog.md
@@ -1,8 +1,57 @@
|
|||||||
# Changelog Material Deck Module
|
# Changelog Material Deck Module
|
||||||
|
### v1.4.3 - 05-05-2021
|
||||||
|
Fixes:
|
||||||
|
<ul>
|
||||||
|
<li>Fixed issue where the module would break if multiple Stream Decks were configured in the Stream Deck application, but not all of them had MD actions assigned to them</li>
|
||||||
|
<li>In the User Permission Configuration, the Scene Directory hint wasn't displayed properly</li>
|
||||||
|
<li>Got rid of warnings that popped up on initialization when using MD as a player</li>
|
||||||
|
<li>Fixed issue where the soundboard and macro board could not be configured by players, if it hadn't first been configured by a GM</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Other
|
||||||
|
<ul>
|
||||||
|
<li>Added compatibility for Foundry 0.8.2. Some functions no longer work in 0.8.1 (they still do in 0.7.9)</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<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.4.2 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||||
|
|
||||||
|
### v1.4.2 - 23-04-2021
|
||||||
|
Fixes:
|
||||||
|
<ul>
|
||||||
|
<li>Last update I fixed the combat tracker, but this broke something in the Token Action (if you had a token selected, it would sometimes assumed you didn't have it selected), both should now work</li>
|
||||||
|
<li>Token Action: Plugin wouldn't save text boxes (such as 'Prepend Title' or 'Custom') if they were empty</li>
|
||||||
|
<li>Token Action: Improved performance, especially when 'Token' is set to 'Selected Token', and you're selecting a new token while you had another token selected<li>
|
||||||
|
<li>Token Action => Stats => Skill Modifier: (dnd5e) Would only display the modifier, now it displays the total value (so with proficiency, if applicable)</li>
|
||||||
|
<li>Combat Tracker => Mode: Function => Function: Would not always properly load the 'Turn Display' options</li>
|
||||||
|
<li>Playlist Action: Background color would not show, and 'Off Color' wouldn't work for 'Offset'</li>
|
||||||
|
<li>Macro Action => Macro Board => Offset: Background color would not show</li>
|
||||||
|
<li>Scene Action => Offset: Background color would not show</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Additions:
|
||||||
|
<ul>
|
||||||
|
<li>Token Action: Changed the way how you can select what icon will be displayed. Instead of a true/false, there is now a selection box where you can select between 'None', 'Token Icon', 'Actor Icon' and 'Default', where the last one will display the default icon, for example the selected stat to display, the condition, etc</li>
|
||||||
|
<li>Token Action => Stats & On Click => Custom: Textbox now automatically resizes to fit the content</li>
|
||||||
|
<li>Token Action => On Click => Dice Roll: Added 'Roll Mode' option, where you can set to roll as 'default' (displays dialog), 'normal', 'advantage' or 'disadvantage'. All options, except for 'default', will ignore the previously added 'Token Roll Options' in 'Other Actions'</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Other:
|
||||||
|
<ul>
|
||||||
|
<li>Big code cleanup of the SD plugin</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<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.4.2 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||||
|
|
||||||
### v1.4.1 - 21-04-2021
|
### v1.4.1 - 21-04-2021
|
||||||
Fixes:
|
Fixes:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Last update broke the combat tracker, should now be fixed</li>
|
<li>Previous update broke the combat tracker, should now be fixed</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
### v1.4.0 - 21-04-2021
|
### v1.4.0 - 21-04-2021
|
||||||
|
|||||||
BIN
img/other/.thumb/d20.png.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
img/token/.thumb/temp_hp_empty.png.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
img/token/abilities/.thumb/cha.png.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/abilities/.thumb/cons.png.jpg
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
img/token/abilities/.thumb/dex.png.jpg
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
img/token/abilities/.thumb/int.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/abilities/.thumb/str.png.jpg
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
img/token/abilities/.thumb/wis.png.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
img/token/skills/.thumb/acr.png.jpg
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
img/token/skills/.thumb/ani.png.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/skills/.thumb/arc.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/skills/.thumb/ath.png.jpg
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
img/token/skills/.thumb/dec.png.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/token/skills/.thumb/his.png.jpg
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
img/token/skills/.thumb/ins.png.jpg
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
img/token/skills/.thumb/inv.png.jpg
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
img/token/skills/.thumb/itm.png.jpg
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
img/token/skills/.thumb/med.png.jpg
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
img/token/skills/.thumb/nat.png.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/token/skills/.thumb/per.png.jpg
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
img/token/skills/.thumb/prc.png.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
img/token/skills/.thumb/prf.png.jpg
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
img/token/skills/.thumb/rel.png.jpg
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
img/token/skills/.thumb/slt.png.jpg
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
img/token/skills/.thumb/ste.png.jpg
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
img/token/skills/.thumb/sur.png.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
@@ -98,7 +98,7 @@
|
|||||||
"MaterialDeck.Perm.MACRO.MACROBOARD.label": "Macro Board",
|
"MaterialDeck.Perm.MACRO.MACROBOARD.label": "Macro Board",
|
||||||
"MaterialDeck.Perm.MACRO.MACROBOARD.hint": "Allow users to use the macro board",
|
"MaterialDeck.Perm.MACRO.MACROBOARD.hint": "Allow users to use the macro board",
|
||||||
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.label": "Configure the Macro Board",
|
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.label": "Configure the Macro Board",
|
||||||
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "Allow users to configure the macro board",
|
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "Allow users to configure the macro board. To allow users to pick icons using the filepicker, enable 'Browse File Explorer' for that user in the core Permission Configuration",
|
||||||
|
|
||||||
"MaterialDeck.Perm.MOVE.label": "Move",
|
"MaterialDeck.Perm.MOVE.label": "Move",
|
||||||
"MaterialDeck.Perm.MOVE.TOKEN.label": "Token",
|
"MaterialDeck.Perm.MOVE.TOKEN.label": "Token",
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
"MaterialDeck.Perm.SCENE.ACTIVE.label": "Active Scene",
|
"MaterialDeck.Perm.SCENE.ACTIVE.label": "Active Scene",
|
||||||
"MaterialDeck.Perm.SCENE.ACTIVE.hint": "Allow users to view the active scene",
|
"MaterialDeck.Perm.SCENE.ACTIVE.hint": "Allow users to view the active scene",
|
||||||
"MaterialDeck.Perm.SCENE.DIRECTORY.label": "Scene Directory",
|
"MaterialDeck.Perm.SCENE.DIRECTORY.label": "Scene Directory",
|
||||||
"MaterialDeck.Perm.SCENE.DIRECTOR.hint": "Allow users to view and control scenes from the scene directory",
|
"MaterialDeck.Perm.SCENE.DIRECTORY.hint": "Allow users to view and control scenes from the scene directory",
|
||||||
"MaterialDeck.Perm.SCENE.NAME.label": "Scene by Name",
|
"MaterialDeck.Perm.SCENE.NAME.label": "Scene by Name",
|
||||||
"MaterialDeck.Perm.SCENE.NAME.hint": "Allow users to view and control any scene by name",
|
"MaterialDeck.Perm.SCENE.NAME.hint": "Allow users to view and control any scene by name",
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
"MaterialDeck.Perm.SOUNDBOARD.PLAY.label": "Enable",
|
"MaterialDeck.Perm.SOUNDBOARD.PLAY.label": "Enable",
|
||||||
"MaterialDeck.Perm.SOUNDBOARD.PLAY.hint": "Allow users to play sounds from the soundboard",
|
"MaterialDeck.Perm.SOUNDBOARD.PLAY.hint": "Allow users to play sounds from the soundboard",
|
||||||
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.label": "Configure",
|
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.label": "Configure",
|
||||||
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.hint": "Allow users to configure the soundboard",
|
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.hint": "Allow users to configure the soundboard. To allow users to pick files and icons using the filepicker, enable 'Browse File Explorer' for that user in the core Permission Configuration",
|
||||||
|
|
||||||
"MaterialDeck.Perm.TOKEN.label": "Token",
|
"MaterialDeck.Perm.TOKEN.label": "Token",
|
||||||
"MaterialDeck.Perm.TOKEN.STATS.label": "Display Stats",
|
"MaterialDeck.Perm.TOKEN.STATS.label": "Display Stats",
|
||||||
|
|||||||
63
module.json
@@ -1,25 +1,40 @@
|
|||||||
{
|
{
|
||||||
"name": "MaterialDeck",
|
"name": "MaterialDeck",
|
||||||
"title": "Material Deck",
|
"title": "Material Deck",
|
||||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||||
"version": "1.4.1",
|
"version": "1.4.3",
|
||||||
"minimumSDversion": "1.4.0",
|
"minimumSDversion": "1.4.2",
|
||||||
"minimumMSversion": "1.0.2",
|
"minimumMSversion": "1.0.2",
|
||||||
"author": "CDeenen",
|
"author": "CDeenen",
|
||||||
"esmodules": [
|
"authors": {
|
||||||
"./MaterialDeck.js"
|
"name": "CDeenen",
|
||||||
],
|
"email": "cdeenen@outlook.com",
|
||||||
"socket": true,
|
"discord": "Cris#6864",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"patreon": "MaterialFoundry",
|
||||||
"compatibleCoreVersion": "0.8.1",
|
"reddit": "CDeenen123"
|
||||||
"languages": [
|
},
|
||||||
{
|
|
||||||
"lang": "en",
|
"esmodules": [
|
||||||
"name": "English",
|
"./MaterialDeck.js"
|
||||||
"path": "lang/en.json"
|
],
|
||||||
}
|
"socket": true,
|
||||||
],
|
"minimumCoreVersion": "0.7.5",
|
||||||
"url": "https://github.com/CDeenen/MaterialDeck",
|
"compatibleCoreVersion": "0.8.2",
|
||||||
"manifest": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json",
|
"languages": [
|
||||||
"download": "https://github.com/CDeenen/MaterialDeck/archive/Master.zip"
|
{
|
||||||
}
|
"lang": "en",
|
||||||
|
"name": "English",
|
||||||
|
"path": "lang/en.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"media": [
|
||||||
|
{
|
||||||
|
"type": "icon",
|
||||||
|
"url": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/img/MaterialFoundry512x512.png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ export class CombatTracker{
|
|||||||
async updateAll(){
|
async updateAll(){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'combattracker') continue;
|
if (data == undefined || data.action != 'combattracker') continue;
|
||||||
@@ -28,6 +29,7 @@ export class CombatTracker{
|
|||||||
let txt = "";
|
let txt = "";
|
||||||
let background = "#000000";
|
let background = "#000000";
|
||||||
settings.combat = true;
|
settings.combat = true;
|
||||||
|
settings.icon = settings.displayIcon ? 'tokenIcon' : 'none';
|
||||||
|
|
||||||
if (mode == 'combatants'){
|
if (mode == 'combatants'){
|
||||||
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export class ExternalModules{
|
|||||||
}
|
}
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'external') continue;
|
if (data == undefined || data.action != 'external') continue;
|
||||||
|
|||||||
79
src/macro.js
@@ -11,6 +11,7 @@ export class MacroControl{
|
|||||||
async updateAll(){
|
async updateAll(){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'macro') continue;
|
if (data == undefined || data.action != 'macro') continue;
|
||||||
@@ -51,6 +52,7 @@ export class MacroControl{
|
|||||||
|
|
||||||
ringColor = (macroOffset == parseInt(this.offset)) ? ringOnColor : ringOffColor;
|
ringColor = (macroOffset == parseInt(this.offset)) ? ringOnColor : ringOffColor;
|
||||||
ring = 2;
|
ring = 2;
|
||||||
|
src = "modules/MaterialDeck/img/transparant.png";
|
||||||
}
|
}
|
||||||
else { //Execute macro
|
else { //Execute macro
|
||||||
macroNumber += this.offset - 1;
|
macroNumber += this.offset - 1;
|
||||||
@@ -108,48 +110,51 @@ export class MacroControl{
|
|||||||
return uses;
|
return uses;
|
||||||
}
|
}
|
||||||
|
|
||||||
async hotbar(macros){
|
async hotbar(){
|
||||||
for (let i=0; i<32; i++){
|
for (let device of streamDeck.buttonContext) {
|
||||||
const data = streamDeck.buttonContext[i];
|
if (device?.buttons == undefined) continue;
|
||||||
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') 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;
|
||||||
|
|
||||||
const context = data.context;
|
const context = data.context;
|
||||||
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
|
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
|
||||||
const displayName = data.settings.displayName ? data.settings.displayName : false;
|
const displayName = data.settings.displayName ? data.settings.displayName : false;
|
||||||
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
|
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
|
||||||
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
|
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
|
||||||
let background = data.settings.background ? data.settings.background : '#000000';
|
let background = data.settings.background ? data.settings.background : '#000000';
|
||||||
let macroNumber = data.settings.macroNumber;
|
let macroNumber = data.settings.macroNumber;
|
||||||
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
|
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
|
||||||
|
|
||||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
|
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let src = "";
|
let src = "";
|
||||||
let name = "";
|
let name = "";
|
||||||
|
|
||||||
if (mode == 'Macro Board') continue;
|
if (mode == 'Macro Board') continue;
|
||||||
|
|
||||||
let macroId;
|
let macroId;
|
||||||
if (mode == 'hotbar'){
|
if (mode == 'hotbar'){
|
||||||
macroId = game.user.data.hotbar[macroNumber];
|
macroId = game.user.data.hotbar[macroNumber];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (macroNumber > 9) macroNumber = 0;
|
||||||
|
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
|
||||||
|
}
|
||||||
|
let macro = undefined;
|
||||||
|
let uses = undefined;
|
||||||
|
if (macroId != undefined) macro = game.macros._source.find(p => p._id == macroId);
|
||||||
|
if (macro != undefined && macro != null) {
|
||||||
|
if (displayName) name += macro.name;
|
||||||
|
if (displayIcon) src += macro.img;
|
||||||
|
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
|
||||||
|
}
|
||||||
|
streamDeck.setIcon(context,device,src,{background:background,uses:uses});
|
||||||
|
streamDeck.setTitle(name,context);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (macroNumber > 9) macroNumber = 0;
|
|
||||||
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
|
|
||||||
}
|
|
||||||
let macro = undefined;
|
|
||||||
let uses = undefined;
|
|
||||||
if (macroId != undefined) macro = game.macros._source.find(p => p._id == macroId);
|
|
||||||
if (macro != undefined && macro != null) {
|
|
||||||
if (displayName) name += macro.name;
|
|
||||||
if (displayIcon) src += macro.img;
|
|
||||||
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
|
|
||||||
}
|
|
||||||
streamDeck.setIcon(context,device,src,{background:background,uses:uses});
|
|
||||||
streamDeck.setTitle(name,context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export class Move{
|
|||||||
const selection = settings.selection ? settings.selection : 'selected';
|
const selection = settings.selection ? settings.selection : 'selected';
|
||||||
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
||||||
|
|
||||||
if (selection == 'selected') token = canvas.tokens.children[0].children.find(p => p.id == MODULE.selectedTokenId);
|
if (selection == 'selected') token = canvas.tokens.controlled[0];
|
||||||
else if (selection != 'selected' && tokenIdentifier == '') {}
|
else if (selection != 'selected' && tokenIdentifier == '') {}
|
||||||
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
|
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
|
||||||
else if (selection == 'actorName') token = canvas.tokens.children[0].children.find(p => p.actor.name == tokenIdentifier);
|
else if (selection == 'actorName') token = canvas.tokens.children[0].children.find(p => p.actor.name == tokenIdentifier);
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ export class OtherControls{
|
|||||||
async updateAll(options={}){
|
async updateAll(options={}){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'other') continue;
|
if (data == undefined || data.action != 'other') continue;
|
||||||
await this.update(data.settings,data.context,device.device);
|
await this.update(data.settings,data.context,device.device,options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,7 +241,16 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
ui.controls.activeControl = selectedControl.name;
|
ui.controls.activeControl = selectedControl.name;
|
||||||
selectedControl.activeTool = selectedControl.activeTool;
|
selectedControl.activeTool = selectedControl.activeTool;
|
||||||
canvas.getLayer(selectedControl.layer).activate();
|
if (compatibleCore("0.8.2")) {
|
||||||
|
for (let layer of canvas.layers) {
|
||||||
|
if (layer.options == undefined) continue;
|
||||||
|
if (layer.options.name == selectedControl.layer) {
|
||||||
|
layer.activate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else canvas.getLayer(selectedControl.layer).activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (control == 'dispTools'){ //displayed tools
|
else if (control == 'dispTools'){ //displayed tools
|
||||||
@@ -281,7 +291,16 @@ export class OtherControls{
|
|||||||
if (tool == 'open'){ //open category
|
if (tool == 'open'){ //open category
|
||||||
ui.controls.activeControl = control;
|
ui.controls.activeControl = control;
|
||||||
selectedControl.activeTool = selectedControl.activeTool;
|
selectedControl.activeTool = selectedControl.activeTool;
|
||||||
canvas.getLayer(selectedControl.layer).activate();
|
if (compatibleCore("0.8.2")) {
|
||||||
|
for (let layer of canvas.layers) {
|
||||||
|
if (layer.options == undefined) continue;
|
||||||
|
if (layer.options.name == selectedControl.layer) {
|
||||||
|
layer.activate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else canvas.getLayer(selectedControl.layer).activate();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const selectedTool = selectedControl.tools.find(t => t.name == tool);
|
const selectedTool = selectedControl.tools.find(t => t.name == tool);
|
||||||
@@ -291,7 +310,16 @@ export class OtherControls{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ui.controls.activeControl = control;
|
ui.controls.activeControl = control;
|
||||||
canvas.getLayer(selectedControl.layer).activate();
|
if (compatibleCore("0.8.2")) {
|
||||||
|
for (let layer of canvas.layers) {
|
||||||
|
if (layer.options == undefined) continue;
|
||||||
|
if (layer.options.name == selectedControl.layer) {
|
||||||
|
layer.activate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else canvas.getLayer(selectedControl.layer).activate();
|
||||||
if (selectedTool.toggle) {
|
if (selectedTool.toggle) {
|
||||||
selectedTool.active = !selectedTool.active;
|
selectedTool.active = !selectedTool.active;
|
||||||
selectedTool.onClick(selectedTool.active);
|
selectedTool.onClick(selectedTool.active);
|
||||||
@@ -378,7 +406,7 @@ export class OtherControls{
|
|||||||
let actor;
|
let actor;
|
||||||
let tokenControlled = false;
|
let tokenControlled = false;
|
||||||
|
|
||||||
if (MODULE.selectedTokenId != undefined) actor = canvas.tokens.children[0].children.find(p => p.id == MODULE.selectedTokenId).actor;
|
if (canvas.tokens.controlled[0] != undefined) actor = canvas.tokens.controlled[0].actor;
|
||||||
if (actor != undefined) tokenControlled = true;
|
if (actor != undefined) tokenControlled = true;
|
||||||
|
|
||||||
let r;
|
let r;
|
||||||
@@ -418,6 +446,7 @@ export class OtherControls{
|
|||||||
|
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const table = game.tables.getName(name);
|
const table = game.tables.getName(name);
|
||||||
|
if (table == undefined) return;
|
||||||
|
|
||||||
let txt = settings.displayRollName ? table.name : '';
|
let txt = settings.displayRollName ? table.name : '';
|
||||||
let src = settings.displayRollIcon ? table.data.img : '';
|
let src = settings.displayRollIcon ? table.data.img : '';
|
||||||
@@ -509,7 +538,7 @@ export class OtherControls{
|
|||||||
if (popOut && options.sidebarTab == sidebarTab) {
|
if (popOut && options.sidebarTab == sidebarTab) {
|
||||||
ringColor = options.renderPopout ? ringOnColor : ringOffColor;
|
ringColor = options.renderPopout ? ringOnColor : ringOffColor;
|
||||||
}
|
}
|
||||||
else ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
|
else if (popOut == false) ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
|
||||||
const name = settings.displaySidebarName ? this.getSidebarName(sidebarTab) : '';
|
const name = settings.displaySidebarName ? this.getSidebarName(sidebarTab) : '';
|
||||||
const icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
|
const icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export class PlaylistControl{
|
|||||||
async updateAll(){
|
async updateAll(){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'playlist') continue;
|
if (data == undefined || data.action != 'playlist') continue;
|
||||||
@@ -52,6 +53,7 @@ export class PlaylistControl{
|
|||||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||||
|
let src = "modules/MaterialDeck/img/transparant.png";
|
||||||
|
|
||||||
//Play/Stop
|
//Play/Stop
|
||||||
if (playlistType == 'playStop'){
|
if (playlistType == 'playStop'){
|
||||||
@@ -74,7 +76,7 @@ export class PlaylistControl{
|
|||||||
else if (playlistType == 'offset') {
|
else if (playlistType == 'offset') {
|
||||||
let playlistOffset = parseInt(settings.offset);
|
let playlistOffset = parseInt(settings.offset);
|
||||||
if (isNaN(playlistOffset)) playlistOffset = 0;
|
if (isNaN(playlistOffset)) playlistOffset = 0;
|
||||||
if (playlistOffset == this.playlistOffset) ringColor = ringOnColor;
|
ringColor = (playlistOffset == this.playlistOffset) ? ringOnColor : ringOffColor;
|
||||||
}
|
}
|
||||||
//Relative Offset
|
//Relative Offset
|
||||||
else if (playlistType == 'relativeOffset') {
|
else if (playlistType == 'relativeOffset') {
|
||||||
@@ -87,7 +89,7 @@ export class PlaylistControl{
|
|||||||
const targetPlaylist = this.getPlaylist(number);
|
const targetPlaylist = this.getPlaylist(number);
|
||||||
if (targetPlaylist != undefined) name = targetPlaylist.name;
|
if (targetPlaylist != undefined) name = targetPlaylist.name;
|
||||||
}
|
}
|
||||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +100,7 @@ export class PlaylistControl{
|
|||||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||||
|
let src = "modules/MaterialDeck/img/transparant.png";
|
||||||
|
|
||||||
//Play/Stop
|
//Play/Stop
|
||||||
if (playlistType == 'playStop'){
|
if (playlistType == 'playStop'){
|
||||||
@@ -130,12 +133,12 @@ export class PlaylistControl{
|
|||||||
else if (playlistType == 'offset') {
|
else if (playlistType == 'offset') {
|
||||||
let trackOffset = parseInt(settings.offset);
|
let trackOffset = parseInt(settings.offset);
|
||||||
if (isNaN(trackOffset)) trackOffset = 0;
|
if (isNaN(trackOffset)) trackOffset = 0;
|
||||||
if (trackOffset == this.trackOffset) ringColor = ringOnColor;
|
ringColor = (trackOffset == this.trackOffset) ? ringOnColor : ringOffColor;
|
||||||
}
|
}
|
||||||
//Relative Offset
|
//Relative Offset
|
||||||
else if (playlistType == 'relativeOffset') {
|
else if (playlistType == 'relativeOffset') {
|
||||||
}
|
}
|
||||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export class SceneControl{
|
|||||||
async updateAll(){
|
async updateAll(){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'scene') continue;
|
if (data == undefined || data.action != 'scene') continue;
|
||||||
@@ -114,8 +115,8 @@ export class SceneControl{
|
|||||||
else if (func == 'offset'){
|
else if (func == 'offset'){
|
||||||
let offset = parseInt(settings.sceneOffset);
|
let offset = parseInt(settings.sceneOffset);
|
||||||
if (isNaN(offset)) offset = 0;
|
if (isNaN(offset)) offset = 0;
|
||||||
if (offset == this.sceneOffset) ringColor = ringOnColor;
|
ringColor = (offset == this.sceneOffset) ? ringOnColor : ringOffColor;
|
||||||
else ringColor = ringOffColor;
|
src = "modules/MaterialDeck/img/transparant.png";
|
||||||
}
|
}
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||||
|
|||||||
@@ -222,7 +222,8 @@ export const registerSettings = async function() {
|
|||||||
if (permissionSettings.permissions.TOKEN.OBSERVER == undefined) permissionSettings.permissions.TOKEN.OBSERVER = [false,true,true,true];
|
if (permissionSettings.permissions.TOKEN.OBSERVER == undefined) permissionSettings.permissions.TOKEN.OBSERVER = [false,true,true,true];
|
||||||
if (permissionSettings.permissions.MACRO.BY_NAME == undefined) permissionSettings.permissions.MACRO.BY_NAME = [false,false,true,true];
|
if (permissionSettings.permissions.MACRO.BY_NAME == undefined) permissionSettings.permissions.MACRO.BY_NAME = [false,false,true,true];
|
||||||
}
|
}
|
||||||
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
|
if (game.user.isGM)
|
||||||
|
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export class SoundboardControl{
|
|||||||
async updateAll(){
|
async updateAll(){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'soundboard') continue;
|
if (data == undefined || data.action != 'soundboard') continue;
|
||||||
@@ -171,7 +172,7 @@ export class SoundboardControl{
|
|||||||
volume *= game.settings.get("core", "globalAmbientVolume");
|
volume *= game.settings.get("core", "globalAmbientVolume");
|
||||||
|
|
||||||
if (compatibleCore("0.8.1")) {
|
if (compatibleCore("0.8.1")) {
|
||||||
let newSound = new SoundNode(src);
|
let newSound = new Sound(src);
|
||||||
if(newSound.loaded == false) await newSound.load({autoplay:true});
|
if(newSound.loaded == false) await newSound.load({autoplay:true});
|
||||||
newSound.on('end', ()=>{
|
newSound.on('end', ()=>{
|
||||||
if (repeat == false) {
|
if (repeat == false) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export class StreamDeck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings){
|
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings){
|
||||||
|
if (device == undefined) return;
|
||||||
if (this.buttonContext[iteration] == undefined) {
|
if (this.buttonContext[iteration] == undefined) {
|
||||||
const deckSize = size.columns*size.rows;
|
const deckSize = size.columns*size.rows;
|
||||||
let buttons = [];
|
let buttons = [];
|
||||||
|
|||||||
91
src/token.js
@@ -11,6 +11,7 @@ export class TokenControl{
|
|||||||
async update(tokenId=null){
|
async update(tokenId=null){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'token') continue;
|
if (data == undefined || data.action != 'token') continue;
|
||||||
@@ -21,7 +22,7 @@ export class TokenControl{
|
|||||||
|
|
||||||
async pushData(tokenId,settings,context,device,ring=0,ringColor='#000000'){
|
async pushData(tokenId,settings,context,device,ring=0,ringColor='#000000'){
|
||||||
const name = settings.displayName ? settings.displayName : false;
|
const name = settings.displayName ? settings.displayName : false;
|
||||||
const icon = settings.displayIcon ? settings.displayIcon : false;
|
const icon = settings.icon ? settings.icon : 'none';
|
||||||
const background = settings.background ? settings.background : "#000000";
|
const background = settings.background ? settings.background : "#000000";
|
||||||
let stats = settings.stats ? settings.stats : 'none';
|
let stats = settings.stats ? settings.stats : 'none';
|
||||||
const selection = settings.selection ? settings.selection : 'selected';
|
const selection = settings.selection ? settings.selection : 'selected';
|
||||||
@@ -30,7 +31,10 @@ export class TokenControl{
|
|||||||
|
|
||||||
let validToken = false;
|
let validToken = false;
|
||||||
let token;
|
let token;
|
||||||
if (tokenId != undefined && tokenId != null) token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
if (settings.combatTrackerMode) {
|
||||||
|
const mode = settings.combatTrackerMode;
|
||||||
|
token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||||
|
}
|
||||||
else if (selection == 'selected') token = canvas.tokens.controlled[0];
|
else if (selection == 'selected') token = canvas.tokens.controlled[0];
|
||||||
else if (selection != 'selected' && tokenIdentifier == '') {}
|
else if (selection != 'selected' && tokenIdentifier == '') {}
|
||||||
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
|
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
|
||||||
@@ -76,7 +80,8 @@ export class TokenControl{
|
|||||||
stats = 'none';
|
stats = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon) iconSrc = token.data.img;
|
if (icon == 'tokenIcon') iconSrc = token.data.img;
|
||||||
|
else if (icon == 'actorIcon') iconSrc = token.actor.data.img;
|
||||||
if (name && stats != 'none' && stats != 'HPbox') txt += "\n";
|
if (name && stats != 'none' && stats != 'HPbox') txt += "\n";
|
||||||
if (stats == 'custom'){
|
if (stats == 'custom'){
|
||||||
const custom = settings.custom ? settings.custom : '';
|
const custom = settings.custom ? settings.custom : '';
|
||||||
@@ -99,7 +104,7 @@ export class TokenControl{
|
|||||||
else if (game.system.id == 'dnd5e'){
|
else if (game.system.id == 'dnd5e'){
|
||||||
let attributes = token.actor.data.data.attributes;
|
let attributes = token.actor.data.data.attributes;
|
||||||
if (stats == 'HP') {
|
if (stats == 'HP') {
|
||||||
if (!icon) {
|
if (icon == 'stats') {
|
||||||
uses = {
|
uses = {
|
||||||
available: attributes.hp.value,
|
available: attributes.hp.value,
|
||||||
maximum: attributes.hp.max,
|
maximum: attributes.hp.max,
|
||||||
@@ -119,7 +124,7 @@ export class TokenControl{
|
|||||||
else if (stats == 'TempHP') {
|
else if (stats == 'TempHP') {
|
||||||
const val = (attributes.hp.temp == null) ? 0 : attributes.hp.temp;
|
const val = (attributes.hp.temp == null) ? 0 : attributes.hp.temp;
|
||||||
const max = (attributes.hp.tempmax == null) ? 0 : attributes.hp.tempmax
|
const max = (attributes.hp.tempmax == null) ? 0 : attributes.hp.tempmax
|
||||||
if (!icon) {
|
if (icon == 'stats') {
|
||||||
uses = {
|
uses = {
|
||||||
available: (attributes.hp.temp == null) ? 0 : attributes.hp.temp,
|
available: (attributes.hp.temp == null) ? 0 : attributes.hp.temp,
|
||||||
maximum: (max == 0) ? 1 : attributes.hp.tempmax,
|
maximum: (max == 0) ? 1 : attributes.hp.tempmax,
|
||||||
@@ -186,7 +191,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (stats == 'Skill') {
|
else if (stats == 'Skill') {
|
||||||
const skill = settings.skill ? settings.skill : 'acr';
|
const skill = settings.skill ? settings.skill : 'acr';
|
||||||
const value = token.actor.data.data.skills?.[skill].mod;
|
const value = token.actor.data.data.skills?.[skill].total;
|
||||||
if (value >= 0) txt += '+';
|
if (value >= 0) txt += '+';
|
||||||
txt += value;
|
txt += value;
|
||||||
}
|
}
|
||||||
@@ -200,7 +205,7 @@ export class TokenControl{
|
|||||||
else if (game.system.id == 'D35E' || game.system.id == 'pf1'){
|
else if (game.system.id == 'D35E' || game.system.id == 'pf1'){
|
||||||
let attributes = token.actor.data.data.attributes;
|
let attributes = token.actor.data.data.attributes;
|
||||||
if (stats == 'HP') {
|
if (stats == 'HP') {
|
||||||
if (!icon) {
|
if (icon == 'stats') {
|
||||||
uses = {
|
uses = {
|
||||||
available: attributes.hp.value,
|
available: attributes.hp.value,
|
||||||
maximum: attributes.hp.max,
|
maximum: attributes.hp.max,
|
||||||
@@ -273,7 +278,7 @@ export class TokenControl{
|
|||||||
else if (game.system.id == 'pf2e'){
|
else if (game.system.id == 'pf2e'){
|
||||||
let attributes = token.actor.data.data.attributes;
|
let attributes = token.actor.data.data.attributes;
|
||||||
if (stats == 'HP') {
|
if (stats == 'HP') {
|
||||||
if (!icon) {
|
if (icon == 'stats') {
|
||||||
uses = {
|
uses = {
|
||||||
available: attributes.hp.value,
|
available: attributes.hp.value,
|
||||||
maximum: attributes.hp.max,
|
maximum: attributes.hp.max,
|
||||||
@@ -341,7 +346,7 @@ export class TokenControl{
|
|||||||
else if (game.system.id == 'demonlord'){
|
else if (game.system.id == 'demonlord'){
|
||||||
let characteristics = token.actor.data.data.characteristics;
|
let characteristics = token.actor.data.data.characteristics;
|
||||||
if (stats == 'HP') {
|
if (stats == 'HP') {
|
||||||
if (!icon) {
|
if (icon == 'stats') {
|
||||||
uses = {
|
uses = {
|
||||||
available: attributes.hp.value,
|
available: attributes.hp.value,
|
||||||
maximum: attributes.hp.max,
|
maximum: attributes.hp.max,
|
||||||
@@ -391,7 +396,7 @@ export class TokenControl{
|
|||||||
ring = 2;
|
ring = 2;
|
||||||
ringColor = "#FF7B00";
|
ringColor = "#FF7B00";
|
||||||
}
|
}
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
iconSrc = window.CONFIG.controlIcons.visibility;
|
iconSrc = window.CONFIG.controlIcons.visibility;
|
||||||
overlay = true;
|
overlay = true;
|
||||||
}
|
}
|
||||||
@@ -406,7 +411,7 @@ export class TokenControl{
|
|||||||
ring = 2;
|
ring = 2;
|
||||||
ringColor = "#FF7B00";
|
ringColor = "#FF7B00";
|
||||||
}
|
}
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
iconSrc = window.CONFIG.controlIcons.combat;
|
iconSrc = window.CONFIG.controlIcons.combat;
|
||||||
overlay = true;
|
overlay = true;
|
||||||
}
|
}
|
||||||
@@ -417,7 +422,7 @@ export class TokenControl{
|
|||||||
ring = 2;
|
ring = 2;
|
||||||
ringColor = "#FF7B00";
|
ringColor = "#FF7B00";
|
||||||
}
|
}
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
iconSrc = "fas fa-bullseye";
|
iconSrc = "fas fa-bullseye";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,9 +434,9 @@ export class TokenControl{
|
|||||||
ring = 1;
|
ring = 1;
|
||||||
if (game.system.id == 'dnd5e' || game.system.id == 'D35E' || game.system.id == 'pf1'){
|
if (game.system.id == 'dnd5e' || game.system.id == 'D35E' || game.system.id == 'pf1'){
|
||||||
const condition = settings.condition ? settings.condition : 'removeAll';
|
const condition = settings.condition ? settings.condition : 'removeAll';
|
||||||
if (condition == 'removeAll' && icon == false)
|
if (condition == 'removeAll' && icon == 'stats')
|
||||||
iconSrc = window.CONFIG.controlIcons.effects;
|
iconSrc = window.CONFIG.controlIcons.effects;
|
||||||
else if (icon == false) {
|
else if (icon == 'stats') {
|
||||||
let effect = CONFIG.statusEffects.find(e => e.id === condition);
|
let effect = CONFIG.statusEffects.find(e => e.id === condition);
|
||||||
iconSrc = effect.icon;
|
iconSrc = effect.icon;
|
||||||
let effects = compatibleCore("0.8.1") ? token.actor.effects.contents : token.actor.effects.entries;
|
let effects = compatibleCore("0.8.1") ? token.actor.effects.contents : token.actor.effects.entries;
|
||||||
@@ -444,9 +449,9 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (game.system.id == 'pf2e') {
|
else if (game.system.id == 'pf2e') {
|
||||||
const condition = settings.condition ? settings.condition : 'removeAll';
|
const condition = settings.condition ? settings.condition : 'removeAll';
|
||||||
if (condition == 'removeAll' && icon == false)
|
if (condition == 'removeAll' && icon == 'stats')
|
||||||
iconSrc = window.CONFIG.controlIcons.effects;
|
iconSrc = window.CONFIG.controlIcons.effects;
|
||||||
else if (icon == false) {
|
else if (icon == 'stats') {
|
||||||
let effects = token.data.effects;
|
let effects = token.data.effects;
|
||||||
for (let i=0; i<effects.length; i++){
|
for (let i=0; i<effects.length; i++){
|
||||||
if (this.pf2eCondition(condition) == effects[i]){
|
if (this.pf2eCondition(condition) == effects[i]){
|
||||||
@@ -459,9 +464,9 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (game.system.id == 'demonlord'){
|
else if (game.system.id == 'demonlord'){
|
||||||
const condition = settings.condition ? settings.condition : 'removeAll';
|
const condition = settings.condition ? settings.condition : 'removeAll';
|
||||||
if (condition == 'removeAll' && icon == false)
|
if (condition == 'removeAll' && icon == 'stats')
|
||||||
iconSrc = window.CONFIG.controlIcons.effects;
|
iconSrc = window.CONFIG.controlIcons.effects;
|
||||||
else if (icon == false) {
|
else if (icon == 'stats') {
|
||||||
let effect = CONFIG.statusEffects.find(e => e.id === condition);
|
let effect = CONFIG.statusEffects.find(e => e.id === condition);
|
||||||
iconSrc = effect.icon;
|
iconSrc = effect.icon;
|
||||||
let effects = token.actor.effects.entries;
|
let effects = token.actor.effects.entries;
|
||||||
@@ -485,7 +490,7 @@ export class TokenControl{
|
|||||||
overlay = true;
|
overlay = true;
|
||||||
const condition = settings.cubConditionName;
|
const condition = settings.cubConditionName;
|
||||||
if (condition == undefined || condition == '') return;
|
if (condition == undefined || condition == '') return;
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
let effect = CONFIG.statusEffects.find(e => e.label === condition);
|
let effect = CONFIG.statusEffects.find(e => e.label === condition);
|
||||||
iconSrc = effect.icon;
|
iconSrc = effect.icon;
|
||||||
let effects = compatibleCore("0.8.1") ? token.actor.effects.contents : token.actor.effects.entries;
|
let effects = compatibleCore("0.8.1") ? token.actor.effects.contents : token.actor.effects.entries;
|
||||||
@@ -501,7 +506,7 @@ export class TokenControl{
|
|||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (icon == false) return;
|
if (icon != 'stats') return;
|
||||||
const method = settings.wildcardMethod ? settings.wildcardMethod : 'iterate';
|
const method = settings.wildcardMethod ? settings.wildcardMethod : 'iterate';
|
||||||
let value = parseInt(settings.wildcardValue);
|
let value = parseInt(settings.wildcardValue);
|
||||||
if (isNaN(value)) value = 1;
|
if (isNaN(value)) value = 1;
|
||||||
@@ -541,7 +546,7 @@ export class TokenControl{
|
|||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
iconSrc = window.CONFIG.controlIcons.visibility;
|
iconSrc = window.CONFIG.controlIcons.visibility;
|
||||||
ring = 2;
|
ring = 2;
|
||||||
overlay = true;
|
overlay = true;
|
||||||
@@ -552,14 +557,14 @@ export class TokenControl{
|
|||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
iconSrc = window.CONFIG.controlIcons.combat;
|
iconSrc = window.CONFIG.controlIcons.combat;
|
||||||
ring = 2;
|
ring = 2;
|
||||||
overlay = true;
|
overlay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'target') { //target token
|
else if (settings.onClick == 'target') { //target token
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
iconSrc = "fas fa-bullseye";
|
iconSrc = "fas fa-bullseye";
|
||||||
ring = 2;
|
ring = 2;
|
||||||
overlay = true;
|
overlay = true;
|
||||||
@@ -574,21 +579,21 @@ export class TokenControl{
|
|||||||
const condition = settings.condition ? settings.condition : 'removeAll';
|
const condition = settings.condition ? settings.condition : 'removeAll';
|
||||||
if (condition == 'removeAll' && icon == false)
|
if (condition == 'removeAll' && icon == false)
|
||||||
iconSrc = window.CONFIG.controlIcons.effects;
|
iconSrc = window.CONFIG.controlIcons.effects;
|
||||||
else if (icon == false)
|
else if (icon == 'stats')
|
||||||
iconSrc = CONFIG.statusEffects.find(e => e.id === condition).icon;
|
iconSrc = CONFIG.statusEffects.find(e => e.id === condition).icon;
|
||||||
}
|
}
|
||||||
else if (game.system.id == 'pf2e') {
|
else if (game.system.id == 'pf2e') {
|
||||||
const condition = settings.condition ? settings.condition : 'removeAll';
|
const condition = settings.condition ? settings.condition : 'removeAll';
|
||||||
if (condition == 'removeAll' && icon == false)
|
if (condition == 'removeAll' && icon == 'stats')
|
||||||
iconSrc = window.CONFIG.controlIcons.effects;
|
iconSrc = window.CONFIG.controlIcons.effects;
|
||||||
else if (icon == false)
|
else if (icon == 'stats')
|
||||||
iconSrc = this.pf2eCondition(condition);
|
iconSrc = this.pf2eCondition(condition);
|
||||||
}
|
}
|
||||||
else if (game.system.id == 'demonlord'){
|
else if (game.system.id == 'demonlord'){
|
||||||
const condition = settings.condition ? settings.condition : 'removeAll';
|
const condition = settings.condition ? settings.condition : 'removeAll';
|
||||||
if (condition == 'removeAll' && icon == false)
|
if (condition == 'removeAll' && icon == 'stats')
|
||||||
iconSrc = window.CONFIG.controlIcons.effects;
|
iconSrc = window.CONFIG.controlIcons.effects;
|
||||||
else if (icon == false)
|
else if (icon == 'stats')
|
||||||
iconSrc = CONFIG.statusEffects.find(e => e.id === condition).icon;
|
iconSrc = CONFIG.statusEffects.find(e => e.id === condition).icon;
|
||||||
}
|
}
|
||||||
ring = 1;
|
ring = 1;
|
||||||
@@ -601,7 +606,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
const condition = settings.cubConditionName;
|
const condition = settings.cubConditionName;
|
||||||
if (condition == undefined || condition == '') return;
|
if (condition == undefined || condition == '') return;
|
||||||
if (icon == false) {
|
if (icon == 'stats') {
|
||||||
iconSrc = CONFIG.statusEffects.find(e => e.label === condition).icon;
|
iconSrc = CONFIG.statusEffects.find(e => e.label === condition).icon;
|
||||||
}
|
}
|
||||||
ring = 1;
|
ring = 1;
|
||||||
@@ -609,7 +614,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon == false){
|
if (icon == 'stats'){
|
||||||
if (MODULE.getPermission('TOKEN','STATS') == false) stats = statsOld;
|
if (MODULE.getPermission('TOKEN','STATS') == false) stats = statsOld;
|
||||||
if (stats == 'HP') //HP
|
if (stats == 'HP') //HP
|
||||||
iconSrc = "modules/MaterialDeck/img/token/hp_empty.png";
|
iconSrc = "modules/MaterialDeck/img/token/hp_empty.png";
|
||||||
@@ -645,8 +650,7 @@ export class TokenControl{
|
|||||||
let skill = settings.skill;
|
let skill = settings.skill;
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
else iconSrc = "modules/MaterialDeck/img/token/skills/" + skill + ".png";
|
else iconSrc = "modules/MaterialDeck/img/token/skills/" + skill + ".png";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:ring,ringColor:ringColor,overlay:overlay,uses:uses,hp:hp});
|
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:ring,ringColor:ringColor,overlay:overlay,uses:uses,hp:hp});
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
@@ -655,13 +659,13 @@ export class TokenControl{
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
async keyPress(settings){
|
async keyPress(settings){
|
||||||
const tokenId = MODULE.selectedTokenId;
|
const tokenId = canvas.tokens.controlled[0]?.id;
|
||||||
|
|
||||||
const selection = settings.selection ? settings.selection : 'selected';
|
const selection = settings.selection ? settings.selection : 'selected';
|
||||||
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
||||||
|
|
||||||
let token;
|
let token;
|
||||||
if (selection == 'selected') token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
if (selection == 'selected') token = canvas.tokens.controlled[0];
|
||||||
else if (selection != 'selected' && tokenIdentifier == '') {}
|
else if (selection != 'selected' && tokenIdentifier == '') {}
|
||||||
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
|
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
|
||||||
else if (selection == 'actorName') token = canvas.tokens.children[0].children.find(p => p.actor.name == tokenIdentifier);
|
else if (selection == 'actorName') token = canvas.tokens.children[0].children.find(p => p.actor.name == tokenIdentifier);
|
||||||
@@ -830,7 +834,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (method == 'offset'){
|
else if (method == 'offset'){
|
||||||
this.wildcardOffset = value;
|
this.wildcardOffset = value;
|
||||||
this.update(MODULE.selectedTokenId);
|
this.update(canvas.tokens.controlled[0]?.id);
|
||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
@@ -851,12 +855,17 @@ export class TokenControl{
|
|||||||
const ability = settings.rollAbility ? settings.rollAbility : 'str';
|
const ability = settings.rollAbility ? settings.rollAbility : 'str';
|
||||||
const skill = settings.rollSkill ? settings.rollSkill : 'acr';
|
const skill = settings.rollSkill ? settings.rollSkill : 'acr';
|
||||||
const save = settings.rollSave ? settings.rollSave : 'str';
|
const save = settings.rollSave ? settings.rollSave : 'str';
|
||||||
const rollOptions = otherControls.rollOption ? otherControls.rollOption : 'dialog';
|
const rollMode = settings.rollMode ? settings.rollMode : 'default';
|
||||||
const options = {
|
let options;
|
||||||
fastForward: (otherControls.rollOption != 'dialog'),
|
if (rollMode == 'default')
|
||||||
advantage: (otherControls.rollOption == 'advantage'),
|
options = {
|
||||||
disadvantage: (otherControls.rollOption == 'disadvantage')
|
fastForward: (otherControls.rollOption != 'dialog'),
|
||||||
}
|
advantage: (otherControls.rollOption == 'advantage'),
|
||||||
|
disadvantage: (otherControls.rollOption == 'disadvantage')
|
||||||
|
}
|
||||||
|
else if (rollMode == 'normal') options = {fastForward:true}
|
||||||
|
else if (rollMode == 'advantage') options = {fastForward:true,advantage:true}
|
||||||
|
else if (rollMode == 'disadvantage') options = {fastForward:true,disadvantage:true}
|
||||||
|
|
||||||
if (game.system.id == 'pf2e') {
|
if (game.system.id == 'pf2e') {
|
||||||
if (roll == 'ability') token.actor.data.data.saves?.[ability].roll(options);
|
if (roll == 'ability') token.actor.data.data.saves?.[ability].roll(options);
|
||||||
|
|||||||