67 Commits

Author SHA1 Message Date
Cristian Deenen
2cfa8c3ac9 v1.5.1 2023-06-28 02:19:40 +02:00
Cristian Deenen
b07f0a6454 v1.5.0 2023-05-28 13:50:41 +02:00
Cristian Deenen
631fdbcccb v1.4.12 2022-09-07 04:55:51 +02:00
Cristian Deenen
9a7088a310 v1.4.11 2022-09-05 01:42:15 +02:00
Material Foundry
033a7351e4 Merge pull request #97 from kyamsil/update_pf2e_3.8.2
Updating pf2e again
2022-09-01 03:14:07 +02:00
kyamsil
be7f837f7d Updating pf2e again 2022-06-12 20:24:30 +01:00
Cristian Deenen
79cfc5769a v1.4.10 2022-05-30 02:06:57 +02:00
Cristian Deenen
fc7dcff3b0 version check hotfix 2022-05-29 16:09:14 +02:00
Cristian Deenen
abb883c8b8 Starfinder conditions fix 2022-04-19 12:31:45 +02:00
Cristian Deenen
8cf974455a v1.4.9 2022-04-16 04:29:57 +02:00
Material Foundry
e7e9b84227 Merge pull request #95 from kyamsil/update_pf2e_3.8.2
Fixed rolls and conditions to work with latest pf2e version
2022-04-16 00:13:00 +02:00
kyamsil
108c955ac2 Revamped Spellbook handling and clicking for all types 2022-04-11 02:31:35 +01:00
kyamsil
4d320a5f6c Added color ring based on proficiency levels for skills and saves (pf2e and dnd5e) 2022-04-08 20:26:33 +01:00
kyamsil
ccacd3e26e Changed initiative rolling so it adds to combat without dialog 2022-04-07 23:03:48 +01:00
kyamsil
d3c2c6465d Some clean up and checks for special types of actors 2022-04-07 03:00:51 +01:00
kyamsil
bc0804bc08 Fixed rolls and conditions to work with latest pf2e version 2022-04-06 21:36:48 +01:00
CDeenen
49bc188dde v1.4.8 2021-12-22 23:04:06 +01:00
CDeenen
dce419d7c3 v1.4.7 2021-12-20 03:41:38 +01:00
Material Foundry
4566b8ef53 Merge pull request #91 from ElfFriend-DnD/Master
chore: update gm screen api call
2021-12-17 02:03:59 +01:00
Material Foundry
1f55b324c5 Merge pull request #85 from InnerGI/patch-1
Fixing undefined device when looping over buttonContext.
2021-12-17 02:03:39 +01:00
Material Foundry
a6a6cd170e Merge pull request #84 from JackDCondon/Master
Forbidden Lands System
2021-12-17 02:03:10 +01:00
Andrew Krigline
cc8588bf4d chore: update gm screen api call 2021-11-23 09:57:34 -05:00
Logan Marin
117a1fb59d Fixing undefined device when looping over buttonContext. 2021-10-23 21:48:13 -05:00
Jack Condon
888a2971fb Support for monster attack and raw item quantity. 2021-10-19 01:21:04 +11:00
Jack Condon
c74d27610a Push Finished Forbidden Lands,
All stats have been added into the rolling
2021-10-19 00:48:01 +11:00
Jack Condon
f4d02cf296 Added System doc
System doc added and it loads
2021-10-17 00:16:34 +11:00
CDeenen
874d9c8fb6 v1.4.6 2021-09-07 22:49:16 +02:00
Material Foundry
66b8406615 Merge pull request #81 from kyamsil/pf2e_refresh
Pf2e refresh
2021-09-07 22:24:44 +02:00
kyamsil
e6c54a2b13 Fix FlatFooted condition handling 2021-09-06 03:53:22 +01:00
kyamsil
c01f9ec566 Added support for Lore Skills, Perception and Initiative. Additional skill and saves icons 2021-08-25 23:10:39 +01:00
kyamsil
7bd06d7797 Cleanup 2021-08-03 00:51:51 +01:00
kyamsil
2fd5f81891 Adding management of actions and strikes 2021-08-03 00:42:26 +01:00
kyamsil
e8df118ce1 Defaulting to rollItemMacro. Fixes for spell and spell uses 2021-08-02 01:42:55 +01:00
kyamsil
6e22fef160 Merge branch 'Master' into pf2e_refresh 2021-08-01 22:57:28 +01:00
kyamsil
3a52ed28b4 Change the way conditions with values are handled 2021-08-01 22:48:08 +01:00
CDeenen
6c840cbf59 v1.4.5 2021-07-30 00:07:58 +01:00
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
86 changed files with 9379 additions and 3323 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: ''
---

45
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Release Creation
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# get part of the tag after the `v`
- name: Extract tag version number
id: get_version
uses: battila7/get-version-action@v2
# Substitute the Manifest and Download URLs in the module.json
- name: Substitute Manifest and Download Links For Versioned Ones
id: sub_manifest_link_version
uses: microsoft/variable-substitution@v1
with:
files: 'module.json'
env:
version: ${{steps.get_version.outputs.version-without-v}}
url: https://github.com/${{github.repository}}
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip
# Create a zip file with all files required by the module to add to the release
- run: zip -r ./module.zip MaterialDeck.js module.json README.md DEVGUIDE.md changelog.md css/ wiki/ img/ lang/ src/ templates/
# Create a release for this specific version
- name: Update Release with Files
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true # Set this to false if you want to prevent updating existing releases
name: ${{ github.event.release.name }}
draft: ${{ github.event.release.unpublished }}
prerelease: ${{ github.event.release.prerelease }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json, ./module.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}

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, or use template.js; 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,18 +1,18 @@
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 {compatibleCore} from "./src/misc.js";
import { registerSettings } from "./src/settings.js";
import { StreamDeck } from "./src/streamDeck.js";
import { TokenControl } from "./src/actions/token.js";
import { MacroControl } from "./src/actions/macro.js";
import { CombatTracker } from "./src/actions/combattracker.js";
import { PlaylistControl } from "./src/actions/playlist.js";
import { SoundboardControl } from "./src/actions/soundboard.js";
import { OtherControls } from "./src/actions/othercontrols.js";
import { ExternalModules } from "./src/actions/external.js";
import { SceneControl } from "./src/actions/scene.js";
import { downloadUtility, compareVersions, compatibleCore } from "./src/misc.js";
import { TokenHelper } from "./src/systems/tokenHelper.js";
export var streamDeck;
export var tokenControl;
var move;
export var macroControl;
export var combatTracker;
export var playlistControl;
@@ -20,24 +20,20 @@ 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 gamingSystem = "dnd5e";
export let hotbarUses = false;
export let calculateHotbarUses;
export let sdVersion;
export let msVersion;
let ready = false;
let controlTokenTimer;
let updateDialog;
export let minimumMSversion;
export let minimumSDversion;
//CONFIG.debug.hooks = true;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Global variables
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
export var enableModule;
//Websocket variables
@@ -46,7 +42,8 @@ let wsOpen = false; //Bool for checking if websocket has ever been o
let wsInterval; //Interval timer to detect disconnections
let WSconnected = false;
//let furnace = game.modules.get("furnace");
//CONFIG.debug.hooks = true;
/*
* Analyzes the message received
@@ -58,53 +55,70 @@ async function analyzeWSmessage(msg){
const data = JSON.parse(msg);
//console.log("Received",data);
if (data.type == "connected" && data.data == "SD"){
const msg = {
target: "SD",
type: "init",
system: game.system.id
if ((data.type == "connected" || data.type == "version") && data.data == "SD"){
transmitInitData();
let sdNok = false;
let msNok = false;
if (data.MSversion) {
msVersion = data.MSversion;
if (!compareVersions(minimumMSversion,msVersion)) {
msNok = true;
}
}
ws.send(JSON.stringify(msg));
if (data.SDversion) {
sdVersion = data.SDversion;
if (!compareVersions(minimumSDversion,sdVersion)) {
sdNok = true;
}
}
if (msNok || sdNok) {
let content = '';
if (sdNok && msNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.Both")}<br><br>`;
else if (sdNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.SD")}<br><br>`;
else if (msNok) content += `${game.i18n.localize("MaterialDeck.UpdateRequired.MS")}<br><br>`;
console.log("streamdeck connected to server");
content += `${game.i18n.localize("MaterialDeck.UpdateRequired.Update")}<br><br>`;
if (sdNok) content += `<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">${game.i18n.localize("MaterialDeck.UpdateRequired.SDdownload")}</a><br>`;
if (msNok) content += `<a href="https://github.com/CDeenen/MaterialServer/releases">Material Server</a><br>`;
content += "<br>"
const myDialog = new Dialog({
title: game.i18n.localize("MaterialDeck.UpdateRequired.Title"),
content,
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"
}).render(true);
}
console.log("streamdeck connected to server", msVersion);
streamDeck.resetImageBuffer();
}
if (data.type == "version" && data.source == "SD") {
const minimumSDversion = game.modules.get("MaterialDeck").data.minimumSDversion.replace('v','');
const minimumMSversion = game.modules.get("MaterialDeck").data.minimumMSversion;
if (data.version < minimumSDversion) {
let d = new Dialog({
title: "Material Deck: Update Needed",
content: "<p>The Stream Deck plugin version you're using is v" + data.version + ", which is outdated.<br>Update to v" + minimumSDversion + " or newer.</p>",
buttons: {
download: {
icon: '<i class="fas fa-download"></i>',
label: "Update",
callback: () => window.open("https://github.com/CDeenen/MaterialDeck_SD/releases")
},
ignore: {
icon: '<i class="fas fa-times"></i>',
label: "Ignore"
}
},
default: "download"
});
d.render(true);
}
if (data.type == 'newDevice') {
streamDeck.newDevice(data.iteration,data.device);
return;
}
if (data == undefined || data.payload == undefined) return;
//console.log("Received",data);
const action = data.action;
const event = data.event;
const context = data.context;
const coordinates = data.payload.coordinates;
const settings = data.payload.settings;
const device = data.device;
const name = data.deviceName;
const type = data.deviceType;
if (data.data == 'init'){
@@ -112,14 +126,14 @@ async function analyzeWSmessage(msg){
if (event == 'willAppear' || event == 'didReceiveSettings'){
if (coordinates == undefined) return;
streamDeck.setScreen(action);
await streamDeck.setContext(device,data.size,data.deviceIteration,action,context,coordinates,settings);
await streamDeck.setContext(device,data.size,data.deviceIteration,action,context,coordinates,settings,name,type);
if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
if (action == 'token'){
tokenControl.active = true;
tokenControl.update(device,selectedTokenId,device);
tokenControl.pushData(canvas.tokens.controlled[0]?.id,settings,context,device);
}
else if (action == 'move')
move.update(settings,context,device);
else if (action == 'macro')
macroControl.update(settings,context,device);
else if (action == 'combattracker')
@@ -142,10 +156,10 @@ async function analyzeWSmessage(msg){
}
else if (event == 'keyDown'){
if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
if (action == 'token')
tokenControl.keyPress(settings);
else if (action == 'move')
move.keyPress(settings);
else if (action == 'macro')
macroControl.keyPress(settings);
else if (action == 'combattracker')
@@ -163,6 +177,8 @@ async function analyzeWSmessage(msg){
}
else if (event == 'keyUp'){
if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
if (action == 'soundboard'){
soundboard.keyPressUp(settings);
}
@@ -190,6 +206,7 @@ function startWebsocket() {
}
ws.onopen = function() {
messageCount = 0;
WSconnected = true;
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+address);
wsOpen = true;
@@ -198,12 +215,7 @@ function startWebsocket() {
module: "MD"
}
ws.send(JSON.stringify(msg));
const msg2 = {
target: "SD",
type: "init",
system: game.system.id
}
ws.send(JSON.stringify(msg2));
transmitInitData();
clearInterval(wsInterval);
wsInterval = setInterval(resetWS, 5000);
}
@@ -211,15 +223,55 @@ function startWebsocket() {
clearInterval(wsInterval);
wsInterval = setInterval(resetWS, 10000);
}
let messageCount = 0;
function transmitInitData() {
const msg = {
target: "SD",
type: "init",
system: getGamingSystem(),
systemData: {
conditions: tokenHelper.getConditionList(),
abilities: tokenHelper.getAbilityList(),
saves: tokenHelper.getSavesList(),
skills: tokenHelper.getSkillList(),
itemTypes: tokenHelper.getItemTypes(),
weaponRollModes: tokenHelper.getWeaponRollModes(),
featureTypes: tokenHelper.getFeatureTypes(),
spellLevels: tokenHelper.getSpellLevels(),
spellTypes: tokenHelper.getSpellTypes(),
stats: tokenHelper.getStatsList(),
onClick: tokenHelper.getOnClickList(),
rollTypes: tokenHelper.getRollTypes(),
attackModes: tokenHelper.getAttackModes()
},
coreVersion: game.version.split('.')[0]
}
ws.send(JSON.stringify(msg));
}
/**
* Try to reset the websocket if a connection is lost
*/
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){
@@ -242,31 +294,68 @@ export function getPermission(action,func) {
else return settings.permissions?.[action]?.[func]?.[role];
}
function getGamingSystem() {
const systemOverride = game.settings.get(moduleName,'systemOverride');
gamingSystem = (systemOverride == undefined || systemOverride == null || systemOverride == '') ? game.system.id : systemOverride;
return gamingSystem;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Hooks
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
async function enableSettingDialog() {
return new Promise((resolve, reject) => {
const dialog = new Dialog({
title: game.i18n.localize("MaterialDeck.EnableDialog.Title"),
content: game.i18n.localize("MaterialDeck.EnableDialog.Content"),
buttons: {
yes: { label: game.i18n.localize("MaterialDeck.EnableDialog.Yes"), callback: () => { resolve('yes') } },
no: { label: game.i18n.localize("MaterialDeck.EnableDialog.No"), callback: () => { resolve('no') } },
},
default: 'no',
close: () => { reject() }
});
dialog.render(true);
});
}
/**
* Ready hook
* Attempt to open the websocket
*/
Hooks.once('ready', async()=>{
registerSettings();
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
await registerSettings();
if (game.settings.get(moduleName, 'Enable')) game.settings.set(moduleName,'EnableDialogShown',true);
else if (!game.settings.get(moduleName,'EnableDialogShown')) {
const response = await enableSettingDialog();
await game.settings.set(moduleName,'EnableDialogShown',true);
if (response == "yes") await game.settings.set(moduleName, 'Enable', true);
else await game.settings.set(moduleName, 'Enable', false);
}
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
getGamingSystem();
minimumMSversion = game.modules.get(moduleName).flags.minimumMSVersion;
minimumSDversion = game.modules.get(moduleName).flags.minimumPluginVersion;
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);
@@ -314,8 +403,36 @@ Hooks.once('ready', async()=>{
});
for (let i=0; i<64; i++)
activeSounds[i] = false;
if (game.user.isGM) {
let soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
let macroSettings = game.settings.get(moduleName, 'macroSettings');
let array = [];
for (let i=0; i<64; i++) array[i] = "";
let arrayVolume = [];
for (let i=0; i<64; i++) arrayVolume[i] = "50";
let arrayZero = [];
for (let i=0; i<64; i++) arrayZero[i] = "0";
if (macroSettings.color == undefined){
game.settings.set(moduleName,'macroSettings',{
macros: array,
color: arrayZero
});
}
const settings = {
playlist: "",
sounds: array,
colorOn: arrayZero,
colorOff: arrayZero,
mode: arrayZero,
toggle: arrayZero,
volume: arrayVolume
};
if (soundBoardSettings.colorOff == undefined){
game.settings.set(moduleName,'soundboardSettings',settings);
}
}
if (enableModule == false) return;
if (getPermission('ENABLE') == false) {
@@ -325,70 +442,60 @@ Hooks.once('ready', async()=>{
startWebsocket();
let soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
let macroSettings = game.settings.get(moduleName, 'macroSettings');
let array = [];
for (let i=0; i<64; i++) array[i] = "";
let arrayVolume = [];
for (let i=0; i<64; i++) arrayVolume[i] = "50";
let arrayZero = [];
for (let i=0; i<64; i++) arrayZero[i] = "0";
if (macroSettings.color == undefined){
game.settings.set(moduleName,'macroSettings',{
macros: array,
color: arrayZero
});
}
if (soundBoardSettings.colorOff == undefined){
game.settings.set(moduleName,'soundboardSettings',{
playlist: "",
sounds: array,
colorOn: arrayZero,
colorOff: arrayZero,
mode: arrayZero,
toggle: arrayZero,
volume: arrayVolume
});
}
const hotbarUsesTemp = game.modules.get("illandril-hotbar-uses");
if (hotbarUsesTemp != undefined) {
hotbarUses = true;
}
if (hotbarUsesTemp != undefined) hotbarUses = true;
});
Hooks.on('updateToken',(scene,token)=>{
function updateActor(id) {
const token = tokenHelper.getTokenFromActorId(id)
tokenControl.update(token.id);
}
Hooks.on('updateToken',(document,changes)=>{
if (enableModule == false || ready == false) return;
let tokenId = token._id;
if (tokenId == selectedTokenId)
tokenControl.update(selectedTokenId);
let tokenId = changes._id;
if (tokenId == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
if (macroControl != undefined) macroControl.updateAll();
if (changes.hidden != undefined && combatTracker != undefined) combatTracker.updateAll();
});
Hooks.on('updateActor',(actor)=>{
if (enableModule == false || ready == false) return;
updateActor(actor.id);
if (macroControl != undefined) macroControl.updateAll();
});
Hooks.on('updateActor',(scene,actor)=>{
Hooks.on('createActiveEffect',(data)=>{
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 (macroControl != undefined) macroControl.updateAll();
updateActor(data.parent.id);
return;
});
Hooks.on('deleteActiveEffect',(data)=>{
if (enableModule == false || ready == false) return;
updateActor(data.parent.id);
return;
});
Hooks.on('onActorSetCondition',(data)=>{
if (enableModule == false || ready == false) return;
updateActor(data.actor.id);
return;
});
Hooks.on('controlToken',(token,controlled)=>{
if (enableModule == false || ready == false) return;
if (controlled) {
selectedTokenId = token.data._id;
tokenControl.update(token.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();
});
@@ -397,22 +504,26 @@ Hooks.on('updateOwnedItem',()=>{
})
Hooks.on('renderHotbar', (hotbar)=>{
if (compatibleCore("0.8.1")) return;
if (enableModule == false || ready == false) return;
if (macroControl != undefined) macroControl.hotbar(hotbar.macros);
});
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;
if (combatTracker != undefined) combatTracker.updateAll();
if (tokenControl != undefined) 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)=>{
@@ -426,6 +537,16 @@ Hooks.on('closeplaylistConfigForm', (form)=>{
playlistControl.updateAll();
});
Hooks.on('updatePlaylistSound', ()=>{
if (enableModule == false || ready == false) return;
if (playlistControl != undefined) playlistControl.updateAll();
});
Hooks.on('lightingRefresh',()=>{
if (enableModule == false || ready == false) return;
if (tokenControl != undefined) tokenControl.update();
});
Hooks.on('pauseGame',()=>{
if (enableModule == false || ready == false) return;
otherControls.updateAll();
@@ -439,6 +560,10 @@ Hooks.on('renderSidebarTab',(app)=>{
if (enableModule == false || ready == false) return;
if (otherControls != undefined) otherControls.updateAll(options);
if (sceneControl != undefined) sceneControl.updateAll();
if (document.getElementsByClassName("roll-type-select")[0] != undefined)
document.getElementsByClassName("roll-type-select")[0].addEventListener('change',function(){
if (otherControls != undefined) otherControls.updateAll(options);
})
});
Hooks.on('closeSidebarTab',(app)=>{
@@ -469,7 +594,7 @@ Hooks.on('renderSceneControls',()=>{
Hooks.on('targetToken',(user,token,targeted)=>{
if (enableModule == false || ready == false) return;
if (token.id == selectedTokenId) tokenControl.update(selectedTokenId);
if (token.id == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
});
Hooks.on('sidebarCollapse',()=>{
@@ -528,21 +653,55 @@ Hooks.on('NotYourTurn', ()=>{
externalModules.updateAll();
})
Hooks.on('pseudoclockSet', ()=>{
Hooks.on('simple-calendar-date-time-change', ()=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll();
})
Hooks.on('about-time.clockRunningStatus', ()=>{
Hooks.on('simple-calendar-clock-start-stop', ()=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll();
})
Hooks.on('updateTile',()=>{
if (enableModule == false || ready == false) return;
externalModules.updateAll();
});
Hooks.once('init', ()=>{
//CONFIG.debug.hooks = true;
//registerSettings(); //in ./src/settings.js
});
Hooks.once('canvasReady',()=>{
ready = true;
});
});
Hooks.on("soundscape", (data) => {
externalModules.newSoundscapeData(data);
});
Hooks.on("globalAmbientVolumeChanged", (volume) => {
soundboard.ambientVolumeChanged(volume);
})
Hooks.on('updateMacro', () => {
if (enableModule == false || ready == false || macroControl == undefined) return;
macroControl.updateAll();
})
Hooks.on('globalPlaylistVolumeChanged', () => {
if (enableModule == false || ready == false || otherControls == undefined) return;
otherControls.updateAll();
})
Hooks.on('globalAmbientVolumeChanged', () => {
if (enableModule == false || ready == false || otherControls == undefined) return;
otherControls.updateAll();
})
Hooks.on('globalInterfaceVolumeChanged', () => {
if (enableModule == false || ready == false || otherControls == undefined) return;
otherControls.updateAll();
})

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.9<br>
<b>Foundry VTT:</b> v10 - v11<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,20 +1,310 @@
# Changelog Material Deck Module
### v1.4.0
### v1.5.1 - 28-06-2023
Fixes:
<ul>
<li>Token Action => Toggle Condition: Fixed PF2e conditions</li>
<li>Macro Action => Macro by name: Fixed macro arguments not working in v10</li>
<li>Download Utility: Latest module version is now displayed correctly</li>
</ul>
Additions:
<ul>
<li>Other Actions => Open Journal: Added option to open journal pages by page name or number</li>
<li>Playlist Action: Added option to select playlists and tracks by name</li>
</ul>
### v1.5.0 - 28-05-2023
Additions:
<ul>
<li>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>
<li>Most settings in the plugin are now hyperlinks. Clicking them opens a window opening the relevant section on the wiki describing that setting.</li>
<li>Token Action => Stats: Added support for simple if-statements in the custom stats function</li>
<li>(dnd5e) Token Action => Added option to filter spells by preparedness</li>
<li>Added an 'Icon Override' option to each action. Filling in a path to an icon on your Foundry server will make the button use that icon instead of the default one</li>
<li>Added a one-time popup asking users if they want to enable the module for their client. This should hopefully solve one of the most common connection issues</li>
<li>Token Action: Added background color option for items, abilities and spells</li>
<li>Added the current and latest module version to the download utility</li>
<li>Combat Tracker: Added option to filter combatants in order to not display neutral, hostile or hidden tokens</li>
<li>Macro Action => Macroboard: Added a label to each macro. By default this is the name of the macro, but this can be edited to your liking. If 'Display Name/Label' is selected in the SD app, the label will be displayed. This allows you to distinguish macros when the same macro is used for multiple functions (using macro arguments)</li>
<li>(dnd5e) Other: Added 'Attack Roll Modes' where you can configure weapon rolls to roll for 'to hit', 'damage', 'crit damage', etc</li>
<li>Scene Action: Added option to specify a ring color for the active scene</li>
<li>Other Controls => Darkness Control: Added animation time option for 'Transition to Day/Night'</li>
<li>Other Controls: Added 'Global Volume Controls' to control the playlist, ambient and interface volume</li>
</ul>
Fixes:
<ul>
<li>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>
<li>External Modules => Monk's Active Tile Triggers: Was no longer working, should now be fixed</li>
<li>Soundboard: Changing the 'Ambient' volume slider now instantaneously changes the volume of any currently playing sounds</li>
<li>Token Action => On Click => Handle Condition: Fixed some issues with conditions not being there or not working</li>
<li>Token Action => On Click: Fixed item offset</li>
<li>Fixed issue where long text would result in an error if Foundry was set to Russian</li>
<li>Macro Action => Macroboard: Arguments are stored again</li>
<li>Macro Action: Arguments were broken due to an update to Advanced Macros, this is now fixed</li>
<li>Macro Action: Fixed issue with icons on SD turning black when changing the icon in Foundry or moving the macro on the macrobar</li>
<li>Playlist Action: Playlist with shuffle enabled now play shuffled</li>
<li>Other => Control Buttons: Changing controls now loads the correct canvas layer</li>
<li>Combat Tracker: Token image, name and stats would not always display (if a new Combat Tracker action was created without changing 'Mode')</li>
</ul>
Other:
<ul>
<li>Made compatible with Foundry v11, dropped compatibility with Foundry v9</li>
<li>Moved most of the system-dependent code from the plugin to the module. This makes implementing new system or modifying/fixing current systems easier. It also automates some stuff (for example grabbing all conditions from Foundry instead of hardcoding them)</li>
<li>External Modules => About Time: Has been replaced with 'Simple Calendar' since About Time no longer functions as time/calendar management. It still functions exactly the same</li>
<li>External Modules => Mook AI: Has been removed since the module hasn't been updated for Foundry v10 or v11</li>
<li>Changed the logo in the Stream Deck app from the Foundry VTT logo to the Material Foundry logo</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2+ (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.5.0 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.4.12 - 07-09-2022
Fixes:
<ul>
<li>Some settings did not have a default value, which caused errors for new users in v10</li>
</ul>
### v1.4.11 - 05-09-2022
Fixes:
<ul>
<li>Fixed system autodetection bug, where it would not always correctly detect the system</li>
<li>Token Action => Stats/On Click: Pf2e intimidation did not work</li>
<li>Playlist Action => Fix unrestricted playback and 'play playlist'</li>
<li>User Config: Fix settings saving issue</li>
</ul>
Additions:
<ul>
<li>Token Action => Inventory: Added roll options to roll for to hit and damage (dnd5e only)</li>
<li>Token Action => Inventory/Features/Spellbook: Select by name or id</li>
<li>Token Action => Features: Added option to filter active and passive abilities (dnd5e only)</li>
<li>Token Action => Items/Spells/Features: Add offset options</li>
<li>Token Action => OnClick => SetVision: Added checkboxes to configure what settings should be changed</li>
<li>Combat Tracker => Function: Added option to roll initiative for combatants</li>
<li>Combat Tracker => OnClick: Added target and untarget token option</li>
<li>Other Actions => Darkness Control: Added 'Transition to Day' and 'Transition to Night' options</li>
<li>Other Actions => Darkness Control: Added animation time option for darkness changes</li>
</ul>
Other:
<ul>
<li>Made compatible with Foundry v10 (see notes below), dropped compatibility with Foundry v8</li>
<li>Token Action => On Click => Call Macro: Removed macro target, since I can't get it to work properly</li>
<li>Token Action => On Click => Movement: Tokens now snap to the grid when moved</li>
<li>Token Action => OnClick => SetVision: update configuration to v9/v10 standards</li>
<li>Token Action => Handle Conditions: Removed the increase/decrease option for all systems but pf2e (it only works in pf2e)</li>
<li>System Override: Changed to a dropdown menu with all supported systems, instead of a string field</li>
<li>All ui elements and classes have been given unique identifiers to prevent module incompatibilities</li>
</ul>
V10 Compatibility Notes:
<ul>
<li>The following systems have been tested in v10: dnd5e, pf1e, forbidden lands, wfrp4. Other systems have not been updated to v10 yet at the time of this update</li>
<li>Changing the token vision mode through MD does not work properly, appears to be a bug in Foundry</li>
<li>Wildcard images currently don't seem to work in v10, so they have not been tested</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.4.11 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.4.10 - 30-05-2022
Fixes:
<ul>
<li>Stream Deck plugin v1.4.10 was not properly recognized as compatible</li>
</ul>
Additions:
<ul>
<li>Material Server version is now displayed in the Download Utility (MS v1.1.0+)</li>
</ul>
### v1.4.9 - 16-04-2022
Fixes:
<ul>
<li>PF2e: Fixed rolls and conditions for compatibility with latest pf2e version. Thanks to Kyamsil</li>
<li>Token Action => Set Vison: Setting light is working again</li>
<li>Other Actions => Roll Dice: Roll result would show as 'NaN' in Foundry v9, this is fixed</li>
</ul>
Additions:
<ul>
<li>Added support for the Starfinder system</li>
<li>External Modules => Added support for 'Monks Active Tile Triggers'</li>
<li>Added 'System Override' module setting. If your system is not supported, MD defaults to 5e. Here you can choose a supported system that is most similar to yours and have Material Deck use that system instead.</li>
<li>Token Action => Displayed Stats: A colored border is drawn around certain skills, saves, etc to indicate proficiency (compatible systems: dnd5e, pf2e). Thanks to Kyamsil</li>
</ul>
### v1.4.8 - 22-12-2021
Fixes:
<ul>
<li>'Device Configuration' would not save its settings properly</li>
</ul>
### v1.4.7 - 20-12-2021
Fixes:
<ul>
<li>External Modules => GM Screen: Changed to new api (thanks to akrigline)</li>
<li>Fixed an issue where SDs would not iterate properly, causing errors (thanks to InnerGI)</li>
<li>Fixed support for FXMaster. Requires FXMaster v2.0.0 or later (not officially released yet)</li>
</ul>
Additions:
<ul>
<li>Added compatibility for Foundry V0.9</li>
<li>Added Forbidden Lands system (thanks to JackDCondon)</li>
<li>Other Controls => Control Buttons: Added offset for 'Displayed Controls' and 'Displayed Tools'</li>
<li>Added 'Device Configuration' to the module settings. You can use this to configure specific SD devices to not connect to a client</li>
<li>Playlist Action => Added option to play next or previous track</li>
</ul>
### v1.4.6 - 07-09-2021
Fixes:
<ul>
<li>Token Action => Move token: If the user is not the GM, tokens can no longer move if game is paused, and they can no longer move through walls</li>
<li>Modifications made in the Property Inspector now immediately get saved, instead of when user deselects the setting (changed 'onchange' to 'oninput' event)</li>
</ul>
Additions:
<ul>
<li>Playlist Action: Added a 'Pause All' option</li>
</ul>
Other:
<ul>
<li>PF2E compatibility updated (thanks @kyamsil)</li>
</ul>
### v1.4.5 - 27-07-2021
Fixes:
<ul>
<li>Combat Tracker Action => Turn Display: If only 'Display Round' was enabled, the vertical alignment would be off. This has been fixed.</li>
<li>WebSocket client no longer creates duplicate connections</li>
<li>Token Action => If 'Display Uses/Quantity' is enabled for an item that has no maximum uses/quantity, the uses/quantity border is now consistently black.</li>
<li>Update dialog that appears if the SD plugin needs to be updated now only appears once</li>
</ul>
Additions:
<ul>
<li>External Modules: Added support for the Soundscape module. Requires Soundscape v1.0.3</li>
<li>Macro Action => Advanced Macros is now supported for calling macros with arguments</li>
<li>Combat Tracker Action => Function: Added option to select the combatant after changing the turn</li>
<li>Other Actions => Added 'Set Roll Mode' which sets the roll mode for all rolls to public, private gm, blind gm or self roll</li>
<li>Added support for wfrp4e (thanks to sozin#8622 & eccobold#3541)</li>
<li>Added DEVGUIDE.md to help developers add support for new systems (thanks to sozin#8622 & eccobold#3541)</li>
</ul>
<br>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.4.5 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.4.4 - 26-05-2021
Fixes:
<ul>
<li>Some small fixes to make the module compatible with Foundry 0.8.5</li>
</ul>
Additions:
<ul>
<li>Token Action => Added 'Page-Wide Token' option. All buttons on the current page (where the page is the collection of buttons that are shown) that have this enabled will use the same token</li>
<li>Token Action => On Click: Added 'Set Page-Wide Token' option, so you can configure buttons to set the page-wide token by pressing a button</li>
<li>Token Action: Added a 'Mode' select box. Setting it to 'Token' is the same as pre v1.4.4. New are the inventory, features and spellbook options that can be used to auto-populate buttons with items, features and spells.</li>
<li>Added a 'Clear Page' and 'Clear All' button to the soundboard and macroboard configuration</li>
<li>Added import and export buttons to the soundboard and macroboard configuration (only imports/exports metadata, not the actual audio files or the macros)</li>
<li>The number of connection error messages you will get is now configurable in the module settings</li>
<li>Added a download utility to the module settings, so you can easily version-check with the SD plugin and Material Server, download them and download profiles</li>
<li>Added Japanese localization (thanks BrotherSharper and Asami). All of the new features have not yet been translated</li>
</ul>
Other:
<ul>
<li><b>(Breaking)</b> The Move Action has been removed. Moving tokens is not in the Token Action (it's an on click setting) and moving the canvas is in the Other Actions.</li>
<li>Major change to the soundboard and macroboard configuration. It is now displayed as pages of 16 sounds or 32 macros each, you can browse through the pages using the arrow keys at the top.</li>
<li>There is no longer a limit to the amount of sounds/macros you can assign to the soundboard/macroboard, but please note that at some point you might experience performance issues if there's too many sounds/macros.</li>
<li>Removed the 'Stream Deck Model' module setting, since it's not that useful</li>
<li>Token Action has been revamped to make it clearer and easier to implement new game systems</li>
</ul>
<br>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.4.4 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.4.3 - 05-05-2021
Fixes:
<ul>
<li>Fixed issue where the module would break if multiple Stream Decks were configured in the Stream Deck application, but not all of them had MD actions assigned to them</li>
<li>In the User Permission Configuration, the Scene Directory hint wasn't displayed properly</li>
<li>Got rid of warnings that popped up on initialization when using MD as a player</li>
<li>Fixed issue where the soundboard and macro board could not be configured by players, if it hadn't first been configured by a GM</li>
</ul>
Other
<ul>
<li>Added compatibility for Foundry 0.8.2. Some functions no longer work in 0.8.1 (they still do in 0.7.9)</li>
</ul>
<br>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.4.2 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.4.2 - 23-04-2021
Fixes:
<ul>
<li>Last update I fixed the combat tracker, but this broke something in the Token Action (if you had a token selected, it would sometimes assumed you didn't have it selected), both should now work</li>
<li>Token Action: Plugin wouldn't save text boxes (such as 'Prepend Title' or 'Custom') if they were empty</li>
<li>Token Action: Improved performance, especially when 'Token' is set to 'Selected Token', and you're selecting a new token while you had another token selected<li>
<li>Token Action => Stats => Skill Modifier: (dnd5e) Would only display the modifier, now it displays the total value (so with proficiency, if applicable)</li>
<li>Combat Tracker => Mode: Function => Function: Would not always properly load the 'Turn Display' options</li>
<li>Playlist Action: Background color would not show, and 'Off Color' wouldn't work for 'Offset'</li>
<li>Macro Action => Macro Board => Offset: Background color would not show</li>
<li>Scene Action => Offset: Background color would not show</li>
</ul>
Additions:
<ul>
<li>Token Action: Changed the way how you can select what icon will be displayed. Instead of a true/false, there is now a selection box where you can select between 'None', 'Token Icon', 'Actor Icon' and 'Default', where the last one will display the default icon, for example the selected stat to display, the condition, etc</li>
<li>Token Action => Stats & On Click => Custom: Textbox now automatically resizes to fit the content</li>
<li>Token Action => On Click => Dice Roll: Added 'Roll Mode' option, where you can set to roll as 'default' (displays dialog), 'normal', 'advantage' or 'disadvantage'. All options, except for 'default', will ignore the previously added 'Token Roll Options' in 'Other Actions'</li>
</ul>
Other:
<ul>
<li>Big code cleanup of the SD plugin</li>
</ul>
<br>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.4.2 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.4.1 - 21-04-2021
Fixes:
<ul>
<li>Previous update broke the combat tracker, should now be fixed</li>
</ul>
### v1.4.0 - 21-04-2021
Additions:
<ul>
<li>Support for connecting multiple Stream Decks at the same time. Please note that performance decreases with each extra Stream Deck</li>
<li>Other Actions: Added 'Token Roll Options'. This can toggle token rolls between showing a dialog and skipping the dialog and rolling normally or with advantage or disadvantage</li>
<li>If the SD plugin version you're using is outdated, you now get a pop-up to notify you of this and direct you to the download page</li>
<li>Added a module setting to set how dark the default white images should be. Can be lowered for improved readability of the text</li>
<li>Token Action => Stats: Added option to prepend text to the title, so you can set the stat to, for example, strength, and put 'STR: ' in the prepend textbox to display, for example, 'STR: +2'</li>
</ul>
Fixes:
<ul>
<li>Token Action => Skill Roll: Setting wasn't saved in SD app</li>
<li>Token Action => Roll Ability: Rolling ability checks was broken for some systems</li>
<li>Token Action => Stats => Display HP: Read overlay indicating HP in the heart icon was also drawn when 'Display Token Icon' was enabled</li>
<li>Token Action => Stats: Added default images for all dnd5e abilities, saves and skills</li>
</ul>
<br>
@@ -22,30 +312,31 @@ Fixes:
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
### 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>
<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>
<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>
<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>
@@ -56,23 +347,23 @@ SD plugin v1.3.4 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialD
### 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>
<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>
<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>
<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>
@@ -83,17 +374,17 @@ SD plugin v1.3.2 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialD
### 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>
<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>
<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>
@@ -104,24 +395,24 @@ SD plugin v1.3.1 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialD
### 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>
<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>
<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>
<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>
@@ -135,12 +426,12 @@ SD plugin v1.3.0 (<b>must be updated!</b>): https://github.com/CDeenen/MaterialD
### v1.2.3 - 03-02-2021
Fixes:
<ul>
<li>Fixed some issues for the Shadow of the Demon Lord system</li>
<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>
<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>
@@ -149,13 +440,13 @@ SD plugin v1.2.2 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/release
### 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>
<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>
<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>
@@ -166,23 +457,23 @@ SD plugin v1.2.2: https://github.com/CDeenen/MaterialDeck_SD/releases<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>
<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>
<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>
@@ -191,24 +482,24 @@ SD plugin v1.2.1: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.2.0 - 28-12-2020
Fixes
<ul>
<li>Incorrect link to some black backgrounds fixed</li>
<li>Token Action: Movement speed wouldn't be displayed for DnD5e 1.2.0</li>
<li>Macro Action => Hotbar: 10th macro would not trigger and display correctly</li>
<li>Combat Tracker Action => Function: Default value would not properly initialize</li>
<li>Other Actions => Darkness Control => Display would not function correctly</li>
<li>Fixed some issues in the SD plugin where correct settings would not be displayed</li>
<li>Incorrect link to some black backgrounds fixed</li>
<li>Token Action: Movement speed wouldn't be displayed for DnD5e 1.2.0</li>
<li>Macro Action => Hotbar: 10th macro would not trigger and display correctly</li>
<li>Combat Tracker Action => Function: Default value would not properly initialize</li>
<li>Other Actions => Darkness Control => Display would not function correctly</li>
<li>Fixed some issues in the SD plugin where correct settings would not be displayed</li>
</ul>
Additions:
<ul>
<li>Added new 'External Modules Action', which will contain all module integrations that don't fit anywhere else</li>
<li>Added support for the Custom Hotbar module in 'Macro Action' => Mode: 'Custom Hotbar'. Link to module: https://foundryvtt.com/packages/custom-hotbar/</li>
<li>Added support for the FxMaster module in 'External Modules Action' => Mode: 'Fx Master'. Link to module: https://foundryvtt.com/packages/fxmaster/</li>
<li>Added new 'External Modules Action', which will contain all module integrations that don't fit anywhere else</li>
<li>Added support for the Custom Hotbar module in 'Macro Action' => Mode: 'Custom Hotbar'. Link to module: https://foundryvtt.com/packages/custom-hotbar/</li>
<li>Added support for the FxMaster module in 'External Modules Action' => Mode: 'Fx Master'. Link to module: https://foundryvtt.com/packages/fxmaster/</li>
</ul>
### v1.1.1 - 12-12-2020
Fixes
<ul>
<li>Fixed issue where deleting a playlist would cause an error preventing the Soundboard Configuration to show up</li>
<li>Fixed issue where deleting a playlist would cause an error preventing the Soundboard Configuration to show up</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
@@ -218,16 +509,16 @@ SD plugin v1.1.0 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/release
### v1.1.0 - 09-12-2020
Fixes
<ul>
<li>Settings would not show for Combat Tracker action</li>
<li>Macro Action => Macro Board default settings fixed</li>
<li>API has been improved, making integration with other hardware/software easier, and making future changes/additions easier</li>
<li>Settings would not show for Combat Tracker action</li>
<li>Macro Action => Macro Board default settings fixed</li>
<li>API has been improved, making integration with other hardware/software easier, and making future changes/additions easier</li>
</ul>
Additions:
<ul>
<li>Added support for Pathfinder 1e and Shadow of the Demon Lord</li>
<li>All dialogs that are openable using the SD can now be closed by pressing the button while the dialog is open</li>
<li>Playlist Action & Soundboard Action => Stop All now indicates if there are tracks/playlists/sounds playing</li>
<li>Confirmed Foundry 0.7.8 compatibility</li>
<li>Added support for Pathfinder 1e and Shadow of the Demon Lord</li>
<li>All dialogs that are openable using the SD can now be closed by pressing the button while the dialog is open</li>
<li>Playlist Action & Soundboard Action => Stop All now indicates if there are tracks/playlists/sounds playing</li>
<li>Confirmed Foundry 0.7.8 compatibility</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
@@ -236,8 +527,8 @@ SD plugin v1.1.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### V1.0.1 - 26-11-2020
<ul>
<li>Fixed issue where macro from macroboard wouldn't execute if furnace arguments were not defined</li>
<li>Fixed issue where soundboard wouldn't save if no previous data existed for that sound</li>
<li>Fixed issue where macro from macroboard wouldn't execute if furnace arguments were not defined</li>
<li>Fixed issue where soundboard wouldn't save if no previous data existed for that sound</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
@@ -247,7 +538,7 @@ SD plugin v1.0.0 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/release
### v1.0.0 - 24-11-2020
Release
<ul>
<li>Fixed issue where the last column in 'Soundboard Configuration' would not work properly</li>
<li>Fixed issue where the last column in 'Soundboard Configuration' would not work properly</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
@@ -256,17 +547,17 @@ SD plugin v1.0.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v0.9.2 - 24-11-2020
<ul>
<li>Removed unnecessary errors when module is not fully configured</li>
<li>Solved issue that soundboard config couldn't be saved on a world that hadn't run Material Deck previously</li>
<li>Removed unnecessary errors when module is not fully configured</li>
<li>Solved issue that soundboard config couldn't be saved on a world that hadn't run Material Deck previously</li>
</ul>
### v0.9.1 - 23-11-2020
<ul>
<li>Fixed 'Playlist' action issue where 'TrackNr' wouldn't show</li>
<li>Fixed 'Soundboard Configuration' issue where changing the playlist would reset everything you've changed since last save</li>
<li>'Soundboard Configuration', 'Macro Configuration' and 'Playlist Configuration' now save after each change, and update the SD instantly</li>
<li>Save button has been removed from configuration screens, since it is now redundant</li>
<li>Added support for DnD3.5e and Pathfinder 2e</li>
<li>Fixed 'Playlist' action issue where 'TrackNr' wouldn't show</li>
<li>Fixed 'Soundboard Configuration' issue where changing the playlist would reset everything you've changed since last save</li>
<li>'Soundboard Configuration', 'Macro Configuration' and 'Playlist Configuration' now save after each change, and update the SD instantly</li>
<li>Save button has been removed from configuration screens, since it is now redundant</li>
<li>Added support for DnD3.5e and Pathfinder 2e</li>
</ul>
<b>Note1:</b> In 'Macro Configuration', previously saved Furnace arguments have to be filled in again.<br>
@@ -278,12 +569,12 @@ SD plugin v0.9.1: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v0.9.0 - 19-11-2020
<ul>
<li>Added support for more playlists</li>
<li>Added playmode setting for each playlist, which overrides the default playmode</li>
<li>Added option to use the file picker to select Soundboard sounds, including support for wildcard names</li>
<li>Fixed issue where macro config screen would not close if the module was disabled</li>
<li>Fixed issue where the layout of the configuration screens would be messed up depending on browser/screen size</li>
<li>Added option to open compendia and journal entries</li>
<li>Added support for more playlists</li>
<li>Added playmode setting for each playlist, which overrides the default playmode</li>
<li>Added option to use the file picker to select Soundboard sounds, including support for wildcard names</li>
<li>Fixed issue where macro config screen would not close if the module was disabled</li>
<li>Fixed issue where the layout of the configuration screens would be messed up depending on browser/screen size</li>
<li>Added option to open compendia and journal entries</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
@@ -292,7 +583,7 @@ SD plugin v0.9.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v0.8.6 - 18-11-2020
<ul>
<li>Added support for the new Material Server app</li>
<li>Added support for the new Material Server app</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
@@ -301,18 +592,18 @@ SD plugin v0.7.3: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v0.8.5 - 17-11-2020
<ul>
<li>Added 'Display Icon' to Macro action</li>
<li>Removed background option from 'Macro' => 'Macro Board' => 'Trigger Macro', this is handled in the macro configuration screen</li>
<li>Added 'Background' option in 'Macro' => 'Macro Board' => 'Offset'</li>
<li>Fixed control buttons from not performing action when clicked</li>
<li>Added check for each function to prevent unnecessary searching through the button buffer</li>
<li>Added 'Target', 'Visibility', 'Toggle Combat State' and 'Set Condition' options to the 'Token' action (under 'on click')</li>
<li>Added 'Zoom In' and 'Zoom Out' functions to 'Move' action</li>
<li>Added ability to load icons from web sources</li>
<li>Added support for localization (module only)</li>
<li>Fixed issue where SD buttons would not load properly if Foundry was initialized before the SD, or if Foundry was refreshed</li>
<li>Long words now split up onto multiple lines</li>
<li>Confirmed compatibility with Foundry v0.7.7</li>
<li>Added 'Display Icon' to Macro action</li>
<li>Removed background option from 'Macro' => 'Macro Board' => 'Trigger Macro', this is handled in the macro configuration screen</li>
<li>Added 'Background' option in 'Macro' => 'Macro Board' => 'Offset'</li>
<li>Fixed control buttons from not performing action when clicked</li>
<li>Added check for each function to prevent unnecessary searching through the button buffer</li>
<li>Added 'Target', 'Visibility', 'Toggle Combat State' and 'Set Condition' options to the 'Token' action (under 'on click')</li>
<li>Added 'Zoom In' and 'Zoom Out' functions to 'Move' action</li>
<li>Added ability to load icons from web sources</li>
<li>Added support for localization (module only)</li>
<li>Fixed issue where SD buttons would not load properly if Foundry was initialized before the SD, or if Foundry was refreshed</li>
<li>Long words now split up onto multiple lines</li>
<li>Confirmed compatibility with Foundry v0.7.7</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Server v0.2.4 (no change)<br>
@@ -320,12 +611,12 @@ SD plugin v0.7.2<br>
### v0.8.4 - 11-11-2020
<ul>
<li>In 'Other' action, 'Control Button' mode, add 'Displayed Controls' option</li>
<li>Change 'Other', 'Playlist' and 'Soundboard' actions from background color change to ring color</li>
<li>Macro board fixed</li>
<li>Added proper background color options for 'Other' action</li>
<li>In 'Other' action, control button icons are now properly centered</li>
<li>Newly created actions now show the correct options at the start</li>
<li>In 'Other' action, 'Control Button' mode, add 'Displayed Controls' option</li>
<li>Change 'Other', 'Playlist' and 'Soundboard' actions from background color change to ring color</li>
<li>Macro board fixed</li>
<li>Added proper background color options for 'Other' action</li>
<li>In 'Other' action, control button icons are now properly centered</li>
<li>Newly created actions now show the correct options at the start</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Server v0.2.4 (no change)<br>
@@ -333,7 +624,7 @@ SD plugin v0.7.1<br>
### v0.8.3 - 10-11-2020
<ul>
<li>Fixed compatibility with tokenizer</li>
<li>Fixed compatibility with tokenizer</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Server v0.2.4<br>
@@ -341,7 +632,7 @@ SD plugin v0.7.0<br>
### v0.8.2 - 10-11-2020
<ul>
<li>Initial beta release</li>
<li>Initial beta release</li>
</ul>
<b>Compatible server app and SD plugin:</b><br>
Server v0.2.4<br>

175
css/style.css Normal file
View File

@@ -0,0 +1,175 @@
/*
* Device Config
*/
.materialDeck_devConf_columnLabel {
max-width:30%;
min-width:30%;
text-align: left;
}
.materialDeck_devConf_columnId {
max-width:25%;
min-width:25%;
text-align: left;
text-overflow: hidden;
}
.materialDeck_devConf_columnCB {
width:10%;
text-align: left;
}
/*
* Download Utility
*/
.materialDeck_dlUtil_columnLabel {
width:25%;
text-align: left;
}
.materialDeck_dlUtil_columnVersion {
width:15%;
text-align: left;
}
.materialDeck_dlUtil_columnOS {
width:15%;
}
.materialDeck_dlUtil_columnButton {
width:15%;
}
.materialDeck_dlUtil_button {
width:100%;
}
/*
* Macro Config
*/
.materialDeck_macroConfig_boxed {
border: 1px solid black ;
border-radius: 5px ;
max-width: 166px;
padding: 5px;
margin:2px;
width:10%;
}
.materialDeck_macroConfig_navigationDiv {
width:100%;
display:flex;
flex-direction:row;
}
.materialDeck_macroConfig_navigation {
flex:1;
max-width: 8%;
}
.materialDeck_macroConfig_p {
width:84%;
text-align:center;
padding: 0px 0;
font-size: 20px;
}
.materialDeck_macroConfig_background {
display:flex;
flex-direction:row;
padding-top:10px;
}
/*
* Playlist Config
*/
.materialDeck_plConfig_select {
width: 35%;
max-width: 35%;
}
/*
* Soundboard Config
*/
.materialDeck_sbConfig_boxed {
border: 1px solid black ;
border-radius: 5px ;
max-width: 166px;
height: 300px;
padding: 5px;
margin:2px;
width:10%
}
.materialDeck_sbConfig_navigationDiv {
flex:1;
width:100%;
display:flex;
flex-direction:row;
}
.materialDeck_sbConfig_navigation {
flex:1;
}
.materialDeck_sbConfig_p {
flex:15;
text-align:center;
padding: 0px 0;
font-size: 20px
}
/*
* User Permission Config
*/
header.materialDeck_uPerm_table-header {
background: rgba(0, 0, 0, 0.5);
padding: 5px;
border: 1px solid #191813;
text-align: center;
color: #f0f0e0;
font-weight: bold;
text-shadow: 1px 1px #000;
}
ul.materialDeck_uPerm_permissions-list {
list-style: none;
margin: 0;
padding: 0;
overflow: hidden auto;
scrollbar-width: thin;
}
li.materialDeck_uPerm_permission {
padding: 5px;
border-bottom: 1px solid #7a7971;
}
li.materialDeck_uPerm_permission .form-fields {
justify-content: space-around;
}
li.materialDeck_uPerm_permission input[type="checkbox"] {
margin: 0;
}
.materialDeck_uPerm_index {
flex: 0 0 200px;
text-align: left;
font-weight: bold;
}
.materialDeck_uPerm_hint {
flex: 0 0 100%;
color: #4b4a44;
font-size: 13px;
margin: 5px 0 0;
}
/*
* Help Menu
*/
.materialDeck_helpMenu_expandable {
cursor: pointer;
}
.materialDeck_helpMenu_collapsed {
display:none;
}
.materialDeck_helpMenu_expandableIcon {
border: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/.thumb/down.png.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
img/.thumb/right.png.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

BIN
img/down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -1,2 +1,3 @@
play.png: Edited from https://fontawesome.com/icons/play?style=solid
stop.png: Edited from https://fontawesome.com/icons/stop?style=solid
stop.png: Edited from https://fontawesome.com/icons/stop?style=solid
pause.png: Edited from https://fontawesome.com/v5.15/icons/pause?style=solid

BIN
img/playlist/pause.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
img/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

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: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -4,4 +4,7 @@ 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
cha.png: https://game-icons.net/1x1/lorc/icicles-aura.html
fort.png: https://game-icons.net/1x1/delapouite/rock-golem.html
ref.png: https://game-icons.net/1x1/lorc/dodging.html
will.png: https://game-icons.net/1x1/lorc/meditation.html

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -3,17 +3,23 @@ acr.png: https://game-icons.net/1x1/delapouite/contortionist.html
ani.png: https://game-icons.net/1x1/delapouite/cavalry.html
arc.png: https://game-icons.net/1x1/delapouite/spell-book.html
ath.png: https://game-icons.net/1x1/lorc/muscle-up.html
cra.png: https://game-icons.net/1x1/lorc/sword-smithing.html
dec.png: https://game-icons.net/1x1/delapouite/convince.html
dip.png: https://game-icons.net/1x1/delapouite/shaking-hands.html
his.png: https://game-icons.net/1x1/delapouite/backward-time.html
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
lor.png: https://game-icons.net/1x1/lorc/bookmarklet.html
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
nat.png: https://game-icons.net/1x1/delapouite/forest.html
occ.png: https://game-icons.net/1x1/skoll/pentacle.html
prc.png: https://game-icons.net/1x1/lorc/semi-closed-eye.html
prf.png: https://game-icons.net/1x1/lorc/sing.html
per.png: https://game-icons.net/1x1/delapouite/public-speaker.html
rel.png: https://game-icons.net/1x1/lorc/holy-grail.html
soc.png: https://game-icons.net/1x1/delapouite/trumpet-flag.html
slt.png: https://game-icons.net/1x1/lorc/snatch.html
ste.png: https://game-icons.net/1x1/lorc/cloak-dagger.html
sur.png: https://game-icons.net/1x1/delapouite/pyre.html
sur.png: https://game-icons.net/1x1/delapouite/pyre.html
thi.png: https://game-icons.net/1x1/delapouite/lock-picking.html

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -3,17 +3,26 @@
"MaterialDeck.Notifications.ConnectFail": "Can't connect to Material Server, retrying",
"MaterialDeck.Notifications.Connected": "Connected",
"MaterialDeck.Notifications.Soundboard.NoPermission": "You do not have permission to configure the soundboard",
"MaterialDeck.Notifications.Macroboard.NoPermission": "You do not have permission to configure the macro board",
"MaterialDeck.Notifications.Macroboard.NoPermission": "You do not have permission to configure the macroboard",
"MaterialDeck.Notifications.Playlist.NoPermission": "You do not have permission to configure the playlists",
"MaterialDeck.EnableDialog.Title": "Material Deck: Enable for this Client",
"MaterialDeck.EnableDialog.Content": "Do you want to enable Material Deck for this client?<br><br>If you don't have a Stream Deck connected, or don't want to use it for Material Deck, please click no.<br><br>You can always change this in the Material Deck module settings.<br><br>Foundry will refresh after this.<br>",
"MaterialDeck.EnableDialog.Yes": "Yes",
"MaterialDeck.EnableDialog.No": "No",
"MaterialDeck.UpdateRequired.Title": "Material Deck: Update Required",
"MaterialDeck.UpdateRequired.MS": "The Material Server version you are using is incompatible with this version of Material Deck.",
"MaterialDeck.UpdateRequired.SD": "The Stream Deck plugin you are using is incompatible with this version of Material Deck.",
"MaterialDeck.UpdateRequired.Both": "The Stream Deck plugin and Material Server you are using are incompatible with this version of Material Deck.",
"MaterialDeck.UpdateRequired.Update": "Please update using the Download Utility or click the link below.",
"MaterialDeck.UpdateRequired.SDdownload": "Stream Deck Plugin",
"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.Enable": "Enable Module for This Client",
"MaterialDeck.Sett.EnableHint": "Enabling the module for this client is required if you want to use Material Deck on your computer. If you do not have a Stream Deck connected or don't want to use it for Material Deck, disable the module here.",
"MaterialDeck.Sett.Help": "Help",
"MaterialDeck.Sett.Permission": "User Permission Configuration",
"MaterialDeck.DeviceConfig.Title": "Device Configuration",
"MaterialDeck.Sett.PlaylistConfig": "Playlist Configuration",
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
@@ -23,6 +32,10 @@
"MaterialDeck.Sett.ImageBufferHint": "Sets the amount of images to store in the image cache. The image cache will locally store all images sent to the Stream Deck. This improves the update speed, but increases memory usage.",
"MaterialDeck.Sett.ImageBrightness": "Image Brightness",
"MaterialDeck.Sett.ImageBrightnessHint": "Sets the brightness of the default white images. If the Image Cache Size is bigger than 0, perform a refresh for instant results.",
"MaterialDeck.Sett.NrOfConnMessages": "Number of Connection Warnings",
"MaterialDeck.Sett.NrOfConnMessagesHint": "Sets the number of times a connection warning is displayed if Material Deck cannot connect to Material Server. If set to 0, it will give not be limited.",
"MaterialDeck.Sett.SystemOverride": "System Override",
"MaterialDeck.Sett.SystemOverrideHint": "Overrides the automatic gaming system detection. Unsupported systems default to dnd5e, but if an unsupported system is similar to a different system you can specify that system here.",
"MaterialDeck.PL.Unrestricted": "Unrestricted",
"MaterialDeck.PL.OneTrackPlaylist": "One track per playlist",
@@ -35,10 +48,12 @@
"MaterialDeck.Playlists": "Playlists",
"MaterialDeck.Playlist": "Playlist",
"MaterialDeck.FilePicker": "File Picker",
"MaterialDeck.FurnaceArgs": "Furnace arguments",
"MaterialDeck.FurnaceArgs": "Macro arguments",
"MaterialDeck.Background": "Background",
"MaterialDeck.Macro": "Macro",
"MaterialDeck.Sound": "Sound",
"MaterialDeck.Sounds": "Sounds",
"MaterialDeck.Of": "of",
"MaterialDeck.Icon": "Icon",
"MaterialDeck.Once": "Once",
"MaterialDeck.Repeat": "Repeat",
@@ -50,11 +65,31 @@
"MaterialDeck.Name": "Name",
"MaterialDeck.None": "None",
"MaterialDeck.Save": "Save",
"MaterialDeck.ClearAll": "Clear All",
"MaterialDeck.ClearAll_Content": "This will clear all the data. This cannot be undone, are you sure you want to proceed?",
"MaterialDeck.ClearPage": "Clear Page",
"MaterialDeck.ClearPage_Content": "This will clear all the data on this page. This cannot be undone, are you sure you want to proceed?",
"MaterialDeck.Continue": "Continue",
"MaterialDeck.Cancel": "Cancel",
"MaterialDeck.Import": "Import",
"MaterialDeck.Export": "Export",
"MaterialDeck.Filename": "Filename",
"MaterialDeck.Id": "Id",
"MaterialDeck.Type": "Type",
"MaterialDeck.Label": "Label",
"MaterialDeck.ExportDialog.Title": "Export",
"MaterialDeck.ExportDialog.SoundboardContent": "Export the soundboard data. Please note that only the metadata is exported, so you will have to make sure the audio files are in the same relative location when you import them.",
"MaterialDeck.ExportDialog.MacroboardContent": "Export the macroboard data. Please note that only the metadata is exported, so you will have to make sure the same macros are available when you import them.",
"MaterialDeck.ImportDialog.Title": "Import",
"MaterialDeck.ImportDialog.SoundboardContent": "Select a file to import. Please note that only the metadata is imported, so you will have to make sure the audio files are in the same relative location as when you exported them.",
"MaterialDeck.ImportDialog.MacroboardContent": "Import the macroboard data. ",
"MaterialDeck.ImportDialog.Warning": "This will overwrite your current settings, and cannot be undone.",
"MaterialDeck.FxMaster.Colorize": "Colorize",
"MaterialDeck.FxMaster.Clear": "Clear All",
"MaterialDeck.Perm.Instructions": "Configure the permission for each Material Deck action.",
"MaterialDeck.Perm.DefaultNotification": "Material Deck user permissions have been configured to the default values.",
@@ -96,15 +131,9 @@
"MaterialDeck.Perm.MACRO.BY_NAME.label": "Macro by Name",
"MaterialDeck.Perm.MACRO.BY_NAME.hint": "Allow users to call macros by name",
"MaterialDeck.Perm.MACRO.MACROBOARD.label": "Macro Board",
"MaterialDeck.Perm.MACRO.MACROBOARD.hint": "Allow users to use the macro board",
"MaterialDeck.Perm.MACRO.MACROBOARD.hint": "Allow users to use the macroboard",
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.label": "Configure the Macro Board",
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "Allow users to configure the macro board",
"MaterialDeck.Perm.MOVE.label": "Move",
"MaterialDeck.Perm.MOVE.TOKEN.label": "Token",
"MaterialDeck.Perm.MOVE.TOKEN.hint": "Allow users to move a controlled token",
"MaterialDeck.Perm.MOVE.CANVAS.label": "Canvas",
"MaterialDeck.Perm.MOVE.CANVAS.hint": "Allow users to move their canvas",
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "Allow users to configure the macroboard. To allow users to pick icons using the filepicker, enable 'Browse File Explorer' for that user in the core Permission Configuration",
"MaterialDeck.Perm.OTHER.label": "Other",
"MaterialDeck.Perm.OTHER.PAUSE.label": "Pause/Resume",
@@ -144,7 +173,7 @@
"MaterialDeck.Perm.SCENE.ACTIVE.label": "Active Scene",
"MaterialDeck.Perm.SCENE.ACTIVE.hint": "Allow users to view the active scene",
"MaterialDeck.Perm.SCENE.DIRECTORY.label": "Scene Directory",
"MaterialDeck.Perm.SCENE.DIRECTOR.hint": "Allow users to view and control scenes from the scene directory",
"MaterialDeck.Perm.SCENE.DIRECTORY.hint": "Allow users to view and control scenes from the scene directory",
"MaterialDeck.Perm.SCENE.NAME.label": "Scene by Name",
"MaterialDeck.Perm.SCENE.NAME.hint": "Allow users to view and control any scene by name",
@@ -152,7 +181,7 @@
"MaterialDeck.Perm.SOUNDBOARD.PLAY.label": "Enable",
"MaterialDeck.Perm.SOUNDBOARD.PLAY.hint": "Allow users to play sounds from the soundboard",
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.label": "Configure",
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.hint": "Allow users to configure the soundboard",
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.hint": "Allow users to configure the soundboard. To allow users to pick files and icons using the filepicker, enable 'Browse File Explorer' for that user in the core Permission Configuration",
"MaterialDeck.Perm.TOKEN.label": "Token",
"MaterialDeck.Perm.TOKEN.STATS.label": "Display Stats",
@@ -174,10 +203,28 @@
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "Observer",
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "Allow users access to tokens with observer permission",
"MaterialDeck.AboutTime.First": "st",
"MaterialDeck.AboutTime.Second": "nd",
"MaterialDeck.AboutTime.Third": "rd",
"MaterialDeck.AboutTime.Fourth": "th",
"MaterialDeck.AboutTime.Of": "of"
}
"MaterialDeck.SimpleCalendar.First": "st",
"MaterialDeck.SimpleCalendar.Second": "nd",
"MaterialDeck.SimpleCalendar.Third": "rd",
"MaterialDeck.SimpleCalendar.Fourth": "th",
"MaterialDeck.SimpleCalendar.Of": "of",
"MaterialDeck.DownloadUtility.Title": "Download Utility",
"MaterialDeck.DownloadUtility.Plugin": "Module, Stream Deck 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.module": "Module",
"MaterialDeck.DownloadUtility.SDplugin": "SD Plugin",
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
"MaterialDeck.DownloadUtility.Windows": "Windows",
"MaterialDeck.DownloadUtility.MacosM1": "MacOS (M1)",
"MaterialDeck.DownloadUtility.MacosIntel": "MacOS (Intel)",
"MaterialDeck.DownloadUtility.Linux": "Linux",
"MaterialDeck.DownloadUtility.Source": "Source",
"MaterialDeck.DownloadUtility.Profiles": "Profiles",
"MaterialDeck.DownloadUtility.Name": "Name",
"MaterialDeck.DownloadUtility.Refresh": "Refresh"
}

210
lang/ja.json Normal file
View File

@@ -0,0 +1,210 @@
{
"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.SimpleCalendar.First": "",
"MaterialDeck.SimpleCalendar.Second": "",
"MaterialDeck.SimpleCalendar.Third": "",
"MaterialDeck.SimpleCalendar.Fourth": "",
"MaterialDeck.SimpleCalendar.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.MacosM1": "MacOS (M1)",
"MaterialDeck.DownloadUtility.MacosIntel": "MacOS (Intel)",
"MaterialDeck.DownloadUtility.Linux": "Linux",
"MaterialDeck.DownloadUtility.Source": "ソース",
"MaterialDeck.DownloadUtility.Profiles": "プロファイル",
"MaterialDeck.DownloadUtility.Name": "名前",
"MaterialDeck.DownloadUtility.Refresh": "更新"
}

View File

@@ -1,25 +1,64 @@
{
"name": "MaterialDeck",
"id": "MaterialDeck",
"title": "Material Deck",
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
"version": "1.4.0",
"minimumSDversion": "1.4.0",
"minimumMSversion": "1.0.2",
"version": "1.5.1",
"author": "CDeenen",
"authors": [
{
"name": "CDeenen",
"email": "cdeenen@outlook.com",
"discord": "Cris#6864",
"patreon": "MaterialFoundry",
"reddit": "CDeenen123"
}
],
"esmodules": [
"./MaterialDeck.js"
"./MaterialDeck.js"
],
"styles": [
"./css/style.css"
],
"socket": true,
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.8.1",
"minimumCoreVersion": "10",
"compatibleCoreVersion": "11",
"compatibility": {
"minimum": "10",
"verified": "11"
},
"flags": {
"minimumMSVersion": "1.1.0",
"minimumPluginVersion": "1.5.0"
},
"languages": [
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
}
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
},
{
"lang": "ja",
"name": "日本語",
"path": "lang/ja.json"
}
],
"media": [
{
"type": "icon",
"url": "modules/MaterialDeck/img/MaterialFoundry512x512.png"
},
{
"type": "setup",
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
},
{
"type": "cover",
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
}
],
"manifestPlusVersion": "1.1.0",
"url": "https://github.com/CDeenen/MaterialDeck",
"manifest": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json",
"download": "https://github.com/CDeenen/MaterialDeck/archive/Master.zip"
}
"manifest": "https://github.com/CDeenen/MaterialDeck/releases/latest/download/module.json",
"download": "https://github.com/CDeenen/MaterialDeck/releases/download/v1.5.1/module.zip"
}

View File

@@ -1,6 +1,5 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck, tokenControl} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
import { streamDeck, tokenControl, getPermission } from "../../MaterialDeck.js";
import { } from "../misc.js";
export class CombatTracker{
constructor(){
@@ -11,6 +10,7 @@ export class CombatTracker{
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 != 'combattracker') continue;
@@ -19,68 +19,101 @@ export class CombatTracker{
}
}
applyFilter(combatant, settings) {
let conf = {
forceIcon: undefined,
hideName: false
}
const disposition = combatant.token.disposition;
const hidden = combatant.token.hidden;
const visibilityMode = settings.visibilityMode ? settings.visibilityMode : 'remove';
const dispositionMode = settings.dispositionMode ? settings.dispositionMode : 'remove';
if (hidden && (settings.visibilityFilter == 'all' || (settings.visibilityFilter == 'hostileNeutral' && disposition != 1) || (settings.visibilityFilter == 'hostile' && disposition == -1))) {
if (visibilityMode == 'black' || visibilityMode == 'remove') conf.forceIcon = "modules/MaterialDeck/img/black.png";
else if (visibilityMode == 'mysteryMan') conf.forceIcon = "modules/MaterialDeck/img/token/mystery-man.png";
else if (visibilityMode == 'hideName') conf.hideName = true;
}
if ((settings.dispositionFilter == 'friendlyNeutral' && disposition == -1) || (settings.dispositionFilter == 'friendly' && disposition != 1)) {
if (conf.forceIcon == undefined && (dispositionMode == 'black' || dispositionMode == 'remove')) conf.forceIcon = "modules/MaterialDeck/img/black.png";
else if (conf.forceIcon == undefined && dispositionMode == 'mysteryMan') conf.forceIcon = "modules/MaterialDeck/img/token/mystery-man.png";
else if (dispositionMode == 'hideName') conf.hideName = true;
}
return conf;
}
update(settings,context,device){
this.active = true;
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
const mode = settings.combatTrackerMode ? settings.combatTrackerMode : 'combatants';
settings.combatTrackerMode = mode;
const combat = game.combat;
let src = "modules/MaterialDeck/img/black.png";
let txt = "";
let background = "#000000";
settings.combat = true;
settings.icon = settings.displayIcon ? 'tokenIcon' : 'none';
if (mode == 'combatants'){
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
if (getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
streamDeck.noPermission(context,device,device,false,"combat tracker");
return;
}
if (combat != null && combat != undefined && combat.turns.length != 0){
const initiativeOrder = combat.turns;
let nr = settings.combatantNr - 1;
if (nr == undefined || nr < 1) nr = 0;
const combatantState = (nr == combat.turn) ? 2 : 1;
let initiativeOrder = combat.turns;
const dispositionMode = settings.dispositionMode ? settings.dispositionMode : 'remove';
if (dispositionMode == 'remove' && settings.dispositionFilter == 'friendly') initiativeOrder = initiativeOrder.filter(c => c.token.disposition == 1);
else if (dispositionMode == 'remove' && settings.dispositionFilter == 'friendlyNeutral') initiativeOrder = initiativeOrder.filter(c => c.token.disposition != -1);
const visibilityMode = settings.visibilityMode ? settings.visibilityMode : 'none';
if (visibilityMode == 'remove' && settings.visibilityFilter == 'hostile') initiativeOrder = initiativeOrder.filter(c => c.token.disposition != -1 && c.token.hidden == false)
else if (visibilityMode == 'remove' && settings.visibilityFilter == 'hostileNeutral') initiativeOrder = initiativeOrder.filter(c => c.token.disposition == 1 && c.token.hidden == false)
else if (visibilityMode == 'remove' && settings.visibilityFilter == 'all') initiativeOrder = initiativeOrder.filter(c => c.token.hidden == false)
const nr = settings.combatantNr ? settings.combatantNr - 1 : 0;
const combatant = initiativeOrder[nr]
const combatantState = (combatant?.token.id == combat.current.tokenId) ? 2 : 1;
if (combatant != undefined){
const tokenId = compatibleCore("0.8.1") ? combatant.data.tokenId : combatant.tokenId;
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00');
const filterConfig = this.applyFilter(combatant, settings);
const tokenId = combatant.token.id;
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00', filterConfig.forceIcon, filterConfig.hideName);
return;
}
else {
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background});
streamDeck.setTitle(txt,context);
}
}
else {
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background});
streamDeck.setTitle(txt,context);
}
}
else if (mode == 'currentCombatant'){
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
if (getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
streamDeck.noPermission(context,device,device);
return;
}
if (combat != null && combat != undefined && combat.started){
const tokenId = compatibleCore("0.8.1") ? combat.combatant.data.tokenId : combat.combatant.tokenId;
tokenControl.pushData(tokenId,settings,context,device);
const filterConfig = this.applyFilter(combat.combatant, settings);
const tokenId = combat.combatant.token.id;
tokenControl.pushData(tokenId,settings,context,device,undefined,undefined, filterConfig.forceIcon, filterConfig.hideName);
}
else {
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background});
streamDeck.setTitle(txt,context);
}
}
else if (mode == 'function'){
if (ctFunction == 'turnDisplay' && MODULE.getPermission('COMBAT','TURN_DISPLAY') == false) {
if (ctFunction == 'turnDisplay' && getPermission('COMBAT','TURN_DISPLAY') == false) {
streamDeck.noPermission(context,device);
return;
}
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
else if (ctFunction == 'endTurn' && getPermission('COMBAT','END_TURN') == false) {
streamDeck.noPermission(context,device);
return;
}
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && MODULE.getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
streamDeck.noPermission(context,device);
return;
}
@@ -125,36 +158,44 @@ 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;
}
else if (ctFunction == 'rollInitiative' || ctFunction == 'rollInitiativeNPC')
src = "modules/MaterialDeck/img/token/init.png";
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
src = settings.iconOverride;
background = settings.background ? settings.background : '#000000'
}
streamDeck.setIcon(context,device,src,{background:background});
streamDeck.setTitle(txt,context);
}
}
keyPress(settings,context,device){
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) {
if (ctFunction == 'turnDisplay' && getPermission('COMBAT','TURN_DISPLAY') == false) {
streamDeck.noPermission(context,device);
return;
}
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
else if (ctFunction == 'endTurn' && getPermission('COMBAT','END_TURN') == false) {
streamDeck.noPermission(context,device);
return;
}
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && MODULE.getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
else if (ctFunction != 'turnDisplay' && ctFunction != 'endTurn' && getPermission('COMBAT','OTHER_FUNCTIONS') == false) {
streamDeck.noPermission(context,device);
return;
}
if (ctFunction == 'startStop'){
else if (ctFunction == 'startStop'){
let src;
let background;
if (game.combat.started){
@@ -165,13 +206,20 @@ export class CombatTracker{
}
return;
}
if (game.combat.started == false) return;
else if (ctFunction == 'rollInitiative' && getPermission('COMBAT','OTHER_FUNCTIONS')) game.combat.rollAll();
else if (ctFunction == 'rollInitiativeNPC' && getPermission('COMBAT','OTHER_FUNCTIONS')) game.combat.rollNPC();
if (ctFunction == 'nextTurn') game.combat.nextTurn();
else if (ctFunction == 'prevTurn') game.combat.previousTurn();
else if (ctFunction == 'nextRound') game.combat.nextRound();
else if (ctFunction == 'prevRound') game.combat.previousRound();
else if (ctFunction == 'endTurn' && game.combat.combatant.owner) game.combat.nextTurn();
if (game.combat.started == false) return;
if (ctFunction == 'nextTurn') await game.combat.nextTurn();
else if (ctFunction == 'prevTurn') await game.combat.previousTurn();
else if (ctFunction == 'nextRound') await game.combat.nextRound();
else if (ctFunction == 'prevRound') await game.combat.previousRound();
else if (ctFunction == 'endTurn' && game.combat.combatant.owner) await game.combat.nextTurn();
if (selectCombatant) {
const token = canvas.tokens.placeables.filter(token => token.id == game.combat.combatant.token.id)[0];
if (token.can(game.userId,"control")) token.control();
}
}
else {
const onClick = settings.onClick ? settings.onClick : 'doNothing';
@@ -183,12 +231,12 @@ export class CombatTracker{
if (nr == undefined || nr < 1) nr = 0;
const combatant = initiativeOrder[nr]
if (combatant == undefined) return;
tokenId = compatibleCore("0.8.1") ? combatant.data.tokenId : combatant.tokenId;
tokenId = combatant.token.id;
}
}
else if (mode == 'currentCombatant')
if (combat != null && combat != undefined && combat.started)
tokenId = compatibleCore("0.8.1") ? combat.combatant.data.tokenId : combat.combatant.tokenId;
tokenId = combat.combatant.token.id;
let token = (canvas.tokens.children[0] != undefined) ? canvas.tokens.children[0].children.find(p => p.id == tokenId) : undefined;
if (token == undefined) return;
@@ -216,6 +264,12 @@ export class CombatTracker{
if (element == null) token.sheet.render(true);
else token.sheet.close();
}
else if (onClick == 'rollInitiative') {
token.actor.rollInitiative({rerollInitiative:true});
}
else if (onClick == 'target') {
token.setTarget(!token.isTargeted,{releaseOthers:false})
}
}
}

952
src/actions/external.js Normal file
View File

@@ -0,0 +1,952 @@
import { streamDeck } from "../../MaterialDeck.js";
import { } from "../misc.js";
export class ExternalModules{
soundscapeSettings = {
channels: [],
master: {
mute: false,
volume: 1,
playing: false,
name: 'Master'
},
soundboard: [],
soundboardVolume: 1,
playing: false
}
constructor(){
this.active = false;
this.gmScreenOpen = false;
let channelData = [];
let soundboardData = [];
for (let i=0; i<8; i++) {
channelData.push({
volume: 1,
mute: false,
solo: false,
link: false,
playing: false,
pan: 1,
name: ''
})
}
for (let i=0; i<25; i++) {
soundboardData.push({
active: false,
name: '',
icon: ''
})
}
this.soundscapeSettings.channels = channelData;
this.soundscapeSettings.soundboard = soundboardData;
}
async updateAll(data={}){
if (data.gmScreen != undefined){
this.gmScreenOpen = data.gmScreen.isOpen;
}
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 != 'external') continue;
await this.update(data.settings,data.context,device.device);
}
}
}
update(settings,context,device){
this.active = true;
const module = settings.module ? settings.module : 'fxmaster';
if (module == 'fxmaster') this.updateFxMaster(settings,context,device);
else if (module == 'gmscreen') this.updateGMScreen(settings,context,device);
else if (module == 'triggerHappy') this.updateTriggerHappy(settings,context,device);
else if (module == 'sharedVision') this.updateSharedVision(settings,context,device);
else if (module == 'notYourTurn') this.updateNotYourTurn(settings,context,device);
else if (module == 'lockView') this.updateLockView(settings,context,device);
else if (module == 'simpleCalendar') this.updateSimpleCalendar(settings,context,device);
else if (module == 'soundscape') this.updateSoundscape(settings,context,device);
else if (module == 'monksActiveTiles') this.updateMonksActiveTiles(settings,context,device);
}
keyPress(settings,context,device){
if (this.active == false) return;
const module = settings.module ? settings.module : 'fxmaster';
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 == 'notYourTurn') this.keyPressNotYourTurn(settings,context,device);
else if (module == 'lockView') this.keyPressLockView(settings,context,device);
else if (module == 'simpleCalendar') this.keyPressSimpleCalendar(settings,context,device);
else if (module == 'soundscape') this.keyPressSoundscape(settings,context,device);
else if (module == 'monksActiveTiles') this.keyPressMonksActiveTiles(settings,context,device);
}
getModuleEnable(moduleId){
const module = game.modules.get(moduleId);
if (module == undefined || module.active == false) return false;
return true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//FxMaster
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateFxMaster(settings,context,device){
if (game.user.isGM == false) return;
const fxmaster = game.modules.get("fxmaster");
if (fxmaster == undefined || fxmaster.active == false) return;
const type = (settings.fxMasterType == undefined) ? 'weatherControls' : settings.fxMasterType;
const displayIcon = settings.displayFxMasterIcon;
const displayName = settings.displayFxMasterName;
let ring = 0;
let ringColor = "#000000";
let background = "#000000"
let icon = '';
let name = '';
if (type == 'weatherControls') {
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
name =game.i18n.localize(CONFIG.fxmaster.particleEffects[effect].label);
icon = CONFIG.fxmaster.particleEffects[effect].icon;
ring = canvas.scene.getFlag("fxmaster", "effects")?.[`core_${effect}`] ? 2 : 1;
ringColor = ring < 2 ? '#000000' : "#00ff00";
}
else if (type == 'filters') {
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
name = game.i18n.localize(CONFIG.fxmaster.filterEffects[filter].label);
background = "#340057";
if (displayIcon){
if (filter == 'lightning') icon = "fas fa-bolt";
else if (filter == 'underwater') icon = "fas fa-water";
else if (filter == 'predator') icon = "fas fa-wave-square";
else if (filter == 'color') icon = "fas fa-palette";
else if (filter == 'oldfilm') icon = "fas fa-film";
else if (filter == 'bloom') icon = "fas fa-ghost";
}
const fxmaster = canvas.scene.getFlag("fxmaster", "filters");
ring = 1;
if (fxmaster != undefined) {
const objKeys = Object.keys(fxmaster);
for (let i=0; i<objKeys.length; i++){
if (objKeys[i] == "core_"+filter) {
ring = 2;
ringColor = "#A600FF";
break;
}
}
}
if (filter == 'color') background = settings.fxMasterFilterColor ? settings.fxMasterFilterColor : '#ffffff';
}
else if (type == 'clear'){
icon = "fas fa-trash";
name = game.i18n.localize("MaterialDeck.FxMaster.Clear");
}
if (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:ring,ringColor:ringColor});
else streamDeck.setIcon(context,device, "", {background:background,ring:ring,ringColor:ringColor});
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
keyPressFxMaster(settings,context,device){
if (game.user.isGM == false) return;
const fxmaster = game.modules.get("fxmaster");
if (fxmaster == undefined || fxmaster.active == false) return;
const type = (settings.fxMasterType == undefined) ? 'weatherControls' : settings.fxMasterType;
if (type == 'weatherControls') {
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
const options = {
density: (settings.densitySlider == undefined) ? 0.25 : settings.densitySlider,
speed: (settings.speedSlider == undefined) ? 1 : settings.speedSlider,
direction: (settings.directionSlider == undefined) ? 15 : settings.directionSlider,
scale: (settings.scaleSlider == undefined) ? 1 : settings.scaleSlider,
color: (settings.fxMasterWeatherColor == undefined) ? "#000000" : settings.fxMasterWeatherColor,
applyColor: (settings.fxWeatherEnColor == undefined) ? false : settings.fxWeatherEnColor
}
Hooks.call("fxmaster.switchParticleEffect", {
name: `core_${effect}`,
type: effect,
options,
});
}
else if (type == 'filters') {
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
let options = {color: {value:"#000000", apply:false}};
if (filter == 'lightning') {
options.period = settings.fxMasterFilterPeriod ? parseFloat(settings.fxMasterFilterPeriod) : 500;
options.duration = settings.fxMasterFilterDuration ? parseFloat(settings.fxMasterFilterDuration) : 300;
options.brightness = settings.fxMasterFilterBrightness ? parseFloat(settings.fxMasterFilterBrightness) : 1.3;
}
else if (filter == 'underwater') {
options.speed = settings.fxMasterFilterSpeed ? parseFloat(settings.fxMasterFilterSpeed) : 0.3;
options.scale = settings.fxMasterFilterScale ? parseFloat(settings.fxMasterFilterScale) : 4;
}
else if (filter == 'predator') {
options.noise = settings.fxMasterFilterNoise ? parseFloat(settings.fxMasterFilterNoise) : 4;
options.speed = settings.fxMasterFilterSpeed ? parseFloat(settings.fxMasterFilterSpeed)*0.1 : 0.03;
}
else if (filter == 'bloom') {
options.blur = settings.fxMasterFilterBlur ? parseFloat(settings.fxMasterFilterBlur) : 1;
options.bloom = settings.fxMasterFilterBloom ? parseFloat(settings.fxMasterFilterBloom) : 0.1;
options.threshold = settings.fxMasterFilterThreshold ? parseFloat(settings.fxMasterFilterThreshold) : 0.5;
}
else if (filter == 'oldfilm') {
options.sepia = settings.fxMasterFilterSepia ? parseFloat(settings.fxMasterFilterSepia) : 0.3;
options.noise = settings.fxMasterFilterNoise ? parseFloat(settings.fxMasterFilterNoise) : 4;
}
if (filter == 'color') {
options.color = {
apply: settings.fxMasterFilterTint ? settings.fxMasterFilterTint : false,
value: settings.fxMasterFilterColor ? settings.fxMasterFilterColor : '#ffffff'
}
options.saturation = settings.fxMasterFilterSaturation ? parseFloat(settings.fxMasterFilterSaturation) : 1;
options.contrast = settings.fxMasterFilterContrast ? parseFloat(settings.fxMasterFilterContrast) : 1;
options.brightness = settings.fxMasterFilterBrightness ? parseFloat(settings.fxMasterFilterBrightness) : 1;
options.Gamma = settings.fxMasterFilterGamma ? parseFloat(settings.fxMasterFilterGamma) : 1;
}
FXMASTER.filters.switch(`core_${filter}`, filter, options);
}
else if (type == 'clear'){
canvas.scene.unsetFlag("fxmaster", "filters");
canvas.scene.unsetFlag("fxmaster", "effects");
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//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";
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
if (settings.displayGmScreenName) txt = game.i18n.localize(`GMSCR.gmScreen.Open`);
streamDeck.setTitle(txt,context);
}
keyPressGMScreen(settings,context,device){
if (this.getModuleEnable("gm-screen") == false) return;
if (game.user.isGM == false) return;
game.modules.get('gm-screen')?.api?.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 = '';
let src = "fas fa-grin-squint-tears";
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
if (displayIcon) streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
else streamDeck.setIcon(context,device,'',{background:'#000000'});
if (displayName) txt = 'Trigger Happy';
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 = '';
let src = "fas fa-eye";
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
if (displayIcon) streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
else streamDeck.setIcon(context,device,'',{background:'#000000'});
if (displayName) txt = 'Shared Vision';
streamDeck.setTitle(txt,context);
}
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});
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//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 (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
else streamDeck.setIcon(context,device,'',{background:'#000000'});
if (displayName == false) txt = '';
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 (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
else streamDeck.setIcon(context,device,'',{background:'#000000'});
if (displayName == false) txt = '';
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
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateSimpleCalendar(settings,context,device) {
if (this.getModuleEnable("foundryvtt-simple-calendar") == false) return;
if (game.user.isGM == false) return;
const displayTime = settings.simpleCalendarDisplayTime ? settings.simpleCalendarDisplayTime : 'none';
const displayDate = settings.simpleCalendarDisplayDate ? settings.simpleCalendarDisplayDate : 'none';
const background = settings.simpleCalendarBackground ? settings.simpleCalendarBackground : '#000000';
const ringOffColor = settings.simpleCalendarOffRing ? settings.simpleCalendarOffRing : '#000000';
const ringOnColor = settings.simpleCalendarOnRing ? settings.simpleCalendarOnRing : '#00FF00';
let ring = 0;
let ringColor = '#000000';
let txt = '';
let currentTime = SimpleCalendar.api.currentDateTime();
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.seconds;
else {
if (currentTime.minute < 10) currentTime.minute = '0' + currentTime.minute;
if (currentTime.seconds < 10) currentTime.seconds = '0' + currentTime.seconds;
txt += hours + ':' + currentTime.minute;
if (displayTime == 'full24h' || displayTime == 'full12h') txt += ':' + currentTime.seconds;
}
if (displayTime == 'compact12h' || displayTime == 'full12h' || displayTime == 'hours12h') txt += AMPM;
}
if (displayTime != 'none' && displayTime != 'clock' && displayDate != 'none') txt += '\n';
if (displayDate == 'day') txt += currentTime.day;
else if (displayDate == 'dayName') txt += SimpleCalendar.api.getCurrentWeekday().name;
else if (displayDate == 'month') txt += currentTime.month;
else if (displayDate == 'monthName') txt += SimpleCalendar.api.getCurrentMonth().name;
else if (displayDate == 'year') txt += currentTime.year;
else if (displayDate == 'small') txt += currentTime.day + '-' + currentTime.month;
else if (displayDate == 'smallInv') txt += currentTime.month + '-' + currentTime.day;
else if (displayDate == 'full') txt += currentTime.day + '-' + currentTime.month + '-' + currentTime.year;
else if (displayDate == 'fullInv') txt += currentTime.month + '-' + currentTime.day + '-' + currentTime.year;
else if (displayDate == 'text' || displayDate == 'textDay' || displayDate == 'textAbbr' || displayDate == 'textDayAbbr') {
if (displayDate == 'textDay') txt += SimpleCalendar.api.getCurrentWeekday().name + ' ';
else if (displayDate == 'textDayAbbr') txt += SimpleCalendar.api.getCurrentWeekday().abbreviation + ' ';
txt += currentTime.day;
if (currentTime.day % 10 == 1 && currentTime != 11) txt += game.i18n.localize("MaterialDeck.SimpleCalendar.First");
else if (currentTime.day % 10 == 2 && currentTime != 12) txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Second");
else if (currentTime.day % 10 == 3 && currentTime != 13) txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Third");
else txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Fourth");
txt += ' ' + game.i18n.localize("MaterialDeck.SimpleCalendar.Of") + ' '
if (displayDate == 'textAbbr' || displayDate == 'textDayAbbr') txt += SimpleCalendar.api.getCurrentMonth().abbreviation
else txt += SimpleCalendar.api.getCurrentMonth().name
txt += ', ' + currentTime.year;
}
if (settings.simpleCalendarActive) {
const clockRunning = SimpleCalendar.api.clockStatus().started;
ringColor = clockRunning ? ringOnColor : ringOffColor;
ring = 2;
}
streamDeck.setTitle(txt.toString(),context);
streamDeck.setIcon(context,device,'',{background:background,ring:ring,ringColor:ringColor, clock:clock});
}
keyPressSimpleCalendar(settings,context,device) {
if (this.getModuleEnable("foundryvtt-simple-calendar") == false) return;
if (game.user.isGM == false) return;
const onClick = settings.simpleCalendarOnClick ? settings.simpleCalendarOnClick : 'none';
if (onClick == 'none') return;
else if (onClick == 'startStop') {
const clockRunning = SimpleCalendar.api.clockStatus().started;
const startMode = settings.simpleCalendarStartStopMode ? settings.simpleCalendarStartStopMode : 'toggle';
if (clockRunning && (startMode == 'toggle' || startMode == 'stop')) SimpleCalendar.api.stopClock();
else if (!clockRunning && (startMode == 'toggle' || startMode == 'start')) SimpleCalendar.api.startClock();
}
else if (onClick == 'advance') {
const advanceMode = settings.simpleCalendarAdvanceMode ? settings.simpleCalendarAdvanceMode : 'dawn';
if (advanceMode == 'sunrise') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunrise);
if (advanceMode == 'midday') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midday);
if (advanceMode == 'sunset') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunset);
if (advanceMode == 'midnight') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midnight);
else if (advanceMode == '1s') SimpleCalendar.api.changeDate({seconds: 1});
else if (advanceMode == '30s') SimpleCalendar.api.changeDate({seconds: 30});
else if (advanceMode == '1m') SimpleCalendar.api.changeDate({minute: 1});
else if (advanceMode == '5m') SimpleCalendar.api.changeDate({minute: 5});
else if (advanceMode == '15m') SimpleCalendar.api.changeDate({minute: 15});
else if (advanceMode == '1h') SimpleCalendar.api.changeDate({hour: 1});
else if (advanceMode == '6h') SimpleCalendar.api.changeDate({hour: 6});
else if (advanceMode == '12h') SimpleCalendar.api.changeDate({hour: 12});
else if (advanceMode == '1d') SimpleCalendar.api.changeDate({day: 1});
else if (advanceMode == '7d') SimpleCalendar.api.changeDate({day: 7});
else if (advanceMode == '1M') SimpleCalendar.api.changeDate({month: 1});
else if (advanceMode == '1y') SimpleCalendar.api.changeDate({year: 1});
}
else if (onClick == 'recede') {
const advanceMode = settings.simpleCalendarAdvanceMode ? settings.simpleCalendarAdvanceMode : 'dawn';
let now = SimpleCalendar.api.currentDateTime();
if (advanceMode == 'sunrise') {
SimpleCalendar.api.changeDate({day: -1});
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunrise);
}
else if (advanceMode == 'midday') {
SimpleCalendar.api.changeDate({day: -1});
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midday);
}
else if (advanceMode == 'sunset') {
SimpleCalendar.api.changeDate({day: -1});
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunset);
}
else if (advanceMode == 'midnight') {
SimpleCalendar.api.changeDate({day: -1});
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midnight);
}
else if (advanceMode == '1s') SimpleCalendar.api.changeDate({seconds: -1});
else if (advanceMode == '30s') SimpleCalendar.api.changeDate({seconds: -30});
else if (advanceMode == '1m') SimpleCalendar.api.changeDate({minute: -1});
else if (advanceMode == '5m') SimpleCalendar.api.changeDate({minute: -5});
else if (advanceMode == '15m') SimpleCalendar.api.changeDate({minute: -15});
else if (advanceMode == '1h') SimpleCalendar.api.changeDate({hour: -1});
else if (advanceMode == '6h') SimpleCalendar.api.changeDate({hour: -6});
else if (advanceMode == '12h') SimpleCalendar.api.changeDate({hour: -12});
else if (advanceMode == '1d') SimpleCalendar.api.changeDate({day: -1});
else if (advanceMode == '7d') SimpleCalendar.api.changeDate({day: -7});
else if (advanceMode == '1M') SimpleCalendar.api.changeDate({month: -1});
else if (advanceMode == '1y') SimpleCalendar.api.changeDate({year: -1});
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//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);
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
}
async keyPressSoundscape(settings,context,device) {
if (this.getModuleEnable("soundscape") == false) return;
if (game.user.isGM == false) return;
const target = settings.soundscapeTarget ? settings.soundscapeTarget : 'mixer';
let channel = settings.soundscapeChannel ? settings.soundscapeChannel : 1;
if (target == 'mixer') {
const mode = settings.soundscapeMixerMode ? settings.soundscapeMixerMode : 'startStopAll';
if (mode == 'startStopAll') {
const playing = !this.soundscapeSettings.playing;
if (playing) {
Hooks.call('setSoundscape',{"msgType":"start","channelNr":undefined});
return;
}
else {
Hooks.call('setSoundscape',{"msgType":"stop","channelNr":undefined});
return;
}
}
if (channel == 'Master') channel = 'master';
let channelSettings;
if (channel == 'master') {
channelSettings = this.soundscapeSettings.master;
channelSettings.playing = this.soundscapeSettings.playing;
}
else channelSettings = this.soundscapeSettings.channels[channel-1];
let mute, solo, link, playing;
let setChannel = false;
if (mode == 'startStop') {
setChannel = true;
playing = !channelSettings.playing;
if (channel == 'master' && playing) {
Hooks.call('setSoundscape',{"msgType":"stop"});
return;
}
else if (channel == 'master') {
Hooks.call('setSoundscape',{"msgType":"start"});
return;
}
}
else if (mode == 'mute') {
setChannel = true;
mute = !channelSettings.mute;
}
else if (mode == 'solo') {
if (channel == 'master') return;
setChannel = true;
solo = !channelSettings.solo;
}
else if (mode == 'link') {
if (channel == 'master') return;
setChannel = true;
link = !channelSettings.link;
}
if (setChannel) {
const channelNr = channel == 'master' ? 'master' : channel-1;
const payload = {
"msgType": "setChannel",
"channelNr": channelNr,
mute,
solo,
link,
playing
};
Hooks.call('setSoundscape',payload);
return;
}
if (mode == 'volume') {
const volumeMode = settings.soundscapeMixerValueMode ? settings.soundscapeMixerValueMode : 'incrementDecrement';
const value = parseInt(settings.soundscapeMixerValue);
if (isNaN(value) == false) {
let volume = channelSettings.volume*100;
if (volumeMode == 'set')
volume = value;
else
volume += value;
volume = Math.floor(volume*100)/10000;
const channelNr = channel == 'master' ? 'master' : channel-1;
const payload = {
"msgType": "setVolume",
"channelNr": channelNr,
volume
};
Hooks.call('setSoundscape',payload);
}
}
}
else if (target == 'soundboard') {
const mode = settings.soundscapeSoundboardMode ? settings.soundscapeSoundboardMode : 'play';
if (mode == 'play') {
channel -= 1;
const payload = {
"msgType": "playSoundboard",
channelNr: channel
};
Hooks.call('setSoundscape',payload);
}
else if (mode == 'volume') {
const volumeMode = settings.soundscapeSoundboardValueMode ? settings.soundscapeSoundboardValueMode : 'incrementDecrement';
const value = parseInt(settings.soundscapeSoundboardValue);
if (isNaN(value) == false) {
let volume = this.soundscapeSettings.soundboardVolume*100;
if (volumeMode == 'set')
volume = value;
else
volume += value;
volume = Math.floor(volume*100)/10000;
const payload = {
"msgType": "setSoundboardVolume",
volume
};
Hooks.call('setSoundscape',payload);
}
}
else if (mode == 'stop') {
const payload = {
"msgType": "stopSoundboard"
};
Hooks.call('setSoundscape',payload);
}
}
}
newSoundscapeData(data) {
let channel;
if (data.channel != undefined) channel = data.channel;
else if (data.channelNr != undefined) channel = data.channelNr;
let channelSettings = channel == 'master' ? this.soundscapeSettings.master : this.soundscapeSettings.channels[channel]
if (data.msgType == 'soundConfig') {
let newChannelSettings = {
volume: data.data.settings.volume,
mute: data.data.settings.mute,
solo: data.data.settings.solo,
link: data.data.settings.link,
playing: false,
pan: data.data.settings.pan,
name: data.data.settings.name
};
this.soundscapeSettings.channels[channel] = newChannelSettings;
}
else if (data.msgType == 'setMute') channelSettings.mute = data.mute;
else if (data.msgType == 'setSolo') channelSettings.solo = data.solo;
else if (data.msgType == 'setLink') channelSettings.link = data.link;
else if (data.msgType == 'setVolume') {
if (channel >= 100) return;
channelSettings.volume = data.volume;
}
else if (data.msgType == 'start') {
this.soundscapeSettings.playing = true;
this.soundscapeSettings.master.playing = true;
if (data.channel == undefined) for (let i=0; i<8; i++) this.soundscapeSettings.channels[i].playing = true;
else this.soundscapeSettings.channels[data.channel].playing = true;
}
else if (data.msgType == 'stop') {
if (data.channel == undefined) {
for (let i=0; i<8; i++) this.soundscapeSettings.channels[i].playing = false;
this.soundscapeSettings.playing = false;
}
else {
this.soundscapeSettings.channels[data.channel].playing = false;
let check = 0;
for (let i=0; i<8; i++) if (this.soundscapeSettings.channels[data.channel].playing) check++;
if (check == 0) this.soundscapeSettings.playing = false;
}
}
else if (data.msgType == 'sbSoundConfig') {
const channel = data.channel - 100;
let active = true;
if (data.data.soundArray == undefined) active = false;
this.soundscapeSettings.soundboard[channel] = {
active,
name: data.data.name,
icon: data.data.imageSrc
};
}
else if (data.msgType == 'setSoundboardVolume')
this.soundscapeSettings.soundboardVolume = data.volume;
this.updateAll();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Monks Active Tile Triggers
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateMonksActiveTiles(settings,context,device) {
const id = settings.monksActiveTilesId;
if (id == undefined || id == '') return;
let tile = canvas.tiles.placeables.find(t => t.id == id);
if (tile == undefined) return;
const tileData = tile.document.flags?.['monks-active-tiles'];
if (tileData == undefined) return;
let ring = 1;
let ringColor = '#000000';
let background = '#000000';
if (tileData.active) {
ring = 2;
ringColor = '#00ff00'
}
let src = tile.document.texture.sr;
streamDeck.setTitle('',context);
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
}
keyPressMonksActiveTiles(settings,context,device) {
const mode = settings.monksActiveTilesMode ? settings.monksActiveTilesMode : 'toggle';
const id = settings.monksActiveTilesId;
if (id == undefined || id == '') return;
let tile = canvas.tiles.placeables.find(t => t.id == id);
if (tile == undefined) return;
const tileData = tile.document.flags?.['monks-active-tiles'];
if (tileData == undefined) return;
if (mode == 'toggle') tile.document.setFlag('monks-active-tiles','active',!tileData.active);
}
}

295
src/actions/macro.js Normal file
View File

@@ -0,0 +1,295 @@
import { moduleName, streamDeck, getPermission, hotbarUses } from "../../MaterialDeck.js";
import { compatibleCore } from "../misc.js";
export class MacroControl{
constructor(){
this.active = false;
this.offset = 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 != 'macro') continue;
await this.update(data.settings,data.context,device.device);
}
}
}
async update(settings,context,device){
this.active = true;
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;
if (macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 0;
macroNumber = parseInt(macroNumber);
let ringColor = "#000000";
let ring = 0;
let name = "";
let src = "";
let macroId = undefined;
let uses = undefined;
let macroLabel = "";
if (mode == 'macroBoard') { //Macro board
if ((getPermission('MACRO','MACROBOARD') == false )) {
streamDeck.noPermission(context,device);
return;
}
if (settings.macroBoardMode == 'offset') { //Offset
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;
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;
const macroSettings = game.settings.get(moduleName,'macroSettings');
macroId = macroSettings.macros[macroNumber];
background = macroSettings.color[macroNumber];
try {
macroLabel = macroSettings.labels[macroNumber];
}
catch (err) {}
if ((macroLabel == undefined || macroLabel == "") && game.macros.get(macroId)) macroLabel = game.macros.get(macroId).name;
if (background == undefined) background = '#000000';
ring = 0;
}
}
else if (mode == 'name') { //macro by name
const macroName = settings.macroNumber;
const macro = game.macros.getName(macroName);
macroId = macro?.id;
}
else { //Macro Hotbar
if ((getPermission('MACRO','HOTBAR') == false )) {
streamDeck.noPermission(context,device);
return;
}
if (mode == 'hotbar') macroId = game.user.hotbar[macroNumber];
else {
let macros;
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined)
macros = ui.customHotbar.macros;
else
macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
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) {
if (displayName && mode == 'macroBoard') name = macroLabel;
else if (displayName) name = macro.name;
if (displayIcon) src = macro.img;
if (hotbarUses && displayUses) uses = await this.getUses(macro);
}
}
else {
if (displayName) name = "";
if (displayIcon) src = "modules/MaterialDeck/img/black.png";
}
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,uses:uses});
streamDeck.setTitle(name,context);
}
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 != 'hotbar') continue;
const context = data.context;
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
const displayName = data.settings.displayName ? data.settings.displayName : false;
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
let background = data.settings.background ? data.settings.background : '#000000';
let macroNumber = data.settings.macroNumber;
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
if ((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.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 (hotbarUses && displayUses) uses = await this.getUses(macro);
}
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,uses:uses});
streamDeck.setTitle(name,context);
}
}
}
keyPress(settings){
const mode = settings.macroMode ? settings.macroMode : 'hotbar';
let macroNumber = settings.macroNumber;
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 0;
let target = settings.target ? settings.target : undefined;
if (mode == 'hotbar' || mode == 'visibleHotbar' || mode == 'customHotbar'){
if ((getPermission('MACRO','HOTBAR') == false )) return;
this.executeHotbar(macroNumber,mode,target);
}
else if (mode == 'name') {
if ((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 advancedMacrosEnabled = false;
if (compatibleCore('11.0')) {
advancedMacrosEnabled = true;
}
else {
let advancedMacros = game.modules.get("advanced-macros");
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
}
if (args == "" || args == " ") advancedMacrosEnabled = false;
if (advancedMacrosEnabled == false) macro.execute({token:target});
else {
if (compatibleCore('11.0')) {
let argument;
try {
argument = JSON.parse(args)
macro.execute(argument);
} catch (err) {
console.error(err)
}
}
else {
let chatData = {
user: game.user._id,
speaker: ChatMessage.getSpeaker(),
content: "/amacro '" + macro.name + "' " + args
};
ChatMessage.create(chatData, {});
}
}
}
else {
if ((getPermission('MACRO','MACROBOARD') == false )) return;
if (settings.macroBoardMode == 'offset') {
let macroOffset = settings.macroOffset;
if (macroOffset == undefined) macroOffset = 0;
this.offset = macroOffset;
this.updateAll();
}
else
this.executeBoard(macroNumber);
}
}
executeHotbar(macroNumber,mode,target){
let macroId
if (mode == 'hotbar') macroId = game.user.hotbar[macroNumber];
else {
let macros;
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
macros = ui.customHotbar.macros;
}
else macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
}
if (macroId == undefined) return;
let macro = game.macros.get(macroId);
macro.execute({token:target});
}
executeBoard(macroNumber){
macroNumber = parseInt(macroNumber);
macroNumber += this.offset - 1;
if (macroNumber < 0) macroNumber = 0;
var macroId = game.settings.get(moduleName,'macroSettings').macros[macroNumber];
if (macroId != undefined){
let macro = game.macros.get(macroId);
if (macro != undefined && macro != null) {
const args = game.settings.get(moduleName,'macroSettings').args;
let advancedMacrosEnabled = false;
if (compatibleCore('11.0')) {
advancedMacrosEnabled = true;
}
else {
let advancedMacros = game.modules.get("advanced-macros");
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
}
if (args == undefined || args[macroNumber] == undefined || args[macroNumber] == "") advancedMacrosEnabled = false;
if (advancedMacrosEnabled == false) macro.execute();
else {
if (compatibleCore('11.0')) {
let argument;
try {
argument = JSON.parse(args[macroNumber])
macro.execute(argument);
} catch (err) {
console.error(err)
}
}
else {
let chatData = {
user: game.user._id,
speaker: ChatMessage.getSpeaker(),
content: "/amacro '" + macro.name + "' " + args[macroNumber]
};
ChatMessage.create(chatData, {});
}
}
}
}
}
}

View File

@@ -1,12 +1,14 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
import { streamDeck, gamingSystem, getPermission } from "../../MaterialDeck.js";
import { } from "../misc.js";
export class OtherControls{
constructor(){
this.active = false;
this.rollData = {};
this.rollOption = 'dialog';
this.controlsOffset = 0;
this.toolsOffset = 0;
this.attackMode = 'chat';
}
setRollOption(option) {
@@ -14,13 +16,19 @@ export class OtherControls{
this.updateAll();
}
setAttackMode(option) {
this.attackMode = option;
this.updateAll();
}
async updateAll(options={}){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'other') continue;
await this.update(data.settings,data.context,device.device);
await this.update(data.settings,data.context,device.device,options);
}
}
}
@@ -31,6 +39,8 @@ export class OtherControls{
if (mode == 'pause') //pause
this.updatePause(settings,context,device,options);
else if (mode == 'move') //move canvas
this.updateMove(settings,context,device,options);
else if (mode == 'controlButtons') //control buttons
this.updateControl(settings,context,device,options);
else if (mode == 'darkness') //darkness
@@ -51,6 +61,12 @@ export class OtherControls{
this.updateChatMessage(settings,context,device,options);
else if (mode == 'rollOptions')
this.updateRollOptions(settings,context,device,options);
else if (mode == 'attackModes')
this.updateAttackMode(settings,context,device,options);
else if (mode == 'rollMode')
this.updateRollMode(settings,context,device,options);
else if (mode == 'globalVolumeControls')
this.updateGlobalVolumeControls(settings, context, device, options);
}
keyPress(settings,context,device){
@@ -58,6 +74,8 @@ export class OtherControls{
if (mode == 'pause') //pause
this.keyPressPause(settings);
else if (mode == 'move') //move canvas
this.keyPressMove(settings);
else if (mode == 'controlButtons') //control buttons
this.keyPressControl(settings);
else if (mode == 'darkness') //darkness controll
@@ -78,12 +96,18 @@ export class OtherControls{
this.keyPressChatMessage(settings);
else if (mode == 'rollOptions')
this.keyPressRollOptions(settings);
else if (mode == 'attackModes')
this.keyPressAttackMode(settings);
else if (mode == 'rollMode')
this.keyPressRollMode(settings);
else if (mode == 'globalVolumeControls')
this.keyPressGlobalVolumeControls(settings);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
updatePause(settings,context,device,options={}){
if (MODULE.getPermission('OTHER','PAUSE') == false ) {
if (getPermission('OTHER','PAUSE') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -103,12 +127,17 @@ export class OtherControls{
}
else if (pauseFunction == 'toggle') //toggle
src = 'modules/MaterialDeck/img/other/pause/playpause.png';
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor,overlay:true});
let overlay = true;
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
src = settings.iconOverride;
overlay = false;
}
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor,overlay});
streamDeck.setTitle('',context);
}
keyPressPause(settings){
if (MODULE.getPermission('OTHER','PAUSE') == false ) return;
if (getPermission('OTHER','PAUSE') == false ) return;
const pauseFunction = settings.pauseFunction ? settings.pauseFunction : 'pause';
@@ -125,17 +154,104 @@ export class OtherControls{
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
updateMove(settings,context,device,options={}){
let url = '';
const dir = settings.dir ? settings.dir : 'center';
const background = settings.background ? settings.background : '#000000';
if (dir == 'center') //center
url = "modules/MaterialDeck/img/move/center.png";
else if (dir == 'up') //up
url = "modules/MaterialDeck/img/move/up.png";
else if (dir == 'down') //down
url = "modules/MaterialDeck/img/move/down.png";
else if (dir == 'right') //right
url = "modules/MaterialDeck/img/move/right.png";
else if (dir == 'left') //left
url = "modules/MaterialDeck/img/move/left.png";
else if (dir == 'upRight')
url = "modules/MaterialDeck/img/move/upright.png";
else if (dir == 'upLeft')
url = "modules/MaterialDeck/img/move/upleft.png";
else if (dir == 'downRight')
url = "modules/MaterialDeck/img/move/downright.png";
else if (dir == 'downLeft')
url = "modules/MaterialDeck/img/move/downleft.png";
else if (dir == 'zoomIn')
url = "modules/MaterialDeck/img/move/zoomin.png";
else if (dir == 'zoomOut')
url = "modules/MaterialDeck/img/move/zoomout.png";
let overlay = true;
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
url = settings.iconOverride;
overlay = false;
}
streamDeck.setIcon(context,device,url,{background:background,overlay});
streamDeck.setTitle('',context);
}
keyPressMove(settings){
if (canvas.scene == null) return;
const dir = settings.dir ? settings.dir : 'center';
if (dir == 'zoomIn') {//zoom in
let viewPosition = canvas.scene._viewPosition;
viewPosition.scale = viewPosition.scale*1.05;
viewPosition.duration = 100;
canvas.animatePan(viewPosition);
}
else if (dir == 'zoomOut') {//zoom out
let viewPosition = canvas.scene._viewPosition;
viewPosition.scale = viewPosition.scale*0.95;
viewPosition.duration = 100;
canvas.animatePan(viewPosition);
}
else {
let viewPosition = canvas.scene._viewPosition;
const gridSize = canvas.scene.grid.size;
viewPosition.duration = 100;
if (dir == 'up') viewPosition.y -= gridSize;
else if (dir == 'down') viewPosition.y += gridSize;
else if (dir == 'right') viewPosition.x += gridSize;
else if (dir == 'left') viewPosition.x -= gridSize;
else if (dir == 'upRight') {
viewPosition.x += gridSize;
viewPosition.y -= gridSize;
}
else if (dir == 'upLeft') {
viewPosition.x -= gridSize;
viewPosition.y -= gridSize;
}
else if (dir == 'downRight') {
viewPosition.x += gridSize;
viewPosition.y += gridSize;
}
else if (dir == 'downLeft') {
viewPosition.x -= gridSize;
viewPosition.y += gridSize;
}
else if (dir == 'center') {
viewPosition.x = (canvas.dimensions.sceneWidth+window.innerWidth)/2;
viewPosition.y = (canvas.dimensions.sceneHeight+window.innerHeight)/2;
}
canvas.animatePan(viewPosition);
}
}
//////////////////////////////////////////////////////////////////////////////////////////
updateControl(settings,context,device,options={}){
if (MODULE.getPermission('OTHER','CONTROL') == false ) {
if (getPermission('OTHER','CONTROL') == false ) {
streamDeck.noPermission(context,device);
return;
}
const control = settings.control ? settings.control : 'dispControls';
const tool = settings.tool ? settings.tool : 'open';
let background = settings.background ? settings.background : '#000000';
let ringColor = '#000000'
let ringColor = '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
let txt = "";
let src = "";
const activeControl = ui.controls.activeControl;
@@ -145,26 +261,28 @@ export class OtherControls{
let controlNr = parseInt(settings.controlNr);
if (isNaN(controlNr)) controlNr = 1;
controlNr--;
controlNr += this.controlsOffset;
const selectedControl = ui.controls.controls[controlNr];
const selectedControl = ui.controls.controls[controlNr];
if (selectedControl != undefined){
if (selectedControl.visible == false) {
streamDeck.noPermission(context,device,false);
return;
}
if (tool == 'open'){ //open category
//if (tool == 'open'){ //open category
txt = game.i18n.localize(selectedControl.title);
src = selectedControl.icon;
if (activeControl == selectedControl.name)
ringColor = "#FF7B00";
}
//}
}
}
else if (control == 'dispTools'){ //displayed tools
let controlNr = parseInt(settings.controlNr);
if (isNaN(controlNr)) controlNr = 1;
controlNr--;
controlNr += this.toolsOffset;
const selectedControl = ui.controls.controls.find(c => c.name == ui.controls.activeControl);
if (selectedControl != undefined){
@@ -185,6 +303,18 @@ export class OtherControls{
}
}
}
else if (control == 'controlsOffset') {
const display = settings.controlsOffsetDisplay ? settings.controlsOffsetDisplay : false;
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
if (display) txt = `${this.controlsOffset}`;
if (offsetType == 'absoluteOffset') ringColor = (this.controlsOffset == settings.controlsOffset) ? ringOnColor : ringOffColor;
}
else if (control == 'toolsOffset') {
const display = settings.controlsOffsetDisplay ? settings.controlsOffsetDisplay : false;
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
if (display) txt = `${this.toolsOffset}`;
if (offsetType == 'absoluteOffset') ringColor = (this.toolsOffset == settings.controlsOffset) ? ringOnColor : ringOffColor;
}
else { // specific control/tool
const selectedControl = ui.controls.controls.find(c => c.name == control);
if (selectedControl != undefined){
@@ -217,12 +347,13 @@ export class OtherControls{
}
}
}
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
streamDeck.setTitle(txt,context);
}
keyPressControl(settings){
if (MODULE.getPermission('OTHER','CONTROL') == false ) return;
if (getPermission('OTHER','CONTROL') == false ) return;
if (canvas.scene == null) return;
const control = settings.control ? settings.control : 'dispControls';
const tool = settings.tool ? settings.tool : 'open';
@@ -238,9 +369,8 @@ export class OtherControls{
streamDeck.noPermission(context,device,false);
return;
}
ui.controls.activeControl = selectedControl.name;
selectedControl.activeTool = selectedControl.activeTool;
canvas.getLayer(selectedControl.layer).activate();
ui.controls.initialize({layer: selectedControl.layer});
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
}
}
else if (control == 'dispTools'){ //displayed tools
@@ -266,11 +396,24 @@ export class OtherControls{
else if (selectedTool.button){
selectedTool.onClick();
}
else
selectedControl.activeTool = selectedTool.name;
else {
ui.controls.initialize({layer: selectedControl.layer, tool: selectedTool.name});
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
}
}
}
}
else if (control == 'controlsOffset') {
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
if (offsetType == 'absoluteOffset') this.controlsOffset = parseInt(settings.controlsOffset);
else if (offsetType == 'relativeOffset') this.controlsOffset += parseInt(settings.controlsOffset);
}
else if (control == 'toolsOffset') {
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
if (offsetType == 'absoluteOffset') this.toolsOffset = parseInt(settings.controlsOffset);
else if (offsetType == 'relativeOffset') this.toolsOffset += parseInt(settings.controlsOffset);
}
else { //select control
const selectedControl = ui.controls.controls.find(c => c.name == control);
if (selectedControl != undefined){
@@ -279,9 +422,8 @@ export class OtherControls{
return;
}
if (tool == 'open'){ //open category
ui.controls.activeControl = control;
selectedControl.activeTool = selectedControl.activeTool;
canvas.getLayer(selectedControl.layer).activate();
ui.controls.initialize({layer: selectedControl.layer});
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
}
else {
const selectedTool = selectedControl.tools.find(t => t.name == tool);
@@ -290,17 +432,23 @@ export class OtherControls{
streamDeck.noPermission(context,device,false);
return;
}
ui.controls.activeControl = control;
canvas.getLayer(selectedControl.layer).activate();
if (selectedTool.toggle) {
ui.controls.initialize({layer: selectedControl.layer});
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
selectedTool.active = !selectedTool.active;
selectedTool.onClick(selectedTool.active);
}
else if (selectedTool.button){
ui.controls.initialize({layer: selectedControl.layer});
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
selectedTool.onClick();
}
else
selectedControl.activeTool = tool;
else {
ui.controls.initialize({layer: selectedControl.layer, tool: selectedTool.name});
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
}
}
}
}
@@ -311,7 +459,7 @@ export class OtherControls{
//////////////////////////////////////////////////////////////////////////////////////////
updateDarkness(settings,context,device,options={}){
if (MODULE.getPermission('OTHER','DARKNESS') == false ) {
if (getPermission('OTHER','DARKNESS') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -331,61 +479,77 @@ export class OtherControls{
}
else if (func == 'disp'){ //display darkness
src = 'modules/MaterialDeck/img/other/darkness/darkness.png';
const darkness = canvas.scene != null ? Math.floor(canvas.scene.data.darkness*100)/100 : '';
const darkness = canvas.scene != null ? Math.floor(canvas.scene.darkness*100)/100 : '';
txt += darkness;
}
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,device,src,{background:background,overlay:true});
let overlay = true;
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
src = settings.iconOverride;
overlay = false;
}
streamDeck.setIcon(context,device,src,{background:background,overlay});
}
keyPressDarkness(settings) {
if (canvas.scene == null) return;
if (MODULE.getPermission('OTHER','DARKNESS') == false ) return;
if (getPermission('OTHER','DARKNESS') == false ) return;
const func = settings.darknessFunction ? settings.darknessFunction : 'value';
const value = parseFloat(settings.darknessValue) ? parseFloat(settings.darknessValue) : 0;
const animateDarkness = parseInt(settings.darknessAnimation) ? parseInt(settings.darknessAnimation) : 500;
if (func == 'value') //value
canvas.scene.update({darkness: value});
canvas.scene.update({darkness: value}, {animateDarkness});
else if (func == 'incDec'){ //increase/decrease
let darkness = canvas.scene.data.darkness - value;
let darkness = canvas.scene.darkness - value;
if (darkness > 1) darkness = 1;
if (darkness < 0) darkness = 0;
canvas.scene.update({darkness: darkness});
canvas.scene.update({darkness: darkness}, {animateDarkness});
}
else if (func == 'transitionDay') {
canvas.scene.update({darkness: 0}, {animateDarknes})
}
else if (func == 'transitionNight') {
canvas.scene.update({darkness: 1}, {animateDarknes})
}
}
//////////////////////////////////////////////////////////////////////////////////////////
updateRollDice(settings,context,device,options={}){
if (MODULE.getPermission('OTHER','DICE') == false ) {
if (getPermission('OTHER','DICE') == false ) {
streamDeck.noPermission(context,device);
return;
}
const background = settings.background ? settings.background : '#000000';
let txt = '';
const formula = settings.rollDiceFormula ? settings.rollDiceFormula : '1d20 + 7';
if (settings.displayDiceName) txt = 'Roll: ' + settings.rollDiceFormula;
if (settings.displayDiceName) txt = 'Roll: ' + formula;
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,device,'',{background:background});
let src = '';
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background});
}
keyPressRollDice(settings,context,device){
if (MODULE.getPermission('OTHER','DICE') == false ) return;
if (settings.rollDiceFormula == undefined || settings.rollDiceFormula == '') return;
if (getPermission('OTHER','DICE') == false ) return;
const formula = settings.rollDiceFormula ? settings.rollDiceFormula : '1d20 + 7';
if (formula == '') return;
const rollFunction = settings.rollDiceFunction ? settings.rollDiceFunction : 'public';
let actor;
let tokenControlled = false;
if (MODULE.selectedTokenId != undefined) actor = canvas.tokens.children[0].children.find(p => p.id == MODULE.selectedTokenId).actor;
if (canvas.tokens.controlled[0] != undefined) actor = canvas.tokens.controlled[0].actor;
if (actor != undefined) tokenControlled = true;
let r;
if (tokenControlled) r = new Roll(settings.rollDiceFormula,actor.getRollData());
else r = new Roll(settings.rollDiceFormula);
if (tokenControlled) r = new Roll(formula,actor.getRollData());
else r = new Roll(formula);
r.evaluate();
r.evaluate({async:false});
if (rollFunction == 'public') {
r.toMessage(r,{rollMode:"roll"})
@@ -394,12 +558,12 @@ export class OtherControls{
r.toMessage(r,{rollMode:"selfroll"})
}
else if (rollFunction == 'sd'){
let txt = settings.displayDiceName ? 'Roll: '+settings.rollDiceFormula + '\nResult: ' : '';
let txt = settings.displayDiceName ? 'Roll: '+formula + '\nResult: ' : '';
txt += r.total;
streamDeck.setTitle(txt,context);
let data = this.rollData
data[context] = {
formula: settings.rollDiceFormula,
formula: formula,
result: txt
}
this.rollData = data;
@@ -411,34 +575,36 @@ export class OtherControls{
updateRollTable(settings,context,device,options={}){
const name = settings.rollTableName;
if (name == undefined) return;
if (MODULE.getPermission('OTHER','TABLES') == false ) {
if (getPermission('OTHER','TABLES') == false ) {
streamDeck.noPermission(context,device);
return;
}
const background = settings.background ? settings.background : '#000000';
const table = game.tables.getName(name);
if (table == undefined) return;
let txt = settings.displayRollName ? table.name : '';
let src = settings.displayRollIcon ? table.data.img : '';
let src = settings.displayRollIcon ? table.img : '';
if (table == undefined) {
src = '';
txt = '';
}
else {
if (table.permission < 2 && MODULE.getPermission('OTHER','TABLES_ALL') == false ) {
if (table.permission < 2 && getPermission('OTHER','TABLES_ALL') == false ) {
streamDeck.noPermission(context,device);
return;
}
}
streamDeck.setTitle(txt,context);
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background});
}
keyPressRollTable(settings){
if (MODULE.getPermission('OTHER','TABLES') == false ) return;
if (getPermission('OTHER','TABLES') == false ) return;
const name = settings.rollTableName;
if (name == undefined) return;
@@ -446,7 +612,7 @@ export class OtherControls{
const table = game.tables.getName(name);
if (table != undefined) {
if (table.permission < 2 && MODULE.getPermission('OTHER','TABLES_ALL') == false ) return;
if (table.permission < 2 && getPermission('OTHER','TABLES_ALL') == false ) return;
if (func == 'open'){ //open
const element = document.getElementById(table.sheet.id);
if (element == null) table.sheet.render(true);
@@ -463,14 +629,15 @@ export class OtherControls{
getSidebarName(nr){
let name;
if (nr == 'chat') name = game.i18n.localize("SIDEBAR.TabChat");
else if (nr == 'combat') name = game.i18n.localize("SIDEBAR.TabCombat");
else if (nr == 'scenes') name = game.i18n.localize("SIDEBAR.TabScenes");
else if (nr == 'actors') name = game.i18n.localize("SIDEBAR.TabActors");
else if (nr == 'items') name = game.i18n.localize("SIDEBAR.TabItems");
else if (nr == 'journal') name = game.i18n.localize("SIDEBAR.TabJournal");
else if (nr == 'tables') name = game.i18n.localize("SIDEBAR.TabTables");
else if (nr == 'playlists') name = game.i18n.localize("SIDEBAR.TabPlaylists");
if (nr == 'chat') name = game.i18n.localize("DOCUMENT.ChatMessages");
else if (nr == 'combat') name = game.i18n.localize("DOCUMENT.Combats");
else if (nr == 'scenes') name = game.i18n.localize("DOCUMENT.Scenes");
else if (nr == 'actors') name = game.i18n.localize("DOCUMENT.Actors");
else if (nr == 'items') name = game.i18n.localize("DOCUMENT.Items");
else if (nr == 'journal') name = game.i18n.localize("DOCUMENT.JournalEntries");
else if (nr == 'tables') name = game.i18n.localize("DOCUMENT.RollTables");
else if (nr == 'cards') name = game.i18n.localize("DOCUMENT.Cards");
else if (nr == 'playlists') name = game.i18n.localize("DOCUMENT.Playlists");
else if (nr == 'compendium') name = game.i18n.localize("SIDEBAR.TabCompendium");
else if (nr == 'settings') name = game.i18n.localize("SIDEBAR.TabSettings");
else if (nr == 'collapse') name = game.i18n.localize("SIDEBAR.CollapseToggle");
@@ -486,6 +653,7 @@ export class OtherControls{
else if (nr == 'items') icon = window.CONFIG.Item.sidebarIcon;
else if (nr == 'journal') icon = window.CONFIG.JournalEntry.sidebarIcon;
else if (nr == 'tables') icon = window.CONFIG.RollTable.sidebarIcon;
else if (nr == 'cards') icon = window.CONFIG.Cards.sidebarIcon;
else if (nr == 'playlists') icon = window.CONFIG.Playlist.sidebarIcon;
else if (nr == 'compendium') icon = "fas fa-atlas";
else if (nr == 'settings') icon = "fas fa-cogs";
@@ -494,7 +662,7 @@ export class OtherControls{
}
updateSidebar(settings,context,device,options={}){
if (MODULE.getPermission('OTHER','SIDEBAR') == false ) {
if (getPermission('OTHER','SIDEBAR') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -509,16 +677,17 @@ export class OtherControls{
if (popOut && options.sidebarTab == sidebarTab) {
ringColor = options.renderPopout ? ringOnColor : ringOffColor;
}
else ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
else if (popOut == false) ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
const name = settings.displaySidebarName ? this.getSidebarName(sidebarTab) : '';
const icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
let icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
streamDeck.setTitle(name,context);
if (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
}
keyPressSidebar(settings){
if (MODULE.getPermission('OTHER','SIDEBAR') == false ) return;
if (getPermission('OTHER','SIDEBAR') == false ) return;
const sidebarTab = settings.sidebarTab ? settings.sidebarTab : 'chat';
const popOut = settings.sidebarPopOut ? settings.sidebarPopOut : false;
@@ -539,7 +708,7 @@ export class OtherControls{
updateCompendiumBrowser(settings,context,device,options={}){
let rendered = options.renderCompendiumBrowser;
if (rendered == undefined && game.system.id == "pf2e") rendered = (document.getElementById("app-1") != null);
if (rendered == undefined && gamingSystem == "pf2e") rendered = (document.getElementById("app-1") != null);
else if (rendered == undefined) rendered = (document.getElementById("compendium-popout") != null);
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
@@ -548,18 +717,20 @@ export class OtherControls{
const txt = settings.displayCompendiumName ? name : '';
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
let src = '';
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
}
keyPressCompendiumBrowser(settings){
let element = null;
if (game.system.id == "pf2e") element = document.getElementById("app-1")
if (gamingSystem == "pf2e") element = document.getElementById("app-1")
else element = document.getElementById("compendium-popout");
const rendered = (element != null);
if (rendered)
element.getElementsByClassName("close")[0].click();
else if (game.system.id == "pf2e")
else if (gamingSystem == "pf2e")
document.getElementsByClassName("compendium-browser-btn")[0].click()
else
ui.compendium.renderPopout();
@@ -570,56 +741,66 @@ export class OtherControls{
updateCompendium(settings,context,device,options={}){
const name = settings.compendiumName;
if (name == undefined) return;
if (MODULE.getPermission('OTHER','COMPENDIUM') == false ) {
if (getPermission('OTHER','COMPENDIUM') == false ) {
streamDeck.noPermission(context,device);
return;
}
let compendium;
if (compatibleCore("0.8.1")) compendium = game.packs.contents.find(p=>p.metadata.label == name)?.apps[0];
else compendium = game.packs.entries.find(p=>p.metadata.label == name);
const compendium = game.packs.find(p=>p.metadata.label == name);
if (compendium == undefined) return;
if (compendium.private && MODULE.getPermission('OTHER','COMPENDIUM_ALL') == false) {
if (compendium.private && getPermission('OTHER','COMPENDIUM_ALL') == false) {
streamDeck.noPermission(context,device);
return;
}
const rendered = compendium.apps[0].rendered;
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
const ringColor = compendium.rendered ? ringOnColor : ringOffColor;
const ringColor = rendered ? ringOnColor : ringOffColor;
const txt = settings.displayCompendiumName ? name : '';
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
let src = '';
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
}
keyPressCompendium(settings){
let name = settings.compendiumName;
if (name == undefined) return;
if (MODULE.getPermission('OTHER','COMPENDIUM') == false ) return;
if (getPermission('OTHER','COMPENDIUM') == false ) return;
let compendium;
if (compatibleCore("0.8.1")) compendium = game.packs.contents.find(p=>p.metadata.label == name)?.apps[0];
else compendium = game.packs.entries.find(p=>p.metadata.label == name);
const compendium = game.packs.find(p=>p.metadata.label == name);
const rendered = compendium.apps[0].rendered;
if (compendium == undefined) return;
if (compendium.private && MODULE.getPermission('OTHER','COMPENDIUM_ALL') == false) return;
else if (compendium.rendered) compendium.close();
if (compendium.private && getPermission('OTHER','COMPENDIUM_ALL') == false) return;
else if (rendered) compendium.apps[0].close();
else compendium.render(true);
}
//////////////////////////////////////////////////////////////////////////////////////////
updateJournal(settings,context,device,options={}){
const name = settings.compendiumName;
if (name == undefined) return;
const name = settings.journalName;
const pageName = settings.journalPageName;
let pageId;
let journalMode = settings.journalMode ? settings.journalMode : 'openJournal';
let txt = '';
if (name == undefined) {
streamDeck.setTitle('',context);
return;
}
const journal = game.journal.getName(name);
if (journal == undefined) return;
if (journal == undefined) {
streamDeck.setTitle('',context);
return;
}
if (MODULE.getPermission('OTHER','JOURNAL') == false ) {
if (getPermission('OTHER','JOURNAL') == false ) {
streamDeck.noPermission(context,device);
return;
}
if (journal.permission < 2 && MODULE.getPermission('OTHER','JOURNAL_ALL') == false ) {
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -632,44 +813,95 @@ export class OtherControls{
else
if (document.getElementById("journalentry-sheet-"+journal.id) != null) rendered = true;
txt = settings.displayJournalName == 'journal' ? name : '';
if (journalMode == 'openPageNr') {
pageId = journal.pages.contents[pageName]?.id
}
if (journalMode == 'openPageName') {
pageId = journal.pages.getName(pageName)?.id;
}
if (pageId != undefined) {
const page = journal.pages.get(pageId);
if (settings.displayJournalName == 'page') txt = page.name;
else if (settings.displayJournalName == 'journal+page') txt = name + ' - ' + page.name
if (rendered && page != undefined) {
const currentPage = journal.pages.contents[journal.sheet.pageIndex]
if (currentPage.id != pageId) rendered = false;
}
}
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
const ringColor = rendered ? ringOnColor : ringOffColor;
const txt = settings.displayCompendiumName ? name : '';
//const txt = settings.displayCompendiumName ? name : '';
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
let src = '';
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
}
keyPressJournal(settings){
const name = settings.compendiumName;
async keyPressJournal(settings){
const name = settings.journalName;
const pageName = settings.journalPageName;
let pageId;
let journalMode = settings.journalMode ? settings.journalMode : 'openJournal';
if (name == undefined) return;
const journal = game.journal.getName(name);
if (journal == undefined) return;
if (MODULE.getPermission('OTHER','JOURNAL') == false ) return;
if (journal.permission < 2 && MODULE.getPermission('OTHER','JOURNAL_ALL') == false ) return;
if (journal.sheet.rendered == false) journal.sheet.render(true);
else journal.sheet.close();
if (getPermission('OTHER','JOURNAL') == false ) return;
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) return;
if (journal.sheet.rendered == false) {
if (journalMode == 'openPageNr') pageId = journal.pages.contents[pageName]?.id
else if (journalMode == 'openPageName') pageId = journal.pages.getName(pageName)?.id
else {
await journal.sheet.render(true);
return;
}
const page = journal.pages.get(pageId);
if (page == undefined) return;
await journal.sheet.render(true);
setTimeout(() => {
journal.sheet.goToPage(pageId)
},10)
}
else {
if (journalMode == 'openPageNr') pageId = journal.pages.contents[pageName]?.id
else if (journalMode == 'openPageName') pageId = journal.pages.getName(pageName)?.id
else {
await journal.sheet.close();
return;
}
const currentPage = journal.pages.contents[journal.sheet.pageIndex]
if (currentPage.id == pageId) journal.sheet.close();
else {
let page = journal.pages.get(pageId)
if (page != undefined) journal.sheet.goToPage(pageId)
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////
updateChatMessage(settings,context,device,options={}){
if (MODULE.getPermission('OTHER','CHAT') == false ) {
if (getPermission('OTHER','CHAT') == false ) {
streamDeck.noPermission(context,device);
return;
}
const background = settings.background ? settings.background : '#000000';
streamDeck.setTitle("",context);
streamDeck.setIcon(context,device,"",{background:background});
let src = '';
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background});
}
keyPressChatMessage(settings){
if (MODULE.getPermission('OTHER','CHAT') == false ) return;
if (getPermission('OTHER','CHAT') == false ) return;
const message = settings.chatMessage ? settings.chatMessage : '';
let chatData = {
@@ -686,11 +918,16 @@ export class OtherControls{
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
const iconSrc = "modules/MaterialDeck/img/other/d20.png";
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'normal';
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'dialog';
const ringColor = (rollOption == this.rollOption) ? ringOnColor : ringOffColor;
streamDeck.setTitle("",context);
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay:true});
let overlay = true;
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
iconSrc = settings.iconOverride;
overlay = false;
}
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay});
}
keyPressRollOptions(settings){
@@ -700,4 +937,99 @@ export class OtherControls{
this.updateAll();
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////
updateAttackMode(settings,context,device,options={}){
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
const attackMode = settings.attackMode ? settings.attackMode : 'chat';
const ringColor = (attackMode == this.attackMode) ? ringOnColor : ringOffColor;
streamDeck.setTitle("",context);
let overlay = true;
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
iconSrc = settings.iconOverride;
overlay = false;
}
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay});
}
keyPressAttackMode(settings){
const attackMode = settings.attackMode ? settings.attackMode : 'chat';
if (this.attackMode != attackMode) {
this.setAttackMode(attackMode)
}
}
//////////////////////////////////////////////////////////////////////////////////////////
updateRollMode(settings,context,device,options={}){
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
const rollMode = settings.rollMode ? settings.rollMode : 'roll';
const ringColor = (rollMode == game.settings.get('core','rollMode')) ? ringOnColor : ringOffColor;
streamDeck.setTitle("",context);
let overlay = true;
let src = '';
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
iconSrc = settings.iconOverride;
overlay = false;
}
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay});
}
async keyPressRollMode(settings){
const rollMode = settings.rollMode ? settings.rollMode : 'roll';
await game.settings.set('core','rollMode',rollMode);
this.updateAll();
}
//////////////////////////////////////////////////////////////////////////////////////////
async updateGlobalVolumeControls(settings,context,device,options={}){
const background = settings.background ? settings.background : '#000000';
let iconSrc = "modules/MaterialDeck/img/transparant.png";
const type = settings.globalVolumeType ? settings.globalVolumeType : 'playlists';
let txt = "";
if (settings.displayGlobalVolumeValue) {
if (type == 'playlists') txt += Math.round(AudioHelper.volumeToInput(await game.settings.get("core", "globalPlaylistVolume"))*100)/100;
else if (type == 'ambient') txt += Math.round(AudioHelper.volumeToInput(await game.settings.get("core", "globalAmbientVolume"))*100)/100;
else if (type == 'interface') txt += Math.round(AudioHelper.volumeToInput(await game.settings.get("core", "globalInterfaceVolume"))*100)/100;
}
streamDeck.setTitle(txt,context);
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
iconSrc = settings.iconOverride;
}
streamDeck.setIcon(context,device,iconSrc,{background:background});
}
async keyPressGlobalVolumeControls(settings){
const type = settings.globalVolumeType ? settings.globalVolumeType : 'playlists';
const mode = settings.globalVolumeMode ? settings.globalVolumeMode : 'incDec';
const value = settings.globalVolumeValue ? settings.globalVolumeValue : 0.1;
let settingLabel = '';
let newVolume = 0;
if (type == 'playlists') settingLabel = "globalPlaylistVolume";
else if (type == 'ambient') settingLabel = "globalAmbientVolume";
else if (type == 'interface') settingLabel = "globalInterfaceVolume";
if (mode == 'incDec') newVolume = AudioHelper.volumeToInput(await game.settings.get("core", settingLabel)) + parseFloat(value);
else if (mode == 'set') newVolume = value;
if (newVolume > 1) newVolume = 1;
else if (newVolume < 0) newVolume = 0;
await game.settings.set("core", settingLabel, AudioHelper.inputToVolume(newVolume));
document.getElementsByName(settingLabel)[0].value = newVolume;
this.updateAll();
}
}

View File

@@ -1,6 +1,4 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
import { moduleName, streamDeck, getPermission } from "../../MaterialDeck.js";
export class PlaylistControl{
constructor(){
@@ -12,6 +10,7 @@ export class PlaylistControl{
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 != 'playlist') continue;
@@ -21,46 +20,61 @@ export class PlaylistControl{
}
update(settings,context,device){
if (MODULE.getPermission('PLAYLIST','PLAY') == false ) {
if (getPermission('PLAYLIST','PLAY') == false ) {
streamDeck.noPermission(context,device);
return;
}
this.active = true;
const mode = settings.playlistMode ? settings.playlistMode : 'playlist';
if (mode == 'playlist'){
if (mode == 'playlist' || mode == 'playlistName'){
this.updatePlaylist(settings,context,device);
}
else if (mode == 'track'){
else if (mode == 'track' || mode == 'trackName'){
this.updateTrack(settings,context,device);
}
else {
const src = 'modules/MaterialDeck/img/playlist/stop.png';
let src = mode == 'stopAll' ? 'modules/MaterialDeck/img/playlist/stop.png' : 'modules/MaterialDeck/img/playlist/pause.png';
const background = settings.background ? settings.background : '#000000';
const ringColor = (game.playlists.playing.length > 0) ? '#00FF00' : '#000000';
const ring = (game.playlists.playing.length > 0) ? 2 : 1;
const txt = settings.displayPlaylistName ? this.getPlaylist(this.playlistOffset).name : '';
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,overlay:true});
let overlay = true;
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
src = settings.iconOverride;
overlay = false;
}
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,overlay});
streamDeck.setTitle(txt,context);
}
}
updatePlaylist(settings,context,device){
let name = "";
let ringColor = "#000000"
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
let src = "modules/MaterialDeck/img/transparant.png";
//Play/Stop
if (playlistType == 'playStop'){
let playlistNr = parseInt(settings.playlistNr);
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
playlistNr--;
playlistNr += this.playlistOffset;
let playlist = this.getPlaylist(playlistNr);
let playlist;
if (playlistMode == 'playlist') {
let playlistNr = parseInt(settings.playlistNr);
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
playlistNr--;
playlistNr += this.playlistOffset;
playlist = this.getPlaylist(playlistNr);
}
else {
playlist = game.playlists.getName(settings.playlistNr);
}
if (playlist != undefined){
if (playlist.playing)
ringColor = ringOnColor;
@@ -74,20 +88,22 @@ export class PlaylistControl{
else if (playlistType == 'offset') {
let playlistOffset = parseInt(settings.offset);
if (isNaN(playlistOffset)) playlistOffset = 0;
if (playlistOffset == this.playlistOffset) ringColor = ringOnColor;
ringColor = (playlistOffset == this.playlistOffset) ? ringOnColor : ringOffColor;
}
//Relative Offset
else if (playlistType == 'relativeOffset') {
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);
const nrOfPlaylists = parseInt(game.settings.get(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,"",{background:background,ring:2,ringColor:ringColor});
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
streamDeck.setTitle(name,context);
}
@@ -98,24 +114,33 @@ export class PlaylistControl{
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
let src = "modules/MaterialDeck/img/transparant.png";
//Play/Stop
if (playlistType == 'playStop'){
let playlistNr = parseInt(settings.playlistNr);
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
playlistNr--;
playlistNr += this.playlistOffset;
let trackNr = parseInt(settings.trackNr);
if (isNaN(trackNr) || trackNr < 1) trackNr = 1;
trackNr--;
trackNr += this.trackOffset;
if (playlistType == 'playStop' || playlistType == 'incDecVol' || playlistType == 'setVol'){
let playlist;
let trackNr;
if (playlistMode == 'track') {
let playlistNr = parseInt(settings.playlistNr);
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
playlistNr--;
playlistNr += this.playlistOffset;
trackNr = parseInt(settings.trackNr);
if (isNaN(trackNr) || trackNr < 1) trackNr = 1;
trackNr--;
trackNr += this.trackOffset;
playlist = this.getPlaylist(playlistNr);
}
else {
playlist = game.playlists.getName(settings.playlistNr);
}
let playlist = this.getPlaylist(playlistNr);
if (playlist != undefined){
let track;
if (compatibleCore("0.8.1")) track = playlist.sounds.contents[trackNr];
else track = playlist.data.sounds[trackNr];
if (playlistMode == 'track') track = playlist.sounds.contents[trackNr];
else track = playlist.sounds.getName(settings.trackNr);
if (track != undefined){
if (track.playing)
ringColor = ringOnColor;
@@ -123,6 +148,11 @@ export class PlaylistControl{
ringColor = ringOffColor;
if (settings.displayName)
name = track.name;
if (settings.displayTrackVolume) {
if (settings.displayName) name += ' ';
name += Math.round(AudioHelper.volumeToInput(track.volume)*100)/100
}
}
}
}
@@ -130,12 +160,13 @@ export class PlaylistControl{
else if (playlistType == 'offset') {
let trackOffset = parseInt(settings.offset);
if (isNaN(trackOffset)) trackOffset = 0;
if (trackOffset == this.trackOffset) ringColor = ringOnColor;
ringColor = (trackOffset == this.trackOffset) ? ringOnColor : ringOffColor;
}
//Relative Offset
else if (playlistType == 'relativeOffset') {
}
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
streamDeck.setTitle(name,context);
}
@@ -156,7 +187,7 @@ export class PlaylistControl{
}
else {
let playing = game.playlists.playing;
let settings = game.settings.get(MODULE.moduleName,'playlists');
let settings = game.settings.get(moduleName,'playlists');
let selectedPlaylists = settings.selectedPlaylist;
for (let i=0; i<playing.length; i++){
const playlistNr = selectedPlaylists.findIndex(p => p == playing[i]._id);
@@ -166,15 +197,36 @@ export class PlaylistControl{
}
}
pauseAll(){
if (game.user.isGM == false) {
const payload = {
"msgType": "pauseAllPlaylists"
};
game.socket.emit(`module.MaterialDeck`, payload);
return;
}
/*
let playing = game.playlists.playing;
for (let i=0; i<playing.length; i++){
for (let sound of playing[i].sounds.contents) {
if (sound.playing) sound.sound.pause();
}
}
*/
for (let elmnt of document.getElementsByClassName('sound-control pause'))
elmnt.click();
}
getPlaylist(num){
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
let selectedPlaylists = game.settings.get(moduleName,'playlists').selectedPlaylist;
if (selectedPlaylists != undefined)
return game.playlists.get(selectedPlaylists[num]);
else return undefined;
}
keyPress(settings,context,device){
if (MODULE.getPermission('PLAYLIST','PLAY') == false ) return;
if (getPermission('PLAYLIST','PLAY') == false ) return;
let playlistNr = settings.playlistNr;
if (playlistNr == undefined || playlistNr < 1) playlistNr = 1;
playlistNr--;
@@ -190,22 +242,49 @@ export class PlaylistControl{
if (playlistMode == 'stopAll') {
this.stopAll(true);
}
else if (playlistMode == 'pauseAll') {
this.pauseAll();
}
else {
if (playlistType == 'playStop') {
let playlist = this.getPlaylist(playlistNr);
let playlist;
if (playlistMode == 'playlist' || playlistMode == 'track') playlist = this.getPlaylist(playlistNr);
else playlist = game.playlists.getName(settings.playlistNr);
if (playlistType == 'playStop' && (playlistMode == 'playlist' || playlistMode == 'track')) {
if (playlist != undefined){
if (playlistMode == 'playlist')
this.playPlaylist(playlist,playlistNr);
else {
let track;
if (compatibleCore("0.8.1")) track = playlist.sounds.contents[trackNr];
else track = playlist.data.sounds[trackNr];
const track = playlist.sounds.contents[trackNr];
if (track != undefined){
this.playTrack(track,playlist,playlistNr);
}
}
}
}
else if (playlistType == 'playStop') {
if (playlist != undefined) {
if (playlistMode == 'playlistName' && playlist.playing)
playlist.stopAll();
else if (playlistMode == 'playlistName')
playlist.playAll();
else {
const track = playlist.sounds.getName(settings.trackNr);
if (track != undefined && track.playing){
playlist.stopSound(track);
}
else if (track != undefined) {
playlist.playSound(track);
}
}
}
}
else if (playlistType == 'playNext') {
playlist.playNext();
}
else if (playlistType == 'playPrev') {
playlist.playNext(null,{direction:-1});
}
else if (playlistType == 'offset'){
if (playlistMode == 'playlist') {
this.playlistOffset = parseInt(settings.offset);
@@ -222,7 +301,7 @@ export class PlaylistControl{
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);
const nrOfPlaylists = parseInt(game.settings.get(moduleName,'playlists').playlistNumber);
if (number < 0) number += nrOfPlaylists;
else if (number >= nrOfPlaylists) number -= nrOfPlaylists;
this.playlistOffset = number;
@@ -234,6 +313,30 @@ export class PlaylistControl{
}
this.updateAll();
}
else if (playlistType == 'incDecVol' || playlistType == 'setVol') {
const value = settings.trackVolumeValue ? parseFloat(settings.trackVolumeValue) : 0.1;
let playlist = playlistMode == 'track' ? this.getPlaylist(playlistNr) : game.playlists.getName(settings.playlistNr);
if (playlist != undefined){
if (playlistMode != 'track' && playlistMode != 'trackName') return;
const track = playlistMode == 'track' ? playlist.sounds.contents[trackNr] : playlist.sounds.getName(settings.trackNr);
if (track != undefined){
let newVolume = playlistType == 'incDecVol' ? AudioHelper.volumeToInput(track.volume) + value : value;
if (newVolume > 1) newVolume = 1;
else if (newVolume < 0) newVolume = 0;
track.updateSource({volume:AudioHelper.inputToVolume(newVolume)})
track.sound?.fade(track.effectiveVolume, {duration: PlaylistSound.VOLUME_DEBOUNCE_MS});
if ( track.isOwner ) track.debounceVolume(AudioHelper.inputToVolume(newVolume));
for (let elmnt of document.getElementById('currently-playing').getElementsByClassName('sound')) {
if (elmnt.getAttribute('data-sound-id') == track.id) {
elmnt.getElementsByClassName('sound-volume')[0].value = newVolume;
return;
}
}
this.updateAll();
}
}
}
}
}
@@ -252,12 +355,15 @@ export class PlaylistControl{
playlist.stopAll();
return;
}
let mode = game.settings.get(MODULE.moduleName,'playlists').playlistMode[playlistNr];
let mode = game.settings.get(moduleName,'playlists').playlistMode[playlistNr];
//const originalPlayMode = playlist.mode;
//await playlist.update({mode: CONST.PLAYLIST_MODES.SEQUENTIAL});
if (mode == 0) {
mode = game.settings.get(MODULE.moduleName,'playlists').playMode;
if (mode == 2) await this.stopAll();
mode = game.settings.get(moduleName,'playlists').playMode;
if (mode == 2) await this.stopAll(true);
}
playlist.playAll();
//await playlist.update({mode: originalPlayMode});
}
async playTrack(track,playlist,playlistNr){
@@ -272,23 +378,25 @@ export class PlaylistControl{
return;
}
let play;
const originalPlayMode = playlist.mode;
if (track.playing)
play = false;
else {
play = true;
let mode = game.settings.get(MODULE.moduleName,'playlists').playlistMode[playlistNr];
let mode = game.settings.get(moduleName,'playlists').playlistMode[playlistNr];
if (mode == 0) {
mode = game.settings.get(MODULE.moduleName,'playlists').playMode;
if (mode == 1) await playlist.stopAll();
else if (mode == 2) await this.stopAll();
mode = game.settings.get(moduleName,'playlists').playMode;
if (mode == 0) await playlist.update({mode: CONST.PLAYLIST_MODES.SIMULTANEOUS});
else if (mode == 1) await playlist.stopAll();
else if (mode == 2) await this.stopAll(true);
}
else if (mode == 2) await playlist.stopAll();
else if (mode == 2) await playlist.stopAll(true);
}
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});
if (play) await playlist.playSound(track);
else await playlist.stopSound(track);
playlist.update({playing: play});
await playlist.update({mode: originalPlayMode});
}
}

View File

@@ -1,6 +1,5 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
import { streamDeck, getPermission } from "../../MaterialDeck.js";
import { } from "../misc.js";
export class SceneControl{
constructor(){
@@ -12,6 +11,7 @@ export class SceneControl{
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;
@@ -27,13 +27,14 @@ export class SceneControl{
const background = settings.background ? settings.background : '#000000';
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
const ringActiveColor = settings.activeRing ? settings.activeRing : '#FFFF00'
let ringColor = "#000000";
let ring = 2;
let src = "";
let name = "";
if (func == 'visible') { //visible scenes
if (MODULE.getPermission('SCENE','VISIBLE') == false ) {
if (getPermission('SCENE','VISIBLE') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -46,12 +47,12 @@ export class SceneControl{
if (scene != undefined){
ringColor = scene.isView ? ringOnColor : ringOffColor;
if (settings.displaySceneName) name = scene.name;
if (settings.displaySceneIcon) src = scene.img;
if (settings.displaySceneIcon) src = scene.background.src;
if (scene.active) name += "\n(Active)";
}
}
else if (func == 'dir') { //from directory
if (MODULE.getPermission('SCENE','DIRECTORY') == false ) {
if (getPermission('SCENE','DIRECTORY') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -60,33 +61,29 @@ export class SceneControl{
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])
sceneList = ui.scenes.documents;
const scene = sceneList[nr+this.sceneOffset];
if (scene != undefined){
if (scene.isView)
if (scene.active)
ringColor = ringActiveColor;
else if (scene.isView)
ringColor = ringOnColor;
else if (scene.data.navigation && scene.data.permission.default == 0)
else if (scene.navigation && scene.permission.default == 0)
ringColor = '#000791';
else if (scene.data.navigation)
else if (scene.navigation)
ringColor = '#2d2d2d';
else
ringColor = ringOffColor;
if (settings.displaySceneName) name = scene.name;
if (settings.displaySceneIcon) src = scene.img;
if (settings.displaySceneIcon) src = scene.background.src;
if (scene.active) name += "\n(Active)";
}
}
else if (func == 'any') { //by name
if (MODULE.getPermission('SCENE','NAME') == false ) {
if (getPermission('SCENE','NAME') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -94,30 +91,34 @@ export class SceneControl{
let scene = game.scenes.getName(settings.sceneName);
if (scene != undefined){
ringColor = scene.isView ? ringOnColor : ringOffColor;
if (scene.active)
ringColor = ringActiveColor;
else if (scene.isView)
ringColor = ringOnColor;
if (settings.displaySceneName) name = scene.name;
if (settings.displaySceneIcon) src = scene.img;
if (settings.displaySceneIcon) src = scene.background.src;
if (scene.active) name += "\n(Active)";
}
}
else if (func == 'active'){
if (MODULE.getPermission('SCENE','ACTIVE') == false ) {
if (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;
if (settings.displaySceneIcon) src = scene.background.src;
ring = 0;
}
else if (func == 'offset'){
let offset = parseInt(settings.sceneOffset);
if (isNaN(offset)) offset = 0;
if (offset == this.sceneOffset) ringColor = ringOnColor;
else ringColor = ringOffColor;
ringColor = (offset == this.sceneOffset) ? ringOnColor : ringOffColor;
src = "modules/MaterialDeck/img/transparant.png";
}
streamDeck.setTitle(name,context);
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
}
@@ -125,7 +126,7 @@ export class SceneControl{
const func = settings.sceneFunction ? settings.sceneFunction : 'visible';
if (func == 'visible'){ //visible scenes
if (MODULE.getPermission('SCENE','VISIBLE') == false ) return;
if (getPermission('SCENE','VISIBLE') == false ) return;
const viewFunc = settings.sceneViewFunction ? settings.sceneViewFunction : 'view';
let nr = parseInt(settings.sceneNr);
if (isNaN(nr) || nr < 1) nr = 1;
@@ -146,21 +147,15 @@ export class SceneControl{
}
}
else if (func == 'dir') { //from directory
if (MODULE.getPermission('SCENE','DIRECTORY') == false ) return;
if (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])
sceneList = ui.scenes.documents;
const scene = sceneList[nr+this.sceneOffset];
if (scene != undefined){
@@ -178,7 +173,7 @@ export class SceneControl{
}
else if (func == 'any'){ //by name
if (MODULE.getPermission('SCENE','NAME') == false ) return;
if (getPermission('SCENE','NAME') == false ) return;
if (settings.sceneName == undefined || settings.sceneName == '') return;
const scenes = game.scenes.entries;
let scene = game.scenes.getName(settings.sceneName);
@@ -198,7 +193,7 @@ export class SceneControl{
}
}
else if (func == 'active'){
if (MODULE.getPermission('SCENE','ACTIVE') == false ) return;
if (getPermission('SCENE','ACTIVE') == false ) return;
const scene = game.scenes.active;
if (scene == undefined) return;
scene.view();

View File

@@ -1,19 +1,16 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
import { moduleName, streamDeck, getPermission } from "../../MaterialDeck.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 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;
@@ -23,7 +20,7 @@ export class SoundboardControl{
}
update(settings,context,device){
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) {
if (getPermission('SOUNDBOARD','PLAY') == false ) {
streamDeck.noPermission(context,device);
return;
}
@@ -41,13 +38,14 @@ export class SoundboardControl{
soundNr--;
soundNr += this.offset;
let soundboardSettings = game.settings.get(MODULE.moduleName, 'soundboardSettings');
ringColor = (this.activeSounds[soundNr]==false) ? soundboardSettings.colorOff[soundNr] : soundboardSettings.colorOn[soundNr];
let soundboardSettings = game.settings.get(moduleName, 'soundboardSettings');
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);
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
}
else if (mode == 'offset') { //Offset
@@ -60,7 +58,9 @@ export class SoundboardControl{
else ringColor = ringOffColor;
streamDeck.setTitle(txt,context);
streamDeck.setIcon(context,device,"",{background:background,ring:2,ringColor:ringColor});
let src = '';
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
}
else if (mode == 'stopAll') { //Stop all sounds
let src = 'modules/MaterialDeck/img/playlist/stop.png';
@@ -69,6 +69,7 @@ export class SoundboardControl{
for (let i=0; i<this.activeSounds.length; i++)
if (this.activeSounds[i])
soundPlaying = true;
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
if (soundPlaying)
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:'#00FF00',overlay:true});
else
@@ -77,7 +78,7 @@ export class SoundboardControl{
}
keyPressDown(settings){
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) return;
if (getPermission('SOUNDBOARD','PLAY') == false ) return;
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
if (mode == 'playSound') { //Play sound
@@ -86,9 +87,9 @@ export class SoundboardControl{
soundNr--;
soundNr += this.offset;
const playMode = game.settings.get(MODULE.moduleName,'soundboardSettings').mode[soundNr];
const playMode = game.settings.get(moduleName,'soundboardSettings').mode[soundNr];
const repeat = (playMode > 0) ? true : false;
const play = (this.activeSounds[soundNr] == false) ? true : false;
const play = (this.activeSounds[soundNr] == undefined) ? true : false;
this.prePlaySound(soundNr,repeat,play);
}
@@ -99,8 +100,8 @@ export class SoundboardControl{
this.updateAll();
}
else if (mode == 'stopAll') { //Stop All Sounds
for (let i=0; i<64; i++) {
if (this.activeSounds[i] != false){
for (let i=0; i<this.activeSounds.length; i++) {
if (this.activeSounds[i] != undefined){
this.prePlaySound(i,false,false);
}
}
@@ -108,7 +109,7 @@ export class SoundboardControl{
}
keyPressUp(settings){
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) return;
if (getPermission('SOUNDBOARD','PLAY') == false ) return;
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
if (mode != 'playSound') return;
@@ -118,14 +119,14 @@ export class SoundboardControl{
soundNr--;
soundNr += this.offset;
const playMode = game.settings.get(MODULE.moduleName,'soundboardSettings').mode[soundNr];
const playMode = game.settings.get(moduleName,'soundboardSettings').mode[soundNr];
if (playMode == 2)
this.prePlaySound(soundNr,false,false);
}
async prePlaySound(soundNr,repeat,play){
const soundBoardSettings = game.settings.get(MODULE.moduleName,'soundboardSettings');
const soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
const playlistId = (soundBoardSettings.selectedPlaylists != undefined) ? soundBoardSettings.selectedPlaylists[soundNr] : undefined;
let src;
if (playlistId == "" || playlistId == undefined) return;
@@ -145,12 +146,12 @@ export class SoundboardControl{
const soundId = soundBoardSettings.sounds[soundNr];
const sounds = game.playlists.get(playlistId).sounds;
if (sounds == undefined) return;
const sound = compatibleCore("0.8.1") ? sounds.find(p => p.id == soundId) : sounds.find(p => p._id == soundId);
const sound = sounds.find(p => p.id == soundId);
if (sound == undefined) return;
src = sound.path;
}
let volume = game.settings.get(MODULE.moduleName,'soundboardSettings').volume[soundNr]/100;
let volume = game.settings.get(moduleName,'soundboardSettings').volume[soundNr]/100;
volume = AudioHelper.inputToVolume(volume);
let payload = {
@@ -170,56 +171,31 @@ export class SoundboardControl{
if (play){
volume *= game.settings.get("core", "globalAmbientVolume");
if (compatibleCore("0.8.1")) {
let newSound = new SoundNode(src);
if(newSound.loaded == false) await newSound.load({autoplay:true});
newSound.on('end', ()=>{
if (repeat == false) {
this.activeSounds[soundNr] = false;
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] = false;
this.updateAll();
}
},
onstop: ()=>{
this.activeSounds[soundNr] = false;
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();
}});
howl.play();
this.activeSounds[soundNr] = howl;
}
}
});
newSound.play({loop:repeat,volume:volume});
this.activeSounds[soundNr] = newSound;
}
else {
this.activeSounds[soundNr].stop();
this.activeSounds[soundNr] = false;
if (this.activeSounds[soundNr] != undefined) this.activeSounds[soundNr].stop();
this.activeSounds[soundNr] = undefined;
}
this.updateAll();
}
/*
volumeChange(soundNr){
let volume = game.settings.get("core", "globalAmbientVolume");
if (soundNr == 'all') {
for (let i=0; this.activeSounds.length; i++) {
volume * game.settings.get(MODULE.moduleName,'soundboardSettings').volume[i]/100;
volume = AudioHelper.inputToVolume(volume);
this.activeSounds[i].volume = volume;
}
}
else {
volume * game.settings.get(MODULE.moduleName,'soundboardSettings').volume[soundNr]/100;
volume = AudioHelper.inputToVolume(volume);
ambientVolumeChanged(ambientVolume) {
for (let i = 0; i<this.activeSounds.length; i++) {
let sound = this.activeSounds[i];
if (sound == undefined) continue;
let volume = game.settings.get(moduleName,'soundboardSettings').volume[i]/100;
volume = AudioHelper.inputToVolume(volume) * ambientVolume;
sound.gain.value = volume;
}
}
*/
}

1024
src/actions/token.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,703 +0,0 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
export class ExternalModules{
constructor(){
this.active = false;
this.gmScreenOpen = false;
}
async updateAll(data={}){
if (data.gmScreen != undefined){
this.gmScreenOpen = data.gmScreen.isOpen;
}
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
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,device){
this.active = true;
const module = settings.module ? settings.module : 'fxmaster';
if (module == 'fxmaster') this.updateFxMaster(settings,context,device);
else if (module == 'gmscreen') this.updateGMScreen(settings,context,device);
else if (module == 'triggerHappy') this.updateTriggerHappy(settings,context,device);
else if (module == 'sharedVision') this.updateSharedVision(settings,context,device);
else if (module == 'mookAI') this.updateMookAI(settings,context,device);
else if (module == 'notYourTurn') this.updateNotYourTurn(settings,context,device);
else if (module == 'lockView') this.updateLockView(settings,context,device);
else if (module == 'aboutTime') this.updateAboutTime(settings,context,device);
}
keyPress(settings,context,device){
if (this.active == false) return;
const module = settings.module ? settings.module : 'fxmaster';
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);
}
getModuleEnable(moduleId){
const module = game.modules.get(moduleId);
if (module == undefined || module.active == false) return false;
return true;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//FxMaster
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateFxMaster(settings,context,device){
if (game.user.isGM == false) return;
const fxmaster = game.modules.get("fxmaster");
if (fxmaster == undefined || fxmaster.active == false) return;
const type = (settings.fxMasterType == undefined) ? 'weatherControls' : settings.fxMasterType;
const displayIcon = settings.displayFxMasterIcon;
const displayName = settings.displayFxMasterName;
let ring = 0;
let ringColor = "#000000";
let background = "#000000"
let icon = '';
let name = '';
if (type == 'weatherControls') {
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
name = CONFIG.weatherEffects[effect].label;
icon = CONFIG.weatherEffects[effect].icon;
ring = this.findWeatherEffect(effect) != undefined ? 2 : 1;
ringColor = ring < 2 ? '#000000' : "#00ff00";
}
else if (type == 'colorize') {
background = (settings.fxMasterColorizeColor == undefined) ? '#000000' : settings.fxMasterColorizeColor;
icon = "fas fa-palette";
name = game.i18n.localize("MaterialDeck.FxMaster.Colorize");
const filters = canvas.scene.getFlag("fxmaster", "filters");
ring = 2;
if (filters == undefined || filters['core_color'] == undefined) {
ringColor = "#000000";
}
else {
const colors = filters['core_color'].options;
let red = Math.ceil(colors.red*255).toString(16);
if (red.length == 1) red = '0' + red;
let green = Math.ceil(colors.green*255).toString(16);
if (green.length == 1) green = '0' + green;
let blue = Math.ceil(colors.blue*255).toString(16);
if (blue.length == 1) blue = '0' + blue;
ringColor = "#" + red + green + blue;
}
}
else if (type == 'filters') {
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
name = CONFIG.fxmaster.filters[filter].label;
background = "#340057";
if (displayIcon){
if (filter == 'underwater') icon = "fas fa-water";
else if (filter == 'predator') icon = "fas fa-wave-square";
else if (filter == 'oldfilm') icon = "fas fa-film";
else if (filter == 'bloom') icon = "fas fa-ghost";
}
const fxmaster = canvas.scene.getFlag("fxmaster", "filters");
ring = 1;
if (fxmaster != undefined) {
const objKeys = Object.keys(fxmaster);
for (let i=0; i<objKeys.length; i++){
if (objKeys[i] == "core_"+filter) {
ring = 2;
ringColor = "#A600FF";
break;
}
}
}
}
else if (type == 'clear'){
icon = "fas fa-trash";
name = game.i18n.localize("MaterialDeck.FxMaster.Clear");
}
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:ring,ringColor:ringColor});
else streamDeck.setIcon(context,device, "", {background:background,ring:ring,ringColor:ringColor});
if (displayName == 0) name = "";
streamDeck.setTitle(name,context);
}
hexToRgb(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
red: parseInt(result[1], 16)/256,
green: parseInt(result[2], 16)/256,
blue: parseInt(result[3], 16)/256
} : null;
}
keyPressFxMaster(settings,context,device){
if (game.user.isGM == false) return;
const fxmaster = game.modules.get("fxmaster");
if (fxmaster == undefined || fxmaster.active == false) return;
const type = (settings.fxMasterType == undefined) ? 'weatherControls' : settings.fxMasterType;
if (type == 'weatherControls') {
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
let exists = false;
let newEffects = {};
let effects = canvas.scene.getFlag("fxmaster", "effects");
if (effects != undefined){
const weatherIds = Object.keys(effects);
for (let i=0; i<weatherIds.length; i++){
const weather = effects[weatherIds[i]].type;
if (weather === effect) {
exists = true;
continue;
}
newEffects[weatherIds[i]] = effects[weatherIds[i]];
}
}
const density = (settings.densitySlider == undefined) ? 50 : settings.densitySlider;
const speed = (settings.speedSlider == undefined) ? 50 : settings.speedSlider;
const direction = (settings.directionSlider == undefined) ? 50 : settings.directionSlider;
const scale = (settings.scaleSlider == undefined) ? 50 : settings.scaleSlider;
const color = (settings.fxMasterWeatherColor == undefined) ? "#000000" : settings.fxMasterWeatherColor;
const applyColor = (settings.fxWeatherEnColor == undefined) ? false : settings.fxWeatherEnColor;
if (exists == false) {
newEffects[randomID()] = {
type: effect,
options: {
density: density,
speed: speed,
scale: scale,
tint: color,
direction: direction,
apply_tint: applyColor
}
};
}
canvas.scene.unsetFlag("fxmaster", "effects").then(() => {
canvas.scene.setFlag("fxmaster", "effects", newEffects);
});
}
else if (type == 'colorize') {
const color = (settings.fxMasterColorizeColor == undefined) ? '#000000' : settings.fxMasterColorizeColor;
const filters = canvas.scene.getFlag("fxmaster", "filters");
let newFilters = {};
if (filters != undefined){
const filterObjects = Object.keys(filters);
for (let i=0; i<filterObjects.length; i++){
if (filterObjects[i] == 'core_color'){
//continue;
}
newFilters[filterObjects[i]] = filters[filterObjects[i]];
}
}
newFilters['core_color'] = {
type : 'color',
options: this.hexToRgb(color)
};
canvas.scene.unsetFlag("fxmaster", "filters").then(() => {
canvas.scene.setFlag("fxmaster", "filters", newFilters);
});
}
else if (type == 'filters') {
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
const filters = canvas.scene.getFlag("fxmaster", "filters");
let newFilters = {};
let exists = false;
if (filters != undefined){
const filterObjects = Object.keys(filters);
for (let i=0; i<filterObjects.length; i++){
if (filterObjects[i] == 'core_'+filter){
exists = true;
continue;
}
newFilters[filterObjects[i]] = filters[filterObjects[i]];
}
}
if (exists == false) {
newFilters['core_'+filter] = {type : filter};
}
canvas.scene.unsetFlag("fxmaster", "filters").then(() => {
canvas.scene.setFlag("fxmaster", "filters", newFilters);
});
}
else if (type == 'clear'){
canvas.scene.unsetFlag("fxmaster", "filters");
canvas.scene.unsetFlag("fxmaster", "effects");
}
}
findWeatherEffect(effect){
const effects = canvas.scene.getFlag("fxmaster", "effects");
if (effects == undefined) return undefined;
const weatherIds = Object.keys(effects);
for (let i = 0; i < weatherIds.length; ++i) {
const weather = effects[weatherIds[i]].type;
if (weather === effect) return weatherIds[i];
}
return undefined;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//GM Screen
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
updateGMScreen(settings,context,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 });
}
}
}

View File

@@ -1,246 +0,0 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
export class MacroControl{
constructor(){
this.active = false;
this.offset = 0;
}
async updateAll(){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'macro') continue;
await this.update(data.settings,data.context,device.device);
}
}
}
async update(settings,context,device){
this.active = true;
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;
if (macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 0;
macroNumber = parseInt(macroNumber);
let ringColor = "#000000";
let ring = 0;
let name = "";
let src = "";
let macroId = undefined;
let uses = undefined;
if (mode == 'macroBoard') { //Macro board
if ((MODULE.getPermission('MACRO','MACROBOARD') == false )) {
streamDeck.noPermission(context,device);
return;
}
if (settings.macroBoardMode == 'offset') { //Offset
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;
ringColor = (macroOffset == parseInt(this.offset)) ? ringOnColor : ringOffColor;
ring = 2;
}
else { //Execute macro
macroNumber += this.offset - 1;
if (macroNumber < 0) macroNumber = 0;
macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
background = game.settings.get(MODULE.moduleName,'macroSettings').color[macroNumber];
if (background == undefined) background = '#000000';
ring = 0;
}
}
else if (mode == 'name') { //macro by name
const macroName = settings.macroNumber;
const macro = game.macros.getName(macroName);
macroId = macro?.id;
}
else { //Macro Hotbar
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)
macros = ui.customHotbar.macros;
else
macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
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) {
if (displayName) name = macro.name;
if (displayIcon) src = macro.img;
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
}
}
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);
}
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(macros){
for (let i=0; i<32; i++){
const data = streamDeck.buttonContext[i];
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
const context = data.context;
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
const displayName = data.settings.displayName ? data.settings.displayName : false;
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
let background = data.settings.background ? data.settings.background : '#000000';
let macroNumber = data.settings.macroNumber;
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
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);
}
}
keyPress(settings){
const mode = settings.macroMode ? settings.macroMode : 'hotbar';
let macroNumber = settings.macroNumber;
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;
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;
this.offset = macroOffset;
this.updateAll();
}
else
this.executeBoard(macroNumber);
}
}
executeHotbar(macroNumber,mode){
let macroId
if (mode == 'hotbar') macroId = game.user.data.hotbar[macroNumber];
else {
let macros;
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
macros = ui.customHotbar.macros;
}
else macros = game.macros.apps[0].macros;
if (macroNumber > 9) macroNumber = 0;
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
}
if (macroId == undefined) return;
let macro = game.macros.get(macroId);
macro.execute();
}
executeBoard(macroNumber){
macroNumber = parseInt(macroNumber);
macroNumber += this.offset - 1;
if (macroNumber < 0) macroNumber = 0;
var macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
if (macroId != undefined){
let macro = game.macros.get(macroId);
if (macro != undefined && macro != null) {
const args = game.settings.get(MODULE.moduleName,'macroSettings').args;
let furnaceEnabled = false;
let furnace = game.modules.get("furnace");
if (furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) furnaceEnabled = true;
if (args == undefined || args[macroNumber] == undefined || args[macroNumber] == "") furnaceEnabled = false;
if (furnaceEnabled == false) macro.execute();
else {
let chatData = {
user: game.user._id,
speaker: ChatMessage.getSpeaker(),
content: "/'" + macro.name + "' " + args
};
ChatMessage.create(chatData, {});
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,181 +0,0 @@
import * as MODULE from "../MaterialDeck.js";
import {streamDeck} from "../MaterialDeck.js";
import {compatibleCore} from "./misc.js";
export class Move{
constructor(){
this.active = false;
}
update(settings,context,device){
const background = settings.background ? settings.background : '#000000';
const mode = settings.mode ? settings.mode : 'canvas';
const type = settings.type ? settings.type : 'move';
if ((MODULE.getPermission('MOVE','TOKEN') == false && mode == 'selectedToken') || (MODULE.getPermission('MOVE','CANVAS') == false && mode == 'canvas')) {
streamDeck.noPermission(context,device);
return;
}
let url = '';
if (mode == 'canvas' || (mode == 'selectedToken' && type == 'move')){
const dir = settings.dir ? settings.dir : 'center';
if (dir == 'center') //center
url = "modules/MaterialDeck/img/move/center.png";
else if (dir == 'up') //up
url = "modules/MaterialDeck/img/move/up.png";
else if (dir == 'down') //down
url = "modules/MaterialDeck/img/move/down.png";
else if (dir == 'right') //right
url = "modules/MaterialDeck/img/move/right.png";
else if (dir == 'left') //left
url = "modules/MaterialDeck/img/move/left.png";
else if (dir == 'upRight')
url = "modules/MaterialDeck/img/move/upright.png";
else if (dir == 'upLeft')
url = "modules/MaterialDeck/img/move/upleft.png";
else if (dir == 'downRight')
url = "modules/MaterialDeck/img/move/downright.png";
else if (dir == 'downLeft')
url = "modules/MaterialDeck/img/move/downleft.png";
else if (dir == 'zoomIn')
url = "modules/MaterialDeck/img/move/zoomin.png";
else if (dir == 'zoomOut')
url = "modules/MaterialDeck/img/move/zoomout.png";
}
else if (mode == 'selectedToken' && type == 'rotate'){
const value = isNaN(parseInt(settings.rotValue)) ? 0 : parseInt(settings.rotValue);
if (value >= 0)
url = "modules/MaterialDeck/img/move/rotatecw.png";
else
url = "modules/MaterialDeck/img/move/rotateccw.png";
}
streamDeck.setIcon(context,device,url,{background:background,overlay:true});
streamDeck.setTitle('',context);
}
keyPress(settings){
if (canvas.scene == null) return;
if ((MODULE.getPermission('MOVE','TOKEN') == false && mode == 'selectedToken') || (MODULE.getPermission('MOVE','CANVAS') == false && mode == 'canvas')) {
streamDeck.noPermission(context,device);
return;
}
const dir = settings.dir ? settings.dir : 'center';
const mode = settings.mode ? settings.mode : 'canvas';
const type = settings.type ? settings.type : 'move';
let token;
if (mode == 'selectedToken') {
const selection = settings.selection ? settings.selection : 'selected';
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
if (selection == 'selected') token = canvas.tokens.children[0].children.find(p => p.id == MODULE.selectedTokenId);
else if (selection != 'selected' && tokenIdentifier == '') {}
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
else if (selection == 'actorName') token = canvas.tokens.children[0].children.find(p => p.actor.name == tokenIdentifier);
else if (selection == 'tokenId') token = canvas.tokens.children[0].children.find(p => p.id == tokenIdentifier);
else if (selection == 'actorId') token = canvas.tokens.children[0].children.find(p => p.actor.id == tokenIdentifier);
if (token == undefined) return;
}
if (type == 'move'){
if (dir == 'zoomIn') {//zoom in
let viewPosition = canvas.scene._viewPosition;
viewPosition.scale = viewPosition.scale*1.05;
viewPosition.duration = 100;
canvas.animatePan(viewPosition);
}
else if (dir == 'zoomOut') {//zoom out
let viewPosition = canvas.scene._viewPosition;
viewPosition.scale = viewPosition.scale*0.95;
viewPosition.duration = 100;
canvas.animatePan(viewPosition);
}
else {
if (settings.mode == 'selectedToken')
this.moveToken(token,dir);
else
this.moveCanvas(dir);
}
}
else if (type == 'rotate' && mode == 'selectedToken'){
const rotType = settings.rot ? settings.rot : 'to';
const value = isNaN(parseInt(settings.rotValue)) ? 0 : parseInt(settings.rotValue);
let rotationVal;
if (rotType == 'by') rotationVal = token.data.rotation + value;
else if (rotType == 'to') rotationVal = value;
if (compatibleCore("0.8.1")) token.document.update({rotation: rotationVal});
else token.update({rotation: rotationVal});
//token.rotate(rotationVal,false)
}
}
async moveToken(token,dir){
const gridSize = canvas.scene.data.grid;
let x = token.x;
let y = token.y;
if (dir == 'up') y -= gridSize;
else if (dir == 'down') y += gridSize;
else if (dir == 'right') x += gridSize;
else if (dir == 'left') x -= gridSize;
else if (dir == 'upRight') {
x += gridSize;
y -= gridSize;
}
else if (dir == 'upLeft') {
x -= gridSize;
y -= gridSize;
}
else if (dir == 'downRight') {
x += gridSize;
y += gridSize;
}
else if (dir == 'downLeft') {
x -= gridSize;
y += gridSize;
}
else if (dir == 'center') {
let location = token.getCenter(x,y);
canvas.animatePan(location);
}
if (game.user.isGM == false && (token.can(game.user,"control") == false || token.checkCollision(token.getCenter(x, y)))) return;
if (compatibleCore("0.8.1")) token.document.update({x:x,y:y});
else token.update({x:x,y:y});
};
moveCanvas(dir){
let viewPosition = canvas.scene._viewPosition;
const gridSize = canvas.scene.data.grid;
viewPosition.duration = 100;
if (dir == 'up') viewPosition.y -= gridSize;
else if (dir == 'down') viewPosition.y += gridSize;
else if (dir == 'right') viewPosition.x += gridSize;
else if (dir == 'left') viewPosition.x -= gridSize;
else if (dir == 'upRight') {
viewPosition.x += gridSize;
viewPosition.y -= gridSize;
}
else if (dir == 'upLeft') {
viewPosition.x -= gridSize;
viewPosition.y -= gridSize;
}
else if (dir == 'downRight') {
viewPosition.x += gridSize;
viewPosition.y += gridSize;
}
else if (dir == 'downLeft') {
viewPosition.x -= gridSize;
viewPosition.y += gridSize;
}
else if (dir == 'center') {
viewPosition.x = (canvas.dimensions.sceneWidth+window.innerWidth)/2;
viewPosition.y = (canvas.dimensions.sceneHeight+window.innerHeight)/2;
}
canvas.animatePan(viewPosition);
}
}

View File

@@ -1,5 +1,5 @@
import * as MODULE from "../MaterialDeck.js";
import { playlistConfigForm, macroConfigForm, soundboardConfigForm } from "./misc.js";
import { moduleName, isEmpty } from "../MaterialDeck.js";
import { playlistConfigForm, macroConfigForm, soundboardConfigForm, downloadUtility, deviceConfig } from "./misc.js";
let userPermissions = {};
const defaultEnable = [true,true,true,true];
@@ -22,10 +22,6 @@ const defaultUserPermissions = {
MACROBOARD: [false,false,true,true],
MACROBOARD_CONFIGURE: [false,false,true,true]
},
MOVE: {
TOKEN: [true,true,true,true],
CANVAS: [true,true,true,true]
},
OTHER: {
PAUSE: [false,false,true,true],
CONTROL: [true,true,true,true],
@@ -74,8 +70,9 @@ export const registerSettings = async function() {
//world,global,client
//Enabled the module
game.settings.register(MODULE.moduleName,'Enable', {
game.settings.register(moduleName,'Enable', {
name: "MaterialDeck.Sett.Enable",
hint: "MaterialDeck.Sett.EnableHint",
scope: "client",
config: true,
default: false,
@@ -83,20 +80,42 @@ export const registerSettings = async function() {
onChange: x => window.location.reload()
});
game.settings.register(MODULE.moduleName,'streamDeckModel', {
name: "MaterialDeck.Sett.Model",
hint: "MaterialDeck.Sett.Model_Hint",
game.settings.register(moduleName,'EnableDialogShown', {
name: "MaterialDeck_EnableDialogShown",
scope: "client",
config: false,
default: false,
type: Boolean
});
/**
* System override
*/
game.settings.register(moduleName,'systemOverride', {
name: "MaterialDeck.Sett.SystemOverride",
hint: "MaterialDeck.Sett.SystemOverrideHint",
scope: "client",
config: true,
type:Number,
default:1,
choices:["MaterialDeck.Sett.Model_Mini","MaterialDeck.Sett.Model_Normal","MaterialDeck.Sett.Model_XL"],
default: "",
type: String,
choices: {
"": "Autodetect",
"D35E": "Dungeons & Dragons 3.5e",
"dnd5e": "Dungeons & Dragons 5e",
"forbidden-lands": "Forbidden Lands",
"pf1": "Pathfinder 1e",
"pf2e": "Pathfinder 2e",
"demonlord": "Shadow of the Demon Lord",
"sfrpg": "Starfinder",
"wfrp4e": "Warhammer Fantasy Roleplay 4e",
},
onChange: x => window.location.reload()
});
/**
* Sets the ip address of the server
*/
game.settings.register(MODULE.moduleName,'address', {
game.settings.register(moduleName,'address', {
name: "MaterialDeck.Sett.ServerAddr",
hint: "MaterialDeck.Sett.ServerAddrHint",
scope: "client",
@@ -106,7 +125,7 @@ export const registerSettings = async function() {
onChange: x => window.location.reload()
});
game.settings.register(MODULE.moduleName, 'imageBuffer', {
game.settings.register(moduleName, 'imageBuffer', {
name: "MaterialDeck.Sett.ImageBuffer",
hint: "MaterialDeck.Sett.ImageBufferHint",
default: 100,
@@ -117,7 +136,7 @@ export const registerSettings = async function() {
});
game.settings.register(MODULE.moduleName, 'imageBrightness', {
game.settings.register(moduleName, 'imageBrightness', {
name: "MaterialDeck.Sett.ImageBrightness",
hint: "MaterialDeck.Sett.ImageBrightnessHint",
default: 50,
@@ -128,39 +147,74 @@ export const registerSettings = async function() {
});
game.settings.register(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',{
game.settings.registerMenu(moduleName, 'helpMenu',{
name: "MaterialDeck.Sett.Help",
label: "MaterialDeck.Sett.Help",
type: helpMenu,
restricted: false
});
game.settings.registerMenu(MODULE.moduleName, 'permissionConfig',{
game.settings.registerMenu(moduleName, 'downloadUtility',{
name: "MaterialDeck.DownloadUtility.Title",
label: "MaterialDeck.DownloadUtility.Title",
type: downloadUtility,
restricted: false
});
game.settings.registerMenu(moduleName, 'deviceConfig',{
name: "MaterialDeck.DeviceConfig.Title",
label: "MaterialDeck.DeviceConfig.Title",
type: deviceConfig,
restricted: false
});
game.settings.register(moduleName, 'devices', {
name: "devices",
scope: "client",
type: Object,
config: false,
default: {}
});
game.settings.registerMenu(moduleName, 'permissionConfig',{
name: "MaterialDeck.Sett.Permission",
label: "MaterialDeck.Sett.Permission",
type: userPermission,
restricted: true
});
game.settings.register(MODULE.moduleName, 'userPermission', {
game.settings.register(moduleName, 'userPermission', {
name: "userPermission",
label: "",
scope: "world",
type: Object,
config: false
config: false,
default: {}
});
/**
* Playlist soundboard
*/
game.settings.registerMenu(MODULE.moduleName, 'playlistConfigMenu',{
game.settings.registerMenu(moduleName, 'playlistConfigMenu',{
name: "MaterialDeck.Sett.PlaylistConfig",
label: "MaterialDeck.Sett.PlaylistConfig",
type: playlistConfigForm,
restricted: false
});
game.settings.register(MODULE.moduleName, 'playlists', {
game.settings.register(moduleName, 'playlists', {
name: "selectedPlaylists",
scope: "world",
type: Object,
@@ -171,31 +225,33 @@ export const registerSettings = async function() {
/**
* Macro Board
*/
game.settings.registerMenu(MODULE.moduleName, 'macroConfigMenu',{
game.settings.registerMenu(moduleName, 'macroConfigMenu',{
name: "MaterialDeck.Sett.MacroConfig",
label: "MaterialDeck.Sett.MacroConfig",
type: macroConfigForm,
restricted: false
});
game.settings.register(MODULE.moduleName, 'macroSettings', {
game.settings.register(moduleName, 'macroSettings', {
name: "macroSettings",
scope: "world",
type: Object,
config: false
config: false,
default: {}
});
game.settings.register(MODULE.moduleName, 'macroArgs', {
game.settings.register(moduleName, 'macroArgs', {
name: "macroArgs",
scope: "world",
type: Object,
config: false
config: false,
default: {}
});
/**
* Soundboard
*/
game.settings.register(MODULE.moduleName, 'soundboardSettings', {
game.settings.register(moduleName, 'soundboardSettings', {
name: "soundboardSettings",
scope: "world",
type: Object,
@@ -203,15 +259,16 @@ export const registerSettings = async function() {
config: false
});
game.settings.registerMenu(MODULE.moduleName, 'soundboardConfigMenu',{
game.settings.registerMenu(moduleName, 'soundboardConfigMenu',{
name: "MaterialDeck.Sett.SoundboardConfig",
label: "MaterialDeck.Sett.SoundboardConfig",
type: soundboardConfigForm,
restricted: false
});
let permissionSettings = game.settings.get(MODULE.moduleName,'userPermission');
if (permissionSettings == undefined || permissionSettings == null || MODULE.isEmpty(permissionSettings)) {
let permissionSettings = game.settings.get(moduleName,'userPermission');
if (permissionSettings == undefined || permissionSettings == null || isEmpty(permissionSettings)) {
permissionSettings = {
enable: defaultEnable,
permissions: defaultUserPermissions
@@ -222,11 +279,12 @@ export const registerSettings = async function() {
if (permissionSettings.permissions.TOKEN.OBSERVER == undefined) permissionSettings.permissions.TOKEN.OBSERVER = [false,true,true,true];
if (permissionSettings.permissions.MACRO.BY_NAME == undefined) permissionSettings.permissions.MACRO.BY_NAME = [false,false,true,true];
}
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
if (game.user.isGM)
game.settings.set(moduleName,'userPermission',permissionSettings);
}
export class helpMenu extends FormApplication {
constructor(data, options) {
super(data, options);
@@ -279,7 +337,7 @@ export class helpMenu extends FormApplication {
*/
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id: "userPermissionConfig",
id: "materialDeck_userPermissionConfig",
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.Permission"),
template: "./modules/MaterialDeck/templates/userPermissionConfig.html",
width: 660,
@@ -292,22 +350,23 @@ export class helpMenu extends FormApplication {
* Provide data to the template
*/
async getData() {
let settings = game.settings.get(MODULE.moduleName,'userPermission');
if (settings == undefined || settings == null || MODULE.isEmpty(settings)) {
let settings = game.settings.get(moduleName,'userPermission');
if (settings == undefined || settings == null || isEmpty(settings)) {
settings = {
enable: defaultEnable,
permissions: defaultUserPermissions
}
}
const actions = Object.entries(duplicate(settings.permissions)).reduce((arr, e) => {
//const perm = e[1];
const perms = Object.entries(duplicate(e[1])).reduce((arr, p) => {
//const perm = e[1];
let perm = {};
perm.roles = [p[1][0],p[1][1],p[1][2],p[1][3]]
perm.roles = [
{role:'player',en:p[1][0]},
{role:'trusted',en:p[1][1]},
{role:'assistent',en:p[1][2]},
{role:'gm',en: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");
@@ -323,16 +382,25 @@ export class helpMenu extends FormApplication {
arr.push(cat);
return arr;
}, []);
const current = await game.settings.get("core", "permissions");
for (let i=0; i<actions.length; i++) {
if (actions[i].id == 'MOVE')
actions.splice(i,1);
}
const enable = [
{role:'player',en:settings.enable[0]},
{role:'trusted',en:settings.enable[1]},
{role:'assistent',en:settings.enable[2]},
{role:'gm',en:settings.enable[3]}
]
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
actions,
enable
}
}
@@ -342,12 +410,28 @@ export class helpMenu extends FormApplication {
* @param {*} formData
*/
async _updateObject(event, formData) {
let permissions = expandObject(formData);
let settings = {};
settings.enable = permissions.ENABLE;
let permissions = expandObject(formData);
for (const [key, value] of Object.entries(permissions)) {
const val = value;
let conf = {};
if (key == 'ENABLE') {
settings.enable = [value.player, value.trusted, value.assistent, value.gm];
}
else {
conf = {};
for (const [key, value] of Object.entries(val)) {
const arr = [value.player, value.trusted, value.assistent, value.gm];
conf[key] = arr;
}
}
permissions[key] = conf;
}
delete permissions.ENABLE;
settings.permissions = permissions;
game.settings.set(MODULE.moduleName,'userPermission',settings);
game.settings.set(moduleName,'userPermission',settings);
}
async activateListeners(html) {
@@ -366,7 +450,7 @@ export class helpMenu extends FormApplication {
enable: defaultEnable,
permissions: defaultUserPermissions
}
await game.settings.set(MODULE.moduleName,'userPermission',settings);
await game.settings.set(moduleName,'userPermission',settings);
this.render();
ui.notifications.info(game.i18n.localize("MaterialDeck.Perm.DefaultNotification"));
}

View File

@@ -1,4 +1,4 @@
import * as MODULE from "../MaterialDeck.js";
import { moduleName, sendWS, tokenControl, macroControl, combatTracker, playlistControl, soundboard, otherControls, externalModules, sceneControl } from "../MaterialDeck.js";
export class StreamDeck{
constructor() {
@@ -34,7 +34,31 @@ export class StreamDeck{
}
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings){
//getButtonContext
newDevice(iteration,device) {
if (this.buttonContext[iteration] == undefined) {
const deckSize = device.size.columns*device.size.rows;
let buttons = [];
for (let i=0; i<deckSize; i++){
buttons[i] = undefined;
}
this.buttonContext[iteration] = {
device: device.id,
name: device.name,
type: device.type,
size: deckSize,
buttons: buttons
}
}
}
removeDevice(iteration) {
this.buttonContext[iteration] = undefined;
}
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings, name, type){
if (device == undefined) return;
if (this.buttonContext[iteration] == undefined) {
const deckSize = size.columns*size.rows;
let buttons = [];
@@ -43,6 +67,8 @@ export class StreamDeck{
}
this.buttonContext[iteration] = {
device: device,
name: name,
type: type,
size: size,
buttons: buttons
}
@@ -60,7 +86,7 @@ export class StreamDeck{
clearContext(device,action,coordinates = {column:0,row:0}){
for (let d of this.buttonContext) {
if (d.device == device) {
if (d?.device == device) {
const num = coordinates.column + coordinates.row*d.size.columns;
d.buttons[num] = undefined;
return;
@@ -68,14 +94,14 @@ export class StreamDeck{
}
if (this.getActive(action) == false){
if (action == 'token') MODULE.tokenControl.active = false;
else if (action == 'macro') MODULE.macroControl.active = false;
else if (action == 'combattracker') MODULE.combatTracker.active = false;
else if (action == 'playlist') MODULE.playlistControl.active = false;
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;
if (action == 'token') tokenControl.active = false;
else if (action == 'macro') macroControl.active = false;
else if (action == 'combattracker') combatTracker.active = false;
else if (action == 'playlist') playlistControl.active = false;
else if (action == 'soundboard') soundboard.active = false;
else if (action == 'other') otherControls.active = false;
else if (action == 'external') externalModules.active = false;
else if (action == 'scene') sceneControl.active = false;
}
}
@@ -109,6 +135,7 @@ export class StreamDeck{
counter++;
}
}
let txtNew = "";
let newTxtArray = ['','','','','','','','','','','','','','','','','','','',''];
counter = 0;
@@ -117,27 +144,41 @@ export class StreamDeck{
let txtNewPart = txtArray[i];
if (txtNewPart != undefined && txtNewPart.length > 10){
let syllables = this.syllabify(txtNewPart);
for (let j=0; j<syllables.length; j++){
if (syllables.length == 0){
let syllables = [];
if (game.i18n.lang == "ru") {
newTxtArray[counter] = txtNewPart.slice(0,txtNewPart.length/2) + '-';
counter++;
newTxtArray[counter] = txtNewPart.slice(txtNewPart.length/2+1,txtNewPart.length);
counter++;
}
else {
syllables = this.syllabify(txtNewPart);
if (syllables == null) {
newTxtArray[counter] = txtNewPart;
counter++;
}
else if (syllables[j+1] == undefined){
newTxtArray[counter] = syllables[j];
counter++;
}
else if ((syllables[j].length+syllables[j+1].length) < 10){
newTxtArray[counter] = syllables[j]+syllables[j+1];
if (syllables.length-2 > j) newTxtArray[counter] += '-';
counter++;
j++;
}
else {
newTxtArray[counter] = syllables[j];
if (syllables.length > j) newTxtArray[counter] += '-';
counter++;
for (let j=0; j<syllables.length; j++){
if (syllables.length == 0){
newTxtArray[counter] = txtNewPart;
counter++;
}
else if (syllables[j+1] == undefined){
newTxtArray[counter] = syllables[j];
counter++;
}
else if ((syllables[j].length+syllables[j+1].length) < 10){
newTxtArray[counter] = syllables[j]+syllables[j+1];
if (syllables.length-2 > j) newTxtArray[counter] += '-';
counter++;
j++;
}
else {
newTxtArray[counter] = syllables[j];
if (syllables.length > j) newTxtArray[counter] += '-';
counter++;
}
}
}
}
}
@@ -164,15 +205,14 @@ export class StreamDeck{
setTitle(txt,context){
if (txt == null || txt == undefined) txt = '';
txt = this.formatTitle(txt);
for (let i=0; i<32; i++){
if (this.buttonContext[i] == undefined) continue;
if (this.buttonContext[i].context == context) {
if (this.buttonContext[i].txt != undefined)
if (this.buttonContext[i].txt == txt)
return;
this.buttonContext[i].txt = txt;
}
for (let device of this.buttonContext) {
if (device == undefined) continue;
const btn = device.buttons.find(b => b?.context == context);
if (btn == undefined) continue;
btn.txt = txt;
}
let msg = {
target: "SD",
event: 'setTitle',
@@ -182,7 +222,7 @@ export class StreamDeck{
target: 0
}
};
MODULE.sendWS(JSON.stringify(msg));
sendWS(JSON.stringify(msg));
}
setColor(context,color = '#000000'){
@@ -194,7 +234,7 @@ export class StreamDeck{
format: 'color',
background: color
};
MODULE.sendWS(JSON.stringify(msg));
sendWS(JSON.stringify(msg));
}
setImage(image,context,device,nr,id){
@@ -210,7 +250,7 @@ export class StreamDeck{
target: 0
}
};
MODULE.sendWS(JSON.stringify(json));
sendWS(JSON.stringify(json));
}
setBufferImage(context,device,nr,id){
@@ -225,7 +265,7 @@ export class StreamDeck{
target: 0
}
};
MODULE.sendWS(JSON.stringify(json));
sendWS(JSON.stringify(json));
}
setIcon(context,device,src='',options = {}){
@@ -240,7 +280,7 @@ export class StreamDeck{
//if (src != 'modules/MaterialDeck/img/black.png')
for (let d of this.buttonContext) {
if (d.device == device) {
if (d?.device == device) {
for (let i=0; i<d.buttons.length; i++){
if (clock != false) break;
if (d.buttons[i] == undefined) continue;
@@ -279,6 +319,8 @@ export class StreamDeck{
let format = split[split.length-1].split('?')[0];
split = split[0].split(' ');
if (split[0] == 'fas' || split[0] == 'far' || split[0] == 'fal' || split[0] == 'fad') format = 'icon';
let split2 = split[0].split('-');
if (split2[0] == 'fa') format = 'icon';
let msg = {
target: "SD",
event: 'setIcon',
@@ -304,7 +346,7 @@ export class StreamDeck{
action: action,
state: state
};
MODULE.sendWS(JSON.stringify(msg));
sendWS(JSON.stringify(msg));
}
setProfile(action,device){
@@ -321,7 +363,7 @@ export class StreamDeck{
profile: profile
}
};
MODULE.sendWS(JSON.stringify(json));
sendWS(JSON.stringify(json));
}
setPluginId(id){
@@ -356,15 +398,13 @@ export class StreamDeck{
if(isNaN(parseInt(background[i],16)))
BGvalid = false;
if (BGvalid == false) background = '#000000';
let canvas;
if (canvas == null || canvas == undefined){
canvas = document.createElement('canvas');
canvas.width="144";
canvas.height="144";
canvas.style="background-color:transparent;visibility:hidden";
document.getElementById('sdCanvasBox').appendChild(canvas); // adds the canvas to #someBox
}
let canvas = document.createElement('canvas');
canvas.width="144";
canvas.height="144";
canvas.style="background-color:transparent;visibility:hidden;display:none";
document.getElementById('sdCanvasBox').appendChild(canvas); // adds the canvas to #someBox
this.counter++;
if (this.counter > 31) this.counter = 0;
@@ -388,7 +428,7 @@ export class StreamDeck{
else {
}
if (uses != undefined && uses.heart != false && (uses.available > 0 || uses.maximum != undefined)) {
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);
@@ -410,15 +450,16 @@ 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 == true) ctx.filter = "brightness(" + game.settings.get(MODULE.moduleName,'imageBrightness') + "%)";
if (data.overlay == true) ctx.filter = "brightness(" + game.settings.get(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;
@@ -450,10 +491,18 @@ export class StreamDeck{
yStart = 0;
}
ctx.drawImage(img, xStart+margin, yStart+margin, renderableWidth - 2*margin, renderableHeight - 2*margin);
if (uses != undefined && uses.heart == false && (uses.available > 0 || uses.maximum != undefined)) {
let txt = uses.available;
if (uses.maximum != undefined) txt = uses.available + '/' + uses.maximum;
if (uses.maximum == undefined ) uses.maximum = 1;
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));
@@ -462,7 +511,8 @@ export class StreamDeck{
if (green.length == 1) green = "0"+green;
red = red.toString(16);
if (red.length == 1) red = "0"+red;
if (uses.available == 0) ctx.strokeStyle = "#c80000";
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);
@@ -534,7 +584,7 @@ export class StreamDeck{
addToImageBuffer(img,data){
const id = this.getImageBufferId(data);
const maxBufferSize = game.settings.get(MODULE.moduleName,'imageBuffer');
const maxBufferSize = game.settings.get(moduleName,'imageBuffer');
if (maxBufferSize == 0) return false;
if (this.imageBufferCounter > maxBufferSize) this.imageBufferCounter = 0;
@@ -551,7 +601,7 @@ export class StreamDeck{
}
checkImageBuffer(data){
if (game.settings.get(MODULE.moduleName,'imageBuffer') == 0) return false;
if (game.settings.get(moduleName,'imageBuffer') == 0) return false;
const id = this.getImageBufferId(data);
for (let i=0; i<this.imageBuffer.length; i++){
@@ -573,4 +623,4 @@ export class StreamDeck{
this.setIcon(context,device,url,{background:background});
this.setTitle(txt,context);
}
}
}

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

@@ -0,0 +1,246 @@
import { compatibleCore } from "../misc.js";
export class demonlord{
conf;
constructor(){
console.log("Material Deck: Using system 'Shadow of the Demon Lord'");
this.conf = CONFIG.DL;
}
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
getStatsList() {
return [
{value:'HP', name:'HP'},
{value:'HPbox', name:'HP (box)'},
{value:'AC', name:'AC'},
{value:'Speed', name:'Speed'},
{value:'Init', name:'Initiative'},
{value:'Ability', name:'Ability Score'},
{value:'AbilityMod', name:'Ability Score Modifier'}
]
}
getAttackModes() {
return [
{value:'attack', name:'Attack'},
{value:'damage', name:'Damage'},
{value:'damageCrit', name:'Critical Damage'},
{value:'versatile', name:'Versatile Damage'},
{value:'versatileCrit', name:'Versatile Critical Damage'},
{value:'otherFormula', name:'Other Formula'},
]
}
getHP(token) {
const hp = this.getActorData(token).characteristics.health;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
return;
}
getAC(token) {
return this.getActorData(token).characteristics.defense;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
return this.getActorData(token).characteristics.speed;
}
getInitiative(token) {
return this.getActorData(token).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 this.getActorData(token).attributes?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = this.getActorData(token).attributes?.[ability].modifier;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
return;
}
getSavesList() {
return [];
}
getAbilityList() {
const keys = Object.keys(this.conf.attributes);
let abilities = [];
for (let k of keys) abilities.push({value:k, name:this.conf.attributes?.[k]})
return abilities;
}
getSkill(token, skill) {
if (skill == undefined) skill = 'acr';
const val = this.getActorData(token).skills?.[skill].total;
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;
}
getConditionList() {
let conditions = [];
for (let c of CONFIG.statusEffects) if (c.disabled != undefined) conditions.push({value:c.id, name:c.label});
return conditions;
}
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
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: getItemData(item).quantity};
}
/**
* Spells
*/
getSpells(token,level,type) {
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' && getItemData(i).rank == level)
}
getSpellUses(token,level,item) {
return;
}
getSpellTypes() {
return [
]
}
rollItem(item) {
return item.roll()
}
/**
* Ring Colors
*/
getSkillRingColor(token, skill) {
return;
}
getSaveRingColor(token, save) {
return;
}
getSkillList() {
return [];
}
getOnClickList() {
return [{value:'initiative',name:'Toggle Initiative'}]
}
getRollTypes() {
return []
}
getItemTypes() {
return []
}
getWeaponRollModes() {
return []
}
getFeatureTypes() {
return [
{value:'class', name:'Class'},
{value:'feat', name:'Abilities'}
]
}
getSpellLevels() {
return [
{value:'0', name:'Cantrip'},
{value:'1', name:'1st Level'},
{value:'2', name:'2nd Level'},
{value:'3', name:'3rd Level'},
{value:'4', name:'4th Level'},
{value:'5', name:'5th Level'},
{value:'6', name:'6th Level'},
{value:'7', name:'7th Level'},
{value:'8', name:'8th Level'},
{value:'9', name:'9th Level'}
]
}
}

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

@@ -0,0 +1,342 @@
import { compatibleCore } from "../misc.js";
export class dnd35e{
conf;
system;
constructor(gamingSystem){
console.log("Material Deck: Using system 'Dungeons & Dragons 3.5e'/'Pathfinder 1e'");
if (gamingSystem == 'D35E') this.conf = CONFIG.D35E;
else if (gamingSystem == 'pf1') this.conf = CONFIG.PF1;
this.system = gamingSystem;
}
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
getStatsList() {
return [
{value:'HP', name:'HP'},
{value:'HPbox', name:'HP (box)'},
{value:'TempHP', name:'Temp HP'},
{value:'AC', name:'AC'},
{value:'Speed', name:'Speed'},
{value:'Init', name:'Initiative'},
{value:'Ability', name:'Ability Score'},
{value:'AbilityMod', name:'Ability Score Modifier'},
{value:'Save', name:'Saving Throw Modifier'},
{value:'Skill', name:'Skill Modifier'},
{value:'Prof', name:'Proficiency'}
]
}
getAttackModes() {
return [
]
}
getOnClickList() {
return []
}
getHP(token) {
const hp = this.getActorData(token).attributes.hp;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
const hp = this.getActorData(token).attributes.hp;
return {
value: (hp.temp == null) ? 0 : hp.temp,
max: (hp.tempmax == null) ? 0 : hp.tempmax
}
}
getAC(token) {
return this.getActorData(token).attributes.ac.normal.total;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
const movement = this.getActorData(token).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 = this.getActorData(token).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 this.getActorData(token).abilities?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = this.getActorData(token).abilities?.[ability].mod;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
if (ability == undefined) ability = 'fort';
let val = this.getActorData(token).attributes.savingThrows?.[ability].total;
return (val >= 0) ? `+${val}` : val;
}
getAbilityList() {
const keys = Object.keys(this.conf.abilities);
let abilities = [];
for (let k of keys) abilities.push({value:this.conf.abilityAbbreviations?.[k], name:this.conf.abilities?.[k]})
return abilities;
}
getSavesList() {
const keys = Object.keys(this.conf.savingThrows);
let saves = [];
for (let k of keys) saves.push({value:k, name:this.conf.savingThrows?.[k]})
return saves;
}
getSkill(token, skill) {
if (skill == undefined) skill = 'apr';
const val = this.getActorData(token).skills?.[skill].mod;
return (val >= 0) ? `+${val}` : val;
}
getSkillList() {
const keys = Object.keys(this.conf.skills);
let skills = [];
for (let s of keys) {
const skill = this.conf.skills?.[s];
skills.push({value:s, name:skill})
}
return skills;
}
getProficiency(token) {
const val = this.getActorData(token).attributes.prof;
return (val >= 0) ? `+${val}` : val;
}
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;
}
getConditionList() {
let conditions = [];
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
return conditions;
}
/**
* 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') {
options.rerollInitiative = true;
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);
}
getRollTypes() {
if (this.system == 'D35E') {
return [
{value:'initiative', name:'Initiative'},
{value:'grapple', name:'Grapple'},
{value:'bab', name:'Base Attack Bonus'},
{value:'melee', name:'Melee'},
{value:'ranged', name:'Ranged'}
]
}
else if (this.system == 'pf1') {
return [
{value:'initiative', name:'Initiative'},
{value:'cmb', name:'Combat Maneuver Bonus'},
{value:'bab', name:'Base Attack Bonus'},
{value:'attack', name:'Attack'},
{value:'defenses', name:'Defenses'}
]
}
}
/**
* Items
*/
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' && this.getItemData(i).subType == itemType);
else {
if (itemType == 'gear' || itemType == 'ammo' || itemType == 'misc' || itemType == 'tradeGoods')
return allItems.filter(i => i.type == 'loot' && this.getItemData(i).subType == itemType);
else return allItems.filter(i => i.type == itemType);
}
}
getItemUses(item) {
return {available: this.getItemData(item).quantity};
}
getItemTypes() {
return [
{value:'weapon', name:'Weapons'},
{value:'equipment', name:'Armor/Equipment'},
{value:'consumable', name:'Consumables'},
{value:'gear', name:'Gear'},
{value:'ammo', name:'Ammunition'},
{value:'misc', name:'Miscellaneous'},
{value:'tradeGoods', name:'Trade Goods'},
{value:'container', name:'Containers'}
]
}
getWeaponRollModes() {
return []
}
/**
* Features
*/
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: this.getItemData(item).levels};
else return {
available: this.getItemData(item).uses.value,
maximum: this.getItemData(item).uses.max
};
}
getFeatureTypes() {
return [
{value:'class', name:'Class'},
{value:'feat', name:'Abilities'}
]
}
/**
* Spells
*/
getSpells(token,level,type) {
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' && this.getItemData(i).level == level)
}
getSpellUses(token,level,item) {
if (level == undefined) level = 'any';
if (this.getItemData(item).level == 0) return;
return {
available: item.charges,
maximum: item.maxCharges
}
}
getSpellLevels() {
const keys = Object.keys(this.conf.spellLevels);
let levels = [];
for (let l of keys) levels.push({value:l, name:this.conf.spellLevels?.[l]});
return levels;
}
getSpellTypes() {
return [
]
}
rollItem(item) {
return item.roll()
}
/**
* Ring Colors
*/
getSkillRingColor(token, skill) {
return;
}
getSaveRingColor(token, save) {
return;
}
}

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

@@ -0,0 +1,383 @@
import { compatibleCore, compatibleSystem } from "../misc.js";
const proficiencyColors = {
0: "#000000",
0.5: "#804A00",
1: "#C0C0C0",
2: "#FFD700"
}
export class dnd5e{
conf;
constructor(){
console.log("Material Deck: Using system 'Dungeons & Dragons 5e'");
this.conf = game.system.config;
}
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
getStatsList() {
return [
{value:'HP', name:'HP'},
{value:'HPbox', name:'HP (box)'},
{value:'TempHP', name:'Temp HP'},
{value:'AC', name:'AC'},
{value:'Speed', name:'Speed'},
{value:'Init', name:'Initiative'},
{value:'Ability', name:'Ability Score'},
{value:'AbilityMod', name:'Ability Score Modifier'},
{value:'Save', name:'Saving Throw Modifier'},
{value:'Skill', name:'Skill Modifier'},
{value:'PassivePerception', name:'Passive Perception'},
{value:'PassiveInvestigation', name:'Passive Investigation'},
{value:'Prof', name:'Proficiency'}
]
}
getAttackModes() {
return [
{value:'attack', name:'Attack'},
{value:'damage', name:'Damage'},
{value:'damageCrit', name:'Critical Damage'},
{value:'versatile', name:'Versatile Damage'},
{value:'versatileCrit', name:'Versatile Critical Damage'},
{value:'otherFormula', name:'Other Formula'},
]
}
getOnClickList() {
return []
}
getHP(token) {
const hp = this.getActorData(token).attributes.hp;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
const hp = this.getActorData(token).attributes.hp;
return {
value: (hp.temp == null) ? 0 : hp.temp,
max: (hp.tempmax == null) ? 0 : hp.tempmax
}
}
getAC(token) {
return this.getActorData(token).attributes.ac.value;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
const movement = this.getActorData(token).attributes.movement;
let speed = "";
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}`;
}
return speed;
}
getInitiative(token) {
let initiative = this.getActorData(token).attributes.init.total;
return (initiative >= 0) ? `+${initiative}` : initiative;
}
toggleInitiative(token) {
return;
}
getPassivePerception(token) {
return this.getActorData(token).skills.prc.passive;
}
getPassiveInvestigation(token) {
return this.getActorData(token).skills.inv.passive;
}
getAbility(token, ability) {
if (ability == undefined) ability = 'str';
return this.getActorData(token).abilities?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = this.getActorData(token).abilities?.[ability].mod;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
if (ability == undefined) ability = 'str';
let val = this.getActorData(token).abilities?.[ability].save;
return (val >= 0) ? `+${val}` : val;
}
getAbilityList() {
const keys = Object.keys(this.conf.abilities);
let abilities = [];
if (compatibleSystem("2.2.0"))
for (let k of keys) abilities.push({value:this.conf.abilityAbbreviations?.[k], name:this.conf.abilities?.[k]})
else
for (let k of keys) abilities.push({value:this.conf.abilities?.[k].abbreviation, name:this.conf.abilities?.[k].label})
return abilities;
}
getSavesList() {
return this.getAbilityList();
}
getSkill(token, skill) {
if (skill == undefined) skill = 'acr';
const val = this.getActorData(token).skills?.[skill].total;
return (val >= 0) ? `+${val}` : val;
}
getSkillList() {
const keys = Object.keys(this.conf.skills);
let skills = [];
for (let s of keys) {
const skill = this.conf.skills?.[s];
skills.push({value:s, name:skill.label})
}
return skills;
}
getProficiency(token) {
const val = this.getActorData(token).attributes.prof;
return (val >= 0) ? `+${val}` : val;
}
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;
}
getConditionList() {
let conditions = [];
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
return conditions;
}
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll'){
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') {
options.rerollInitiative = true;
token.actor.rollInitiative(options);
}
else if (roll == 'deathSave') token.actor.rollDeathSave(options);
}
getRollTypes() {
return [
{value:'initiative', name:'Initiative'},
{value:'deathSave', name:'Death Save'}
]
}
/**
* 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: this.getItemData(item).quantity};
}
getItemTypes() {
return [
{value:'weapon', name:'Weapons'},
{value:'equipment', name:'Equipment'},
{value:'consumable', name:'Consumables'},
{value:'tool', name:'Tools'},
{value:'backpack', name:'Containers'},
{value:'loot', name:'Loot'}
]
}
getWeaponRollModes() {
return [
{value:'default', name:'Default'},
{value:'attack', name:'Attack'},
{value:'damage', name:'Damage'},
{value:'damageCrit', name:'Damage (Critical)'},
{value:'versatile', name:'Versatile'},
{value:'versatileCrit', name:'Versatile (Critical)'},
{value:'otherFormula', name:'Other Formula'}
]
}
/**
* Features
*/
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 if (featureType == 'activeAbilities') return allItems.filter(i => i.type == 'feat' && i.labels.featType == 'Action')
else if (featureType == 'passiveAbilities') return allItems.filter(i => i.type == 'feat' && i.labels.featType == 'Passive')
else return allItems.filter(i => i.type == featureType)
}
getFeatureUses(item) {
if (item.type == 'class') return {available: this.getItemData(item).levels};
else return {
available: this.getItemData(item).uses.value,
maximum: this.getItemData(item).uses.max
};
}
getFeatureTypes() {
return [
{value:'class', name:'Class'},
{value:'feat', name:'Abilities'},
{value:'activeAbilities', name:'Active Abilities'},
{value:'passiveAbilities', name:'Passive Abilities'}
]
}
/**
* Spells
*/
getSpells(token,level,type) {
if (level == undefined) level = 'any';
if (type == undefined) type = 'any';
const allItems = token.actor.items;
if (level == 'any') return allItems.filter(i => i.type == 'spell')
else if (type == 'any') return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level)
else if (type == 'prepared') return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level && i.system.preparation.prepared == true)
else if (type == 'unprepared') return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level && i.system.preparation.prepared == false)
}
getSpellUses(token,level,item) {
if (level == undefined || level == 'any') level = this.getItemData(item).level;
if (this.getItemData(item).level == 0) return;
return {
available: this.getActorData(token).spells?.[`spell${level}`].value,
maximum: this.getActorData(token).spells?.[`spell${level}`].max
}
}
getSpellLevels() {
const keys = Object.keys(this.conf.spellLevels);
let levels = [];
for (let l of keys) levels.push({value:l, name:this.conf.spellLevels?.[l]});
return levels;
}
getSpellTypes() {
return [
{value: 'prepared', name:'Prepared'},
{value: 'unprepared', name:'Unprepared'}
]
}
rollItem(item, settings, rollOption, attackMode) {
let options = {
fastForward: rollOption != 'dialog',
advantage: rollOption == 'advantage',
disadvantage: rollOption == 'disadvantage'
}
if (settings.tokenMode == 'inventory' && settings.inventoryType == 'weapon') {
const mode = settings.weaponRollMode == 'default' ? attackMode : settings.weaponRollMode;
if (mode == 'attack') {
options.fastForward = true;
return item.rollAttack(options);
}
else if (mode == 'otherFormula') {
return item.rollFormula(options);
}
else if (mode != 'default' && mode != 'chat') {
options.fastForward = true;
return item.rollDamage({
options,
critical: (mode == 'damageCrit' || mode == 'versatileCrit'),
versatile: (mode == 'versatile' || mode == 'versatileCrit')
});
}
}
item.use(options)
}
/**
* Ring Colors
*/
getSkillRingColor(token, skill) {
const profLevel = this.getActorData(token).skills[skill]?.proficient;
if (profLevel == undefined) return;
return proficiencyColors?.[profLevel];
}
getSaveRingColor(token, save) {
const profLevel = this.getActorData(token).abilities[save]?.proficient;
if (profLevel == undefined) return;
return proficiencyColors?.[profLevel];
}
}

View File

@@ -0,0 +1,334 @@
import { compatibleCore } from "../misc.js";
export class forbiddenlands{
conf;
constructor(){
console.log("Material Deck: Using system 'Forbidden Lands'");
this.conf = CONFIG.fbl;
}
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
getStatsList() {
return [
{value:'HP', name:'Strength'},
{value:'HPbox', name:'Strength (box)'},
{value:'Agility', name:'Agility'},
{value:'Wits', name:'Wits'},
{value:'Empathy', name:'Empathy'},
{value:'WillPower', name:'Will Power'},
{value:'AC', name:'Armor'},
{value:'Skill', name:'Skill'}
]
}
getAttackModes() {
return [
]
}
getOnClickList() {
return []
}
getHP(token) {
const hp = this.getActorData(token).attribute.strength;
return {
value: hp.value,
max: hp.max
}
}
getAgility(token) {
const agility = this.getActorData(token).attribute.agility;
return {
value: agility.value,
max: agility.max
}
}
getWits(token) {
const wits = this.getActorData(token).attribute.wits;
return {
value: wits.value,
max: wits.max
}
}
getEmpathy(token) {
const empathy = this.getActorData(token).attribute.empathy;
return {
value: empathy.value,
max: empathy.max
}
}
getWillPower(token) {
const wp = this.getActorData(token).bio.willpower;
return {
value: wp.value,
max: wp.max
}
}
getTempHP(token) {
return 0;
}
getAC(token) {
const totalArmor = token.actor.itemTypes.armor.reduce((sum, armor) => {
if (armor.itemProperties.part === "shield") return sum;
const value = armor.itemProperties.bonus.value;
return (sum += value);
}, 0);
return totalArmor;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
return 1;
}
getInitiative(token) {
return 0;
}
toggleInitiative(token) {
return;
}
getPassivePerception(token) {
return 0;
}
getPassiveInvestigation(token) {
return;
}
getAbility(token, ability) {
if (ability == undefined) ability = 'strength';
return this.getActorData(token).attribute?.[ability].value;
}
getAbilityModifier(token, ability) {
return;
}
getAbilitySave(token, ability) {
return this.getAbility(token, ability);
}
getAbilityList() {
const abilityList = this.conf.attributes;
let abilities = [];
for (let a of abilityList) abilities.push({value:a, name:a.charAt(0).toUpperCase() + a.slice(1)})
return abilities;
}
getSavesList() {
return this.getAbilityList();
}
getSkill(token, skill) {
if (skill == undefined) skill = 'might';
let skillComp = token.actor.sheet.getSkill(skill);
const val = skillComp.skill.value + skillComp.attribute.value;
return game.i18n.localize(skillComp.skill.label)+`-${val}`;
}
getSkillList() {
const keys = Object.keys(this.conf.skillAttributeMap);
let skills = [];
for (let s of keys) {
const nameArr = s.split('-');
let name = '';
for (let p of nameArr) name += p.charAt(0).toUpperCase() + p.slice(1) + ' ';
skills.push({value:s, name})
}
return skills;
}
getProficiency(token) {
return;
}
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;
}
getConditionList() {
let conditions = [];
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
return conditions;
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
if (roll == undefined) roll = 'ability';
if (ability == undefined) ability = 'strength';
if (skill == undefined) skill = 'might';
if (save == undefined) save = 'strength';
if (roll == 'ability') token.actor.sheet.rollAttribute(ability);
else if (roll == 'save') token.actor.sheet.rollAttribute(save);
else if (roll == 'skill') token.actor.sheet.rollSkill(skill);
else if (roll == 'rollFood') token.actor.sheet.rollConsumable('food');
else if (roll == 'rollWater') token.actor.sheet.rollConsumable('water');
else if (roll == 'rollArrows') token.actor.sheet.rollConsumable('arrows');
else if (roll == 'rollTorches') token.actor.sheet.rollConsumable('torches');
else if (roll == 'rollArmor') token.actor.sheet.rollArmor();
else if (roll == 'monsterAttack') token.actor.sheet.rollAttack();
//else if (roll == 'initiative') token.actor.rollInitiative(options);
}
getRollTypes() {
return [
{value:'rollFood', name:'Roll Food'},
{value:'rollWater', name:'Roll Water'},
{value:'rollArrows', name:'Roll Arrows'},
{value:'rollTorches', name:'Roll Torches'},
{value:'rollArmor', name:'Roll Armor'},
{value:'monsterAttack', name:'Roll Monster Attack'}
]
}
/**
* Items
*/
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 == 'armor' || i.type == 'gear' || i.type == 'rawMaterial');
else if (token.actor.type == 'monster' && itemType == 'weapon')
{
return allItems.filter(i => i.type == 'monsterAttack');
}
return allItems.filter(i => i.type == itemType);
}
getItemUses(item) {
if (item.type == 'monsterAttack') return;
if (item.type == 'rawMaterial') return {available: this.getItemData(item).quantity};
return {available: this.getItemData(item).bonus.value,
maximum: this.getItemData(item).bonus.max};
}
getItemTypes() {
return [
{value:'armor', name: "Armour"},
{value:'gear', name: "Gear"},
{value:'weapon', name: "Weapons"},
{value:'rawMaterial', name: "Raw Material"}
]
}
getWeaponRollModes() {
return []
}
/**
* Features
*/
getFeatures(token,featureType) {
if (featureType == undefined) featureType = 'any';
const allItems = token.actor.items;
if (featureType == 'any') return allItems.filter(i => i.type == 'talent')
else return allItems.filter(i => i.type == featureType)
}
getFeatureUses(item) {
if (item.data.type == 'class') return {available: this.getItemData(item).levels};
else return {
available: this.getItemData(item).uses.value,
maximum: this.getItemData(item).uses.max
};
}
getFeatureTypes() {
return []
}
/**
* Spells
*/
getSpells(token,level,type) {
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' && this.getItemData(i).level == level)
}
getSpellUses(token,level,item) {
if (level == undefined) level = 'any';
if (this.getItemData(item).level == 0) return;
return {
available: this.getActorData(token).spells?.[`spell${level}`].value,
maximum: this.getActorData(token).spells?.[`spell${level}`].max
}
}
getSpellLevels() {
return [];
}
getSpellTypes() {
return [
]
}
rollItem(item) {
const sheet = item.actor.sheet;
if (item.type === "armor")
return sheet.rollSpecificArmor(item.id);
else if (item.type === "weapon")
return sheet.rollGear(item.id);
else if (item.type === "spell")
return sheet.rollSpell(item.id);
else if (item.type === "monsterAttack")
sheet.rollSpecificAttack(item.id);
return item.sendToChat();
}
/**
* Ring Colors
*/
getSkillRingColor(token, skill) {
return;
}
getSaveRingColor(token, save) {
return;
}
}

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

@@ -0,0 +1,655 @@
import { otherControls } from "../../MaterialDeck.js";
import { compatibleCore } from "../misc.js";
const limitedSheets = ['loot', 'vehicle'];
const proficiencyColors =
{
untrained: "#424242",
trained: "#171F69",
expert: "#3C005E",
master: "#664400",
legendary: "#5E0000"
};
export class pf2e{
conf;
constructor(){
console.log("Material Deck: Using system 'Pathfinder 2e'");
this.conf = CONFIG.PF2E;
}
tokenSpellData = new Map();
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
getStatsList() {
return [
{value:'HP', name:'HP'},
{value:'HPbox', name:'HP (box)'},
{value:'TempHP', name:'Temp HP'},
{value:'AC', name:'AC'},
{value:'ShieldHP', name:'Shield HP'},
{value:'Speed', name:'Speed'},
{value:'Init', name:'Initiative'},
{value:'Ability', name:'Ability Score'},
{value:'AbilityMod', name:'Ability Score Modifier'},
{value:'Save', name:'Saving Throw Modifier'},
{value:'Skill', name:'Skill Modifier'},
{value:'Prof', name:'Proficiency'},
{value:'Condition', name: 'Condition'},
{value:'Perception', name: 'Perception'}
]
}
getAttackModes() {
return [
]
}
getOnClickList() {
return []
}
getHP(token) {
const hp = token.actor.attributes?.hp;
return {
value: (hp?.value == null) ? 0 : hp.value,
max: (hp?.max == null) ? 0 : hp.max
}
}
getTempHP(token) {
const hp = token.actor.attributes?.hp;
return {
value: (hp?.temp == null) ? 0 : hp.temp,
max: (hp?.tempmax == null) ? 0 : hp.tempmax
}
}
getAC(token) {
const ac = token.actor.attributes?.ac;
return (ac?.value == null) ? 10 : ac?.value;
}
getShieldHP(token) {
const shieldhp = token.actor.attributes.shield
return (shieldhp?.value == null) ? 0 : shieldhp?.value;
}
getSpeed(token) {
if (this.isLimitedSheet(token.actor) || token.actor.type == 'hazard') {
if (token.actor.type == 'vehicle') {
return this.getActorData(token).details.speed;
} else return '';
}
let speed = `${token.actor.attributes.speed?.total}'`;
const otherSpeeds = token.actor.attributes.speed?.otherSpeeds;
if (otherSpeeds.length > 0)
for (let os of otherSpeeds)
speed += `\n${os.type} ${os.total}'`;
return speed;
}
getInitiative(token) {
if (this.isLimitedSheet(token.actor) || token.actor.type == 'familiar') return '';
if (token.actor.type == 'hazard') {
let initiative = token.actor.attributes?.stealth?.value;
return `Init: Stealth (${initiative})`;
}
let initiative = token.actor.attributes.initiative;
let initiativeModifier = initiative?.totalModifier;
let initiativeLabel = initiative?.label.replace('iative',''); //Initiative is too long for the button
if (initiativeModifier > 0) {
initiativeModifier = `+${initiativeModifier}`;
} else {
initiativeModifier = this.getPerception(token); //NPCs won't have a valid Initiative value, so default to use Perception
}
return `${initiativeLabel} (${initiativeModifier})`;
}
toggleInitiative(token) {
return;
}
getPassivePerception(token) {
return;
}
getPassiveInvestigation(token) {
return;
}
getPerception(token) {
if (this.isLimitedSheet(token.actor) || token.actor.type == 'hazard') return '';
let perception = token.actor.attributes.perception?.totalModifier;
return (perception >= 0) ? `+${perception}` : perception;
}
getAbility(token, ability) {
if (this.isLimitedSheet(token.actor) || token.actor.type == 'familiar') return '';
if (ability == undefined) ability = 'str';
return token.actor.abilities?.[ability]?.value;
}
getAbilityModifier(token, ability) {
if (this.isLimitedSheet(token.actor) || token.actor.type == 'hazard' || token.actor.type == 'familiar') return '';
if (ability == undefined) ability = 'str';
let val = token.actor.abilities?.[ability]?.mod;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
if (ability == undefined) return 'fortitude';
//ability = this.fixSave(ability);
const save = this.findSave(token, ability);
if (save == undefined) return '';
let val = save?.value;
return (val >= 0) ? `+${val}` : val;
}
getAbilityList() {
const keys = Object.keys(this.conf.abilities);
let abilities = [];
for (let k of keys) abilities.push({value:k, name:game.i18n.localize(this.conf.abilities?.[k])})
return abilities;
}
findSave(token, ability) {
if (this.isLimitedSheet(token.actor)) return;
return this.getActorData(token).saves?.[ability];
}
/*
fixSave(ability) {
if (ability == undefined) return 'fortitude';
else if (ability == 'fort') return 'fortitude';
else if (ability == 'ref') return 'reflex';
else if (ability == 'will') return 'will';
}
*/
getSavesList() {
const keys = Object.keys(this.conf.saves);
let saves = [];
for (let k of keys) saves.push({value:k, name:game.i18n.localize(this.conf.saves?.[k])})
return saves;
}
getSkill(token, skill) {
const tokenSkill = this.findSkill(token, skill);
if (tokenSkill == undefined) return '';
if (skill.startsWith('lor')) {
return `${tokenSkill.name}: +${tokenSkill.totalModifier}`;
}
const val = tokenSkill.totalModifier;
return (val >= 0) ? `+${val}` : val;
}
findSkill(token, skill) {
if (this.isLimitedSheet(token.actor)) return;
if (skill == undefined) skill = 'acr';
if (skill.startsWith('lor')) {
const index = parseInt(skill.split('_')[1])-1;
const loreSkills = this.getLoreSkills(token);
if (loreSkills.length > index) {
return loreSkills[index];
} else {
return;
}
}
return this.getActorData(token).skills?.[skill];
}
getSkillList() {
const keys = Object.keys(this.conf.skills);
let skills = [];
for (let s of keys) {
skills.push({value:s, name:game.i18n.localize(this.conf.skills?.[s])})
}
for (let i=1; i<4; i++) skills.push({value:`lor_${i}`, name: `${game.i18n.localize(this.conf.skillList.lore)} #${i}`})
return skills;
}
getLoreSkills(token) {
if (this.isLimitedSheet(token.actor)) return [];
const skills = this.getActorData(token).skills;
return Object.keys(skills).map(key => skills[key]).filter(s => s.lore == true);
}
getProficiency(token) {
return;
}
getCondition(token,condition) {
if (condition == undefined || condition == 'removeAll') return undefined;
const Condition = this.getConditionName(condition);
const effects = token.actor.items.filter(i => i.type == 'condition');
return effects.find(e => e.name.split(' ')[0] === Condition);
}
getConditionIcon(condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll') return window.CONFIG.controlIcons.effects;
else return `${CONFIG.PF2E.statusEffects.effectsIconFolder}${condition}.webp`;
}
getConditionActive(token,condition) {
return this.getCondition(token,condition) != undefined;
}
getConditionValue(token,condition) {
const effect = this.getCondition(token, condition);
if (effect != undefined && effect?.value != null) return effect;
}
async modifyConditionValue(token,condition,delta) {
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.getConditionValue(token,condition);
if (effect == undefined) {
if (delta > 0) {
const newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
}
} else {
try {
await game.pf2e.ConditionManager.updateConditionValue(effect.id, token, effect.value+delta);
} catch (error) {
//Do nothing. updateConditionValue will have an error about 'documentData is not iterable' when called from an NPC token.
}
}
}
return true;
}
getConditionName(condition) {
if ("flatFooted" == condition) {
return 'Flat-Footed'; //An inconsistency has been introduced on the PF2E system. The icon is still using 'flatFooted' as the name, but the condition in the manager has been renamed to 'Flat-Footed'
} else return condition.charAt(0).toUpperCase() + condition.slice(1);
}
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 newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
}
else {
effect.delete();
}
}
return true;
}
getConditionList() {
let conditions = [];
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
return conditions;
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
if (this.isLimitedSheet(token.actor)) return;
options.skipDialog = true;
if (roll == undefined) roll = 'skill';
if (ability == undefined) ability = 'str';
if (skill == undefined) skill = 'acr';
if (save == undefined) save = 'fort';
if (roll == 'perception') {
this.checkRoll(`Perception Check`, token.actor.perception, 'perception-check', token.actor);
}
if (roll == 'initiative') {
token.actor.rollInitiative({createCombatants:true, initiativeOptions: {skipDialog: true}});
}
if (roll == 'ability') return; //Ability Checks are not supported in pf2e
else if (roll == 'save') {
let ability = save;
if (ability == 'fort') ability = 'fortitude';
else if (ability == 'ref') ability = 'reflex';
else if (ability == 'will') ability = 'will';
if (token.actor.type == 'hazard' && ability == 'will') return; //Hazards don't have Will saves
let abilityName = ability.charAt(0).toUpperCase() + ability.slice(1);
this.checkRoll(`${abilityName} Saving Throw`, token.actor.saves?.[ability], 'saving-throw', token.actor);
}
else if (roll == 'skill') {
if (skill.startsWith('lor')) {
const index = parseInt(skill.split('_')[1])-1;
const loreSkills = this.getLoreSkills(token);
if (loreSkills.length > index) {
let loreSkill = loreSkills[index];
skill = loreSkill.shortform == undefined? loreSkills[index].expanded : loreSkills[index].shortform;
} else {
return;
}
}
let skillName = this.getActorData(token).skills?.[skill].name;
skillName = skillName.charAt(0).toUpperCase() + skillName.slice(1);
this.checkRoll(`Skill Check: ${skillName}`, token.actor.skills?.[skill], 'skill-check', token.actor);
}
}
checkRoll(checkLabel,stat,type,actor) {
let checkModifier = new game.pf2e.CheckModifier(checkLabel, stat);
game.pf2e.Check.roll(checkModifier, {type:type, actor: actor, skipDialog: true}, null);
}
getRollTypes() {
return [
{value:'initiative', name:'Initiative'},
{value:'perception', name:'Perception'}
]
}
/**
* Items
*/
getItems(token,itemType) {
if (this.isLimitedSheet(token.actor)) return [];
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');
if (itemType == 'weapon') return allItems.filter(i => i.type == 'weapon' || i.type == 'melee') //Include melee actions for NPCs without equipment
else return allItems.filter(i => i.type == itemType);
}
getItemUses(item) {
return {available: item.quantity};
}
getItemTypes() {
return [
{value:'weapon', name:'Weapons'},
{value:'armor', name:'Armor'},
{value:'equipment', name:'Equipment'},
{value:'consumable', name:'Consumables'},
{value:'treasure', name:'Treasure'}
]
}
getWeaponRollModes() {
return []
}
/**
* Features
*/
getFeatures(token,featureType) {
if (this.isLimitedSheet(token.actor)) return [];
if (featureType == undefined) featureType = 'any';
const allItems = token.actor.items;
if (featureType == 'any') return allItems.filter(i => i.type == 'ancestry' || i.type == 'background' || i.type == 'class' || i.type == 'feat' || i.type == 'action' || i.type == 'heritage' || i.type == 'deity' || i.type == '');
if (featureType == 'feat-any') return allItems.filter(i => i.type == 'feat');
if (featureType == 'ancestryfeature') return allItems.filter(i => i.type == 'feat' && i.featType == 'ancestryfeature');
if (featureType == 'classfeature') return allItems.filter(i => i.type == 'feat' && i.featType == 'classfeature');
if (featureType == 'feat-anc') return allItems.filter(i => i.type == 'feat' && i.featType == 'ancestry');
if (featureType == 'feat-arc') return allItems.filter(i => i.type == 'feat' && i.featType == 'archetype' && i.name.indexOf('Dedication') < 0);
if (featureType == 'feat-ded') return allItems.filter(i => i.type == 'feat' && i.featType == 'archetype' && i.name.indexOf('Dedication') > 0);
if (featureType == 'feat-cla') return allItems.filter(i => i.type == 'feat' && i.featType == 'class');
if (featureType == 'feat-gen') return allItems.filter(i => i.type == 'feat' && i.featType == 'general');
if (featureType == 'feat-ski') return allItems.filter(i => i.type == 'feat' && i.featType == 'skill');
if (featureType == 'action-any') return allItems.filter(i => i.type == 'action');
if (featureType == 'action-def') return allItems.filter(i => i.type == 'action' && this.getItemData(i).actionCategory?.value == 'defensive');
if (featureType == 'action-int') return allItems.filter(i => i.type == 'action' && this.getItemData(i).actionCategory?.value == 'interaction');
if (featureType == 'action-off') return allItems.filter(i => i.type == 'action' && this.getItemData(i).actionCategory?.value == 'offensive');
if (featureType == 'strike') { //Strikes are not in the actor.items collection
if (token.actor.type == 'hazard' || token.actor.type == 'familiar') {
return allItems.filter(i => i.type == 'melee' || i.type == 'ranged');
}
let actions = this.getActorData(token).actions?.filter(a=>a.type == 'strike');
for (let a of actions) {
a.img = a.imageUrl;
a.data = {
sort: 1
};
}
return actions;
}
else return allItems.filter(i => i.type == featureType)
}
getFeatureUses(item) {
if (item.data.type == 'class') return {available: item.parent.data.data.details.level.value};
else return;
}
getFeatureTypes() {
return [
{value:'ancestry', name:'Ancestry'},
{value:'ancestryfeature', name:'Ancestry Feature'},
{value:'heritage', name: 'Heritage'},
{value:'background', name: 'Background'},
{value:'class', name:'Class'},
{value:'classfeature', name:'Class Feature'},
{value:'deity', name: 'Deity'},
{value:'feat-any', name:'Feats - Any'},
{value:'feat-anc', name:'Feats - Ancestry'},
{value:'feat-arc', name: 'Feats - Archetype'},
{value:'feat-ded', name: 'Feats - Dedication'},
{value:'feat-cla', name: 'Feats - Class'},
{value:'feat-gen', name: 'Feats - General'},
{value:'feat-ski', name: 'Feats - Skill'},
{value:'action-any', name:'Actions - Any'},
{value:'action-def', name:'Actions - Defensive'},
{value:'action-int', name:'Actions - Interaction'},
{value:'action-off', name:'Actions - Offensive'},
{value:'strike', name:'Strikes'}
]
}
/**
* Spells
*/
buildSpellData(token) {
let spellData = [[],[],[],[],[],[],[],[],[],[],[],[]];
let spellcastingEntries = token.actor.spellcasting;
const actorLevel = this.getActorData(token).details.level.value;
spellcastingEntries.forEach(spellCastingEntry => {
let highestSpellSlot = Math.ceil(actorLevel/2);
while (spellCastingEntry.data.data.slots?.[`slot${highestSpellSlot}`]?.max <= 0) highestSpellSlot--;
//Prepared (not flexible)
if (spellCastingEntry.data.data.prepared?.value == 'prepared' && !spellCastingEntry?.data.data?.prepared?.flexible == true) {
for (let slotLevel = 0; slotLevel < 11; slotLevel++) {
for (let slot = 0; slot < spellCastingEntry.data.data.slots?.[`slot${slotLevel}`].max; slot++) {
let spellId = spellCastingEntry.data.data.slots?.[`slot${slotLevel}`].prepared?.[slot].id;
let spell = spellCastingEntry.spells.get(spellId);
if (spellId != null) {
spellData[slotLevel].push(spell);
}
}
}
} else {
spellCastingEntry.spells.forEach( ses => {
if ((spellCastingEntry.data.data.prepared.value == 'spontaneous' || spellCastingEntry.data.data.prepared?.flexible == true) && ses.data.data.location.signature == true) {
let baseLevel = this.getSpellLevel(ses);
for (let level = baseLevel; level <= highestSpellSlot; level++) {
spellData[level].push(ses);
}
} else {
spellData[this.getSpellLevel(ses)].push(ses);
}
});
}
});
this.tokenSpellData.set(token.id, {spellData: spellData, timeStamp: Date.now()});
return spellData;
}
getSpellData(token) {
let existingSpellData = this.tokenSpellData.get(token.id);
if (existingSpellData == undefined) return this.buildSpellData(token);
let milisSinceCreation = Date.now() - existingSpellData.timeStamp;
if (milisSinceCreation > 10000) {
this.tokenSpellData.delete(token.id);
return this.buildSpellData(token);
}
return existingSpellData.spellData;
}
getSpellLevel(spell) {
if (spell.isFocusSpell == true) return 11;
if (spell.isCantrip == true) return 0;
return spell.level;
}
getSpells(token,level,type) {
if (this.isLimitedSheet(token.actor)) return '';
if (level == undefined) level = 'any';
let spellData = this.getSpellData(token);
if (level == 'f') return this.getUniqueSpells(spellData[11]);
if (level == 'any') return this.getUniqueSpells(spellData.flat());
return this.getUniqueSpells(spellData[level]);
}
getUniqueSpells(spells) {
return Array.from(new Set(spells));
}
getSpellUses(token,level,item) {
if (this.isLimitedSheet(token.actor)) return '';
if (level == undefined || level == 'any') level = item.level;
if (item.isCantrip == true) return;
if (item.isFocusSpell == true) return {
available: this.getActorData(token).resources.focus.value,
maximum: this.getActorData(token).resources.focus.max
}
const spellbook = this.findSpellcastingEntry(token.actor, item);
if (spellbook == undefined) return;
if (spellbook.data.data.prepared.value == 'innate') {
return {
available: this.getItemData(item).location.uses.value,
maximum: this.getItemData(item).location.uses.max
}
}
if (spellbook.data.data.prepared.value == 'prepared') {
if (!spellbook.data.data.prepared?.flexible == true) {
let slotsExpended = 0;
let slotsPrepared = 0;
for (let slot = 0; slot < spellbook.data.data.slots?.[`slot${level}`].max; slot++) {
let slotEntry = spellbook.data.data.slots?.[`slot${level}`].prepared?.[slot];
if (slotEntry.id == item.id) {
slotsPrepared++;
if (slotEntry?.expended == true) {
slotsExpended++;
}
}
}
return {
available: slotsPrepared - slotsExpended,
maximum: slotsPrepared
}
}
}
return {
available: spellbook.data.data.slots?.[`slot${level}`].value,
maximum: spellbook.data.data.slots?.[`slot${level}`].max
}
}
findSpellcastingEntry(actor, spell) {
let spellcastingEntries = actor.spellcasting;
let result;
spellcastingEntries.forEach(spellCastingEntry => {
if (spellCastingEntry.spells.get(spell.id) != undefined) {
result = spellCastingEntry;
}
});
return result;
}
getSpellLevels() {
const keys = Object.keys(this.conf.spellLevels);
let levels = [
{value:'f', name: game.i18n.localize("PF2E.SpellCategoryFocus")},
{value:'0', name: game.i18n.localize("PF2E.SpellCantripLabel")}
];
for (let l of keys) levels.push({value:l, name:game.i18n.localize(this.conf.spellLevels?.[l])});
return levels;
}
getSpellTypes() {
return [
]
}
rollItem(item, settings) {
let variant = 0;
if (otherControls.rollOption == 'map1') variant = 1;
if (otherControls.rollOption == 'map2') variant = 2;
if (item?.parent?.type == 'hazard' && item.type==='melee') return item.rollNPCAttack({}, variant+1);
if (item.type==='strike') return item.variants[variant].roll({event});
if (item?.parent?.type !== 'hazard' && (item.type==='weapon' || item.type==='melee')) return item.parent.data.data.actions.find(a=>a.name===item.name).variants[variant].roll({event});
if (item.type === 'spell') {
const spellbook = this.findSpellcastingEntry(item.parent, item);
if (spellbook != undefined) {
let spellLvl = item.level;
if (settings.spellType == 'f' || settings.spellType == '0') {
const actorLevel = item.parent.data.data.details.level.value;
spellLvl = Math.ceil(actorLevel/2);
} else if (settings.spellType != 'any') {
spellLvl = settings.spellType;
}
if (spellbook.data.data.prepared.value == 'prepared' && !spellbook.data.data.prepared?.flexible == true) {
for (let slotId = 0; slotId < spellbook.data.data.slots?.[`slot${spellLvl}`].max; slotId++) {
let slotEntry = spellbook.data.data.slots?.[`slot${spellLvl}`].prepared?.[slotId];
if (slotEntry.id == item.id) {
if (!slotEntry?.expended == true) {
return spellbook.cast(item, {slot: slotId, level: spellLvl});
}
}
}
} else {
return spellbook.cast(item, { level: spellLvl});
}
}
}
return game.pf2e.rollItemMacro(item.id);
}
isLimitedSheet(actor) {
return limitedSheets.includes(actor.type);
}
/**
* Ring Colors
*/
getSkillRingColor(token, skill) {
return this.getRingColor(this.findSkill(token, skill));
}
getSaveRingColor(token, save) {
//save = this.fixSave(save);
return this.getRingColor(this.findSave(token, save));
}
getRingColor(stat) {
if (stat == undefined) return;
let statModifiers = stat?.modifiers || stat?._modifiers;
const profLevel = statModifiers?.find(m => m.type == 'proficiency')?.slug;
if (profLevel != undefined) {
return proficiencyColors?.[profLevel];
}
return;
}
}

362
src/systems/starfinder.js Normal file
View File

@@ -0,0 +1,362 @@
import { compatibleCore } from "../misc.js";
const proficiencyColors = {
0: "#000000",
0.5: "#804A00",
1: "#C0C0C0",
2: "#FFD700"
}
export class starfinder{
conf;
constructor(){
console.log("Material Deck: Using system 'Starfinder'");
this.conf = CONFIG.SFRPG;
}
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
getStatsList() {
return [
{value:'HP', name:'HP'},
{value:'HPbox', name:'HP (box)'},
{value:'Stamina', name:'Stamina'},
{value:'AC', name:'Energy AC'},
{value:'KinAC', name:'Kinetic AC'},
{value:'Speed', name:'Speed'},
{value:'Init', name:'Initiative'},
{value:'Ability', name:'Ability Score'},
{value:'AbilityMod', name:'Ability Score Modifier'},
{value:'Save', name:'Saving Throw Modifier'},
{value:'Skill', name:'Skill Modifier'}
]
}
getAttackModes() {
return [
]
}
getOnClickList() {
return []
}
getHP(token) {
const hp = this.getActorData(token).attributes.hp;
return {
value: hp.value,
max: hp.max
}
}
getTempHP(token) {
return;
}
getStamina(token) {
const stamina = this.getActorData(token).attributes.sp;
return {
value: stamina.value,
max: stamina.max
}
}
getAC(token) {
return this.getActorData(token).attributes.eac.value;
}
getKinAC(token) {
return this.getActorData(token).attributes.kac.value;
}
getShieldHP(token) {
return;
}
getSpeed(token) {
const movement = this.getActorData(token).attributes.speed;
let speed = "";
if (movement.burrowing.value > 0) speed += `Burrow: ${movement.burrowing.value}Ft`;
if (movement.climbing.value > 0) {
if (speed.length > 0) speed += '\n';
speed += `Climb: ${movement.climbing.value}Ft`;
}
if (movement.flying.value > 0) {
if (speed.length > 0) speed += '\n';
speed += `Fly: ${movement.flying.value}Ft`;
}
if (movement.land.value > 0) {
if (speed.length > 0) speed += '\n';
speed += `Land: ${movement.land.value}Ft`;
}
if (movement.swimming.value > 0) {
if (speed.length > 0) speed += '\n';
speed += `Swim: ${movement.swimming.value}Ft`;
}
return speed;
}
getInitiative(token) {
let initiative = this.getActorData(token).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 this.getActorData(token).abilities?.[ability].value;
}
getAbilityModifier(token, ability) {
if (ability == undefined) ability = 'str';
let val = this.getActorData(token).abilities?.[ability].mod;
return (val >= 0) ? `+${val}` : val;
}
getAbilitySave(token, ability) {
if (ability == undefined) ability = 'fort';
else if (ability == 'ref') ability = 'reflex';
let val = this.getActorData(token).attributes?.[ability].bonus;
return (val >= 0) ? `+${val}` : val;
}
getAbilityList() {
const keys = Object.keys(this.conf.abilities);
let abilities = [];
for (let k of keys) abilities.push({value:k, name:this.conf.abilities?.[k]})
return abilities;
}
getSavesList() {
const keys = Object.keys(this.conf.saves);
let saves = [];
for (let k of keys) saves.push({value:k, name:this.conf.saves?.[k]})
return saves;
}
getSkill(token, skill) {
if (skill == undefined) skill = 'acr';
const val = this.getActorData(token).skills?.[skill].mod;
return (val >= 0) ? `+${val}` : val;
}
getSkillList() {
const keys = Object.keys(this.conf.skills);
let skills = [];
for (let s of keys) {
const skill = this.conf.skills?.[s];
skills.push({value:s, name:skill.label})
}
return skills;
}
getProficiency(token) {
return;
}
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 {
if (this.getConditionActive(token,condition)) token.actor.setCondition(condition,false);
else token.actor.setCondition(condition,true);
}
return true;
}
getConditionList() {
let conditions = [];
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:c.label});
return conditions;
}
/**
* 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') {
options.rerollInitiative = true;
token.actor.rollInitiative(options);
}
else if (roll == 'deathSave') token.actor.rollDeathSave(options);
}
getRollTypes() {
return [
{value:'initiative', name:'Initiative'},
{value:'deathSave', name:'Death Save'}
]
}
/**
* 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 == 'shield' || i.type == 'equipment' || i.type == 'consumable' || i.type == 'goods' || i.type == 'container' || i.type == 'technological' || i.type == 'fusion' || i.type == 'upgrade' || i.type == 'weaponAccessory' || i.type == 'augmentation');
else if (itemType == 'enhancers') return allItems.filter(i => i.type == 'fusion' || i.type == 'upgrade' || i.type == 'weaponAccessory');
else return allItems.filter(i => i.type == itemType);
}
getItemUses(item) {
return {available: this.getItemData(item).quantity};
}
getItemTypes() {
return [
{value:'weapon', name:'Weapons'},
{value:'shield', name:'Shields'},
{value:'equipment', name:'Armor'},
{value:'ammunition', name:'Ammunition'},
{value:'consumable', name:'Consumables'},
{value:'goods', name:'Goods'},
{value:'container', name:'Containers'},
{value:'technological', name:'Technological, Magical, and Hybrid Items'},
{value:'enhancers', name:'Equipment Enhancers'},
{value:'augmentation', name:'Augmentations'}
]
}
getWeaponRollModes() {
return []
}
/**
* Features
*/
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 == 'race' || i.type == 'theme'|| i.type == 'asi' || i.type == 'archetype' || i.type == 'feat' || i.type == 'actorResource')
else if (featureType == 'activeFeat' || featureType == 'passiveFeat') {
const features = allItems.filter(i => i.type == 'feat');
if (featureType == 'activeFeat') return features.filter(i => i.labels.featType == 'Action');
else return features.filter(i => i.labels.featType == 'Passive');
}
return allItems.filter(i => i.type == featureType)
}
getFeatureUses(item) {
if (item.data.type == 'class') return {available: this.getItemData(item).levels};
else return {
available: this.getItemData(item).uses.value,
maximum: this.getItemData(item).uses.max
};
}
getFeatureTypes() {
return [
{value:'class', name:'Class'},
{value:'race', name:'Race'},
{value:'theme', name:'Theme'},
{value:'asi', name:'Ability Score Increases'},
{value:'archetypes', name:'Archetypes'},
{value:'activeFeat', name:'Active Feats'},
{value:'passiveFeat', name:'Passive Feats'},
{value:'actorResource', name:'Actor Resources'}
]
}
/**
* Spells
*/
getSpells(token,level,type) {
if (level == undefined) level = 'any';
const allItems = token.actor.items;
if (level == 'any') return allItems.filter(i => i.type == 'spell')
else if (level == 'innate') return allItems.filter(i => i.type == 'spell' && this.getItemData(i).preparation.mode == 'innate');
else return allItems.filter(i => i.type == 'spell' && this.getItemData(i).preparation.mode == '' && this.getItemData(i).level == level)
}
getSpellUses(token,level,item) {
if (level == undefined) level = 'any';
if (this.getItemData(item).level == 0) return;
const spellSlots = this.getActorData(token).spells;
const allowedClasses = this.getItemData(item).allowedClasses;
let uses = {available: 0, maximum: 0};
if (allowedClasses.myst && spellSlots?.[`spell${level}`].perClass?.mystic?.max > uses.maximum)
uses = {available: spellSlots?.[`spell${level}`].perClass?.mystic.value, maximum: spellSlots?.[`spell${level}`].perClass?.mystic.max}
if (allowedClasses.precog && spellSlots?.[`spell${level}`].perClass?.precog?.max > uses.maximum)
uses = {available: spellSlots?.[`spell${level}`].perClass?.precog.value, maximum: spellSlots?.[`spell${level}`].perClass?.precog.max}
if (allowedClasses.tech && spellSlots?.[`spell${level}`].perClass?.technomancer?.max > uses.maximum)
uses = {available: spellSlots?.[`spell${level}`].perClass?.technomancer.value, maximum: spellSlots?.[`spell${level}`].perClass?.technomancer.max}
if (allowedClasses.wysh && spellSlots?.[`spell${level}`].perClass?.witchwarper?.max > uses.maximum)
uses = {available: spellSlots?.[`spell${level}`].perClass?.witchwarper.value, maximum: spellSlots?.[`spell${level}`].perClass?.witchwarper.max}
return uses;
}
getSpellLevels() {
const keys = Object.keys(this.conf.spellLevels);
let levels = [{label:'innate', name:game.i18n.localize("SFRPG.SpellPreparationModesInnate")}];
for (let l of keys) levels.push({value:l, name:this.conf.spellLevels?.[l]});
return levels;
}
getSpellTypes() {
return [
]
}
rollItem(item) {
return item.roll()
}
/**
* Ring Colors
*/
getSkillRingColor(token, skill) {
const profLevel = this.getActorData(token)?.skills[skill]?.proficient;
if (profLevel == undefined) return;
return proficiencyColors?.[profLevel];
}
getSaveRingColor(token, save) {
const profLevel = this.getActorData(token)?.abilities[save]?.proficient;
if (profLevel == undefined) return;
return proficiencyColors?.[profLevel];
}
}

374
src/systems/template.js Normal file
View File

@@ -0,0 +1,374 @@
/**
* This is a template for adding a new gaming system.
* Edit it to suit your system, for inspiration, look at other system files.
* Functions that are unused in your system can be left empty, but don't delete the function.
*
* Use the compatibleCore function to get the right value for the Foundry core:
* return compatibleCore('10.0') ? [value in v10+] : [value pre v10];
*
* Use the compatibleSystem function to get the right value for the gaming system version:
* return compatibleSystem('1.6.3') ? [value in v1.6.3+] : [value pre v1.6.3];
*/
import { compatibleCore, compatibleSystem } from "../misc";
/**
* Proficiency colors to show if a token is proficient in for example a skill
*/
const proficiencyColors = {
0: "#000000",
0.5: "#804A00",
1: "#C0C0C0",
2: "#FFD700"
}
//Rename 'template' to the name of your system
export class template{
conf; //this variable stores the configuration data for the system, set in the constructor
constructor(){
console.log("Material Deck: Using system 'SystemName'");
this.conf = CONFIG.DND5E; //You can use this to get various things like the list of ability scores, conditions, etc. Make sure you set it to the correct value for your system
}
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
/**
* This generates a list of stats to be displayed on the SD: Token Action => Stats.
* Choose the ones you want to use and change the 'name' value if desired. If you add new ones, you will need to add a function to handle them in src/token.js.
* After each option you'll find what function it will call after the button is pressed on the SD
*/
getStatsList() {
return [
{value:'HP', name:'HP'}, //will call getHP()
{value:'HPbox', name:'HP (box)'}, //will call getHP()
{value:'TempHP', name:'Temp HP'}, //will call getTempHP()
{value:'AC', name:'AC'}, //will call getAC()
{value:'ShieldHP', name:'Shield HP'}, //will call getShieldHP()
{value:'Speed', name:'Speed'}, //will call getSpeed()
{value:'Init', name:'Initiative'}, //will call getInitiative()
{value:'Ability', name:'Ability Score'}, //will call getAbility()
{value:'AbilityMod', name:'Ability Score Modifier'}, //will call getAbilityModifier()
{value:'Save', name:'Saving Throw Modifier'}, //will call getAbilitySave()
{value:'Skill', name:'Skill Modifier'}, //will call getSkill()
{value:'PassivePerception', name:'Passive Perception'}, //will call getPassivePerception()
{value:'PassiveInvestigation', name:'Passive Investigation'}, //will call getPassiveInvestigation()
{value:'Prof', name:'Proficiency'}, //will call getProficiency()
{value:'Condition', name: 'Condition'}, //will call getConditionValue()
]
}
/**
* Adds an on click option to the SD: Token Action => On Click
* Currently only supports toggling initiative (for Shadow of the Demonlord)
*/
getOnClickList() {
return [
//{value:'initiative',name:'Toggle Initiative'}
]
}
/**
* Returns the HP of the token
* @param {Token} token Token instance to get the HP from
* @returns {object} Token hp value and max: {value: ##, max: ##}
*/
getHP(token) {
return;
}
/**
* Returns the temporary HP of the token
* @param {Token} token Token instance to get the temp HP from
* @returns {object} Token temp hp value and max: {value: ##, max: ##}
*/
getTempHP(token) {
return;
}
/**
* Returns the armor class of the token
* @param {Token} token Token instance to get the AC from
* @returns {number} AC value
*/
getAC(token) {
return;
}
/**
* Returns the shield HP of the token
* @param {Token} token Token instance to get the shield HP from
* @returns {number} Shield HP
*/
getShieldHP(token) {
return;
}
/**
* Returns a string with movement speeds of the token
* @param {Token} token Token instance to get the speed from
* @returns {string} Movement speed string
*/
getSpeed(token) {
return;
}
/**
* Returns the initiative of the token
* @param {Token} token Token instance to get the initiative from
* @returns {number} Initiative value
*/
getInitiative(token) {
return;
}
/**
* Toggles the initiative of the token
* @param {Token} token Token instance to toggle the initiative for
*/
toggleInitiative(token) {
}
/**
* Returns the passive perception of the token
* @param {Token} token Token instance to get the passive perception from
* @returns {number} Passive perception value
*/
getPassivePerception(token) {
return;
}
/**
* Returns the passive investigation of the token
* @param {Token} token Token instance to get the passive investigation from
* @returns {number} Passive investigation value
*/
getPassiveInvestigation(token) {
return;
}
/**
* Returns the ability value of the token
* @param {Token} token Token instance to get the ability value from
* @param {string} ability Ability to get the value from
* @returns {number} Ability value
*/
getAbility(token, ability) {
if (ability == undefined) ability = ''; //default ability
return;
}
/**
* Returns the ability modifier of the token
* @param {Token} token Token instance to get the ability modifier from
* @param {string} ability Ability to get the value from
* @returns {number} Ability modifier
*/
getAbilityModifier(token, ability) {
if (ability == undefined) ability = ''; //default ability
return;
}
/**
* Returns the ability save of the token
* @param {Token} token Token instance to get the ability save from
* @param {string} ability Ability to get the value from
* @returns {number} Ability save
*/
getAbilitySave(token, ability) {
if (ability == undefined) ability = ''; //default ability
return;
}
/**
* Returns a list of abilities available to the system
* Each array item must be {value:'abilityId', name:'abilityName'}
* 'abilityId' is defined by the system, the name can be anything you want
* @returns
*/
getAbilityList() {
let abilities = [];
return abilities;
}
/**
* Returns the skill value of the token
* @param {Token} token Token instance to get the skill value from
* @param {string} skill Skill to get the value from
* @returns {number} Skill value
*/
getSkill(token, skill) {
if (skill == undefined) skill = '';
return;
}
/**
* Returns the proficiency value of the token
* @param {Token} token Token instance to get the proficiency from
* @returns {number} Proficiency value
*/
getProficiency(token) {
return;
}
/**
* Returns the icon location of a condition
* @param {string} condition Name of the condition
* @returns {string} Icon location
*/
getConditionIcon(condition) {
if (condition == undefined) condition = 'removeAll';
if (condition == 'removeAll') return;
else return;
}
/**
* Returns whether a condition is active on the token
* @param {Token} token Token instance to get the value from
* @param {string} condition Name of the condition
* @returns {boolean} Condition is active or not
*/
getConditionActive(token,condition) {
if (condition == undefined) condition = 'removeAll';
return;
}
/**
* Toggles a condition on a token
* @param {Token} token Token instance to get the value from
* @param {string} condition Name of the condition
*/
async toggleCondition(token,condition) {
if (condition == undefined) condition = 'removeAll';
}
/**
* Roll for a token
* @param {Token} token Token instance to roll for
* @param {string} roll Roll type (ability/save/skill/initiative/deathSave)
* @param {bbject} options Roll options
* @param {string} ability Name of the ability to roll
* @param {string} skill Name of the skill to roll
* @param {string} save Name of the save to roll
*/
roll(token,roll,options,ability,skill,save) {
if (roll == undefined) roll = 'ability';
if (ability == undefined) ability = ''; //default ability
if (skill == undefined) skill = ''; //default skill
if (save == undefined) save = ''; //default save
if (roll == 'ability')
else if (roll == 'save')
else if (roll == 'skill')
else if (roll == 'initiative')
else if (roll == 'deathSave')
}
/**
* Get array of items
* @param {Token} token Token instance to get the items from
* @param {string} itemType Item type
* @returns {array} Array of items
*/
getItems(token,itemType) {
if (itemType == undefined) itemType = 'any';
if (itemType == 'any') return ;
else return ;
}
/**
* Returns uses/quantity of an item
* @param {Item} item Item instance to get the uses/quantity from
* @returns {object} Uses/quantity available {available: ###, maximum: ###}
*/
getItemUses(item) {
return;
}
/**
* Returns the features of a token
* @param {Token} token Token instance to get the features from
* @param {string} featureType Feature types to return
* @returns {array} Array of features
*/
getFeatures(token,featureType) {
if (featureType == undefined) featureType = 'any';
if (featureType == 'any') return;
else return;
}
/**
* Returns uses/quantity of a feature
* @param {Item} item Item/feature instance to get the uses/quantity from
* @returns {object} Uses/quantity available {available: ###, maximum: ###}
*/
getFeatureUses(item) {
return {};
}
/**
* Returns the spells of a token
* @param {Token} token Token instance to get the spells from
* @param {string} level Spell level
* @returns {array} Array of spells
*/
getSpells(token,level) {
if (level == undefined) level = 'any';
if (level == 'any') return;
else return;
}
/**
* Returns the spell uses of a specific spell for a token
* @param {Token} token Token instance to get the spell uses from
* @param {string} level Spell level
* @param {Item} item Spell instance to get the uses from
* @returns {object} Spell uses left: {available: ###, maximum: ###}
*/
getSpellUses(token,level,item) {
return {
}
}
/**
* Roll an item
* @param {Token} item Item instance to roll
* @param {object} settings Settings of the action
* @param {object} rollOption Roll options
*/
rollItem(item, settings, rollOption) {
}
/**
* Returns a color to display proficiency for skills
* @param {Token} token Token instance to get the proficiency from
* @param {string} skill Skill name
* @returns {string} Hex color string from proficiencyColors array
*/
getSkillRingColor(token, skill) {
const profLevel = ;
if (profLevel == undefined) return;
return proficiencyColors?.[profLevel];
}
/**
* Returns a color to display proficiency for saves
* @param {Token} token Token instance to get the proficiency from
* @param {string} save Save name
* @returns {string} Hex color string from proficiencyColors array
*/
getSaveRingColor(token, save) {
const profLevel = ;
if (profLevel == undefined) return;
return proficiencyColors?.[profLevel];
}
}

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

@@ -0,0 +1,397 @@
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 { forbiddenlands } from "./forbidden-lands.js";
import { starfinder } from "./starfinder.js";
import { compatibleCore } from "../misc.js";
import { gamingSystem } from "../../MaterialDeck.js";
export class TokenHelper{
constructor(){
this.system;
this.setSystem();
}
setSystem() {
if (gamingSystem == 'D35E' || gamingSystem == 'pf1') this.system = new dnd35e(gamingSystem);
else if (gamingSystem == 'pf2e') this.system = new pf2e();
else if (gamingSystem == 'demonlord') this.system = new demonlord();
else if (gamingSystem == 'wfrp4e') this.system = new wfrp4e();
else if (gamingSystem == 'forbidden-lands') this.system = new forbiddenlands();
else if (gamingSystem == 'sfrpg') this.system = new starfinder();
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.get(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.grid.size;
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) return;
if (game.user.isGM == false && (token.can(game.user,"control") == false || token.checkCollision(token.getCenter(x, y)))) return;
let coords = canvas.grid.getCenter(x,y);
coords[0] -= canvas.grid.size/2;
coords[1] -= canvas.grid.size/2;
token.document.update({x:coords[0],y:coords[1]});
};
rotateToken(token,move,value) {
if (move == undefined) move = 'to';
value = isNaN(parseInt(value)) ? 0 : parseInt(value);
let rotationVal;
if (move == 'by') rotationVal = token.document.rotation + value;
else rotationVal = value;
token.document.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.document.texture.src;
}
getActorIcon(token) {
return token.actor.img;
}
/***********************************************************************
* System specific functions
***********************************************************************/
getStatsList() {
return this.system.getStatsList();
}
getAttackModes() {
return this.system.getAttackModes();
}
getOnClickList() {
return this.system.getOnClickList();
}
getHP(token) {
return this.system.getHP(token);
}
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);
}
getAbilityList() {
return this.system.getAbilityList();
}
getSavesList() {
return this.system.getSavesList();
}
getSkill(token, skill) {
return this.system.getSkill(token, skill);
}
getSkillList() {
return this.system.getSkillList();
}
getProficiency(token) {
return this.system.getProficiency(token);
}
/* 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)
}
/* PF2E */
getPerception(token) {
return this.system.getPerception(token)
}
/* forbidden-lands */
getAgility(token) {
return this.system.getAgility(token)
}
/* forbidden-lands */
getWits(token) {
return this.system.getWits(token)
}
/* forbidden-lands */
getEmpathy(token) {
return this.system.getEmpathy(token)
}
/* forbidden-lands */
getWillPower(token) {
return this.system.getWillPower(token)
}
/* starfinder */
getStamina(token) {
return this.system.getStamina(token);
}
/* starfinder */
getKinAC(token) {
return this.system.getKinAC(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);
}
getConditionList() {
return this.system.getConditionList();
}
/* PF2E */
getConditionValue(token,condition) {
return this.system.getConditionValue(token,condition);
}
/* PF2E */
modifyConditionValue(token,condition,delta) {
return this.system.modifyConditionValue(token,condition,delta);
}
/**
* Roll
*/
roll(token,roll,options,ability,skill,save) {
return this.system.roll(token,roll,options,ability,skill,save);
}
getRollTypes() {
return this.system.getRollTypes();
}
/**
* Items
*/
getItems(token,itemType) {
return this.system.getItems(token,itemType);
}
getItemUses(item) {
return this.system.getItemUses(item);
}
getItemTypes() {
return this.system.getItemTypes();
}
getWeaponRollModes() {
return this.system.getWeaponRollModes();
}
/**
* Features
*/
getFeatures(token,featureType) {
return this.system.getFeatures(token,featureType);
}
getFeatureUses(item) {
return this.system.getFeatureUses(item);
}
getFeatureTypes() {
return this.system.getFeatureTypes();
}
/**
* Spells
*/
getSpells(token,level,type) {
return this.system.getSpells(token,level,type);
}
getSpellUses(token,level,item) {
return this.system.getSpellUses(token,level,item);
}
rollItem(item, settings, rollOption, attackMode) {
return this.system.rollItem(item, settings, rollOption, attackMode);
}
getSpellLevels() {
return this.system.getSpellLevels();
}
getSpellTypes() {
return this.system.getSpellTypes();
}
/**
* Ring Colors
*/
getSkillRingColor(token,skill) {
return this.system.getSkillRingColor(token,skill);
}
getSaveRingColor(token,save) {
return this.system.getSaveRingColor(token,save);
}
}

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

@@ -0,0 +1,279 @@
import { compatibleCore } from "../misc.js";
export class wfrp4e {
conf;
constructor(){
console.log("Material Deck: Using system 'Warhammer Fantasy Roleplaying 4e'");
this.conf = game.wfrp4e.config;
}
getActorData(token) {
return token.actor.system;
}
getItemData(item) {
return item.system;
}
getStatsList() {
return [
{value: 'Advantage', name: 'Advantage'},
{value: 'Corruption', name: 'Corruption'},
{value: 'CriticalWounds', name: 'Critical Wounds'},
{value: 'Encumbrance', name: 'Encumbrance'},
{value: 'Fate', name: 'Fate'},
{value: 'Fortune', name: 'Fortune'},
{value: 'Wounds', name: 'Wounds'},
{value: 'Movement', name: 'Movement'},
{value: 'Resilience', name: 'Resilience'},
{value: 'Resolve', name: 'Resolve'},
{value: 'Ability', name: 'Characteristics' } //value is ability to conform to the interface
]
}
getAttackModes() {
return [
]
}
getOnClickList() {
return []
}
getFate(token) {
return this.getActorData(token).status.fate.value
}
getFortune(token) {
return this.getActorData(token).status.fortune.value
}
getWounds(token) {
const wounds = this.getActorData(token).status.wounds
return {
value: wounds.value,
max: wounds.max
}
}
getCriticalWounds(token) {
const criticalWounds = this.getActorData(token).status.criticalWounds
return {
value: criticalWounds.value,
max: criticalWounds.max
}
}
getCorruption(token) {
return this.getActorData(token).status.corruption.value
}
getAdvantage(token) {
return this.getActorData(token).status.advantage.value
}
getResolve(token) {
return this.getActorData(token).status.resolve.value
}
getResilience(token) {
return this.getActorData(token).status.resilience.value
}
getAbility(token, abilityName) {
return this.getCharacteristics(token, abilityName);
}
getAbilityList() {
const keys = Object.keys(this.conf.characteristics);
let abilities = [];
for (let k of keys) abilities.push({value:k, name:this.conf.characteristics?.[k]})
return abilities;
}
getCharacteristics(token, characteristicName) {
if (characteristicName == undefined ) characteristicName = `AG`;
const characteristic = this.getActorData(token).characteristics[characteristicName.toLowerCase()]
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);
}
getFeatureTypes() {
return [
{value: 'skill', name: 'Skills'}
]
}
getSpells(token,spellLevel,type) {
const allItems = token.actor.items;
return allItems.filter(i => i.type == 'spell')
}
getSpellUses(token,level,item) {
return;
}
getSpellLevels() {
return [
{value:'0', name:'Cantrip'},
{value:'1', name:'1st Level'},
{value:'2', name:'2nd Level'},
{value:'3', name:'3rd Level'},
{value:'4', name:'4th Level'},
{value:'5', name:'5th Level'},
{value:'6', name:'6th Level'},
{value:'7', name:'7th Level'},
{value:'8', name:'8th Level'},
{value:'9', name:'9th Level'}
]
}
getSpellTypes() {
return [
]
}
getFeatureUses(item) {
return {available: `+${this.getItemData(item).total.value}`};
}
getHP(token) {
return this.getWounds(token);
}
rollItem(item) {
return game.wfrp4e.utility.rollItemMacro(item.name, item.type, false);
}
getRollTypes() {
return [
{value:'initiative', name:'Initiative'},
{value:'deathSave', name:'Death Save'}
]
}
getSpeed(token) {
return this.getActorData(token).details.move.value;
}
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;
}
getConditionList() {
let conditions = [];
for (let c of CONFIG.statusEffects) conditions.push({value:c.id, name:game.i18n.localize(c.label)});
return conditions;
}
roll(token,roll,options,ability,skill,save) {
if (ability == undefined) ability = 'ag';
return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false);
}
getItems(token,itemType) {
if (itemType == undefined) itemType = 'any';
const allItems = token.actor.items;
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) {
if ( item.type == 'ammunition') {
return {available: this.getItemData(item).quantity.value};
}
else {
return;
}
}
getItemTypes() {
return [
{value:'weapon', name: "Weapons"},
{value:'ammunition', name: "Ammunition"},
{value:'trapping', name: "Trapping"},
{value:'armour', name: "Armour"},
{value:'cargo', name: "Cargo"}
]
}
getSkillList() {
return this.getAbilityList();
}
/* this is all cargo-culted in and some of it could be deleted once the interface is resolved
to not be the superset of all possible systems
*/
getAC(token) {
return;
}
getShieldHP(token) {
return;
}
getInitiative(token) {
return;
}
toggleInitiative(token) {
return;
}
getConditionIcon(condition) {
return;
}
getConditionActive(token,condition) {
return;
}
getTempHP(token) {
return;
}
getSavesList() {
return [];
}
getWeaponRollModes() {
return []
}
/**
* Ring Colors
*/
getSkillRingColor(token, skill) {
return;
}
getSaveRingColor(token, save) {
return;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<table style="width:100%; min-width:400px">
<tr>
<th class='materialDeck_devConf_columnLabel'>{{localize "MaterialDeck.Name"}}</th>
<th class='materialDeck_devConf_columnLabel'>{{localize "MaterialDeck.Type"}}</th>
<th class='materialDeck_devConf_columnId'>{{localize "MaterialDeck.Id"}}</th>
<th class='materialDeck_devConf_columnCB'>{{localize "MaterialDeck.Perm.ENABLE.ENABLE.label"}}</th>
</tr>
{{#each devices as |d|}}
<tr>
<td class='materialDeck_devConf_columnLabel'>{{d.name}}</td>
<td class='materialDeck_devConf_columnLabel'>{{d.type}}</td>
<td class='materialDeck_devConf_columnId'><input type="text" value={{d.id}} disabled></td>
<td class='materialDeck_devConf_columnCB'><input type="checkbox" name="enable" id="materialDeck_devConf_{{d.id}}" {{checked d.en}}></td>
</tr>
{{/each}}
</table>
</form>

View File

@@ -0,0 +1,87 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<h2>{{localize "MaterialDeck.DownloadUtility.Plugin"}}</h2>
<table style="width:100%; min-width:400px">
<tr>
<th class='materialDeck_dlUtil_columnLabel'></th>
<th class='materialDeck_dlUtil_columnVersion'>{{localize "MaterialDeck.DownloadUtility.Current"}}</th>
<th class='materialDeck_dlUtil_columnVersion'>{{localize "MaterialDeck.DownloadUtility.Minimum"}}</th>
<th class='materialDeck_dlUtil_columnVersion'>{{localize "MaterialDeck.DownloadUtility.Latest"}}</th>
<th class='materialDeck_dlUtil_columnOS'>{{localize "MaterialDeck.DownloadUtility.OS"}}</th>
<th class='materialDeck_dlUtil_columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
</tr>
<tr>
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.module"}}</td>
<td class='materialDeck_dlUtil_columnVersion'>{{localModuleVersion}}</td>
<td class='materialDeck_dlUtil_columnVersion'></td>
<td class='materialDeck_dlUtil_columnVersion' id='materialDeck_dlUtil_masterModuleVersion'>{{masterModuleVersion}}</td>
<td class='materialDeck_dlUtil_columnOS'></td>
<td class='materialDeck_dlUtil_columnButton'><button type="button" class='materialDeck_dlUtil_button' style="visibility:hidden">
<i class="fas fa-download"></i>
</button>
</td>
</tr>
<tr>
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.SDplugin"}}</td>
<td class='materialDeck_dlUtil_columnVersion'>{{localSdVersion}}</td>
<td class='materialDeck_dlUtil_columnVersion'>{{minimumSdVersion}}</td>
<td class='materialDeck_dlUtil_columnVersion' id='materialDeck_dlUtil_masterSdVersion'>{{masterSdVersion}}</td>
<td class='materialDeck_dlUtil_columnOS'></td>
<td class='materialDeck_dlUtil_columnButton'>
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_downloadSd' {{#if sdDlDisable}}disabled{{/if}}>
<i class="fas fa-download"></i>
</button>
</td>
</tr>
<tr>
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.MSserver"}}</td>
<td class='materialDeck_dlUtil_columnVersion'>{{localMsVersion}}</td>
<td class='materialDeck_dlUtil_columnVersion'>{{minimumMsVersion}}</td>
<td class='materialDeck_dlUtil_columnVersion' id='materialDeck_dlUtil_masterMsVersion'>{{masterMsVersion}}</td>
<td class='materialDeck_dlUtil_columnOS'>
<select id="materialDeck_dlUtil_os" default="" {{#if msDlDisable}}disabled{{/if}}>
<option value="win32-x64">{{localize "MaterialDeck.DownloadUtility.Windows"}}</option>
<option value="macos-x64">{{localize "MaterialDeck.DownloadUtility.MacosIntel"}}</option>
<option value="macos-arm64">{{localize "MaterialDeck.DownloadUtility.MacosM1"}}</option>
<option value="linux-x64">{{localize "MaterialDeck.DownloadUtility.Linux"}}</option>
<option value="source">{{localize "MaterialDeck.DownloadUtility.Source"}}</option>
</select>
</td>
<td class='materialDeck_dlUtil_columnButton'>
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_downloadMs' {{#if msDlDisable}}disabled{{/if}}>
<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='materialDeck_dlUtil_columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
</tr>
<div id='profileContents'>
{{#each profiles as |p|}}
<tr>
<td>{{p.label}}</td>
<td class='materialDeck_dlUtil_columnButton'>
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_dlProfile-{{p.id}}' name='downloadProfile' {{#if ../profileDlDisable}}disabled{{/if}}>
<i class="fas fa-download"></i>
</button>
</td>
</tr>
{{/each}}
</div>
</table>
<button type="button" id='materialDeck_dlUtil_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}}" style="width:100%;" >
</div>
<button type="submit" name="submit">
<i></i>{{localize "MaterialDeck.Export"}}
</button>
</form>

View File

@@ -1,208 +1,290 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<script>
for (let element of document.getElementsByClassName("materialDeck_helpMenu_expandable")) {
element.addEventListener("click",(event) => {
let thisElement = event.target;
if (event.target.className == "materialDeck_helpMenu_expandableIcon") thisElement = event.target.parentElement;
let nextElement = thisElement.nextElementSibling;
const collapse = nextElement.className == "materialDeck_helpMenu_collapsed" ? false : true;
nextElement.className = collapse ? "materialDeck_helpMenu_collapsed" : "";
thisElement.children[0].src = collapse ? "modules/MaterialDeck/img/right.png" : "modules/MaterialDeck/img/down.png";
})
}
</script>
<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>
<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>
<ol>
<li>Download and install the <a href="https://www.elgato.com/en/gaming/downloads">Stream Deck software</a></li>
<li>Download the latest plugin file (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 the 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 profile (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 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/down.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Introduction</h1>
<div class="">
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>
</div>
<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>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</li>
<li><b>Stream Deck Model</b> - Select the model of your Stream Deck. This is optional, as it only changes the amount of macros and sounds that
you can assign in the macro and soundboard configuration screens. If you have a smaller Stream Deck, you might not want to
have a screen filled with 64 macros, since you probably won't use that many (you can, if you want to, though)</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>
</ul>
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Latest Releases</h1>
<div class="materialDeck_helpMenu_collapsed">
<a href="https://github.com/CDeenen/MaterialDeck/releases">Module</a><br>
<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Stream Deck</a><br>
<a href="https://github.com/CDeenen/MaterialServer/releases">Server</a><br>
You can use the download utility in the module settings to download the Stream Deck plugin, Stream Deck profiles and Material Server.
</div>
<BR CLEAR="right" />
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Getting Started</h1>
<div class="materialDeck_helpMenu_collapsed">
Besides installing this module, you also need to install and run some other things.<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.
<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>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 macro board for the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Macro-Action">Macro action</a>.<br>
<br>
The screen is divided into a number of boxes, each labeled 'Macro #', where each represents a single macro and its settings. The number of macros you can see
depends on what Stream Deck model you've set up in the module configuration.<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>
<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 a number of boxes, each labeled 'Sound #', where each represents a single sound and its settings.
The number of sounds you can see depends on what Stream Deck model you've set up in the module configuration.<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:
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Installing the Stream Deck Software and Plugin</h2>
<div class="materialDeck_helpMenu_collapsed">
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>
</div>
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Installing a Stream Deck Profile (optional)</h2>
<div class="materialDeck_helpMenu_collapsed">
You can create your own profile, but it is recommended to start with one of the pre-made profiles. Currently, there is a profile for the normal and XL Stream Deck variants.
<ol>
<li>Download the latest plugin file using the download utility in the module settings, or download one (ending with .streamDeckProfile) from <a href="https://github.com/CDeenen/MaterialDeck_SD/releases">here</a></li>
<li>Double-click the file, this should load the profile into the Stream Deck software</li>
</ol>
</div>
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Downloading and Starting Material Server</h2>
<div class="materialDeck_helpMenu_collapsed">
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> or through the download utility</li>
<li>Extract the archive</li>
<li>Run 'materialserver.exe' (Windows) or 'materialserver' (MacOS and Linux)</li>
</ol>
<b>You need to always have Material Server running when you want to use Material Deck</b><br>
<br>
<a href="https://github.com/CDeenen/MaterialServer/wiki">Material Server documentation</a>
</div>
</div>
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Module Setup</h1>
<div class="materialDeck_helpMenu_collapsed">
<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 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">User Permission Configuration</h2>
<div class="materialDeck_helpMenu_collapsed">
<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" />
</div>
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Download Utility</h2>
<div class="materialDeck_helpMenu_collapsed">
<img src="modules/MaterialDeck/wiki/img/DownloadUtility.png" align="right" HSPACE="5" width="350">
The download utility allows you to easily check the current version of the Stream Deck plugin and Material Server, and gives you the option to download the latest version.<br>
Please note that the current version of Material Server is at the moment not supported.<br>
<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" />
</div>
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Playlist Configuration</h2>
<div class="materialDeck_helpMenu_collapsed">
<img src="modules/MaterialDeck/wiki/img/PlaylistConfig.png" align="right" HSPACE="5" width="350">
The playlist configuration screen configures the playlists that you control using the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Playlist-Action">Playlist action</a>.<br>
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>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>
<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>
</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>
<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.
</div>
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Macro Configuration</h2>
<div class="materialDeck_helpMenu_collapsed">
The Macro Configuration screen is to configure the macroboard for the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Macro-Action">Macro action</a>.<br>
<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%">
</div>
<h2 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:15px">Soundboard Configuration</h2>
<div class="materialDeck_helpMenu_collapsed">
The Soundboard Configuration screen is used to configure the soundboard for the <a href="https://github.com/CDeenen/MaterialDeck/wiki/Soundboard-Action">Soundboard action</a>.<br>
<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%">
</div>
</div>
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Customization</h1>
<div class="materialDeck_helpMenu_collapsed">
Material Deck is extremely flexible, but most of this flexibility must be performed in the Stream Deck software.<br>
Some basic instructions on using the software can be found <a href="https://github.com/CDeenen/MaterialDeck/wiki/Getting-Started#basic-stream-deck-setup-instructions">here</a>.<br>
<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>
</div>
<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/Move-Action">Move 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>Software Versions & Module Incompatibilities</h1>
<b>Foundry VTT:</b> Tested on 0.7.9<br>
<b>Module Incompatibilities:</b> None known.<br>
<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.
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Feedback & Credits</h1>
<div class="materialDeck_helpMenu_collapsed">
If you have any suggestions or bugs to report, feel free to create an issue, contact me on Discord (Cris#6864), or send me an email: cdeenen@outlook.com.<br>
<br>
<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>
</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="materialDeck_import_uploadJson">
</div>
<button type="submit" name="submit">
<i></i>{{localize "MaterialDeck.Import"}}
</button>
</form>

View File

@@ -1,22 +1,33 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<style>
.boxed {
border: 1px solid black ;
border-radius: 5px ;
max-width: 166px;
height: {{height}}px;
}
</style>
<div class="materialDeck_macroConfig_navigationDiv">
<button type="button" class="materialDeck_macroConfig_navigation" name="navPrev" {{prevDisabled}}>
<i class="fas fa-arrow-left"></i>
</button>
<p class="materialDeck_macroConfig_p"><b>
{{localize "MaterialDeck.Perm.MACRO.label"}}: {{macroRange}} {{localize "MaterialDeck.Of"}} {{totalMacros}}
</b></p>
<button type="button" class="materialDeck_macroConfig_navigation" name="navNext">
<i class="fas fa-arrow-right"></i>
</button>
</div>
<hr>
{{#each macroData}}
<div class="form-group" style="width:100%">
{{#each this.dataThis}}
<div class="boxed" style="padding: 5px; margin:2px; width:10%">
{{#each this.macroRowConfig}}
<div class="materialDeck_macroConfig_boxed">
<div style="text-align:center;">
{{localize "MaterialDeck.Macro"}} {{this.iteration}}
</div>
<div>
<select name="macros" class="macros-select" id="macros{{this.iteration}}" default="" style="max-width:140px;">
<div style="text-align:center;">
{{localize "MaterialDeck.Label"}}
</div>
<input type="text" value="{{this.label}}" name="macroLabel" id="materialDeck_macroConfig_label{{this.iteration}}" style="width:100%;" >
<div style="text-align:center;">
{{localize "MaterialDeck.Macro"}}
</div>
<select name="macros" class="macros-select" id="materialDeck_macroConfig_macros{{this.iteration}}" default="" style="width:100%;">
{{#select this.macro}}
<option value="">{{localize "MaterialDeck.None"}}</option>
{{#each ../../macros}}
@@ -27,15 +38,31 @@
</div>
{{#if ../../furnace}}
<label>{{localize "MaterialDeck.FurnaceArgs"}}</label>
<input type="text" name="args" id="args{{this.iteration}}" value="{{this.args}}">
<input type="text" name="args" id="materialDeck_macroConfig_args{{this.iteration}}" value="{{this.args}}">
{{/if}}
<div class="flex-container" style="display:flex;flex-direction:row;padding-top:10px">
<div class="flex-container materialDeck_macroConfig_background">
<label style="flex:1">{{localize "MaterialDeck.Background"}}</label>
<input style="flex:1" type="color" name="colorPicker" id="colorpicker{{this.iteration}}" data-dtype="String" value="{{this.color}}">
<input style="flex:1" type="color" name="colorPicker" id="materialDeck_macroConfig_colorpicker{{this.iteration}}" data-dtype="String" value="{{this.color}}">
</div>
</div>
{{/each}}
</div>
{{/each}}
<hr>
<div class="materialDeck_macroConfig_navigationDiv">
<button type="button" class="materialDeck_macroConfig_navigation" name="clearPage">
<i></i>{{localize "MaterialDeck.ClearPage"}}
</button>
<button type="button" class="materialDeck_macroConfig_navigation" name="clearAll">
<i></i>{{localize "MaterialDeck.ClearAll"}}
</button>
<p style="width:68%;"></p>
<button type="button" class="materialDeck_macroConfig_navigation" name="import">
<i></i>{{localize "MaterialDeck.Import"}}
</button>
<button type="button" class="materialDeck_macroConfig_navigation" name="export">
<i></i>{{localize "MaterialDeck.Export"}}
</button>
</div>
</form>

View File

@@ -4,7 +4,7 @@
</div>
<div class="form-group">
<label>{{localize "MaterialDeck.PL.Mode"}}</label>
<select name="playMode" class="playMode" default="">
<select name="playMode" class="materialDeck_plConfig_select" default="">
{{#select playMode}}
<option value="0">{{localize "MaterialDeck.PL.Unrestricted"}}</option>
<option value="1">{{localize "MaterialDeck.PL.OneTrackPlaylist"}}</option>
@@ -14,7 +14,7 @@
</div>
<div class="form-group">
<label>{{localize "MaterialDeck.PL.Nr"}}</label>
<input type="number" id="numberOfPlaylists" name="plNum" min="0" max="127" value={{numberOfPlaylists}}>
<input type="number" class="materialDeck_plConfig_select" id="numberOfPlaylists" name="plNum" min="0" max="127" value={{numberOfPlaylists}}>
</div>
<div>
<h2>{{localize "MaterialDeck.Playlists"}}</h2>
@@ -22,7 +22,7 @@
{{#each playlistData}}
<div class="form-group">
<label>{{localize "MaterialDeck.Playlist"}} {{this.iteration}}</label>
<select name="selectedPlaylist" class="playlist-select" id="playlist{{this.iteration}}" default="">
<select name="selectedPlaylist" class="materialDeck_plConfig_select" id="playlist{{this.iteration}}" default="">
{{#select this.playlist}}
<option value="">{{localize "MaterialDeck.None"}}</option>
{{#each ../playlists}}
@@ -31,7 +31,7 @@
{{/select}}
</select>
&nbsp;
<select name="playlistMode" class="playlistMode" id="playlistMode{{this.iteration}}" default="">
<select name="playlistMode" class="materialDeck_plConfig_select" id="playlistMode{{this.iteration}}" default="">
{{#select this.playlistMode}}
<option value="0">{{localize "MaterialDeck.PL.Mode"}}</option>
<option value="1">{{localize "MaterialDeck.PL.Unrestricted"}}</option>

View File

@@ -1,30 +1,35 @@
<form autocomplete="off" onsubmit="event.preventDefault()">
<style>
.boxed {
border: 1px solid black ;
border-radius: 5px ;
max-width: 166px;
height: 300px;
}
</style>
<div class="materialDeck_sbConfig_navigationDiv">
<button type="button" class="materialDeck_sbConfig_navigation" name="navPrev" {{prevDisabled}}>
<i class="fas fa-arrow-left"></i>
</button>
<p class="materialDeck_sbConfig_p"><b>
{{localize "MaterialDeck.Sounds"}}: {{soundRange}} {{localize "MaterialDeck.Of"}} {{totalSounds}}
</b></p>
<button type="button" class="materialDeck_sbConfig_navigation" name="navNext">
<i class="fas fa-arrow-right"></i>
</button>
</div>
<hr>
{{#each soundData}}
<div class="form-group" style="width:100%">
{{#each this.dataThis}}
<div class="boxed" style="padding: 5px; margin:2px; width:10%">
<div class="materialDeck_sbConfig_boxed">
<div style="text-align:center;">
{{localize "MaterialDeck.Sound"}} {{this.iteration}}
</div>
<div style="text-align:center;">
{{localize "MaterialDeck.Name"}}
</div>
<input type="text" name="namebox" value="{{this.name}}" id="name{{this.iteration}}" style="width:100%;" >
<input type="text" name="namebox" value="{{this.name}}" id="materialDeck_sbConfig_name{{this.iteration}}" style="width:100%;" >
<div style="text-align:center;">
{{localize "MaterialDeck.Playlist"}}
</div>
<div>
<select name="playlist" class="playlist-select" default="" style="width:100%;" id="playlists{{this.iteration}}">
<select name="playlist" class="playlist-select" default="" style="width:100%;" id="materialDeck_sbConfig_playlists{{this.iteration}}">
{{#select this.selectedPlaylist}}
{{#each ../../playlists}}
<option value="{{this.id}}">{{this.name}}</option>
@@ -36,8 +41,8 @@
<div style="text-align:center;">
{{localize "MaterialDeck.Sound"}}
</div>
<div class="form-fields" id="ss{{this.iteration}}" style="{{this.styleSS}}">
<select name="sounds" class="sounds-select" default="" style="width:100%;" id="soundSelect{{this.iteration}}">
<div class="form-fields" id="materialDeck_sbConfig_ss{{this.iteration}}" style="{{this.styleSS}}">
<select name="sounds" class="sounds-select" default="" style="width:100%;" id="materialDeck_sbConfig_soundSelect{{this.iteration}}">
{{#select this.sound}}
<option value="">{{localize "MaterialDeck.None"}}</option>
{{#each sounds}}
@@ -46,11 +51,11 @@
{{/select}}
</select>
</div>
<div class="form-fields" id="fp{{this.iteration}}" style="{{this.styleFP}}">
<div class="form-fields" id="materialDeck_sbConfig_fp{{this.iteration}}" style="{{this.styleFP}}">
<button type="button" class="file-picker" data-type="audio" data-target="src{{this.iteration}}" title="Browse Files" tabindex="-1">
<i class="fas fa-file-import fa-fw"></i>
</button>
<input class="image" type="text" name="src{{this.iteration}}" name2="soundSrc" id="srcPath{{this.iteration}}" placeholder="path/audio.mp3" value={{this.srcPath}}>
<input class="image" type="text" name="src{{this.iteration}}" name2="soundSrc" id="materialDeck_sbConfig_srcPath{{this.iteration}}" placeholder="path/audio.mp3" value={{this.srcPath}}>
</div>
<div style="text-align:center;">
{{localize "MaterialDeck.Icon"}}
@@ -59,18 +64,18 @@
<button type="button" class="file-picker" data-type="image" data-target="img{{this.iteration}}" title="Browse Files" tabindex="-1">
<i class="fas fa-file-import fa-fw"></i>
</button>
<input class="image" type="text" name="img{{this.iteration}}" name2="imgSrc" id="imgPath{{this.iteration}}" placeholder="path/image.png" value={{this.imgPath}}>
<input class="image" type="text" name="img{{this.iteration}}" name2="imgSrc" id="materialDeck_sbConfig_imgPath{{this.iteration}}" placeholder="path/image.png" value={{this.imgPath}}>
</div>
<div class="flex-container" style="display:flex;flex-direction:row;padding-top:5px">
<label style="flex:1">{{localize "MaterialDeck.On"}}&nbsp;&nbsp;&nbsp;</label>
<input style="flex:1" type="color" id="colorOn{{this.iteration}}" name="colorOn" style="flex:4" data-dtype="String" value="{{this.colorOn}}">
<input style="flex:1" type="color" id="materialDeck_sbConfig_colorOn{{this.iteration}}" name="colorOn" style="flex:4" data-dtype="String" value="{{this.colorOn}}">
<label style="flex:1">&nbsp;{{localize "MaterialDeck.Off"}}&nbsp;&nbsp;</label>
<input style="flex:1" type="color" id="colorOff{{this.iteration}}" name="colorOff" style="flex:4" data-dtype="String" value="{{this.colorOff}}">
<input style="flex:1" type="color" id="materialDeck_sbConfig_colorOff{{this.iteration}}" name="colorOff" style="flex:4" data-dtype="String" value="{{this.colorOff}}">
</div>
<div class="form-group options">
<label>{{localize "MaterialDeck.Playback"}}</label>
<select name="mode" id="playmode{{this.iteration}}" style="flex:1">
<select name="mode" id="materialDeck_sbConfig_playmode{{this.iteration}}" style="flex:1">
{{#select this.mode}}
<option value="0">{{localize "MaterialDeck.Once"}}</option>
<option value="1">{{localize "MaterialDeck.Repeat"}}</option>
@@ -80,11 +85,27 @@
</div>
<div class="form-group options">
<label>{{localize "MaterialDeck.Volume"}}</label>
<input type="range" min="0" max="100" value={{this.volume}} class="slider" name="volume" id="volume{{this.iteration}}">
<input type="range" min="0" max="100" value={{this.volume}} class="slider" name="volume" id="materialDeck_sbConfig_volume{{this.iteration}}">
</div>
</div>
{{/each}}
</div>
{{/each}}
<hr>
<div class="materialDeck_sbConfig_navigationDiv">
<button type="button" class="materialDeck_sbConfig_navigation" name="clearPage">
<i></i>{{localize "MaterialDeck.ClearPage"}}
</button>
<button type="button" class="materialDeck_sbConfig_navigation" name="clearAll">
<i></i>{{localize "MaterialDeck.ClearAll"}}
</button>
<p style="flex:15;"></p>
<button type="button" class="materialDeck_sbConfig_navigation" name="import">
<i></i>{{localize "MaterialDeck.Import"}}
</button>
<button type="button" class="materialDeck_sbConfig_navigation" name="export">
<i></i>{{localize "MaterialDeck.Export"}}
</button>
</div>
</form>

View File

@@ -1,98 +1,49 @@
<form autocomplete="off" onsubmit="event.preventDefault();">
<style>
header.table-header {
background: rgba(0, 0, 0, 0.5);
padding: 5px;
border: 1px solid #191813;
text-align: center;
color: #f0f0e0;
font-weight: bold;
text-shadow: 1px 1px #000;
}
ul.permissions-list {
list-style: none;
margin: 0;
padding: 0;
overflow: hidden auto;
scrollbar-width: thin;
}
li.permission {
padding: 5px;
border-bottom: 1px solid #7a7971;
}
li.permission .form-fields {
justify-content: space-around;
}
li.permission input[type="checkbox"] {
margin: 0;
}
.index {
flex: 0 0 200px;
text-align: left;
font-weight: bold;
}
.hint {
flex: 0 0 100%;
color: #4b4a44;
font-size: 13px;
margin: 5px 0 0;
}
.form-fields {
justify-content: space-around;
}
</style>
<p class="notes">{{localize "MaterialDeck.Perm.Instructions"}}</p>
<hr>
<div class="form-group">
<h2>{{ localize "MaterialDeck.Perm.ENABLE.label" }}</h2>
</div>
<header class="table-header flexrow">
<label class="index">{{ localize "PERMISSION.Permission" }}</label>
<header class="materialDeck_uPerm_table-header flexrow">
<label class="materialDeck_uPerm_index">{{ localize "PERMISSION.Permission" }}</label>
{{#each roles as |rl r|}}
<label>{{ localize rl}}</label>
{{/each}}
</header>
<li class="materialDeck_uPerm_permission form-group">
<label class="materialDeck_uPerm_index">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.label" }}</label>
<div class="form-fields">
{{#each enable as |r|}}
<input type="checkbox" name="ENABLE.{{r.role}}" {{checked r.en}}>
{{/each}}
</div>
<p class="hint materialDeck_uPerm_hint">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.hint" }}</p>
</li>
<li class="permission form-group">
<label class="index">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.label" }}</label>
<div class="form-fields">
{{#each enable as |r|}}
<input type="checkbox" name="ENABLE" {{checked r}}>
{{/each}}
</div>
<p class="hint">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.hint" }}</p>
</li>
{{#each actions as |a|}}
<div class="form-group">
<h2>{{ localize a.label }}</h2>
</div>
<header class="table-header flexrow">
<label class="index">{{ localize "PERMISSION.Permission" }}</label>
<header class="materialDeck_uPerm_table-header flexrow">
<label class="materialDeck_uPerm_index">{{ localize "PERMISSION.Permission" }}</label>
{{#each ../roles as |rl r|}}
<label>{{ localize rl}}</label>
{{/each}}
</header>
<ul class="permissions-list">
<ul class="materialDeck_uPerm_permissions-list">
{{#each a.permissions as |p|}}
<li class="permission form-group">
<label class="index">{{ localize p.label }}</label>
<li class="materialDeck_uPerm_permission form-group">
<label class="materialDeck_uPerm_index">{{ localize p.label }}</label>
<div class="form-fields">
{{#each p.roles as |r|}}
<input type="checkbox" id="{{p.id}}" name="{{a.id}}.{{p.id}}" {{checked r}}>
<input type="checkbox" name="{{a.id}}.{{p.id}}.{{r.role}}" {{checked r.en}}>
{{/each}}
</div>
<p class="hint">{{ localize p.hint }}</p>
<p class="hint materialDeck_uPerm_hint">{{ localize p.hint }}</p>
</li>
{{/each}}
</ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 481 KiB

After

Width:  |  Height:  |  Size: 584 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 363 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 KiB

After

Width:  |  Height:  |  Size: 622 KiB