Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dce419d7c3 | ||
|
|
4566b8ef53 | ||
|
|
1f55b324c5 | ||
|
|
a6a6cd170e | ||
|
|
cc8588bf4d | ||
|
|
117a1fb59d | ||
|
|
888a2971fb | ||
|
|
c74d27610a | ||
|
|
f4d02cf296 | ||
|
|
874d9c8fb6 | ||
|
|
66b8406615 | ||
|
|
e6c54a2b13 | ||
|
|
c01f9ec566 | ||
|
|
7bd06d7797 | ||
|
|
2fd5f81891 | ||
|
|
e8df118ce1 | ||
|
|
6e22fef160 | ||
|
|
3a52ed28b4 | ||
|
|
6c840cbf59 |
@@ -109,15 +109,20 @@ async function analyzeWSmessage(msg){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.type == 'newDevice') {
|
||||||
|
streamDeck.newDevice(data.iteration,data.device);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data == undefined || data.payload == undefined) return;
|
if (data == undefined || data.payload == undefined) return;
|
||||||
//console.log("Received",data);
|
|
||||||
const action = data.action;
|
const action = data.action;
|
||||||
const event = data.event;
|
const event = data.event;
|
||||||
const context = data.context;
|
const context = data.context;
|
||||||
const coordinates = data.payload.coordinates;
|
const coordinates = data.payload.coordinates;
|
||||||
const settings = data.payload.settings;
|
const settings = data.payload.settings;
|
||||||
const device = data.device;
|
const device = data.device;
|
||||||
|
const name = data.deviceName;
|
||||||
|
const type = data.deviceType;
|
||||||
|
|
||||||
if (data.data == 'init'){
|
if (data.data == 'init'){
|
||||||
|
|
||||||
@@ -125,7 +130,9 @@ async function analyzeWSmessage(msg){
|
|||||||
if (event == 'willAppear' || event == 'didReceiveSettings'){
|
if (event == 'willAppear' || event == 'didReceiveSettings'){
|
||||||
if (coordinates == undefined) return;
|
if (coordinates == undefined) return;
|
||||||
streamDeck.setScreen(action);
|
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'){
|
if (action == 'token'){
|
||||||
tokenControl.active = true;
|
tokenControl.active = true;
|
||||||
@@ -153,6 +160,8 @@ async function analyzeWSmessage(msg){
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (event == 'keyDown'){
|
else if (event == 'keyDown'){
|
||||||
|
if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
|
||||||
|
|
||||||
if (action == 'token')
|
if (action == 'token')
|
||||||
tokenControl.keyPress(settings);
|
tokenControl.keyPress(settings);
|
||||||
else if (action == 'macro')
|
else if (action == 'macro')
|
||||||
@@ -172,6 +181,8 @@ async function analyzeWSmessage(msg){
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (event == 'keyUp'){
|
else if (event == 'keyUp'){
|
||||||
|
if (game.settings.get(moduleName, 'devices')?.[device]?.enable == false) return;
|
||||||
|
|
||||||
if (action == 'soundboard'){
|
if (action == 'soundboard'){
|
||||||
soundboard.keyPressUp(settings);
|
soundboard.keyPressUp(settings);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ Instructions and more info can be found in the <a href="https://github.com/CDeen
|
|||||||
Module manifest: https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json
|
Module manifest: https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json
|
||||||
|
|
||||||
## Software Versions & Module Incompatibilities
|
## Software Versions & Module Incompatibilities
|
||||||
<b>Foundry VTT:</b> Tested on 0.7.9 - 0.8.5<br>
|
<b>Foundry VTT:</b> Tested on 0.7.9 - 0.9<br>
|
||||||
<b>Module Incompatibilities:</b> None known.<br>
|
<b>Module Incompatibilities:</b> None known.<br>
|
||||||
|
|
||||||
## Developer Guide
|
## Developer Guide
|
||||||
|
|||||||
34
changelog.md
@@ -1,4 +1,38 @@
|
|||||||
# Changelog Material Deck Module
|
# Changelog Material Deck Module
|
||||||
|
### 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
|
### v1.4.5 - 27-07-2021
|
||||||
Fixes:
|
Fixes:
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
BIN
img/playlist/.thumb/pause.png.jpg
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
@@ -1,2 +1,3 @@
|
|||||||
play.png: Edited from https://fontawesome.com/icons/play?style=solid
|
play.png: Edited from https://fontawesome.com/icons/play?style=solid
|
||||||
stop.png: Edited from https://fontawesome.com/icons/stop?style=solid
|
stop.png: Edited from https://fontawesome.com/icons/stop?style=solid
|
||||||
|
pause.png: Edited from https://fontawesome.com/v5.15/icons/pause?style=solid
|
||||||
BIN
img/playlist/pause.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
img/token/abilities/.thumb/fort.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/abilities/.thumb/ref.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/abilities/.thumb/will.png.jpg
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
@@ -5,3 +5,6 @@ cons.png: https://game-icons.net/1x1/zeromancer/heart-plus.html
|
|||||||
int.png: https://game-icons.net/1x1/lorc/bookmarklet.html
|
int.png: https://game-icons.net/1x1/lorc/bookmarklet.html
|
||||||
wis.png: https://game-icons.net/1x1/delapouite/wisdom.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
|
||||||
BIN
img/token/abilities/fort.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
img/token/abilities/ref.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
img/token/abilities/will.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
img/token/skills/.thumb/cra.png.jpg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
img/token/skills/.thumb/dip.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/skills/.thumb/occ.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/token/skills/.thumb/soc.png.jpg
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
img/token/skills/.thumb/thi.png.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
@@ -3,17 +3,22 @@ acr.png: https://game-icons.net/1x1/delapouite/contortionist.html
|
|||||||
ani.png: https://game-icons.net/1x1/delapouite/cavalry.html
|
ani.png: https://game-icons.net/1x1/delapouite/cavalry.html
|
||||||
arc.png: https://game-icons.net/1x1/delapouite/spell-book.html
|
arc.png: https://game-icons.net/1x1/delapouite/spell-book.html
|
||||||
ath.png: https://game-icons.net/1x1/lorc/muscle-up.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
|
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
|
his.png: https://game-icons.net/1x1/delapouite/backward-time.html
|
||||||
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
|
ins.png: https://game-icons.net/1x1/lorc/light-bulb.html
|
||||||
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
|
itm.png: https://game-icons.net/1x1/lorc/one-eyed.html
|
||||||
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
|
inv.png: https://game-icons.net/1x1/lorc/magnifying-glass.html
|
||||||
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
|
med.png: https://game-icons.net/1x1/delapouite/first-aid-kit.html
|
||||||
nat.png: https://game-icons.net/1x1/delapouite/forest.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
|
prc.png: https://game-icons.net/1x1/lorc/semi-closed-eye.html
|
||||||
prf.png: https://game-icons.net/1x1/lorc/sing.html
|
prf.png: https://game-icons.net/1x1/lorc/sing.html
|
||||||
per.png: https://game-icons.net/1x1/delapouite/public-speaker.html
|
per.png: https://game-icons.net/1x1/delapouite/public-speaker.html
|
||||||
rel.png: https://game-icons.net/1x1/lorc/holy-grail.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
|
slt.png: https://game-icons.net/1x1/lorc/snatch.html
|
||||||
ste.png: https://game-icons.net/1x1/lorc/cloak-dagger.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
|
After Width: | Height: | Size: 18 KiB |
BIN
img/token/skills/dip.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
img/token/skills/occ.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
img/token/skills/soc.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
img/token/skills/thi.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
@@ -9,6 +9,7 @@
|
|||||||
"MaterialDeck.Sett.Enable": "Enable module",
|
"MaterialDeck.Sett.Enable": "Enable module",
|
||||||
"MaterialDeck.Sett.Help": "Help",
|
"MaterialDeck.Sett.Help": "Help",
|
||||||
"MaterialDeck.Sett.Permission": "User Permission Configuration",
|
"MaterialDeck.Sett.Permission": "User Permission Configuration",
|
||||||
|
"MaterialDeck.DeviceConfig.Title": "Device Configuration",
|
||||||
"MaterialDeck.Sett.PlaylistConfig": "Playlist Configuration",
|
"MaterialDeck.Sett.PlaylistConfig": "Playlist Configuration",
|
||||||
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
|
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
|
||||||
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
|
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
"MaterialDeck.Playlists": "Playlists",
|
"MaterialDeck.Playlists": "Playlists",
|
||||||
"MaterialDeck.Playlist": "Playlist",
|
"MaterialDeck.Playlist": "Playlist",
|
||||||
"MaterialDeck.FilePicker": "File Picker",
|
"MaterialDeck.FilePicker": "File Picker",
|
||||||
"MaterialDeck.FurnaceArgs": "Furnace arguments",
|
"MaterialDeck.FurnaceArgs": "Macro arguments",
|
||||||
"MaterialDeck.Background": "Background",
|
"MaterialDeck.Background": "Background",
|
||||||
"MaterialDeck.Macro": "Macro",
|
"MaterialDeck.Macro": "Macro",
|
||||||
"MaterialDeck.Sound": "Sound",
|
"MaterialDeck.Sound": "Sound",
|
||||||
@@ -58,6 +59,8 @@
|
|||||||
"MaterialDeck.Import": "Import",
|
"MaterialDeck.Import": "Import",
|
||||||
"MaterialDeck.Export": "Export",
|
"MaterialDeck.Export": "Export",
|
||||||
"MaterialDeck.Filename": "Filename",
|
"MaterialDeck.Filename": "Filename",
|
||||||
|
"MaterialDeck.Id": "Id",
|
||||||
|
"MaterialDeck.Type": "Type",
|
||||||
|
|
||||||
"MaterialDeck.ExportDialog.Title": "Export",
|
"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.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.",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "MaterialDeck",
|
"name": "MaterialDeck",
|
||||||
"title": "Material Deck",
|
"title": "Material Deck",
|
||||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||||
"version": "1.4.5",
|
"version": "1.4.7",
|
||||||
"author": "CDeenen",
|
"author": "CDeenen",
|
||||||
"authors": {
|
"authors": {
|
||||||
"name": "CDeenen",
|
"name": "CDeenen",
|
||||||
@@ -12,17 +12,17 @@
|
|||||||
"reddit": "CDeenen123"
|
"reddit": "CDeenen123"
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
"minimumSDversion": "1.4.4",
|
"minimumSDversion": "1.4.7",
|
||||||
"minimumMSversion": "1.0.2"
|
"minimumMSversion": "1.0.2"
|
||||||
},
|
},
|
||||||
"minimumSDversion": "1.4.4",
|
"minimumSDversion": "1.4.7",
|
||||||
"minimumMSversion": "1.0.2",
|
"minimumMSversion": "1.0.2",
|
||||||
"esmodules": [
|
"esmodules": [
|
||||||
"./MaterialDeck.js"
|
"./MaterialDeck.js"
|
||||||
],
|
],
|
||||||
"socket": true,
|
"socket": true,
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.8.8",
|
"compatibleCoreVersion": "9",
|
||||||
"languages": [
|
"languages": [
|
||||||
{
|
{
|
||||||
"lang": "en",
|
"lang": "en",
|
||||||
|
|||||||
170
src/external.js
@@ -111,38 +111,20 @@ export class ExternalModules{
|
|||||||
let name = '';
|
let name = '';
|
||||||
if (type == 'weatherControls') {
|
if (type == 'weatherControls') {
|
||||||
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
|
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
|
||||||
name = CONFIG.weatherEffects[effect].label;
|
name = CONFIG.fxmaster.weather[effect].label;
|
||||||
icon = CONFIG.weatherEffects[effect].icon;
|
icon = CONFIG.fxmaster.weather[effect].icon;
|
||||||
ring = this.findWeatherEffect(effect) != undefined ? 2 : 1;
|
ring = canvas.scene.getFlag("fxmaster", "effects")?.[`core_${effect}`] ? 2 : 1;
|
||||||
ringColor = ring < 2 ? '#000000' : "#00ff00";
|
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') {
|
else if (type == 'filters') {
|
||||||
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
|
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
|
||||||
name = CONFIG.fxmaster.filters[filter].label;
|
name = CONFIG.fxmaster.filters[filter].label;
|
||||||
background = "#340057";
|
background = "#340057";
|
||||||
if (displayIcon){
|
if (displayIcon){
|
||||||
if (filter == 'underwater') icon = "fas fa-water";
|
if (filter == 'lightning') icon = "fas fa-bolt";
|
||||||
|
else if (filter == 'underwater') icon = "fas fa-water";
|
||||||
else if (filter == 'predator') icon = "fas fa-wave-square";
|
else if (filter == '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 == 'oldfilm') icon = "fas fa-film";
|
||||||
else if (filter == 'bloom') icon = "fas fa-ghost";
|
else if (filter == 'bloom') icon = "fas fa-ghost";
|
||||||
}
|
}
|
||||||
@@ -158,6 +140,7 @@ export class ExternalModules{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (filter == 'color') background = settings.fxMasterFilterColor ? settings.fxMasterFilterColor : '#ffffff';
|
||||||
}
|
}
|
||||||
else if (type == 'clear'){
|
else if (type == 'clear'){
|
||||||
icon = "fas fa-trash";
|
icon = "fas fa-trash";
|
||||||
@@ -170,15 +153,6 @@ export class ExternalModules{
|
|||||||
streamDeck.setTitle(name,context);
|
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){
|
keyPressFxMaster(settings,context,device){
|
||||||
if (game.user.isGM == false) return;
|
if (game.user.isGM == false) return;
|
||||||
const fxmaster = game.modules.get("fxmaster");
|
const fxmaster = game.modules.get("fxmaster");
|
||||||
@@ -188,91 +162,63 @@ export class ExternalModules{
|
|||||||
|
|
||||||
if (type == 'weatherControls') {
|
if (type == 'weatherControls') {
|
||||||
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
|
const effect = (settings.weatherEffect == undefined) ? 'leaves' : settings.weatherEffect;
|
||||||
let exists = false;
|
|
||||||
let newEffects = {};
|
const options = {
|
||||||
let effects = canvas.scene.getFlag("fxmaster", "effects");
|
density: (settings.densitySlider == undefined) ? 0.25 : settings.densitySlider,
|
||||||
if (effects != undefined){
|
speed: (settings.speedSlider == undefined) ? 1 : settings.speedSlider,
|
||||||
const weatherIds = Object.keys(effects);
|
direction: (settings.directionSlider == undefined) ? 15 : settings.directionSlider,
|
||||||
for (let i=0; i<weatherIds.length; i++){
|
scale: (settings.scaleSlider == undefined) ? 1 : settings.scaleSlider,
|
||||||
const weather = effects[weatherIds[i]].type;
|
color: (settings.fxMasterWeatherColor == undefined) ? "#000000" : settings.fxMasterWeatherColor,
|
||||||
if (weather === effect) {
|
applyColor: (settings.fxWeatherEnColor == undefined) ? false : settings.fxWeatherEnColor
|
||||||
exists = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
newEffects[weatherIds[i]] = effects[weatherIds[i]];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const density = (settings.densitySlider == undefined) ? 50 : settings.densitySlider;
|
Hooks.call("fxmaster.switchWeather", {
|
||||||
const speed = (settings.speedSlider == undefined) ? 50 : settings.speedSlider;
|
name: `core_${effect}`,
|
||||||
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,
|
type: effect,
|
||||||
options: {
|
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') {
|
else if (type == 'filters') {
|
||||||
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
|
const filter = (settings.fxMasterFilter == undefined) ? 'underwater' : settings.fxMasterFilter;
|
||||||
const filters = canvas.scene.getFlag("fxmaster", "filters");
|
|
||||||
let newFilters = {};
|
let options = {color: {value:"#000000", apply:false}};
|
||||||
let exists = false;
|
if (filter == 'lightning') {
|
||||||
if (filters != undefined){
|
options.period = settings.fxMasterFilterPeriod ? parseFloat(settings.fxMasterFilterPeriod) : 500;
|
||||||
const filterObjects = Object.keys(filters);
|
options.duration = settings.fxMasterFilterDuration ? parseFloat(settings.fxMasterFilterDuration) : 300;
|
||||||
for (let i=0; i<filterObjects.length; i++){
|
options.brightness = settings.fxMasterFilterBrightness ? parseFloat(settings.fxMasterFilterBrightness) : 1.3;
|
||||||
if (filterObjects[i] == 'core_'+filter){
|
|
||||||
exists = true;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
newFilters[filterObjects[i]] = filters[filterObjects[i]];
|
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;
|
||||||
}
|
}
|
||||||
if (exists == false) {
|
else if (filter == 'oldfilm') {
|
||||||
newFilters['core_'+filter] = {type : filter};
|
options.sepia = settings.fxMasterFilterSepia ? parseFloat(settings.fxMasterFilterSepia) : 0.3;
|
||||||
|
options.noise = settings.fxMasterFilterNoise ? parseFloat(settings.fxMasterFilterNoise) : 4;
|
||||||
}
|
}
|
||||||
canvas.scene.unsetFlag("fxmaster", "filters").then(() => {
|
|
||||||
canvas.scene.setFlag("fxmaster", "filters", newFilters);
|
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'){
|
else if (type == 'clear'){
|
||||||
canvas.scene.unsetFlag("fxmaster", "filters");
|
canvas.scene.unsetFlag("fxmaster", "filters");
|
||||||
@@ -280,18 +226,6 @@ export class ExternalModules{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
findWeatherEffect(effect){
|
|
||||||
const effects = canvas.scene.getFlag("fxmaster", "effects");
|
|
||||||
if (effects == undefined) return undefined;
|
|
||||||
|
|
||||||
const weatherIds = Object.keys(effects);
|
|
||||||
for (let i = 0; i < weatherIds.length; ++i) {
|
|
||||||
const weather = effects[weatherIds[i]].type;
|
|
||||||
if (weather === effect) return weatherIds[i];
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GM Screen
|
//GM Screen
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -317,7 +251,7 @@ export class ExternalModules{
|
|||||||
keyPressGMScreen(settings,context,device){
|
keyPressGMScreen(settings,context,device){
|
||||||
if (this.getModuleEnable("gm-screen") == false) return;
|
if (this.getModuleEnable("gm-screen") == false) return;
|
||||||
if (game.user.isGM == false) return;
|
if (game.user.isGM == false) return;
|
||||||
window['gm-screen'].toggleGmScreenVisibility();
|
game.modules.get('gm-screen')?.api?.toggleGmScreenVisibility?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
90
src/misc.js
@@ -1,12 +1,14 @@
|
|||||||
import {sdVersion, msVersion, moduleName, getPermission, enableModule} from "../MaterialDeck.js";
|
import {sdVersion, msVersion, moduleName, getPermission, enableModule, streamDeck} from "../MaterialDeck.js";
|
||||||
import {macroControl,soundboard,playlistControl} from "../MaterialDeck.js";
|
import {macroControl,soundboard,playlistControl} from "../MaterialDeck.js";
|
||||||
|
|
||||||
export function compatibleCore(compatibleVersion){
|
export function compatibleCore(compatibleVersion){
|
||||||
let coreVersion = game.data.version;
|
let coreVersion = game.version == undefined ? game.data.version : `0.${game.version}`;
|
||||||
coreVersion = coreVersion.split(".");
|
coreVersion = coreVersion.split(".");
|
||||||
compatibleVersion = compatibleVersion.split(".");
|
compatibleVersion = compatibleVersion.split(".");
|
||||||
if (compatibleVersion[0] > coreVersion[0]) return false;
|
if (compatibleVersion[0] > coreVersion[0]) return false;
|
||||||
|
if (compatibleVersion[0] < coreVersion[0]) return true;
|
||||||
if (compatibleVersion[1] > coreVersion[1]) return false;
|
if (compatibleVersion[1] > coreVersion[1]) return false;
|
||||||
|
if (compatibleVersion[1] < coreVersion[1]) return true;
|
||||||
if (compatibleVersion[2] > coreVersion[2]) return false;
|
if (compatibleVersion[2] > coreVersion[2]) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1186,3 +1188,87 @@ export class downloadUtility extends FormApplication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class deviceConfig extends FormApplication {
|
||||||
|
constructor(data, options) {
|
||||||
|
super(data, options);
|
||||||
|
|
||||||
|
this.devices = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Options for this FormApplication
|
||||||
|
*/
|
||||||
|
static get defaultOptions() {
|
||||||
|
return mergeObject(super.defaultOptions, {
|
||||||
|
id: "MD_DeviceConfig",
|
||||||
|
title: "Material Deck: " + game.i18n.localize("MaterialDeck.DeviceConfig.Title"),
|
||||||
|
template: "./modules/MaterialDeck/templates/deviceConfig.html",
|
||||||
|
width: 500,
|
||||||
|
height: "auto"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide data to the template
|
||||||
|
*/
|
||||||
|
getData() {
|
||||||
|
this.devices = [];
|
||||||
|
const dConfig = game.settings.get(moduleName, 'devices');
|
||||||
|
|
||||||
|
for (let d of streamDeck.buttonContext) {
|
||||||
|
let type;
|
||||||
|
if (d.type == 0) type = 'Stream Deck';
|
||||||
|
else if (d.type == 1) type = 'Stream Deck Mini';
|
||||||
|
else if (d.type == 2) type = 'Stream Deck XL';
|
||||||
|
else if (d.type == 3) type = 'Stream Deck Mobile';
|
||||||
|
else if (d.type == 4) type = 'Corsair G Keys';
|
||||||
|
|
||||||
|
const name = d.name;
|
||||||
|
const id = d.device;
|
||||||
|
let enable;
|
||||||
|
if (dConfig?.[id] == undefined) enable = true;
|
||||||
|
else enable = dConfig?.[id].enable;
|
||||||
|
|
||||||
|
const device = {
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
type,
|
||||||
|
en: enable
|
||||||
|
}
|
||||||
|
this.devices.push(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
devices: this.devices
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update on form submit
|
||||||
|
* @param {*} event
|
||||||
|
* @param {*} formData
|
||||||
|
*/
|
||||||
|
async _updateObject(event, formData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
activateListeners(html) {
|
||||||
|
super.activateListeners(html);
|
||||||
|
|
||||||
|
html.find("input[name='enable']").on('change', (event) => {
|
||||||
|
const id = event.currentTarget.id;
|
||||||
|
for (let d of this.devices) {
|
||||||
|
if (d.id == id) {
|
||||||
|
let dConfig = game.settings.get(moduleName, 'devices');
|
||||||
|
delete dConfig[id];
|
||||||
|
dConfig[id] = {enable: event.currentTarget.checked}
|
||||||
|
|
||||||
|
game.settings.set(moduleName, 'devices', dConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,8 @@ export class OtherControls{
|
|||||||
this.active = false;
|
this.active = false;
|
||||||
this.rollData = {};
|
this.rollData = {};
|
||||||
this.rollOption = 'dialog';
|
this.rollOption = 'dialog';
|
||||||
|
this.controlsOffset = 0;
|
||||||
|
this.toolsOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setRollOption(option) {
|
setRollOption(option) {
|
||||||
@@ -225,7 +227,9 @@ export class OtherControls{
|
|||||||
const control = settings.control ? settings.control : 'dispControls';
|
const control = settings.control ? settings.control : 'dispControls';
|
||||||
const tool = settings.tool ? settings.tool : 'open';
|
const tool = settings.tool ? settings.tool : 'open';
|
||||||
let background = settings.background ? settings.background : '#000000';
|
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 txt = "";
|
||||||
let src = "";
|
let src = "";
|
||||||
const activeControl = ui.controls.activeControl;
|
const activeControl = ui.controls.activeControl;
|
||||||
@@ -235,6 +239,7 @@ export class OtherControls{
|
|||||||
let controlNr = parseInt(settings.controlNr);
|
let controlNr = parseInt(settings.controlNr);
|
||||||
if (isNaN(controlNr)) controlNr = 1;
|
if (isNaN(controlNr)) controlNr = 1;
|
||||||
controlNr--;
|
controlNr--;
|
||||||
|
controlNr += this.controlsOffset;
|
||||||
|
|
||||||
const selectedControl = ui.controls.controls[controlNr];
|
const selectedControl = ui.controls.controls[controlNr];
|
||||||
|
|
||||||
@@ -255,6 +260,7 @@ export class OtherControls{
|
|||||||
let controlNr = parseInt(settings.controlNr);
|
let controlNr = parseInt(settings.controlNr);
|
||||||
if (isNaN(controlNr)) controlNr = 1;
|
if (isNaN(controlNr)) controlNr = 1;
|
||||||
controlNr--;
|
controlNr--;
|
||||||
|
controlNr += this.toolsOffset;
|
||||||
|
|
||||||
const selectedControl = ui.controls.controls.find(c => c.name == ui.controls.activeControl);
|
const selectedControl = ui.controls.controls.find(c => c.name == ui.controls.activeControl);
|
||||||
if (selectedControl != undefined){
|
if (selectedControl != undefined){
|
||||||
@@ -275,6 +281,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
|
else { // specific control/tool
|
||||||
const selectedControl = ui.controls.controls.find(c => c.name == control);
|
const selectedControl = ui.controls.controls.find(c => c.name == control);
|
||||||
if (selectedControl != undefined){
|
if (selectedControl != undefined){
|
||||||
@@ -370,6 +388,16 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (control == 'controlsOffset') {
|
||||||
|
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
|
||||||
|
if (offsetType == 'absoluteOffset') this.controlsOffset = parseInt(settings.controlsOffset);
|
||||||
|
else if (offsetType == 'relativeOffset') this.controlsOffset += parseInt(settings.controlsOffset);
|
||||||
|
}
|
||||||
|
else if (control == 'toolsOffset') {
|
||||||
|
const offsetType = settings.controlsOffsetType ? settings.controlsOffsetType : 'absoluteOffset';
|
||||||
|
if (offsetType == 'absoluteOffset') this.toolsOffset = parseInt(settings.controlsOffset);
|
||||||
|
else if (offsetType == 'relativeOffset') this.toolsOffset += parseInt(settings.controlsOffset);
|
||||||
|
}
|
||||||
else { //select control
|
else { //select control
|
||||||
const selectedControl = ui.controls.controls.find(c => c.name == control);
|
const selectedControl = ui.controls.controls.find(c => c.name == control);
|
||||||
if (selectedControl != undefined){
|
if (selectedControl != undefined){
|
||||||
@@ -588,6 +616,7 @@ export class OtherControls{
|
|||||||
else if (nr == 'items') name = game.i18n.localize("SIDEBAR.TabItems");
|
else if (nr == 'items') name = game.i18n.localize("SIDEBAR.TabItems");
|
||||||
else if (nr == 'journal') name = game.i18n.localize("SIDEBAR.TabJournal");
|
else if (nr == 'journal') name = game.i18n.localize("SIDEBAR.TabJournal");
|
||||||
else if (nr == 'tables') name = game.i18n.localize("SIDEBAR.TabTables");
|
else if (nr == 'tables') name = game.i18n.localize("SIDEBAR.TabTables");
|
||||||
|
else if (nr == 'cards') name = game.i18n.localize("SIDEBAR.TabCards");
|
||||||
else if (nr == 'playlists') name = game.i18n.localize("SIDEBAR.TabPlaylists");
|
else if (nr == 'playlists') name = game.i18n.localize("SIDEBAR.TabPlaylists");
|
||||||
else if (nr == 'compendium') name = game.i18n.localize("SIDEBAR.TabCompendium");
|
else if (nr == 'compendium') name = game.i18n.localize("SIDEBAR.TabCompendium");
|
||||||
else if (nr == 'settings') name = game.i18n.localize("SIDEBAR.TabSettings");
|
else if (nr == 'settings') name = game.i18n.localize("SIDEBAR.TabSettings");
|
||||||
@@ -600,10 +629,11 @@ export class OtherControls{
|
|||||||
if (nr == 'chat') icon = window.CONFIG.ChatMessage.sidebarIcon;
|
if (nr == 'chat') icon = window.CONFIG.ChatMessage.sidebarIcon;
|
||||||
else if (nr == 'combat') icon = window.CONFIG.Combat.sidebarIcon;
|
else if (nr == 'combat') icon = window.CONFIG.Combat.sidebarIcon;
|
||||||
else if (nr == 'scenes') icon = window.CONFIG.Scene.sidebarIcon;
|
else if (nr == 'scenes') icon = window.CONFIG.Scene.sidebarIcon;
|
||||||
else if (nr == 'actors') icon = window.CONFIG.Actor.sidebarIcon;
|
else if (nr == 'actors') icon = "fas fa-users";
|
||||||
else if (nr == 'items') icon = window.CONFIG.Item.sidebarIcon;
|
else if (nr == 'items') icon = window.CONFIG.Item.sidebarIcon;
|
||||||
else if (nr == 'journal') icon = window.CONFIG.JournalEntry.sidebarIcon;
|
else if (nr == 'journal') icon = window.CONFIG.JournalEntry.sidebarIcon;
|
||||||
else if (nr == 'tables') icon = window.CONFIG.RollTable.sidebarIcon;
|
else if (nr == 'tables') icon = window.CONFIG.RollTable.sidebarIcon;
|
||||||
|
else if (nr == 'cards') icon = "fas fa-id-badge";
|
||||||
else if (nr == 'playlists') icon = window.CONFIG.Playlist.sidebarIcon;
|
else if (nr == 'playlists') icon = window.CONFIG.Playlist.sidebarIcon;
|
||||||
else if (nr == 'compendium') icon = "fas fa-atlas";
|
else if (nr == 'compendium') icon = "fas fa-atlas";
|
||||||
else if (nr == 'settings') icon = "fas fa-cogs";
|
else if (nr == 'settings') icon = "fas fa-cogs";
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export class PlaylistControl{
|
|||||||
this.updateTrack(settings,context,device);
|
this.updateTrack(settings,context,device);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const src = 'modules/MaterialDeck/img/playlist/stop.png';
|
const src = mode == 'stopAll' ? 'modules/MaterialDeck/img/playlist/stop.png' : 'modules/MaterialDeck/img/playlist/pause.png';
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const ringColor = (game.playlists.playing.length > 0) ? '#00FF00' : '#000000';
|
const ringColor = (game.playlists.playing.length > 0) ? '#00FF00' : '#000000';
|
||||||
const ring = (game.playlists.playing.length > 0) ? 2 : 1;
|
const ring = (game.playlists.playing.length > 0) ? 2 : 1;
|
||||||
@@ -167,6 +167,27 @@ export class PlaylistControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pauseAll(){
|
||||||
|
if (game.user.isGM == false) {
|
||||||
|
const payload = {
|
||||||
|
"msgType": "pauseAllPlaylists"
|
||||||
|
};
|
||||||
|
game.socket.emit(`module.MaterialDeck`, payload);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
let playing = game.playlists.playing;
|
||||||
|
for (let i=0; i<playing.length; i++){
|
||||||
|
for (let sound of playing[i].sounds.contents) {
|
||||||
|
if (sound.playing) sound.sound.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
for (let elmnt of document.getElementsByClassName('sound-control pause'))
|
||||||
|
elmnt.click();
|
||||||
|
}
|
||||||
|
|
||||||
getPlaylist(num){
|
getPlaylist(num){
|
||||||
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
|
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
|
||||||
if (selectedPlaylists != undefined)
|
if (selectedPlaylists != undefined)
|
||||||
@@ -191,6 +212,9 @@ export class PlaylistControl{
|
|||||||
if (playlistMode == 'stopAll') {
|
if (playlistMode == 'stopAll') {
|
||||||
this.stopAll(true);
|
this.stopAll(true);
|
||||||
}
|
}
|
||||||
|
else if (playlistMode == 'pauseAll') {
|
||||||
|
this.pauseAll();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if (playlistType == 'playStop') {
|
if (playlistType == 'playStop') {
|
||||||
let playlist = this.getPlaylist(playlistNr);
|
let playlist = this.getPlaylist(playlistNr);
|
||||||
@@ -205,6 +229,12 @@ export class PlaylistControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (playlistType == 'playNext') {
|
||||||
|
this.getPlaylist(playlistNr).playNext();
|
||||||
|
}
|
||||||
|
else if (playlistType == 'playPrev') {
|
||||||
|
this.getPlaylist(playlistNr).playNext(null,{direction:-1});
|
||||||
|
}
|
||||||
else if (playlistType == 'offset'){
|
else if (playlistType == 'offset'){
|
||||||
if (playlistMode == 'playlist') {
|
if (playlistMode == 'playlist') {
|
||||||
this.playlistOffset = parseInt(settings.offset);
|
this.playlistOffset = parseInt(settings.offset);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import * as MODULE from "../MaterialDeck.js";
|
||||||
import { playlistConfigForm, macroConfigForm, soundboardConfigForm, downloadUtility } from "./misc.js";
|
import { playlistConfigForm, macroConfigForm, soundboardConfigForm, downloadUtility, deviceConfig } from "./misc.js";
|
||||||
|
|
||||||
let userPermissions = {};
|
let userPermissions = {};
|
||||||
const defaultEnable = [true,true,true,true];
|
const defaultEnable = [true,true,true,true];
|
||||||
@@ -133,6 +133,27 @@ export const registerSettings = async function() {
|
|||||||
restricted: false
|
restricted: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
game.settings.registerMenu(MODULE.moduleName, 'downloadUtility',{
|
||||||
|
name: "MaterialDeck.DownloadUtility.Title",
|
||||||
|
label: "MaterialDeck.DownloadUtility.Title",
|
||||||
|
type: downloadUtility,
|
||||||
|
restricted: false
|
||||||
|
});
|
||||||
|
|
||||||
|
game.settings.registerMenu(MODULE.moduleName, 'deviceConfig',{
|
||||||
|
name: "MaterialDeck.DeviceConfig.Title",
|
||||||
|
label: "MaterialDeck.DeviceConfig.Title",
|
||||||
|
type: deviceConfig,
|
||||||
|
restricted: false
|
||||||
|
});
|
||||||
|
|
||||||
|
game.settings.register(MODULE.moduleName, 'devices', {
|
||||||
|
name: "devices",
|
||||||
|
scope: "client",
|
||||||
|
type: Object,
|
||||||
|
config: false
|
||||||
|
});
|
||||||
|
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'permissionConfig',{
|
game.settings.registerMenu(MODULE.moduleName, 'permissionConfig',{
|
||||||
name: "MaterialDeck.Sett.Permission",
|
name: "MaterialDeck.Sett.Permission",
|
||||||
label: "MaterialDeck.Sett.Permission",
|
label: "MaterialDeck.Sett.Permission",
|
||||||
@@ -147,13 +168,6 @@ export const registerSettings = async function() {
|
|||||||
config: false
|
config: false
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'downloadUtility',{
|
|
||||||
name: "MaterialDeck.DownloadUtility.Title",
|
|
||||||
label: "MaterialDeck.DownloadUtility.Title",
|
|
||||||
type: downloadUtility,
|
|
||||||
restricted: false
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Playlist soundboard
|
* Playlist soundboard
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -34,7 +34,26 @@ 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: size,
|
||||||
|
buttons: buttons
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings, name, type){
|
||||||
if (device == undefined) return;
|
if (device == undefined) return;
|
||||||
if (this.buttonContext[iteration] == undefined) {
|
if (this.buttonContext[iteration] == undefined) {
|
||||||
const deckSize = size.columns*size.rows;
|
const deckSize = size.columns*size.rows;
|
||||||
@@ -44,6 +63,8 @@ export class StreamDeck{
|
|||||||
}
|
}
|
||||||
this.buttonContext[iteration] = {
|
this.buttonContext[iteration] = {
|
||||||
device: device,
|
device: device,
|
||||||
|
name: name,
|
||||||
|
type: type,
|
||||||
size: size,
|
size: size,
|
||||||
buttons: buttons
|
buttons: buttons
|
||||||
}
|
}
|
||||||
@@ -61,7 +82,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
clearContext(device,action,coordinates = {column:0,row:0}){
|
clearContext(device,action,coordinates = {column:0,row:0}){
|
||||||
for (let d of this.buttonContext) {
|
for (let d of this.buttonContext) {
|
||||||
if (d.device == device) {
|
if (d?.device == device) {
|
||||||
const num = coordinates.column + coordinates.row*d.size.columns;
|
const num = coordinates.column + coordinates.row*d.size.columns;
|
||||||
d.buttons[num] = undefined;
|
d.buttons[num] = undefined;
|
||||||
return;
|
return;
|
||||||
@@ -241,7 +262,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
//if (src != 'modules/MaterialDeck/img/black.png')
|
//if (src != 'modules/MaterialDeck/img/black.png')
|
||||||
for (let d of this.buttonContext) {
|
for (let d of this.buttonContext) {
|
||||||
if (d.device == device) {
|
if (d?.device == device) {
|
||||||
for (let i=0; i<d.buttons.length; i++){
|
for (let i=0; i<d.buttons.length; i++){
|
||||||
if (clock != false) break;
|
if (clock != false) break;
|
||||||
if (d.buttons[i] == undefined) continue;
|
if (d.buttons[i] == undefined) continue;
|
||||||
@@ -358,14 +379,12 @@ export class StreamDeck{
|
|||||||
BGvalid = false;
|
BGvalid = false;
|
||||||
if (BGvalid == false) background = '#000000';
|
if (BGvalid == false) background = '#000000';
|
||||||
|
|
||||||
let canvas;
|
let canvas = document.createElement('canvas');
|
||||||
if (canvas == null || canvas == undefined){
|
|
||||||
canvas = document.createElement('canvas');
|
|
||||||
canvas.width="144";
|
canvas.width="144";
|
||||||
canvas.height="144";
|
canvas.height="144";
|
||||||
canvas.style="background-color:transparent;visibility:hidden";
|
canvas.style="background-color:transparent;visibility:hidden;display:none";
|
||||||
document.getElementById('sdCanvasBox').appendChild(canvas); // adds the canvas to #someBox
|
document.getElementById('sdCanvasBox').appendChild(canvas); // adds the canvas to #someBox
|
||||||
}
|
|
||||||
this.counter++;
|
this.counter++;
|
||||||
if (this.counter > 31) this.counter = 0;
|
if (this.counter > 31) this.counter = 0;
|
||||||
|
|
||||||
@@ -413,6 +432,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
if (format != 'jpg' && format != 'jpeg' && format != 'png' && 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"
|
//if (url == "") url = "modules/MaterialDeck/img/transparant.png"
|
||||||
|
|
||||||
let resImageURL = url;
|
let resImageURL = url;
|
||||||
let img = new Image();
|
let img = new Image();
|
||||||
img.setAttribute('crossorigin', 'anonymous');
|
img.setAttribute('crossorigin', 'anonymous');
|
||||||
|
|||||||
238
src/systems/forbidden-lands.js
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
import {compatibleCore} from "../misc.js";
|
||||||
|
|
||||||
|
export class forbiddenlands{
|
||||||
|
constructor(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getHP(token) {
|
||||||
|
const hp = token.actor.data.data.attribute.strength;
|
||||||
|
return {
|
||||||
|
value: hp.value,
|
||||||
|
max: hp.max
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getAgility(token) {
|
||||||
|
const agility = token.actor.data.data.attribute.agility;
|
||||||
|
return {
|
||||||
|
value: agility.value,
|
||||||
|
max: agility.max
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getWits(token) {
|
||||||
|
const wits = token.actor.data.data.attribute.wits;
|
||||||
|
return {
|
||||||
|
value: wits.value,
|
||||||
|
max: wits.max
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getEmpathy(token) {
|
||||||
|
const empathy = token.actor.data.data.attribute.empathy;
|
||||||
|
return {
|
||||||
|
value: empathy.value,
|
||||||
|
max: empathy.max
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getWillPower(token) {
|
||||||
|
const wp = token.actor.data.data.bio.willpower;
|
||||||
|
return {
|
||||||
|
value: wp.value,
|
||||||
|
max: wp.max
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTempHP(token) {
|
||||||
|
return 0;
|
||||||
|
const hp = token.actor.data.data.attributes.hp;
|
||||||
|
return {
|
||||||
|
value: (hp.temp == null) ? 0 : hp.temp,
|
||||||
|
max: (hp.tempmax == null) ? 0 : hp.tempmax
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getAC(token) {
|
||||||
|
|
||||||
|
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;
|
||||||
|
let initiative = token.actor.data.data.attributes.init.total;
|
||||||
|
return (initiative >= 0) ? `+${initiative}` : initiative;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleInitiative(token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPassivePerception(token) {
|
||||||
|
return 0;
|
||||||
|
return token.actor.data.data.skills.prc.passive;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPassiveInvestigation(token) {
|
||||||
|
return;
|
||||||
|
return token.actor.data.data.skills.inv.passive;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAbility(token, ability) {
|
||||||
|
if (ability == undefined) ability = 'strength';
|
||||||
|
return token.actor.data.data.attribute?.[ability].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAbilityModifier(token, ability) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAbilitySave(token, ability) {
|
||||||
|
return this.getAbility(token, ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
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}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
getProficiency(token) {
|
||||||
|
return;
|
||||||
|
const val = token.actor.data.data.attributes.prof;
|
||||||
|
return (val >= 0) ? `+${val}` : val;
|
||||||
|
}
|
||||||
|
|
||||||
|
getConditionIcon(condition) {
|
||||||
|
if (condition == undefined) condition = 'removeAll';
|
||||||
|
if (condition == 'removeAll') return window.CONFIG.controlIcons.effects;
|
||||||
|
else return CONFIG.statusEffects.find(e => e.id === condition).icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
getConditionActive(token,condition) {
|
||||||
|
if (condition == undefined) condition = 'removeAll';
|
||||||
|
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
async toggleCondition(token,condition) {
|
||||||
|
if (condition == undefined) condition = 'removeAll';
|
||||||
|
if (condition == 'removeAll'){
|
||||||
|
for( let effect of token.actor.effects)
|
||||||
|
await effect.delete();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const effect = CONFIG.statusEffects.find(e => e.id === condition);
|
||||||
|
await token.toggleEffect(effect);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roll
|
||||||
|
*/
|
||||||
|
roll(token,roll,options,ability,skill,save) {
|
||||||
|
if (roll == undefined) roll = 'ability';
|
||||||
|
if (ability == undefined) ability = '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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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: item.data.data.quantity};
|
||||||
|
return {available: item.data.data.bonus.value,
|
||||||
|
maximum: item.data.data.bonus.max};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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: item.data.data.levels};
|
||||||
|
else return {
|
||||||
|
available: item.data.data.uses.value,
|
||||||
|
maximum: item.data.data.uses.max
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spells
|
||||||
|
*/
|
||||||
|
getSpells(token,level) {
|
||||||
|
if (level == undefined) level = 'any';
|
||||||
|
const allItems = token.actor.items;
|
||||||
|
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
||||||
|
else return allItems.filter(i => i.type == 'spell' && i.data.data.level == level)
|
||||||
|
}
|
||||||
|
|
||||||
|
getSpellUses(token,level,item) {
|
||||||
|
if (level == undefined) level = 'any';
|
||||||
|
if (item.data.data.level == 0) return;
|
||||||
|
return {
|
||||||
|
available: token.actor.data.data.spells?.[`spell${level}`].value,
|
||||||
|
maximum: token.actor.data.data.spells?.[`spell${level}`].max
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rollItem(item) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import {compatibleCore} from "../misc.js";
|
import {compatibleCore} from "../misc.js";
|
||||||
|
import {otherControls} from "../../MaterialDeck.js";
|
||||||
|
|
||||||
export class pf2e{
|
export class pf2e{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -30,17 +31,23 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSpeed(token) {
|
getSpeed(token) {
|
||||||
let speed = token.actor.data.data.attributes.speed.breakdown;
|
let speed = `${token.actor.data.data.attributes.speed.total}'`;
|
||||||
const otherSpeeds = token.actor.data.data.attributes.speed.otherSpeeds;
|
const otherSpeeds = token.actor.data.data.attributes.speed.otherSpeeds;
|
||||||
if (otherSpeeds.length > 0)
|
if (otherSpeeds.length > 0)
|
||||||
for (let i=0; i<otherSpeeds.length; i++)
|
for (let os of otherSpeeds)
|
||||||
speed += `\n${otherSpeeds[i].type}: ${otherSpeeds[i].value}`;
|
speed += `\n${os.type} ${os.total}'`;
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
getInitiative(token) {
|
getInitiative(token) {
|
||||||
let initiative = token.actor.data.data.attributes.init.value;
|
let initiativeModifier = token.actor.data.data.attributes?.initiative.totalModifier;
|
||||||
return (initiative >= 0) ? `+${initiative}` : initiative;
|
let initiativeAbility = token.actor.data.data.attributes?.initiative.ability;
|
||||||
|
if (initiativeModifier > 0) {
|
||||||
|
initiativeModifier = `+${initiativeModifier}`;
|
||||||
|
} else {
|
||||||
|
initiativeModifier = this.getPerception(token); //NPCs won't have a valid Initiative value, so default to use Perception
|
||||||
|
}
|
||||||
|
return (initiativeAbility != '') ? `(${initiativeAbility}): ${initiativeModifier}` : `(perception): ${initiativeModifier}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleInitiative(token) {
|
toggleInitiative(token) {
|
||||||
@@ -55,6 +62,11 @@ export class pf2e{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPerception(token) {
|
||||||
|
let perception = token.actor.data.data.attributes?.perception.totalModifier;
|
||||||
|
return (perception >= 0) ? `+${perception}` : perception;
|
||||||
|
}
|
||||||
|
|
||||||
getAbility(token, ability) {
|
getAbility(token, ability) {
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
return token.actor.data.data.abilities?.[ability].value;
|
return token.actor.data.data.abilities?.[ability].value;
|
||||||
@@ -77,17 +89,31 @@ export class pf2e{
|
|||||||
|
|
||||||
getSkill(token, skill) {
|
getSkill(token, skill) {
|
||||||
if (skill == undefined) skill = 'acr';
|
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].name}: +${loreSkills[index].totalModifier}`;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
const val = token.actor.data.data.skills?.[skill].totalModifier;
|
const val = token.actor.data.data.skills?.[skill].totalModifier;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getLoreSkills(token) {
|
||||||
|
const skills = token.actor.data.data.skills;
|
||||||
|
return Object.keys(skills).map(key => skills[key]).filter(s => s.lore == true);
|
||||||
|
}
|
||||||
|
|
||||||
getProficiency(token) {
|
getProficiency(token) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCondition(token,condition) {
|
getCondition(token,condition) {
|
||||||
if (condition == undefined || condition == 'removeAll') return undefined;
|
if (condition == undefined || condition == 'removeAll') return undefined;
|
||||||
const Condition = condition.charAt(0).toUpperCase() + condition.slice(1);
|
const Condition = this.getConditionName(condition);
|
||||||
const effects = token.actor.items.filter(i => i.type == 'condition');
|
const effects = token.actor.items.filter(i => i.type == 'condition');
|
||||||
return effects.find(e => e.name === Condition);
|
return effects.find(e => e.name === Condition);
|
||||||
}
|
}
|
||||||
@@ -102,6 +128,41 @@ export class pf2e{
|
|||||||
return this.getCondition(token,condition) != undefined;
|
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 Condition = this.getConditionName(condition);
|
||||||
|
const newCondition = game.pf2e.ConditionManager.getCondition(Condition);
|
||||||
|
await game.pf2e.ConditionManager.addConditionToToken(newCondition, token);
|
||||||
|
}
|
||||||
|
} 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) {
|
async toggleCondition(token,condition) {
|
||||||
if (condition == undefined) condition = 'removeAll';
|
if (condition == undefined) condition = 'removeAll';
|
||||||
if (condition == 'removeAll'){
|
if (condition == 'removeAll'){
|
||||||
@@ -111,7 +172,7 @@ export class pf2e{
|
|||||||
else {
|
else {
|
||||||
const effect = this.getCondition(token,condition);
|
const effect = this.getCondition(token,condition);
|
||||||
if (effect == undefined) {
|
if (effect == undefined) {
|
||||||
const Condition = condition.charAt(0).toUpperCase() + condition.slice(1);
|
const Condition = this.getConditionName(condition);
|
||||||
const newCondition = game.pf2e.ConditionManager.getCondition(Condition);
|
const newCondition = game.pf2e.ConditionManager.getCondition(Condition);
|
||||||
newCondition.data.sources.hud = !0,
|
newCondition.data.sources.hud = !0,
|
||||||
await game.pf2e.ConditionManager.addConditionToToken(newCondition, token);
|
await game.pf2e.ConditionManager.addConditionToToken(newCondition, token);
|
||||||
@@ -127,20 +188,33 @@ export class pf2e{
|
|||||||
* Roll
|
* Roll
|
||||||
*/
|
*/
|
||||||
roll(token,roll,options,ability,skill,save) {
|
roll(token,roll,options,ability,skill,save) {
|
||||||
if (roll == undefined) roll = 'ability';
|
if (roll == undefined) roll = 'skill';
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
if (save == undefined) save = 'fort';
|
if (save == undefined) save = 'fort';
|
||||||
|
if (roll == 'perception') token.actor.data.data.attributes.perception.roll(options);
|
||||||
if (roll == 'ability') token.actor.data.data.abilities?.[ability].roll(options);
|
if (roll == 'initiative') token.actor.rollInitiative(options);
|
||||||
|
if (roll == 'ability') token.actor.rollAbility(options, ability);
|
||||||
else if (roll == 'save') {
|
else if (roll == 'save') {
|
||||||
let ability = save;
|
let ability = save;
|
||||||
if (ability == 'fort') ability = 'fortitude';
|
if (ability == 'fort') ability = 'fortitude';
|
||||||
else if (ability == 'ref') ability = 'reflex';
|
else if (ability == 'ref') ability = 'reflex';
|
||||||
else if (ability == 'will') ability = 'will';
|
else if (ability == 'will') ability = 'will';
|
||||||
token.actor.data.data.saves?.[ability].roll(options);
|
token.actor.rollSave(options, ability);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
token.actor.data.data.skills?.[skill].roll(options);
|
||||||
}
|
}
|
||||||
else if (roll == 'skill') token.actor.data.data.skills?.[skill].roll(options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,6 +224,7 @@ export class pf2e{
|
|||||||
if (itemType == undefined) itemType = 'any';
|
if (itemType == undefined) itemType = 'any';
|
||||||
const allItems = token.actor.items;
|
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 == '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);
|
else return allItems.filter(i => i.type == itemType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +238,21 @@ export class pf2e{
|
|||||||
getFeatures(token,featureType) {
|
getFeatures(token,featureType) {
|
||||||
if (featureType == undefined) featureType = 'any';
|
if (featureType == undefined) featureType = 'any';
|
||||||
const allItems = token.actor.items;
|
const allItems = token.actor.items;
|
||||||
if (featureType == 'any') return allItems.filter(i => i.type == 'class' || i.type == 'feat')
|
if (featureType == 'any') return allItems.filter(i => i.type == 'ancestry' || i.type == 'background' || i.type == 'class' || i.type == 'feat' || i.type == 'action');
|
||||||
|
if (featureType == 'action-any') return allItems.filter(i => i.type == 'action');
|
||||||
|
if (featureType == 'action-def') return allItems.filter(i => i.type == 'action' && i.data.data.actionCategory?.value == 'defensive');
|
||||||
|
if (featureType == 'action-int') return allItems.filter(i => i.type == 'action' && i.data.data.actionCategory?.value == 'interaction');
|
||||||
|
if (featureType == 'action-off') return allItems.filter(i => i.type == 'action' && i.data.data.actionCategory?.value == 'offensive');
|
||||||
|
if (featureType == 'strike') { //Strikes are not in the actor.items collection
|
||||||
|
let actions = token.actor.data.data.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)
|
else return allItems.filter(i => i.type == featureType)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,12 +268,13 @@ export class pf2e{
|
|||||||
if (level == undefined) level = 'any';
|
if (level == undefined) level = 'any';
|
||||||
const allItems = token.actor.items;
|
const allItems = token.actor.items;
|
||||||
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
||||||
else return allItems.filter(i => i.type == 'spell' && i.data.data.level.value == level)
|
if (level == '0') return allItems.filter(i => i.type == 'spell' && i.isCantrip == true)
|
||||||
|
else return allItems.filter(i => i.type == 'spell' && i.level == level && i.isCantrip == false)
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpellUses(token,level,item) {
|
getSpellUses(token,level,item) {
|
||||||
if (level == undefined) level = 'any';
|
if (level == undefined || level == 'any') level = item.level;
|
||||||
if (item.data.data.level.value == 0) return;
|
if (item.isCantrip == true) return;
|
||||||
const spellbook = token.actor.items.filter(i => i.data.type === 'spellcastingEntry')[0];
|
const spellbook = token.actor.items.filter(i => i.data.type === 'spellcastingEntry')[0];
|
||||||
if (spellbook == undefined) return;
|
if (spellbook == undefined) return;
|
||||||
return {
|
return {
|
||||||
@@ -194,6 +284,11 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
rollItem(item) {
|
rollItem(item) {
|
||||||
return item.roll()
|
let variant = 0;
|
||||||
|
if (otherControls.rollOption == 'map1') variant = 1;
|
||||||
|
if (otherControls.rollOption == 'map2') variant = 2;
|
||||||
|
if (item.type==='strike') return item.variants[variant].roll({event});
|
||||||
|
if (item.type==='weapon' || item.type==='melee') return item.parent.data.data.actions.find(a=>a.name===item.name).variants[variant].roll({event});
|
||||||
|
return game.pf2e.rollItemMacro(item.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,10 @@ import {dnd35e} from "./dnd35e.js"
|
|||||||
import {pf2e} from "./pf2e.js"
|
import {pf2e} from "./pf2e.js"
|
||||||
import {demonlord} from "./demonlord.js";
|
import {demonlord} from "./demonlord.js";
|
||||||
import {wfrp4e} from "./wfrp4e.js"
|
import {wfrp4e} from "./wfrp4e.js"
|
||||||
|
import {forbiddenlands} from "./forbidden-lands.js"
|
||||||
import {compatibleCore} from "../misc.js";
|
import {compatibleCore} from "../misc.js";
|
||||||
|
|
||||||
|
|
||||||
export class TokenHelper{
|
export class TokenHelper{
|
||||||
constructor(){
|
constructor(){
|
||||||
this.system;
|
this.system;
|
||||||
@@ -16,6 +18,7 @@ export class TokenHelper{
|
|||||||
else if (game.system.id == 'pf2e') this.system = new pf2e();
|
else if (game.system.id == 'pf2e') this.system = new pf2e();
|
||||||
else if (game.system.id == 'demonlord') this.system = new demonlord();
|
else if (game.system.id == 'demonlord') this.system = new demonlord();
|
||||||
else if (game.system.id == 'wfrp4e') this.system = new wfrp4e();
|
else if (game.system.id == 'wfrp4e') this.system = new wfrp4e();
|
||||||
|
else if (game.system.id == 'forbidden-lands') this.system = new forbiddenlands();
|
||||||
else this.system = new dnd5e(); //default to dnd5e
|
else this.system = new dnd5e(); //default to dnd5e
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +83,8 @@ export class TokenHelper{
|
|||||||
let location = token.getCenter(x,y);
|
let location = token.getCenter(x,y);
|
||||||
canvas.animatePan(location);
|
canvas.animatePan(location);
|
||||||
}
|
}
|
||||||
if (game.user.isGM == false && game.paused == true && (token.can(game.user,"control") == false || token.checkCollision(token.getCenter(x, y)))) return;
|
if (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;
|
||||||
if (compatibleCore("0.8.1")) token.document.update({x:x,y:y});
|
if (compatibleCore("0.8.1")) token.document.update({x:x,y:y});
|
||||||
else token.update({x:x,y:y});
|
else token.update({x:x,y:y});
|
||||||
};
|
};
|
||||||
@@ -221,6 +225,31 @@ export class TokenHelper{
|
|||||||
return this.system.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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conditions
|
* Conditions
|
||||||
*/
|
*/
|
||||||
@@ -236,6 +265,16 @@ export class TokenHelper{
|
|||||||
return this.system.toggleCondition(token,condition);
|
return this.system.toggleCondition(token,condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PF2E */
|
||||||
|
getConditionValue(token,condition) {
|
||||||
|
return this.system.getConditionValue(token,condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PF2E */
|
||||||
|
modifyConditionValue(token,condition,delta) {
|
||||||
|
return this.system.modifyConditionValue(token,condition,delta);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Roll
|
* Roll
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export class wfrp4e {
|
|||||||
|
|
||||||
|
|
||||||
getItemUses(item) {
|
getItemUses(item) {
|
||||||
console.log("getItemUses(" , item , ")")
|
//console.log("getItemUses(" , item , ")")
|
||||||
if ( item.type == 'ammunition') {
|
if ( item.type == 'ammunition') {
|
||||||
return {available: item.data.data.quantity.value};
|
return {available: item.data.data.quantity.value};
|
||||||
}
|
}
|
||||||
|
|||||||
88
src/token.js
@@ -1,5 +1,6 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import * as MODULE from "../MaterialDeck.js";
|
||||||
import {streamDeck, macroControl, otherControls, tokenHelper} from "../MaterialDeck.js";
|
import {streamDeck, macroControl, otherControls, tokenHelper} from "../MaterialDeck.js";
|
||||||
|
import { compatibleCore } from "./misc.js";
|
||||||
|
|
||||||
export class TokenControl{
|
export class TokenControl{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -106,6 +107,59 @@ export class TokenControl{
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stats == 'Agility') { /* forbidden-lands */
|
||||||
|
const wits = tokenHelper.getAgility(token);
|
||||||
|
txt += wits.value + "/" + wits.max;
|
||||||
|
|
||||||
|
if (icon == 'stats')
|
||||||
|
uses = {
|
||||||
|
available: wits.value,
|
||||||
|
maximum: wits.max,
|
||||||
|
heart: "#FF0000"
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats == 'Wits') { /* forbidden-lands */
|
||||||
|
const wits = tokenHelper.getWits(token);
|
||||||
|
txt += wits.value + "/" + wits.max;
|
||||||
|
|
||||||
|
if (icon == 'stats')
|
||||||
|
uses = {
|
||||||
|
available: wits.value,
|
||||||
|
maximum: wits.max,
|
||||||
|
heart: "#FF0000"
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats == 'Empathy') { /* forbidden-lands */
|
||||||
|
const wits = tokenHelper.getEmpathy(token);
|
||||||
|
txt += wits.value + "/" + wits.max;
|
||||||
|
|
||||||
|
if (icon == 'stats')
|
||||||
|
uses = {
|
||||||
|
available: wits.value,
|
||||||
|
maximum: wits.max,
|
||||||
|
heart: "#FF0000"
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats == 'WillPower') { /* forbidden-lands */
|
||||||
|
const wits = tokenHelper.getWillPower(token);
|
||||||
|
txt += wits.value + "/" + wits.max;
|
||||||
|
|
||||||
|
if (icon == 'stats')
|
||||||
|
uses = {
|
||||||
|
available: wits.value,
|
||||||
|
maximum: wits.max,
|
||||||
|
heart: "#FF0000"
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (stats == 'CriticalWounds') { /* WFRP4e */
|
if (stats == 'CriticalWounds') { /* WFRP4e */
|
||||||
const criticalWounds = tokenHelper.getCriticalWounds(token);
|
const criticalWounds = tokenHelper.getCriticalWounds(token);
|
||||||
txt += criticalWounds.value + "/" + criticalWounds.max;
|
txt += criticalWounds.value + "/" + criticalWounds.max;
|
||||||
@@ -153,7 +207,13 @@ export class TokenControl{
|
|||||||
else if (stats == 'Advantage') txt += tokenHelper.getAdvantage(token) /* WFRP4e */
|
else if (stats == 'Advantage') txt += tokenHelper.getAdvantage(token) /* WFRP4e */
|
||||||
else if (stats == 'Resolve') txt += tokenHelper.getResolve(token) /* WFRP4e */
|
else if (stats == 'Resolve') txt += tokenHelper.getResolve(token) /* WFRP4e */
|
||||||
else if (stats == 'Resilience') txt += tokenHelper.getResilience(token) /* WFRP4e */
|
else if (stats == 'Resilience') txt += tokenHelper.getResilience(token) /* WFRP4e */
|
||||||
|
else if (stats == 'Perception') txt += tokenHelper.getPerception(token) /* PF2E */
|
||||||
|
else if (stats == 'Condition') { /* PF2E */
|
||||||
|
const valuedCondition = tokenHelper.getConditionValue(token, settings.condition);
|
||||||
|
if (valuedCondition != undefined) {
|
||||||
|
txt += valuedCondition?.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.onClick == 'visibility') { //toggle visibility
|
if (settings.onClick == 'visibility') { //toggle visibility
|
||||||
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) {
|
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) {
|
||||||
@@ -195,7 +255,7 @@ export class TokenControl{
|
|||||||
iconSrc = "fas fa-bullseye";
|
iconSrc = "fas fa-bullseye";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'condition') { //toggle condition
|
else if (settings.onClick == 'condition') { //handle condition
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) {
|
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
@@ -502,11 +562,24 @@ export class TokenControl{
|
|||||||
else if (onClick == 'target') { //Target token
|
else if (onClick == 'target') { //Target token
|
||||||
token.setTarget(!token.isTargeted,{releaseOthers:false});
|
token.setTarget(!token.isTargeted,{releaseOthers:false});
|
||||||
}
|
}
|
||||||
else if (onClick == 'condition') { //Toggle condition
|
else if (onClick == 'condition') { //Handle condition
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) return;
|
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) return;
|
||||||
|
const func = settings.conditionFunction ? settings.conditionFunction : 'toggle';
|
||||||
|
|
||||||
|
if (func == 'toggle'){ //toggle
|
||||||
await tokenHelper.toggleCondition(token,settings.condition);
|
await tokenHelper.toggleCondition(token,settings.condition);
|
||||||
this.update(tokenId);
|
this.update(tokenId);
|
||||||
}
|
}
|
||||||
|
else if (func == 'increase'){ //increase
|
||||||
|
await tokenHelper.modifyConditionValue(token, settings.condition, +1)
|
||||||
|
this.update(tokenId);
|
||||||
|
}
|
||||||
|
else if (func == 'decrease'){ //decrease
|
||||||
|
await tokenHelper.modifyConditionValue(token, settings.condition, -1)
|
||||||
|
this.update(tokenId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else if (onClick == 'cubCondition') { //Combat Utility Belt conditions
|
else if (onClick == 'cubCondition') { //Combat Utility Belt conditions
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) return;
|
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) return;
|
||||||
const condition = settings.cubConditionName;
|
const condition = settings.cubConditionName;
|
||||||
@@ -553,7 +626,8 @@ export class TokenControl{
|
|||||||
animation.speed = animationSpeed;
|
animation.speed = animationSpeed;
|
||||||
}
|
}
|
||||||
data.lightAnimation = animation;
|
data.lightAnimation = animation;
|
||||||
token.update(data);
|
if (compatibleCore('0.8.1')) token.document.update(data);
|
||||||
|
else token.update(data);
|
||||||
}
|
}
|
||||||
else if (onClick == 'initiative'){
|
else if (onClick == 'initiative'){
|
||||||
tokenHelper.toggleInitiative(token);
|
tokenHelper.toggleInitiative(token);
|
||||||
@@ -591,7 +665,8 @@ export class TokenControl{
|
|||||||
else return;
|
else return;
|
||||||
|
|
||||||
iconSrc = images[imgNr];
|
iconSrc = images[imgNr];
|
||||||
token.update({img: iconSrc})
|
if (compatibleCore('0.8.1')) token.document.update({img: iconSrc});
|
||||||
|
else token.update({img: iconSrc})
|
||||||
}
|
}
|
||||||
else if (onClick == 'macro') { //call a macro
|
else if (onClick == 'macro') { //call a macro
|
||||||
const settingsNew = {
|
const settingsNew = {
|
||||||
@@ -734,7 +809,8 @@ export class TokenControl{
|
|||||||
if (path != '') path += '.';
|
if (path != '') path += '.';
|
||||||
path += targetArray[i][j];
|
path += targetArray[i][j];
|
||||||
}
|
}
|
||||||
await token.update({[path]:value})
|
if (compatibleCore('0.8.1')) await token.document.update({[path]:value});
|
||||||
|
else await token.update({[path]:value})
|
||||||
this.update(token.id);
|
this.update(token.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
41
templates/deviceConfig.html
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<form autocomplete="off" onsubmit="event.preventDefault()">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.columnLabel {
|
||||||
|
max-width:30%;
|
||||||
|
min-width:30%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.columnId {
|
||||||
|
max-width:25%;
|
||||||
|
min-width:25%;
|
||||||
|
text-align: left;
|
||||||
|
text-overflow: hidden;
|
||||||
|
}
|
||||||
|
.columnCB {
|
||||||
|
width:10%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<table style="width:100%; min-width:400px">
|
||||||
|
<tr>
|
||||||
|
<th class='columnLabel'>{{localize "MaterialDeck.Name"}}</th>
|
||||||
|
<th class='columnLabel'>{{localize "MaterialDeck.Type"}}</th>
|
||||||
|
<th class='columnId'>{{localize "MaterialDeck.Id"}}</th>
|
||||||
|
<th class='columnCB'>{{localize "MaterialDeck.Perm.ENABLE.ENABLE.label"}}</th>
|
||||||
|
</tr>
|
||||||
|
{{#each devices as |d|}}
|
||||||
|
<tr>
|
||||||
|
<td class='columnLabel'>{{d.name}}</td>
|
||||||
|
<td class='columnLabel'>{{d.type}}</td>
|
||||||
|
<td class='columnId'><input type="text" value={{d.id}} disabled></td>
|
||||||
|
<td class='columnCB'><input type="checkbox" name="enable" id={{d.id}} {{checked d.en}}></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||