Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8cf974455a | ||
|
|
e7e9b84227 | ||
|
|
108c955ac2 | ||
|
|
4d320a5f6c | ||
|
|
ccacd3e26e | ||
|
|
d3c2c6465d | ||
|
|
bc0804bc08 | ||
|
|
49bc188dde | ||
|
|
dce419d7c3 | ||
|
|
4566b8ef53 | ||
|
|
1f55b324c5 | ||
|
|
a6a6cd170e | ||
|
|
cc8588bf4d | ||
|
|
117a1fb59d | ||
|
|
888a2971fb | ||
|
|
c74d27610a | ||
|
|
f4d02cf296 | ||
|
|
874d9c8fb6 | ||
|
|
66b8406615 | ||
|
|
e6c54a2b13 | ||
|
|
c01f9ec566 | ||
|
|
7bd06d7797 | ||
|
|
2fd5f81891 | ||
|
|
e8df118ce1 | ||
|
|
6e22fef160 | ||
|
|
3a52ed28b4 | ||
|
|
6c840cbf59 | ||
|
|
e58d9ca757 | ||
|
|
ce28b2da97 | ||
|
|
9c1f549791 | ||
|
|
28212f03e2 | ||
|
|
22debde812 | ||
|
|
26afbae66b | ||
|
|
a5655f46dd | ||
|
|
b4fe337824 | ||
|
|
69442aec39 | ||
|
|
9e12b7cd84 | ||
|
|
5c6a4a4223 | ||
|
|
57812d0863 | ||
|
|
560c3a573f | ||
|
|
cffa2318f7 | ||
|
|
ec207fa658 | ||
|
|
9ffa796eeb | ||
|
|
2dcbfbe096 | ||
|
|
87a031ae44 | ||
|
|
63bda666b5 | ||
|
|
6b8ca86fe2 | ||
|
|
efbbdf7760 | ||
|
|
3b30f7d439 | ||
|
|
318c16d013 | ||
|
|
1dcdcd9c0b | ||
|
|
cf95255a47 | ||
|
|
ebdc1b5e5c | ||
|
|
07a3bdd837 | ||
|
|
08fdde939a | ||
|
|
484b7a0b7f | ||
|
|
bf8c5c0076 | ||
|
|
e229abc3ee | ||
|
|
51119f42ea | ||
|
|
42e4f8f0d8 | ||
|
|
c3ee0a76aa | ||
|
|
2264d018c2 |
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: MaterialFoundry
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: materialfoundry
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
28
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Setup**
|
||||
- OS: [e.g. windows]
|
||||
- Browser: [e.g. chrome, safari, Foundry app]
|
||||
- Module version: [e.g. 1.2.5]
|
||||
- Foundry version: [e.g. 0.8.6]
|
||||
- Gaming system & version: [e.g. dnd5e 1.3.3]
|
||||
- Any other modules enabled: [yes/no]
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Console Log**
|
||||
Please check the console (F12) to see if there are any errors and also include them.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEATURE]"
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
10
.github/ISSUE_TEMPLATE/other-issues.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: Other issues
|
||||
about: For any other issues
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
40
DEVGUIDE.md
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
# Dev Guide
|
||||
|
||||
In addition to this repo, you will also need to check out the [MaterialDeck_SD github repo](https://github.com/CDeenen/MaterialDeck_SD).
|
||||
|
||||
## Module Development
|
||||
|
||||
### Make a new system.js file
|
||||
|
||||
In the [src/systems](src/systems) directory, create a new system file by copying and pasting a similar system to it; for example, `cp demonlord.js wfrp4.js`
|
||||
You then need to go through all the functions in there and make sure that the correct data is set.
|
||||
|
||||
### Update TokenHelper
|
||||
In [src/systems/TokenHelper.js](src/systems/TokenHelper.js), you need to add an `import {}` for your new system.
|
||||
|
||||
In the same file, in the setSystem() function, you need to wire in your system to the if/else block.
|
||||
|
||||
## Debugging
|
||||
|
||||
It's possible to debug on the Stream Deck, so you can do `console.log`. Just follow the instructions [from elgato here](https://developer.elgato.com/documentation/stream-deck/sdk/create-your-own-plugin/). After editing the code for the plugin, you need to either refresh by refreshing the debug window, or by deselecting the current button, and selecting it again.
|
||||
|
||||
When you go to the debugging page, there should be multiple options. With the property inspector open, you should connect to the one with property inspector in its name. If you go to to propertyinspector/js/common.js, near the top there's the debugEn variable. Set it to true, and you should get tons of messages, especially if you change any settings.
|
||||
In the module, in MaterialDeck.js, at line 60, there's //console.log("Received",data);. If you uncomment that, it'll log everything that's send from the SD to the module. Might be helpful for debugging.
|
||||
|
||||
|
||||
## Streamdeck
|
||||
|
||||
To enable logging on the streamdeck, [follow these instructions](https://developer.elgato.com/documentation/stream-deck/sdk/create-your-own-plugin/) from Elgato.
|
||||
|
||||
The plugin in Windows is located at (Windows) `AppData/Roaming/Elgato/StreamDeck/Plugins/com.cdeenen.materialdeck.sdPlugin`
|
||||
In `propertyinspector/js/common.js::getStats()` there are various functions that are used to get the relevant options to show up in the SD plugin. Each array element has a value and a name, you should keep the value the same, but the name can be whatever you like. I think you'll be able to figure out how to add stuff for wfrp by looking at the others.
|
||||
|
||||
|
||||
## Property discovery
|
||||
In a Foundry client browser instance, if you go to the dev console, you can browser your tokens via the `canvas.tokens` path, for example `canvas.tokens.children[0].children[0].actor.data`.
|
||||
|
||||
## Module Deployment
|
||||
If you make changes to files in this project, you'll need to copy the changed files to your Foundry install folder, probably found here: `C:\Users\$USER\AppData\Local\FoundryVTT\Data\modules\MaterialDeck`.
|
||||
|
||||
If you change the `MaterialDeck_SD` code (for example, `propertyinspector\js\common.js`), you will need to copy that file to the Elgato streamdeck plugins directory, probably found here: `C:\Users\$USER\AppData\Roaming\Elgato\StreamDeck\Plugins\com.cdeenen.materialdeck.sdPlugin`.
|
||||
271
MaterialDeck.js
@@ -1,7 +1,6 @@
|
||||
import {registerSettings} from "./src/settings.js";
|
||||
import {StreamDeck} from "./src/streamDeck.js";
|
||||
import {TokenControl} from "./src/token.js";
|
||||
import {Move} from "./src/move.js";
|
||||
import {MacroControl} from "./src/macro.js";
|
||||
import {CombatTracker} from "./src/combattracker.js";
|
||||
import {PlaylistControl} from "./src/playlist.js";
|
||||
@@ -9,10 +8,10 @@ import {SoundboardControl} from "./src/soundboard.js";
|
||||
import {OtherControls} from "./src/othercontrols.js";
|
||||
import {ExternalModules} from "./src/external.js";
|
||||
import {SceneControl} from "./src/scene.js";
|
||||
import {compatibleCore} from "./src/misc.js";
|
||||
import {downloadUtility, compatibleCore} from "./src/misc.js";
|
||||
import {TokenHelper} from "./src/systems/tokenHelper.js";
|
||||
export var streamDeck;
|
||||
export var tokenControl;
|
||||
var move;
|
||||
export var macroControl;
|
||||
export var combatTracker;
|
||||
export var playlistControl;
|
||||
@@ -20,17 +19,23 @@ export var soundboard;
|
||||
export var otherControls;
|
||||
export var externalModules;
|
||||
export var sceneControl;
|
||||
export var tokenHelper;
|
||||
|
||||
export const moduleName = "MaterialDeck";
|
||||
export var selectedTokenId;
|
||||
|
||||
export let gamingSystem = "dnd5e";
|
||||
|
||||
let ready = false;
|
||||
let activeSounds = [];
|
||||
|
||||
export let hotbarUses = false;
|
||||
export let calculateHotbarUses;
|
||||
|
||||
let controlTokenTimer;
|
||||
|
||||
export let sdVersion;
|
||||
export let msVersion;
|
||||
|
||||
let updateDialog;
|
||||
|
||||
//CONFIG.debug.hooks = true;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -62,7 +67,7 @@ async function analyzeWSmessage(msg){
|
||||
const msg = {
|
||||
target: "SD",
|
||||
type: "init",
|
||||
system: game.system.id
|
||||
system: gamingSystem
|
||||
}
|
||||
ws.send(JSON.stringify(msg));
|
||||
|
||||
@@ -72,23 +77,54 @@ async function analyzeWSmessage(msg){
|
||||
}
|
||||
|
||||
if (data.type == "version" && data.source == "SD") {
|
||||
/*
|
||||
console.log(data);
|
||||
const minimumSDversion = game.modules.get("MaterialDeck").data.minimumSDversion.replace('v','');
|
||||
const minimumMSversion = game.modules.get("MaterialDeck").data.minimumMSversion;
|
||||
console.log('SD',minimumSDversion,data.version)
|
||||
if (data.version < minimumSDversion) console.log('SD: nope')
|
||||
else console.log('SD: yes');
|
||||
*/
|
||||
let minimumSDversion;
|
||||
let minimumMSversion;
|
||||
if (compatibleCore("0.8.5")) {
|
||||
minimumSDversion = game.modules.get("MaterialDeck").data.flags.minimumSDversion.replace('v','');
|
||||
minimumMSversion = game.modules.get("MaterialDeck").data.flags.minimumMSversion;
|
||||
}
|
||||
else {
|
||||
minimumSDversion = game.modules.get("MaterialDeck").data.minimumSDversion.replace('v','');
|
||||
minimumMSversion = game.modules.get("MaterialDeck").data.minimumMSversion;
|
||||
}
|
||||
|
||||
sdVersion = data.version;
|
||||
|
||||
if (data.version < minimumSDversion && updateDialog == undefined) {
|
||||
updateDialog = new Dialog({
|
||||
title: "Material Deck: Update Needed",
|
||||
content: "<p>The Stream Deck plugin version you're using is v" + data.version + ", which is incompatible with this verion of the module.<br>Update to v" + minimumSDversion + " or newer.</p>",
|
||||
buttons: {
|
||||
download: {
|
||||
icon: '<i class="fas fa-download"></i>',
|
||||
label: "Download Utility",
|
||||
callback: () => new downloadUtility()
|
||||
},
|
||||
ignore: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: "Ignore"
|
||||
}
|
||||
},
|
||||
default: "download"
|
||||
});
|
||||
updateDialog.render(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type == 'newDevice') {
|
||||
streamDeck.newDevice(data.iteration,data.device);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data == undefined || data.payload == undefined) return;
|
||||
//console.log("Received",data);
|
||||
const action = data.action;
|
||||
const event = data.event;
|
||||
const context = data.context;
|
||||
const coordinates = data.payload.coordinates;
|
||||
const settings = data.payload.settings;
|
||||
const device = data.device;
|
||||
const name = data.deviceName;
|
||||
const type = data.deviceType;
|
||||
|
||||
if (data.data == 'init'){
|
||||
|
||||
@@ -96,57 +132,59 @@ async function analyzeWSmessage(msg){
|
||||
if (event == 'willAppear' || event == 'didReceiveSettings'){
|
||||
if (coordinates == undefined) return;
|
||||
streamDeck.setScreen(action);
|
||||
streamDeck.setContext(action,context,coordinates,settings);
|
||||
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.update(selectedTokenId);
|
||||
tokenControl.pushData(canvas.tokens.controlled[0]?.id,settings,context,device);
|
||||
}
|
||||
else if (action == 'move')
|
||||
move.update(settings,context);
|
||||
else if (action == 'macro')
|
||||
macroControl.update(settings,context);
|
||||
macroControl.update(settings,context,device);
|
||||
else if (action == 'combattracker')
|
||||
combatTracker.update(settings,context);
|
||||
combatTracker.update(settings,context,device);
|
||||
else if (action == 'playlist')
|
||||
playlistControl.update(settings,context);
|
||||
playlistControl.update(settings,context,device);
|
||||
else if (action == 'soundboard')
|
||||
soundboard.update(settings,context);
|
||||
soundboard.update(settings,context,device);
|
||||
else if (action == 'other')
|
||||
otherControls.update(settings,context);
|
||||
otherControls.update(settings,context,device);
|
||||
else if (action == 'external')
|
||||
externalModules.update(settings,context);
|
||||
externalModules.update(settings,context,device);
|
||||
else if (action == 'scene')
|
||||
sceneControl.update(settings,context);
|
||||
sceneControl.update(settings,context,device);
|
||||
}
|
||||
|
||||
else if (event == 'willDisappear'){
|
||||
if (coordinates == undefined) return;
|
||||
streamDeck.clearContext(action,coordinates,context);
|
||||
streamDeck.clearContext(device,action,coordinates,context);
|
||||
}
|
||||
|
||||
else if (event == 'keyDown'){
|
||||
if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
|
||||
|
||||
if (action == 'token')
|
||||
tokenControl.keyPress(settings);
|
||||
else if (action == 'move')
|
||||
move.keyPress(settings);
|
||||
else if (action == 'macro')
|
||||
macroControl.keyPress(settings);
|
||||
else if (action == 'combattracker')
|
||||
combatTracker.keyPress(settings,context);
|
||||
combatTracker.keyPress(settings,context,device);
|
||||
else if (action == 'playlist')
|
||||
playlistControl.keyPress(settings,context);
|
||||
playlistControl.keyPress(settings,context,device);
|
||||
else if (action == 'soundboard')
|
||||
soundboard.keyPressDown(settings);
|
||||
else if (action == 'other')
|
||||
otherControls.keyPress(settings,context);
|
||||
otherControls.keyPress(settings,context,device);
|
||||
else if (action == 'external')
|
||||
externalModules.keyPress(settings,context);
|
||||
externalModules.keyPress(settings,context,device);
|
||||
else if (action == 'scene')
|
||||
sceneControl.keyPress(settings);
|
||||
}
|
||||
|
||||
else if (event == 'keyUp'){
|
||||
if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
|
||||
|
||||
if (action == 'soundboard'){
|
||||
soundboard.keyPressUp(settings);
|
||||
}
|
||||
@@ -174,6 +212,7 @@ function startWebsocket() {
|
||||
}
|
||||
|
||||
ws.onopen = function() {
|
||||
messageCount = 0;
|
||||
WSconnected = true;
|
||||
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+address);
|
||||
wsOpen = true;
|
||||
@@ -185,7 +224,7 @@ function startWebsocket() {
|
||||
const msg2 = {
|
||||
target: "SD",
|
||||
type: "init",
|
||||
system: game.system.id
|
||||
system: gamingSystem
|
||||
}
|
||||
ws.send(JSON.stringify(msg2));
|
||||
clearInterval(wsInterval);
|
||||
@@ -195,15 +234,28 @@ function startWebsocket() {
|
||||
clearInterval(wsInterval);
|
||||
wsInterval = setInterval(resetWS, 10000);
|
||||
}
|
||||
|
||||
let messageCount = 0;
|
||||
/**
|
||||
* Try to reset the websocket if a connection is lost
|
||||
*/
|
||||
function resetWS(){
|
||||
if (wsOpen) ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.Disconnected"));
|
||||
else ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.ConnectFail"));
|
||||
WSconnected = false;
|
||||
startWebsocket();
|
||||
const maxMessages = game.settings.get(moduleName, 'nrOfConnMessages');
|
||||
if (wsOpen) {
|
||||
ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.Disconnected"));
|
||||
wsOpen = false;
|
||||
messageCount = 0;
|
||||
WSconnected = false;
|
||||
startWebsocket();
|
||||
}
|
||||
else if (ws.readyState == 3){
|
||||
if (maxMessages == 0 || maxMessages > messageCount) {
|
||||
messageCount++;
|
||||
const countString = maxMessages == 0 ? "" : " (" + messageCount + "/" + maxMessages + ")";
|
||||
ui.notifications.warn("Material Deck: "+game.i18n.localize("MaterialDeck.Notifications.ConnectFail") + countString);
|
||||
}
|
||||
WSconnected = false;
|
||||
startWebsocket();
|
||||
}
|
||||
}
|
||||
|
||||
export function sendWS(txt){
|
||||
@@ -240,17 +292,20 @@ export function getPermission(action,func) {
|
||||
Hooks.once('ready', async()=>{
|
||||
registerSettings();
|
||||
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
|
||||
|
||||
|
||||
const systemOverride = game.settings.get(moduleName,'systemOverride');
|
||||
gamingSystem = systemOverride != '' ? systemOverride : game.system.id;
|
||||
|
||||
soundboard = new SoundboardControl();
|
||||
streamDeck = new StreamDeck();
|
||||
tokenControl = new TokenControl();
|
||||
move = new Move();
|
||||
macroControl = new MacroControl();
|
||||
combatTracker = new CombatTracker();
|
||||
playlistControl = new PlaylistControl();
|
||||
otherControls = new OtherControls();
|
||||
externalModules = new ExternalModules();
|
||||
sceneControl = new SceneControl();
|
||||
tokenHelper = new TokenHelper();
|
||||
|
||||
game.socket.on(`module.MaterialDeck`, async(payload) =>{
|
||||
//console.log(payload);
|
||||
@@ -298,8 +353,36 @@ Hooks.once('ready', async()=>{
|
||||
|
||||
});
|
||||
|
||||
for (let i=0; i<64; i++)
|
||||
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 (getPermission('ENABLE') == false) {
|
||||
@@ -309,70 +392,59 @@ Hooks.once('ready', async()=>{
|
||||
|
||||
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");
|
||||
if (hotbarUsesTemp != undefined) {
|
||||
hotbarUses = true;
|
||||
}
|
||||
|
||||
if (hotbarUsesTemp != undefined) hotbarUses = true;
|
||||
});
|
||||
|
||||
function updateActor(id) {
|
||||
const token = tokenHelper.getTokenFromActorId(id)
|
||||
tokenControl.update(token.id);
|
||||
}
|
||||
|
||||
Hooks.on('updateToken',(scene,token)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
let tokenId = token._id;
|
||||
if (tokenId == selectedTokenId)
|
||||
tokenControl.update(selectedTokenId);
|
||||
if (tokenId == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||
if (macroControl != undefined) macroControl.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('updateActor',(scene,actor)=>{
|
||||
Hooks.on('updateActor',(actor)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
let children = canvas.tokens.children[0].children;
|
||||
for (let i=0; i<children.length; i++){
|
||||
if (children[i].actor.id == actor._id){
|
||||
let tokenId = children[i].id;
|
||||
if (tokenId == selectedTokenId)
|
||||
tokenControl.update(selectedTokenId);
|
||||
}
|
||||
}
|
||||
updateActor(actor.id);
|
||||
if (macroControl != undefined) macroControl.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('createActiveEffect',(data)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
updateActor(data.parent.id);
|
||||
return;
|
||||
});
|
||||
|
||||
Hooks.on('deleteActiveEffect',(data)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
updateActor(data.parent.id);
|
||||
return;
|
||||
});
|
||||
|
||||
Hooks.on('onActorSetCondition',(data)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
updateActor(data.actor.id);
|
||||
return;
|
||||
});
|
||||
|
||||
Hooks.on('controlToken',(token,controlled)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (controlled) {
|
||||
selectedTokenId = token.data._id;
|
||||
tokenControl.update(token.data._id);
|
||||
if (controlTokenTimer != undefined) {
|
||||
clearTimeout(controlTokenTimer);
|
||||
controlTokenTimer = undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
selectedTokenId = undefined;
|
||||
controlTokenTimer = setTimeout(function(){tokenControl.update(canvas.tokens.controlled[0]?.id);},10)
|
||||
}
|
||||
tokenControl.update(selectedTokenId);
|
||||
|
||||
if (macroControl != undefined) macroControl.updateAll();
|
||||
});
|
||||
|
||||
@@ -381,7 +453,6 @@ Hooks.on('updateOwnedItem',()=>{
|
||||
})
|
||||
|
||||
Hooks.on('renderHotbar', (hotbar)=>{
|
||||
if (compatibleCore("0.8.1")) return;
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (macroControl != undefined) macroControl.hotbar(hotbar.macros);
|
||||
});
|
||||
@@ -396,7 +467,12 @@ Hooks.on('render', (app)=>{
|
||||
Hooks.on('renderCombatTracker',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (combatTracker != undefined) combatTracker.updateAll();
|
||||
if (tokenControl != undefined) tokenControl.update(selectedTokenId);
|
||||
if (tokenControl != undefined) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||
});
|
||||
|
||||
Hooks.on('renderActorSheet',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (tokenControl != undefined) tokenControl.update();
|
||||
});
|
||||
|
||||
Hooks.on('renderPlaylistDirectory', (playlistDirectory)=>{
|
||||
@@ -423,6 +499,10 @@ Hooks.on('renderSidebarTab',(app)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (otherControls != undefined) otherControls.updateAll(options);
|
||||
if (sceneControl != undefined) sceneControl.updateAll();
|
||||
if (document.getElementsByClassName("roll-type-select")[0] != undefined)
|
||||
document.getElementsByClassName("roll-type-select")[0].addEventListener('change',function(){
|
||||
if (otherControls != undefined) otherControls.updateAll(options);
|
||||
})
|
||||
});
|
||||
|
||||
Hooks.on('closeSidebarTab',(app)=>{
|
||||
@@ -453,7 +533,7 @@ Hooks.on('renderSceneControls',()=>{
|
||||
|
||||
Hooks.on('targetToken',(user,token,targeted)=>{
|
||||
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',()=>{
|
||||
@@ -522,6 +602,11 @@ Hooks.on('about-time.clockRunningStatus', ()=>{
|
||||
externalModules.updateAll();
|
||||
})
|
||||
|
||||
Hooks.on('updateTile',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
externalModules.updateAll();
|
||||
});
|
||||
|
||||
Hooks.once('init', ()=>{
|
||||
//CONFIG.debug.hooks = true;
|
||||
//registerSettings(); //in ./src/settings.js
|
||||
@@ -529,4 +614,8 @@ Hooks.once('init', ()=>{
|
||||
|
||||
Hooks.once('canvasReady',()=>{
|
||||
ready = true;
|
||||
});
|
||||
|
||||
Hooks.on("soundscape", (data) => {
|
||||
externalModules.newSoundscapeData(data);
|
||||
});
|
||||
11
README.md
@@ -31,11 +31,6 @@ The functions are categorized into actions. Here is a list of the available acti
|
||||
<li>Toggle token visibility, combat state, conditions</li>
|
||||
</ul>
|
||||
<li>Move Action: Move selected token or the canvas</li>
|
||||
<ul>
|
||||
<li>Move token (in a specified direction)</li>
|
||||
<li>Move canvas (in a specified direction)</li>
|
||||
<li>Zoom canvas in/out</li>
|
||||
</ul>
|
||||
<li>Macro Actions: Execute macros</li>
|
||||
<ul>
|
||||
<li>Execute macro from hotbar</li>
|
||||
@@ -71,9 +66,12 @@ 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<br>
|
||||
<b>Foundry VTT:</b> Tested on 0.7.9 - 0.8.5<br>
|
||||
<b>Module Incompatibilities:</b> None known.<br>
|
||||
|
||||
## Developer Guide
|
||||
See the [developer guide](./DEVGUIDE.md) for a guide on how to add new systems to `MaterialDeck`.
|
||||
|
||||
## Feedback
|
||||
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.
|
||||
|
||||
@@ -84,6 +82,7 @@ Special thanks to Asmodeus#7588 who made this module possible by generously dona
|
||||
<br>
|
||||
Please consider supporting me on <a href="https://www.patreon.com/materialfoundry">Patreon</a>, and feel free to join the Material Foundry <a href="https://discord.gg/3hd4G6TkmA">Discord</a> server.
|
||||
|
||||
|
||||
## Abandonment
|
||||
Abandoned modules are a (potential) problem for Foundry, because users and/or other modules might rely on abandoned modules, which might break in future Foundry updates.<br>
|
||||
I consider this module abandoned if all of the below cases apply:
|
||||
|
||||
201
changelog.md
@@ -1,5 +1,197 @@
|
||||
# Changelog Material Deck Module
|
||||
## v1.3.3
|
||||
### v1.4.9 - 16-04-2022
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>PF2e: Fixed rolls and conditions for compatibility with latest pf2e version. Thanks to Kyamsil</li>
|
||||
<li>Token Action => Set Vison: Setting light is working again</li>
|
||||
<li>Other Actions => Roll Dice: Roll result would show as 'NaN' in Foundry v9, this is fixed</li>
|
||||
</ul>
|
||||
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Added support for the Starfinder system</li>
|
||||
<li>External Modules => Added support for 'Monks Active Tile Triggers'</li>
|
||||
<li>Added 'System Override' module setting. If your system is not supported, MD defaults to 5e. Here you can choose a supported system that is most similar to yours and have Material Deck use that system instead.</li>
|
||||
<li>Token Action => Displayed Stats: A colored border is drawn around certain skills, saves, etc to indicate proficiency (compatible systems: dnd5e, pf2e). Thanks to Kyamsil</li>
|
||||
</ul>
|
||||
|
||||
### v1.4.8 - 22-12-2021
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>'Device Configuration' would not save its settings properly</li>
|
||||
</ul>
|
||||
|
||||
|
||||
### v1.4.7 - 20-12-2021
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>External Modules => GM Screen: Changed to new api (thanks to akrigline)</li>
|
||||
<li>Fixed an issue where SDs would not iterate properly, causing errors (thanks to InnerGI)</li>
|
||||
<li>Fixed support for FXMaster. Requires FXMaster v2.0.0 or later (not officially released yet)</li>
|
||||
</ul>
|
||||
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Added compatibility for Foundry V0.9</li>
|
||||
<li>Added Forbidden Lands system (thanks to JackDCondon)</li>
|
||||
<li>Other Controls => Control Buttons: Added offset for 'Displayed Controls' and 'Displayed Tools'</li>
|
||||
<li>Added 'Device Configuration' to the module settings. You can use this to configure specific SD devices to not connect to a client</li>
|
||||
<li>Playlist Action => Added option to play next or previous track</li>
|
||||
</ul>
|
||||
|
||||
### v1.4.6 - 07-09-2021
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Token Action => Move token: If the user is not the GM, tokens can no longer move if game is paused, and they can no longer move through walls</li>
|
||||
<li>Modifications made in the Property Inspector now immediately get saved, instead of when user deselects the setting (changed 'onchange' to 'oninput' event)</li>
|
||||
</ul>
|
||||
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Playlist Action: Added a 'Pause All' option</li>
|
||||
</ul>
|
||||
|
||||
Other:
|
||||
<ul>
|
||||
<li>PF2E compatibility updated (thanks @kyamsil)</li>
|
||||
</ul>
|
||||
|
||||
### v1.4.5 - 27-07-2021
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Combat Tracker Action => Turn Display: If only 'Display Round' was enabled, the vertical alignment would be off. This has been fixed.</li>
|
||||
<li>WebSocket client no longer creates duplicate connections</li>
|
||||
<li>Token Action => If 'Display Uses/Quantity' is enabled for an item that has no maximum uses/quantity, the uses/quantity border is now consistently black.</li>
|
||||
<li>Update dialog that appears if the SD plugin needs to be updated now only appears once</li>
|
||||
</ul>
|
||||
|
||||
Additions:
|
||||
<ul>
|
||||
<li>External Modules: Added support for the Soundscape module. Requires Soundscape v1.0.3</li>
|
||||
<li>Macro Action => Advanced Macros is now supported for calling macros with arguments</li>
|
||||
<li>Combat Tracker Action => Function: Added option to select the combatant after changing the turn</li>
|
||||
<li>Other Actions => Added 'Set Roll Mode' which sets the roll mode for all rolls to public, private gm, blind gm or self roll</li>
|
||||
<li>Added support for wfrp4e (thanks to sozin#8622 & eccobold#3541)</li>
|
||||
<li>Added DEVGUIDE.md to help developers add support for new systems (thanks to sozin#8622 & eccobold#3541)</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.5 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v1.4.4 - 26-05-2021
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Some small fixes to make the module compatible with Foundry 0.8.5</li>
|
||||
</ul>
|
||||
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Token Action => Added 'Page-Wide Token' option. All buttons on the current page (where the page is the collection of buttons that are shown) that have this enabled will use the same token</li>
|
||||
<li>Token Action => On Click: Added 'Set Page-Wide Token' option, so you can configure buttons to set the page-wide token by pressing a button</li>
|
||||
<li>Token Action: Added a 'Mode' select box. Setting it to 'Token' is the same as pre v1.4.4. New are the inventory, features and spellbook options that can be used to auto-populate buttons with items, features and spells.</li>
|
||||
<li>Added a 'Clear Page' and 'Clear All' button to the soundboard and macroboard configuration</li>
|
||||
<li>Added import and export buttons to the soundboard and macroboard configuration (only imports/exports metadata, not the actual audio files or the macros)</li>
|
||||
<li>The number of connection error messages you will get is now configurable in the module settings</li>
|
||||
<li>Added a download utility to the module settings, so you can easily version-check with the SD plugin and Material Server, download them and download profiles</li>
|
||||
<li>Added Japanese localization (thanks BrotherSharper and Asami). All of the new features have not yet been translated</li>
|
||||
</ul>
|
||||
|
||||
Other:
|
||||
<ul>
|
||||
<li><b>(Breaking)</b> The Move Action has been removed. Moving tokens is not in the Token Action (it's an on click setting) and moving the canvas is in the Other Actions.</li>
|
||||
<li>Major change to the soundboard and macroboard configuration. It is now displayed as pages of 16 sounds or 32 macros each, you can browse through the pages using the arrow keys at the top.</li>
|
||||
<li>There is no longer a limit to the amount of sounds/macros you can assign to the soundboard/macroboard, but please note that at some point you might experience performance issues if there's too many sounds/macros.</li>
|
||||
<li>Removed the 'Stream Deck Model' module setting, since it's not that useful</li>
|
||||
<li>Token Action has been revamped to make it clearer and easier to implement new game systems</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.4 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### 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
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Previous update broke the combat tracker, should now be fixed</li>
|
||||
</ul>
|
||||
|
||||
### v1.4.0 - 21-04-2021
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Support for connecting multiple Stream Decks at the same time. Please note that performance decreases with each extra Stream Deck</li>
|
||||
<li>Other Actions: Added 'Token Roll Options'. This can toggle token rolls between showing a dialog and skipping the dialog and rolling normally or with advantage or disadvantage</li>
|
||||
<li>If the SD plugin version you're using is outdated, you now get a pop-up to notify you of this and direct you to the download page</li>
|
||||
<li>Added a module setting to set how dark the default white images should be. Can be lowered for improved readability of the text</li>
|
||||
<li>Token Action => Stats: Added option to prepend text to the title, so you can set the stat to, for example, strength, and put 'STR: ' in the prepend textbox to display, for example, 'STR: +2'</li>
|
||||
</ul>
|
||||
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Token Action => Skill Roll: Setting wasn't saved in SD app</li>
|
||||
<li>Token Action => Roll Ability: Rolling ability checks was broken for some systems</li>
|
||||
<li>Token Action => Stats => Display HP: Read overlay indicating HP in the heart icon was also drawn when 'Display Token Icon' was enabled</li>
|
||||
<li>Token Action => Stats: Added default images for all dnd5e abilities, saves and skills</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.0 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
|
||||
### v1.3.3 - 12-04-2021
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Other Actions => Open Sidebar Tab: Action now indicates which sidebar tab is open (only works on Foundry 0.8.x)</li>
|
||||
@@ -30,7 +222,7 @@ Other:
|
||||
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v1.3.4 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
## v1.3.2 - 11-03-2021
|
||||
### v1.3.2 - 11-03-2021
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Added support for the Multi Action provided by the SD app</li>
|
||||
@@ -50,7 +242,6 @@ Other:
|
||||
<ul>
|
||||
<li>Macro Action: Improved the way Hotbar Uses are displayed, it is now displayed in a box similar to how the module looks in Foundry</li>
|
||||
<li>Made the way images are generated more flexible to make future additions easier</li>
|
||||
<li></li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
@@ -90,7 +281,7 @@ Additions:
|
||||
<li>External Modules => Added support for the 'Shared Vision' module</li>
|
||||
<li>External Modules => Added support for the 'Lock View' module</li>
|
||||
<li>External Modules => Added support for the 'Not Your Turn' module</li>
|
||||
<ul>
|
||||
</ul>
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Token Action => OnClick: Fixed conditions for pf1e and dnd3.5e</li>
|
||||
@@ -323,4 +514,4 @@ SD plugin v0.7.0<br>
|
||||
</ul>
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Server v0.2.4<br>
|
||||
SD plugin v0.7.1<br>
|
||||
SD plugin v0.7.1<br>
|
||||
|
||||
BIN
img/.thumb/MaterialFoundry512x512.png.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
img/MaterialFoundry512x512.png
Normal file
|
After Width: | Height: | Size: 359 KiB |
BIN
img/other/.thumb/d20.png.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
@@ -1,2 +1,3 @@
|
||||
other.png: Made using https://www.elgato.com/en/gaming/keycreator
|
||||
cogs.png: Edited from https://fontawesome.com/icons/cogs?style=solid
|
||||
cogs.png: Edited from https://fontawesome.com/icons/cogs?style=solid
|
||||
d20.png: Edited from https://game-icons.net/1x1/delapouite/dice-twenty-faces-twenty.html
|
||||
BIN
img/other/d20.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
img/playlist/.thumb/pause.png.jpg
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
@@ -1,2 +1,3 @@
|
||||
play.png: Edited from https://fontawesome.com/icons/play?style=solid
|
||||
stop.png: Edited from https://fontawesome.com/icons/stop?style=solid
|
||||
stop.png: Edited from https://fontawesome.com/icons/stop?style=solid
|
||||
pause.png: Edited from https://fontawesome.com/v5.15/icons/pause?style=solid
|
||||
BIN
img/playlist/pause.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
img/token/.thumb/temp_hp_empty.png.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
@@ -1,5 +1,5 @@
|
||||
ac.webp: Foundry's icon folder, original name: heater-steel-worn.webp
|
||||
hp.png: made using Elgato's key creator: https://www.elgato.com/en/gaming/keycreator
|
||||
hp.png, hp_empty.png and temp_hp_empty.png: made using/modified from Elgato's key creator: https://www.elgato.com/en/gaming/keycreator
|
||||
init.png: freepngimg.com, color inverted, from: https://freepngimg.com/png/81025-art-dice-dungeons-system-dragons-d20-triangle/icon
|
||||
speed.webp: Foundry's icon folder, original name: shoes-collared-leather-blue.webp
|
||||
mystery-man.png: Foundry's icon folder, converted from .svg
|
||||
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/fort.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/abilities/.thumb/int.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/abilities/.thumb/ref.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/will.png.jpg
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
img/token/abilities/.thumb/wis.png.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
10
img/token/abilities/SOURCES.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
All images licenced under CC BY 3.0. Grabbed from game-icons.net
|
||||
str.png: https://game-icons.net/1x1/delapouite/weight-lifting-up.html
|
||||
dex.png: https://game-icons.net/1x1/darkzaitzev/acrobatic.html
|
||||
cons.png: https://game-icons.net/1x1/zeromancer/heart-plus.html
|
||||
int.png: https://game-icons.net/1x1/lorc/bookmarklet.html
|
||||
wis.png: https://game-icons.net/1x1/delapouite/wisdom.html
|
||||
cha.png: https://game-icons.net/1x1/lorc/icicles-aura.html
|
||||
fort.png: https://game-icons.net/1x1/delapouite/rock-golem.html
|
||||
ref.png: https://game-icons.net/1x1/lorc/dodging.html
|
||||
will.png: https://game-icons.net/1x1/lorc/meditation.html
|
||||
BIN
img/token/abilities/cha.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
img/token/abilities/cons.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
img/token/abilities/dex.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/abilities/fort.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
img/token/abilities/int.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/abilities/ref.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
img/token/abilities/str.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/abilities/will.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
img/token/abilities/wis.png
Normal file
|
After Width: | Height: | Size: 13 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/cra.png.jpg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
img/token/skills/.thumb/dec.png.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
img/token/skills/.thumb/dip.png.jpg
Normal file
|
After Width: | Height: | Size: 11 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/lor.png.jpg
Normal file
|
After Width: | Height: | Size: 11 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/occ.png.jpg
Normal file
|
After Width: | Height: | Size: 11 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/soc.png.jpg
Normal file
|
After Width: | Height: | Size: 8.5 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 |
BIN
img/token/skills/.thumb/thi.png.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
25
img/token/skills/SOURCES.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
All images licenced under CC BY 3.0. Grabbed from game-icons.net
|
||||
acr.png: https://game-icons.net/1x1/delapouite/contortionist.html
|
||||
ani.png: https://game-icons.net/1x1/delapouite/cavalry.html
|
||||
arc.png: https://game-icons.net/1x1/delapouite/spell-book.html
|
||||
ath.png: https://game-icons.net/1x1/lorc/muscle-up.html
|
||||
cra.png: https://game-icons.net/1x1/lorc/sword-smithing.html
|
||||
dec.png: https://game-icons.net/1x1/delapouite/convince.html
|
||||
dip.png: https://game-icons.net/1x1/delapouite/shaking-hands.html
|
||||
his.png: https://game-icons.net/1x1/delapouite/backward-time.html
|
||||
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
|
||||
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
|
||||
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
|
||||
lor.png: https://game-icons.net/1x1/lorc/bookmarklet.html
|
||||
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
|
||||
nat.png: https://game-icons.net/1x1/delapouite/forest.html
|
||||
occ.png: https://game-icons.net/1x1/skoll/pentacle.html
|
||||
prc.png: https://game-icons.net/1x1/lorc/semi-closed-eye.html
|
||||
prf.png: https://game-icons.net/1x1/lorc/sing.html
|
||||
per.png: https://game-icons.net/1x1/delapouite/public-speaker.html
|
||||
rel.png: https://game-icons.net/1x1/lorc/holy-grail.html
|
||||
soc.png: https://game-icons.net/1x1/delapouite/trumpet-flag.html
|
||||
slt.png: https://game-icons.net/1x1/lorc/snatch.html
|
||||
ste.png: https://game-icons.net/1x1/lorc/cloak-dagger.html
|
||||
sur.png: https://game-icons.net/1x1/delapouite/pyre.html
|
||||
thi.png: https://game-icons.net/1x1/delapouite/lock-picking.html
|
||||
BIN
img/token/skills/acr.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
img/token/skills/ani.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
img/token/skills/arc.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/skills/ath.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/skills/cra.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
img/token/skills/dec.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
img/token/skills/dip.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
img/token/skills/his.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
img/token/skills/ins.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
img/token/skills/inv.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/skills/itm.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
img/token/skills/lor.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
img/token/skills/med.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
img/token/skills/nat.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
img/token/skills/occ.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
img/token/skills/per.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
img/token/skills/prc.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
img/token/skills/prf.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/skills/rel.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/skills/slt.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/skills/soc.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
img/token/skills/ste.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
img/token/skills/sur.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
img/token/skills/thi.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
img/token/temp_hp_empty.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
73
lang/en.json
@@ -3,17 +3,13 @@
|
||||
"MaterialDeck.Notifications.ConnectFail": "Can't connect to Material Server, 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 macro board",
|
||||
"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.Sett.Model": "Stream Deck Model",
|
||||
"MaterialDeck.Sett.Model_Hint": "Reduces the amount of macros and sounds in the macro and soundboard configuration screens. Gives a better overview, but if desired it can be set to XL to get the maximum number. This doesn't influence the operation of the module.",
|
||||
"MaterialDeck.Sett.Model_Mini": "Mini",
|
||||
"MaterialDeck.Sett.Model_Normal": "Normal or Mobile",
|
||||
"MaterialDeck.Sett.Model_XL": "XL",
|
||||
"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",
|
||||
@@ -21,6 +17,12 @@
|
||||
"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.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.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. Leave empty for system autodetection.",
|
||||
|
||||
"MaterialDeck.PL.Unrestricted": "Unrestricted",
|
||||
"MaterialDeck.PL.OneTrackPlaylist": "One track per playlist",
|
||||
@@ -33,10 +35,12 @@
|
||||
"MaterialDeck.Playlists": "Playlists",
|
||||
"MaterialDeck.Playlist": "Playlist",
|
||||
"MaterialDeck.FilePicker": "File Picker",
|
||||
"MaterialDeck.FurnaceArgs": "Furnace arguments",
|
||||
"MaterialDeck.FurnaceArgs": "Macro arguments",
|
||||
"MaterialDeck.Background": "Background",
|
||||
"MaterialDeck.Macro": "Macro",
|
||||
"MaterialDeck.Sound": "Sound",
|
||||
"MaterialDeck.Sounds": "Sounds",
|
||||
"MaterialDeck.Of": "of",
|
||||
"MaterialDeck.Icon": "Icon",
|
||||
"MaterialDeck.Once": "Once",
|
||||
"MaterialDeck.Repeat": "Repeat",
|
||||
@@ -48,11 +52,30 @@
|
||||
"MaterialDeck.Name": "Name",
|
||||
"MaterialDeck.None": "None",
|
||||
"MaterialDeck.Save": "Save",
|
||||
"MaterialDeck.ClearAll": "Clear All",
|
||||
"MaterialDeck.ClearAll_Content": "This will clear all the data. This cannot be undone, are you sure you want to proceed?",
|
||||
"MaterialDeck.ClearPage": "Clear Page",
|
||||
"MaterialDeck.ClearPage_Content": "This will clear all the data on this page. This cannot be undone, are you sure you want to proceed?",
|
||||
"MaterialDeck.Continue": "Continue",
|
||||
"MaterialDeck.Cancel": "Cancel",
|
||||
"MaterialDeck.Import": "Import",
|
||||
"MaterialDeck.Export": "Export",
|
||||
"MaterialDeck.Filename": "Filename",
|
||||
"MaterialDeck.Id": "Id",
|
||||
"MaterialDeck.Type": "Type",
|
||||
|
||||
"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.",
|
||||
"MaterialDeck.ExportDialog.MacroboardContent": "Export the macroboard data. Please note that only the metadata is exported, so you will have to make sure the same macros are available when you import them.",
|
||||
|
||||
"MaterialDeck.ImportDialog.Title": "Import",
|
||||
"MaterialDeck.ImportDialog.SoundboardContent": "Select a file to import. Please note that only the metadata is imported, so you will have to make sure the audio files are in the same relative location as when you exported them.",
|
||||
"MaterialDeck.ImportDialog.MacroboardContent": "Import the macroboard data. ",
|
||||
"MaterialDeck.ImportDialog.Warning": "This will overwrite your current settings, and cannot be undone.",
|
||||
|
||||
"MaterialDeck.FxMaster.Colorize": "Colorize",
|
||||
"MaterialDeck.FxMaster.Clear": "Clear All",
|
||||
|
||||
|
||||
"MaterialDeck.Perm.Instructions": "Configure the permission for each Material Deck action.",
|
||||
"MaterialDeck.Perm.DefaultNotification": "Material Deck user permissions have been configured to the default values.",
|
||||
|
||||
@@ -94,15 +117,9 @@
|
||||
"MaterialDeck.Perm.MACRO.BY_NAME.label": "Macro by Name",
|
||||
"MaterialDeck.Perm.MACRO.BY_NAME.hint": "Allow users to call macros by name",
|
||||
"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 macroboard",
|
||||
"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.MOVE.label": "Move",
|
||||
"MaterialDeck.Perm.MOVE.TOKEN.label": "Token",
|
||||
"MaterialDeck.Perm.MOVE.TOKEN.hint": "Allow users to move a controlled token",
|
||||
"MaterialDeck.Perm.MOVE.CANVAS.label": "Canvas",
|
||||
"MaterialDeck.Perm.MOVE.CANVAS.hint": "Allow users to move their canvas",
|
||||
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "Allow users to configure the macroboard. To allow users to pick icons using the filepicker, enable 'Browse File Explorer' for that user in the core Permission Configuration",
|
||||
|
||||
"MaterialDeck.Perm.OTHER.label": "Other",
|
||||
"MaterialDeck.Perm.OTHER.PAUSE.label": "Pause/Resume",
|
||||
@@ -142,7 +159,7 @@
|
||||
"MaterialDeck.Perm.SCENE.ACTIVE.label": "Active Scene",
|
||||
"MaterialDeck.Perm.SCENE.ACTIVE.hint": "Allow users to view the active scene",
|
||||
"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.hint": "Allow users to view and control any scene by name",
|
||||
|
||||
@@ -150,7 +167,7 @@
|
||||
"MaterialDeck.Perm.SOUNDBOARD.PLAY.label": "Enable",
|
||||
"MaterialDeck.Perm.SOUNDBOARD.PLAY.hint": "Allow users to play sounds from the soundboard",
|
||||
"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.STATS.label": "Display Stats",
|
||||
@@ -176,6 +193,22 @@
|
||||
"MaterialDeck.AboutTime.Second": "nd",
|
||||
"MaterialDeck.AboutTime.Third": "rd",
|
||||
"MaterialDeck.AboutTime.Fourth": "th",
|
||||
"MaterialDeck.AboutTime.Of": "of"
|
||||
}
|
||||
"MaterialDeck.AboutTime.Of": "of",
|
||||
|
||||
"MaterialDeck.DownloadUtility.Title": "Download Utility",
|
||||
"MaterialDeck.DownloadUtility.Plugin": "Plugin & Material Server",
|
||||
"MaterialDeck.DownloadUtility.Minimum": "Minimum",
|
||||
"MaterialDeck.DownloadUtility.Current": "Current",
|
||||
"MaterialDeck.DownloadUtility.Latest": "Latest",
|
||||
"MaterialDeck.DownloadUtility.OS": "OS",
|
||||
"MaterialDeck.DownloadUtility.Download": "Download",
|
||||
"MaterialDeck.DownloadUtility.SDplugin": "SD Plugin",
|
||||
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
||||
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
||||
"MaterialDeck.DownloadUtility.Macos": "MacOS",
|
||||
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
||||
"MaterialDeck.DownloadUtility.Source": "Source",
|
||||
"MaterialDeck.DownloadUtility.Profiles": "Profiles",
|
||||
"MaterialDeck.DownloadUtility.Name": "Name",
|
||||
"MaterialDeck.DownloadUtility.Refresh": "Refresh"
|
||||
}
|
||||
209
lang/ja.json
Normal file
@@ -0,0 +1,209 @@
|
||||
{
|
||||
"MaterialDeck.Notifications.Disconnected": "Material Serverから切断され、再接続を試みています",
|
||||
"MaterialDeck.Notifications.ConnectFail": "Material Serverに接続できません、再試行します",
|
||||
"MaterialDeck.Notifications.Connected": "に接続しました",
|
||||
"MaterialDeck.Notifications.Soundboard.NoPermission": "サウンドボードを設定する権限がありません",
|
||||
"MaterialDeck.Notifications.Macroboard.NoPermission": "マクロボードを設定する権限がありません",
|
||||
"MaterialDeck.Notifications.Playlist.NoPermission": "プレイリストを設定する権限がありません",
|
||||
|
||||
"MaterialDeck.Sett.Enable": "モジュールの有効化",
|
||||
"MaterialDeck.Sett.Help": "ヘルプ",
|
||||
"MaterialDeck.Sett.Permission": "ユーザー権限の設定",
|
||||
"MaterialDeck.Sett.PlaylistConfig": "プレイリスト設定",
|
||||
"MaterialDeck.Sett.MacroConfig": "マクロ設定",
|
||||
"MaterialDeck.Sett.SoundboardConfig": "サウンド設定",
|
||||
"MaterialDeck.Sett.ServerAddr": "Material Server アドレス",
|
||||
"MaterialDeck.Sett.ServerAddrHint": "Material ServerのIPアドレスとポート。デフォルト値は99%の人に有効ですが、何をしているのかがわかっている場合にのみ変更してください。[ip_address]:[port]の形式に従う必要があります。例:「localhost:3001」または「192.168.1.1:4000」。",
|
||||
"MaterialDeck.Sett.ImageBuffer": "画像キャッシュサイズ",
|
||||
"MaterialDeck.Sett.ImageBufferHint": "画像キャッシュに保存する画像のデータ量を設定します。画像キャッシュは、ストリームデッキに送信されたすべての画像をローカルに保存します。これにより更新速度は向上しますが、メモリ使用量は増加します。",
|
||||
"MaterialDeck.Sett.ImageBrightness": "画像の明るさ",
|
||||
"MaterialDeck.Sett.ImageBrightnessHint": "デフォルトの画像の明るさを設定します。画像キャッシュサイズが0より大きい場合、更新を実行してください。",
|
||||
"MaterialDeck.Sett.NrOfConnMessages": "接続警告回数",
|
||||
"MaterialDeck.Sett.NrOfConnMessagesHint": "Material DeckがMaterial Serverに接続できない場合に表示される接続警告回数を設定します。0に設定すると、無制限となります。",
|
||||
|
||||
"MaterialDeck.PL.Unrestricted": "無制限",
|
||||
"MaterialDeck.PL.OneTrackPlaylist": "プレイリストごとに1つのトラック",
|
||||
"MaterialDeck.PL.OneTrackTotal": "合計1トラック",
|
||||
"MaterialDeck.PL.OneTrack": "1トラック",
|
||||
"MaterialDeck.PL.Settings": "設定",
|
||||
"MaterialDeck.PL.Mode": "デフォルトの再生モード",
|
||||
"MaterialDeck.PL.Nr": "プレイリストの数",
|
||||
|
||||
"MaterialDeck.Playlists": "プレイリスト",
|
||||
"MaterialDeck.Playlist": "プレイリスト",
|
||||
"MaterialDeck.FilePicker": "ファイルを選ぶ",
|
||||
"MaterialDeck.FurnaceArgs": "炉の引数",
|
||||
"MaterialDeck.Background": "背景",
|
||||
"MaterialDeck.Macro": "マクロ",
|
||||
"MaterialDeck.Sound": "サウンド",
|
||||
"MaterialDeck.Sounds": "Sounds",
|
||||
"MaterialDeck.Of": "of",
|
||||
"MaterialDeck.Icon": "アイコン",
|
||||
"MaterialDeck.Once": "一度だけ再生",
|
||||
"MaterialDeck.Repeat": "リピート再生",
|
||||
"MaterialDeck.Hold": "ホールド",
|
||||
"MaterialDeck.Playback": "再生",
|
||||
"MaterialDeck.Volume": "音量",
|
||||
"MaterialDeck.On": "On",
|
||||
"MaterialDeck.Off": "Off",
|
||||
"MaterialDeck.Name": "名前",
|
||||
"MaterialDeck.None": "無し",
|
||||
"MaterialDeck.Save": "セーブ",
|
||||
"MaterialDeck.ClearAll": "すべて クリア",
|
||||
"MaterialDeck.ClearAll_Content": "すべてのデータがクリアされます。この操作は取り消すことができません、続行しますか?",
|
||||
"MaterialDeck.ClearPage": "ページ クリア",
|
||||
"MaterialDeck.ClearPage_Content": "このページのすべてのデータがクリアされます。この操作は取り消すことができません、続行しますか?",
|
||||
"MaterialDeck.Continue": "継続",
|
||||
"MaterialDeck.Cancel": "キャンセル",
|
||||
"MaterialDeck.Import": "インポート",
|
||||
"MaterialDeck.Export": "エクスポート",
|
||||
"MaterialDeck.Filename": "ファイル名",
|
||||
|
||||
"MaterialDeck.ExportDialog.Title": "エクスポート",
|
||||
"MaterialDeck.ExportDialog.SoundboardContent": "SouseBoardデータをエクスポートします。メタデータのみがエクスポートされるので、インポートするときにオーディオファイルが相対的に同じ場所にあることを確認する必要があります。",
|
||||
"MaterialDeck.ExportDialog.MacroboardContent": "MacroBoardデータをエクスポートします。メタデータのみがエクスポートされるため、インポートしたときに同じマクロが使用可能であることを確認する必要があります。",
|
||||
|
||||
"MaterialDeck.ImportDialog.Title": "インポート",
|
||||
"MaterialDeck.ImportDialog.SoundboardContent": "インポートするファイルを選択してください。メタデータのみがインポートされるので、オーディオファイルがそれらをエクスポートしたときと同じ相対的な場所にあることを確認する必要があります。",
|
||||
"MaterialDeck.ImportDialog.MacroboardContent": "MacroBoardデータをインポートします。 ",
|
||||
"MaterialDeck.ImportDialog.Warning": "現在の設定が上書きされ、元に戻すことはできません。",
|
||||
|
||||
"MaterialDeck.FxMaster.Colorize": "色付け",
|
||||
"MaterialDeck.FxMaster.Clear": "すべてクリア",
|
||||
|
||||
"MaterialDeck.Perm.Instructions": "各Material Deckアクションの権限を設定します。",
|
||||
"MaterialDeck.Perm.DefaultNotification": "Material Deckのユーザー権限がデフォルト値に設定されています。",
|
||||
|
||||
"MaterialDeck.Perm.ENABLE.label": "モジュールを有効にする",
|
||||
"MaterialDeck.Perm.ENABLE.ENABLE.label": "有効にする",
|
||||
"MaterialDeck.Perm.ENABLE.ENABLE.hint": "ユーザーがMaterial Deckを使用できるようにします",
|
||||
|
||||
"MaterialDeck.Perm.COMBAT.label": "イニシアチブ表",
|
||||
"MaterialDeck.Perm.COMBAT.END_TURN.label": "ターン終了",
|
||||
"MaterialDeck.Perm.COMBAT.END_TURN.hint": "ユーザーが自分のターンを終了できるようにします",
|
||||
"MaterialDeck.Perm.COMBAT.TURN_DISPLAY.label": "ターン表示",
|
||||
"MaterialDeck.Perm.COMBAT.TURN_DISPLAY.hint": "ユーザーがターン表示できるようにします",
|
||||
"MaterialDeck.Perm.COMBAT.OTHER_FUNCTIONS.label": "その他の機能",
|
||||
"MaterialDeck.Perm.COMBAT.OTHER_FUNCTIONS.hint": "戦闘の開始/停止、ターンの増減など、ユーザーが「機能モード」で他の機能を使用できるようにします。",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_COMBATANTS.label": "戦闘参加者の表示",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_COMBATANTS.hint": "ユーザーが戦闘参加者を表示できるようにします",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_NON_OWNED_STATS.label": "所有されていないステータスと、オブザーバー以外のステータスを表示",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_NON_OWNED_STATS.hint": "ユーザーが所有していないか、オブザーバー権限を持っていないトークンのステータスを表示できるようにする",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_HP.label": "リミテッド権限のHP表示",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_HP.hint": "ユーザーがリミテッド権限を持つトークンのHPを表示できるようにする",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_HP.label": "オブザーバー権限のHP表示",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_HP.hint": "ユーザーがオブザーバー権限を持つトークンのHPを表示できるようにする",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_ALL_NAMES.label": "すべての名前を表示",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_ALL_NAMES.hint": "ユーザーがすべてのトークンの名前を表示できるようにする",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_NAME.label": "リミテッド権限の名前表示",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_NAME.hint": "ユーザーがリミテッド権限を持つトークンの名前を表示できるようにする",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_NAME.label": "オブザーバー権限の名前表示",
|
||||
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_NAME.hint": "ユーザーがオブザーバー権限を持つトークンの名前を表示できるようにする",
|
||||
|
||||
"MaterialDeck.Perm.EXTERNAL.label": "外部モジュール",
|
||||
"MaterialDeck.Perm.EXTERNAL.FXMASTER.label": "Fx Master",
|
||||
"MaterialDeck.Perm.EXTERNAL.FXMASTER.hint": "ユーザーがFxマスターモジュールを制御できるようにする",
|
||||
"MaterialDeck.Perm.EXTERNAL.GM_SCREEN.label": "GM Screen",
|
||||
"MaterialDeck.Perm.EXTERNAL.GM_SCREEN.hint": "ユーザーがGM Screenモジュールを使用してGM画面を表示できるようにする",
|
||||
|
||||
"MaterialDeck.Perm.MACRO.label": "マクロ",
|
||||
"MaterialDeck.Perm.MACRO.HOTBAR.label": "ホットバーマクロ",
|
||||
"MaterialDeck.Perm.MACRO.HOTBAR.hint": "ユーザーがホットバーマクロを使用できるようにする",
|
||||
"MaterialDeck.Perm.MACRO.BY_NAME.label": "名前でマクロ呼出",
|
||||
"MaterialDeck.Perm.MACRO.BY_NAME.hint": "ユーザーが名前でマクロを呼び出すことを許可します",
|
||||
"MaterialDeck.Perm.MACRO.MACROBOARD.label": "マクロボード",
|
||||
"MaterialDeck.Perm.MACRO.MACROBOARD.hint": "ユーザーがマクロボードを使用できるようにする",
|
||||
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.label": "マクロボードの設定",
|
||||
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "ユーザーがマクロボードを設定できるようにする。ユーザーがファイルエクスプローラを使用してアイコンを選択できるようにするには、コア設定の「権限の設定」でそのユーザーに対して「ファイルエクスプローラの使用」を有効にすること。",
|
||||
|
||||
"MaterialDeck.Perm.OTHER.label": "その他",
|
||||
"MaterialDeck.Perm.OTHER.PAUSE.label": "一時停止/再開",
|
||||
"MaterialDeck.Perm.OTHER.PAUSE.hint": "ユーザーがゲームを一時停止または再開できるようにする",
|
||||
"MaterialDeck.Perm.OTHER.CONTROL.label": "コントロールボタン",
|
||||
"MaterialDeck.Perm.OTHER.CONTROL.hint": "ユーザーがコントロールボタンを制御できるようにする",
|
||||
"MaterialDeck.Perm.OTHER.DARKNESS.label": "シーンの暗さ",
|
||||
"MaterialDeck.Perm.OTHER.DARKNESS.hint": "ユーザーがシーンの暗さを設定できるようにする",
|
||||
"MaterialDeck.Perm.OTHER.DICE.label": "ダイスロール",
|
||||
"MaterialDeck.Perm.OTHER.DICE.hint": "ユーザーがダイスを振ることを許可する",
|
||||
"MaterialDeck.Perm.OTHER.TABLES_ALL.label": "ロールテーブル(すべて)",
|
||||
"MaterialDeck.Perm.OTHER.TABLES_ALL.hint": "ユーザーがすべてのロールテーブルの表示、およびロールすることを許可する",
|
||||
"MaterialDeck.Perm.OTHER.TABLES.label": "ロールテーブル(オブザーバー/所有者)",
|
||||
"MaterialDeck.Perm.OTHER.TABLES.hint": "ユーザーがオブザーバーまたは所有者の権限を持つロールテーブルを表示およびロールできるようにする",
|
||||
"MaterialDeck.Perm.OTHER.SIDEBAR.label": "サイドバー",
|
||||
"MaterialDeck.Perm.OTHER.SIDEBAR.hint": "ユーザーがサイドバーを制御できるようにする",
|
||||
"MaterialDeck.Perm.OTHER.COMPENDIUM_ALL.label": "辞典(すべて)",
|
||||
"MaterialDeck.Perm.OTHER.COMPENDIUM_ALL.hint": "ユーザーがすべての辞典を開くことを許可する",
|
||||
"MaterialDeck.Perm.OTHER.COMPENDIUM.label": "辞典(オブザーバー/所有者)",
|
||||
"MaterialDeck.Perm.OTHER.COMPENDIUM.hint": "ユーザーがオブザーバーまたは所有者権限を持つ辞典を開くことを許可する",
|
||||
"MaterialDeck.Perm.OTHER.JOURNAL_ALL.label": "資料(すべて)",
|
||||
"MaterialDeck.Perm.OTHER.JOURNAL_ALL.hint": "ユーザーがすべての資料を開くことを許可する",
|
||||
"MaterialDeck.Perm.OTHER.JOURNAL.label": "資料(オブザーバー/所有者)",
|
||||
"MaterialDeck.Perm.OTHER.JOURNAL.hint": "ユーザーがオブザーバーまたは所有者権限を持つ資料を開くことを許可する",
|
||||
"MaterialDeck.Perm.OTHER.CHAT.label": "チャットメッセージ",
|
||||
"MaterialDeck.Perm.OTHER.CHAT.hint": "ユーザーがチャットメッセージを送信できるようにする",
|
||||
|
||||
"MaterialDeck.Perm.PLAYLIST.label": "プレイリスト",
|
||||
"MaterialDeck.Perm.PLAYLIST.PLAY.label": "制御",
|
||||
"MaterialDeck.Perm.PLAYLIST.PLAY.hint": "ユーザーがプレイリストとサウンドを再生および一時停止できるようにする",
|
||||
"MaterialDeck.Perm.PLAYLIST.CONFIGURE.label": "設定",
|
||||
"MaterialDeck.Perm.PLAYLIST.CONFIGURE.hint": "ユーザーがプレイリストを設定できるようにする",
|
||||
|
||||
"MaterialDeck.Perm.SCENE.label": "シーン",
|
||||
"MaterialDeck.Perm.SCENE.VISIBLE.label": "シーンの可視状態",
|
||||
"MaterialDeck.Perm.SCENE.VISIBLE.hint": "ユーザーが表示されているシーンを表示および制御できるようにする",
|
||||
"MaterialDeck.Perm.SCENE.ACTIVE.label": "シーンの有効化",
|
||||
"MaterialDeck.Perm.SCENE.ACTIVE.hint": "ユーザーが有効化されたシーンを表示できるようにする",
|
||||
"MaterialDeck.Perm.SCENE.DIRECTORY.label": "シーンディレクトリ",
|
||||
"MaterialDeck.Perm.SCENE.DIRECTORY.hint": "ユーザーがシーンディレクトリからシーンを表示および制御できるようにする",
|
||||
"MaterialDeck.Perm.SCENE.NAME.label": "名前によるシーン",
|
||||
"MaterialDeck.Perm.SCENE.NAME.hint": "ユーザーが名前で任意のシーンを表示および制御できるようにする",
|
||||
|
||||
"MaterialDeck.Perm.SOUNDBOARD.label": "サウンドボード",
|
||||
"MaterialDeck.Perm.SOUNDBOARD.PLAY.label": "有効にする",
|
||||
"MaterialDeck.Perm.SOUNDBOARD.PLAY.hint": "ユーザーがサウンドボードからサウンドを再生できるようにする",
|
||||
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.label": "設定",
|
||||
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.hint": "ユーザーがサウンドボードを設定できるようにする。ユーザーがファイルエクスプローラを使用してアイコンを選択できるようにするには、コア設定の「権限の設定」でそのユーザーに対して「ファイルエクスプローラの使用」を有効にすること。",
|
||||
|
||||
"MaterialDeck.Perm.TOKEN.label": "トークン",
|
||||
"MaterialDeck.Perm.TOKEN.STATS.label": "ステータス表示",
|
||||
"MaterialDeck.Perm.TOKEN.STATS.hint": "ユーザーが制御されたトークンのステータスを表示できるようにする",
|
||||
"MaterialDeck.Perm.TOKEN.VISIBILITY.label": "可視状態の切替",
|
||||
"MaterialDeck.Perm.TOKEN.VISIBILITY.hint": "ユーザーが制御するトークンの表示を切り替えることができるようにする",
|
||||
"MaterialDeck.Perm.TOKEN.COMBAT.label": "戦闘状態の切替",
|
||||
"MaterialDeck.Perm.TOKEN.COMBAT.hint": "ユーザーが制御するトークンの戦闘状態を切り替えることができるようにする",
|
||||
"MaterialDeck.Perm.TOKEN.VISION.label": "視覚を有効化",
|
||||
"MaterialDeck.Perm.TOKEN.VISION.hint": "ユーザーが制御されたトークンの視覚を設定できるようにする",
|
||||
"MaterialDeck.Perm.TOKEN.WILDCARD.label": "ワイルドカード画像",
|
||||
"MaterialDeck.Perm.TOKEN.WILDCARD.hint": "ユーザーがワイルドカード画像機能を使用して制御するトークンの画像を設定できるようにする",
|
||||
"MaterialDeck.Perm.TOKEN.CONDITIONS.label": "状態設定",
|
||||
"MaterialDeck.Perm.TOKEN.CONDITIONS.hint": "ユーザーが制御するトークンの状態を設定できるようにする",
|
||||
"MaterialDeck.Perm.TOKEN.CUSTOM.label": "カスタムオンクリック",
|
||||
"MaterialDeck.Perm.TOKEN.CUSTOM.hint": "ユーザーがカスタムオンクリック機能を設定できるようにする",
|
||||
"MaterialDeck.Perm.TOKEN.NON_OWNED.label": "非所有者/非オブザーバートークン",
|
||||
"MaterialDeck.Perm.TOKEN.NON_OWNED.hint": "所有者またはオブザーバーではない権限を持つトークンへのアクセスをユーザーに許可する",
|
||||
"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.DownloadUtility.Title": "ダウンロード・ユーティリティ",
|
||||
"MaterialDeck.DownloadUtility.Plugin": "プラグイン&Material Server",
|
||||
"MaterialDeck.DownloadUtility.Minimum": "最小",
|
||||
"MaterialDeck.DownloadUtility.Current": "現在",
|
||||
"MaterialDeck.DownloadUtility.Latest": "最新",
|
||||
"MaterialDeck.DownloadUtility.OS": "OS",
|
||||
"MaterialDeck.DownloadUtility.Download": "ダウンロード",
|
||||
"MaterialDeck.DownloadUtility.SDplugin": "SDプラグイン",
|
||||
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
||||
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
||||
"MaterialDeck.DownloadUtility.Macos": "MacOS",
|
||||
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
||||
"MaterialDeck.DownloadUtility.Source": "ソース",
|
||||
"MaterialDeck.DownloadUtility.Profiles": "プロファイル",
|
||||
"MaterialDeck.DownloadUtility.Name": "名前",
|
||||
"MaterialDeck.DownloadUtility.Refresh": "更新"
|
||||
}
|
||||
71
module.json
@@ -1,25 +1,48 @@
|
||||
{
|
||||
"name": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.3.3",
|
||||
"minimumSDversion": "1.3.4",
|
||||
"minimumMSversion": "1.0.2",
|
||||
"author": "CDeenen",
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
],
|
||||
"socket": true,
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.8.1",
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
"path": "lang/en.json"
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
"name": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.4.9",
|
||||
"author": "CDeenen",
|
||||
"authors": {
|
||||
"name": "CDeenen",
|
||||
"email": "cdeenen@outlook.com",
|
||||
"discord": "Cris#6864",
|
||||
"patreon": "MaterialFoundry",
|
||||
"reddit": "CDeenen123"
|
||||
},
|
||||
"flags": {
|
||||
"minimumSDversion": "1.4.7",
|
||||
"minimumMSversion": "1.0.2"
|
||||
},
|
||||
"minimumSDversion": "1.4.7",
|
||||
"minimumMSversion": "1.0.2",
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
],
|
||||
"socket": true,
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "9",
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
"path": "lang/en.json"
|
||||
},
|
||||
{
|
||||
"lang": "ja",
|
||||
"name": "日本語",
|
||||
"path": "lang/ja.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"
|
||||
}
|
||||
@@ -10,14 +10,17 @@ export class CombatTracker{
|
||||
|
||||
async updateAll(){
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'combattracker') continue;
|
||||
await this.update(data.settings,data.context);
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
if (device?.buttons == undefined) continue;
|
||||
for (let i=0; i<device.buttons.length; i++){
|
||||
const data = device.buttons[i];
|
||||
if (data == undefined || data.action != 'combattracker') continue;
|
||||
await this.update(data.settings,data.context,device.device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
update(settings,context,device){
|
||||
this.active = true;
|
||||
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
|
||||
const mode = settings.combatTrackerMode ? settings.combatTrackerMode : 'combatants';
|
||||
@@ -26,10 +29,11 @@ export class CombatTracker{
|
||||
let txt = "";
|
||||
let background = "#000000";
|
||||
settings.combat = true;
|
||||
settings.icon = settings.displayIcon ? 'tokenIcon' : 'none';
|
||||
|
||||
if (mode == 'combatants'){
|
||||
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
||||
streamDeck.noPermission(context,false,"combat tracker");
|
||||
streamDeck.noPermission(context,device,device,false,"combat tracker");
|
||||
return;
|
||||
}
|
||||
if (combat != null && combat != undefined && combat.turns.length != 0){
|
||||
@@ -41,45 +45,45 @@ export class CombatTracker{
|
||||
|
||||
if (combatant != undefined){
|
||||
const tokenId = compatibleCore("0.8.1") ? combatant.data.tokenId : combatant.tokenId;
|
||||
tokenControl.pushData(tokenId,settings,context,combatantState,'#cccc00');
|
||||
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(context,src,{background:background});
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(context,src,{background:background});
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
else if (mode == 'currentCombatant'){
|
||||
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device,device);
|
||||
return;
|
||||
}
|
||||
if (combat != null && combat != undefined && combat.started){
|
||||
const tokenId = compatibleCore("0.8.1") ? combat.combatant.data.tokenId : combat.combatant.tokenId;
|
||||
tokenControl.pushData(tokenId,settings,context);
|
||||
tokenControl.pushData(tokenId,settings,context,device);
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(context,src,{background:background});
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
else if (mode == 'function'){
|
||||
|
||||
if (ctFunction == 'turnDisplay' && MODULE.getPermission('COMBAT','TURN_DISPLAY') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && MODULE.getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -123,16 +127,18 @@ export class CombatTracker{
|
||||
turn = combat.turn+1;
|
||||
}
|
||||
if (settings.displayRound) txt += "Round\n"+round;
|
||||
if (txt != "") txt += "\n";
|
||||
if (settings.displayRound && settings.displayTurn) txt += "\n";
|
||||
if (settings.displayTurn) txt += "Turn\n"+turn;
|
||||
}
|
||||
streamDeck.setIcon(context,src,{background:background});
|
||||
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
|
||||
keyPress(settings,context){
|
||||
async keyPress(settings,context,device){
|
||||
const mode = settings.combatTrackerMode ? settings.combatTrackerMode : 'combatants';
|
||||
const selectCombatant = settings.selectCombatant ? settings.selectCombatant : false;
|
||||
const combat = game.combat;
|
||||
|
||||
if (mode == 'function'){
|
||||
@@ -140,15 +146,15 @@ export class CombatTracker{
|
||||
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
|
||||
|
||||
if (ctFunction == 'turnDisplay' && MODULE.getPermission('COMBAT','TURN_DISPLAY') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && MODULE.getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,24 +163,25 @@ export class CombatTracker{
|
||||
let background;
|
||||
if (game.combat.started){
|
||||
game.combat.endCombat();
|
||||
src = "modules/MaterialDeck/img/combattracker/startcombat.png";
|
||||
background = "#000000";
|
||||
}
|
||||
else {
|
||||
game.combat.startCombat();
|
||||
src = "modules/MaterialDeck/img/combattracker/stopcombat.png";
|
||||
background = "#FF0000";
|
||||
}
|
||||
streamDeck.setIcon(context,src,{background:background});
|
||||
return;
|
||||
}
|
||||
if (game.combat.started == false) return;
|
||||
|
||||
if (ctFunction == 'nextTurn') game.combat.nextTurn();
|
||||
else if (ctFunction == 'prevTurn') game.combat.previousTurn();
|
||||
else if (ctFunction == 'nextRound') game.combat.nextRound();
|
||||
else if (ctFunction == 'prevRound') game.combat.previousRound();
|
||||
else if (ctFunction == 'endTurn' && game.combat.combatant.owner) game.combat.nextTurn();
|
||||
if (ctFunction == 'nextTurn') await game.combat.nextTurn();
|
||||
else if (ctFunction == 'prevTurn') await game.combat.previousTurn();
|
||||
else if (ctFunction == 'nextRound') await game.combat.nextRound();
|
||||
else if (ctFunction == 'prevRound') await game.combat.previousRound();
|
||||
else if (ctFunction == 'endTurn' && game.combat.combatant.owner) await game.combat.nextTurn();
|
||||
|
||||
if (selectCombatant) {
|
||||
const token = canvas.tokens.placeables.filter(token => token.id == game.combat.combatant.token.id)[0];
|
||||
if (token.can(game.userId,"control")) token.control();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
const onClick = settings.onClick ? settings.onClick : 'doNothing';
|
||||
|
||||
684
src/external.js
@@ -1,10 +1,44 @@
|
||||
import * as MODULE from "../MaterialDeck.js";
|
||||
import {streamDeck} from "../MaterialDeck.js";
|
||||
|
||||
export class ExternalModules{
|
||||
soundscapeSettings = {
|
||||
channels: [],
|
||||
master: {
|
||||
mute: false,
|
||||
volume: 1,
|
||||
playing: false,
|
||||
name: 'Master'
|
||||
},
|
||||
soundboard: [],
|
||||
soundboardVolume: 1,
|
||||
playing: false
|
||||
}
|
||||
constructor(){
|
||||
this.active = false;
|
||||
this.gmScreenOpen = false;
|
||||
|
||||
let channelData = [];
|
||||
let soundboardData = [];
|
||||
for (let i=0; i<8; i++) {
|
||||
channelData.push({
|
||||
volume: 1,
|
||||
mute: false,
|
||||
solo: false,
|
||||
link: false,
|
||||
playing: false,
|
||||
pan: 1,
|
||||
name: ''
|
||||
})
|
||||
}
|
||||
for (let i=0; i<25; i++) {
|
||||
soundboardData.push({
|
||||
active: false,
|
||||
name: '',
|
||||
icon: ''
|
||||
})
|
||||
}
|
||||
this.soundscapeSettings.channels = channelData;
|
||||
this.soundscapeSettings.soundboard = soundboardData;
|
||||
}
|
||||
|
||||
async updateAll(data={}){
|
||||
@@ -12,39 +46,46 @@ export class ExternalModules{
|
||||
this.gmScreenOpen = data.gmScreen.isOpen;
|
||||
}
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'external') continue;
|
||||
await this.update(data.settings,data.context);
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
if (device?.buttons == undefined) continue;
|
||||
for (let i=0; i<device.buttons.length; i++){
|
||||
const data = device.buttons[i];
|
||||
if (data == undefined || data.action != 'external') continue;
|
||||
await this.update(data.settings,data.context,device.device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
update(settings,context,device){
|
||||
this.active = true;
|
||||
const module = settings.module ? settings.module : 'fxmaster';
|
||||
|
||||
if (module == 'fxmaster') this.updateFxMaster(settings,context);
|
||||
else if (module == 'gmscreen') this.updateGMScreen(settings,context);
|
||||
else if (module == 'triggerHappy') this.updateTriggerHappy(settings,context);
|
||||
else if (module == 'sharedVision') this.updateSharedVision(settings,context);
|
||||
else if (module == 'mookAI') this.updateMookAI(settings,context);
|
||||
else if (module == 'notYourTurn') this.updateNotYourTurn(settings,context);
|
||||
else if (module == 'lockView') this.updateLockView(settings,context);
|
||||
else if (module == 'aboutTime') this.updateAboutTime(settings,context);
|
||||
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 == 'soundscape') this.updateSoundscape(settings,context,device);
|
||||
else if (module == 'monksActiveTiles') this.updateMonksActiveTiles(settings,context,device);
|
||||
}
|
||||
|
||||
keyPress(settings,context){
|
||||
keyPress(settings,context,device){
|
||||
if (this.active == false) return;
|
||||
const module = settings.module ? settings.module : 'fxmaster';
|
||||
|
||||
if (module == 'fxmaster') this.keyPressFxMaster(settings,context);
|
||||
else if (module == 'gmscreen') this.keyPressGMScreen(settings,context);
|
||||
else if (module == 'triggerHappy') this.keyPressTriggerHappy(settings,context);
|
||||
else if (module == 'sharedVision') this.keyPressSharedVision(settings,context);
|
||||
else if (module == 'mookAI') this.keyPressMookAI(settings,context);
|
||||
else if (module == 'notYourTurn') this.keyPressNotYourTurn(settings,context);
|
||||
else if (module == 'lockView') this.keyPressLockView(settings,context);
|
||||
else if (module == 'aboutTime') this.keyPressAboutTime(settings,context);
|
||||
if (module == 'fxmaster') this.keyPressFxMaster(settings,context,device);
|
||||
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 == 'soundscape') this.keyPressSoundscape(settings,context,device);
|
||||
else if (module == 'monksActiveTiles') this.keyPressMonksActiveTiles(settings,context,device);
|
||||
}
|
||||
|
||||
getModuleEnable(moduleId){
|
||||
@@ -56,7 +97,7 @@ export class ExternalModules{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//FxMaster
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateFxMaster(settings,context){
|
||||
updateFxMaster(settings,context,device){
|
||||
if (game.user.isGM == false) return;
|
||||
const fxmaster = game.modules.get("fxmaster");
|
||||
if (fxmaster == undefined || fxmaster.active == false) return;
|
||||
@@ -72,38 +113,20 @@ export class ExternalModules{
|
||||
let name = '';
|
||||
if (type == 'weatherControls') {
|
||||
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
|
||||
name = CONFIG.weatherEffects[effect].label;
|
||||
icon = CONFIG.weatherEffects[effect].icon;
|
||||
ring = this.findWeatherEffect(effect) != undefined ? 2 : 1;
|
||||
name = CONFIG.fxmaster.weather[effect].label;
|
||||
icon = CONFIG.fxmaster.weather[effect].icon;
|
||||
ring = canvas.scene.getFlag("fxmaster", "effects")?.[`core_${effect}`] ? 2 : 1;
|
||||
ringColor = ring < 2 ? '#000000' : "#00ff00";
|
||||
}
|
||||
else if (type == 'colorize') {
|
||||
background = (settings.fxMasterColorizeColor == undefined) ? '#000000' : settings.fxMasterColorizeColor;
|
||||
icon = "fas fa-palette";
|
||||
name = game.i18n.localize("MaterialDeck.FxMaster.Colorize");
|
||||
const filters = canvas.scene.getFlag("fxmaster", "filters");
|
||||
ring = 2;
|
||||
if (filters == undefined || filters['core_color'] == undefined) {
|
||||
ringColor = "#000000";
|
||||
}
|
||||
else {
|
||||
const colors = filters['core_color'].options;
|
||||
let red = Math.ceil(colors.red*255).toString(16);
|
||||
if (red.length == 1) red = '0' + red;
|
||||
let green = Math.ceil(colors.green*255).toString(16);
|
||||
if (green.length == 1) green = '0' + green;
|
||||
let blue = Math.ceil(colors.blue*255).toString(16);
|
||||
if (blue.length == 1) blue = '0' + blue;
|
||||
ringColor = "#" + red + green + blue;
|
||||
}
|
||||
}
|
||||
else if (type == 'filters') {
|
||||
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
|
||||
name = CONFIG.fxmaster.filters[filter].label;
|
||||
background = "#340057";
|
||||
if (displayIcon){
|
||||
if (filter == 'underwater') icon = "fas fa-water";
|
||||
if (filter == 'lightning') icon = "fas fa-bolt";
|
||||
else if (filter == 'underwater') icon = "fas fa-water";
|
||||
else if (filter == 'predator') icon = "fas fa-wave-square";
|
||||
else if (filter == 'color') icon = "fas fa-palette";
|
||||
else if (filter == 'oldfilm') icon = "fas fa-film";
|
||||
else if (filter == 'bloom') icon = "fas fa-ghost";
|
||||
}
|
||||
@@ -119,28 +142,20 @@ export class ExternalModules{
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filter == 'color') background = settings.fxMasterFilterColor ? settings.fxMasterFilterColor : '#ffffff';
|
||||
}
|
||||
else if (type == 'clear'){
|
||||
icon = "fas fa-trash";
|
||||
name = game.i18n.localize("MaterialDeck.FxMaster.Clear");
|
||||
}
|
||||
|
||||
if (displayIcon) streamDeck.setIcon(context,icon,{background:background,ring:ring,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context, "", {background:background,ring:ring,ringColor:ringColor});
|
||||
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 = "";
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
|
||||
hexToRgb(hex) {
|
||||
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? {
|
||||
red: parseInt(result[1], 16)/256,
|
||||
green: parseInt(result[2], 16)/256,
|
||||
blue: parseInt(result[3], 16)/256
|
||||
} : null;
|
||||
}
|
||||
|
||||
keyPressFxMaster(settings,context){
|
||||
keyPressFxMaster(settings,context,device){
|
||||
if (game.user.isGM == false) return;
|
||||
const fxmaster = game.modules.get("fxmaster");
|
||||
if (fxmaster == undefined || fxmaster.active == false) return;
|
||||
@@ -149,91 +164,63 @@ export class ExternalModules{
|
||||
|
||||
if (type == 'weatherControls') {
|
||||
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
|
||||
let exists = false;
|
||||
let newEffects = {};
|
||||
let effects = canvas.scene.getFlag("fxmaster", "effects");
|
||||
if (effects != undefined){
|
||||
const weatherIds = Object.keys(effects);
|
||||
for (let i=0; i<weatherIds.length; i++){
|
||||
const weather = effects[weatherIds[i]].type;
|
||||
if (weather === effect) {
|
||||
exists = true;
|
||||
continue;
|
||||
}
|
||||
newEffects[weatherIds[i]] = effects[weatherIds[i]];
|
||||
}
|
||||
|
||||
const options = {
|
||||
density: (settings.densitySlider == undefined) ? 0.25 : settings.densitySlider,
|
||||
speed: (settings.speedSlider == undefined) ? 1 : settings.speedSlider,
|
||||
direction: (settings.directionSlider == undefined) ? 15 : settings.directionSlider,
|
||||
scale: (settings.scaleSlider == undefined) ? 1 : settings.scaleSlider,
|
||||
color: (settings.fxMasterWeatherColor == undefined) ? "#000000" : settings.fxMasterWeatherColor,
|
||||
applyColor: (settings.fxWeatherEnColor == undefined) ? false : settings.fxWeatherEnColor
|
||||
}
|
||||
|
||||
const density = (settings.densitySlider == undefined) ? 50 : settings.densitySlider;
|
||||
const speed = (settings.speedSlider == undefined) ? 50 : settings.speedSlider;
|
||||
const direction = (settings.directionSlider == undefined) ? 50 : settings.directionSlider;
|
||||
const scale = (settings.scaleSlider == undefined) ? 50 : settings.scaleSlider;
|
||||
const color = (settings.fxMasterWeatherColor == undefined) ? "#000000" : settings.fxMasterWeatherColor;
|
||||
const applyColor = (settings.fxWeatherEnColor == undefined) ? false : settings.fxWeatherEnColor;
|
||||
|
||||
if (exists == false) {
|
||||
newEffects[randomID()] = {
|
||||
type: effect,
|
||||
options: {
|
||||
density: density,
|
||||
speed: speed,
|
||||
scale: scale,
|
||||
tint: color,
|
||||
direction: direction,
|
||||
apply_tint: applyColor
|
||||
}
|
||||
};
|
||||
}
|
||||
canvas.scene.unsetFlag("fxmaster", "effects").then(() => {
|
||||
canvas.scene.setFlag("fxmaster", "effects", newEffects);
|
||||
});
|
||||
|
||||
}
|
||||
else if (type == 'colorize') {
|
||||
const color = (settings.fxMasterColorizeColor == undefined) ? '#000000' : settings.fxMasterColorizeColor;
|
||||
const filters = canvas.scene.getFlag("fxmaster", "filters");
|
||||
let newFilters = {};
|
||||
if (filters != undefined){
|
||||
const filterObjects = Object.keys(filters);
|
||||
for (let i=0; i<filterObjects.length; i++){
|
||||
if (filterObjects[i] == 'core_color'){
|
||||
//continue;
|
||||
}
|
||||
newFilters[filterObjects[i]] = filters[filterObjects[i]];
|
||||
}
|
||||
}
|
||||
newFilters['core_color'] = {
|
||||
type : 'color',
|
||||
options: this.hexToRgb(color)
|
||||
};
|
||||
|
||||
canvas.scene.unsetFlag("fxmaster", "filters").then(() => {
|
||||
canvas.scene.setFlag("fxmaster", "filters", newFilters);
|
||||
});
|
||||
Hooks.call("fxmaster.switchWeather", {
|
||||
name: `core_${effect}`,
|
||||
type: effect,
|
||||
options,
|
||||
});
|
||||
|
||||
}
|
||||
else if (type == 'filters') {
|
||||
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
|
||||
const filters = canvas.scene.getFlag("fxmaster", "filters");
|
||||
let newFilters = {};
|
||||
let exists = false;
|
||||
if (filters != undefined){
|
||||
const filterObjects = Object.keys(filters);
|
||||
for (let i=0; i<filterObjects.length; i++){
|
||||
if (filterObjects[i] == 'core_'+filter){
|
||||
exists = true;
|
||||
continue;
|
||||
}
|
||||
newFilters[filterObjects[i]] = filters[filterObjects[i]];
|
||||
|
||||
let options = {color: {value:"#000000", apply:false}};
|
||||
if (filter == 'lightning') {
|
||||
options.period = settings.fxMasterFilterPeriod ? parseFloat(settings.fxMasterFilterPeriod) : 500;
|
||||
options.duration = settings.fxMasterFilterDuration ? parseFloat(settings.fxMasterFilterDuration) : 300;
|
||||
options.brightness = settings.fxMasterFilterBrightness ? parseFloat(settings.fxMasterFilterBrightness) : 1.3;
|
||||
}
|
||||
else if (filter == 'underwater') {
|
||||
options.speed = settings.fxMasterFilterSpeed ? parseFloat(settings.fxMasterFilterSpeed) : 0.3;
|
||||
options.scale = settings.fxMasterFilterScale ? parseFloat(settings.fxMasterFilterScale) : 4;
|
||||
}
|
||||
else if (filter == 'predator') {
|
||||
options.noise = settings.fxMasterFilterNoise ? parseFloat(settings.fxMasterFilterNoise) : 4;
|
||||
options.speed = settings.fxMasterFilterSpeed ? parseFloat(settings.fxMasterFilterSpeed)*0.1 : 0.03;
|
||||
}
|
||||
|
||||
else if (filter == 'bloom') {
|
||||
options.blur = settings.fxMasterFilterBlur ? parseFloat(settings.fxMasterFilterBlur) : 1;
|
||||
options.bloom = settings.fxMasterFilterBloom ? parseFloat(settings.fxMasterFilterBloom) : 0.1;
|
||||
options.threshold = settings.fxMasterFilterThreshold ? parseFloat(settings.fxMasterFilterThreshold) : 0.5;
|
||||
}
|
||||
else if (filter == 'oldfilm') {
|
||||
options.sepia = settings.fxMasterFilterSepia ? parseFloat(settings.fxMasterFilterSepia) : 0.3;
|
||||
options.noise = settings.fxMasterFilterNoise ? parseFloat(settings.fxMasterFilterNoise) : 4;
|
||||
}
|
||||
|
||||
if (filter == 'color') {
|
||||
options.color = {
|
||||
apply: settings.fxMasterFilterTint ? settings.fxMasterFilterTint : false,
|
||||
value: settings.fxMasterFilterColor ? settings.fxMasterFilterColor : '#ffffff'
|
||||
}
|
||||
|
||||
options.saturation = settings.fxMasterFilterSaturation ? parseFloat(settings.fxMasterFilterSaturation) : 1;
|
||||
options.contrast = settings.fxMasterFilterContrast ? parseFloat(settings.fxMasterFilterContrast) : 1;
|
||||
options.brightness = settings.fxMasterFilterBrightness ? parseFloat(settings.fxMasterFilterBrightness) : 1;
|
||||
options.Gamma = settings.fxMasterFilterGamma ? parseFloat(settings.fxMasterFilterGamma) : 1;
|
||||
}
|
||||
if (exists == false) {
|
||||
newFilters['core_'+filter] = {type : filter};
|
||||
}
|
||||
canvas.scene.unsetFlag("fxmaster", "filters").then(() => {
|
||||
canvas.scene.setFlag("fxmaster", "filters", newFilters);
|
||||
});
|
||||
|
||||
FXMASTER.filters.switch(`core_${filter}`, filter, options);
|
||||
}
|
||||
else if (type == 'clear'){
|
||||
canvas.scene.unsetFlag("fxmaster", "filters");
|
||||
@@ -241,23 +228,11 @@ export class ExternalModules{
|
||||
}
|
||||
}
|
||||
|
||||
findWeatherEffect(effect){
|
||||
const effects = canvas.scene.getFlag("fxmaster", "effects");
|
||||
if (effects == undefined) return undefined;
|
||||
|
||||
const weatherIds = Object.keys(effects);
|
||||
for (let i = 0; i < weatherIds.length; ++i) {
|
||||
const weather = effects[weatherIds[i]].type;
|
||||
if (weather === effect) return weatherIds[i];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//GM Screen
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateGMScreen(settings,context){
|
||||
updateGMScreen(settings,context,device){
|
||||
if (this.getModuleEnable("gm-screen") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -270,22 +245,22 @@ export class ExternalModules{
|
||||
if (this.gmScreenOpen) ring = 2;
|
||||
|
||||
if (settings.displayGmScreenIcon) src = "fas fa-book-reader";
|
||||
streamDeck.setIcon(context,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
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);
|
||||
}
|
||||
|
||||
keyPressGMScreen(settings,context){
|
||||
keyPressGMScreen(settings,context,device){
|
||||
if (this.getModuleEnable("gm-screen") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
window['gm-screen'].toggleGmScreenVisibility();
|
||||
game.modules.get('gm-screen')?.api?.toggleGmScreenVisibility?.();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Trigger Happy
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateTriggerHappy(settings,context) {
|
||||
updateTriggerHappy(settings,context,device) {
|
||||
if (this.getModuleEnable("trigger-happy") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -296,14 +271,14 @@ export class ExternalModules{
|
||||
const ringColor = game.settings.get("trigger-happy", "enableTriggers") ? "#A600FF" : "#340057";
|
||||
|
||||
let txt = '';
|
||||
if (displayIcon) streamDeck.setIcon(context,"fas fa-grin-squint-tears",{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,'',{background:'#000000'});
|
||||
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-grin-squint-tears",{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName) txt = 'Trigger Happy';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
keyPressTriggerHappy(settings,context){
|
||||
keyPressTriggerHappy(settings,context,device){
|
||||
if (this.getModuleEnable("trigger-happy") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
const mode = settings.triggerHappyMode ? settings.triggerHappyMode : 'toggle';
|
||||
@@ -326,7 +301,7 @@ export class ExternalModules{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Shared Vision
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateSharedVision(settings,context) {
|
||||
updateSharedVision(settings,context,device) {
|
||||
if (this.getModuleEnable("SharedVision") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -337,13 +312,13 @@ export class ExternalModules{
|
||||
const ringColor = game.settings.get("SharedVision", "enable") ? "#A600FF" : "#340057";
|
||||
|
||||
let txt = '';
|
||||
if (displayIcon) streamDeck.setIcon(context,"fas fa-eye",{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,'',{background:'#000000'});
|
||||
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-eye",{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName) txt = 'Shared Vision';
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
keyPressSharedVision(settings,context) {
|
||||
keyPressSharedVision(settings,context,device) {
|
||||
if (this.getModuleEnable("SharedVision") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -357,7 +332,7 @@ export class ExternalModules{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Mook AI
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateMookAI(settings,context) {
|
||||
updateMookAI(settings,context,device) {
|
||||
if (this.getModuleEnable("mookAI") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -367,13 +342,13 @@ export class ExternalModules{
|
||||
const background = "#000000";
|
||||
|
||||
let txt = '';
|
||||
if (displayIcon) streamDeck.setIcon(context,"fas fa-brain",{background:'#000000'});
|
||||
else streamDeck.setIcon(context,'',{background:'#000000'});
|
||||
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) {
|
||||
async keyPressMookAI(settings,context,device) {
|
||||
if (this.getModuleEnable("mookAI") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -385,7 +360,7 @@ export class ExternalModules{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Not Your Turn!
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateNotYourTurn(settings,context) {
|
||||
updateNotYourTurn(settings,context,device) {
|
||||
|
||||
if (this.getModuleEnable("NotYourTurn") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
@@ -409,13 +384,13 @@ export class ExternalModules{
|
||||
txt = "Block Non-Combat Movement";
|
||||
ringColor = game.settings.get('NotYourTurn','nonCombat') ? "#A600FF": "#340057" ;
|
||||
}
|
||||
if (displayIcon) streamDeck.setIcon(context,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,'',{background:'#000000'});
|
||||
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName == false) txt = '';
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
async keyPressNotYourTurn(settings,context) {
|
||||
async keyPressNotYourTurn(settings,context,device) {
|
||||
if (this.getModuleEnable("NotYourTurn") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -433,7 +408,7 @@ export class ExternalModules{
|
||||
//Lock View
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateLockView(settings,context) {
|
||||
updateLockView(settings,context,device) {
|
||||
|
||||
if (this.getModuleEnable("LockView") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
@@ -463,13 +438,13 @@ export class ExternalModules{
|
||||
ringColor = canvas.scene.getFlag('LockView', 'boundingBox') ? "#A600FF": "#340057" ;
|
||||
}
|
||||
|
||||
if (displayIcon) streamDeck.setIcon(context,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,'',{background:'#000000'});
|
||||
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||
if (displayName == false) txt = '';
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
async keyPressLockView(settings,context) {
|
||||
async keyPressLockView(settings,context,device) {
|
||||
if (this.getModuleEnable("LockView") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -489,7 +464,7 @@ export class ExternalModules{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//About Time
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateAboutTime(settings,context) {
|
||||
updateAboutTime(settings,context,device) {
|
||||
if (this.getModuleEnable("about-time") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -566,10 +541,10 @@ export class ExternalModules{
|
||||
}
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,'',{background:background,ring:ring,ringColor:ringColor, clock:clock});
|
||||
streamDeck.setIcon(context,device,'',{background:background,ring:ring,ringColor:ringColor, clock:clock});
|
||||
}
|
||||
|
||||
keyPressAboutTime(settings,context) {
|
||||
keyPressAboutTime(settings,context,device) {
|
||||
if (this.getModuleEnable("about-time") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
@@ -696,6 +671,363 @@ export class ExternalModules{
|
||||
game.Gametime.advanceTime({ hours: -1 });
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Soundscape
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateSoundscape(settings,context,device) {
|
||||
|
||||
if (this.getModuleEnable("soundscape") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
const target = settings.soundscapeTarget ? settings.soundscapeTarget : 'mixer';
|
||||
let channel = settings.soundscapeChannel ? settings.soundscapeChannel : 1;
|
||||
|
||||
let background = '#000000';
|
||||
let ring = 0;
|
||||
let ringColor = '#000000';
|
||||
|
||||
let txt = '';
|
||||
let src = 'modules/MaterialDeck/img/transparant.png';
|
||||
let name = '';
|
||||
|
||||
if (target == 'mixer') {
|
||||
let mode = settings.soundscapeMixerMode ? settings.soundscapeMixerMode : 'startStopAll';
|
||||
const displayName = settings.soundscapeMixerName;
|
||||
const displayChannel = settings.soundscapeDisplayMixerChannel;
|
||||
|
||||
if (mode == 'startStopAll') {
|
||||
channel = 'master';
|
||||
mode = 'startStop';
|
||||
}
|
||||
|
||||
if (channel == 'Master') channel = 'master';
|
||||
|
||||
let channelSettings;
|
||||
if (channel == 'master') {
|
||||
channelSettings = this.soundscapeSettings.master;
|
||||
channelSettings.playing = this.soundscapeSettings.playing;
|
||||
channelSettings.name = 'Master';
|
||||
}
|
||||
else channelSettings = this.soundscapeSettings.channels[channel-1];
|
||||
if (displayChannel && channel == 'master') txt += 'Master';
|
||||
else if (displayChannel) txt += channel;
|
||||
|
||||
if (mode == 'startStop') {
|
||||
if (displayChannel) txt += '\n';
|
||||
if (channelSettings.playing) {
|
||||
src = "fas fa-stop";
|
||||
ringColor = '#00ff00';
|
||||
}
|
||||
else {
|
||||
src = "fas fa-play";
|
||||
ringColor = '#006600';
|
||||
}
|
||||
ring=2;
|
||||
|
||||
}
|
||||
else if (mode == 'mute') {
|
||||
if (displayChannel) txt += '\n';
|
||||
txt += 'M';
|
||||
if (displayName) txt += '\n';
|
||||
ring=2;
|
||||
ringColor = '#ff0000';
|
||||
background = channelSettings.mute ? '#ff0000' : '#660000'
|
||||
}
|
||||
else if (mode == 'solo') {
|
||||
if (channel == 'master') return;
|
||||
if (displayChannel) txt += '\n';
|
||||
txt += 'S';
|
||||
if (displayName) txt += '\n';
|
||||
ring=2;
|
||||
ringColor = '#ffff00';
|
||||
background = channelSettings.solo ? '#ffff00' : '#666600'
|
||||
}
|
||||
else if (mode == 'link') {
|
||||
if (channel == 'master') return;
|
||||
if (displayChannel) txt += '\n';
|
||||
txt += 'L';
|
||||
if (displayName) txt += '\n';
|
||||
ring=2;
|
||||
ringColor = '#00ffff';
|
||||
background = channelSettings.link ? '#00ffff' : '#000066'
|
||||
}
|
||||
else if (displayName && displayChannel) txt += '\n';
|
||||
|
||||
if (displayName) txt += channelSettings.name;
|
||||
|
||||
if (mode == 'volume') {
|
||||
const displayValue = settings.soundscapeDisplayMixerValue;
|
||||
const volume = Math.floor(channelSettings.volume*100);
|
||||
if (displayValue && (displayName || displayChannel)) txt += '\n';
|
||||
if (displayValue) txt += volume;
|
||||
}
|
||||
|
||||
}
|
||||
else if (target == 'soundboard') {
|
||||
const displayName = settings.soundscapeSoundboardName;
|
||||
const displayIcon = settings.soundscapeSoundboardIcon;
|
||||
const displayChannel = settings.soundscapeDisplayChannel;
|
||||
const displayValue = settings.soundscapeSoundboardValue;
|
||||
const mode = settings.soundscapeSoundboardMode ? settings.soundscapeSoundboardMode : 'play';
|
||||
|
||||
if (mode == 'play') {
|
||||
channel -= 1;
|
||||
let sound = this.soundscapeSettings.soundboard[channel];
|
||||
|
||||
if (displayChannel) txt += channel+1;
|
||||
if (displayChannel && displayName) txt += '\n';
|
||||
if (displayName) txt += sound.name;
|
||||
if (displayIcon) src = sound.icon;
|
||||
}
|
||||
else if (mode == 'volume') {
|
||||
const volume = Math.floor(this.soundscapeSettings.soundboardVolume*100);
|
||||
if (displayValue) txt += volume;
|
||||
}
|
||||
else if (mode == 'stop') {
|
||||
src = 'modules/MaterialDeck/img/playlist/stop.png';
|
||||
}
|
||||
}
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
}
|
||||
|
||||
async keyPressSoundscape(settings,context,device) {
|
||||
if (this.getModuleEnable("soundscape") == false) return;
|
||||
if (game.user.isGM == false) return;
|
||||
|
||||
const target = settings.soundscapeTarget ? settings.soundscapeTarget : 'mixer';
|
||||
let channel = settings.soundscapeChannel ? settings.soundscapeChannel : 1;
|
||||
|
||||
if (target == 'mixer') {
|
||||
const mode = settings.soundscapeMixerMode ? settings.soundscapeMixerMode : 'startStopAll';
|
||||
|
||||
if (mode == 'startStopAll') {
|
||||
const playing = !this.soundscapeSettings.playing;
|
||||
if (playing) {
|
||||
Hooks.call('setSoundscape',{"msgType":"start","channelNr":undefined});
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Hooks.call('setSoundscape',{"msgType":"stop","channelNr":undefined});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (channel == 'Master') channel = 'master';
|
||||
|
||||
let channelSettings;
|
||||
if (channel == 'master') {
|
||||
channelSettings = this.soundscapeSettings.master;
|
||||
channelSettings.playing = this.soundscapeSettings.playing;
|
||||
}
|
||||
else channelSettings = this.soundscapeSettings.channels[channel-1];
|
||||
|
||||
let mute, solo, link, playing;
|
||||
let setChannel = false;
|
||||
|
||||
if (mode == 'startStop') {
|
||||
setChannel = true;
|
||||
playing = !channelSettings.playing;
|
||||
if (channel == 'master' && playing) {
|
||||
Hooks.call('setSoundscape',{"msgType":"stop"});
|
||||
return;
|
||||
}
|
||||
else if (channel == 'master') {
|
||||
Hooks.call('setSoundscape',{"msgType":"start"});
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (mode == 'mute') {
|
||||
setChannel = true;
|
||||
mute = !channelSettings.mute;
|
||||
}
|
||||
else if (mode == 'solo') {
|
||||
if (channel == 'master') return;
|
||||
setChannel = true;
|
||||
solo = !channelSettings.solo;
|
||||
}
|
||||
else if (mode == 'link') {
|
||||
if (channel == 'master') return;
|
||||
setChannel = true;
|
||||
link = !channelSettings.link;
|
||||
}
|
||||
if (setChannel) {
|
||||
const channelNr = channel == 'master' ? 'master' : channel-1;
|
||||
const payload = {
|
||||
"msgType": "setChannel",
|
||||
"channelNr": channelNr,
|
||||
mute,
|
||||
solo,
|
||||
link,
|
||||
playing
|
||||
};
|
||||
Hooks.call('setSoundscape',payload);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == 'volume') {
|
||||
const volumeMode = settings.soundscapeMixerValueMode ? settings.soundscapeMixerValueMode : 'incrementDecrement';
|
||||
const value = parseInt(settings.soundscapeMixerValue);
|
||||
if (isNaN(value) == false) {
|
||||
let volume = channelSettings.volume*100;
|
||||
|
||||
if (volumeMode == 'set')
|
||||
volume = value;
|
||||
else
|
||||
volume += value;
|
||||
|
||||
volume = Math.floor(volume*100)/10000;
|
||||
const channelNr = channel == 'master' ? 'master' : channel-1;
|
||||
const payload = {
|
||||
"msgType": "setVolume",
|
||||
"channelNr": channelNr,
|
||||
volume
|
||||
};
|
||||
Hooks.call('setSoundscape',payload);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (target == 'soundboard') {
|
||||
const mode = settings.soundscapeSoundboardMode ? settings.soundscapeSoundboardMode : 'play';
|
||||
|
||||
if (mode == 'play') {
|
||||
channel -= 1;
|
||||
const payload = {
|
||||
"msgType": "playSoundboard",
|
||||
channelNr: channel
|
||||
};
|
||||
Hooks.call('setSoundscape',payload);
|
||||
}
|
||||
else if (mode == 'volume') {
|
||||
const volumeMode = settings.soundscapeSoundboardValueMode ? settings.soundscapeSoundboardValueMode : 'incrementDecrement';
|
||||
const value = parseInt(settings.soundscapeSoundboardValue);
|
||||
if (isNaN(value) == false) {
|
||||
let volume = this.soundscapeSettings.soundboardVolume*100;
|
||||
|
||||
if (volumeMode == 'set')
|
||||
volume = value;
|
||||
else
|
||||
volume += value;
|
||||
|
||||
volume = Math.floor(volume*100)/10000;
|
||||
const payload = {
|
||||
"msgType": "setSoundboardVolume",
|
||||
volume
|
||||
};
|
||||
Hooks.call('setSoundscape',payload);
|
||||
}
|
||||
}
|
||||
else if (mode == 'stop') {
|
||||
const payload = {
|
||||
"msgType": "stopSoundboard"
|
||||
};
|
||||
Hooks.call('setSoundscape',payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newSoundscapeData(data) {
|
||||
let channel;
|
||||
if (data.channel != undefined) channel = data.channel;
|
||||
else if (data.channelNr != undefined) channel = data.channelNr;
|
||||
|
||||
let channelSettings = channel == 'master' ? this.soundscapeSettings.master : this.soundscapeSettings.channels[channel]
|
||||
if (data.msgType == 'soundConfig') {
|
||||
|
||||
let newChannelSettings = {
|
||||
volume: data.data.settings.volume,
|
||||
mute: data.data.settings.mute,
|
||||
solo: data.data.settings.solo,
|
||||
link: data.data.settings.link,
|
||||
playing: false,
|
||||
pan: data.data.settings.pan,
|
||||
name: data.data.settings.name
|
||||
};
|
||||
this.soundscapeSettings.channels[channel] = newChannelSettings;
|
||||
}
|
||||
else if (data.msgType == 'setMute') channelSettings.mute = data.mute;
|
||||
else if (data.msgType == 'setSolo') channelSettings.solo = data.solo;
|
||||
else if (data.msgType == 'setLink') channelSettings.link = data.link;
|
||||
else if (data.msgType == 'setVolume') {
|
||||
if (channel >= 100) return;
|
||||
channelSettings.volume = data.volume;
|
||||
}
|
||||
else if (data.msgType == 'start') {
|
||||
this.soundscapeSettings.playing = true;
|
||||
this.soundscapeSettings.master.playing = true;
|
||||
if (data.channel == undefined) for (let i=0; i<8; i++) this.soundscapeSettings.channels[i].playing = true;
|
||||
else this.soundscapeSettings.channels[data.channel].playing = true;
|
||||
}
|
||||
else if (data.msgType == 'stop') {
|
||||
|
||||
if (data.channel == undefined) {
|
||||
for (let i=0; i<8; i++) this.soundscapeSettings.channels[i].playing = false;
|
||||
this.soundscapeSettings.playing = false;
|
||||
}
|
||||
else {
|
||||
this.soundscapeSettings.channels[data.channel].playing = false;
|
||||
let check = 0;
|
||||
for (let i=0; i<8; i++) if (this.soundscapeSettings.channels[data.channel].playing) check++;
|
||||
if (check == 0) this.soundscapeSettings.playing = false;
|
||||
}
|
||||
}
|
||||
else if (data.msgType == 'sbSoundConfig') {
|
||||
|
||||
const channel = data.channel - 100;
|
||||
let active = true;
|
||||
if (data.data.soundArray == undefined) active = false;
|
||||
this.soundscapeSettings.soundboard[channel] = {
|
||||
active,
|
||||
name: data.data.name,
|
||||
icon: data.data.imageSrc
|
||||
};
|
||||
}
|
||||
else if (data.msgType == 'setSoundboardVolume')
|
||||
this.soundscapeSettings.soundboardVolume = data.volume;
|
||||
|
||||
this.updateAll();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//Monks Active Tile Triggers
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
updateMonksActiveTiles(settings,context,device) {
|
||||
const id = settings.monksActiveTilesId;
|
||||
if (id == undefined || id == '') return;
|
||||
let tile = canvas.background.placeables.find(t => t.id == id);
|
||||
if (tile == undefined) return;
|
||||
const tileData = tile.data.flags?.['monks-active-tiles'];
|
||||
if (tileData == undefined) return;
|
||||
|
||||
let ring = 1;
|
||||
let ringColor = '#000000';
|
||||
let background = '#000000';
|
||||
if (tileData.active) {
|
||||
ring = 2;
|
||||
ringColor = '#00ff00'
|
||||
}
|
||||
let src = tile.data.img;
|
||||
|
||||
streamDeck.setTitle('',context);
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressMonksActiveTiles(settings,context,device) {
|
||||
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);
|
||||
if (tile == undefined) return;
|
||||
const tileData = tile.data.flags?.['monks-active-tiles'];
|
||||
if (tileData == undefined) return;
|
||||
|
||||
if (mode == 'toggle') tile.document.setFlag('monks-active-tiles','active',!tileData.active);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
115
src/macro.js
@@ -10,14 +10,17 @@ export class MacroControl{
|
||||
|
||||
async updateAll(){
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'macro') continue;
|
||||
await this.update(data.settings,data.context);
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
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') continue;
|
||||
await this.update(data.settings,data.context,device.device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async update(settings,context){
|
||||
async update(settings,context,device){
|
||||
this.active = true;
|
||||
const mode = settings.macroMode ? settings.macroMode : 'hotbar';
|
||||
const displayName = settings.displayName ? settings.displayName : false;
|
||||
@@ -37,7 +40,7 @@ export class MacroControl{
|
||||
|
||||
if (mode == 'macroBoard') { //Macro board
|
||||
if ((MODULE.getPermission('MACRO','MACROBOARD') == false )) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
if (settings.macroBoardMode == 'offset') { //Offset
|
||||
@@ -49,6 +52,7 @@ export class MacroControl{
|
||||
|
||||
ringColor = (macroOffset == parseInt(this.offset)) ? ringOnColor : ringOffColor;
|
||||
ring = 2;
|
||||
src = "modules/MaterialDeck/img/transparant.png";
|
||||
}
|
||||
else { //Execute macro
|
||||
macroNumber += this.offset - 1;
|
||||
@@ -66,7 +70,7 @@ export class MacroControl{
|
||||
}
|
||||
else { //Macro Hotbar
|
||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
if (mode == 'hotbar') macroId = game.user.data.hotbar[macroNumber];
|
||||
@@ -95,7 +99,7 @@ export class MacroControl{
|
||||
if (displayIcon) src = "modules/MaterialDeck/img/black.png";
|
||||
}
|
||||
|
||||
streamDeck.setIcon(context,src,{background:background,ring:ring,ringColor:ringColor,uses:uses});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,uses:uses});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
|
||||
@@ -106,48 +110,51 @@ export class MacroControl{
|
||||
return uses;
|
||||
}
|
||||
|
||||
async hotbar(macros){
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
|
||||
async hotbar(){
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
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;
|
||||
|
||||
const context = data.context;
|
||||
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
|
||||
const displayName = data.settings.displayName ? data.settings.displayName : false;
|
||||
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
|
||||
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
|
||||
let background = data.settings.background ? data.settings.background : '#000000';
|
||||
let macroNumber = data.settings.macroNumber;
|
||||
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
|
||||
const context = data.context;
|
||||
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
|
||||
const displayName = data.settings.displayName ? data.settings.displayName : false;
|
||||
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
|
||||
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
|
||||
let background = data.settings.background ? data.settings.background : '#000000';
|
||||
let macroNumber = data.settings.macroNumber;
|
||||
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
|
||||
|
||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
|
||||
streamDeck.noPermission(context);
|
||||
return;
|
||||
}
|
||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
|
||||
let src = "";
|
||||
let name = "";
|
||||
let src = "";
|
||||
let name = "";
|
||||
|
||||
if (mode == 'Macro Board') continue;
|
||||
|
||||
let macroId;
|
||||
if (mode == 'hotbar'){
|
||||
macroId = game.user.data.hotbar[macroNumber];
|
||||
if (mode == 'Macro Board') continue;
|
||||
|
||||
let macroId;
|
||||
if (mode == 'hotbar'){
|
||||
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,src,{background:background,uses:uses});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,14 +163,6 @@ export class MacroControl{
|
||||
let macroNumber = settings.macroNumber;
|
||||
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 0;
|
||||
let target = settings.target ? settings.target : undefined;
|
||||
//const targetActor = target.actor ? undefined : target;
|
||||
//if (targetActor != undefined) target = undefined;
|
||||
|
||||
//let macroTarget = {
|
||||
// token: target,
|
||||
// actor: targetActor
|
||||
//}
|
||||
//console.log('target',macroTarget,mode);
|
||||
|
||||
if (mode == 'hotbar' || mode == 'visibleHotbar' || mode == 'customHotbar'){
|
||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) return;
|
||||
@@ -181,7 +180,12 @@ export class MacroControl{
|
||||
let furnaceEnabled = false;
|
||||
let furnace = game.modules.get("furnace");
|
||||
if (furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) furnaceEnabled = true;
|
||||
|
||||
let advancedMacros = game.modules.get("advanced-macros");
|
||||
if (advancedMacros != undefined && advancedMacros.active) furnaceEnabled = true;
|
||||
|
||||
if (args == "" || args == " ") furnaceEnabled = false;
|
||||
|
||||
if (furnaceEnabled == false) macro.execute({token:target});
|
||||
else {
|
||||
let chatData = {
|
||||
@@ -236,7 +240,12 @@ export class MacroControl{
|
||||
let furnaceEnabled = false;
|
||||
let furnace = game.modules.get("furnace");
|
||||
if (furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) furnaceEnabled = true;
|
||||
|
||||
let advancedMacros = game.modules.get("advanced-macros");
|
||||
if (advancedMacros != undefined && advancedMacros.active) furnaceEnabled = true;
|
||||
|
||||
if (args == undefined || args[macroNumber] == undefined || args[macroNumber] == "") furnaceEnabled = false;
|
||||
|
||||
if (furnaceEnabled == false) macro.execute();
|
||||
else {
|
||||
let chatData = {
|
||||
|
||||
800
src/misc.js
@@ -1,15 +1,17 @@
|
||||
import * as MODULE from "../MaterialDeck.js";
|
||||
import {sdVersion, msVersion, moduleName, getPermission, enableModule, streamDeck} from "../MaterialDeck.js";
|
||||
import {macroControl,soundboard,playlistControl} from "../MaterialDeck.js";
|
||||
|
||||
export function compatibleCore(compatibleVersion){
|
||||
let coreVersion = game.data.version;
|
||||
let coreVersion = game.version == undefined ? game.data.version : `0.${game.version}`;
|
||||
coreVersion = coreVersion.split(".");
|
||||
compatibleVersion = compatibleVersion.split(".");
|
||||
if (compatibleVersion[0] > coreVersion[0]) return false;
|
||||
if (compatibleVersion[0] < coreVersion[0]) return true;
|
||||
if (compatibleVersion[1] > coreVersion[1]) return false;
|
||||
if (compatibleVersion[1] < coreVersion[1]) return true;
|
||||
if (compatibleVersion[2] > coreVersion[2]) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class playlistConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
@@ -36,12 +38,12 @@ export class playlistConfigForm extends FormApplication {
|
||||
* Provide data to the template
|
||||
*/
|
||||
getData() {
|
||||
if (MODULE.getPermission('PLAYLIST','CONFIGURE') == false ) {
|
||||
if (getPermission('PLAYLIST','CONFIGURE') == false ) {
|
||||
ui.notifications.warn(game.i18n.localize("MaterialDeck.Notifications.Playlist.NoPermission"));
|
||||
return;
|
||||
}
|
||||
//Get the playlist settings
|
||||
let settings = game.settings.get(MODULE.moduleName,'playlists');
|
||||
let settings = game.settings.get(moduleName,'playlists');
|
||||
|
||||
//Get values from the settings, and check if they are defined
|
||||
let selectedPlaylists = settings.selectedPlaylist;
|
||||
@@ -125,8 +127,8 @@ export class playlistConfigForm extends FormApplication {
|
||||
|
||||
async updateSettings(settings,render){
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(MODULE.moduleName,'playlists', settings);
|
||||
if (MODULE.enableModule) playlistControl.updateAll();
|
||||
await game.settings.set(moduleName,'playlists', settings);
|
||||
if (enableModule) playlistControl.updateAll();
|
||||
if (render) this.render();
|
||||
}
|
||||
else {
|
||||
@@ -146,6 +148,7 @@ export class macroConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
this.data = data;
|
||||
this.page = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,14 +167,14 @@ export class macroConfigForm extends FormApplication {
|
||||
* Provide data to the template
|
||||
*/
|
||||
getData() {
|
||||
if (MODULE.getPermission('MACRO','MACROBOARD_CONFIGURE') == false ) {
|
||||
if (getPermission('MACRO','MACROBOARD_CONFIGURE') == false ) {
|
||||
ui.notifications.warn(game.i18n.localize("MaterialDeck.Notifications.Macroboard.NoPermission"));
|
||||
return;
|
||||
}
|
||||
//Get the settings
|
||||
var selectedMacros = game.settings.get(MODULE.moduleName,'macroSettings').macros;
|
||||
var color = game.settings.get(MODULE.moduleName,'macroSettings').color;
|
||||
var args = game.settings.get(MODULE.moduleName,'macroSettings').args;
|
||||
var selectedMacros = game.settings.get(moduleName,'macroSettings').macros;
|
||||
var color = game.settings.get(moduleName,'macroSettings').color;
|
||||
var args = game.settings.get(moduleName,'macroSettings').args;
|
||||
|
||||
//Check if the settings are defined
|
||||
if (selectedMacros == undefined) selectedMacros = [];
|
||||
@@ -182,33 +185,18 @@ export class macroConfigForm extends FormApplication {
|
||||
let furnaceEnabled = false;
|
||||
let height = 95;
|
||||
let furnace = game.modules.get("furnace");
|
||||
if (furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) {
|
||||
let advancedMacros = game.modules.get("advanced-macros");
|
||||
if ((furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) || (advancedMacros != undefined && advancedMacros.active)) {
|
||||
furnaceEnabled = true;
|
||||
height += 50;
|
||||
}
|
||||
|
||||
//Check what SD model the user is using, and set the number of rows and columns to correspond
|
||||
let streamDeckModel = game.settings.get(MODULE.moduleName,'streamDeckModel');
|
||||
let iMax,jMax;
|
||||
if (streamDeckModel == 0){
|
||||
jMax = 6;
|
||||
iMax = 3;
|
||||
}
|
||||
else if (streamDeckModel == 1){
|
||||
jMax = 6;
|
||||
iMax = 5;
|
||||
}
|
||||
else {
|
||||
jMax = 8;
|
||||
iMax = 8;
|
||||
}
|
||||
|
||||
let iteration = 0;
|
||||
let iteration = this.page*32;
|
||||
let macroData = [];
|
||||
for (let j=0; j<jMax; j++){
|
||||
for (let j=0; j<4; j++){
|
||||
let macroThis = [];
|
||||
|
||||
for (let i=0; i<iMax; i++){
|
||||
for (let i=0; i<8; i++){
|
||||
let colorData = color[iteration];
|
||||
if (colorData != undefined){
|
||||
let colorCorrect = true;
|
||||
@@ -233,13 +221,15 @@ export class macroConfigForm extends FormApplication {
|
||||
}
|
||||
macroData.push({dataThis: macroThis});
|
||||
}
|
||||
|
||||
return {
|
||||
height: height,
|
||||
macros: game.macros,
|
||||
selectedMacros: selectedMacros,
|
||||
macroData: macroData,
|
||||
furnace: furnaceEnabled
|
||||
furnace: furnaceEnabled,
|
||||
macroRange: `${this.page*32 + 1} - ${this.page*32 + 32}`,
|
||||
prevDisabled: this.page == 0 ? 'disabled' : '',
|
||||
totalMacros: Math.max(Math.ceil(selectedMacros.length/32)*32, this.page*32 + 32)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,27 +244,118 @@ export class macroConfigForm extends FormApplication {
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
const navNext = html.find("button[id='navNext']");
|
||||
const navPrev = html.find("button[id='navPrev']");
|
||||
const clearAll = html.find("button[id='clearAll']");
|
||||
const clearPage = html.find("button[id='clearPage']");
|
||||
const importBtn = html.find("button[id='import']");
|
||||
const exportBtn = html.find("button[id='export']");
|
||||
const macro = html.find("select[name='macros']");
|
||||
const args = html.find("input[name='args']");
|
||||
const color = html.find("input[name='colorPicker']");
|
||||
|
||||
importBtn.on('click', async(event) => {
|
||||
let importDialog = new importConfigForm();
|
||||
importDialog.setData('macroboard',this)
|
||||
importDialog.render(true);
|
||||
});
|
||||
|
||||
exportBtn.on('click', async(event) => {
|
||||
const settings = game.settings.get(moduleName,'macroSettings');
|
||||
let exportDialog = new exportConfigForm();
|
||||
exportDialog.setData(settings,'macroboard')
|
||||
exportDialog.render(true);
|
||||
});
|
||||
|
||||
navNext.on('click',async (event) => {
|
||||
this.page++;
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
navPrev.on('click',async (event) => {
|
||||
const settings = game.settings.get(moduleName,'macroSettings');
|
||||
this.page--;
|
||||
if (this.page < 0) this.page = 0;
|
||||
else {
|
||||
const totalMacros = Math.ceil(settings.macros.length/32)*32;
|
||||
if ((this.page + 2)*32 == totalMacros) {
|
||||
let pageEmpty = this.getPageEmpty(totalMacros-32);
|
||||
if (pageEmpty) {
|
||||
await this.clearPage(totalMacros-32,true)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
clearAll.on('click',async (event) => {
|
||||
const parent = this;
|
||||
|
||||
let d = new Dialog({
|
||||
title: game.i18n.localize("MaterialDeck.ClearAll"),
|
||||
content: game.i18n.localize("MaterialDeck.ClearAll_Content"),
|
||||
buttons: {
|
||||
continue: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Continue"),
|
||||
callback: async () => {
|
||||
this.page = 0;
|
||||
await parent.clearAllSettings();
|
||||
parent.render(true);
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Cancel")
|
||||
}
|
||||
},
|
||||
default: "cancel"
|
||||
});
|
||||
d.render(true);
|
||||
})
|
||||
|
||||
clearPage.on('click',(event) => {
|
||||
const parent = this;
|
||||
|
||||
let d = new Dialog({
|
||||
title: game.i18n.localize("MaterialDeck.ClearPage"),
|
||||
content: game.i18n.localize("MaterialDeck.ClearPage_Content"),
|
||||
buttons: {
|
||||
continue: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Continue"),
|
||||
callback: async () => {
|
||||
await parent.clearPage(parent.page*32)
|
||||
parent.render(true);
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Cancel")
|
||||
}
|
||||
},
|
||||
default: "cancel"
|
||||
});
|
||||
d.render(true);
|
||||
})
|
||||
|
||||
macro.on("change", event => {
|
||||
let id = event.target.id.replace('macros','');
|
||||
let settings = game.settings.get(MODULE.moduleName,'macroSettings');
|
||||
let settings = game.settings.get(moduleName,'macroSettings');
|
||||
settings.macros[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
|
||||
args.on("change", event => {
|
||||
let id = event.target.id.replace('args','');
|
||||
let settings = game.settings.get(MODULE.moduleName,'macroSettings');
|
||||
let settings = game.settings.get(moduleName,'macroSettings');
|
||||
settings.args[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
|
||||
color.on("change", event => {
|
||||
let id = event.target.id.replace('colorpicker','');
|
||||
let settings = game.settings.get(MODULE.moduleName,'macroSettings');
|
||||
let settings = game.settings.get(moduleName,'macroSettings');
|
||||
settings.color[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
@@ -282,8 +363,8 @@ export class macroConfigForm extends FormApplication {
|
||||
|
||||
async updateSettings(settings){
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(MODULE.moduleName,'macroSettings',settings);
|
||||
if (MODULE.enableModule) macroControl.updateAll();
|
||||
await game.settings.set(moduleName,'macroSettings',settings);
|
||||
if (enableModule) macroControl.updateAll();
|
||||
}
|
||||
else {
|
||||
const payload = {
|
||||
@@ -293,6 +374,49 @@ export class macroConfigForm extends FormApplication {
|
||||
game.socket.emit(`module.MaterialDeck`, payload);
|
||||
}
|
||||
}
|
||||
|
||||
getPageEmpty(pageStart) {
|
||||
const settings = game.settings.get(moduleName,'macroSettings');
|
||||
let pageEmpty = true;
|
||||
for (let i=pageStart; i<pageStart+32; i++) {
|
||||
if (settings.macros[i] != undefined && settings.macros[i] != null && settings.macros[i] != "") {
|
||||
pageEmpty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pageEmpty;
|
||||
}
|
||||
|
||||
async clearPage(pageStart,remove=false) {
|
||||
const settings = game.settings.get(moduleName,'macroSettings');
|
||||
if (remove) {
|
||||
await settings.macros.splice(pageStart,32);
|
||||
await settings.color.splice(pageStart,32);
|
||||
if (settings.args != undefined) await settings.args.splice(pageStart,32);
|
||||
}
|
||||
else {
|
||||
for (let i=pageStart; i<pageStart+32; i++) {
|
||||
settings.macros[i] = null;
|
||||
settings.color[i] = "0";
|
||||
if (settings.args != undefined) settings.args[i] = null;
|
||||
}
|
||||
}
|
||||
await this.updateSettings(settings);
|
||||
}
|
||||
|
||||
async clearAllSettings() {
|
||||
let settings = {
|
||||
macros: [],
|
||||
color: [],
|
||||
args: []
|
||||
};
|
||||
for (let i=0; i<32; i++) {
|
||||
settings.macros[i] = null;
|
||||
settings.color[i] = "0";
|
||||
settings.args[i] = null;
|
||||
}
|
||||
await this.updateSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -301,9 +425,8 @@ export class soundboardConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
this.playlists = [];
|
||||
this.iMax;
|
||||
this.jMax;
|
||||
this.settings = {};
|
||||
this.page = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,7 +438,7 @@ export class soundboardConfigForm extends FormApplication {
|
||||
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.SoundboardConfig"),
|
||||
template: "./modules/MaterialDeck/templates/soundboardConfig.html",
|
||||
classes: ["sheet"],
|
||||
height: 720
|
||||
height: "auto"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -323,13 +446,13 @@ export class soundboardConfigForm extends FormApplication {
|
||||
* Provide data to the template
|
||||
*/
|
||||
getData() {
|
||||
if (MODULE.getPermission('SOUNDBOARD','CONFIGURE') == false ) {
|
||||
if (getPermission('SOUNDBOARD','CONFIGURE') == false ) {
|
||||
ui.notifications.warn(game.i18n.localize("MaterialDeck.Notifications.Soundboard.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
//Get the settings
|
||||
this.settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
this.settings = game.settings.get(moduleName,'soundboardSettings');
|
||||
|
||||
//Check if all settings are defined
|
||||
if (this.settings.sounds == undefined) this.settings.sounds = [];
|
||||
@@ -353,29 +476,13 @@ export class soundboardConfigForm extends FormApplication {
|
||||
|
||||
this.playlists = playlists;
|
||||
|
||||
//Check what SD model the user is using, and set the number of rows and columns to correspond
|
||||
let streamDeckModel = game.settings.get(MODULE.moduleName,'streamDeckModel');
|
||||
|
||||
if (streamDeckModel == 0){
|
||||
this.jMax = 6;
|
||||
this.iMax = 3;
|
||||
}
|
||||
else if (streamDeckModel == 1){
|
||||
this.jMax = 6;
|
||||
this.iMax = 5;
|
||||
}
|
||||
else {
|
||||
this.jMax = 8;
|
||||
this.iMax = 8;
|
||||
}
|
||||
|
||||
let iteration = 0; //Sound number
|
||||
let iteration = this.page*16; //Sound number
|
||||
let soundData = []; //Stores all the data for each sound
|
||||
|
||||
//Fill soundData. soundData is an array the size of jMax (nr of rows), with each array element containing an array the size of iMax (nr of columns)
|
||||
for (let j=0; j<this.jMax; j++){
|
||||
//Fill soundData
|
||||
for (let j=0; j<2; j++){
|
||||
let soundsThis = []; //Stores row data
|
||||
for (let i=0; i<this.iMax; i++){
|
||||
for (let i=0; i<8; i++){
|
||||
//Each iteration gets the data for each sound
|
||||
|
||||
//If the volume is undefined for this sound, define it and set it to its default value
|
||||
@@ -453,7 +560,10 @@ export class soundboardConfigForm extends FormApplication {
|
||||
|
||||
return {
|
||||
soundData: soundData,
|
||||
playlists
|
||||
playlists,
|
||||
soundRange: `${this.page*16 + 1} - ${this.page*16 + 16}`,
|
||||
prevDisabled: this.page == 0 ? 'disabled' : '',
|
||||
totalSounds: this.settings.volume.length
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,6 +578,12 @@ export class soundboardConfigForm extends FormApplication {
|
||||
|
||||
async activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
const navNext = html.find("button[id='navNext']");
|
||||
const navPrev = html.find("button[id='navPrev']");
|
||||
const clearAll = html.find("button[id='clearAll']");
|
||||
const clearPage = html.find("button[id='clearPage']");
|
||||
const importBtn = html.find("button[id='import']");
|
||||
const exportBtn = html.find("button[id='export']");
|
||||
const nameField = html.find("input[name='namebox']");
|
||||
const playlistSelect = html.find("select[name='playlist']");
|
||||
const soundSelect = html.find("select[name='sounds']");
|
||||
@@ -478,6 +594,89 @@ export class soundboardConfigForm extends FormApplication {
|
||||
const playMode = html.find("select[name='mode']");
|
||||
const volume = html.find("input[name='volume']");
|
||||
|
||||
importBtn.on('click', async(event) => {
|
||||
let importDialog = new importConfigForm();
|
||||
importDialog.setData('soundboard',this)
|
||||
importDialog.render(true);
|
||||
});
|
||||
|
||||
exportBtn.on('click', async(event) => {
|
||||
const settings = game.settings.get(moduleName,'soundboardSettings');
|
||||
let exportDialog = new exportConfigForm();
|
||||
exportDialog.setData(settings,'soundboard')
|
||||
exportDialog.render(true);
|
||||
});
|
||||
|
||||
navNext.on('click',async (event) => {
|
||||
this.page++;
|
||||
this.render(true);
|
||||
});
|
||||
navPrev.on('click',async (event) => {
|
||||
this.page--;
|
||||
if (this.page < 0) this.page = 0;
|
||||
else {
|
||||
const totalSounds = this.settings.volume.length;
|
||||
if ((this.page + 2)*16 == totalSounds) {
|
||||
let pageEmpty = this.getPageEmpty(totalSounds-16);
|
||||
if (pageEmpty) {
|
||||
await this.clearPage(totalSounds-16,true)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
clearAll.on('click',async (event) => {
|
||||
const parent = this;
|
||||
|
||||
let d = new Dialog({
|
||||
title: game.i18n.localize("MaterialDeck.ClearAll"),
|
||||
content: game.i18n.localize("MaterialDeck.ClearAll_Content"),
|
||||
buttons: {
|
||||
continue: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Continue"),
|
||||
callback: async () => {
|
||||
this.page = 0;
|
||||
await parent.clearAllSettings();
|
||||
parent.render(true);
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Cancel")
|
||||
}
|
||||
},
|
||||
default: "cancel"
|
||||
});
|
||||
d.render(true);
|
||||
})
|
||||
|
||||
clearPage.on('click',(event) => {
|
||||
const parent = this;
|
||||
|
||||
let d = new Dialog({
|
||||
title: game.i18n.localize("MaterialDeck.ClearPage"),
|
||||
content: game.i18n.localize("MaterialDeck.ClearPage_Content"),
|
||||
buttons: {
|
||||
continue: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Continue"),
|
||||
callback: async () => {
|
||||
await parent.clearPage(parent.page*16)
|
||||
parent.render(true);
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: game.i18n.localize("MaterialDeck.Cancel")
|
||||
}
|
||||
},
|
||||
default: "cancel"
|
||||
});
|
||||
d.render(true);
|
||||
})
|
||||
|
||||
nameField.on("change",event => {
|
||||
let id = event.target.id.replace('name','')-1;
|
||||
this.settings.name[id]=event.target.value;
|
||||
@@ -595,8 +794,8 @@ export class soundboardConfigForm extends FormApplication {
|
||||
|
||||
async updateSettings(settings){
|
||||
if (game.user.isGM) {
|
||||
await game.settings.set(MODULE.moduleName,'soundboardSettings',settings);
|
||||
if (MODULE.enableModule) soundboard.updateAll();
|
||||
await game.settings.set(moduleName,'soundboardSettings',settings);
|
||||
if (enableModule) soundboard.updateAll();
|
||||
}
|
||||
else {
|
||||
const payload = {
|
||||
@@ -606,4 +805,473 @@ export class soundboardConfigForm extends FormApplication {
|
||||
game.socket.emit(`module.MaterialDeck`, payload);
|
||||
}
|
||||
}
|
||||
|
||||
getPageEmpty(pageStart) {
|
||||
let pageEmpty = true;
|
||||
for (let i=pageStart; i<pageStart+16; i++) {
|
||||
const name = this.settings.name[i];
|
||||
const playlist = this.settings.selectedPlaylists[i];
|
||||
const sound = this.settings.sounds[i];
|
||||
if ((name != "" && name != null) || playlist != undefined || sound != undefined) {
|
||||
pageEmpty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pageEmpty;
|
||||
}
|
||||
|
||||
async clearPage(pageStart,remove=false) {
|
||||
if (remove) {
|
||||
await this.settings.sounds.splice(pageStart,16);
|
||||
await this.settings.colorOn.splice(pageStart,16);
|
||||
await this.settings.colorOff.splice(pageStart,16);
|
||||
await this.settings.mode.splice(pageStart,16);
|
||||
await this.settings.img.splice(pageStart,16);
|
||||
await this.settings.volume.splice(pageStart,16);
|
||||
await this.settings.name.splice(pageStart,16);
|
||||
await this.settings.selectedPlaylists.splice(pageStart,16);
|
||||
await this.settings.src.splice(pageStart,16);
|
||||
await this.settings.sounds.splice(pageStart,16);
|
||||
}
|
||||
else {
|
||||
for (let i=pageStart; i<pageStart+16; i++) {
|
||||
this.settings.sounds[i] = null;
|
||||
this.settings.colorOn[i] = null;
|
||||
this.settings.colorOff[i] = null;
|
||||
this.settings.mode[i] = null;
|
||||
this.settings.img[i] = null;
|
||||
this.settings.volume[i] = null;
|
||||
this.settings.name[i] = null;
|
||||
this.settings.selectedPlaylists[i] = null;
|
||||
this.settings.src[i] = null;
|
||||
this.settings.sounds[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
await this.updateSettings(this.settings);
|
||||
}
|
||||
|
||||
async clearAllSettings() {
|
||||
let array = [];
|
||||
for (let i=0; i<16; i++) array[i] = "";
|
||||
let arrayVolume = [];
|
||||
for (let i=0; i<16; i++) arrayVolume[i] = "50";
|
||||
let arrayZero = [];
|
||||
for (let i=0; i<16; i++) arrayZero[i] = "0";
|
||||
|
||||
const settings = {
|
||||
playlist: "",
|
||||
sounds: array,
|
||||
colorOn: arrayZero,
|
||||
colorOff: arrayZero,
|
||||
mode: arrayZero,
|
||||
toggle: arrayZero,
|
||||
volume: arrayVolume
|
||||
};
|
||||
await this.updateSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
export class exportConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
this.data = {};
|
||||
this.name = "";
|
||||
this.source = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Options for this FormApplication
|
||||
*/
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
id: "MD_Export",
|
||||
title: "Material Deck: " + game.i18n.localize("MaterialDeck.ExportDialog.Title"),
|
||||
template: "./modules/MaterialDeck/templates/exportDialog.html",
|
||||
width: 500,
|
||||
height: "auto"
|
||||
});
|
||||
}
|
||||
|
||||
setData(data,source) {
|
||||
this.data = data;
|
||||
this.source = source;
|
||||
this.name = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide data to the template
|
||||
*/
|
||||
getData() {
|
||||
return {
|
||||
source: this.source,
|
||||
name: this.name,
|
||||
content: this.source == "soundboard" ? game.i18n.localize("MaterialDeck.ExportDialog.SoundboardContent") : game.i18n.localize("MaterialDeck.ExportDialog.MacroboardContent")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update on form submit
|
||||
* @param {*} event
|
||||
* @param {*} formData
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
this.download(this.data,formData.name)
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
}
|
||||
|
||||
download(data,name) {
|
||||
let dataStr = JSON.stringify(data);
|
||||
let dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
|
||||
let exportFileDefaultName = `${name}.json`;
|
||||
let linkElement = document.createElement('a');
|
||||
linkElement.setAttribute('href', dataUri);
|
||||
linkElement.setAttribute('download', exportFileDefaultName);
|
||||
linkElement.click();
|
||||
}
|
||||
}
|
||||
|
||||
export class importConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
this.data = {};
|
||||
this.name = "";
|
||||
this.source = "";
|
||||
this.parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Options for this FormApplication
|
||||
*/
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
id: "MD_Import",
|
||||
title: "Material Deck: " + game.i18n.localize("MaterialDeck.ImportDialog.Title"),
|
||||
template: "./modules/MaterialDeck/templates/importDialog.html",
|
||||
width: 500,
|
||||
height: "auto"
|
||||
});
|
||||
}
|
||||
|
||||
setData(source,parent) {
|
||||
this.source = source;
|
||||
this.name = source;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide data to the template
|
||||
*/
|
||||
getData() {
|
||||
return {
|
||||
source: this.source,
|
||||
name: this.name,
|
||||
content: this.source == "soundboard" ? game.i18n.localize("MaterialDeck.ImportDialog.SoundboardContent") : game.i18n.localize("MaterialDeck.ImportDialog.MacroboardContent")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update on form submit
|
||||
* @param {*} event
|
||||
* @param {*} formData
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
await this.parent.updateSettings(this.data);
|
||||
this.parent.render(true);
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
const upload = html.find("input[id='uploadJson']");
|
||||
|
||||
upload.on('change',(event) => {
|
||||
event.preventDefault();
|
||||
this.readJsonFile(event.target.files[0]);
|
||||
})
|
||||
}
|
||||
|
||||
readJsonFile(jsonFile) {
|
||||
var reader = new FileReader();
|
||||
reader.addEventListener('load', (loadEvent) => {
|
||||
try {
|
||||
let json = JSON.parse(loadEvent.target.result);
|
||||
this.data = json;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
reader.readAsText(jsonFile);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Options for this FormApplication
|
||||
*/
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
id: "MD_DownloadUtility",
|
||||
title: "Material Deck: " + game.i18n.localize("MaterialDeck.DownloadUtility.Title"),
|
||||
template: "./modules/MaterialDeck/templates/downloadUtility.html",
|
||||
width: 500,
|
||||
height: "auto"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide data to the template
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (this.localMSversion == undefined) this.localMSversion = 'unknown';
|
||||
|
||||
let minimumSdVersion;
|
||||
let minimumMsVersion;
|
||||
if (compatibleCore("0.8.5")) {
|
||||
minimumSdVersion = game.modules.get("MaterialDeck").data.flags.minimumSDversion.replace('v','');
|
||||
minimumMsVersion = game.modules.get("MaterialDeck").data.flags.minimumMSversion;
|
||||
}
|
||||
else {
|
||||
minimumSdVersion = game.modules.get("MaterialDeck").data.minimumSDversion.replace('v','');
|
||||
minimumMsVersion = game.modules.get("MaterialDeck").data.minimumMSversion;
|
||||
}
|
||||
|
||||
return {
|
||||
minimumSdVersion,
|
||||
localSdVersion: this.localSDversion,
|
||||
masterSdVersion: this.masterSDversion,
|
||||
sdDlDisable: this.masterSDversion == undefined,
|
||||
minimumMsVersion,
|
||||
localMsVersion: this.localMSversion,
|
||||
masterMsVersion: this.masterMSversion,
|
||||
msDlDisable: this.masterMSversion == undefined,
|
||||
profiles: this.profiles,
|
||||
profileDlDisable: dlDisabled
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update on form submit
|
||||
* @param {*} event
|
||||
* @param {*} formData
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
const downloadSd = html.find("button[id='downloadSd']");
|
||||
const downloadMs = html.find("button[id='downloadMs']");
|
||||
const downloadProfile = html.find("button[name='downloadProfile']")
|
||||
const refresh = html.find("button[id='refresh']");
|
||||
|
||||
downloadSd.on('click', () => {
|
||||
const version = document.getElementById('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')
|
||||
})
|
||||
downloadMs.on('click', () => {
|
||||
const version = document.getElementById('masterMsVersion').innerHTML;
|
||||
const os = document.getElementById('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)
|
||||
})
|
||||
downloadProfile.on('click',(event) => {
|
||||
let id = event.currentTarget.id.replace('dlProfile-','');
|
||||
this.downloadURI(this.profiles[id].url,`${this.profiles[id].label}.streamDeckProfile`);
|
||||
})
|
||||
refresh.on('click', () => {
|
||||
document.getElementById('masterSdVersion').value = 'Getting data';
|
||||
this.checkForUpdate('SD');
|
||||
document.getElementById('masterMsVersion').value = 'Getting data';
|
||||
this.checkForUpdate('MS');
|
||||
this.getReleaseData();
|
||||
})
|
||||
}
|
||||
|
||||
downloadURI(uri, name) {
|
||||
var link = document.createElement("a");
|
||||
link.download = name;
|
||||
link.href = uri;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
getReleaseData() {
|
||||
let parent = this;
|
||||
const url = 'https://api.github.com/repos/CDeenen/MaterialDeck_SD/releases/latest';
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', url, true);
|
||||
request.send(null);
|
||||
request.onreadystatechange = function () {
|
||||
if (request.readyState === 4 && request.status === 200) {
|
||||
var type = request.getResponseHeader('Content-Type');
|
||||
const data = JSON.parse(request.responseText);
|
||||
parent.releaseAssets = data.assets;
|
||||
parent.render(true);
|
||||
if (type.indexOf("text") !== 1) {
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
request.onerror = function () {
|
||||
}
|
||||
}
|
||||
|
||||
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/src/Windows/package.json';
|
||||
const elementId = reqType == 'SD' ? 'masterSdVersion' : 'masterMsVersion';
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', url, true);
|
||||
request.send(null);
|
||||
request.onreadystatechange = function () {
|
||||
if (request.readyState === 4 && request.status === 200) {
|
||||
var type = request.getResponseHeader('Content-Type');
|
||||
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;
|
||||
parent.render(true);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
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: "MD_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) {
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
181
src/move.js
@@ -1,181 +0,0 @@
|
||||
import * as MODULE from "../MaterialDeck.js";
|
||||
import {streamDeck} from "../MaterialDeck.js";
|
||||
import {compatibleCore} from "./misc.js";
|
||||
|
||||
export class Move{
|
||||
constructor(){
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const mode = settings.mode ? settings.mode : 'canvas';
|
||||
const type = settings.type ? settings.type : 'move';
|
||||
|
||||
if ((MODULE.getPermission('MOVE','TOKEN') == false && mode == 'selectedToken') || (MODULE.getPermission('MOVE','CANVAS') == false && mode == 'canvas')) {
|
||||
streamDeck.noPermission(context);
|
||||
return;
|
||||
}
|
||||
|
||||
let url = '';
|
||||
if (mode == 'canvas' || (mode == 'selectedToken' && type == 'move')){
|
||||
const dir = settings.dir ? settings.dir : 'center';
|
||||
if (dir == 'center') //center
|
||||
url = "modules/MaterialDeck/img/move/center.png";
|
||||
else if (dir == 'up') //up
|
||||
url = "modules/MaterialDeck/img/move/up.png";
|
||||
else if (dir == 'down') //down
|
||||
url = "modules/MaterialDeck/img/move/down.png";
|
||||
else if (dir == 'right') //right
|
||||
url = "modules/MaterialDeck/img/move/right.png";
|
||||
else if (dir == 'left') //left
|
||||
url = "modules/MaterialDeck/img/move/left.png";
|
||||
else if (dir == 'upRight')
|
||||
url = "modules/MaterialDeck/img/move/upright.png";
|
||||
else if (dir == 'upLeft')
|
||||
url = "modules/MaterialDeck/img/move/upleft.png";
|
||||
else if (dir == 'downRight')
|
||||
url = "modules/MaterialDeck/img/move/downright.png";
|
||||
else if (dir == 'downLeft')
|
||||
url = "modules/MaterialDeck/img/move/downleft.png";
|
||||
else if (dir == 'zoomIn')
|
||||
url = "modules/MaterialDeck/img/move/zoomin.png";
|
||||
else if (dir == 'zoomOut')
|
||||
url = "modules/MaterialDeck/img/move/zoomout.png";
|
||||
}
|
||||
else if (mode == 'selectedToken' && type == 'rotate'){
|
||||
const value = isNaN(parseInt(settings.rotValue)) ? 0 : parseInt(settings.rotValue);
|
||||
if (value >= 0)
|
||||
url = "modules/MaterialDeck/img/move/rotatecw.png";
|
||||
else
|
||||
url = "modules/MaterialDeck/img/move/rotateccw.png";
|
||||
}
|
||||
streamDeck.setIcon(context,url,{background:background});
|
||||
streamDeck.setTitle('',context);
|
||||
}
|
||||
|
||||
keyPress(settings){
|
||||
if (canvas.scene == null) return;
|
||||
if ((MODULE.getPermission('MOVE','TOKEN') == false && mode == 'selectedToken') || (MODULE.getPermission('MOVE','CANVAS') == false && mode == 'canvas')) {
|
||||
streamDeck.noPermission(context);
|
||||
return;
|
||||
}
|
||||
|
||||
const dir = settings.dir ? settings.dir : 'center';
|
||||
const mode = settings.mode ? settings.mode : 'canvas';
|
||||
const type = settings.type ? settings.type : 'move';
|
||||
|
||||
let token;
|
||||
if (mode == 'selectedToken') {
|
||||
const selection = settings.selection ? settings.selection : 'selected';
|
||||
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
||||
|
||||
if (selection == 'selected') token = canvas.tokens.children[0].children.find(p => p.id == MODULE.selectedTokenId);
|
||||
else if (selection != 'selected' && 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 == 'tokenId') token = canvas.tokens.children[0].children.find(p => p.id == tokenIdentifier);
|
||||
else if (selection == 'actorId') token = canvas.tokens.children[0].children.find(p => p.actor.id == tokenIdentifier);
|
||||
if (token == undefined) return;
|
||||
}
|
||||
|
||||
if (type == 'move'){
|
||||
if (dir == 'zoomIn') {//zoom in
|
||||
let viewPosition = canvas.scene._viewPosition;
|
||||
viewPosition.scale = viewPosition.scale*1.05;
|
||||
viewPosition.duration = 100;
|
||||
canvas.animatePan(viewPosition);
|
||||
}
|
||||
else if (dir == 'zoomOut') {//zoom out
|
||||
let viewPosition = canvas.scene._viewPosition;
|
||||
viewPosition.scale = viewPosition.scale*0.95;
|
||||
viewPosition.duration = 100;
|
||||
canvas.animatePan(viewPosition);
|
||||
}
|
||||
else {
|
||||
if (settings.mode == 'selectedToken')
|
||||
this.moveToken(token,dir);
|
||||
else
|
||||
this.moveCanvas(dir);
|
||||
}
|
||||
}
|
||||
else if (type == 'rotate' && mode == 'selectedToken'){
|
||||
const rotType = settings.rot ? settings.rot : 'to';
|
||||
const value = isNaN(parseInt(settings.rotValue)) ? 0 : parseInt(settings.rotValue);
|
||||
|
||||
let rotationVal;
|
||||
if (rotType == 'by') rotationVal = token.data.rotation + value;
|
||||
else if (rotType == 'to') rotationVal = value;
|
||||
|
||||
if (compatibleCore("0.8.1")) token.document.update({rotation: rotationVal});
|
||||
else token.update({rotation: rotationVal});
|
||||
//token.rotate(rotationVal,false)
|
||||
}
|
||||
}
|
||||
|
||||
async moveToken(token,dir){
|
||||
const gridSize = canvas.scene.data.grid;
|
||||
let x = token.x;
|
||||
let y = token.y;
|
||||
|
||||
if (dir == 'up') y -= gridSize;
|
||||
else if (dir == 'down') y += gridSize;
|
||||
else if (dir == 'right') x += gridSize;
|
||||
else if (dir == 'left') x -= gridSize;
|
||||
else if (dir == 'upRight') {
|
||||
x += gridSize;
|
||||
y -= gridSize;
|
||||
}
|
||||
else if (dir == 'upLeft') {
|
||||
x -= gridSize;
|
||||
y -= gridSize;
|
||||
}
|
||||
else if (dir == 'downRight') {
|
||||
x += gridSize;
|
||||
y += gridSize;
|
||||
}
|
||||
else if (dir == 'downLeft') {
|
||||
x -= gridSize;
|
||||
y += gridSize;
|
||||
}
|
||||
else if (dir == 'center') {
|
||||
let location = token.getCenter(x,y);
|
||||
canvas.animatePan(location);
|
||||
}
|
||||
if (game.user.isGM == false && (token.can(game.user,"control") == false || token.checkCollision(token.getCenter(x, y)))) return;
|
||||
if (compatibleCore("0.8.1")) token.document.update({x:x,y:y});
|
||||
else token.update({x:x,y:y});
|
||||
};
|
||||
|
||||
moveCanvas(dir){
|
||||
let viewPosition = canvas.scene._viewPosition;
|
||||
const gridSize = canvas.scene.data.grid;
|
||||
viewPosition.duration = 100;
|
||||
|
||||
if (dir == 'up') viewPosition.y -= gridSize;
|
||||
else if (dir == 'down') viewPosition.y += gridSize;
|
||||
else if (dir == 'right') viewPosition.x += gridSize;
|
||||
else if (dir == 'left') viewPosition.x -= gridSize;
|
||||
else if (dir == 'upRight') {
|
||||
viewPosition.x += gridSize;
|
||||
viewPosition.y -= gridSize;
|
||||
}
|
||||
else if (dir == 'upLeft') {
|
||||
viewPosition.x -= gridSize;
|
||||
viewPosition.y -= gridSize;
|
||||
}
|
||||
else if (dir == 'downRight') {
|
||||
viewPosition.x += gridSize;
|
||||
viewPosition.y += gridSize;
|
||||
}
|
||||
else if (dir == 'downLeft') {
|
||||
viewPosition.x -= gridSize;
|
||||
viewPosition.y += gridSize;
|
||||
}
|
||||
else if (dir == 'center') {
|
||||
viewPosition.x = (canvas.dimensions.sceneWidth+window.innerWidth)/2;
|
||||
viewPosition.y = (canvas.dimensions.sceneHeight+window.innerHeight)/2;
|
||||
}
|
||||
canvas.animatePan(viewPosition);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +1,78 @@
|
||||
import * as MODULE from "../MaterialDeck.js";
|
||||
import {streamDeck} from "../MaterialDeck.js";
|
||||
import {streamDeck, gamingSystem} from "../MaterialDeck.js";
|
||||
import {compatibleCore} from "./misc.js";
|
||||
|
||||
export class OtherControls{
|
||||
constructor(){
|
||||
this.active = false;
|
||||
this.rollData = {};
|
||||
this.rollOption = 'dialog';
|
||||
this.controlsOffset = 0;
|
||||
this.toolsOffset = 0;
|
||||
}
|
||||
|
||||
setRollOption(option) {
|
||||
this.rollOption = option;
|
||||
this.updateAll();
|
||||
}
|
||||
|
||||
async updateAll(options={}){
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'other') continue;
|
||||
await this.update(data.settings,data.context,options);
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
if (device?.buttons == undefined) continue;
|
||||
for (let i=0; i<device.buttons.length; i++){
|
||||
const data = device.buttons[i];
|
||||
if (data == undefined || data.action != 'other') continue;
|
||||
await this.update(data.settings,data.context,device.device,options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(settings,context,options={}){
|
||||
update(settings,context,device,options={}){
|
||||
this.active = true;
|
||||
const mode = settings.otherMode ? settings.otherMode : 'pause';
|
||||
|
||||
if (mode == 'pause') //pause
|
||||
this.updatePause(settings,context,options);
|
||||
this.updatePause(settings,context,device,options);
|
||||
else if (mode == 'move') //move canvas
|
||||
this.updateMove(settings,context,device,options);
|
||||
else if (mode == 'controlButtons') //control buttons
|
||||
this.updateControl(settings,context,options);
|
||||
this.updateControl(settings,context,device,options);
|
||||
else if (mode == 'darkness') //darkness
|
||||
this.updateDarkness(settings,context,options);
|
||||
this.updateDarkness(settings,context,device,options);
|
||||
else if (mode == 'rollDice') //roll dice
|
||||
this.updateRollDice(settings,context,options);
|
||||
this.updateRollDice(settings,context,device,options);
|
||||
else if (mode == 'rollTables') //roll tables
|
||||
this.updateRollTable(settings,context,options);
|
||||
this.updateRollTable(settings,context,device,options);
|
||||
else if (mode == 'sidebarTab') //open sidebar tab
|
||||
this.updateSidebar(settings,context,options);
|
||||
this.updateSidebar(settings,context,device,options);
|
||||
else if (mode == 'compendiumBrowser') //open compendium browser
|
||||
this.updateCompendiumBrowser(settings,context,options);
|
||||
this.updateCompendiumBrowser(settings,context,device,options);
|
||||
else if (mode == 'compendium') //open compendium
|
||||
this.updateCompendium(settings,context,options);
|
||||
this.updateCompendium(settings,context,device,options);
|
||||
else if (mode == 'journal') //open journal
|
||||
this.updateJournal(settings,context,options);
|
||||
this.updateJournal(settings,context,device,options);
|
||||
else if (mode == 'chatMessage')
|
||||
this.updateChatMessage(settings,context,options);
|
||||
this.updateChatMessage(settings,context,device,options);
|
||||
else if (mode == 'rollOptions')
|
||||
this.updateRollOptions(settings,context,device,options);
|
||||
else if (mode == 'rollMode')
|
||||
this.updateRollMode(settings,context,device,options);
|
||||
}
|
||||
|
||||
keyPress(settings,context){
|
||||
keyPress(settings,context,device){
|
||||
const mode = settings.otherMode ? settings.otherMode : 'pause';
|
||||
|
||||
if (mode == 'pause') //pause
|
||||
this.keyPressPause(settings);
|
||||
else if (mode == 'move') //move canvas
|
||||
this.keyPressMove(settings);
|
||||
else if (mode == 'controlButtons') //control buttons
|
||||
this.keyPressControl(settings);
|
||||
else if (mode == 'darkness') //darkness controll
|
||||
this.keyPressDarkness(settings);
|
||||
else if (mode == 'rollDice') //roll dice
|
||||
this.keyPressRollDice(settings,context);
|
||||
this.keyPressRollDice(settings,context,device);
|
||||
else if (mode == 'rollTables') //roll tables
|
||||
this.keyPressRollTable(settings);
|
||||
else if (mode == 'sidebarTab') //sidebar
|
||||
@@ -66,13 +85,17 @@ export class OtherControls{
|
||||
this.keyPressJournal(settings);
|
||||
else if (mode == 'chatMessage')
|
||||
this.keyPressChatMessage(settings);
|
||||
else if (mode == 'rollOptions')
|
||||
this.keyPressRollOptions(settings);
|
||||
else if (mode == 'rollMode')
|
||||
this.keyPressRollMode(settings);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updatePause(settings,context,options={}){
|
||||
updatePause(settings,context,device,options={}){
|
||||
if (MODULE.getPermission('OTHER','PAUSE') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,7 +114,7 @@ export class OtherControls{
|
||||
}
|
||||
else if (pauseFunction == 'toggle') //toggle
|
||||
src = 'modules/MaterialDeck/img/other/pause/playpause.png';
|
||||
streamDeck.setIcon(context,src,{background:background,ring:2,ringColor:ringColor,overlay:true});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor,overlay:true});
|
||||
streamDeck.setTitle('',context);
|
||||
}
|
||||
|
||||
@@ -113,33 +136,118 @@ export class OtherControls{
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateMove(settings,context,device,options={}){
|
||||
let url = '';
|
||||
const dir = settings.dir ? settings.dir : 'center';
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
if (dir == 'center') //center
|
||||
url = "modules/MaterialDeck/img/move/center.png";
|
||||
else if (dir == 'up') //up
|
||||
url = "modules/MaterialDeck/img/move/up.png";
|
||||
else if (dir == 'down') //down
|
||||
url = "modules/MaterialDeck/img/move/down.png";
|
||||
else if (dir == 'right') //right
|
||||
url = "modules/MaterialDeck/img/move/right.png";
|
||||
else if (dir == 'left') //left
|
||||
url = "modules/MaterialDeck/img/move/left.png";
|
||||
else if (dir == 'upRight')
|
||||
url = "modules/MaterialDeck/img/move/upright.png";
|
||||
else if (dir == 'upLeft')
|
||||
url = "modules/MaterialDeck/img/move/upleft.png";
|
||||
else if (dir == 'downRight')
|
||||
url = "modules/MaterialDeck/img/move/downright.png";
|
||||
else if (dir == 'downLeft')
|
||||
url = "modules/MaterialDeck/img/move/downleft.png";
|
||||
else if (dir == 'zoomIn')
|
||||
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});
|
||||
streamDeck.setTitle('',context);
|
||||
}
|
||||
|
||||
keyPressMove(settings){
|
||||
if (canvas.scene == null) return;
|
||||
const dir = settings.dir ? settings.dir : 'center';
|
||||
if (dir == 'zoomIn') {//zoom in
|
||||
let viewPosition = canvas.scene._viewPosition;
|
||||
viewPosition.scale = viewPosition.scale*1.05;
|
||||
viewPosition.duration = 100;
|
||||
canvas.animatePan(viewPosition);
|
||||
}
|
||||
else if (dir == 'zoomOut') {//zoom out
|
||||
let viewPosition = canvas.scene._viewPosition;
|
||||
viewPosition.scale = viewPosition.scale*0.95;
|
||||
viewPosition.duration = 100;
|
||||
canvas.animatePan(viewPosition);
|
||||
}
|
||||
else {
|
||||
let viewPosition = canvas.scene._viewPosition;
|
||||
const gridSize = canvas.scene.data.grid;
|
||||
viewPosition.duration = 100;
|
||||
|
||||
if (dir == 'up') viewPosition.y -= gridSize;
|
||||
else if (dir == 'down') viewPosition.y += gridSize;
|
||||
else if (dir == 'right') viewPosition.x += gridSize;
|
||||
else if (dir == 'left') viewPosition.x -= gridSize;
|
||||
else if (dir == 'upRight') {
|
||||
viewPosition.x += gridSize;
|
||||
viewPosition.y -= gridSize;
|
||||
}
|
||||
else if (dir == 'upLeft') {
|
||||
viewPosition.x -= gridSize;
|
||||
viewPosition.y -= gridSize;
|
||||
}
|
||||
else if (dir == 'downRight') {
|
||||
viewPosition.x += gridSize;
|
||||
viewPosition.y += gridSize;
|
||||
}
|
||||
else if (dir == 'downLeft') {
|
||||
viewPosition.x -= gridSize;
|
||||
viewPosition.y += gridSize;
|
||||
}
|
||||
else if (dir == 'center') {
|
||||
viewPosition.x = (canvas.dimensions.sceneWidth+window.innerWidth)/2;
|
||||
viewPosition.y = (canvas.dimensions.sceneHeight+window.innerHeight)/2;
|
||||
}
|
||||
canvas.animatePan(viewPosition);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateControl(settings,context,options={}){
|
||||
updateControl(settings,context,device,options={}){
|
||||
if (MODULE.getPermission('OTHER','CONTROL') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
const control = settings.control ? settings.control : 'dispControls';
|
||||
const tool = settings.tool ? settings.tool : 'open';
|
||||
let background = settings.background ? settings.background : '#000000';
|
||||
let ringColor = '#000000'
|
||||
let ringColor = '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
let txt = "";
|
||||
let src = "";
|
||||
const activeControl = ui.controls.activeControl;
|
||||
const activeTool = ui.controls.activeTool;
|
||||
|
||||
|
||||
if (control == 'dispControls') { //displayed controls
|
||||
let controlNr = parseInt(settings.controlNr);
|
||||
if (isNaN(controlNr)) controlNr = 1;
|
||||
controlNr--;
|
||||
controlNr += this.controlsOffset;
|
||||
|
||||
const selectedControl = ui.controls.controls[controlNr];
|
||||
if (selectedControl.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedControl != undefined){
|
||||
if (selectedControl.visible == false) {
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
if (tool == 'open'){ //open category
|
||||
txt = game.i18n.localize(selectedControl.title);
|
||||
src = selectedControl.icon;
|
||||
@@ -152,13 +260,14 @@ export class OtherControls{
|
||||
let controlNr = parseInt(settings.controlNr);
|
||||
if (isNaN(controlNr)) controlNr = 1;
|
||||
controlNr--;
|
||||
controlNr += this.toolsOffset;
|
||||
|
||||
const selectedControl = ui.controls.controls.find(c => c.name == ui.controls.activeControl);
|
||||
if (selectedControl != undefined){
|
||||
const selectedTool = selectedControl.tools[controlNr];
|
||||
if (selectedTool != undefined){
|
||||
if (selectedControl.visible == false || selectedTool.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
txt = game.i18n.localize(selectedTool.title);
|
||||
@@ -172,11 +281,23 @@ export class OtherControls{
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (control == 'controlsOffset') {
|
||||
const display = settings.controlsOffsetDisplay ? settings.controlsOffsetDisplay : false;
|
||||
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
|
||||
if (display) txt = `${this.controlsOffset}`;
|
||||
if (offsetType == 'absoluteOffset') ringColor = (this.controlsOffset == settings.controlsOffset) ? ringOnColor : ringOffColor;
|
||||
}
|
||||
else if (control == 'toolsOffset') {
|
||||
const display = settings.controlsOffsetDisplay ? settings.controlsOffsetDisplay : false;
|
||||
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
|
||||
if (display) txt = `${this.toolsOffset}`;
|
||||
if (offsetType == 'absoluteOffset') ringColor = (this.toolsOffset == settings.controlsOffset) ? ringOnColor : ringOffColor;
|
||||
}
|
||||
else { // specific control/tool
|
||||
const selectedControl = ui.controls.controls.find(c => c.name == control);
|
||||
if (selectedControl != undefined){
|
||||
if (selectedControl.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
if (tool == 'open'){ //open category
|
||||
@@ -189,7 +310,7 @@ export class OtherControls{
|
||||
const selectedTool = selectedControl.tools.find(t => t.name == tool);
|
||||
if (selectedTool != undefined){
|
||||
if (selectedTool.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
txt = game.i18n.localize(selectedTool.title);
|
||||
@@ -204,7 +325,7 @@ export class OtherControls{
|
||||
}
|
||||
}
|
||||
}
|
||||
streamDeck.setIcon(context,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
@@ -213,20 +334,30 @@ export class OtherControls{
|
||||
if (canvas.scene == null) return;
|
||||
const control = settings.control ? settings.control : 'dispControls';
|
||||
const tool = settings.tool ? settings.tool : 'open';
|
||||
|
||||
|
||||
if (control == 'dispControls'){ //displayed controls
|
||||
let controlNr = parseInt(settings.controlNr);
|
||||
if (isNaN(controlNr)) controlNr = 1;
|
||||
controlNr--;
|
||||
const selectedControl = ui.controls.controls[controlNr];
|
||||
|
||||
if (selectedControl != undefined){
|
||||
if (selectedControl.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
ui.controls.activeControl = 'token';
|
||||
ui.controls.activeControl = selectedControl.name;
|
||||
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
|
||||
@@ -236,13 +367,13 @@ export class OtherControls{
|
||||
const selectedControl = ui.controls.controls.find(c => c.name == ui.controls.activeControl);
|
||||
if (selectedControl != undefined){
|
||||
if (selectedControl.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
const selectedTool = selectedControl.tools[controlNr];
|
||||
if (selectedTool != undefined){
|
||||
if (selectedTool.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
if (selectedTool.toggle) {
|
||||
@@ -257,27 +388,55 @@ export class OtherControls{
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (control == 'controlsOffset') {
|
||||
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
|
||||
if (offsetType == 'absoluteOffset') this.controlsOffset = parseInt(settings.controlsOffset);
|
||||
else if (offsetType == 'relativeOffset') this.controlsOffset += parseInt(settings.controlsOffset);
|
||||
}
|
||||
else if (control == 'toolsOffset') {
|
||||
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
|
||||
if (offsetType == 'absoluteOffset') this.toolsOffset = parseInt(settings.controlsOffset);
|
||||
else if (offsetType == 'relativeOffset') this.toolsOffset += parseInt(settings.controlsOffset);
|
||||
}
|
||||
else { //select control
|
||||
const selectedControl = ui.controls.controls.find(c => c.name == control);
|
||||
if (selectedControl != undefined){
|
||||
if (selectedControl.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
if (tool == 'open'){ //open category
|
||||
ui.controls.activeControl = 'token';
|
||||
ui.controls.activeControl = control;
|
||||
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 {
|
||||
const selectedTool = selectedControl.tools.find(t => t.name == tool);
|
||||
if (selectedTool != undefined){
|
||||
if (selectedTool.visible == false) {
|
||||
streamDeck.noPermission(context,false);
|
||||
streamDeck.noPermission(context,device,false);
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
selectedTool.active = !selectedTool.active;
|
||||
selectedTool.onClick(selectedTool.active);
|
||||
@@ -296,9 +455,9 @@ export class OtherControls{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateDarkness(settings,context,options={}){
|
||||
updateDarkness(settings,context,device,options={}){
|
||||
if (MODULE.getPermission('OTHER','DARKNESS') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
const func = settings.darknessFunction ? settings.darknessFunction : 'value';
|
||||
@@ -321,7 +480,7 @@ export class OtherControls{
|
||||
txt += darkness;
|
||||
}
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,src,{background:background});
|
||||
streamDeck.setIcon(context,device,src,{background:background,overlay:true});
|
||||
}
|
||||
|
||||
keyPressDarkness(settings) {
|
||||
@@ -342,9 +501,9 @@ export class OtherControls{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateRollDice(settings,context,options={}){
|
||||
updateRollDice(settings,context,device,options={}){
|
||||
if (MODULE.getPermission('OTHER','DICE') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
@@ -353,10 +512,10 @@ export class OtherControls{
|
||||
if (settings.displayDiceName) txt = 'Roll: ' + settings.rollDiceFormula;
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,'',{background:background});
|
||||
streamDeck.setIcon(context,device,'',{background:background});
|
||||
}
|
||||
|
||||
keyPressRollDice(settings,context){
|
||||
keyPressRollDice(settings,context,device){
|
||||
if (MODULE.getPermission('OTHER','DICE') == false ) return;
|
||||
if (settings.rollDiceFormula == undefined || settings.rollDiceFormula == '') return;
|
||||
const rollFunction = settings.rollDiceFunction ? settings.rollDiceFunction : 'public';
|
||||
@@ -364,14 +523,14 @@ export class OtherControls{
|
||||
let actor;
|
||||
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;
|
||||
|
||||
let r;
|
||||
if (tokenControlled) r = new Roll(settings.rollDiceFormula,actor.getRollData());
|
||||
else r = new Roll(settings.rollDiceFormula);
|
||||
|
||||
r.evaluate();
|
||||
r.evaluate({async:false});
|
||||
|
||||
if (rollFunction == 'public') {
|
||||
r.toMessage(r,{rollMode:"roll"})
|
||||
@@ -394,16 +553,17 @@ export class OtherControls{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateRollTable(settings,context,options={}){
|
||||
updateRollTable(settings,context,device,options={}){
|
||||
const name = settings.rollTableName;
|
||||
if (name == undefined) return;
|
||||
if (MODULE.getPermission('OTHER','TABLES') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const table = game.tables.getName(name);
|
||||
if (table == undefined) return;
|
||||
|
||||
let txt = settings.displayRollName ? table.name : '';
|
||||
let src = settings.displayRollIcon ? table.data.img : '';
|
||||
@@ -414,13 +574,13 @@ export class OtherControls{
|
||||
}
|
||||
else {
|
||||
if (table.permission < 2 && MODULE.getPermission('OTHER','TABLES_ALL') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,src,{background:background});
|
||||
streamDeck.setIcon(context,device,src,{background:background});
|
||||
}
|
||||
|
||||
keyPressRollTable(settings){
|
||||
@@ -456,6 +616,7 @@ export class OtherControls{
|
||||
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");
|
||||
@@ -468,10 +629,11 @@ export class OtherControls{
|
||||
if (nr == 'chat') icon = window.CONFIG.ChatMessage.sidebarIcon;
|
||||
else if (nr == 'combat') icon = window.CONFIG.Combat.sidebarIcon;
|
||||
else if (nr == 'scenes') icon = window.CONFIG.Scene.sidebarIcon;
|
||||
else if (nr == 'actors') icon = window.CONFIG.Actor.sidebarIcon;
|
||||
else if (nr == 'actors') icon = "fas fa-users";
|
||||
else if (nr == 'items') icon = window.CONFIG.Item.sidebarIcon;
|
||||
else if (nr == 'journal') icon = window.CONFIG.JournalEntry.sidebarIcon;
|
||||
else if (nr == 'tables') icon = window.CONFIG.RollTable.sidebarIcon;
|
||||
else if (nr == 'cards') icon = "fas fa-id-badge";
|
||||
else if (nr == 'playlists') icon = window.CONFIG.Playlist.sidebarIcon;
|
||||
else if (nr == 'compendium') icon = "fas fa-atlas";
|
||||
else if (nr == 'settings') icon = "fas fa-cogs";
|
||||
@@ -479,9 +641,9 @@ export class OtherControls{
|
||||
return icon;
|
||||
}
|
||||
|
||||
updateSidebar(settings,context,options={}){
|
||||
updateSidebar(settings,context,device,options={}){
|
||||
if (MODULE.getPermission('OTHER','SIDEBAR') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
const popOut = settings.sidebarPopOut ? settings.sidebarPopOut : false;
|
||||
@@ -495,12 +657,12 @@ export class OtherControls{
|
||||
if (popOut && options.sidebarTab == sidebarTab) {
|
||||
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 icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
|
||||
|
||||
streamDeck.setTitle(name,context);
|
||||
streamDeck.setIcon(context,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressSidebar(settings){
|
||||
@@ -523,9 +685,9 @@ export class OtherControls{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateCompendiumBrowser(settings,context,options={}){
|
||||
updateCompendiumBrowser(settings,context,device,options={}){
|
||||
let rendered = options.renderCompendiumBrowser;
|
||||
if (rendered == undefined && game.system.id == "pf2e") rendered = (document.getElementById("app-1") != null);
|
||||
if (rendered == undefined && gamingSystem == "pf2e") rendered = (document.getElementById("app-1") != null);
|
||||
else if (rendered == undefined) rendered = (document.getElementById("compendium-popout") != null);
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
@@ -534,18 +696,18 @@ export class OtherControls{
|
||||
const txt = settings.displayCompendiumName ? name : '';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,"",{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressCompendiumBrowser(settings){
|
||||
let element = null;
|
||||
if (game.system.id == "pf2e") element = document.getElementById("app-1")
|
||||
if (gamingSystem == "pf2e") element = document.getElementById("app-1")
|
||||
else element = document.getElementById("compendium-popout");
|
||||
const rendered = (element != null);
|
||||
|
||||
if (rendered)
|
||||
element.getElementsByClassName("close")[0].click();
|
||||
else if (game.system.id == "pf2e")
|
||||
else if (gamingSystem == "pf2e")
|
||||
document.getElementsByClassName("compendium-browser-btn")[0].click()
|
||||
else
|
||||
ui.compendium.renderPopout();
|
||||
@@ -553,29 +715,28 @@ export class OtherControls{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateCompendium(settings,context,options={}){
|
||||
updateCompendium(settings,context,device,options={}){
|
||||
const name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
if (MODULE.getPermission('OTHER','COMPENDIUM') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
let compendium;
|
||||
if (compatibleCore("0.8.1")) compendium = game.packs.contents.find(p=>p.metadata.label == name)?.apps[0];
|
||||
else compendium = game.packs.entries.find(p=>p.metadata.label == name);
|
||||
const compendium = game.packs.find(p=>p.metadata.label == name);
|
||||
if (compendium == undefined) return;
|
||||
if (compendium.private && MODULE.getPermission('OTHER','COMPENDIUM_ALL') == false) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
const rendered = compatibleCore("0.8.5") ? compendium.apps[0].rendered : compendium.rendered;
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const ringColor = compendium.rendered ? ringOnColor : ringOffColor;
|
||||
const ringColor = rendered ? ringOnColor : ringOffColor;
|
||||
const txt = settings.displayCompendiumName ? name : '';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,"",{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressCompendium(settings){
|
||||
@@ -583,18 +744,17 @@ export class OtherControls{
|
||||
if (name == undefined) return;
|
||||
if (MODULE.getPermission('OTHER','COMPENDIUM') == false ) return;
|
||||
|
||||
let compendium;
|
||||
if (compatibleCore("0.8.1")) compendium = game.packs.contents.find(p=>p.metadata.label == name)?.apps[0];
|
||||
else compendium = game.packs.entries.find(p=>p.metadata.label == name);
|
||||
const compendium = game.packs.find(p=>p.metadata.label == name);
|
||||
const rendered = compatibleCore("0.8.5") ? compendium.apps[0].rendered : compendium.rendered;
|
||||
if (compendium == undefined) return;
|
||||
if (compendium.private && MODULE.getPermission('OTHER','COMPENDIUM_ALL') == false) return;
|
||||
else if (compendium.rendered) compendium.close();
|
||||
else if (rendered) compatibleCore("0.8.5") ? compendium.apps[0].close() : compendium.close();
|
||||
else compendium.render(true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateJournal(settings,context,options={}){
|
||||
updateJournal(settings,context,device,options={}){
|
||||
const name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
|
||||
@@ -602,11 +762,11 @@ export class OtherControls{
|
||||
if (journal == undefined) return;
|
||||
|
||||
if (MODULE.getPermission('OTHER','JOURNAL') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
if (journal.permission < 2 && MODULE.getPermission('OTHER','JOURNAL_ALL') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
let rendered = false;
|
||||
@@ -625,7 +785,7 @@ export class OtherControls{
|
||||
const txt = settings.displayCompendiumName ? name : '';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,"",{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressJournal(settings){
|
||||
@@ -644,14 +804,14 @@ export class OtherControls{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateChatMessage(settings,context,options={}){
|
||||
updateChatMessage(settings,context,device,options={}){
|
||||
if (MODULE.getPermission('OTHER','CHAT') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
streamDeck.setTitle("",context);
|
||||
streamDeck.setIcon(context,"",{background:background});
|
||||
streamDeck.setIcon(context,device,"",{background:background});
|
||||
}
|
||||
|
||||
keyPressChatMessage(settings){
|
||||
@@ -665,4 +825,44 @@ export class OtherControls{
|
||||
};
|
||||
ChatMessage.create(chatData, {});
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateRollOptions(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";
|
||||
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'normal';
|
||||
const ringColor = (rollOption == this.rollOption) ? ringOnColor : ringOffColor;
|
||||
streamDeck.setTitle("",context);
|
||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay:true});
|
||||
}
|
||||
|
||||
keyPressRollOptions(settings){
|
||||
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'normal';
|
||||
if (this.rollOption != rollOption) {
|
||||
this.rollOption = rollOption;
|
||||
this.updateAll();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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";
|
||||
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});
|
||||
}
|
||||
|
||||
async keyPressRollMode(settings){
|
||||
const rollMode = settings.rollMode ? settings.rollMode : 'roll';
|
||||
await game.settings.set('core','rollMode',rollMode);
|
||||
this.updateAll();
|
||||
}
|
||||
}
|
||||
@@ -11,45 +11,49 @@ export class PlaylistControl{
|
||||
|
||||
async updateAll(){
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'playlist') continue;
|
||||
await this.update(data.settings,data.context);
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
if (device?.buttons == undefined) continue;
|
||||
for (let i=0; i<device.buttons.length; i++){
|
||||
const data = device.buttons[i];
|
||||
if (data == undefined || data.action != 'playlist') continue;
|
||||
await this.update(data.settings,data.context,device.device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
update(settings,context,device){
|
||||
if (MODULE.getPermission('PLAYLIST','PLAY') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
this.active = true;
|
||||
const mode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||
|
||||
if (mode == 'playlist'){
|
||||
this.updatePlaylist(settings,context);
|
||||
this.updatePlaylist(settings,context,device);
|
||||
}
|
||||
else if (mode == 'track'){
|
||||
this.updateTrack(settings,context);
|
||||
this.updateTrack(settings,context,device);
|
||||
}
|
||||
else {
|
||||
const src = 'modules/MaterialDeck/img/playlist/stop.png';
|
||||
const 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,src,{background:background,ring:ring,ringColor:ringColor,overlay:true});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,overlay:true});
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
}
|
||||
|
||||
updatePlaylist(settings,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';
|
||||
let src = "modules/MaterialDeck/img/transparant.png";
|
||||
|
||||
//Play/Stop
|
||||
if (playlistType == 'playStop'){
|
||||
@@ -59,6 +63,7 @@ export class PlaylistControl{
|
||||
playlistNr += this.playlistOffset;
|
||||
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
|
||||
if (playlist != undefined){
|
||||
if (playlist.playing)
|
||||
ringColor = ringOnColor;
|
||||
@@ -72,7 +77,7 @@ export class PlaylistControl{
|
||||
else if (playlistType == 'offset') {
|
||||
let playlistOffset = parseInt(settings.offset);
|
||||
if (isNaN(playlistOffset)) playlistOffset = 0;
|
||||
if (playlistOffset == this.playlistOffset) ringColor = ringOnColor;
|
||||
ringColor = (playlistOffset == this.playlistOffset) ? ringOnColor : ringOffColor;
|
||||
}
|
||||
//Relative Offset
|
||||
else if (playlistType == 'relativeOffset') {
|
||||
@@ -85,17 +90,18 @@ export class PlaylistControl{
|
||||
const targetPlaylist = this.getPlaylist(number);
|
||||
if (targetPlaylist != undefined) name = targetPlaylist.name;
|
||||
}
|
||||
streamDeck.setIcon(context,"",{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
|
||||
updateTrack(settings,context){
|
||||
updateTrack(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';
|
||||
let src = "modules/MaterialDeck/img/transparant.png";
|
||||
|
||||
//Play/Stop
|
||||
if (playlistType == 'playStop'){
|
||||
@@ -110,10 +116,7 @@ export class PlaylistControl{
|
||||
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
if (playlist != undefined){
|
||||
let track;
|
||||
if (compatibleCore("0.8.1")) track = playlist.sounds.contents[trackNr];
|
||||
else track = playlist.data.sounds[trackNr];
|
||||
|
||||
const track = compatibleCore("0.8.1") ? playlist.sounds.contents[trackNr] : playlist.sounds[trackNr];
|
||||
if (track != undefined){
|
||||
if (track.playing)
|
||||
ringColor = ringOnColor;
|
||||
@@ -128,12 +131,12 @@ export class PlaylistControl{
|
||||
else if (playlistType == 'offset') {
|
||||
let trackOffset = parseInt(settings.offset);
|
||||
if (isNaN(trackOffset)) trackOffset = 0;
|
||||
if (trackOffset == this.trackOffset) ringColor = ringOnColor;
|
||||
ringColor = (trackOffset == this.trackOffset) ? ringOnColor : ringOffColor;
|
||||
}
|
||||
//Relative Offset
|
||||
else if (playlistType == 'relativeOffset') {
|
||||
}
|
||||
streamDeck.setIcon(context,"",{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
|
||||
@@ -164,6 +167,27 @@ export class PlaylistControl{
|
||||
}
|
||||
}
|
||||
|
||||
pauseAll(){
|
||||
if (game.user.isGM == false) {
|
||||
const payload = {
|
||||
"msgType": "pauseAllPlaylists"
|
||||
};
|
||||
game.socket.emit(`module.MaterialDeck`, payload);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
let playing = game.playlists.playing;
|
||||
for (let i=0; i<playing.length; i++){
|
||||
for (let sound of playing[i].sounds.contents) {
|
||||
if (sound.playing) sound.sound.pause();
|
||||
}
|
||||
}
|
||||
*/
|
||||
for (let elmnt of document.getElementsByClassName('sound-control pause'))
|
||||
elmnt.click();
|
||||
}
|
||||
|
||||
getPlaylist(num){
|
||||
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
|
||||
if (selectedPlaylists != undefined)
|
||||
@@ -171,7 +195,7 @@ export class PlaylistControl{
|
||||
else return undefined;
|
||||
}
|
||||
|
||||
keyPress(settings,context){
|
||||
keyPress(settings,context,device){
|
||||
if (MODULE.getPermission('PLAYLIST','PLAY') == false ) return;
|
||||
let playlistNr = settings.playlistNr;
|
||||
if (playlistNr == undefined || playlistNr < 1) playlistNr = 1;
|
||||
@@ -188,6 +212,9 @@ export class PlaylistControl{
|
||||
if (playlistMode == 'stopAll') {
|
||||
this.stopAll(true);
|
||||
}
|
||||
else if (playlistMode == 'pauseAll') {
|
||||
this.pauseAll();
|
||||
}
|
||||
else {
|
||||
if (playlistType == 'playStop') {
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
@@ -195,15 +222,19 @@ export class PlaylistControl{
|
||||
if (playlistMode == 'playlist')
|
||||
this.playPlaylist(playlist,playlistNr);
|
||||
else {
|
||||
let track;
|
||||
if (compatibleCore("0.8.1")) track = playlist.sounds.contents[trackNr];
|
||||
else track = playlist.data.sounds[trackNr];
|
||||
const track = compatibleCore("0.8.1") ? playlist.sounds.contents[trackNr] : playlist.sounds[trackNr];
|
||||
if (track != undefined){
|
||||
this.playTrack(track,playlist,playlistNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (playlistType == 'playNext') {
|
||||
this.getPlaylist(playlistNr).playNext();
|
||||
}
|
||||
else if (playlistType == 'playPrev') {
|
||||
this.getPlaylist(playlistNr).playNext(null,{direction:-1});
|
||||
}
|
||||
else if (playlistType == 'offset'){
|
||||
if (playlistMode == 'playlist') {
|
||||
this.playlistOffset = parseInt(settings.offset);
|
||||
|
||||
27
src/scene.js
@@ -11,14 +11,17 @@ export class SceneControl{
|
||||
|
||||
async updateAll(){
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'scene') continue;
|
||||
await this.update(data.settings,data.context);
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
if (device?.buttons == undefined) continue;
|
||||
for (let i=0; i<device.buttons.length; i++){
|
||||
const data = device.buttons[i];
|
||||
if (data == undefined || data.action != 'scene') continue;
|
||||
await this.update(data.settings,data.context,device.device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
update(settings,context,device){
|
||||
if (canvas.scene == null) return;
|
||||
this.active = true;
|
||||
const func = settings.sceneFunction ? settings.sceneFunction : 'visible';
|
||||
@@ -32,7 +35,7 @@ export class SceneControl{
|
||||
let name = "";
|
||||
if (func == 'visible') { //visible scenes
|
||||
if (MODULE.getPermission('SCENE','VISIBLE') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
let nr = parseInt(settings.sceneNr);
|
||||
@@ -50,7 +53,7 @@ export class SceneControl{
|
||||
}
|
||||
else if (func == 'dir') { //from directory
|
||||
if (MODULE.getPermission('SCENE','DIRECTORY') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
let nr = parseInt(settings.sceneNr);
|
||||
@@ -85,7 +88,7 @@ export class SceneControl{
|
||||
}
|
||||
else if (func == 'any') { //by name
|
||||
if (MODULE.getPermission('SCENE','NAME') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
if (settings.sceneName == undefined || settings.sceneName == '') return;
|
||||
@@ -100,7 +103,7 @@ export class SceneControl{
|
||||
}
|
||||
else if (func == 'active'){
|
||||
if (MODULE.getPermission('SCENE','ACTIVE') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
const scene = game.scenes.active;
|
||||
@@ -112,11 +115,11 @@ export class SceneControl{
|
||||
else if (func == 'offset'){
|
||||
let offset = parseInt(settings.sceneOffset);
|
||||
if (isNaN(offset)) offset = 0;
|
||||
if (offset == this.sceneOffset) ringColor = ringOnColor;
|
||||
else ringColor = ringOffColor;
|
||||
ringColor = (offset == this.sceneOffset) ? ringOnColor : ringOffColor;
|
||||
src = "modules/MaterialDeck/img/transparant.png";
|
||||
}
|
||||
streamDeck.setTitle(name,context);
|
||||
streamDeck.setIcon(context,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPress(settings){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as MODULE from "../MaterialDeck.js";
|
||||
import { playlistConfigForm, macroConfigForm, soundboardConfigForm } from "./misc.js";
|
||||
import { playlistConfigForm, macroConfigForm, soundboardConfigForm, downloadUtility, deviceConfig } from "./misc.js";
|
||||
|
||||
let userPermissions = {};
|
||||
const defaultEnable = [true,true,true,true];
|
||||
@@ -22,10 +22,6 @@ const defaultUserPermissions = {
|
||||
MACROBOARD: [false,false,true,true],
|
||||
MACROBOARD_CONFIGURE: [false,false,true,true]
|
||||
},
|
||||
MOVE: {
|
||||
TOKEN: [true,true,true,true],
|
||||
CANVAS: [true,true,true,true]
|
||||
},
|
||||
OTHER: {
|
||||
PAUSE: [false,false,true,true],
|
||||
CONTROL: [true,true,true,true],
|
||||
@@ -83,14 +79,17 @@ export const registerSettings = async function() {
|
||||
onChange: x => window.location.reload()
|
||||
});
|
||||
|
||||
game.settings.register(MODULE.moduleName,'streamDeckModel', {
|
||||
name: "MaterialDeck.Sett.Model",
|
||||
hint: "MaterialDeck.Sett.Model_Hint",
|
||||
/**
|
||||
* System override
|
||||
*/
|
||||
game.settings.register(MODULE.moduleName,'systemOverride', {
|
||||
name: "MaterialDeck.Sett.SystemOverride",
|
||||
hint: "MaterialDeck.Sett.SystemOverrideHint",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type:Number,
|
||||
default:1,
|
||||
choices:["MaterialDeck.Sett.Model_Mini","MaterialDeck.Sett.Model_Normal","MaterialDeck.Sett.Model_XL"],
|
||||
default: "",
|
||||
type: String,
|
||||
onChange: x => window.location.reload()
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -117,6 +116,28 @@ export const registerSettings = async function() {
|
||||
|
||||
});
|
||||
|
||||
game.settings.register(MODULE.moduleName, 'imageBrightness', {
|
||||
name: "MaterialDeck.Sett.ImageBrightness",
|
||||
hint: "MaterialDeck.Sett.ImageBrightnessHint",
|
||||
default: 50,
|
||||
type: Number,
|
||||
scope: 'client',
|
||||
range: { min: 0, max: 100, step: 1 },
|
||||
config: true
|
||||
|
||||
});
|
||||
|
||||
game.settings.register(MODULE.moduleName, 'nrOfConnMessages', {
|
||||
name: "MaterialDeck.Sett.NrOfConnMessages",
|
||||
hint: "MaterialDeck.Sett.NrOfConnMessagesHint",
|
||||
default: 5,
|
||||
type: Number,
|
||||
scope: 'client',
|
||||
range: { min: 0, max: 100, step: 1 },
|
||||
config: true
|
||||
|
||||
});
|
||||
|
||||
//Create the Help button
|
||||
game.settings.registerMenu(MODULE.moduleName, 'helpMenu',{
|
||||
name: "MaterialDeck.Sett.Help",
|
||||
@@ -125,6 +146,27 @@ export const registerSettings = async function() {
|
||||
restricted: false
|
||||
});
|
||||
|
||||
game.settings.registerMenu(MODULE.moduleName, 'downloadUtility',{
|
||||
name: "MaterialDeck.DownloadUtility.Title",
|
||||
label: "MaterialDeck.DownloadUtility.Title",
|
||||
type: downloadUtility,
|
||||
restricted: false
|
||||
});
|
||||
|
||||
game.settings.registerMenu(MODULE.moduleName, 'deviceConfig',{
|
||||
name: "MaterialDeck.DeviceConfig.Title",
|
||||
label: "MaterialDeck.DeviceConfig.Title",
|
||||
type: deviceConfig,
|
||||
restricted: false
|
||||
});
|
||||
|
||||
game.settings.register(MODULE.moduleName, 'devices', {
|
||||
name: "devices",
|
||||
scope: "client",
|
||||
type: Object,
|
||||
config: false
|
||||
});
|
||||
|
||||
game.settings.registerMenu(MODULE.moduleName, 'permissionConfig',{
|
||||
name: "MaterialDeck.Sett.Permission",
|
||||
label: "MaterialDeck.Sett.Permission",
|
||||
@@ -211,11 +253,12 @@ export const registerSettings = async function() {
|
||||
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];
|
||||
}
|
||||
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
|
||||
|
||||
|
||||
if (game.user.isGM)
|
||||
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class helpMenu extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
@@ -290,11 +333,7 @@ export class helpMenu extends FormApplication {
|
||||
}
|
||||
|
||||
const actions = Object.entries(duplicate(settings.permissions)).reduce((arr, e) => {
|
||||
//const perm = e[1];
|
||||
|
||||
const perms = Object.entries(duplicate(e[1])).reduce((arr, p) => {
|
||||
//const perm = e[1];
|
||||
|
||||
let perm = {};
|
||||
perm.roles = [p[1][0],p[1][1],p[1][2],p[1][3]]
|
||||
perm.id = p[0];
|
||||
@@ -312,8 +351,10 @@ export class helpMenu extends FormApplication {
|
||||
arr.push(cat);
|
||||
return arr;
|
||||
}, []);
|
||||
|
||||
const current = await game.settings.get("core", "permissions");
|
||||
for (let i=0; i<actions.length; i++) {
|
||||
if (actions[i].id == 'MOVE')
|
||||
actions.splice(i,1);
|
||||
}
|
||||
return {
|
||||
roles: Object.keys(CONST.USER_ROLES).reduce((obj, r) => {
|
||||
if ( r === "NONE" ) return obj;
|
||||
@@ -336,7 +377,7 @@ export class helpMenu extends FormApplication {
|
||||
settings.enable = permissions.ENABLE;
|
||||
delete permissions.ENABLE;
|
||||
settings.permissions = permissions;
|
||||
game.settings.set(MODULE.moduleName,'userPermission',settings);
|
||||
// game.settings.set(MODULE.moduleName,'userPermission',settings);
|
||||
}
|
||||
|
||||
async activateListeners(html) {
|
||||
|
||||
@@ -7,22 +7,23 @@ export class SoundboardControl{
|
||||
this.active = false;
|
||||
this.offset = 0;
|
||||
this.activeSounds = [];
|
||||
for (let i=0; i<64; i++)
|
||||
this.activeSounds[i] = false;
|
||||
}
|
||||
|
||||
async updateAll(){
|
||||
if (this.active == false) return;
|
||||
for (let i=0; i<32; i++){
|
||||
const data = streamDeck.buttonContext[i];
|
||||
if (data == undefined || data.action != 'soundboard') continue;
|
||||
await this.update(data.settings,data.context);
|
||||
for (let device of streamDeck.buttonContext) {
|
||||
if (device?.buttons == undefined) continue;
|
||||
for (let i=0; i<device.buttons.length; i++){
|
||||
const data = device.buttons[i];
|
||||
if (data == undefined || data.action != 'soundboard') continue;
|
||||
await this.update(data.settings,data.context,device.device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update(settings,context){
|
||||
update(settings,context,device){
|
||||
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) {
|
||||
streamDeck.noPermission(context);
|
||||
streamDeck.noPermission(context,device);
|
||||
return;
|
||||
}
|
||||
this.active = true;
|
||||
@@ -40,13 +41,13 @@ export class SoundboardControl{
|
||||
soundNr += this.offset;
|
||||
|
||||
let soundboardSettings = game.settings.get(MODULE.moduleName, 'soundboardSettings');
|
||||
ringColor = (this.activeSounds[soundNr]==false) ? soundboardSettings.colorOff[soundNr] : soundboardSettings.colorOn[soundNr];
|
||||
ringColor = (this.activeSounds[soundNr]==undefined) ? soundboardSettings.colorOff[soundNr] : soundboardSettings.colorOn[soundNr];
|
||||
|
||||
if (settings.displayName && soundboardSettings.name != undefined) txt = soundboardSettings.name[soundNr];
|
||||
if (settings.displayIcon && soundboardSettings.img != undefined) src = soundboardSettings.img[soundNr];
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,src,{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
else if (mode == 'offset') { //Offset
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
@@ -58,7 +59,7 @@ export class SoundboardControl{
|
||||
else ringColor = ringOffColor;
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(context,"",{background:background,ring:2,ringColor:ringColor});
|
||||
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
else if (mode == 'stopAll') { //Stop all sounds
|
||||
let src = 'modules/MaterialDeck/img/playlist/stop.png';
|
||||
@@ -68,9 +69,9 @@ export class SoundboardControl{
|
||||
if (this.activeSounds[i])
|
||||
soundPlaying = true;
|
||||
if (soundPlaying)
|
||||
streamDeck.setIcon(context,src,{background:background,ring:2,ringColor:'#00FF00',overlay:true});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:'#00FF00',overlay:true});
|
||||
else
|
||||
streamDeck.setIcon(context,src,{background:background,ring:1,ringColor:'#000000',overlay:true});
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:1,ringColor:'#000000',overlay:true});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +87,7 @@ export class SoundboardControl{
|
||||
|
||||
const playMode = game.settings.get(MODULE.moduleName,'soundboardSettings').mode[soundNr];
|
||||
const repeat = (playMode > 0) ? true : false;
|
||||
const play = (this.activeSounds[soundNr] == false) ? true : false;
|
||||
const play = (this.activeSounds[soundNr] == undefined) ? true : false;
|
||||
|
||||
this.prePlaySound(soundNr,repeat,play);
|
||||
}
|
||||
@@ -97,8 +98,8 @@ export class SoundboardControl{
|
||||
this.updateAll();
|
||||
}
|
||||
else if (mode == 'stopAll') { //Stop All Sounds
|
||||
for (let i=0; i<64; i++) {
|
||||
if (this.activeSounds[i] != false){
|
||||
for (let i=0; i<this.activeSounds.length; i++) {
|
||||
if (this.activeSounds[i] != undefined){
|
||||
this.prePlaySound(i,false,false);
|
||||
}
|
||||
}
|
||||
@@ -169,11 +170,11 @@ export class SoundboardControl{
|
||||
volume *= game.settings.get("core", "globalAmbientVolume");
|
||||
|
||||
if (compatibleCore("0.8.1")) {
|
||||
let newSound = new SoundNode(src);
|
||||
let newSound = new Sound(src);
|
||||
if(newSound.loaded == false) await newSound.load({autoplay:true});
|
||||
newSound.on('end', ()=>{
|
||||
if (repeat == false) {
|
||||
this.activeSounds[soundNr] = false;
|
||||
this.activeSounds[soundNr] = undefined;
|
||||
this.updateAll();
|
||||
}
|
||||
});
|
||||
@@ -183,12 +184,12 @@ export class SoundboardControl{
|
||||
else {
|
||||
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
|
||||
if (repeat == false){
|
||||
this.activeSounds[soundNr] = false;
|
||||
this.activeSounds[soundNr] = undefined;
|
||||
this.updateAll();
|
||||
}
|
||||
},
|
||||
onstop: ()=>{
|
||||
this.activeSounds[soundNr] = false;
|
||||
this.activeSounds[soundNr] = undefined;
|
||||
this.updateAll();
|
||||
}});
|
||||
howl.play();
|
||||
@@ -196,28 +197,9 @@ export class SoundboardControl{
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.activeSounds[soundNr].stop();
|
||||
this.activeSounds[soundNr] = false;
|
||||
if (this.activeSounds[soundNr] != undefined) this.activeSounds[soundNr].stop();
|
||||
this.activeSounds[soundNr] = undefined;
|
||||
}
|
||||
this.updateAll();
|
||||
}
|
||||
|
||||
/*
|
||||
volumeChange(soundNr){
|
||||
|
||||
let volume = game.settings.get("core", "globalAmbientVolume");
|
||||
|
||||
if (soundNr == 'all') {
|
||||
for (let i=0; this.activeSounds.length; i++) {
|
||||
volume * game.settings.get(MODULE.moduleName,'soundboardSettings').volume[i]/100;
|
||||
volume = AudioHelper.inputToVolume(volume);
|
||||
this.activeSounds[i].volume = volume;
|
||||
}
|
||||
}
|
||||
else {
|
||||
volume * game.settings.get(MODULE.moduleName,'soundboardSettings').volume[soundNr]/100;
|
||||
volume = AudioHelper.inputToVolume(volume);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||