52 Commits

Author SHA1 Message Date
CDeenen
e58d9ca757 v1.4.5 2021-07-27 21:56:50 +02:00
CDeenen
ce28b2da97 Merge branch 'Master' of https://github.com/CDeenen/MaterialDeck into Master 2021-07-20 02:03:34 +02:00
Material Foundry
9c1f549791 Merge pull request #79 from lhayhurst/feature/wfrp4
WFRP4e implementation
2021-07-20 01:57:37 +02:00
CDeenen
28212f03e2 readme update 2021-07-14 02:02:05 +02:00
Lyle hayhurst
22debde812 Merge remote-tracking branch 'CDeenen/Master' into feature/wfrp4 2021-06-20 00:05:01 -05:00
Lyle hayhurst
26afbae66b Final bits.
with @solo
2021-06-20 00:03:44 -05:00
Lyle hayhurst
a5655f46dd getting skill bonuses showing 2021-06-07 19:44:36 -05:00
Lyle hayhurst
b4fe337824 Added characteristics
with @cdeendan and @echobold
2021-06-07 15:21:35 -05:00
Material Foundry
69442aec39 Merge pull request #78 from lhayhurst/feature/roll-item-refactoring
Added rollItem() family of methods
2021-06-07 14:46:19 +02:00
Lyle hayhurst
9e12b7cd84 fix item roll 2021-06-06 11:18:35 -05:00
Lyle hayhurst
5c6a4a4223 add impl of rollitem 2021-06-06 11:14:25 -05:00
Lyle hayhurst
57812d0863 Merge branch 'feature/roll-item-refactoring' into feature/wfrp4 2021-06-06 11:12:16 -05:00
Lyle hayhurst
560c3a573f Added rollItem() family of methods 2021-06-06 09:23:47 -05:00
Lyle hayhurst
cffa2318f7 better return type. 2021-06-06 08:54:47 -05:00
Lyle hayhurst
ec207fa658 added item display, item rolling 2021-06-04 09:02:52 -05:00
Lyle hayhurst
9ffa796eeb added item types 2021-06-04 08:14:28 -05:00
Lyle hayhurst
2dcbfbe096 added basics of getItems() 2021-06-03 08:42:08 -05:00
Lyle hayhurst
87a031ae44 added support for fate and wounds. 2021-06-02 23:50:12 -05:00
Lyle hayhurst
63bda666b5 renamed to wfrp4e 2021-06-02 08:15:04 -05:00
Material Foundry
6b8ca86fe2 Merge pull request #74 from BrotherSharper/Master
ja.json update
2021-06-02 03:12:21 +02:00
Lyle hayhurst
efbbdf7760 WIP comit
with @solo
2021-06-01 19:57:44 -05:00
CDeenen
3b30f7d439 Update issue templates 2021-06-02 02:00:31 +02:00
Material Foundry
318c16d013 Create FUNDING.yml 2021-06-02 01:46:07 +02:00
BrotherSharper
1dcdcd9c0b Merge branch and update ja.json 2021-06-01 21:03:10 +09:00
BrotherSharper
cf95255a47 ja.json update 2021-06-01 21:01:11 +09:00
CDeenen
ebdc1b5e5c v1.4.4 2021-05-26 02:02:47 +02:00
Material Foundry
07a3bdd837 Merge pull request #70 from BrotherSharper/Master
add japanese localisaton
2021-05-23 17:40:26 +02:00
BrotherSharper
08fdde939a add japanese localisaton 2021-05-19 10:35:54 +09:00
CDeenen
484b7a0b7f v1.4.3 2021-05-05 01:00:18 +02:00
CDeenen
bf8c5c0076 v1.4.2 2021-04-23 02:13:09 +02:00
CDeenen
e229abc3ee v1.4.1 2021-04-21 23:32:05 +02:00
CDeenen
51119f42ea v1.4.0 2021-04-21 18:27:03 +02:00
CDeenen
42e4f8f0d8 merge fix 2021-04-21 18:26:10 +02:00
CDeenen
c3ee0a76aa v1.4.0 2021-04-21 18:23:02 +02:00
Material Foundry
2264d018c2 Update changelog.md 2021-04-18 21:55:15 +02:00
CDeenen
8fa32838d8 v1.3.3 2021-04-13 02:30:25 +02:00
CDeenen
1552ae6fe8 v1.3.3 2021-04-13 02:30:10 +02:00
CDeenen
cc9bcf4770 v1.3.2 2021-03-11 02:28:26 +01:00
CDeenen
7d4fd1e8b1 readme fix 2021-02-27 05:14:56 +01:00
CDeenen
780e06d581 Merge branch 'Master' of https://github.com/CDeenen/MaterialDeck into Master 2021-02-27 05:09:23 +01:00
CDeenen
64983ca0cb v1.3.1 2021-02-27 05:07:47 +01:00
CDeenen
dd534488da Update settings.js 2021-02-25 07:54:20 +01:00
CDeenen
7e2796316e Merge branch 'Master' of https://github.com/CDeenen/MaterialDeck into Master 2021-02-25 06:49:29 +01:00
CDeenen
7fa5352459 v1.3.0 2021-02-25 06:48:27 +01:00
CDeenen
c31cea4c64 Update README.md 2021-02-08 16:46:52 +01:00
CDeenen
f994e64fc7 v1.2.3 2021-02-04 05:03:34 +01:00
CDeenen
f0c1b0e1e0 v1.2.2 2021-02-02 05:32:08 +01:00
CDeenen
cc5dc9ab63 v1.2.1 2021-01-07 05:40:07 +01:00
CDeenen
64fd6cb132 Merge branch 'Master' of https://github.com/CDeenen/MaterialDeck into Master 2021-01-07 05:39:02 +01:00
CDeenen
888b089e7b v1.2.1 2021-01-07 05:38:16 +01:00
CDeenen
959b9c9e4e Add files via upload 2021-01-02 05:19:06 +01:00
CDeenen
afaf1c9799 Delete Black.png 2021-01-02 05:18:50 +01:00
114 changed files with 7108 additions and 1581 deletions

12
.github/FUNDING.yml vendored Normal file
View 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
View 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.

View 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
View File

@@ -0,0 +1,10 @@
---
name: Other issues
about: For any other issues
title: ''
labels: ''
assignees: ''
---

40
DEVGUIDE.md Normal file
View 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`.

View File

@@ -1,28 +1,39 @@
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";
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 {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;
export var soundboard;
export var otherControls;
export var externalModules;
export var sceneControl;
export var tokenHelper;
export const moduleName = "MaterialDeck";
export var selectedTokenId;
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;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -38,6 +49,8 @@ let wsOpen = false; //Bool for checking if websocket has ever been o
let wsInterval; //Interval timer to detect disconnections
let WSconnected = false;
//let furnace = game.modules.get("furnace");
/*
* Analyzes the message received
*
@@ -46,10 +59,54 @@ let WSconnected = false;
async function analyzeWSmessage(msg){
if (enableModule == false) return;
const data = JSON.parse(msg);
//console.log("Received",data);
// console.log("Received",data);
if (data.type == "connected" && data.data == "SD"){
const msg = {
target: "SD",
type: "init",
system: game.system.id
}
ws.send(JSON.stringify(msg));
console.log("streamdeck connected to server");
streamDeck.resetImageBuffer();
}
if (data.type == "version" && data.source == "SD") {
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 == undefined || data.payload == undefined) return;
@@ -58,57 +115,60 @@ async function analyzeWSmessage(msg){
const event = data.event;
const context = data.context;
const coordinates = data.payload.coordinates;
if (coordinates == undefined) coordinates = 0;
const settings = data.payload.settings;
const device = data.device;
if (data.data == 'init'){
}
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);
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,device);
}
else if (event == 'willDisappear'){
streamDeck.clearContext(action,coordinates);
if (coordinates == undefined) return;
streamDeck.clearContext(device,action,coordinates,context);
}
else if (event == 'keyDown'){
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);
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'){
@@ -126,7 +186,10 @@ async function analyzeWSmessage(msg){
*/
function startWebsocket() {
const address = game.settings.get(moduleName,'address');
ws = new WebSocket('ws://'+address+'/');
const url = address.startsWith('wss://') ? address : ('ws://'+address+'/');
ws = new WebSocket(url);
ws.onmessage = function(msg){
//console.log(msg);
@@ -136,6 +199,7 @@ function startWebsocket() {
}
ws.onopen = function() {
messageCount = 0;
WSconnected = true;
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+address);
wsOpen = true;
@@ -146,7 +210,8 @@ function startWebsocket() {
ws.send(JSON.stringify(msg));
const msg2 = {
target: "SD",
type: "init"
type: "init",
system: game.system.id
}
ws.send(JSON.stringify(msg2));
clearInterval(wsInterval);
@@ -156,15 +221,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){
@@ -172,6 +250,22 @@ export function sendWS(txt){
ws.send(txt);
}
export function isEmpty(obj) {
for(var key in obj) {
if(obj.hasOwnProperty(key))
return false;
}
return true;
}
export function getPermission(action,func) {
const role = game.user.role-1;
const settings = game.settings.get(moduleName,'userPermission');
if (action == 'ENABLE') return settings.enable[role];
else return settings.permissions?.[action]?.[func]?.[role];
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Hooks
@@ -182,53 +276,85 @@ export function sendWS(txt){
* Ready hook
* Attempt to open the websocket
*/
Hooks.once('ready', ()=>{
Hooks.once('ready', async()=>{
registerSettings();
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
game.socket.on(`module.MaterialDeck`, (payload) =>{
//console.log(payload);
if (payload.msgType != "playSound") return;
playTrack(payload.trackNr,payload.src,payload.play,payload.repeat,payload.volume);
});
for (let i=0; i<64; i++)
activeSounds[i] = false;
if (enableModule == false) return;
if (game.user.isGM == false) {
ready = true;
return;
}
startWebsocket();
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);
if (payload.msgType == "playSound") soundboard.playSound(payload.trackNr,payload.src,payload.play,payload.repeat,payload.volume);
else if (game.user.isGM && payload.msgType == "playPlaylist") {
const playlist = playlistControl.getPlaylist(payload.playlistNr);
playlistControl.playPlaylist(playlist,payload.playlistNr);
}
else if (game.user.isGM && payload.msgType == "playTrack") {
const playlist = playlistControl.getPlaylist(payload.playlistNr);
const sounds = playlist.data.sounds;
for (let track of sounds)
if (track._id == payload.trackId)
playlistControl.playTrack(track,playlist,payload.playlistNr)
}
else if (game.user.isGM && payload.msgType == "stopAllPlaylists")
playlistControl.stopAll(payload.force);
else if (game.user.isGM && payload.msgType == "soundboardUpdate") {
await game.settings.set(moduleName,'soundboardSettings',payload.settings);
const payloadNew = {
"msgType": "soundboardRefresh"
};
game.socket.emit(`module.MaterialDeck`, payloadNew);
}
else if (game.user.isGM == false && payload.msgType == "soundboardRefresh" && enableModule)
soundboard.updateAll();
else if (game.user.isGM && payload.msgType == "macroboardUpdate") {
await game.settings.set(moduleName,'macroSettings',payload.settings);
const payloadNew = {
"msgType": "macroboardRefresh"
};
game.socket.emit(`module.MaterialDeck`, payloadNew);
}
else if (game.user.isGM == false && payload.msgType == "macroboardRefresh" && enableModule)
macroControl.updateAll();
else if (game.user.isGM && payload.msgType == "playlistUpdate") {
await game.settings.set(moduleName,'playlists',payload.settings);
const payloadNew = {
"msgType": "playlistRefresh"
};
game.socket.emit(`module.MaterialDeck`, payloadNew);
}
else if (game.user.isGM == false && payload.msgType == "playlistRefresh" && enableModule)
playlistControl.updateAll();
});
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',{
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,
@@ -236,76 +362,92 @@ Hooks.once('ready', ()=>{
mode: arrayZero,
toggle: arrayZero,
volume: arrayVolume
});
};
if (soundBoardSettings.colorOff == undefined){
game.settings.set(moduleName,'soundboardSettings',settings);
}
}
if (enableModule == false) return;
if (getPermission('ENABLE') == false) {
ready = true;
return;
}
startWebsocket();
const hotbarUsesTemp = game.modules.get("illandril-hotbar-uses");
if (hotbarUsesTemp != undefined) hotbarUses = true;
});
export function playTrack(soundNr,src,play,repeat,volume){
if (play){
volume *= game.settings.get("core", "globalInterfaceVolume");
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
if (repeat == false){
activeSounds[soundNr] = false;
}
},
onstop: (id)=>{
activeSounds[soundNr] = false;
}});
howl.play();
activeSounds[soundNr] = howl;
}
else {
activeSounds[soundNr].stop();
activeSounds[soundNr] = false;
}
}
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);
if (tokenId == canvas.tokens.controlled[0]?.id) {
tokenControl.update(canvas.tokens.controlled[0]?.id);
}
}
}
if (macroControl != undefined) macroControl.updateAll();
});
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();
});
Hooks.on('updateOwnedItem',()=>{
if (macroControl != undefined) macroControl.updateAll();
})
Hooks.on('renderHotbar', (hotbar)=>{
if (enableModule == false || ready == false) return;
macroControl.hotbar(hotbar.macros);
if (macroControl != undefined) macroControl.hotbar(hotbar.macros);
});
Hooks.on('render', (app)=>{
if (enableModule == false || ready == false) return;
if (compatibleCore("0.8.1") == false) return;
if (app.id == "hotbar" && macroControl != undefined) macroControl.hotbar(app.macros);
});
Hooks.on('renderCombatTracker',()=>{
if (enableModule == false || ready == false) return;
combatTracker.updateAll();
tokenControl.update(selectedTokenId);
if (combatTracker != undefined) combatTracker.updateAll();
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)=>{
if (enableModule == false || ready == false) return;
playlistControl.updateAll();
if (playlistControl != undefined) playlistControl.updateAll();
});
Hooks.on('closeplaylistConfigForm', (form)=>{
@@ -319,25 +461,49 @@ Hooks.on('pauseGame',()=>{
otherControls.updateAll();
});
Hooks.on('renderSidebarTab',()=>{
Hooks.on('renderSidebarTab',(app)=>{
const options = {
sidebarTab: app.tabName,
renderPopout: app.popOut
}
if (enableModule == false || ready == false) return;
otherControls.updateAll();
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)=>{
const options = {
sidebarTab: app.tabName,
renderPopout: false
}
if (otherControls != undefined) otherControls.updateAll(options);
});
Hooks.on('changeSidebarTab',()=>{
if (enableModule == false || ready == false) return;
if (otherControls != undefined) otherControls.updateAll();
});
Hooks.on('updateScene',()=>{
if (enableModule == false || ready == false) return;
sceneControl.updateAll();
externalModules.updateAll();
otherControls.updateAll();
});
Hooks.on('renderSceneControls',()=>{
if (enableModule == false || ready == false || otherControls == undefined) return;
otherControls.updateAll();
externalModules.updateAll();
});
Hooks.on('renderSceneControls',()=>{
if (enableModule == false || ready == false) return;
otherControls.updateAll();
});
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',()=>{
@@ -355,21 +521,66 @@ Hooks.on('closeCompendium',()=>{
otherControls.updateAll();
});
Hooks.on('renderJournalSheet',()=>{
Hooks.on('renderCompendiumBrowser',()=>{
if (enableModule == false || ready == false) return;
otherControls.updateAll();
otherControls.updateAll({renderCompendiumBrowser:true});
});
Hooks.on('closeJournalSheet',()=>{
Hooks.on('closeCompendiumBrowser',()=>{
if (enableModule == false || ready == false) return;
otherControls.updateAll();
otherControls.updateAll({renderCompendiumBrowser:false});
});
Hooks.on('renderJournalSheet',(sheet)=>{
if (enableModule == false || ready == false) return;
otherControls.updateAll({
hook:'renderJournalSheet',
sheet:sheet
});
});
Hooks.on('closeJournalSheet',(sheet)=>{
if (enableModule == false || ready == false) return;
otherControls.updateAll({
hook:'closeJournalSheet',
sheet:sheet
});
});
Hooks.on('gmScreenOpenClose',(html,isOpen)=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll({gmScreen:isOpen});
});
Hooks.on('ShareVision', ()=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll();
})
Hooks.on('NotYourTurn', ()=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll();
})
Hooks.on('pseudoclockSet', ()=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll();
})
Hooks.on('about-time.clockRunningStatus', ()=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll();
})
Hooks.once('init', ()=>{
//CONFIG.debug.hooks = true;
registerSettings(); //in ./src/settings.js
//registerSettings(); //in ./src/settings.js
});
Hooks.once('canvasReady',()=>{
ready = true;
});
Hooks.on("soundscape", (data) => {
externalModules.newSoundscapeData(data);
});

View File

@@ -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.5-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:

View File

@@ -1,4 +1,305 @@
# Changelog Material Deck Module
### 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>
<li>Other Actions => Open Sidebar Tab: Added option to create an pop-out (doesn't work for the chat)</li>
<li>Other Actions: Added option to open the pf2e compendium browser</li>
<li>Macro Action: Can now call macros by name</li>
<li>Token Action => On Click: Added option to call a macro. Currently the macro will be applied to the selected token</li>
<li>Token Action => Display Stats: Added saving throws and skill modifiers for most systems</li>
<li>Token Action => OnClick: Added 'Dice Roll' option, which allows you to roll ability checks, saving throws and other things (depending on game system)</li>
<li>Token Action => Stats => Display HP: Made the heart icon dynamic, so the amount that the heart is filled with red depends on the relative amount of hit points of the token. 25% hp means the lower 25% of the heart is red, 50% hp means the lower 50% of the heart is red, etc</li>
<li>Token Action => Stats => Added a '+' before all modifier stats that are bigger than 0</li>
<li>Token Action => Custom OnClick: Added support for calling macros. For instructions, please refer to the documentation: https://github.com/CDeenen/MaterialDeck/wiki/Token-Action#custom-on-click-function</li>
</ul>
Fixes:
<ul>
<li>Other Actions => Pause Game: Pause is now transmitted to all connected clients</li>
<li>Token Action => Display Stats: Fixed movement speed for pf2e</li>
</ul>
Other:
<ul>
<li>Should be compatible with Foundry 0.8.1. Only tested on DnD5e. Please note that any functions that rely on other modules do not work if the other modules are not compatible with 0.8.1</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.3.4 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.3.2 - 11-03-2021
Additions:
<ul>
<li>Added support for the Multi Action provided by the SD app</li>
<li>External Modules Action => Added support for About Time</li>
<li>Token Action => Stats: Added 'Ability Scores', 'Ability Score Modifiers', 'Ability Score Saves' (dnd5e only) and 'Proficiency Bonus'</li>
<li>Token Action => Stats: Added 'HP (box)' option that displays a box with color that changes depending on the HP</li>
<li>Move Action: You can now choose what token should be moved, similar to the Token Action</li>
</ul>
Fixes:
<ul>
<li>Playlist Action => Relative Offset: Fixed issue with displaying the target playlist name</li>
<li>Macro Action: Fixed Hotbar Uses for Shadow of the Demonlord</li>
</ul>
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>
</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.3.2 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.3.1 - 27-02-2021
Additions:
<ul>
<li>Token Action: You can now choose what token should be targeted with the action using: 'Selected Token', 'Token Name', 'Actor Name', 'Token Id' or 'Actor Id'. Added relevant user permissions to the permission configuration</li>
<li>Token Action => On Click: Added options 'Select Token' and 'Center on Token and Select Token'</li>
<li>Playlist Action: Added relative offset mode, with the option to display the offset target name for playlists</li>
<li>Playlist Action => Stop All: Added option to display the name of the playlist at the current offset</li>
</ul>
Fixes:
<ul>
<li>Default user permissions would not be loaded if no previously saved permissions were present, resulting in MD assuming nobody has any permissions</li>
<li>Other Actions => Control Buttons => Lighting Controls: Would create a button for ambient sound instead of lighting</li>
<li>Token Action => Display Token Icon: It used to show the icon, even if unchecked, if no stat with default icon was selected</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.3.1 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.3.0 - 25-02-2021
Additions:
<ul>
<li>Material Deck can now be used by players. A 'User Permission Configuration' screen has been added to the module settings where the GM can deside what Material Deck functions are available to users</li>
<li>Macro Action: Added support for Illandril's Hotbar Uses (only requires the module to be installed, does not have to be active)</li>
<li>Token Action => OnClick: Added support for CUB conditions</li>
<li>External Modules => Added support for the 'Trigger Happy' module</li>
<li>External Modules => Added support for the 'MookAI' module</li>
<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>
Fixes:
<ul>
<li>Token Action => OnClick: Fixed conditions for pf1e and dnd3.5e</li>
</ul>
Other Changes:
<ul>
<li>Token and Combat Tracker Actions now autodetect the game system</li>
<li>Game-system related settings in the SD app unified and improved</li>
<li>Image Cache setting is no longer considered experimental</li>
</ul>
<b>Note 1: </b>Because the module can now be used by players, some settings have been moved from 'world' settings to 'client' settings. This means that previous settings have been deleted, and they have to be set up again in the module settings.<br>
<b>Note 2: </b>You can give users access to the playlists, macro board and soundboard. Currently, everyone has to share the same configuration, so be careful with giving players permission to configure one of them.<br>
<b>Note 3: </b>Because of the new game system autodetection, some settings for non dnd5e systems might be deleted. You'll have to reconfigure them.<br>
<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.3.0 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.2.3 - 03-02-2021
Fixes:
<ul>
<li>Fixed some issues for the Shadow of the Demon Lord system</li>
</ul>
Other Changes:
<ul>
<li>Improved performance of the 'Playlist Configuration', 'Macro Configuration' and 'Soundboard Configuration' screens</li>
<li>Minor code clean-up</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.2.2 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.2.2 - 02-02-2021
Additions:
<ul>
<li>Added a help button in the module configuration</li>
<li>Token Action: Added support for easy token wildcard image changes</li>
<li>Token Action: Added a comprehensive custom onClick function that can modify token and actor data, with support for basic mathematical expressions</li>
</ul>
Other Changes:
<ul>
<li>Improved GM screen compatibility</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.2.2: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.2.1 - 07-01-2021
<b>Note:</b> Due to a change in how scene control is handled (moved from 'Other Controls' to its own 'Scene Action'), any actions related to scenes no longer work. You will have to set them up again using the new Scene Action.<br>
<br>
Additions:
<ul>
<li>EXPERIMENTAL: Added an image buffer to prevent resending of images that have already been sent, giving a slight performance boost. Buffer size can be set in the module settings</li>
<li>Token Action => Display Stats: Added option to select a data path for an attribute</li>
<li>External Modules => GM Screen: Open and close the GM screen. Link to module: https://foundryvtt.com/packages/gm-screen/</li>
<li>Other Actions => Roll dice: Roll dice in foundry and select between public roll, private roll, or displaying result on the SD</li>
<li>Scene Action: Added way to create scene selection screen similar to soundboard/macro board. New functions to do this: 'Scene Directory' and 'Scene Offset'</li>
<li>Scene Action: Added 'Active Scene' function</li>
<li>Move Action => Selected Token: Added rotate to and rotate by functions</li>
<li>Token Action => On Click: Added 'Set Vision' option to set the token's vision and light emission</li>
<li>Other Actions => Send Chat Message: Send a message to the Foundry chat</li>
</ul>
Other Changes:
<ul>
<li>Plugin: Scene Action created that replaces Other Actions => Scene Selection</li>
<li>Plugin: Scene Action: Changed 'Any Scene' to 'Scene by Name'</li>
<li>Plugin: Actions are now ordered alphabetically</li>
<li>Plugin: Replaced color strings with color pickers</li>
<li>Various minor bug fixes</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.2.1: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.2.0 - 28-12-2020
Fixes
<ul>
@@ -156,4 +457,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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -1,2 +1,3 @@
center.png: made by me
center.png: made by me.
rotatecw.png & rotateccw.png Edited from https://fontawesome.com/icons/sync-alt?style=solid.
All other images taken from freepngimg.com, iverted color and rotated. Source: https://freepngimg.com/png/24691-right-arrow-hd

BIN
img/move/rotateccw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
img/move/rotatecw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,7 @@
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

BIN
img/token/abilities/cha.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
img/token/abilities/dex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/token/abilities/int.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/token/abilities/str.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/token/abilities/wis.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/token/hp_empty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,19 @@
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
dec.png: https://game-icons.net/1x1/delapouite/convince.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
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
nat.png: https://game-icons.net/1x1/delapouite/forest.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
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

BIN
img/token/skills/acr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
img/token/skills/ani.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/token/skills/arc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/token/skills/ath.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/token/skills/dec.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/token/skills/his.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
img/token/skills/ins.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
img/token/skills/inv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/token/skills/itm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/token/skills/med.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
img/token/skills/nat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
img/token/skills/per.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
img/token/skills/prc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
img/token/skills/prf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/token/skills/rel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/token/skills/slt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/token/skills/ste.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/token/skills/sur.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
img/token/temp_hp_empty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -2,18 +2,24 @@
"MaterialDeck.Notifications.Disconnected": "Disconnected from Material Server, attempting to reconnect",
"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 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.Sett.PlaylistConfig": "Playlist Configuration",
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
"MaterialDeck.Sett.ServerAddr": "Material Server Address",
"MaterialDeck.Sett.ServerAddrHint": "Fill in the IP address and port of the Material Server. Must follow the format [ip_address]:[port], for example: 'localhost:3001' or '192.168.1.1:4000'.",
"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.PL.Unrestricted": "Unrestricted",
"MaterialDeck.PL.OneTrackPlaylist": "One track per playlist",
@@ -30,6 +36,8 @@
"MaterialDeck.Background": "Background",
"MaterialDeck.Macro": "Macro",
"MaterialDeck.Sound": "Sound",
"MaterialDeck.Sounds": "Sounds",
"MaterialDeck.Of": "of",
"MaterialDeck.Icon": "Icon",
"MaterialDeck.Once": "Once",
"MaterialDeck.Repeat": "Repeat",
@@ -41,8 +49,161 @@
"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.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.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.",
"MaterialDeck.Perm.ENABLE.label": "Enable Module",
"MaterialDeck.Perm.ENABLE.ENABLE.label": "Enable",
"MaterialDeck.Perm.ENABLE.ENABLE.hint": "Allow users to use Material Deck",
"MaterialDeck.Perm.COMBAT.label": "Combat Tracker",
"MaterialDeck.Perm.COMBAT.END_TURN.label": "End Turn",
"MaterialDeck.Perm.COMBAT.END_TURN.hint": "Allow users to end their turn",
"MaterialDeck.Perm.COMBAT.TURN_DISPLAY.label": "Turn Display",
"MaterialDeck.Perm.COMBAT.TURN_DISPLAY.hint": "Allow users to display the turn display",
"MaterialDeck.Perm.COMBAT.OTHER_FUNCTIONS.label": "Other Functions",
"MaterialDeck.Perm.COMBAT.OTHER_FUNCTIONS.hint": "Allow users to use other functions in the 'Function Mode', such as starting/stopping combat, increasing/decreasing the turn, etc",
"MaterialDeck.Perm.COMBAT.DISPLAY_COMBATANTS.label": "Display Combatants",
"MaterialDeck.Perm.COMBAT.DISPLAY_COMBATANTS.hint": "Allow users to display the combatants",
"MaterialDeck.Perm.COMBAT.DISPLAY_NON_OWNED_STATS.label": "Display Non-Owned and Non-Observer Stats",
"MaterialDeck.Perm.COMBAT.DISPLAY_NON_OWNED_STATS.hint": "Allow users to display stats for tokens they do not own or have observer permission for",
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_HP.label": "Display Limited HP",
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_HP.hint": "Allow users to display the HP of tokens they have Limited permission for",
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_HP.label": "Display Observer HP",
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_HP.hint": "Allow users to display the HP of tokens they have Observer permission for",
"MaterialDeck.Perm.COMBAT.DISPLAY_ALL_NAMES.label": "Display All Names",
"MaterialDeck.Perm.COMBAT.DISPLAY_ALL_NAMES.hint": "Allow users to display the name of all tokens",
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_NAME.label": "Display Limited Name",
"MaterialDeck.Perm.COMBAT.DISPLAY_LIMITED_NAME.hint": "Allow users to display the name of tokens they have Limited permission for",
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_NAME.label": "Display Observer Name",
"MaterialDeck.Perm.COMBAT.DISPLAY_OBSERVER_NAME.hint": "Allow users to display the name of tokens they have Observer permission for",
"MaterialDeck.Perm.EXTERNAL.label": "External Modules",
"MaterialDeck.Perm.EXTERNAL.FXMASTER.label": "Fx Master",
"MaterialDeck.Perm.EXTERNAL.FXMASTER.hint": "Allow users to control the Fx Master module",
"MaterialDeck.Perm.EXTERNAL.GM_SCREEN.label": "GM Screen",
"MaterialDeck.Perm.EXTERNAL.GM_SCREEN.hint": "Allow users to display a GM screen using the GM Screen module",
"MaterialDeck.Perm.MACRO.label": "Macros",
"MaterialDeck.Perm.MACRO.HOTBAR.label": "Hotbar Macros",
"MaterialDeck.Perm.MACRO.HOTBAR.hint": "Allow users to use hotbar macros",
"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 macroboard",
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.label": "Configure the Macro Board",
"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",
"MaterialDeck.Perm.OTHER.PAUSE.hint": "Allow users to pause or resume the game",
"MaterialDeck.Perm.OTHER.CONTROL.label": "Control Buttons",
"MaterialDeck.Perm.OTHER.CONTROL.hint": "Allow users to control the control buttons",
"MaterialDeck.Perm.OTHER.DARKNESS.label": "Scene Darkness",
"MaterialDeck.Perm.OTHER.DARKNESS.hint": "Allow users to set the scene darkness",
"MaterialDeck.Perm.OTHER.DICE.label": "Dice Rolling",
"MaterialDeck.Perm.OTHER.DICE.hint": "Allow users to roll dice",
"MaterialDeck.Perm.OTHER.TABLES_ALL.label": "Roll Tables (all)",
"MaterialDeck.Perm.OTHER.TABLES_ALL.hint": "Allow users to view and roll from all roll tables",
"MaterialDeck.Perm.OTHER.TABLES.label": "Roll Tables (observer/owner)",
"MaterialDeck.Perm.OTHER.TABLES.hint": "Allow users to view and roll from roll tables that they have observer or owner permission for",
"MaterialDeck.Perm.OTHER.SIDEBAR.label": "Sidebar",
"MaterialDeck.Perm.OTHER.SIDEBAR.hint": "Allow users to control the sidebar",
"MaterialDeck.Perm.OTHER.COMPENDIUM_ALL.label": "Compendium Packs (all)",
"MaterialDeck.Perm.OTHER.COMPENDIUM_ALL.hint": "Allow users to open all compendium packs",
"MaterialDeck.Perm.OTHER.COMPENDIUM.label": "Compendium Packs (observer/owner)",
"MaterialDeck.Perm.OTHER.COMPENDIUM.hint": "Allow users to open compendium packs that they have observer or owner permission for",
"MaterialDeck.Perm.OTHER.JOURNAL_ALL.label": "Journals (all)",
"MaterialDeck.Perm.OTHER.JOURNAL_ALL.hint": "Allow users to open all journals",
"MaterialDeck.Perm.OTHER.JOURNAL.label": "Journals (observer/owner)",
"MaterialDeck.Perm.OTHER.JOURNAL.hint": "Allow users to open journals they have observer or owner permission for",
"MaterialDeck.Perm.OTHER.CHAT.label": "Chat Messages",
"MaterialDeck.Perm.OTHER.CHAT.hint": "Allow users to send chat messages",
"MaterialDeck.Perm.PLAYLIST.label": "Playlists",
"MaterialDeck.Perm.PLAYLIST.PLAY.label": "Control",
"MaterialDeck.Perm.PLAYLIST.PLAY.hint": "Allow users to play and pause playlists and tracks",
"MaterialDeck.Perm.PLAYLIST.CONFIGURE.label": "Configure",
"MaterialDeck.Perm.PLAYLIST.CONFIGURE.hint": "Allow users to configure the playlists",
"MaterialDeck.Perm.SCENE.label": "Scenes",
"MaterialDeck.Perm.SCENE.VISIBLE.label": "Visible Scenes",
"MaterialDeck.Perm.SCENE.VISIBLE.hint": "Allow users to view and control the visible scenes",
"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.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",
"MaterialDeck.Perm.SOUNDBOARD.label": "Soundboard",
"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. 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",
"MaterialDeck.Perm.TOKEN.STATS.hint": "Allow the user to display the stats of the controlled token",
"MaterialDeck.Perm.TOKEN.VISIBILITY.label": "Toggle Visibility",
"MaterialDeck.Perm.TOKEN.VISIBILITY.hint": "Allow the user to toggle the visibility of the controlled token",
"MaterialDeck.Perm.TOKEN.COMBAT.label": "Toggle Combat State",
"MaterialDeck.Perm.TOKEN.COMBAT.hint": "Allow the user to toggle the combat state of the controlled token",
"MaterialDeck.Perm.TOKEN.VISION.label": "Set Vision",
"MaterialDeck.Perm.TOKEN.VISION.hint": "Allow the user to set the vision of the controlled token",
"MaterialDeck.Perm.TOKEN.WILDCARD.label": "Wildcard Images",
"MaterialDeck.Perm.TOKEN.WILDCARD.hint": "Allow the user to set the controlled token's image using the wildcard image functionality",
"MaterialDeck.Perm.TOKEN.CONDITIONS.label": "Set Conditions",
"MaterialDeck.Perm.TOKEN.CONDITIONS.hint": "Allow the users to set conditions for the controlled token",
"MaterialDeck.Perm.TOKEN.CUSTOM.label": "Custom On-Click",
"MaterialDeck.Perm.TOKEN.CUSTOM.hint": "Allow the users to set custom on-click functions",
"MaterialDeck.Perm.TOKEN.NON_OWNED.label": "Non-Owned and Non-Observer Tokens",
"MaterialDeck.Perm.TOKEN.NON_OWNED.hint": "Allow users access to tokens with non-owned or limited permission",
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "Observer",
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "Allow users access to tokens with observer permission",
"MaterialDeck.AboutTime.First": "st",
"MaterialDeck.AboutTime.Second": "nd",
"MaterialDeck.AboutTime.Third": "rd",
"MaterialDeck.AboutTime.Fourth": "th",
"MaterialDeck.AboutTime.Of": "of",
"MaterialDeck.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
View 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に接続できない場合に表示される接続警告回数を設定します。に設定すると、無制限となります。",
"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": "",
"MaterialDeck.AboutTime.Second": "",
"MaterialDeck.AboutTime.Third": "",
"MaterialDeck.AboutTime.Fourth": "",
"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": "更新"
}

View File

@@ -1,23 +1,48 @@
{
"name": "MaterialDeck",
"title": "Material Deck",
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
"version": "1.2.0",
"author": "CDeenen",
"esmodules": [
"./MaterialDeck.js"
],
"socket": true,
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.9",
"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.5",
"author": "CDeenen",
"authors": {
"name": "CDeenen",
"email": "cdeenen@outlook.com",
"discord": "Cris#6864",
"patreon": "MaterialFoundry",
"reddit": "CDeenen123"
},
"flags": {
"minimumSDversion": "1.4.4",
"minimumMSversion": "1.0.2"
},
"minimumSDversion": "1.4.4",
"minimumMSversion": "1.0.2",
"esmodules": [
"./MaterialDeck.js"
],
"socket": true,
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.8.8",
"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"
}

View File

@@ -1,5 +1,6 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck, tokenControl} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
export class CombatTracker{
constructor(){
@@ -9,62 +10,83 @@ export class CombatTracker{
async updateAll(){
if (this.active == false) return;
for (let i=0; i<32; i++){
let 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;
let ctFunction = settings.combatTrackerFunction;
if (ctFunction == undefined) ctFunction = 'startStop';
let combat = game.combat;
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
const mode = settings.combatTrackerMode ? settings.combatTrackerMode : 'combatants';
const combat = game.combat;
let src = "modules/MaterialDeck/img/black.png";
let txt = "";
let background = "#000000";
let mode = settings.combatTrackerMode;
if (mode == undefined) mode = 'combatants';
settings.combat = true;
settings.icon = settings.displayIcon ? 'tokenIcon' : 'none';
if (mode == 'combatants'){
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
streamDeck.noPermission(context,device,device,false,"combat tracker");
return;
}
if (combat != null && combat != undefined && combat.turns.length != 0){
let initiativeOrder = combat.turns;
const initiativeOrder = combat.turns;
let nr = settings.combatantNr - 1;
if (nr == undefined || nr < 1) nr = 0;
let combatantState = 1;
if (nr == combat.turn) combatantState = 2;
let combatant = initiativeOrder[nr]
const combatantState = (nr == combat.turn) ? 2 : 1;
const combatant = initiativeOrder[nr]
if (combatant != undefined){
let tokenId = combatant.tokenId;
tokenControl.pushData(tokenId,settings,context,combatantState,'#cccc00');
const tokenId = compatibleCore("0.8.1") ? combatant.data.tokenId : combatant.tokenId;
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00');
return;
}
else {
streamDeck.setIcon(context,src,background);
streamDeck.setIcon(context,device,src,{background:background});
streamDeck.setTitle(txt,context);
}
}
else {
streamDeck.setIcon(context,src,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,device,device);
return;
}
if (combat != null && combat != undefined && combat.started){
let tokenId = combat.combatant.tokenId;
tokenControl.pushData(tokenId,settings,context);
const tokenId = compatibleCore("0.8.1") ? combat.combatant.data.tokenId : combat.combatant.tokenId;
tokenControl.pushData(tokenId,settings,context,device);
}
else {
streamDeck.setIcon(context,src,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,device);
return;
}
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
streamDeck.noPermission(context,device);
return;
}
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && MODULE.getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
streamDeck.noPermission(context,device);
return;
}
if (ctFunction == 'startStop') {
if (combat == null || combat == undefined || combat.combatants.length == 0) {
src = "modules/MaterialDeck/img/combattracker/startcombat.png";
@@ -81,6 +103,9 @@ export class CombatTracker{
}
}
}
else if (ctFunction == 'endTurn') {
src = "modules/MaterialDeck/img/combattracker/nextturn.png";
}
else if (ctFunction == 'nextTurn') {
src = "modules/MaterialDeck/img/combattracker/nextturn.png";
}
@@ -102,71 +127,80 @@ 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);
streamDeck.setIcon(context,device,src,{background:background});
streamDeck.setTitle(txt,context);
}
}
keyPress(settings,context){
let mode = settings.combatTrackerMode;
if (mode == undefined) mode = 'combatants';
if (mode == 'function'){
let combat = game.combat;
if (combat == null || combat == undefined) return;
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'){
if (combat == null || combat == undefined) return;
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
if (ctFunction == 'turnDisplay' && MODULE.getPermission('COMBAT','TURN_DISPLAY') == false) {
streamDeck.noPermission(context,device);
return;
}
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
streamDeck.noPermission(context,device);
return;
}
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && MODULE.getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
streamDeck.noPermission(context,device);
return;
}
let ctFunction = settings.combatTrackerFunction;
if (ctFunction == undefined) ctFunction = 'startStop';
if (ctFunction == 'startStop'){
let src;
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);
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();
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 {
let onClick = settings.onClick;
if (onClick == undefined) onClick = 'doNothing';
const onClick = settings.onClick ? settings.onClick : 'doNothing';
let tokenId;
let combat = game.combat;
if (mode == 'combatants') {
if (combat != null && combat != undefined && combat.turns.length != 0){
let initiativeOrder = combat.turns;
const initiativeOrder = combat.turns;
let nr = settings.combatantNr - 1;
if (nr == undefined || nr < 1) nr = 0;
let combatantState = 1;
if (nr == combat.turn) combatantState = 2;
let combatant = initiativeOrder[nr]
const combatant = initiativeOrder[nr]
if (combatant == undefined) return;
tokenId = combatant.tokenId;
tokenId = compatibleCore("0.8.1") ? combatant.data.tokenId : combatant.tokenId;
}
}
else if (mode == 'currentCombatant')
if (combat != null && combat != undefined && combat.started)
tokenId = combat.combatant.tokenId;
tokenId = compatibleCore("0.8.1") ? combat.combatant.data.tokenId : combat.combatant.tokenId;
let token
if (canvas.tokens.children[0] != undefined) token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
let token = (canvas.tokens.children[0] != undefined) ? canvas.tokens.children[0].children.find(p => p.id == tokenId) : undefined;
if (token == undefined) return;
if (onClick == 'doNothing') //Do nothing
return;
@@ -178,7 +212,7 @@ export class CombatTracker{
canvas.animatePan(location);
}
else if (onClick == 'centerSelect'){ //center on token and select
let location = token.getCenter(token.x,token.y);
const location = token.getCenter(token.x,token.y);
canvas.animatePan(location);
token.control();
}

View File

@@ -1,43 +1,102 @@
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(){
async updateAll(data={}){
if (data.gmScreen != undefined){
this.gmScreenOpen = data.gmScreen.isOpen;
}
if (this.active == false) return;
for (let i=0; i<32; i++){
let data = streamDeck.buttonContext[i];
if (data == undefined || data.action != 'external') continue;
await this.update(data.settings,data.context);
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;
let module = settings.module;
if (module == undefined) module = 'fxmaster';
const module = settings.module ? settings.module : 'fxmaster';
if (module == 'fxmaster') this.updateFxMaster(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);
}
keyPress(settings,context){
keyPress(settings,context,device){
if (this.active == false) return;
let module = settings.module;
if (module == undefined) module = 'fxmaster';
const module = settings.module ? settings.module : 'fxmaster';
if (module == 'fxmaster') { //scene
this.keyPressFxMaster(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);
}
getModuleEnable(moduleId){
const module = game.modules.get(moduleId);
if (module == undefined || module.active == false) return false;
return true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//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;
@@ -105,8 +164,8 @@ export class ExternalModules{
name = game.i18n.localize("MaterialDeck.FxMaster.Clear");
}
if (displayIcon) streamDeck.setIcon(context,icon,background,ring,ringColor);
else streamDeck.setIcon(context, "", background,ring,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);
}
@@ -120,7 +179,8 @@ export class ExternalModules{
} : 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;
@@ -231,4 +291,771 @@ export class ExternalModules{
}
return undefined;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//GM Screen
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateGMScreen(settings,context,device){
if (this.getModuleEnable("gm-screen") == false) return;
if (game.user.isGM == false) return;
const background = settings.gmScreenBackground ? settings.gmScreenBackground : '#000000';
let ring = 1;
const ringColor = '#00FF00'
let src = '';
let txt = '';
if (this.gmScreenOpen) ring = 2;
if (settings.displayGmScreenIcon) src = "fas fa-book-reader";
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,device){
if (this.getModuleEnable("gm-screen") == false) return;
if (game.user.isGM == false) return;
window['gm-screen'].toggleGmScreenVisibility();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Trigger Happy
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateTriggerHappy(settings,context,device) {
if (this.getModuleEnable("trigger-happy") == false) return;
if (game.user.isGM == false) return;
const displayName = settings.displayTriggerHappyName ? settings.displayTriggerHappyName : false;
const displayIcon = settings.displayTriggerHappyIcon ? settings.displayTriggerHappyIcon : false;
const background = "#340057";
const ringColor = game.settings.get("trigger-happy", "enableTriggers") ? "#A600FF" : "#340057";
let txt = '';
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-grin-squint-tears",{background:background,ring:2,ringColor:ringColor});
else streamDeck.setIcon(context,device,'',{background:'#000000'});
if (displayName) txt = 'Trigger Happy';
streamDeck.setTitle(txt,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';
let val = game.settings.get("trigger-happy", "enableTriggers");
if (mode == 'toggle') val = !val;
else if (mode == 'enable') val = true;
else if (mode == 'disable') val = false;
game.settings.set("trigger-happy", "enableTriggers", val);
const control = ui.controls.controls.find(c => c.name == 'token');
if (control == undefined) return;
let tool = control.tools.find(t => t.name == 'triggers');
if (tool == undefined) return;
tool.active = val;
ui.controls.render();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Shared Vision
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateSharedVision(settings,context,device) {
if (this.getModuleEnable("SharedVision") == false) return;
if (game.user.isGM == false) return;
const displayName = settings.sharedVisionName ? settings.sharedVisionName : false;
const displayIcon = settings.sharedVisionIcon ? settings.sharedVisionIcon : false;
const background = "#340057";
const ringColor = game.settings.get("SharedVision", "enable") ? "#A600FF" : "#340057";
let txt = '';
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-eye",{background:background,ring:2,ringColor:ringColor});
else streamDeck.setIcon(context,device,'',{background:'#000000'});
if (displayName) txt = 'Shared Vision';
streamDeck.setTitle(txt,context);
}
keyPressSharedVision(settings,context,device) {
if (this.getModuleEnable("SharedVision") == false) return;
if (game.user.isGM == false) return;
const mode = settings.sharedVisionMode ? settings.sharedVisionMode : 'toggle';
if (mode == 'toggle') Hooks.call("setShareVision",{enable:'toggle'});
else if (mode == 'enable') Hooks.call("setShareVision",{enable:true});
else if (mode == 'disable') Hooks.call("setShareVision",{enable:false});
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Mook AI
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateMookAI(settings,context,device) {
if (this.getModuleEnable("mookAI") == false) return;
if (game.user.isGM == false) return;
const displayName = settings.mookName ? settings.mookName : false;
const displayIcon = settings.mookIcon ? settings.mookIcon : false;
const background = "#000000";
let txt = '';
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-brain",{background:'#000000'});
else streamDeck.setIcon(context,device,'',{background:'#000000'});
if (displayName) txt = 'Mook AI';
streamDeck.setTitle(txt,context);
}
async keyPressMookAI(settings,context,device) {
if (this.getModuleEnable("mookAI") == false) return;
if (game.user.isGM == false) return;
let mook = await import('../../mookAI/scripts/mookAI.js');
let mookAI = new mook.MookAI ();
mookAI.takeNextTurn();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Not Your Turn!
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateNotYourTurn(settings,context,device) {
if (this.getModuleEnable("NotYourTurn") == false) return;
if (game.user.isGM == false) return;
const mode = settings.notYourTurnMode ? settings.notYourTurnMode : 'toggle';
const displayName = settings.notYourTurnName ? settings.notYourTurnName : false;
const displayIcon = settings.notYourTurnIcon ? settings.notYourTurnIcon : false;
const background = "#340057";
let ringColor = "#340057" ;
let txt = '';
let icon = '';
if (mode == 'toggle' || mode == 'enable' || mode == 'disable') {
icon = "fas fa-fist-raised";
txt = "Block Combat Movement";
ringColor = game.settings.get('NotYourTurn','enable') ? "#A600FF": "#340057" ;
}
else {
icon = "fas fa-lock";
txt = "Block Non-Combat Movement";
ringColor = game.settings.get('NotYourTurn','nonCombat') ? "#A600FF": "#340057" ;
}
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,device) {
if (this.getModuleEnable("NotYourTurn") == false) return;
if (game.user.isGM == false) return;
const mode = settings.notYourTurnMode ? settings.notYourTurnMode : 'toggle';
if (mode == 'toggle') Hooks.call("setNotYourTurn",{combat:'toggle'});
else if (mode == 'enable') Hooks.call("setNotYourTurn",{combat:true});
else if (mode == 'disable') Hooks.call("setNotYourTurn",{combat:false});
else if (mode == 'toggleNonCombat') Hooks.call("setNotYourTurn",{nonCombat:'toggle'});
else if (mode == 'enableNonCombat') Hooks.call("setNotYourTurn",{nonCombat:true});
else if (mode == 'disableNonCombat') Hooks.call("setNotYourTurn",{nonCombat:false});
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Lock View
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateLockView(settings,context,device) {
if (this.getModuleEnable("LockView") == false) return;
if (game.user.isGM == false) return;
const mode = settings.lockViewMode ? settings.lockViewMode : 'panLock';
const displayName = settings.lockViewName ? settings.lockViewName : false;
const displayIcon = settings.lockViewIcon ? settings.lockViewIcon : false;
const background = "#340057";
let ringColor = "#340057" ;
let txt = '';
let icon = '';
if (mode == 'panLock') {
icon = "fas fa-arrows-alt";
txt = "Pan Lock";
ringColor = canvas.scene.getFlag('LockView', 'lockPan') ? "#A600FF": "#340057" ;
}
else if (mode == 'zoomLock') {
icon = "fas fa-search-plus";
txt = "Zoom Lock";
ringColor = canvas.scene.getFlag('LockView', 'lockZoom') ? "#A600FF": "#340057" ;
}
else if (mode == 'boundingBox') {
icon = "fas fa-box";
txt = "Bounding Box";
ringColor = canvas.scene.getFlag('LockView', 'boundingBox') ? "#A600FF": "#340057" ;
}
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,device) {
if (this.getModuleEnable("LockView") == false) return;
if (game.user.isGM == false) return;
const mode = settings.lockViewMode ? settings.lockViewMode : 'panLock';
let toggle = settings.lockViewToggle ? settings.lockViewToggle : 'toggle';
if (toggle == 'enable') toggle = true;
else if (toggle == 'disable') toggle = false;
let msg = {};
if (mode == 'panLock') msg = {panLock:toggle};
else if (mode == 'zoomLock') msg = {zoomLock:toggle};
else if (mode == 'boundingBox') msg = {boundingBox:toggle};
Hooks.call("setLockView",msg);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//About Time
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateAboutTime(settings,context,device) {
if (this.getModuleEnable("about-time") == false) return;
if (game.user.isGM == false) return;
const displayTime = settings.aboutTimeDisplayTime ? settings.aboutTimeDisplayTime : 'none';
const displayDate = settings.aboutTimeDisplayDate ? settings.aboutTimeDisplayDate : 'none';
const background = settings.aboutTimeBackground ? settings.aboutTimeBackground : '#000000';
const ringOffColor = settings.aboutTimeOffRing ? settings.aboutTimeOffRing : '#000000';
const ringOnColor = settings.aboutTimeOnRing ? settings.aboutTimeOnRing : '#00FF00';
let ring = 0;
let ringColor = '#000000';
let txt = '';
let currentTime = game.Gametime.DTNow().longDateExtended();
let clock = 'none';
if (displayTime == 'clock') {
const hours = currentTime.hour > 12 ? currentTime.hour-12 : currentTime.hour;
clock = {
hours: hours,
minutes: currentTime.minute
}
}
else if (displayTime != 'none') {
let hours;
let AMPM = "";
if ((displayTime == 'compact12h' || displayTime == 'full12h' || displayTime == 'hours12h') && currentTime.hour > 12) {
hours = currentTime.hour - 12;
AMPM = " PM";
}
else if ((displayTime == 'compact12h' || displayTime == 'full12h' || displayTime == 'hours12h') && currentTime.hour <= 12) {
hours = currentTime.hour;
AMPM = " AM";
}
else {
hours = currentTime.hour;
}
if (displayTime == 'hours24h' || displayTime == 'hours12h') txt = hours;
else if (displayTime == 'minutes') txt = currentTime.minute;
else if (displayTime == 'seconds') txt = currentTime.second;
else {
if (currentTime.minute < 10) currentTime.minute = '0' + currentTime.minute;
if (currentTime.second < 10) currentTime.second = '0' + currentTime.second;
txt += hours + ':' + currentTime.minute;
if (displayTime == 'full24h' || displayTime == 'full12h') txt += ':' + currentTime.second;
}
if (displayTime == 'compact12h' || displayTime == 'full12h' || displayTime == 'hours12h') txt += AMPM;
}
if (displayTime != 'none' && displayTime != 'clock' && displayDate != 'none') txt += '\n';
if (displayDate == 'day') txt += currentTime.day;
else if (displayDate == 'dayName') txt += currentTime.dowString;
else if (displayDate == 'month') txt += currentTime.month;
else if (displayDate == 'monthName') txt += currentTime.monthString;
else if (displayDate == 'year') txt += currentTime.year;
else if (displayDate == 'small') txt += currentTime.day + '-' + currentTime.month;
else if (displayDate == 'smallInv') txt += currentTime.month + '-' + currentTime.day;
else if (displayDate == 'full') txt += currentTime.day + '-' + currentTime.month + '-' + currentTime.year;
else if (displayDate == 'fullInv') txt += currentTime.month + '-' + currentTime.day + '-' + currentTime.year;
else if (displayDate == 'text' || displayDate == 'textDay') {
if (displayDate == 'textDay') txt += currentTime.dowString + ' ';
txt += currentTime.day;
if (currentTime.day % 10 == 1 && currentTime != 11) txt += game.i18n.localize("MaterialDeck.AboutTime.First");
else if (currentTime.day % 10 == 2 && currentTime != 12) txt += game.i18n.localize("MaterialDeck.AboutTime.Second");
else if (currentTime.day % 10 == 3 && currentTime != 13) txt += game.i18n.localize("MaterialDeck.AboutTime.Third");
else txt += game.i18n.localize("MaterialDeck.AboutTime.Fourth");
txt += ' ' + game.i18n.localize("MaterialDeck.AboutTime.Of") + ' ' + currentTime.monthString + ', ' + currentTime.year;
}
if (settings.aboutTimeActive) {
const clockRunning = game.Gametime.isRunning();
ringColor = clockRunning ? ringOnColor : ringOffColor;
ring = 2;
}
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,device,'',{background:background,ring:ring,ringColor:ringColor, clock:clock});
}
keyPressAboutTime(settings,context,device) {
if (this.getModuleEnable("about-time") == false) return;
if (game.user.isGM == false) return;
const onClick = settings.aboutTimeOnClick ? settings.aboutTimeOnClick : 'none';
if (onClick == 'none') return;
else if (onClick == 'startStop') {
const clockRunning = game.Gametime.isRunning();
const startMode = settings.aboutTimeStartStopMode ? settings.aboutTimeStartStopMode : 'toggle';
if ((startMode == 'toggle' && clockRunning) || startMode == 'stop') game.Gametime.stopRunning();
else if ((startMode == 'toggle' && !clockRunning) || startMode == 'start') game.Gametime.startRunning();
}
else if (onClick == 'advance') {
const advanceMode = settings.aboutTimeAdvanceMode ? settings.aboutTimeAdvanceMode : 'dawn';
let now = Gametime.DTNow();
if (advanceMode == 'dawn') {
let newDT = now.add({
days: now.hours < 7 ? 0 : 1
}).setAbsolute({
hours: 7,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == 'noon') {
let newDT = now.add({
days: now.hours < 12 ? 0 : 1
}).setAbsolute({
hours: 12,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == 'dusk') {
let newDT = now.add({
days: now.hours < 20 ? 0 : 1
}).setAbsolute({
hours: 20,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == 'midnight') {
let newDT = Gametime.DTNow().add({
days: 1
}).setAbsolute({
hours: 0,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == '1s')
game.Gametime.advanceClock(1);
else if (advanceMode == '30s')
game.Gametime.advanceClock(30);
else if (advanceMode == '1m')
game.Gametime.advanceTime({ minutes: 1 });
else if (advanceMode == '5m')
game.Gametime.advanceTime({ minutes: 5 });
else if (advanceMode == '15m')
game.Gametime.advanceTime({ minutes: 15 });
else if (advanceMode == '1h')
game.Gametime.advanceTime({ hours: 1 });
}
else if (onClick == 'recede') {
const advanceMode = settings.aboutTimeAdvanceMode ? settings.aboutTimeAdvanceMode : 'dawn';
let now = Gametime.DTNow();
if (advanceMode == 'dawn') {
let newDT = now.add({
days: now.hours < 7 ? -1 : 0
}).setAbsolute({
hours: 7,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == 'noon') {
let newDT = now.add({
days: now.hours < 12 ? -1 : 0
}).setAbsolute({
hours: 12,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == 'dusk') {
let newDT = now.add({
days: now.hours < 20 ? -1 : 0
}).setAbsolute({
hours: 20,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == 'midnight') {
let newDT = Gametime.DTNow().add({
days: -1
}).setAbsolute({
hours: 0,
minutes: 0,
seconds: 0
});
Gametime.setAbsolute(newDT);
}
else if (advanceMode == '1s')
game.Gametime.advanceClock(-1);
else if (advanceMode == '30s')
game.Gametime.advanceClock(-30);
else if (advanceMode == '1m')
game.Gametime.advanceTime({ minutes: -1 });
else if (advanceMode == '5m')
game.Gametime.advanceTime({ minutes: -5 });
else if (advanceMode == '15m')
game.Gametime.advanceTime({ minutes: -15 });
else if (advanceMode == '1h')
game.Gametime.advanceTime({ hours: -1 });
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//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();
}
}

View File

@@ -1,5 +1,6 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
export class MacroControl{
constructor(){
@@ -9,163 +10,195 @@ export class MacroControl{
async updateAll(){
if (this.active == false) return;
for (let i=0; i<32; i++){
let 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);
}
}
}
update(settings,context){
async update(settings,context,device){
this.active = true;
let mode = settings.macroMode;
let displayName = settings.displayName;
const mode = settings.macroMode ? settings.macroMode : 'hotbar';
const displayName = settings.displayName ? settings.displayName : false;
const displayIcon = settings.displayIcon ? settings.displayIcon : false;
const displayUses = settings.displayUses ? settings.displayUses : false;
let background = settings.background ? settings.background : '#000000';
let macroNumber = settings.macroNumber;
let background = settings.background;
let icon = false;
if (settings.displayIcon) icon = true;
if (macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 0;
macroNumber = parseInt(macroNumber);
let ringColor = "#000000";
let ring = 0;
if(macroNumber == undefined || isNaN(parseInt(macroNumber))){
macroNumber = 0;
}
if (mode == undefined) mode = 'hotbar';
if (displayName == undefined) displayName = false;
if (background == undefined) background = '#000000';
macroNumber = parseInt(macroNumber);
let name = "";
let src = "";
let macroId = undefined;
let uses = undefined;
if (mode == 'macroBoard') { //Macro board
let name = "";
let src = '';
if ((MODULE.getPermission('MACRO','MACROBOARD') == false )) {
streamDeck.noPermission(context,device);
return;
}
if (settings.macroBoardMode == 'offset') { //Offset
let ringOffColor = settings.offRing;
if (ringOffColor == undefined) ringOffColor = '#000000';
let ringOnColor = settings.onRing;
if (ringOnColor == undefined) ringOnColor = '#00FF00';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
let macroOffset = parseInt(settings.macroOffset);
if (macroOffset == undefined || isNaN(macroOffset)) macroOffset = 0;
if (macroOffset == parseInt(this.offset)) ringColor = ringOnColor;
else ringColor = ringOffColor;
ringColor = (macroOffset == parseInt(this.offset)) ? ringOnColor : ringOffColor;
ring = 2;
src = "modules/MaterialDeck/img/transparant.png";
}
else { //Execute macro
macroNumber += this.offset - 1;
if (macroNumber < 0) macroNumber = 0;
var macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
background = game.settings.get(MODULE.moduleName,'macroSettings').color[macroNumber];
if (background == undefined) background = '#000000';
src = "";
if (macroId != undefined){
let macro = game.macros._source.find(p => p._id == macroId);
if (macro != undefined) {
name += macro.name;
src += macro.img;
}
}
ring = 0;
}
if (icon) streamDeck.setIcon(context,src,background,ring,ringColor);
else streamDeck.setIcon(context, "", background,ring,ringColor);
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
else if (mode == 'name') { //macro by name
const macroName = settings.macroNumber;
const macro = game.macros.getName(macroName);
macroId = macro?.id;
}
else { //Macro Hotbar
let macroId
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
streamDeck.noPermission(context,device);
return;
}
if (mode == 'hotbar') macroId = game.user.data.hotbar[macroNumber];
else {
let macros;
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined)
macros = ui.customHotbar.macros;
}
else macros = game.macros.apps[0].macros;
else
macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
for (let j=0; j<10; j++){
if (macros[j].key == macroNumber){
if (macros[j].macro == null) macroId == undefined;
else macroId = macros[j].macro._id;
}
}
}
let src = "";
let name = "";
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
}
}
if (macroId != undefined){
let macro = game.macros._source.find(p => p._id == macroId);
if (macro != undefined) {
name += macro.name;
src += macro.img;
}
if (macroId != undefined){
let macro = game.macros._source.find(p => p._id == macroId);
if (macro != undefined) {
if (displayName) name = macro.name;
if (displayIcon) src = macro.img;
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
}
if (icon) streamDeck.setIcon(context,src,background);
else streamDeck.setIcon(context, "", background);
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
else {
if (displayName) name = "";
if (displayIcon) src = "modules/MaterialDeck/img/black.png";
}
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,uses:uses});
streamDeck.setTitle(name,context);
}
hotbar(macros){
for (let i=0; i<32; i++){
let data = streamDeck.buttonContext[i];
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
let context = data.context;
let mode = data.settings.macroMode;
let displayName = data.settings.displayName;
let macroNumber = data.settings.macroNumber;
let background = data.settings.background;
let src = "";
let name = "";
if(macroNumber == undefined || isNaN(parseInt(macroNumber))){
macroNumber = 1;
}
if (mode == undefined) mode = 'hotbar';
if (mode == 'Macro Board') continue;
if (displayName == undefined) displayName = false;
if (background == undefined) background = '#000000';
async getUses(macro) {
let hbUses = await import('../../illandril-hotbar-uses/scripts/item-system.js');
const command = macro.command;
const uses = await hbUses.calculateUses(command);
return uses;
}
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;
let macroId;
if (mode == 'hotbar'){
macroId = game.user.data.hotbar[macroNumber];
}
else {
if (macroNumber > 9) macroNumber = 0;
for (let j=0; j<10; j++){
if (macros[j].key == macroNumber){
if (macros[j].macro == null) macroId == undefined;
else macroId = macros[j].macro._id;
}
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,device);
return;
}
let src = "";
let name = "";
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);
}
let macro = undefined;
if (macroId != undefined) macro = game.macros._source.find(p => p._id == macroId);
if (macro != undefined && macro != null) {
name += macro.name;
src += macro.img;
}
streamDeck.setIcon(context,src,background);
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
}
keyPress(settings){
let mode = settings.macroMode;
if (mode == undefined) mode = 'hotbar';
const mode = settings.macroMode ? settings.macroMode : 'hotbar';
let macroNumber = settings.macroNumber;
if(macroNumber == undefined || isNaN(parseInt(macroNumber))){
macroNumber = 0;
}
if (mode == 'hotbar' || mode == 'visibleHotbar' || mode == 'customHotbar')
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 0;
let target = settings.target ? settings.target : undefined;
if (mode == 'hotbar' || mode == 'visibleHotbar' || mode == 'customHotbar'){
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) return;
this.executeHotbar(macroNumber,mode);
}
else if (mode == 'name') {
if ((MODULE.getPermission('MACRO','BY_NAME') == false )) return;
const macroName = settings.macroNumber;
const macro = game.macros.getName(macroName);
if (macro == undefined) return;
const args = settings.macroArgs ? settings.macroArgs : "";
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 = {
user: game.user._id,
speaker: ChatMessage.getSpeaker(),
content: "/'" + macro.name + "' " + args
};
ChatMessage.create(chatData, {});
}
}
else {
if ((MODULE.getPermission('MACRO','MACROBOARD') == false )) return;
if (settings.macroBoardMode == 'offset') {
let macroOffset = settings.macroOffset;
if (macroOffset == undefined) macroOffset = 0;
@@ -187,12 +220,7 @@ export class MacroControl{
}
else macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
for (let j=0; j<10; j++){
if (macros[j].key == macroNumber){
if (macros[j].macro == null) macroId == undefined;
else macroId = macros[j].macro._id;
}
}
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
}
if (macroId == undefined) return;
let macro = game.macros.get(macroId);
@@ -211,8 +239,13 @@ export class MacroControl{
const args = game.settings.get(MODULE.moduleName,'macroSettings').args;
let furnaceEnabled = false;
let furnace = game.modules.get("furnace");
if (furnace != undefined && furnace.active) furnaceEnabled = true;
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 = {
@@ -225,14 +258,4 @@ export class MacroControl{
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,132 +0,0 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
export class Move{
constructor(){
this.active = false;
}
update(settings,context){
let background;
if (settings.background) background = settings.background;
else background = '#000000';
let url = '';
if (settings.dir == 'center') //center
url = "modules/MaterialDeck/img/move/center.png";
else if (settings.dir == 'up') //up
url = "modules/MaterialDeck/img/move/up.png";
else if (settings.dir == 'down') //down
url = "modules/MaterialDeck/img/move/down.png";
else if (settings.dir == 'right') //right
url = "modules/MaterialDeck/img/move/right.png";
else if (settings.dir == 'left') //left
url = "modules/MaterialDeck/img/move/left.png";
else if (settings.dir == 'upRight')
url = "modules/MaterialDeck/img/move/upright.png";
else if (settings.dir == 'upLeft')
url = "modules/MaterialDeck/img/move/upleft.png";
else if (settings.dir == 'downRight')
url = "modules/MaterialDeck/img/move/downright.png";
else if (settings.dir == 'downLeft')
url = "modules/MaterialDeck/img/move/downleft.png";
else if (settings.dir == 'zoomIn')
url = "modules/MaterialDeck/img/move/zoomin.png";
else if (settings.dir == 'zoomOut')
url = "modules/MaterialDeck/img/move/zoomout.png";
streamDeck.setIcon(context,url,background);
}
keyPress(settings){
if (canvas.scene == null) return;
let dir = settings.dir;
let mode = settings.mode;
if (mode == undefined) mode = 'canvas';
if (dir == undefined) 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 {
if (settings.mode == 'selectedToken')
this.moveToken(MODULE.selectedTokenId,dir);
else
this.moveCanvas(dir);
}
}
async moveToken(tokenId,dir){
if (tokenId == undefined) return;
const token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
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;
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);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
export class PlaylistControl{
constructor(){
@@ -10,47 +11,49 @@ export class PlaylistControl{
async updateAll(){
if (this.active == false) return;
for (let i=0; i<32; i++){
let 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){
this.active = true;
if (settings.playlistMode == undefined) settings.playlistMode = 'playlist';
if (settings.playlistMode == 'playlist'){
this.updatePlaylist(settings,context);
update(settings,context,device){
if (MODULE.getPermission('PLAYLIST','PLAY') == false ) {
streamDeck.noPermission(context,device);
return;
}
else if (settings.playlistMode == 'track'){
this.updateTrack(settings,context);
this.active = true;
const mode = settings.playlistMode ? settings.playlistMode : 'playlist';
if (mode == 'playlist'){
this.updatePlaylist(settings,context,device);
}
else if (mode == 'track'){
this.updateTrack(settings,context,device);
}
else {
let src = 'modules/MaterialDeck/img/playlist/stop.png';
if (game.playlists.playing.length > 0)
streamDeck.setIcon(context,src,settings.background,2,'#00FF00',true);
else
streamDeck.setIcon(context,src,settings.background,1,'#000000',true);
const src = 'modules/MaterialDeck/img/playlist/stop.png';
const background = settings.background ? settings.background : '#000000';
const ringColor = (game.playlists.playing.length > 0) ? '#00FF00' : '#000000';
const ring = (game.playlists.playing.length > 0) ? 2 : 1;
const txt = settings.displayPlaylistName ? this.getPlaylist(this.playlistOffset).name : '';
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,overlay:true});
streamDeck.setTitle(txt,context);
}
}
updatePlaylist(settings,context){
updatePlaylist(settings,context,device){
let name = "";
let background = settings.background;
if(background == undefined) background = '#000000';
let ringColor = "#000000"
let ringOffColor = settings.offRing;
if (ringOffColor == undefined) ringOffColor = '#FF0000';
let ringOnColor = settings.onRing;
if (ringOnColor == undefined) ringOnColor = '#00FF00';
let playlistType = settings.playlistType;
if (playlistType == undefined) playlistType = 'playStop';
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'){
@@ -60,6 +63,7 @@ export class PlaylistControl{
playlistNr += this.playlistOffset;
let playlist = this.getPlaylist(playlistNr);
if (playlist != undefined){
if (playlist.playing)
ringColor = ringOnColor;
@@ -73,28 +77,31 @@ 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;
}
streamDeck.setIcon(context,"",background,2,ringColor);
//Relative Offset
else if (playlistType == 'relativeOffset') {
let playlistOffset = parseInt(settings.offset);
if (isNaN(playlistOffset)) playlistOffset = 0;
let number = parseInt(this.playlistOffset + playlistOffset);
const nrOfPlaylists = parseInt(game.settings.get(MODULE.moduleName,'playlists').playlistNumber);
if (number < 0) number += nrOfPlaylists;
else if (number >= nrOfPlaylists) number -= nrOfPlaylists;
const targetPlaylist = this.getPlaylist(number);
if (targetPlaylist != undefined) name = targetPlaylist.name;
}
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 background = settings.background;
if(background == undefined) background = '#000000';
let ringColor = "#000000"
let ringOffColor = settings.offRing;
if (ringOffColor == undefined) ringOffColor = '#FF0000';
let ringOnColor = settings.onRing;
if (ringOnColor == undefined) ringOnColor = '#00FF00';
let playlistType = settings.playlistType;
if (playlistType == undefined) playlistType = 'playStop';
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'){
@@ -106,10 +113,10 @@ export class PlaylistControl{
if (isNaN(trackNr) || trackNr < 1) trackNr = 1;
trackNr--;
trackNr += this.trackOffset;
let playlist = this.getPlaylist(playlistNr);
if (playlist != undefined){
let 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;
@@ -121,16 +128,27 @@ export class PlaylistControl{
}
}
//Offset
else {
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;
}
streamDeck.setIcon(context,"",background,2,ringColor);
//Relative Offset
else if (playlistType == 'relativeOffset') {
}
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
streamDeck.setTitle(name,context);
}
stopAll(force=false){
if (game.user.isGM == false) {
const payload = {
"msgType": "stopAllPlaylists",
"force": force
};
game.socket.emit(`module.MaterialDeck`, payload);
return;
}
if (force){
let playing = game.playlists.playing;
for (let i=0; i<playing.length; i++){
@@ -152,11 +170,12 @@ export class PlaylistControl{
getPlaylist(num){
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
if (selectedPlaylists != undefined)
return game.playlists.entities.find(p => p._id == selectedPlaylists[num]);
return game.playlists.get(selectedPlaylists[num]);
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;
playlistNr--;
@@ -166,41 +185,68 @@ export class PlaylistControl{
trackNr--;
trackNr += this.trackOffset;
if (settings.playlistMode == undefined) settings.playlistMode = 'playlist';
if (settings.playlistType == undefined) settings.playlistType = 'playStop';
if (settings.playlistMode == 'stopAll') {
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
if (playlistMode == 'stopAll') {
this.stopAll(true);
}
else {
if (settings.playlistType == 'playStop') {
if (playlistType == 'playStop') {
let playlist = this.getPlaylist(playlistNr);
if (playlist != undefined){
if (settings.playlistMode == 'playlist')
if (playlistMode == 'playlist')
this.playPlaylist(playlist,playlistNr);
else {
let 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 (settings.playlistMode == 'playlist') {
else if (playlistType == 'offset'){
if (playlistMode == 'playlist') {
this.playlistOffset = parseInt(settings.offset);
if (isNaN(this.playlistOffset)) this.playlistOffset = 0;
}
else {
else {
this.trackOffset = parseInt(settings.offset);
if (isNaN(this.trackOffset)) this.trackOffset = 0;
}
this.updateAll();
}
else if (playlistType == 'relativeOffset'){
if (playlistMode == 'playlist') {
let playlistOffset = parseInt(settings.offset);
if (isNaN(playlistOffset)) playlistOffset = 0;
let number = parseInt(this.playlistOffset + playlistOffset);
const nrOfPlaylists = parseInt(game.settings.get(MODULE.moduleName,'playlists').playlistNumber);
if (number < 0) number += nrOfPlaylists;
else if (number >= nrOfPlaylists) number -= nrOfPlaylists;
this.playlistOffset = number;
}
else {
let value = parseInt(settings.offset);
if (isNaN(value)) return;
this.trackOffset += value;
}
this.updateAll();
}
}
}
async playPlaylist(playlist,playlistNr){
if (game.user.isGM == false) {
const payload = {
"msgType": "playPlaylist",
"playlistId": playlist.id,
"playlistNr": playlistNr
};
game.socket.emit(`module.MaterialDeck`, payload);
return;
}
if (playlist.playing) {
playlist.stopAll();
return;
@@ -214,6 +260,16 @@ export class PlaylistControl{
}
async playTrack(track,playlist,playlistNr){
if (game.user.isGM == false) {
const payload = {
"msgType": "playTrack",
"playlistId": playlist.id,
"playlistNr": playlistNr,
"trackId": track._id
};
game.socket.emit(`module.MaterialDeck`, payload);
return;
}
let play;
if (track.playing)
play = false;
@@ -227,7 +283,11 @@ export class PlaylistControl{
}
else if (mode == 2) await playlist.stopAll();
}
await playlist.updateEmbeddedEntity("PlaylistSound", {_id: track._id, playing: play});
if (compatibleCore("0.8.1") && play) await playlist.playSound(track);
else if (compatibleCore("0.8.1")) await playlist.stopSound(track);
else await playlist.updateEmbeddedEntity("PlaylistSound", {_id: track._id, playing: play});
playlist.update({playing: play});
}
}

214
src/scene.js Normal file
View File

@@ -0,0 +1,214 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
export class SceneControl{
constructor(){
this.active = false;
this.rollData = {};
this.sceneOffset = 0;
}
async updateAll(){
if (this.active == false) return;
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,device){
if (canvas.scene == null) return;
this.active = true;
const func = settings.sceneFunction ? settings.sceneFunction : 'visible';
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
let ringColor = "#000000";
let ring = 2;
let src = "";
let name = "";
if (func == 'visible') { //visible scenes
if (MODULE.getPermission('SCENE','VISIBLE') == false ) {
streamDeck.noPermission(context,device);
return;
}
let nr = parseInt(settings.sceneNr);
if (isNaN(nr) || nr < 1) nr = 1;
nr--;
let scene = game.scenes.apps[0].scenes[nr];
if (scene != undefined){
ringColor = scene.isView ? ringOnColor : ringOffColor;
if (settings.displaySceneName) name = scene.name;
if (settings.displaySceneIcon) src = scene.img;
if (scene.active) name += "\n(Active)";
}
}
else if (func == 'dir') { //from directory
if (MODULE.getPermission('SCENE','DIRECTORY') == false ) {
streamDeck.noPermission(context,device);
return;
}
let nr = parseInt(settings.sceneNr);
if (isNaN(nr) || nr < 1) nr = 1;
nr--;
let sceneList = [];
for (let i=0; i<ui.scenes.tree.children.length; i++){
const scenesInFolder = compatibleCore("0.8.1") ? ui.scenes.tree.children[i].contents : ui.scenes.tree.children[i].entities;
for (let j=0; j<scenesInFolder.length; j++)
sceneList.push(scenesInFolder[j])
}
for (let i=0; i<ui.scenes.tree.content.length; i++)
sceneList.push(ui.scenes.tree.content[i])
const scene = sceneList[nr+this.sceneOffset];
if (scene != undefined){
if (scene.isView)
ringColor = ringOnColor;
else if (scene.data.navigation && scene.data.permission.default == 0)
ringColor = '#000791';
else if (scene.data.navigation)
ringColor = '#2d2d2d';
else
ringColor = ringOffColor;
if (settings.displaySceneName) name = scene.name;
if (settings.displaySceneIcon) src = scene.img;
if (scene.active) name += "\n(Active)";
}
}
else if (func == 'any') { //by name
if (MODULE.getPermission('SCENE','NAME') == false ) {
streamDeck.noPermission(context,device);
return;
}
if (settings.sceneName == undefined || settings.sceneName == '') return;
let scene = game.scenes.getName(settings.sceneName);
if (scene != undefined){
ringColor = scene.isView ? ringOnColor : ringOffColor;
if (settings.displaySceneName) name = scene.name;
if (settings.displaySceneIcon) src = scene.img;
if (scene.active) name += "\n(Active)";
}
}
else if (func == 'active'){
if (MODULE.getPermission('SCENE','ACTIVE') == false ) {
streamDeck.noPermission(context,device);
return;
}
const scene = game.scenes.active;
if (scene == undefined) return;
if (settings.displaySceneName) name = scene.name;
if (settings.displaySceneIcon) src = scene.img;
ring = 0;
}
else if (func == 'offset'){
let offset = parseInt(settings.sceneOffset);
if (isNaN(offset)) offset = 0;
ringColor = (offset == this.sceneOffset) ? ringOnColor : ringOffColor;
src = "modules/MaterialDeck/img/transparant.png";
}
streamDeck.setTitle(name,context);
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
}
keyPress(settings){
const func = settings.sceneFunction ? settings.sceneFunction : 'visible';
if (func == 'visible'){ //visible scenes
if (MODULE.getPermission('SCENE','VISIBLE') == false ) return;
const viewFunc = settings.sceneViewFunction ? settings.sceneViewFunction : 'view';
let nr = parseInt(settings.sceneNr);
if (isNaN(nr) || nr < 1) nr = 1;
nr--;
let scene = game.scenes.apps[0].scenes[nr];
if (scene != undefined){
if (viewFunc == 'view'){
scene.view();
}
else if (viewFunc == 'activate'){
scene.activate();
}
else {
if (scene.isView) scene.activate();
scene.view();
}
}
}
else if (func == 'dir') { //from directory
if (MODULE.getPermission('SCENE','DIRECTORY') == false ) return;
const viewFunc = settings.sceneViewFunction ? settings.sceneViewFunction : 'view';
let nr = parseInt(settings.sceneNr);
if (isNaN(nr) || nr < 1) nr = 1;
nr--;
let sceneList = [];
for (let i=0; i<ui.scenes.tree.children.length; i++){
const scenesInFolder = compatibleCore("0.8.1") ? ui.scenes.tree.children[i].contents : ui.scenes.tree.children[i].entities;
for (let j=0; j<scenesInFolder.length; j++)
sceneList.push(scenesInFolder[j])
}
for (let i=0; i<ui.scenes.tree.content.length; i++)
sceneList.push(ui.scenes.tree.content[i])
const scene = sceneList[nr+this.sceneOffset];
if (scene != undefined){
if (viewFunc == 'view'){
scene.view();
}
else if (viewFunc == 'activate'){
scene.activate();
}
else {
if (scene.isView) scene.activate();
scene.view();
}
}
}
else if (func == 'any'){ //by name
if (MODULE.getPermission('SCENE','NAME') == false ) return;
if (settings.sceneName == undefined || settings.sceneName == '') return;
const scenes = game.scenes.entries;
let scene = game.scenes.getName(settings.sceneName);
if (scene == undefined) return;
const viewFunc = settings.sceneViewFunction ? settings.sceneViewFunction : 'view';
if (viewFunc == 'view'){
scene.view();
}
else if (viewFunc == 'activate'){
scene.activate();
}
else {
if (scene.isView) scene.activate();
scene.view();
}
}
else if (func == 'active'){
if (MODULE.getPermission('SCENE','ACTIVE') == false ) return;
const scene = game.scenes.active;
if (scene == undefined) return;
scene.view();
}
else if (func == 'offset'){
let offset = parseInt(settings.sceneOffset);
if (isNaN(offset)) offset = 0;
this.sceneOffset = offset;
this.updateAll();
}
}
}

View File

@@ -1,44 +1,159 @@
import * as MODULE from "../MaterialDeck.js";
import { playlistConfigForm, macroConfigForm, soundboardConfigForm } from "./misc.js";
import { playlistConfigForm, macroConfigForm, soundboardConfigForm, downloadUtility } from "./misc.js";
export const registerSettings = function() {
let userPermissions = {};
const defaultEnable = [true,true,true,true];
const defaultUserPermissions = {
COMBAT: {
END_TURN: [true,true,true,true],
TURN_DISPLAY: [true,true,true,true],
OTHER_FUNCTIONS: [false,false,true,true],
DISPLAY_COMBATANTS: [false,false,true,true],
DISPLAY_NON_OWNED_STATS: [false,false,true,true],
DISPLAY_LIMITED_HP: [false,true,true,true],
DISPLAY_OBSERVER_HP: [true,true,true,true],
DISPLAY_ALL_NAMES: [false,false,true,true],
DISPLAY_LIMITED_NAME: [false,true,true,true],
DISPLAY_OBSERVER_NAME: [true,true,true,true]
},
MACRO: {
HOTBAR: [true,true,true,true],
BY_NAME: [false,false,true,true],
MACROBOARD: [false,false,true,true],
MACROBOARD_CONFIGURE: [false,false,true,true]
},
OTHER: {
PAUSE: [false,false,true,true],
CONTROL: [true,true,true,true],
DARKNESS: [false,false,true,true],
DICE: [true,true,true,true],
TABLES_ALL: [false,false,true,true],
TABLES: [false,true,true,true],
SIDEBAR: [true,true,true,true],
COMPENDIUM_ALL: [false,false,true,true],
COMPENDIUM: [false,true,true,true],
JOURNAL_ALL: [false,false,true,true],
JOURNAL: [false,true,true,true],
CHAT: [false,true,true,true]
},
PLAYLIST: {
PLAY: [false,false,true,true],
CONFIGURE: [false,false,true,true]
},
SCENE: {
VISIBLE: [false,false,true,true],
ACTIVE: [true,true,true,true],
DIRECTORY: [false,false,true,true],
NAME: [false,false,true,true]
},
SOUNDBOARD: {
PLAY: [false,false,true,true],
CONFIGURE: [false,false,true,true]
},
TOKEN: {
STATS: [true,true,true,true],
VISIBILITY: [false,false,true,true],
COMBAT: [false,true,true,true],
VISION: [false,true,true,true],
WILDCARD: [false,true,true,true],
CONDITIONS: [false,true,true,true],
CUSTOM: [false,false,true,true],
NON_OWNED: [false,false,true,true],
OBSERVER: [false,true,true,true]
}
}
export const registerSettings = async function() {
/**
* Main settings
*/
//world,global,client
//Enabled the module
game.settings.register(MODULE.moduleName,'Enable', {
name: "MaterialDeck.Sett.Enable",
scope: "global",
scope: "client",
config: true,
default: false,
type: Boolean,
onChange: x => window.location.reload()
});
game.settings.register(MODULE.moduleName,'streamDeckModel', {
name: "MaterialDeck.Sett.Model",
hint: "MaterialDeck.Sett.Model_Hint",
scope: "world",
config: true,
type:Number,
default:1,
choices:["MaterialDeck.Sett.Model_Mini","MaterialDeck.Sett.Model_Normal","MaterialDeck.Sett.Model_XL"],
});
/**
* Sets the ip address of the server
*/
game.settings.register(MODULE.moduleName,'address', {
name: "MaterialDeck.Sett.ServerAddr",
hint: "MaterialDeck.Sett.ServerAddrHint",
scope: "world",
scope: "client",
config: true,
default: "localhost:3001",
type: String,
onChange: x => window.location.reload()
});
game.settings.register(MODULE.moduleName, 'imageBuffer', {
name: "MaterialDeck.Sett.ImageBuffer",
hint: "MaterialDeck.Sett.ImageBufferHint",
default: 100,
type: Number,
scope: 'client',
range: { min: 0, max: 500, step: 10 },
config: true
});
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",
label: "MaterialDeck.Sett.Help",
type: helpMenu,
restricted: false
});
game.settings.registerMenu(MODULE.moduleName, 'permissionConfig',{
name: "MaterialDeck.Sett.Permission",
label: "MaterialDeck.Sett.Permission",
type: userPermission,
restricted: true
});
game.settings.register(MODULE.moduleName, 'userPermission', {
name: "userPermission",
scope: "world",
type: Object,
config: false
});
game.settings.registerMenu(MODULE.moduleName, 'downloadUtility',{
name: "MaterialDeck.DownloadUtility.Title",
label: "MaterialDeck.DownloadUtility.Title",
type: downloadUtility,
restricted: false
});
/**
* Playlist soundboard
*/
@@ -46,7 +161,7 @@ export const registerSettings = function() {
name: "MaterialDeck.Sett.PlaylistConfig",
label: "MaterialDeck.Sett.PlaylistConfig",
type: playlistConfigForm,
restricted: true
restricted: false
});
game.settings.register(MODULE.moduleName, 'playlists', {
@@ -64,7 +179,7 @@ export const registerSettings = function() {
name: "MaterialDeck.Sett.MacroConfig",
label: "MaterialDeck.Sett.MacroConfig",
type: macroConfigForm,
restricted: true
restricted: false
});
game.settings.register(MODULE.moduleName, 'macroSettings', {
@@ -96,6 +211,168 @@ export const registerSettings = function() {
name: "MaterialDeck.Sett.SoundboardConfig",
label: "MaterialDeck.Sett.SoundboardConfig",
type: soundboardConfigForm,
restricted: true
restricted: false
});
let permissionSettings = game.settings.get(MODULE.moduleName,'userPermission');
if (permissionSettings == undefined || permissionSettings == null || MODULE.isEmpty(permissionSettings)) {
permissionSettings = {
enable: defaultEnable,
permissions: defaultUserPermissions
}
}
else {
if (permissionSettings.permissions.TOKEN.NON_OWNED == undefined) permissionSettings.permissions.TOKEN.NON_OWNED = [false,false,true,true];
if (permissionSettings.permissions.TOKEN.OBSERVER == undefined) permissionSettings.permissions.TOKEN.OBSERVER = [false,true,true,true];
if (permissionSettings.permissions.MACRO.BY_NAME == undefined) permissionSettings.permissions.MACRO.BY_NAME = [false,false,true,true];
}
if (game.user.isGM)
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
}
export class helpMenu extends FormApplication {
constructor(data, options) {
super(data, options);
}
/**
* Default Options for this FormApplication
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id: "helpMenu",
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.Help"),
template: "./modules/MaterialDeck/templates/helpMenu.html",
width: "500px"
});
}
/**
* Provide data to the template
*/
getData() {
return {
}
}
/**
* Update on form submit
* @param {*} event
* @param {*} formData
*/
async _updateObject(event, formData) {
}
activateListeners(html) {
super.activateListeners(html);
}
}
class userPermission extends FormApplication {
constructor(data, options) {
super(data, options);
}
/**
* Default Options for this FormApplication
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id: "userPermissionConfig",
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.Permission"),
template: "./modules/MaterialDeck/templates/userPermissionConfig.html",
width: 660,
height: "auto",
scrollY: [".permissions-list"],
});
}
/**
* Provide data to the template
*/
async getData() {
let settings = game.settings.get(MODULE.moduleName,'userPermission');
if (settings == undefined || settings == null || MODULE.isEmpty(settings)) {
settings = {
enable: defaultEnable,
permissions: defaultUserPermissions
}
}
const actions = Object.entries(duplicate(settings.permissions)).reduce((arr, e) => {
const perms = Object.entries(duplicate(e[1])).reduce((arr, p) => {
let perm = {};
perm.roles = [p[1][0],p[1][1],p[1][2],p[1][3]]
perm.id = p[0];
perm.label = game.i18n.localize("MaterialDeck.Perm."+e[0]+"."+p[0]+".label");
perm.hint = game.i18n.localize("MaterialDeck.Perm."+e[0]+"."+p[0]+".hint");
arr.push(perm);
return arr;
}, []);
let cat = {};
cat.permissions = perms;
cat.id = e[0];
cat.label = game.i18n.localize("MaterialDeck.Perm."+e[0]+".label");
cat.hint = game.i18n.localize("MaterialDeck.Perm."+e[0]+".hint");
arr.push(cat);
return arr;
}, []);
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;
obj[r] = `USER.Role${r.titleCase()}`;
return obj;
}, {}),
actions: actions,
enable: settings.enable
}
}
/**
* Update on form submit
* @param {*} event
* @param {*} formData
*/
async _updateObject(event, formData) {
let permissions = expandObject(formData);
let settings = {};
settings.enable = permissions.ENABLE;
delete permissions.ENABLE;
settings.permissions = permissions;
// game.settings.set(MODULE.moduleName,'userPermission',settings);
}
async activateListeners(html) {
super.activateListeners(html);
const defaultBtn = html.find('button[name="reset"]');
defaultBtn.on("click", event => {
this.resetToDefault();
})
}
async resetToDefault(){
const settings = {
enable: defaultEnable,
permissions: defaultUserPermissions
}
await game.settings.set(MODULE.moduleName,'userPermission',settings);
this.render();
ui.notifications.info(game.i18n.localize("MaterialDeck.Perm.DefaultNotification"));
}
}

View File

@@ -1,37 +1,39 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
export class SoundboardControl{
constructor(){
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++){
let 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,device);
return;
}
this.active = true;
let mode = settings.soundboardMode;
if (mode == undefined) mode = 'playSound';
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
const background = settings.background ? settings.background : '#000000';
let ringColor = "#000000"
let txt = "";
let src = "";
let background = settings.background;
if (background == undefined) background = '#000000';
let ringColor = "#000000"
if (mode == 'playSound'){ //play sound
let soundNr = parseInt(settings.soundNr);
if (isNaN(soundNr)) soundNr = 1;
@@ -39,46 +41,44 @@ export class SoundboardControl{
soundNr += this.offset;
let soundboardSettings = game.settings.get(MODULE.moduleName, 'soundboardSettings');
if (this.activeSounds[soundNr]==false)
ringColor = soundboardSettings.colorOff[soundNr];
else
ringColor = 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,2,ringColor);
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
}
else if (mode == 'offset') { //Offset
let ringOffColor = settings.offRing;
if (ringOffColor == undefined) ringOffColor = '#000000';
let ringOnColor = settings.onRing;
if (ringOnColor == undefined) ringOnColor = '#00FF00';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
let offset = parseInt(settings.offset);
if (isNaN(offset)) offset = 0;
if (offset == this.offset) ringColor = ringOnColor;
else ringColor = ringOffColor;
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,"",background,2,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';
let soundPlaying = false;
const background = settings.background ? settings.background : '#000000';
for (let i=0; i<this.activeSounds.length; i++)
if (this.activeSounds[i]) soundPlaying = true;
if (this.activeSounds[i])
soundPlaying = true;
if (soundPlaying)
streamDeck.setIcon(context,src,settings.background,2,'#00FF00',true);
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:'#00FF00',overlay:true});
else
streamDeck.setIcon(context,src,settings.background,1,'#000000',true);
streamDeck.setIcon(context,device,src,{background:background,ring:1,ringColor:'#000000',overlay:true});
}
}
keyPressDown(settings){
let mode = settings.soundboardMode;
if (mode == undefined) mode = 'playSound';
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) return;
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
if (mode == 'playSound') { //Play sound
let soundNr = parseInt(settings.soundNr);
if (isNaN(soundNr)) soundNr = 1;
@@ -86,12 +86,10 @@ export class SoundboardControl{
soundNr += this.offset;
const playMode = game.settings.get(MODULE.moduleName,'soundboardSettings').mode[soundNr];
const repeat = (playMode > 0) ? true : false;
const play = (this.activeSounds[soundNr] == undefined) ? true : false;
let repeat = false;
if (playMode > 0) repeat = true;
let play = false;
if (this.activeSounds[soundNr] == false) play = true;
this.playSound(soundNr,repeat,play);
this.prePlaySound(soundNr,repeat,play);
}
else if (mode == 'offset') { //Offset
let offset = parseInt(settings.offset);
@@ -100,18 +98,20 @@ export class SoundboardControl{
this.updateAll();
}
else if (mode == 'stopAll') { //Stop All Sounds
for (let i=0; i<64; i++) {
if (this.activeSounds[i] != false){
this.playSound(i,false,false);
for (let i=0; i<this.activeSounds.length; i++) {
if (this.activeSounds[i] != undefined){
this.prePlaySound(i,false,false);
}
}
}
}
keyPressUp(settings){
let mode = settings.soundboardMode;
if (mode == undefined) mode = 'playSound';
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) return;
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
if (mode != 'playSound') return;
let soundNr = parseInt(settings.soundNr);
if (isNaN(soundNr)) soundNr = 1;
soundNr--;
@@ -120,13 +120,12 @@ export class SoundboardControl{
const playMode = game.settings.get(MODULE.moduleName,'soundboardSettings').mode[soundNr];
if (playMode == 2)
this.playSound(soundNr,false,false);
this.prePlaySound(soundNr,false,false);
}
async playSound(soundNr,repeat,play){
async prePlaySound(soundNr,repeat,play){
const soundBoardSettings = game.settings.get(MODULE.moduleName,'soundboardSettings');
let playlistId;
if (soundBoardSettings.selectedPlaylists != undefined) playlistId = soundBoardSettings.selectedPlaylists[soundNr];
const playlistId = (soundBoardSettings.selectedPlaylists != undefined) ? soundBoardSettings.selectedPlaylists[soundNr] : undefined;
let src;
if (playlistId == "" || playlistId == undefined) return;
if (playlistId == 'none') return;
@@ -134,7 +133,8 @@ export class SoundboardControl{
src = soundBoardSettings.src[soundNr];
const ret = await FilePicker.browse("data", src, {wildcard:true});
const files = ret.files;
if (files.length == 1) src = files;
if (files.length == 1)
src = files;
else {
let value = Math.floor(Math.random() * Math.floor(files.length));
src = files[value];
@@ -142,9 +142,9 @@ export class SoundboardControl{
}
else {
const soundId = soundBoardSettings.sounds[soundNr];
const sounds = game.playlists.entities.find(p => p._id == playlistId).data.sounds;
const sounds = game.playlists.get(playlistId).sounds;
if (sounds == undefined) return;
const sound = sounds.find(p => p._id == soundId);
const sound = compatibleCore("0.8.1") ? sounds.find(p => p.id == soundId) : sounds.find(p => p._id == soundId);
if (sound == undefined) return;
src = sound.path;
}
@@ -162,25 +162,43 @@ export class SoundboardControl{
};
game.socket.emit(`module.MaterialDeck`, payload);
if (play){
volume *= game.settings.get("core", "globalInterfaceVolume");
this.playSound(soundNr,src,play,repeat,volume)
}
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
if (repeat == false){
this.activeSounds[soundNr] = false;
async playSound(soundNr,src,play,repeat,volume){
if (play){
volume *= game.settings.get("core", "globalAmbientVolume");
if (compatibleCore("0.8.1")) {
let newSound = new Sound(src);
if(newSound.loaded == false) await newSound.load({autoplay:true});
newSound.on('end', ()=>{
if (repeat == false) {
this.activeSounds[soundNr] = undefined;
this.updateAll();
}
});
newSound.play({loop:repeat,volume:volume});
this.activeSounds[soundNr] = newSound;
}
else {
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
if (repeat == false){
this.activeSounds[soundNr] = undefined;
this.updateAll();
}
},
onstop: ()=>{
this.activeSounds[soundNr] = undefined;
this.updateAll();
}
},
onstop: (id)=>{
this.activeSounds[soundNr] = false;
this.updateAll();
}});
howl.play();
this.activeSounds[soundNr] = howl;
}});
howl.play();
this.activeSounds[soundNr] = howl;
}
}
else {
this.activeSounds[soundNr].stop();
this.activeSounds[soundNr] = false;
if (this.activeSounds[soundNr] != undefined) this.activeSounds[soundNr].stop();
this.activeSounds[soundNr] = undefined;
}
this.updateAll();
}

View File

@@ -7,9 +7,7 @@ export class StreamDeck{
this.tokenNameContext;
this.tokenACContext;
this.buttonContext = [];
for (let i=0; i<23; i++){
this.buttonContext[i] = undefined;
}
this.playlistTrackBuffer = [];
this.playlistSelector = 0;
this.trackSelector = 0;
@@ -25,25 +23,51 @@ export class StreamDeck{
document.body.appendChild(canvasBox); // adds the canvas to the body element
this.syllableRegex = /[^aeiouy]*[aeiouy]+(?:[^aeiouy]*$|[^aeiouy](?=[^aeiouy]))?/gi;
this.imageBuffer = [];
this.imageBufferCounter = 0;
}
setScreen(action){
}
setContext(action,context,coordinates = {column:0,row:0},settings){
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings){
if (device == undefined) return;
if (this.buttonContext[iteration] == undefined) {
const deckSize = size.columns*size.rows;
let buttons = [];
for (let i=0; i<deckSize; i++){
buttons[i] = undefined;
}
this.buttonContext[iteration] = {
device: device,
size: size,
buttons: buttons
}
}
const data = {
context: context,
action: action,
settings: settings
}
let num = coordinates.column + coordinates.row*8;
this.buttonContext[num] = data;
const num = coordinates.column + coordinates.row*size.columns;
this.buttonContext[iteration].buttons[num] = data;
}
clearContext(action,coordinates = {column:0,row:0}){
let num = coordinates.column + coordinates.row*8;
this.buttonContext[num] = undefined;
clearContext(device,action,coordinates = {column:0,row:0}){
for (let d of this.buttonContext) {
if (d.device == device) {
const num = coordinates.column + coordinates.row*d.size.columns;
d.buttons[num] = undefined;
return;
}
}
if (this.getActive(action) == false){
if (action == 'token') MODULE.tokenControl.active = false;
else if (action == 'macro') MODULE.macroControl.active = false;
@@ -52,6 +76,7 @@ export class StreamDeck{
else if (action == 'soundboard') MODULE.soundboard.active = false;
else if (action == 'other') MODULE.otherControls.active = false;
else if (action == 'external') MODULE.externalModules.active = false;
else if (action == 'scene') MODULE.sceneControl.active = false;
}
}
@@ -121,7 +146,9 @@ export class StreamDeck{
newTxtArray[counter] = txtNewPart;
counter++;
}
if (counter == 1 && newTxtArray[0] == "") counter = 0;
}
for (let i=0; i<counter; i++){
if (txtNew.length > 0)
txtNew += "\n";
@@ -171,33 +198,82 @@ export class StreamDeck{
MODULE.sendWS(JSON.stringify(msg));
}
setImage(image,context){
setImage(image,context,device,nr,id){
var json = {
target: "SD",
event: "setImage",
context: context,
device: device,
payload: {
image: "" + image,
target: 0
nr: nr,
id: id,
image: "" + image,
target: 0
}
};
MODULE.sendWS(JSON.stringify(json));
}
setIcon(context,src='',background = '#000000',ring=0,ringColor = "#000000",overlay=false){
setBufferImage(context,device,nr,id){
var json = {
target: "SD",
event: "setBufferImage",
context: context,
device: device,
payload: {
nr: nr,
id: id,
target: 0
}
};
MODULE.sendWS(JSON.stringify(json));
}
setIcon(context,device,src='',options = {}){
if (src == null || src == undefined) src = '';
if (src == '') src = 'modules/MaterialDeck/img/black.png';
for (let i=0; i<32; i++){
if (this.buttonContext[i] == undefined) continue;
if (this.buttonContext[i].context == context) {
if (this.buttonContext[i].icon == src && this.buttonContext[i].ring == ring && this.buttonContext[i].ringColor == ringColor && this.buttonContext[i].background == background)
return;
this.buttonContext[i].icon = src;
this.buttonContext[i].ring = ring;
this.buttonContext[i].ringColor = ringColor;
this.buttonContext[i].background = background;
let background = options.background ? options.background : '#000000';
let ring = options.ring ? options.ring : 0;
let ringColor = options.ringColor ? options.ringColor : '#000000';
let overlay = options.overlay ? options.overlay : false;
let uses = options.uses ? options.uses : undefined;
let clock = options.clock ? options.clock : false;
//if (src != 'modules/MaterialDeck/img/black.png')
for (let d of this.buttonContext) {
if (d.device == device) {
for (let i=0; i<d.buttons.length; i++){
if (clock != false) break;
if (d.buttons[i] == undefined) continue;
if (d.buttons[i].context == context) {
if (d.buttons[i].icon == src && d.buttons[i].ring == ring && d.buttons[i].ringColor == ringColor && d.buttons[i].background == background && d.buttons[i].uses == uses)
return;
d.buttons[i].icon = src;
d.buttons[i].ring = ring;
d.buttons[i].ringColor = ringColor;
d.buttons[i].background = background;
d.buttons[i].uses = uses;
}
}
break;
}
}
const data = {
url: src,
background:background,
ring:ring,
ringColor:ringColor,
overlay:overlay,
uses:uses,
options:options,
devide:device
}
const imgBuffer = (clock == false) ? this.checkImageBuffer(data) : false;
if (imgBuffer != false) {
this.setBufferImage(context,device,imgBuffer,this.getImageBufferId(data))
return;
}
let split = src.split('.');
//filter out stuff from Tokenizer
@@ -208,14 +284,17 @@ export class StreamDeck{
target: "SD",
event: 'setIcon',
context: context,
device: device,
url: src,
format: format,
background: background,
ring: ring,
ringColor: ringColor,
overlay: overlay
overlay: overlay,
uses:uses,
options:options
};
this.getImage(msg);
this.getImage(msg);
}
setState(state,context,action){
@@ -266,10 +345,11 @@ export class StreamDeck{
if (data == undefined)
return;
const context = data.context;
const device = data.device;
var url = data.url;
const format = data.format;
var background = data.background;
const uses = data.uses;
let BGvalid = true;
if (background.length != 7) BGvalid = false;
if (background[0] != '#') BGvalid = false;
@@ -293,7 +373,8 @@ export class StreamDeck{
ctx.filter = "none";
let margin = 0;
ctx.fillStyle = background;
ctx.fillRect(0, 0, canvas.width, canvas.height);
if (data.ring != undefined && data.ring > 0){
ctx.fillStyle = background;
ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -306,12 +387,16 @@ export class StreamDeck{
}
}
else {
ctx.fillStyle = background;
ctx.fillRect(0, 0, canvas.width, canvas.height);
}
if (uses != undefined && uses.heart != undefined && (uses.available > 0 || uses.maximum != undefined)) {
const percentage = 102*uses.available/uses.maximum;
ctx.fillStyle = uses.heart;
ctx.fillRect(0, 121,144,-percentage);
}
if (format == 'icon' && url != ""){
ctx.font = '600 90px "Font Awesome 5 Free"';
ctx.fillStyle = "gray";
ctx.fillStyle = "#545454";
var elm = document.createElement('i');
elm.className = url;
elm.style.display = 'none';
@@ -326,14 +411,15 @@ export class StreamDeck{
ctx.fillText(content[1], horOffset, vertOffset);
}
if (format != 'jpg' && format != 'jpeg' && format != 'png' && format != 'webm' && format != 'webp' && format != 'gif' && format != 'svg') url = "modules/MaterialDeck/img/transparant.png";
if (format != 'jpg' && format != 'jpeg' && format != 'png' && format != 'PNG' && format != 'webm' && format != 'webp' && format != 'gif' && format != 'svg') url = "modules/MaterialDeck/img/transparant.png";
//if (url == "") url = "modules/MaterialDeck/img/transparant.png"
let resImageURL = url;
let img = new Image();
img.setAttribute('crossorigin', 'anonymous');
img.onload = () => {
if (format == 'color') ctx.filter = "opacity(0)";
if (data.overlay) ctx.filter = "brightness(60%)";
if (data.overlay == true) ctx.filter = "brightness(" + game.settings.get(MODULE.moduleName,'imageBrightness') + "%)";
//ctx.filter = "brightness(0) saturate(100%) invert(38%) sepia(62%) saturate(2063%) hue-rotate(209deg) brightness(90%) contrast(95%)";
var imageAspectRatio = img.width / img.height;
var canvasAspectRatio = canvas.width / canvas.height;
@@ -365,10 +451,136 @@ export class StreamDeck{
yStart = 0;
}
ctx.drawImage(img, xStart+margin, yStart+margin, renderableWidth - 2*margin, renderableHeight - 2*margin);
if (uses != undefined && uses.heart == undefined) {
let txt = '';
let noMaxUses = false;
if (uses.available != undefined) {
txt = uses.available;
if (uses.maximum != undefined) txt = uses.available + '/' + uses.maximum;
if (uses.maximum == undefined ) {
uses.maximum = 1;
noMaxUses = true;
}
}
ctx.beginPath();
ctx.lineWidth = 4;
let green = Math.ceil(255*(uses.available/uses.maximum));
let red = 255-green;
green = green.toString(16);
if (green.length == 1) green = "0"+green;
red = red.toString(16);
if (red.length == 1) red = "0"+red;
if (noMaxUses) ctx.strokeStyle = "#c000000";
else if (uses.available == 0) ctx.strokeStyle = "#c80000";
else ctx.strokeStyle = "#"+red.toString(16)+green.toString(16)+"00";
const rect = {height:35, paddingSides:20, paddingBottom: 4}
ctx.rect(rect.paddingSides, 144-rect.height-rect.paddingBottom,144-2*rect.paddingSides,rect.height);
ctx.globalAlpha = 0.5;
ctx.fillRect(rect.paddingSides, 144-rect.height-rect.paddingBottom,144-2*rect.paddingSides,rect.height);
ctx.globalAlpha = 1;
ctx.fillStyle = "white";
ctx.font = "24px Arial";
ctx.fillText(txt, (canvas.width - ctx.measureText(txt).width) / 2, 144-rect.height-rect.paddingBottom+25);
ctx.stroke();
}
if (data.options.clock != undefined) {
if (data.options.clock != false && data.options.clock != 'none') {
const hourAngle = (data.options.clock.hours+data.options.clock.minutes/60)*Math.PI/6;
const minuteAngle = data.options.clock.minutes*Math.PI/30;
ctx.translate(72,72);
//Draw outer circle
ctx.beginPath();
ctx.lineWidth = 6;
ctx.strokeStyle = "gray";
ctx.arc(0,0, 50, 0, 2 * Math.PI);
ctx.stroke();
//Draw hour marks
ctx.fillStyle = "gray";
ctx.beginPath();
for (let i=0; i<12; i++) {
ctx.fillRect(-2,40,4,10);
const angle = 2*Math.PI/12;
ctx.rotate(angle);
}
//Draw hour arm
ctx.rotate(Math.PI + hourAngle);
ctx.rotate(0);
ctx.fillRect(-4,0,8,30);
ctx.stroke();
// ctx.rotate 8*Math.PI/12;
ctx.beginPath();
ctx.rotate(-hourAngle + minuteAngle);
ctx.fillStyle = "lightgray";
ctx.fillRect(-2,0,4,40);
ctx.rotate(2*Math.PI/12);
ctx.stroke();
//Draw inner circle
ctx.beginPath();
ctx.arc(0,0, 5, 0, 2 * Math.PI);
ctx.fill();
}
}
var dataURL = canvas.toDataURL();
canvas.remove();
this.setImage(dataURL,data.context);
const nr = this.addToImageBuffer(dataURL,data);
this.setImage(dataURL,data.context,device,nr,this.getImageBufferId(data));
};
img.src = resImageURL;
}
getImageBufferId(data){
return data.url+data.background+data.ring+data.ringColor+data.overlay+data.uses?.available+data.uses?.maximum;
}
addToImageBuffer(img,data){
const id = this.getImageBufferId(data);
const maxBufferSize = game.settings.get(MODULE.moduleName,'imageBuffer');
if (maxBufferSize == 0) return false;
if (this.imageBufferCounter > maxBufferSize) this.imageBufferCounter = 0;
const newData = {
id: id,
img: img
}
if (this.imageBuffer[this.imageBufferCounter] == undefined) this.imageBuffer.push(newData);
else this.imageBuffer[this.imageBufferCounter] = newData;
this.imageBufferCounter++;
return this.imageBufferCounter - 1;
}
checkImageBuffer(data){
if (game.settings.get(MODULE.moduleName,'imageBuffer') == 0) return false;
const id = this.getImageBufferId(data);
for (let i=0; i<this.imageBuffer.length; i++){
if (this.imageBuffer[i].id == id) return i;
}
return false;
}
resetImageBuffer(){
this.imageBufferCounter = 0;
this.imageBuffer = [];
}
noPermission(context,device,showTxt=true, origin = ""){
console.warn("Material Deck: User lacks permission for function "+origin);
const url = 'modules/MaterialDeck/img/black.png';
const background = '#000000';
const txt = showTxt ? 'no\npermission' : '';
this.setIcon(context,device,url,{background:background});
this.setTitle(txt,context);
}
}

137
src/systems/demonlord.js Normal file
View File

@@ -0,0 +1,137 @@
import {compatibleCore} from "../misc.js";
export class demonlord{
constructor(){
}
getHP(token) {
const hp = token.actor.data.data.characteristics.health;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
return;
}
getAC(token) {
return token.actor.data.data.characteristics.defense;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
return token.actor.data.data.characteristics.speed;
}
getInitiative(token) {
return token.actor.data.data.fastturn ? "FAST" : "SLOW";
}
toggleInitiative(token) {
token.actor.update({
'data.fastturn': !token.actor.data?.data?.fastturn
});
return;
}
getPassivePerception(token) {
return;
}
getPassiveInvestigation(token) {
return;
}
getAbility(token, ability) {
if (ability == undefined) ability = 'strength';
return token.actor.data.data.attributes?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = token.actor.data.data.attributes?.[ability].modifier;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
return;
}
getSkill(token, skill) {
if (skill == undefined) skill = 'acr';
const val = token.actor.data.data.skills?.[skill].total;
return (val >= 0) ? `+${val}` : val;
}
getProficiency(token) {
return;
}
getConditionIcon(condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll') return window.CONFIG.controlIcons.effects;
else return CONFIG.statusEffects.find(e => e.id === condition).icon;
}
getConditionActive(token,condition) {
if (condition == undefined) condition = 'removeAll';
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
}
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
for( let effect of token.actor.effects)
await effect.delete();
}
else {
const effect = CONFIG.statusEffects.find(e => e.id === condition);
await token.toggleEffect(effect);
}
return true;
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
return;
}
/**
* Items
*/
getItems(token,itemType) {
if (itemType == undefined) itemType = 'any';
const allItems = token.actor.items;
if (itemType == 'any') return allItems.filter(i => i.type == 'item');
}
getItemUses(item) {
return {available: item.data.data.quantity};
}
/**
* Spells
*/
getSpells(token,level) {
if (level == undefined) level = 'any';
const allItems = token.actor.items;
if (level == 'any') return allItems.filter(i => i.type == 'spell')
else return allItems.filter(i => i.type == 'spell' && i.data.data.rank == level)
}
getSpellUses(token,level,item) {
return;
}
rollItem(item) {
return item.roll()
}
}

202
src/systems/dnd35e.js Normal file
View File

@@ -0,0 +1,202 @@
import {compatibleCore} from "../misc.js";
export class dnd35e{
constructor(){
}
getHP(token) {
const hp = token.actor.data.data.attributes.hp;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
const hp = token.actor.data.data.attributes.hp;
return {
value: (hp.temp == null) ? 0 : hp.temp,
max: (hp.tempmax == null) ? 0 : hp.tempmax
}
}
getAC(token) {
return token.actor.data.data.attributes.ac.normal.total;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
const movement = token.actor.data.data.attributes.speed;
let speed = "";
if (movement.burrow.total > 0) speed += `Burrow: ${movement.burrow.total}Ft`;
if (movement.climb.total > 0) {
if (speed.length > 0) speed += '\n';
speed += `Climb: ${movement.climb.total}Ft`;
}
if (movement.fly.total > 0) {
if (speed.length > 0) speed += '\n';
speed += `Fly: ${movement.fly.total}Ft`;
}
if (movement.land.total > 0) {
if (speed.length > 0) speed += '\n';
speed += `Land: ${movement.land.total}Ft`;
}
if (movement.swim.total > 0) {
if (speed.length > 0) speed += '\n';
speed += `Swim: ${movement.swim.total}Ft`;
}
return speed;
}
getInitiative(token) {
let initiative = token.actor.data.data.attributes.init.total;
return (initiative >= 0) ? `+${initiative}` : initiative;
}
toggleInitiative(token) {
return;
}
getPassivePerception(token) {
return;
}
getPassiveInvestigation(token) {
return;
}
getAbility(token, ability) {
if (ability == undefined) ability = 'str';
return token.actor.data.data.abilities?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = token.actor.data.data.abilities?.[ability].mod;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
if (ability == undefined) ability = 'fort';
let val = token.actor.data.data.attributes.savingThrows?.[ability].total;
return (val >= 0) ? `+${val}` : val;
}
getSkill(token, skill) {
if (skill == undefined) skill = 'apr';
const val = token.actor.data.data.skills?.[skill].mod;
return (val >= 0) ? `+${val}` : val;
}
getProficiency(token) {
const val = token.actor.data.data.attributes.prof;
return (val >= 0) ? `+${val}` : val;
}
getConditionIcon(condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll') return window.CONFIG.controlIcons.effects;
else return CONFIG.statusEffects.find(e => e.id === condition).icon;
}
getConditionActive(token,condition) {
if (condition == undefined) condition = 'removeAll';
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
}
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
for( let effect of token.actor.effects)
await effect.delete();
}
else {
const effect = CONFIG.statusEffects.find(e => e.id === condition);
await token.toggleEffect(effect);
}
return true;
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
if (roll == undefined) roll = 'ability';
if (ability == undefined) ability = 'str';
if (skill == undefined) skill = 'apr';
if (save == undefined) save = 'fort';
if (roll == 'ability') token.actor.rollAbilityTest(ability,options);
else if (roll == 'save') token.actor.rollSavingThrow(save, null, null,options);
else if (roll == 'skill') token.actor.rollSkill(skill,options);
else if (roll == 'initiative') token.actor.rollInitiative(options);
else if (roll == 'grapple') token.actor.rollGrapple(options);
else if (roll == 'bab') token.actor.rollBAB(options);
else if (roll == 'melee') token.actor.rollMelee(options);
else if (roll == 'ranged') token.actor.rollRanged(options);
}
/**
* Items
*/
getItems(token,itemType) {
if (itemType == undefined) itemType = 'any';
const allItems = token.actor.items;
if (itemType == 'any') return allItems.filter(i => i.type == 'weapon' || i.type == 'equipment' || i.type == 'consumable' || i.type == 'loot' || i.type == 'container');
else if (game.system.id == 'D35E' && itemType == 'container') return allItems.filter(i => i.type == 'loot' && i.data.data.subType == itemType);
else {
if (itemType == 'gear' || itemType == 'ammo' || itemType == 'misc' || itemType == 'tradeGoods')
return allItems.filter(i => i.type == 'loot' && i.data.data.subType == itemType);
else return allItems.filter(i => i.type == itemType);
}
}
getItemUses(item) {
return {available: item.data.data.quantity};
}
/**
* Features
*/
getFeatures(token,featureType) {
if (featureType == undefined) featureType = 'any';
const allItems = token.actor.items;
if (featureType == 'any') return allItems.filter(i => i.type == 'class' || i.type == 'feat')
else return allItems.filter(i => i.type == featureType)
}
getFeatureUses(item) {
if (item.data.type == 'class') return {available: item.data.data.levels};
else return {
available: item.data.data.uses.value,
maximum: item.data.data.uses.max
};
}
/**
* Spells
*/
getSpells(token,level) {
if (level == undefined) level = 'any';
const allItems = token.actor.items;
if (level == 'any') return allItems.filter(i => i.type == 'spell')
else return allItems.filter(i => i.type == 'spell' && i.data.data.level == level)
}
getSpellUses(token,level,item) {
if (level == undefined) level = 'any';
if (item.data.data.level == 0) return;
return {
available: item.charges,
maximum: item.maxCharges
}
}
rollItem(item) {
return item.roll()
}
}

205
src/systems/dnd5e.js Normal file
View File

@@ -0,0 +1,205 @@
import {compatibleCore} from "../misc.js";
export class dnd5e{
constructor(){
}
getHP(token) {
const hp = token.actor.data.data.attributes.hp;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
const hp = token.actor.data.data.attributes.hp;
return {
value: (hp.temp == null) ? 0 : hp.temp,
max: (hp.tempmax == null) ? 0 : hp.tempmax
}
}
getAC(token) {
return token.actor.data.data.attributes.ac.value;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
const movement = token.actor.data.data.attributes.movement;
let speed = "";
if (movement != undefined){
if (movement.burrow > 0) speed += `${game.i18n.localize("DND5E.MovementBurrow")}: ${movement.burrow + movement.units}`;
if (movement.climb > 0) {
if (speed.length > 0) speed += '\n';
speed += `${game.i18n.localize("DND5E.MovementClimb")}: ${movement.climb + movement.units}`;
}
if (movement.fly > 0) {
if (speed.length > 0) speed += '\n';
speed += `${game.i18n.localize("DND5E.MovementFly")}: ${movement.fly + movement.units}`;
}
if (movement.hover > 0) {
if (speed.length > 0) speed += '\n';
speed += `${game.i18n.localize("DND5E.MovementHover")}: ${movement.hover + movement.units}`;
}
if (movement.swim > 0) {
if (speed.length > 0) speed += '\n';
speed += `${game.i18n.localize("DND5E.MovementSwim")}: ${movement.swim + movement.units}`;
}
if (movement.walk > 0) {
if (speed.length > 0) speed += '\n';
speed += `${game.i18n.localize("DND5E.MovementWalk")}: ${movement.walk + movement.units}`;
}
}
else {
const spd = token.actor.data.data.attributes.speed;
speed = spd.value;
if (spd.special.length > 0) speed + "\n" + spd.special;
}
return speed;
}
getInitiative(token) {
let initiative = token.actor.data.data.attributes.init.total;
return (initiative >= 0) ? `+${initiative}` : initiative;
}
toggleInitiative(token) {
return;
}
getPassivePerception(token) {
return token.actor.data.data.skills.prc.passive;
}
getPassiveInvestigation(token) {
return token.actor.data.data.skills.inv.passive;
}
getAbility(token, ability) {
if (ability == undefined) ability = 'str';
return token.actor.data.data.abilities?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = token.actor.data.data.abilities?.[ability].mod;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
if (ability == undefined) ability = 'str';
let val = token.actor.data.data.abilities?.[ability].save;
return (val >= 0) ? `+${val}` : val;
}
getSkill(token, skill) {
if (skill == undefined) skill = 'acr';
const val = token.actor.data.data.skills?.[skill].total;
return (val >= 0) ? `+${val}` : val;
}
getProficiency(token) {
const val = token.actor.data.data.attributes.prof;
return (val >= 0) ? `+${val}` : val;
}
getConditionIcon(condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll') return window.CONFIG.controlIcons.effects;
else return CONFIG.statusEffects.find(e => e.id === condition).icon;
}
getConditionActive(token,condition) {
if (condition == undefined) condition = 'removeAll';
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
}
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
for( let effect of token.actor.effects)
await effect.delete();
}
else {
const effect = CONFIG.statusEffects.find(e => e.id === condition);
await token.toggleEffect(effect);
}
return true;
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
if (roll == undefined) roll = 'ability';
if (ability == undefined) ability = 'str';
if (skill == undefined) skill = 'acr';
if (save == undefined) save = 'str';
if (roll == 'ability') token.actor.rollAbilityTest(ability,options);
else if (roll == 'save') token.actor.rollAbilitySave(save,options);
else if (roll == 'skill') token.actor.rollSkill(skill,options);
else if (roll == 'initiative') token.actor.rollInitiative(options);
else if (roll == 'deathSave') token.actor.rollDeathSave(options);
}
/**
* Items
*/
getItems(token,itemType) {
if (itemType == undefined) itemType = 'any';
const allItems = token.actor.items;
if (itemType == 'any') return allItems.filter(i => i.type == 'weapon' || i.type == 'equipment' || i.type == 'consumable' || i.type == 'loot' || i.type == 'container');
else return allItems.filter(i => i.type == itemType);
}
getItemUses(item) {
return {available: item.data.data.quantity};
}
/**
* Features
*/
getFeatures(token,featureType) {
if (featureType == undefined) featureType = 'any';
const allItems = token.actor.items;
if (featureType == 'any') return allItems.filter(i => i.type == 'class' || i.type == 'feat')
else return allItems.filter(i => i.type == featureType)
}
getFeatureUses(item) {
if (item.data.type == 'class') return {available: item.data.data.levels};
else return {
available: item.data.data.uses.value,
maximum: item.data.data.uses.max
};
}
/**
* Spells
*/
getSpells(token,level) {
if (level == undefined) level = 'any';
const allItems = token.actor.items;
if (level == 'any') return allItems.filter(i => i.type == 'spell')
else return allItems.filter(i => i.type == 'spell' && i.data.data.level == level)
}
getSpellUses(token,level,item) {
if (level == undefined) level = 'any';
if (item.data.data.level == 0) return;
return {
available: token.actor.data.data.spells?.[`spell${level}`].value,
maximum: token.actor.data.data.spells?.[`spell${level}`].max
}
}
rollItem(item) {
return item.roll()
}
}

199
src/systems/pf2e.js Normal file
View File

@@ -0,0 +1,199 @@
import {compatibleCore} from "../misc.js";
export class pf2e{
constructor(){
}
getHP(token) {
const hp = token.actor.data.data.attributes.hp;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
const hp = token.actor.data.data.attributes.hp;
return {
value: (hp.temp == null) ? 0 : hp.temp,
max: (hp.tempmax == null) ? 0 : hp.tempmax
}
}
getAC(token) {
return token.actor.data.data.attributes.ac.value;
}
getShieldHP(token) {
return token.actor.data.data.attributes.shield.value;
}
getSpeed(token) {
let speed = token.actor.data.data.attributes.speed.breakdown;
const otherSpeeds = token.actor.data.data.attributes.speed.otherSpeeds;
if (otherSpeeds.length > 0)
for (let i=0; i<otherSpeeds.length; i++)
speed += `\n${otherSpeeds[i].type}: ${otherSpeeds[i].value}`;
return speed;
}
getInitiative(token) {
let initiative = token.actor.data.data.attributes.init.value;
return (initiative >= 0) ? `+${initiative}` : initiative;
}
toggleInitiative(token) {
return;
}
getPassivePerception(token) {
return;
}
getPassiveInvestigation(token) {
return;
}
getAbility(token, ability) {
if (ability == undefined) ability = 'str';
return token.actor.data.data.abilities?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = token.actor.data.data.abilities?.[ability].mod;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
if (ability == undefined) ability = 'fortitude';
else if (ability == 'fort') ability = 'fortitude';
else if (ability == 'ref') ability = 'reflex';
else if (ability == 'will') ability = 'will';
let val = token.actor.data.data.saves?.[ability].value;
return (val >= 0) ? `+${val}` : val;
}
getSkill(token, skill) {
if (skill == undefined) skill = 'acr';
const val = token.actor.data.data.skills?.[skill].totalModifier;
return (val >= 0) ? `+${val}` : val;
}
getProficiency(token) {
return;
}
getCondition(token,condition) {
if (condition == undefined || condition == 'removeAll') return undefined;
const Condition = condition.charAt(0).toUpperCase() + condition.slice(1);
const effects = token.actor.items.filter(i => i.type == 'condition');
return effects.find(e => e.name === Condition);
}
getConditionIcon(condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll') return window.CONFIG.controlIcons.effects;
else return `${CONFIG.PF2E.statusEffects.effectsIconFolder}${condition}.webp`;
}
getConditionActive(token,condition) {
return this.getCondition(token,condition) != undefined;
}
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
for( let effect of token.actor.items.filter(i => i.type == 'condition'))
await effect.delete();
}
else {
const effect = this.getCondition(token,condition);
if (effect == undefined) {
const Condition = condition.charAt(0).toUpperCase() + condition.slice(1);
const newCondition = game.pf2e.ConditionManager.getCondition(Condition);
newCondition.data.sources.hud = !0,
await game.pf2e.ConditionManager.addConditionToToken(newCondition, token);
}
else {
effect.delete();
}
}
return true;
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
if (roll == undefined) roll = 'ability';
if (ability == undefined) ability = 'str';
if (skill == undefined) skill = 'acr';
if (save == undefined) save = 'fort';
if (roll == 'ability') token.actor.data.data.abilities?.[ability].roll(options);
else if (roll == 'save') {
let ability = save;
if (ability == 'fort') ability = 'fortitude';
else if (ability == 'ref') ability = 'reflex';
else if (ability == 'will') ability = 'will';
token.actor.data.data.saves?.[ability].roll(options);
}
else if (roll == 'skill') token.actor.data.data.skills?.[skill].roll(options);
}
/**
* Items
*/
getItems(token,itemType) {
if (itemType == undefined) itemType = 'any';
const allItems = token.actor.items;
if (itemType == 'any') return allItems.filter(i => i.type == 'weapon' || i.type == 'equipment' || i.type == 'consumable' || i.type == 'loot' || i.type == 'container');
else return allItems.filter(i => i.type == itemType);
}
getItemUses(item) {
return {available: item.data.data.quantity.value};
}
/**
* Features
*/
getFeatures(token,featureType) {
if (featureType == undefined) featureType = 'any';
const allItems = token.actor.items;
if (featureType == 'any') return allItems.filter(i => i.type == 'class' || i.type == 'feat')
else return allItems.filter(i => i.type == featureType)
}
getFeatureUses(item) {
if (item.data.type == 'class') return {available: item.actor.data.data.details.level.value};
else return;
}
/**
* Spells
*/
getSpells(token,level) {
if (level == undefined) level = 'any';
const allItems = token.actor.items;
if (level == 'any') return allItems.filter(i => i.type == 'spell')
else return allItems.filter(i => i.type == 'spell' && i.data.data.level.value == level)
}
getSpellUses(token,level,item) {
if (level == undefined) level = 'any';
if (item.data.data.level.value == 0) return;
const spellbook = token.actor.items.filter(i => i.data.type === 'spellcastingEntry')[0];
if (spellbook == undefined) return;
return {
available: spellbook.data.data.slots?.[`slot${level}`].value,
maximum: spellbook.data.data.slots?.[`slot${level}`].max
}
}
rollItem(item) {
return item.roll()
}
}

282
src/systems/tokenHelper.js Normal file
View File

@@ -0,0 +1,282 @@
import {dnd5e} from "./dnd5e.js"
import {dnd35e} from "./dnd35e.js"
import {pf2e} from "./pf2e.js"
import {demonlord} from "./demonlord.js";
import {wfrp4e} from "./wfrp4e.js"
import {compatibleCore} from "../misc.js";
export class TokenHelper{
constructor(){
this.system;
this.setSystem();
}
setSystem() {
if (game.system.id == 'D35E' || game.system.id == 'pf1') this.system = new dnd35e();
else if (game.system.id == 'pf2e') this.system = new pf2e();
else if (game.system.id == 'demonlord') this.system = new demonlord();
else if (game.system.id == 'wfrp4e') this.system = new wfrp4e();
else this.system = new dnd5e(); //default to dnd5e
}
/***********************************************************************
* System agnostic functions
***********************************************************************/
getToken(type,identifier) {
if (type == 'selected') return this.getSelectedToken();
else if (type != 'selected' && identifier == '') return;
else if (type == 'tokenName') return this.getTokenFromTokenName(identifier);
else if (type == 'actorName') return this.getTokenFromActorName(identifier);
else if (type == 'tokenId') return this.getTokenFromTokenId(identifier);
else if (type == 'actorId') return this.getTokenFromActorId(identifier);
}
getTokenFromTokenId(id) {
return canvas.tokens.children[0].children.find(p => p.id == id);
}
getTokenFromTokenName(name) {
return canvas.tokens.children[0].children.find(p => p.name == name);
}
getTokenFromActorId(id) {
return canvas.tokens.children[0].children.find(p => p.actor.id == id);
}
getTokenFromActorName(name) {
return canvas.tokens.children[0].children.find(p => p.actor.name == name);
}
getSelectedToken() {
return canvas.tokens.controlled[0];
}
moveToken(token,dir){
if (dir == undefined) dir = 'up';
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 && game.paused == true && (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});
};
rotateToken(token,move,value) {
if (move == undefined) move = 'to';
value = isNaN(parseInt(value)) ? 0 : parseInt(value);
let rotationVal;
if (move == 'by') rotationVal = token.data.rotation + value;
else rotationVal = value;
if (compatibleCore("0.8.1")) token.document.update({rotation: rotationVal});
else token.update({rotation: rotationVal});
}
///////////////////////////////////////////////
/**
* Get name/id
*/
getTokenName(token) {
return token.name;
}
getTokenId(token) {
return token.id;
}
getActorName(token) {
return token.actor.name;
}
getActorId(token) {
return token.actor.id;
}
////////////////////////////////////////////////////
getTokenIcon(token) {
return token.data.img;
}
getActorIcon(token) {
return token.actor.data.img;
}
/***********************************************************************
* System agnostic functions
***********************************************************************/
getHP(token) {
return this.system.getHP(token);
}
getTempHP(token) {
return this.system.getTempHP(token);
}
getAC(token) {
return this.system.getAC(token);
}
getShieldHP(token) {
return this.system.getShieldHP(token);
}
getSpeed(token) {
return this.system.getSpeed(token);
}
getInitiative(token) {
return this.system.getInitiative(token);
}
toggleInitiative(token) {
return this.system.toggleInitiative(token);
}
getPassivePerception(token) {
return this.system.getPassivePerception(token);
}
getPassiveInvestigation(token) {
return this.system.getPassiveInvestigation(token);
}
getAbility(token, ability) {
return this.system.getAbility(token, ability);
}
getAbilityModifier(token, ability) {
return this.system.getAbilityModifier(token, ability);
}
getAbilitySave(token, ability) {
return this.system.getAbilitySave(token, ability);
}
getSkill(token, skill) {
return this.system.getSkill(token, skill);
}
getProficiency(token) {
return this.system.getProficiency(token);
}
/* WFRP 4E */
getFate(token) {
return this.system.getFate(token)
}
/* WFRP 4E */
getFortune(token) {
return this.system.getFortune(token)
}
/* WFRP 4E */
getCriticalWounds(token) {
return this.system.getCriticalWounds(token)
}
/* WFRP 4E */
getCorruption(token) {
return this.system.getCorruption(token)
}
/* WFRP 4E */
getAdvantage(token) {
return this.system.getAdvantage(token)
}
/* WFRP 4E */
getResolve(token) {
return this.system.getResolve(token)
}
/* WFRP 4E */
getResilience(token) {
return this.system.getResilience(token)
}
/**
* Conditions
*/
getConditionIcon(condition) {
return this.system.getConditionIcon(condition);
}
getConditionActive(token,condition) {
return this.system.getConditionActive(token,condition);
}
toggleCondition(token,condition) {
return this.system.toggleCondition(token,condition);
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
return this.system.roll(token,roll,options,ability,skill,save);
}
/**
* Items
*/
getItems(token,itemType) {
return this.system.getItems(token,itemType);
}
getItemUses(item) {
return this.system.getItemUses(item);
}
/**
* Features
*/
getFeatures(token,featureType) {
return this.system.getFeatures(token,featureType);
}
getFeatureUses(item) {
return this.system.getFeatureUses(item);
}
/**
* Spells
*/
getSpells(token,level) {
return this.system.getSpells(token,level);
}
getSpellUses(token,level,item) {
return this.system.getSpellUses(token,level,item);
}
rollItem(item) {
return this.system.rollItem(item);
}
}

172
src/systems/wfrp4e.js Normal file
View File

@@ -0,0 +1,172 @@
import {compatibleCore} from "../misc.js";
export class wfrp4e {
constructor(){
}
getFate(token) {
return token.actor.data.data.status.fate.value
}
getFortune(token) {
return token.actor.data.data.status.fortune.value
}
getWounds(token) {
const wounds = token.actor.data.data.status.wounds
return {
value: wounds.value,
max: wounds.max
}
}
getCriticalWounds(token) {
const criticalWounds = token.actor.data.data.status.criticalWounds
return {
value: criticalWounds.value,
max: criticalWounds.max
}
}
getCorruption(token) {
return token.actor.data.data.status.corruption.value
}
getAdvantage(token) {
return token.actor.data.data.status.advantage.value
}
getResolve(token) {
return token.actor.data.data.status.resolve.value
}
getResilience(token) {
return token.actor.data.data.status.resilience.value
}
getAbility(token, abilityName) {
return this.getCharacteristics(token, abilityName);
}
getCharacteristics(token, characteristicName) {
if (characteristicName == undefined ) characteristicName = `AG`;
const characteristic = token.actor.data.data.characteristics[characteristicName.toLowerCase()]
const val = characteristic.value;
return (val >= 0) ? `+${val}` : val;
}
getFeatures(token,featureType) {
if (featureType == undefined) featureType = 'any';
const allItems = token.actor.items;
if (featureType == 'any') return allItems.filter(i => i.type == 'skill' || i.type == 'talent' || i.type == "career" || i.type == 'trait');
return allItems.filter(i => i.type == featureType);
}
getSpells(token,spellType) {
const allItems = token.actor.items;
return allItems.filter(i => i.type == 'spell')
}
getSpellUses(token,level,item) {
return;
}
getFeatureUses(item) {
return {available: `+${item.data.data.total.value}`};
}
getHP(token) {
return this.getWounds(token);
}
rollItem(item) {
return game.wfrp4e.utility.rollItemMacro(item.name, item.type, false);
}
getSpeed(token) {
return token.actor.data.data.details.move.value;
}
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
for( let effect of token.actor.effects)
await effect.delete();
}
else {
const effect = CONFIG.statusEffects.find(e => e.id === condition);
await token.toggleEffect(effect);
}
return true;
}
roll(token,roll,options,ability,skill,save) {
//console.log("roll(", token, roll, options, ability, skill, save, ")");
if (ability == undefined) ability = 'ag';
return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false);
}
getItems(token,itemType) {
if (itemType == undefined) itemType = 'any';
const allItems = token.actor.items;
if (itemType == 'any') return allItems.filter(i => i.type == 'weapon' ||
i.type == 'ammunition' ||
i.type == 'armour' ||
i.type == 'trapping');
else {
return allItems.filter(i => i.type == itemType);
}
}
getItemUses(item) {
console.log("getItemUses(" , item , ")")
if ( item.type == 'ammunition') {
return {available: item.data.data.quantity.value};
}
else {
return;
}
}
/* this is all cargo-culted in and some of it could be deleted once the interface is resolved
to not be the superset of all possible systems
*/
getAC(token) {
return;
}
getShieldHP(token) {
return;
}
getInitiative(token) {
return;
}
toggleInitiative(token) {
return;
}
getConditionIcon(condition) {
return;
}
getConditionActive(token,condition) {
return;
}
getTempHP(token) {
return;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<style>
.columnLabel {
width:25%;
text-align: left;
}
.columnVersion {
width:15%;
text-align: left;
}
.columnOS {
width:15%;
}
.columnButton {
width:15%;
}
.btn {
width:100%;
}
</style>
<h2>{{localize "MaterialDeck.DownloadUtility.Plugin"}}</h2>
<table style="width:100%; min-width:400px">
<tr>
<th class='columnLabel'></th>
<th class='columnVersion'>{{localize "MaterialDeck.DownloadUtility.Current"}}</th>
<th class='columnVersion'>{{localize "MaterialDeck.DownloadUtility.Minimum"}}</th>
<th class='columnVersion'>{{localize "MaterialDeck.DownloadUtility.Latest"}}</th>
<th class='columnOS'>{{localize "MaterialDeck.DownloadUtility.OS"}}</th>
<th class='columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
</tr>
<tr>
<td class='columnLabel'>{{localize "MaterialDeck.DownloadUtility.SDplugin"}}</td>
<td class='columnVersion'>{{localSdVersion}}</td>
<td class='columnVersion'>{{minimumSdVersion}}</td>
<td class='columnVersion' id='masterSdVersion'>{{masterSdVersion}}</td>
<td class='columnOS'></td>
<td class='columnButton'>
<button type="button" class='btn' id='downloadSd' {{#if sdDlDisable}}disabled{{/if}}>
<i class="fas fa-download"></i>
</button>
</td>
</tr>
<tr>
<td class='columnLabel'>{{localize "MaterialDeck.DownloadUtility.MSserver"}}</td>
<td class='columnVersion'>{{localMsVersion}}</td>
<td class='columnVersion'>{{minimumMsVersion}}</td>
<td class='columnVersion' id='masterMsVersion'>{{masterMsVersion}}</td>
<td class='columnOS'>
<select id="os" default="" {{#if msDlDisable}}disabled{{/if}}>
<option value="win">{{localize "MaterialDeck.DownloadUtility.Windows"}}</option>
<option value="macos">{{localize "MaterialDeck.DownloadUtility.Macos"}}</option>
<option value="linux">{{localize "MaterialDeck.DownloadUtility.Linux"}}</option>
<option value="source">{{localize "MaterialDeck.DownloadUtility.Source"}}</option>
</select>
</td>
<td class='columnButton'>
<button type="button" class='btn' id='downloadMs' {{#if msDlDisable}}disabled{{/if}}>
<i class="fas fa-download"></i>
</button>
</td>
</tr>
</table>
<br>
<h2>{{localize "MaterialDeck.DownloadUtility.Profiles"}}</h2>
<table style="width:100%; min-width:400px">
<tr>
<th style='text-align: left;'>{{localize "MaterialDeck.DownloadUtility.Name"}}</th>
<th class='columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
</tr>
<div id='profileContents'>
{{#each profiles as |p|}}
<tr>
<td>{{p.label}}</td>
<td class='columnButton'>
<button type="button" class='btn' id='dlProfile-{{p.id}}' name='downloadProfile' {{#if ../profileDlDisable}}disabled{{/if}}>
<i class="fas fa-download"></i>
</button>
</td>
</tr>
{{/each}}
</div>
</table>
<button type="button" id='refresh'>
<i class="fas fa-redo"></i>
{{localize "MaterialDeck.DownloadUtility.Refresh"}}
</button>
</form>

View File

@@ -0,0 +1,12 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<p>{{content}}</p>
<div class="form-group">
<label>{{localize "MaterialDeck.Filename"}}: </label>
<input type="text" name="name" value="{{name}}" id="name" style="width:100%;" >
</div>
<button type="submit" name="submit">
<i></i>{{localize "MaterialDeck.Export"}}
</button>
</form>

251
templates/helpMenu.html Normal file
View File

@@ -0,0 +1,251 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<div style="width:1200px">
<h1>Introduction</h1>
Material Deck is a Foundry VTT module that allows you to control certain Foundry functions using an Elgato Stream Deck.
A Stream Deck is a device that has physical buttons with displays behind them. Material Deck uses this to, for example,
control playlists, execute macros, display and control the combat tracker.<br><br>
The module allows a high degree of customization, where each button on the Stream Deck can be assigned any desired function.
Furthermore, it supports folder structures, allowing easy switching between various button configurations so you can easily switch
between the combat tracker, soundboard, or any other (custom) configuration.<br>
<br>
Material Deck is a very large module with tons of features and ways of customizing your experience. This menu will only cover the basics to get you started,
the full documentation can be found on <a href="https://github.com/CDeenen/MaterialDeck/wiki">Github</a>. Please also check the <a href="https://github.com/CDeenen/MaterialDeck/wiki/FAQ">FAQ</a> which answers some common questions, including some basic troubleshooting.<br>
<h1>Latest Releases</h1>
<a href="https://github.com/CDeenen/MaterialDeck/releases">Module</a><br>
<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Stream Deck</a><br>
<a href="https://github.com/CDeenen/MaterialServer/releases">Server</a><br>
You can use the download utility in the module settings to download the Stream Deck plugin, Stream Deck profiles and Material Server.
<h1>Getting Started</h1>
Besides installing this module, you also need to install and run some other things.
<h2>Installing the Stream Deck Software and Plugin</h2>
YOu have to download and install the <a href="https://www.elgato.com/en/gaming/downloads">Stream Deck software</a>.
You then need to install the plugin. There is a delay between when the plugin get's updated and the update being pushed in the store.
If you try to install the plugin right after an update, you might not have the latest version. Manual installation is better in that case.
<br>
<h3>Stream Deck Store</h3>
<ol>
<li>Open the Stream Deck application</li>
<li>Press 'More Actions' in the lower right</li>
<li>Search (top right) or scroll to find Material Deck</li>
<li>Press the 'Install' button</li>
</ol>
<h3>Manually</h3>
<ol>
<li>Download the latest plugin file using the download utility in the module settings, or download it (com.cdeenen.materialdeck.streamDeckPlugin) from <a href="https://github.com/CDeenen/MaterialDeck_SD/releases">here</a></li>
<li>Double-click the file, this should open the Stream Deck software</li>
<li>Press 'Install' in the pop-up</li>
</ol>
<h2>Installing a Stream Deck Profile (optional)</h2>
You can create your own profile, but it is recommended to start with one of the pre-made profiles. Currently, there is a profile for the normal and XL Stream Deck variants.
<ol>
<li>Download the latest plugin file using the download utility in the module settings, or download one (ending with .streamDeckProfile) from <a href="https://github.com/CDeenen/MaterialDeck_SD/releases">here</a></li>
<li>Double-click the file, this should load the profile into the Stream Deck software</li>
</ol>
<h2>Downloading and Starting Material Server</h2>
Material Server acts as a bridge application, bridging the communication between the Stream Deck and Material Deck.
<ol>
<li>Download the latest version for your operating system <a href="https://github.com/CDeenen/MaterialServer/releases">here</a></li>
<li>Download and install the <a href="https://github.com/CDeenen/MaterialServer/blob/master/README.md#prerequisites">prerequisites</a></li>
<li>Extract the archive</li>
<li>Double-click the file to start the server</li>
</ol>
<b>You need to always have Material Server running when you want to use Material Deck</b>
<br>
<br>
After setting up the module settings I suggest you just play around with one of the profiles to see that happens when you press buttons and do things in Foundry.
Most things should be pretty self explanatory. After that you could look into customizing your experience, as you can read about below.
<h1>Module Setup</h1>
<img src="modules/MaterialDeck/wiki/img/ModuleSettings.png" align="right" HSPACE="5" width="450">
There are four buttons at the top:
<ul>
<li>Help</li>
<li>User Permission Configuration</li>
<li>Download Utility</li>
<li>Playlist Configuration</li>
<li>Macro Configuration</li>
<li>Soundboard Configuration</li>
</ul>
The help button leads you to the page you are currently reading, the other buttons will be explained below.<br>
<br>
Below the buttons you will find the following settings:
<ul>
<li><b>Enable Module</b> - Ticking this box enabled the module for the client</li>
<li><b>Material Server Address</b> - Fill in the address of Material Server (usually if you run it on the same computer as
you're using for Foundry, this can be localhost:3001). This is not necessarily the IP address of Foundry! It is the IP
address of the computer that's running Material Server. The default value will work for 99% of people, only change it if
you know what you're doing. More info on Material Server can be found <a href="https://github.com/CDeenen/MaterialServer/blob/master/README.md">here</a></li>
<li><b>Image Cache Size</b> - Sets the amount of images to store in the image cache. The image cache will locally store all images sent to the Stream Deck.
This improves the update speed, but increases memory usage.</li>
<li><b>Image Brightness</b> - Sets the brightness of the default white images for better readibility of the text. If Image Cache Size is large, it'll take a while for
the new brightness setting to be applied. A refresh will give instantaneous results.</li>
<li><b>Number of Connection Warnings</b> - Sets the number of times you will get a warning when Material Deck cannot connect to Material Server. Will be unlimited if set to 0.</li>
</ul>
<BR CLEAR="right" />
<h2>User Permission Configuration</h2>
<img src="modules/MaterialDeck/wiki/img/PermissionConfig.png" align="right" HSPACE="5" width="450">
Using the 'User Permission Configuration' screen, the GM can configure what Material Deck functions users have access to.<br>
Each action has various settings, and these settings can be set for each user role.<br>
<br>
To save the settings, press the 'Save Configuration' button at the lower left, or to set the settings back to the default values, press 'Reset Defaults' in the lower right.<br>
<br>
<BR CLEAR="right" />
<h2>Download Utility</h2>
<img src="modules/MaterialDeck/wiki/img/DownloadUtility.png" align="right" HSPACE="5" width="350">
The download utility allows you to easily check the current version of the Stream Deck plugin and Material Server, and gives you the option to download the latest version.<br>
Please note that the current version of Material Server is at the moment not supported.<br>
<br>
At the bottom you can also download the default profiles from <a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Github</a><div class=""></div><br>
<br>
The refresh button at the bottom refreshes the page in case there was a connection issue.
<BR CLEAR="right" />
<h2>Playlist Configuration</h2>
<img src="modules/MaterialDeck/wiki/img/PlaylistConfig.png" align="right" HSPACE="5" width="350">
The playlist configuration screen configures the playlists that you control using the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Playlist-Action">Playlist action</a>.<br>
There are 2 sections: 'Settings', and 'Playlists'.
<h3><b>Settings</b></h3>
<h4><b>Default Play Mode</b></h4>
The play mode determines what to do when a track is playing, while another track is requested. By setting it to 'Unrestricted', you can play as many tracks at the same time as you want. Setting it to 'One track per playlist' will automatically stop all playing tracks in the playlist, ensuring that only one track is playing at a time. Setting 'Play Method' to 'One track in total' will limit playback to only one track in total.<br>
This setting sets the default play mode, which can be overridden for each separate playlist, which will be discussed below.<br>
<br>
Options:
<ul>
<li><b>Unrestricted</b> - Play as many tracks at the same time as you want</li>
<li><b>One track per playlist</b> - Play only one track per playlist. Trying to start a second track will stop the other tracks in the playlist</li>
<li><b>One track in total</b> - Play only one track in total. Trying to start a second track will stop all other tracks that are playing</li>
</ul>
<b>Note:</b> This play method only applies if tracks are started using the Stream Deck, you can still play more tracks using Foundry's internal audio player.
<h4><b>Number of Playlists</b></h4>
This sets the number of playlists that will be displayed. You can make this number as high or low as you want. This only changes the amount of playlists
that are displayed, not the amount of playlists that can be controlled (there is no upper limit, as long as Foundry doesn't crash).
<h3><b>Playlists</b></h3>
Here you can select which playlists can be controlled with the module. You can manage as many playlists as you've set at 'Number of playlists',
where the playlist number corresponds with the number you have to fill in in the property inspector (see below).<br>
For each playlist you can set the play mode, which overrides the default play mode for that specific playlist.<br>
<br>
<b>Note:</b> While you can assign the same playlist to multiple playlists in this configuration screen, only the play method of the first instance will be applied.
<h2>Macro Configuration</h2>
The Macro Configuration screen is to configure the macroboard for the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Macro-Action">Macro action</a>.<br>
<br>
The screen is divided into 32 boxes, each labeled 'Macro #', where each represents a single macro and its settings. This screen will be refered to as a page.
By pressing the arrows at the top right and top left, you can go to the next or previous page. There is no limit to the amount of pages you can add, but if you
have a lot of pages, at some point you might notice some performance issues.<br>
<br>
For each macro there are 3 options:
<ul>
<li><b>Macro Selection</b> - Drop down menu from where you can select a macro from your macro directory</li>
<li><b>Furnace Arguments</b> - Allows you to use arguments if <a href="https://foundryvtt.com/packages/furnace/">the Furnace</a> is installed. Please read the
documentation regarding advanced macros in the <a href="https://github.com/League-of-Foundry-Developers/fvtt-module-furnace#advanced-macros">README</a> of the Furnace.
If, for example, you wanted to execute a macro named 'My Macro' with the arguments 'argument1 argument2 argument3', you would use for example /"My Macro" 100 50 "test"
in the chat. In the macro configuration screen you would only fill in the arguments, so: 100 50 "test"</li>
<li><b>Background</b> - Color picker to set the background color of the Stream Deck button</li>
</ul>
<br>
At the bottom you have the following buttons:
<ul>
<li><b>Clear Page</b> - Clears all the macros on the current page. Please note that this is irreversible.</li>
<li><b>Clear All</b> - Clears all the macros. Please note that this is irreversible.</li>
<li><b>Import</b> - Import the macroboard from a file. This will override your current macroboard, and is irreversible.</li>
<li><b>Export</b> - Export your macroboard to a file.</li>
</ul>
When importing and exporting, you only import/export the metadata, not the actual macros. This means that you need to have the same macros in both the source and target Foundry client,
or you might run into issues.
<img src="modules/MaterialDeck/wiki/img/MacroConfig.png" align="center" HSPACE="5" width="100%">
<h2>Soundboard Configuration</h2>
The Soundboard Configuration screen is used to configure the soundboard for the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Soundboard-Action">Soundboard action</a>.<br>
<br>
Similar to the Macro Configuration screen, the screen is divided into boxes, each labeled 'Sound #', where each represents a single sound and its settings. This screen will be refered to as a page.
By pressing the arrows at the top right and top left, you can go to the next or previous page. There is no limit to the amount of pages you can add, but if you
have a lot of pages, at some point you might notice some performance issues.<br>
<br>
For each sound there are multiple options:
<ul>
<li><b>Name</b> - The name of the sound, this is the name that will be displayed on the SD button if 'Display Name' is selected in the property inspector.
This name doesn't have to correspond with the file name of the sound, or the name that can be seen in the Foundry playlist.</li>
<li><b>Playlist</b> - Sets the playlist from which you want to select a sound. If you select 'File Picker', a file picker will appear instead of the sound selection drop-down menu.</li>
<li><b>Sound</b> - This is either a drop-down menu where you can select a sound from the selected playlist, or a file picker.
When using the file picker, it is possible to use wildcard names, this means that you can randomly play a sound from a selection. To do this, navigate to the folder that
contains the sounds, in the textbox append the folder name with the common part of the name of the sounds you want to play, followed by an asterisk.
For example, if you have the sounds 'Thunder.wav', 'Thunder2.wav' and 'Thunder3.wav' in the folder 'Assets', you could fill in the following: 'Assets/Thunder*', which
will play one of the three sounds randomly when you press the button on the Stream Deck.</li>
<li><b>Icon</b> - Here you can select an icon that will be displayed on the SD button if 'Display Icon' is selected in the property inspector.
Please read <a href="https://github.com/CDeenen/MaterialDeck/wiki/Getting-Started#important-notes-on-foundry-assigned-text-and-icons">these</a> notes on rules regarding icon selection.</li>
<li><b>On</b> - Clicking the colored box you'll be presented with a color picker. This sets the color of the ring that's shown on the button when the sound is playing.</li>
<li><b>Off</b> - Clicking the colored box you'll be presented with a color picker. This sets the color of the ring that's shown on the button when the sound is not playing.</li>
<li><b>Playback</b> - This sets the playback mode, you can select from:
<ul>
<li>Once - Play the sound once</li>
<li>Repeat - Play the sound on repeat</li>
<li>Hold - Play the sound as long as the button is held down</li>
</ul>
</li>
<li><b>Volume</b> - The playback volume of the sound. The final playback volume is also determined by the Interface Volume slider in Foundry's 'Audio Playlists' tab.</li>
</ul>
<br>
At the bottom you have the following buttons:
<ul>
<li><b>Clear Page</b> - Clears all the sounds on the current page. Please note that this is irreversible.</li>
<li><b>Clear All</b> - Clears all the sounds. Please note that this is irreversible.</li>
<li><b>Import</b> - Import the soundboard from a file. This will override your current soundboard, and is irreversible.</li>
<li><b>Export</b> - Export your soundboard to a file.</li>
</ul>
When importing and exporting, you only import/export the metadata, not the actual audio files. This means that you need to have the same audio files in the same relative location in both the source and target Foundry client,
or you might run into issues.
<img src="modules/MaterialDeck/wiki/img/SoundboardConfig.png" align="center" HSPACE="5" width="100%">
<h1>Customization</h1>
Material Deck is extremely flexible, but most of this flexibility must be performed in the Stream Deck software.<br>
Some basic instructions on using the software can be found <a href="https://github.com/CDeenen/MaterialDeck/wiki/Getting-Started#basic-stream-deck-setup-instructions">here</a>.<br>
<br>
Some of the things you can change are:
<ul>
<li><b>Button location</b> - You can drag buttons around into any order you want</li>
<li><b>Changing button text and icon</b> - All the text and icons on the Stream Deck can be customized, see <a href="https://github.com/CDeenen/MaterialDeck/wiki/Getting-Started#changing-the-button-text-and-icon">here</a></li>
<li><b>Customize the behavior of buttons</b> - See below</li>
</ul>
All the buttons have many settings to fine-tune your experience. Due to the large amount of things you can change, they will not be discussed here, instead you can read about it at the following links:
<ul>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Combat-Tracker-Action">Combat Tracker Action</a></li>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/External-Modules">External Modules</a></li>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Macro-Action">Macro Action</a></li>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Other-Actions">Other Actions</a></li>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Playlist-Action">Playlist Action</a></li>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Scene-Action">Scene Action</a></li>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Soundboard-Action">Soundboard Action</a></li>
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Token-Action">Token Action</a></li>
</ul>
<h1>Feedback</h1>
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.
<h1>Credits</h1>
<b>Author:</b> Cristian Deenen (Cris#6864 on Discord)<br>
<br>
Special thanks to Asmodeus#7588 who made this module possible by generously donating a Stream Deck XL
<br>
Please consider supporting me on <a href="https://www.patreon.com/materialfoundry">Patreon</a>, and feel free to join the Material Foundry <a href="https://discord.gg/3hd4G6TkmA">Discord</a> server.
</div>
</form>

View File

@@ -0,0 +1,13 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<p>{{content}}</p>
<p><b>{{ localize "MaterialDeck.ImportDialog.Warning" }}</b></p>
<div class="form-group upload-file">
<label><i class="fas fa-upload fa-fw"></i> {{ localize "FILES.Upload" }}</label>
<input type="file" name="upload" id="uploadJson">
</div>
<button type="submit" name="submit">
<i></i>{{localize "MaterialDeck.Import"}}
</button>
</form>

Some files were not shown because too many files have changed in this diff Show More