Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b07f0a6454 | ||
|
|
631fdbcccb | ||
|
|
9a7088a310 | ||
|
|
033a7351e4 | ||
|
|
be7f837f7d | ||
|
|
79cfc5769a | ||
|
|
fc7dcff3b0 | ||
|
|
abb883c8b8 | ||
|
|
8cf974455a | ||
|
|
e7e9b84227 | ||
|
|
108c955ac2 | ||
|
|
4d320a5f6c | ||
|
|
ccacd3e26e | ||
|
|
d3c2c6465d | ||
|
|
bc0804bc08 | ||
|
|
49bc188dde | ||
|
|
dce419d7c3 | ||
|
|
4566b8ef53 | ||
|
|
1f55b324c5 | ||
|
|
a6a6cd170e | ||
|
|
cc8588bf4d | ||
|
|
117a1fb59d | ||
|
|
888a2971fb | ||
|
|
c74d27610a | ||
|
|
f4d02cf296 |
45
.github/workflows/main.yml
vendored
Normal 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 }}
|
||||||
@@ -7,7 +7,7 @@ In addition to this repo, you will also need to check out the [MaterialDeck_SD g
|
|||||||
|
|
||||||
### Make a new system.js file
|
### Make a new system.js file
|
||||||
|
|
||||||
In the [src/systems](src/systems) directory, create a new system file by copying and pasting a similar system to it; for example, `cp demonlord.js wfrp4.js`
|
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.
|
You then need to go through all the functions in there and make sure that the correct data is set.
|
||||||
|
|
||||||
### Update TokenHelper
|
### Update TokenHelper
|
||||||
|
|||||||
277
MaterialDeck.js
@@ -1,15 +1,16 @@
|
|||||||
import { registerSettings } from "./src/settings.js";
|
import { registerSettings } from "./src/settings.js";
|
||||||
import { StreamDeck } from "./src/streamDeck.js";
|
import { StreamDeck } from "./src/streamDeck.js";
|
||||||
import {TokenControl} from "./src/token.js";
|
import { TokenControl } from "./src/actions/token.js";
|
||||||
import {MacroControl} from "./src/macro.js";
|
import { MacroControl } from "./src/actions/macro.js";
|
||||||
import {CombatTracker} from "./src/combattracker.js";
|
import { CombatTracker } from "./src/actions/combattracker.js";
|
||||||
import {PlaylistControl} from "./src/playlist.js";
|
import { PlaylistControl } from "./src/actions/playlist.js";
|
||||||
import {SoundboardControl} from "./src/soundboard.js";
|
import { SoundboardControl } from "./src/actions/soundboard.js";
|
||||||
import {OtherControls} from "./src/othercontrols.js";
|
import { OtherControls } from "./src/actions/othercontrols.js";
|
||||||
import {ExternalModules} from "./src/external.js";
|
import { ExternalModules } from "./src/actions/external.js";
|
||||||
import {SceneControl} from "./src/scene.js";
|
import { SceneControl } from "./src/actions/scene.js";
|
||||||
import {downloadUtility, compatibleCore} from "./src/misc.js";
|
import { downloadUtility, compareVersions, compatibleCore } from "./src/misc.js";
|
||||||
import { TokenHelper } from "./src/systems/tokenHelper.js";
|
import { TokenHelper } from "./src/systems/tokenHelper.js";
|
||||||
|
|
||||||
export var streamDeck;
|
export var streamDeck;
|
||||||
export var tokenControl;
|
export var tokenControl;
|
||||||
export var macroControl;
|
export var macroControl;
|
||||||
@@ -20,27 +21,19 @@ export var otherControls;
|
|||||||
export var externalModules;
|
export var externalModules;
|
||||||
export var sceneControl;
|
export var sceneControl;
|
||||||
export var tokenHelper;
|
export var tokenHelper;
|
||||||
|
|
||||||
export const moduleName = "MaterialDeck";
|
export const moduleName = "MaterialDeck";
|
||||||
|
export let gamingSystem = "dnd5e";
|
||||||
let ready = false;
|
|
||||||
|
|
||||||
export let hotbarUses = false;
|
export let hotbarUses = false;
|
||||||
export let calculateHotbarUses;
|
export let calculateHotbarUses;
|
||||||
|
|
||||||
let controlTokenTimer;
|
|
||||||
|
|
||||||
export let sdVersion;
|
export let sdVersion;
|
||||||
export let msVersion;
|
export let msVersion;
|
||||||
|
|
||||||
|
let ready = false;
|
||||||
|
let controlTokenTimer;
|
||||||
let updateDialog;
|
let updateDialog;
|
||||||
|
export let minimumMSversion;
|
||||||
|
export let minimumSDversion;
|
||||||
|
|
||||||
//CONFIG.debug.hooks = true;
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Global variables
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
export var enableModule;
|
export var enableModule;
|
||||||
|
|
||||||
//Websocket variables
|
//Websocket variables
|
||||||
@@ -49,7 +42,8 @@ let wsOpen = false; //Bool for checking if websocket has ever been o
|
|||||||
let wsInterval; //Interval timer to detect disconnections
|
let wsInterval; //Interval timer to detect disconnections
|
||||||
let WSconnected = false;
|
let WSconnected = false;
|
||||||
|
|
||||||
//let furnace = game.modules.get("furnace");
|
|
||||||
|
//CONFIG.debug.hooks = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Analyzes the message received
|
* Analyzes the message received
|
||||||
@@ -61,37 +55,37 @@ async function analyzeWSmessage(msg){
|
|||||||
const data = JSON.parse(msg);
|
const data = JSON.parse(msg);
|
||||||
//console.log("Received",data);
|
//console.log("Received",data);
|
||||||
|
|
||||||
if (data.type == "connected" && data.data == "SD"){
|
if ((data.type == "connected" || data.type == "version") && data.data == "SD"){
|
||||||
const msg = {
|
transmitInitData();
|
||||||
target: "SD",
|
let sdNok = false;
|
||||||
type: "init",
|
let msNok = false;
|
||||||
system: game.system.id
|
if (data.MSversion) {
|
||||||
|
msVersion = data.MSversion;
|
||||||
|
if (!compareVersions(minimumMSversion,msVersion)) {
|
||||||
|
msNok = true;
|
||||||
}
|
}
|
||||||
ws.send(JSON.stringify(msg));
|
|
||||||
|
|
||||||
|
|
||||||
console.log("streamdeck connected to server");
|
|
||||||
streamDeck.resetImageBuffer();
|
|
||||||
}
|
}
|
||||||
|
if (data.SDversion) {
|
||||||
if (data.type == "version" && data.source == "SD") {
|
sdVersion = data.SDversion;
|
||||||
let minimumSDversion;
|
if (!compareVersions(minimumSDversion,sdVersion)) {
|
||||||
let minimumMSversion;
|
sdNok = true;
|
||||||
if (compatibleCore("0.8.5")) {
|
|
||||||
minimumSDversion = game.modules.get("MaterialDeck").data.flags.minimumSDversion.replace('v','');
|
|
||||||
minimumMSversion = game.modules.get("MaterialDeck").data.flags.minimumMSversion;
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
minimumSDversion = game.modules.get("MaterialDeck").data.minimumSDversion.replace('v','');
|
|
||||||
minimumMSversion = game.modules.get("MaterialDeck").data.minimumMSversion;
|
|
||||||
}
|
}
|
||||||
|
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>`;
|
||||||
|
|
||||||
sdVersion = data.version;
|
content += `${game.i18n.localize("MaterialDeck.UpdateRequired.Update")}<br><br>`;
|
||||||
|
|
||||||
if (data.version < minimumSDversion && updateDialog == undefined) {
|
if (sdNok) content += `<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">${game.i18n.localize("MaterialDeck.UpdateRequired.SDdownload")}</a><br>`;
|
||||||
updateDialog = new Dialog({
|
if (msNok) content += `<a href="https://github.com/CDeenen/MaterialServer/releases">Material Server</a><br>`;
|
||||||
title: "Material Deck: Update Needed",
|
content += "<br>"
|
||||||
content: "<p>The Stream Deck plugin version you're using is v" + data.version + ", which is incompatible with this verion of the module.<br>Update to v" + minimumSDversion + " or newer.</p>",
|
|
||||||
|
const myDialog = new Dialog({
|
||||||
|
title: game.i18n.localize("MaterialDeck.UpdateRequired.Title"),
|
||||||
|
content,
|
||||||
buttons: {
|
buttons: {
|
||||||
download: {
|
download: {
|
||||||
icon: '<i class="fas fa-download"></i>',
|
icon: '<i class="fas fa-download"></i>',
|
||||||
@@ -104,20 +98,27 @@ async function analyzeWSmessage(msg){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
default: "download"
|
default: "download"
|
||||||
});
|
}).render(true);
|
||||||
updateDialog.render(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("streamdeck connected to server", msVersion);
|
||||||
|
streamDeck.resetImageBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 +126,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 +156,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 +177,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);
|
||||||
}
|
}
|
||||||
@@ -208,12 +215,7 @@ function startWebsocket() {
|
|||||||
module: "MD"
|
module: "MD"
|
||||||
}
|
}
|
||||||
ws.send(JSON.stringify(msg));
|
ws.send(JSON.stringify(msg));
|
||||||
const msg2 = {
|
transmitInitData();
|
||||||
target: "SD",
|
|
||||||
type: "init",
|
|
||||||
system: game.system.id
|
|
||||||
}
|
|
||||||
ws.send(JSON.stringify(msg2));
|
|
||||||
clearInterval(wsInterval);
|
clearInterval(wsInterval);
|
||||||
wsInterval = setInterval(resetWS, 5000);
|
wsInterval = setInterval(resetWS, 5000);
|
||||||
}
|
}
|
||||||
@@ -222,6 +224,33 @@ function startWebsocket() {
|
|||||||
wsInterval = setInterval(resetWS, 10000);
|
wsInterval = setInterval(resetWS, 10000);
|
||||||
}
|
}
|
||||||
let messageCount = 0;
|
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
|
* Try to reset the websocket if a connection is lost
|
||||||
*/
|
*/
|
||||||
@@ -265,21 +294,58 @@ export function getPermission(action,func) {
|
|||||||
else return settings.permissions?.[action]?.[func]?.[role];
|
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
|
// 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
|
* Ready hook
|
||||||
* Attempt to open the websocket
|
* Attempt to open the websocket
|
||||||
*/
|
*/
|
||||||
Hooks.once('ready', async()=>{
|
Hooks.once('ready', async()=>{
|
||||||
registerSettings();
|
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;
|
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();
|
soundboard = new SoundboardControl();
|
||||||
streamDeck = new StreamDeck();
|
streamDeck = new StreamDeck();
|
||||||
tokenControl = new TokenControl();
|
tokenControl = new TokenControl();
|
||||||
@@ -380,32 +446,47 @@ Hooks.once('ready', async()=>{
|
|||||||
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;
|
if (enableModule == false || ready == false) return;
|
||||||
let tokenId = token._id;
|
let tokenId = changes._id;
|
||||||
if (tokenId == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
if (tokenId == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||||
if (macroControl != undefined) macroControl.updateAll();
|
if (macroControl != undefined) macroControl.updateAll();
|
||||||
|
if (changes.hidden != undefined && combatTracker != undefined) combatTracker.updateAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on('updateActor',(actor)=>{
|
Hooks.on('updateActor',(actor)=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
let children = canvas.tokens.children[0].children;
|
updateActor(actor.id);
|
||||||
for (let i=0; i<children.length; i++){
|
|
||||||
if (children[i].actor.id == actor._id){
|
|
||||||
let tokenId = children[i].id;
|
|
||||||
if (tokenId == canvas.tokens.controlled[0]?.id) {
|
|
||||||
tokenControl.update(canvas.tokens.controlled[0]?.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (macroControl != undefined) macroControl.updateAll();
|
if (macroControl != undefined) macroControl.updateAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Hooks.on('createActiveEffect',(data)=>{
|
||||||
|
if (enableModule == false || ready == false) return;
|
||||||
|
updateActor(data.parent.id);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
Hooks.on('deleteActiveEffect',(data)=>{
|
||||||
|
if (enableModule == false || ready == false) return;
|
||||||
|
updateActor(data.parent.id);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
Hooks.on('onActorSetCondition',(data)=>{
|
||||||
|
if (enableModule == false || ready == false) return;
|
||||||
|
updateActor(data.actor.id);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
Hooks.on('controlToken',(token,controlled)=>{
|
Hooks.on('controlToken',(token,controlled)=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
if (controlled) {
|
if (controlled) {
|
||||||
tokenControl.update(token.data._id);
|
tokenControl.update(token.id);
|
||||||
if (controlTokenTimer != undefined) {
|
if (controlTokenTimer != undefined) {
|
||||||
clearTimeout(controlTokenTimer);
|
clearTimeout(controlTokenTimer);
|
||||||
controlTokenTimer = undefined;
|
controlTokenTimer = undefined;
|
||||||
@@ -429,14 +510,14 @@ Hooks.on('renderHotbar', (hotbar)=>{
|
|||||||
|
|
||||||
Hooks.on('render', (app)=>{
|
Hooks.on('render', (app)=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
if (compatibleCore("0.8.1") == false) return;
|
|
||||||
if (app.id == "hotbar" && macroControl != undefined) macroControl.hotbar(app.macros);
|
if (app.id == "hotbar" && macroControl != undefined) macroControl.hotbar(app.macros);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on('renderCombatTracker',()=>{
|
Hooks.on('renderCombatTracker',()=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
if (combatTracker != undefined) combatTracker.updateAll();
|
if (combatTracker != undefined) {
|
||||||
|
combatTracker.updateAll();
|
||||||
|
}
|
||||||
if (tokenControl != undefined) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
if (tokenControl != undefined) tokenControl.update(canvas.tokens.controlled[0]?.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -456,6 +537,16 @@ Hooks.on('closeplaylistConfigForm', (form)=>{
|
|||||||
playlistControl.updateAll();
|
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',()=>{
|
Hooks.on('pauseGame',()=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
otherControls.updateAll();
|
otherControls.updateAll();
|
||||||
@@ -562,19 +653,25 @@ Hooks.on('NotYourTurn', ()=>{
|
|||||||
externalModules.updateAll();
|
externalModules.updateAll();
|
||||||
})
|
})
|
||||||
|
|
||||||
Hooks.on('pseudoclockSet', ()=>{
|
Hooks.on('simple-calendar-date-time-change', ()=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
externalModules.updateAll();
|
externalModules.updateAll();
|
||||||
})
|
})
|
||||||
|
|
||||||
Hooks.on('about-time.clockRunningStatus', ()=>{
|
Hooks.on('simple-calendar-clock-start-stop', ()=>{
|
||||||
if (enableModule == false || ready == false) return;
|
if (enableModule == false || ready == false) return;
|
||||||
externalModules.updateAll();
|
externalModules.updateAll();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Hooks.on('updateTile',()=>{
|
||||||
|
if (enableModule == false || ready == false) return;
|
||||||
|
externalModules.updateAll();
|
||||||
|
});
|
||||||
|
|
||||||
Hooks.once('init', ()=>{
|
Hooks.once('init', ()=>{
|
||||||
//CONFIG.debug.hooks = true;
|
//CONFIG.debug.hooks = true;
|
||||||
//registerSettings(); //in ./src/settings.js
|
//registerSettings(); //in ./src/settings.js
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.once('canvasReady',()=>{
|
Hooks.once('canvasReady',()=>{
|
||||||
@@ -584,3 +681,27 @@ Hooks.once('canvasReady',()=>{
|
|||||||
Hooks.on("soundscape", (data) => {
|
Hooks.on("soundscape", (data) => {
|
||||||
externalModules.newSoundscapeData(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();
|
||||||
|
})
|
||||||
@@ -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> v10 - v11<br>
|
||||||
<b>Module Incompatibilities:</b> None known.<br>
|
<b>Module Incompatibilities:</b> None known.<br>
|
||||||
|
|
||||||
## Developer Guide
|
## Developer Guide
|
||||||
|
|||||||
148
changelog.md
@@ -1,4 +1,152 @@
|
|||||||
# Changelog Material Deck Module
|
# Changelog Material Deck Module
|
||||||
|
### v1.5.0 - 28-05-2023
|
||||||
|
Additions:
|
||||||
|
<ul>
|
||||||
|
<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>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
|
### v1.4.6 - 07-09-2021
|
||||||
Fixes:
|
Fixes:
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
175
css/style.css
Normal 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;
|
||||||
|
}
|
||||||
BIN
img/.thumb/MaterialFoundry2560x1440.jpg.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
img/.thumb/down.png.jpg
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
img/.thumb/right.png.jpg
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
img/MaterialFoundry2560x1440.jpg
Normal file
|
After Width: | Height: | Size: 483 KiB |
BIN
img/down.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
img/right.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
BIN
img/token/skills/.thumb/lor.png.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
@@ -10,6 +10,7 @@ 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
|
||||||
|
lor.png: https://game-icons.net/1x1/lorc/bookmarklet.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
|
occ.png: https://game-icons.net/1x1/skoll/pentacle.html
|
||||||
|
|||||||
BIN
img/token/skills/lor.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
39
lang/en.json
@@ -6,9 +6,23 @@
|
|||||||
"MaterialDeck.Notifications.Macroboard.NoPermission": "You do not have permission to configure the macroboard",
|
"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.Notifications.Playlist.NoPermission": "You do not have permission to configure the playlists",
|
||||||
|
|
||||||
"MaterialDeck.Sett.Enable": "Enable module",
|
"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 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.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",
|
||||||
@@ -20,6 +34,8 @@
|
|||||||
"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.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.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.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.Unrestricted": "Unrestricted",
|
||||||
"MaterialDeck.PL.OneTrackPlaylist": "One track per playlist",
|
"MaterialDeck.PL.OneTrackPlaylist": "One track per playlist",
|
||||||
@@ -32,7 +48,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 +74,9 @@
|
|||||||
"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.Label": "Label",
|
||||||
|
|
||||||
"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.",
|
||||||
@@ -184,23 +203,25 @@
|
|||||||
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "Observer",
|
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "Observer",
|
||||||
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "Allow users access to tokens with observer permission",
|
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "Allow users access to tokens with observer permission",
|
||||||
|
|
||||||
"MaterialDeck.AboutTime.First": "st",
|
"MaterialDeck.SimpleCalendar.First": "st",
|
||||||
"MaterialDeck.AboutTime.Second": "nd",
|
"MaterialDeck.SimpleCalendar.Second": "nd",
|
||||||
"MaterialDeck.AboutTime.Third": "rd",
|
"MaterialDeck.SimpleCalendar.Third": "rd",
|
||||||
"MaterialDeck.AboutTime.Fourth": "th",
|
"MaterialDeck.SimpleCalendar.Fourth": "th",
|
||||||
"MaterialDeck.AboutTime.Of": "of",
|
"MaterialDeck.SimpleCalendar.Of": "of",
|
||||||
|
|
||||||
"MaterialDeck.DownloadUtility.Title": "Download Utility",
|
"MaterialDeck.DownloadUtility.Title": "Download Utility",
|
||||||
"MaterialDeck.DownloadUtility.Plugin": "Plugin & Material Server",
|
"MaterialDeck.DownloadUtility.Plugin": "Module, Stream Deck Plugin & Material Server",
|
||||||
"MaterialDeck.DownloadUtility.Minimum": "Minimum",
|
"MaterialDeck.DownloadUtility.Minimum": "Minimum",
|
||||||
"MaterialDeck.DownloadUtility.Current": "Current",
|
"MaterialDeck.DownloadUtility.Current": "Current",
|
||||||
"MaterialDeck.DownloadUtility.Latest": "Latest",
|
"MaterialDeck.DownloadUtility.Latest": "Latest",
|
||||||
"MaterialDeck.DownloadUtility.OS": "OS",
|
"MaterialDeck.DownloadUtility.OS": "OS",
|
||||||
"MaterialDeck.DownloadUtility.Download": "Download",
|
"MaterialDeck.DownloadUtility.Download": "Download",
|
||||||
|
"MaterialDeck.DownloadUtility.module": "Module",
|
||||||
"MaterialDeck.DownloadUtility.SDplugin": "SD Plugin",
|
"MaterialDeck.DownloadUtility.SDplugin": "SD Plugin",
|
||||||
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
||||||
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
||||||
"MaterialDeck.DownloadUtility.Macos": "MacOS",
|
"MaterialDeck.DownloadUtility.MacosM1": "MacOS (M1)",
|
||||||
|
"MaterialDeck.DownloadUtility.MacosIntel": "MacOS (Intel)",
|
||||||
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
||||||
"MaterialDeck.DownloadUtility.Source": "Source",
|
"MaterialDeck.DownloadUtility.Source": "Source",
|
||||||
"MaterialDeck.DownloadUtility.Profiles": "Profiles",
|
"MaterialDeck.DownloadUtility.Profiles": "Profiles",
|
||||||
|
|||||||
13
lang/ja.json
@@ -184,11 +184,11 @@
|
|||||||
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "オブザーバー",
|
"MaterialDeck.Perm.TOKEN.OBSERVER.label": "オブザーバー",
|
||||||
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "オブザーバー権限を持つトークンへのユーザーアクセスを許可する",
|
"MaterialDeck.Perm.TOKEN.OBSERVER.hint": "オブザーバー権限を持つトークンへのユーザーアクセスを許可する",
|
||||||
|
|
||||||
"MaterialDeck.AboutTime.First": "1",
|
"MaterialDeck.SimpleCalendar.First": "1",
|
||||||
"MaterialDeck.AboutTime.Second": "2",
|
"MaterialDeck.SimpleCalendar.Second": "2",
|
||||||
"MaterialDeck.AboutTime.Third": "3",
|
"MaterialDeck.SimpleCalendar.Third": "3",
|
||||||
"MaterialDeck.AboutTime.Fourth": "4",
|
"MaterialDeck.SimpleCalendar.Fourth": "4",
|
||||||
"MaterialDeck.AboutTime.Of": "/",
|
"MaterialDeck.SimpleCalendar.Of": "/",
|
||||||
|
|
||||||
"MaterialDeck.DownloadUtility.Title": "ダウンロード・ユーティリティ",
|
"MaterialDeck.DownloadUtility.Title": "ダウンロード・ユーティリティ",
|
||||||
"MaterialDeck.DownloadUtility.Plugin": "プラグイン&Material Server",
|
"MaterialDeck.DownloadUtility.Plugin": "プラグイン&Material Server",
|
||||||
@@ -200,7 +200,8 @@
|
|||||||
"MaterialDeck.DownloadUtility.SDplugin": "SDプラグイン",
|
"MaterialDeck.DownloadUtility.SDplugin": "SDプラグイン",
|
||||||
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
"MaterialDeck.DownloadUtility.MSserver": "Material Server",
|
||||||
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
"MaterialDeck.DownloadUtility.Windows": "Windows",
|
||||||
"MaterialDeck.DownloadUtility.Macos": "MacOS",
|
"MaterialDeck.DownloadUtility.MacosM1": "MacOS (M1)",
|
||||||
|
"MaterialDeck.DownloadUtility.MacosIntel": "MacOS (Intel)",
|
||||||
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
"MaterialDeck.DownloadUtility.Linux": "Linux",
|
||||||
"MaterialDeck.DownloadUtility.Source": "ソース",
|
"MaterialDeck.DownloadUtility.Source": "ソース",
|
||||||
"MaterialDeck.DownloadUtility.Profiles": "プロファイル",
|
"MaterialDeck.DownloadUtility.Profiles": "プロファイル",
|
||||||
|
|||||||
36
module.json
@@ -1,28 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "MaterialDeck",
|
"name": "MaterialDeck",
|
||||||
|
"id": "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.6",
|
"version": "1.5.0",
|
||||||
"author": "CDeenen",
|
"author": "CDeenen",
|
||||||
"authors": {
|
"authors": [
|
||||||
|
{
|
||||||
"name": "CDeenen",
|
"name": "CDeenen",
|
||||||
"email": "cdeenen@outlook.com",
|
"email": "cdeenen@outlook.com",
|
||||||
"discord": "Cris#6864",
|
"discord": "Cris#6864",
|
||||||
"patreon": "MaterialFoundry",
|
"patreon": "MaterialFoundry",
|
||||||
"reddit": "CDeenen123"
|
"reddit": "CDeenen123"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"esmodules": ["./MaterialDeck.js"],
|
||||||
|
"styles": ["./css/style.css"],
|
||||||
|
"socket": true,
|
||||||
|
"minimumCoreVersion": "10",
|
||||||
|
"compatibleCoreVersion": "11",
|
||||||
|
"compatibility": {
|
||||||
|
"minimum": "10",
|
||||||
|
"verified": "11"
|
||||||
},
|
},
|
||||||
"flags": {
|
"flags": {
|
||||||
"minimumSDversion": "1.4.4",
|
"minimumMSVersion": "1.1.0",
|
||||||
"minimumMSversion": "1.0.2"
|
"minimumPluginVersion": "1.5.0"
|
||||||
},
|
},
|
||||||
"minimumSDversion": "1.4.4",
|
|
||||||
"minimumMSversion": "1.0.2",
|
|
||||||
"esmodules": [
|
|
||||||
"./MaterialDeck.js"
|
|
||||||
],
|
|
||||||
"socket": true,
|
|
||||||
"minimumCoreVersion": "0.7.5",
|
|
||||||
"compatibleCoreVersion": "0.8.9",
|
|
||||||
"languages": [
|
"languages": [
|
||||||
{
|
{
|
||||||
"lang": "en",
|
"lang": "en",
|
||||||
@@ -38,7 +42,13 @@
|
|||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
"type": "icon",
|
"type": "icon",
|
||||||
"url": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/img/MaterialFoundry512x512.png"
|
"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",
|
"manifestPlusVersion": "1.1.0",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { streamDeck, tokenControl, getPermission } from "../../MaterialDeck.js";
|
||||||
import {streamDeck, tokenControl} from "../MaterialDeck.js";
|
import { } from "../misc.js";
|
||||||
import {compatibleCore} from "./misc.js";
|
|
||||||
|
|
||||||
export class CombatTracker{
|
export class CombatTracker{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -20,69 +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){
|
update(settings,context,device){
|
||||||
this.active = true;
|
this.active = true;
|
||||||
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
|
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
|
||||||
const mode = settings.combatTrackerMode ? settings.combatTrackerMode : 'combatants';
|
const mode = settings.combatTrackerMode ? settings.combatTrackerMode : 'combatants';
|
||||||
|
settings.combatTrackerMode = mode;
|
||||||
const combat = game.combat;
|
const combat = game.combat;
|
||||||
let src = "modules/MaterialDeck/img/black.png";
|
let src = "modules/MaterialDeck/img/black.png";
|
||||||
let txt = "";
|
let txt = "";
|
||||||
let background = "#000000";
|
let background = "#000000";
|
||||||
settings.combat = true;
|
settings.combat = true;
|
||||||
settings.icon = settings.displayIcon ? 'tokenIcon' : 'none';
|
settings.icon = settings.displayIcon ? 'tokenIcon' : 'none';
|
||||||
|
|
||||||
if (mode == 'combatants'){
|
if (mode == 'combatants'){
|
||||||
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
if (getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
||||||
streamDeck.noPermission(context,device,device,false,"combat tracker");
|
streamDeck.noPermission(context,device,device,false,"combat tracker");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (combat != null && combat != undefined && combat.turns.length != 0){
|
if (combat != null && combat != undefined && combat.turns.length != 0){
|
||||||
const initiativeOrder = combat.turns;
|
let initiativeOrder = combat.turns;
|
||||||
let nr = settings.combatantNr - 1;
|
const dispositionMode = settings.dispositionMode ? settings.dispositionMode : 'remove';
|
||||||
if (nr == undefined || nr < 1) nr = 0;
|
if (dispositionMode == 'remove' && settings.dispositionFilter == 'friendly') initiativeOrder = initiativeOrder.filter(c => c.token.disposition == 1);
|
||||||
const combatantState = (nr == combat.turn) ? 2 : 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 combatant = initiativeOrder[nr]
|
||||||
|
const combatantState = (combatant?.token.id == combat.current.tokenId) ? 2 : 1;
|
||||||
if (combatant != undefined){
|
if (combatant != undefined){
|
||||||
const tokenId = compatibleCore("0.8.1") ? combatant.data.tokenId : combatant.tokenId;
|
const filterConfig = this.applyFilter(combatant, settings);
|
||||||
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00');
|
const tokenId = combatant.token.id;
|
||||||
|
tokenControl.pushData(tokenId,settings,context,device,combatantState,'#cccc00', filterConfig.forceIcon, filterConfig.hideName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background});
|
streamDeck.setIcon(context,device,src,{background:background});
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background});
|
streamDeck.setIcon(context,device,src,{background:background});
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == 'currentCombatant'){
|
else if (mode == 'currentCombatant'){
|
||||||
if (MODULE.getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
if (getPermission('COMBAT','DISPLAY_COMBATANTS') == false) {
|
||||||
streamDeck.noPermission(context,device,device);
|
streamDeck.noPermission(context,device,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (combat != null && combat != undefined && combat.started){
|
if (combat != null && combat != undefined && combat.started){
|
||||||
const tokenId = compatibleCore("0.8.1") ? combat.combatant.data.tokenId : combat.combatant.tokenId;
|
const filterConfig = this.applyFilter(combat.combatant, settings);
|
||||||
tokenControl.pushData(tokenId,settings,context,device);
|
const tokenId = combat.combatant.token.id;
|
||||||
|
tokenControl.pushData(tokenId,settings,context,device,undefined,undefined, filterConfig.forceIcon, filterConfig.hideName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background});
|
streamDeck.setIcon(context,device,src,{background:background});
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == 'function'){
|
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);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
|
else if (ctFunction == 'endTurn' && getPermission('COMBAT','END_TURN') == false) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
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);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -130,6 +161,13 @@ export class CombatTracker{
|
|||||||
if (settings.displayRound && settings.displayTurn) txt += "\n";
|
if (settings.displayRound && settings.displayTurn) txt += "\n";
|
||||||
if (settings.displayTurn) txt += "Turn\n"+turn;
|
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.setIcon(context,device,src,{background:background});
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
@@ -145,20 +183,19 @@ export class CombatTracker{
|
|||||||
if (combat == null || combat == undefined) return;
|
if (combat == null || combat == undefined) return;
|
||||||
const ctFunction = settings.combatTrackerFunction ? settings.combatTrackerFunction : 'startStop';
|
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);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ctFunction == 'endTurn' && MODULE.getPermission('COMBAT','END_TURN') == false) {
|
else if (ctFunction == 'endTurn' && getPermission('COMBAT','END_TURN') == false) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
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);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (ctFunction == 'startStop'){
|
||||||
if (ctFunction == 'startStop'){
|
|
||||||
let src;
|
let src;
|
||||||
let background;
|
let background;
|
||||||
if (game.combat.started){
|
if (game.combat.started){
|
||||||
@@ -169,8 +206,10 @@ export class CombatTracker{
|
|||||||
}
|
}
|
||||||
return;
|
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 (game.combat.started == false) return;
|
||||||
if (ctFunction == 'nextTurn') await game.combat.nextTurn();
|
if (ctFunction == 'nextTurn') await game.combat.nextTurn();
|
||||||
else if (ctFunction == 'prevTurn') await game.combat.previousTurn();
|
else if (ctFunction == 'prevTurn') await game.combat.previousTurn();
|
||||||
else if (ctFunction == 'nextRound') await game.combat.nextRound();
|
else if (ctFunction == 'nextRound') await game.combat.nextRound();
|
||||||
@@ -181,7 +220,6 @@ export class CombatTracker{
|
|||||||
const token = canvas.tokens.placeables.filter(token => token.id == game.combat.combatant.token.id)[0];
|
const token = canvas.tokens.placeables.filter(token => token.id == game.combat.combatant.token.id)[0];
|
||||||
if (token.can(game.userId,"control")) token.control();
|
if (token.can(game.userId,"control")) token.control();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const onClick = settings.onClick ? settings.onClick : 'doNothing';
|
const onClick = settings.onClick ? settings.onClick : 'doNothing';
|
||||||
@@ -193,12 +231,12 @@ export class CombatTracker{
|
|||||||
if (nr == undefined || nr < 1) nr = 0;
|
if (nr == undefined || nr < 1) nr = 0;
|
||||||
const combatant = initiativeOrder[nr]
|
const combatant = initiativeOrder[nr]
|
||||||
if (combatant == undefined) return;
|
if (combatant == undefined) return;
|
||||||
tokenId = compatibleCore("0.8.1") ? combatant.data.tokenId : combatant.tokenId;
|
tokenId = combatant.token.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == 'currentCombatant')
|
else if (mode == 'currentCombatant')
|
||||||
if (combat != null && combat != undefined && combat.started)
|
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;
|
let token = (canvas.tokens.children[0] != undefined) ? canvas.tokens.children[0].children.find(p => p.id == tokenId) : undefined;
|
||||||
if (token == undefined) return;
|
if (token == undefined) return;
|
||||||
@@ -226,6 +264,12 @@ export class CombatTracker{
|
|||||||
if (element == null) token.sheet.render(true);
|
if (element == null) token.sheet.render(true);
|
||||||
else token.sheet.close();
|
else token.sheet.close();
|
||||||
}
|
}
|
||||||
|
else if (onClick == 'rollInitiative') {
|
||||||
|
token.actor.rollInitiative({rerollInitiative:true});
|
||||||
|
}
|
||||||
|
else if (onClick == 'target') {
|
||||||
|
token.setTarget(!token.isTargeted,{releaseOthers:false})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import {streamDeck} from "../MaterialDeck.js";
|
import { streamDeck } from "../../MaterialDeck.js";
|
||||||
|
import { } from "../misc.js";
|
||||||
|
|
||||||
export class ExternalModules{
|
export class ExternalModules{
|
||||||
soundscapeSettings = {
|
soundscapeSettings = {
|
||||||
@@ -59,16 +60,15 @@ export class ExternalModules{
|
|||||||
update(settings,context,device){
|
update(settings,context,device){
|
||||||
this.active = true;
|
this.active = true;
|
||||||
const module = settings.module ? settings.module : 'fxmaster';
|
const module = settings.module ? settings.module : 'fxmaster';
|
||||||
|
|
||||||
if (module == 'fxmaster') this.updateFxMaster(settings,context,device);
|
if (module == 'fxmaster') this.updateFxMaster(settings,context,device);
|
||||||
else if (module == 'gmscreen') this.updateGMScreen(settings,context,device);
|
else if (module == 'gmscreen') this.updateGMScreen(settings,context,device);
|
||||||
else if (module == 'triggerHappy') this.updateTriggerHappy(settings,context,device);
|
else if (module == 'triggerHappy') this.updateTriggerHappy(settings,context,device);
|
||||||
else if (module == 'sharedVision') this.updateSharedVision(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 == 'notYourTurn') this.updateNotYourTurn(settings,context,device);
|
||||||
else if (module == 'lockView') this.updateLockView(settings,context,device);
|
else if (module == 'lockView') this.updateLockView(settings,context,device);
|
||||||
else if (module == 'aboutTime') this.updateAboutTime(settings,context,device);
|
else if (module == 'simpleCalendar') this.updateSimpleCalendar(settings,context,device);
|
||||||
else if (module == 'soundscape') this.updateSoundscape(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){
|
keyPress(settings,context,device){
|
||||||
@@ -79,11 +79,11 @@ export class ExternalModules{
|
|||||||
else if (module == 'gmscreen') this.keyPressGMScreen(settings,context,device);
|
else if (module == 'gmscreen') this.keyPressGMScreen(settings,context,device);
|
||||||
else if (module == 'triggerHappy') this.keyPressTriggerHappy(settings,context,device);
|
else if (module == 'triggerHappy') this.keyPressTriggerHappy(settings,context,device);
|
||||||
else if (module == 'sharedVision') this.keyPressSharedVision(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 == 'notYourTurn') this.keyPressNotYourTurn(settings,context,device);
|
||||||
else if (module == 'lockView') this.keyPressLockView(settings,context,device);
|
else if (module == 'lockView') this.keyPressLockView(settings,context,device);
|
||||||
else if (module == 'aboutTime') this.keyPressAboutTime(settings,context,device);
|
else if (module == 'simpleCalendar') this.keyPressSimpleCalendar(settings,context,device);
|
||||||
else if (module == 'soundscape') this.keyPressSoundscape(settings,context,device);
|
else if (module == 'soundscape') this.keyPressSoundscape(settings,context,device);
|
||||||
|
else if (module == 'monksActiveTiles') this.keyPressMonksActiveTiles(settings,context,device);
|
||||||
}
|
}
|
||||||
|
|
||||||
getModuleEnable(moduleId){
|
getModuleEnable(moduleId){
|
||||||
@@ -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 =game.i18n.localize(CONFIG.fxmaster.particleEffects[effect].label);
|
||||||
icon = CONFIG.weatherEffects[effect].icon;
|
icon = CONFIG.fxmaster.particleEffects[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 = game.i18n.localize(CONFIG.fxmaster.filterEffects[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,27 +140,20 @@ 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";
|
||||||
name = game.i18n.localize("MaterialDeck.FxMaster.Clear");
|
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});
|
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:ring,ringColor:ringColor});
|
||||||
else streamDeck.setIcon(context,device, "", {background:background,ring:ring,ringColor:ringColor});
|
else streamDeck.setIcon(context,device, "", {background:background,ring:ring,ringColor:ringColor});
|
||||||
if (displayName == 0) name = "";
|
if (displayName == 0) name = "";
|
||||||
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 +163,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.switchParticleEffect", {
|
||||||
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 +227,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
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -299,7 +234,6 @@ export class ExternalModules{
|
|||||||
updateGMScreen(settings,context,device){
|
updateGMScreen(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;
|
||||||
|
|
||||||
const background = settings.gmScreenBackground ? settings.gmScreenBackground : '#000000';
|
const background = settings.gmScreenBackground ? settings.gmScreenBackground : '#000000';
|
||||||
let ring = 1;
|
let ring = 1;
|
||||||
const ringColor = '#00FF00'
|
const ringColor = '#00FF00'
|
||||||
@@ -309,6 +243,7 @@ export class ExternalModules{
|
|||||||
if (this.gmScreenOpen) ring = 2;
|
if (this.gmScreenOpen) ring = 2;
|
||||||
|
|
||||||
if (settings.displayGmScreenIcon) src = "fas fa-book-reader";
|
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});
|
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||||
if (settings.displayGmScreenName) txt = game.i18n.localize(`GMSCR.gmScreen.Open`);
|
if (settings.displayGmScreenName) txt = game.i18n.localize(`GMSCR.gmScreen.Open`);
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
@@ -317,7 +252,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?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -335,7 +270,9 @@ export class ExternalModules{
|
|||||||
const ringColor = game.settings.get("trigger-happy", "enableTriggers") ? "#A600FF" : "#340057";
|
const ringColor = game.settings.get("trigger-happy", "enableTriggers") ? "#A600FF" : "#340057";
|
||||||
|
|
||||||
let txt = '';
|
let txt = '';
|
||||||
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-grin-squint-tears",{background:background,ring:2,ringColor:ringColor});
|
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'});
|
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||||
if (displayName) txt = 'Trigger Happy';
|
if (displayName) txt = 'Trigger Happy';
|
||||||
|
|
||||||
@@ -376,7 +313,9 @@ export class ExternalModules{
|
|||||||
const ringColor = game.settings.get("SharedVision", "enable") ? "#A600FF" : "#340057";
|
const ringColor = game.settings.get("SharedVision", "enable") ? "#A600FF" : "#340057";
|
||||||
|
|
||||||
let txt = '';
|
let txt = '';
|
||||||
if (displayIcon) streamDeck.setIcon(context,device,"fas fa-eye",{background:background,ring:2,ringColor:ringColor});
|
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'});
|
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||||
if (displayName) txt = 'Shared Vision';
|
if (displayName) txt = 'Shared Vision';
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
@@ -393,34 +332,6 @@ export class ExternalModules{
|
|||||||
else if (mode == 'disable') Hooks.call("setShareVision",{enable:false});
|
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!
|
//Not Your Turn!
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -448,6 +359,7 @@ export class ExternalModules{
|
|||||||
txt = "Block Non-Combat Movement";
|
txt = "Block Non-Combat Movement";
|
||||||
ringColor = game.settings.get('NotYourTurn','nonCombat') ? "#A600FF": "#340057" ;
|
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});
|
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||||
if (displayName == false) txt = '';
|
if (displayName == false) txt = '';
|
||||||
@@ -502,6 +414,7 @@ export class ExternalModules{
|
|||||||
ringColor = canvas.scene.getFlag('LockView', 'boundingBox') ? "#A600FF": "#340057" ;
|
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});
|
if (displayIcon) streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||||
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
else streamDeck.setIcon(context,device,'',{background:'#000000'});
|
||||||
if (displayName == false) txt = '';
|
if (displayName == false) txt = '';
|
||||||
@@ -528,20 +441,20 @@ export class ExternalModules{
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//About Time
|
//About Time
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
updateAboutTime(settings,context,device) {
|
updateSimpleCalendar(settings,context,device) {
|
||||||
if (this.getModuleEnable("about-time") == false) return;
|
if (this.getModuleEnable("foundryvtt-simple-calendar") == false) return;
|
||||||
if (game.user.isGM == false) return;
|
if (game.user.isGM == false) return;
|
||||||
|
|
||||||
const displayTime = settings.aboutTimeDisplayTime ? settings.aboutTimeDisplayTime : 'none';
|
const displayTime = settings.simpleCalendarDisplayTime ? settings.simpleCalendarDisplayTime : 'none';
|
||||||
const displayDate = settings.aboutTimeDisplayDate ? settings.aboutTimeDisplayDate : 'none';
|
const displayDate = settings.simpleCalendarDisplayDate ? settings.simpleCalendarDisplayDate : 'none';
|
||||||
const background = settings.aboutTimeBackground ? settings.aboutTimeBackground : '#000000';
|
const background = settings.simpleCalendarBackground ? settings.simpleCalendarBackground : '#000000';
|
||||||
const ringOffColor = settings.aboutTimeOffRing ? settings.aboutTimeOffRing : '#000000';
|
const ringOffColor = settings.simpleCalendarOffRing ? settings.simpleCalendarOffRing : '#000000';
|
||||||
const ringOnColor = settings.aboutTimeOnRing ? settings.aboutTimeOnRing : '#00FF00';
|
const ringOnColor = settings.simpleCalendarOnRing ? settings.simpleCalendarOnRing : '#00FF00';
|
||||||
|
|
||||||
let ring = 0;
|
let ring = 0;
|
||||||
let ringColor = '#000000';
|
let ringColor = '#000000';
|
||||||
let txt = '';
|
let txt = '';
|
||||||
let currentTime = game.Gametime.DTNow().longDateExtended();
|
let currentTime = SimpleCalendar.api.currentDateTime();
|
||||||
let clock = 'none';
|
let clock = 'none';
|
||||||
|
|
||||||
if (displayTime == 'clock') {
|
if (displayTime == 'clock') {
|
||||||
@@ -567,172 +480,112 @@ export class ExternalModules{
|
|||||||
}
|
}
|
||||||
if (displayTime == 'hours24h' || displayTime == 'hours12h') txt = hours;
|
if (displayTime == 'hours24h' || displayTime == 'hours12h') txt = hours;
|
||||||
else if (displayTime == 'minutes') txt = currentTime.minute;
|
else if (displayTime == 'minutes') txt = currentTime.minute;
|
||||||
else if (displayTime == 'seconds') txt = currentTime.second;
|
else if (displayTime == 'seconds') txt = currentTime.seconds;
|
||||||
else {
|
else {
|
||||||
if (currentTime.minute < 10) currentTime.minute = '0' + currentTime.minute;
|
if (currentTime.minute < 10) currentTime.minute = '0' + currentTime.minute;
|
||||||
if (currentTime.second < 10) currentTime.second = '0' + currentTime.second;
|
if (currentTime.seconds < 10) currentTime.seconds = '0' + currentTime.seconds;
|
||||||
txt += hours + ':' + currentTime.minute;
|
txt += hours + ':' + currentTime.minute;
|
||||||
if (displayTime == 'full24h' || displayTime == 'full12h') txt += ':' + currentTime.second;
|
if (displayTime == 'full24h' || displayTime == 'full12h') txt += ':' + currentTime.seconds;
|
||||||
}
|
}
|
||||||
if (displayTime == 'compact12h' || displayTime == 'full12h' || displayTime == 'hours12h') txt += AMPM;
|
if (displayTime == 'compact12h' || displayTime == 'full12h' || displayTime == 'hours12h') txt += AMPM;
|
||||||
}
|
}
|
||||||
if (displayTime != 'none' && displayTime != 'clock' && displayDate != 'none') txt += '\n';
|
if (displayTime != 'none' && displayTime != 'clock' && displayDate != 'none') txt += '\n';
|
||||||
|
|
||||||
if (displayDate == 'day') txt += currentTime.day;
|
if (displayDate == 'day') txt += currentTime.day;
|
||||||
else if (displayDate == 'dayName') txt += currentTime.dowString;
|
else if (displayDate == 'dayName') txt += SimpleCalendar.api.getCurrentWeekday().name;
|
||||||
else if (displayDate == 'month') txt += currentTime.month;
|
else if (displayDate == 'month') txt += currentTime.month;
|
||||||
else if (displayDate == 'monthName') txt += currentTime.monthString;
|
else if (displayDate == 'monthName') txt += SimpleCalendar.api.getCurrentMonth().name;
|
||||||
else if (displayDate == 'year') txt += currentTime.year;
|
else if (displayDate == 'year') txt += currentTime.year;
|
||||||
else if (displayDate == 'small') txt += currentTime.day + '-' + currentTime.month;
|
else if (displayDate == 'small') txt += currentTime.day + '-' + currentTime.month;
|
||||||
else if (displayDate == 'smallInv') txt += currentTime.month + '-' + currentTime.day;
|
else if (displayDate == 'smallInv') txt += currentTime.month + '-' + currentTime.day;
|
||||||
else if (displayDate == 'full') txt += currentTime.day + '-' + currentTime.month + '-' + currentTime.year;
|
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 == 'fullInv') txt += currentTime.month + '-' + currentTime.day + '-' + currentTime.year;
|
||||||
else if (displayDate == 'text' || displayDate == 'textDay') {
|
else if (displayDate == 'text' || displayDate == 'textDay' || displayDate == 'textAbbr' || displayDate == 'textDayAbbr') {
|
||||||
|
if (displayDate == 'textDay') txt += SimpleCalendar.api.getCurrentWeekday().name + ' ';
|
||||||
if (displayDate == 'textDay') txt += currentTime.dowString + ' ';
|
else if (displayDate == 'textDayAbbr') txt += SimpleCalendar.api.getCurrentWeekday().abbreviation + ' ';
|
||||||
txt += currentTime.day;
|
txt += currentTime.day;
|
||||||
if (currentTime.day % 10 == 1 && currentTime != 11) txt += game.i18n.localize("MaterialDeck.AboutTime.First");
|
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.AboutTime.Second");
|
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.AboutTime.Third");
|
else if (currentTime.day % 10 == 3 && currentTime != 13) txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Third");
|
||||||
else txt += game.i18n.localize("MaterialDeck.AboutTime.Fourth");
|
else txt += game.i18n.localize("MaterialDeck.SimpleCalendar.Fourth");
|
||||||
txt += ' ' + game.i18n.localize("MaterialDeck.AboutTime.Of") + ' ' + currentTime.monthString + ', ' + currentTime.year;
|
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.aboutTimeActive) {
|
if (settings.simpleCalendarActive) {
|
||||||
const clockRunning = game.Gametime.isRunning();
|
const clockRunning = SimpleCalendar.api.clockStatus().started;
|
||||||
ringColor = clockRunning ? ringOnColor : ringOffColor;
|
ringColor = clockRunning ? ringOnColor : ringOffColor;
|
||||||
ring = 2;
|
ring = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt.toString(),context);
|
||||||
streamDeck.setIcon(context,device,'',{background:background,ring:ring,ringColor:ringColor, clock:clock});
|
streamDeck.setIcon(context,device,'',{background:background,ring:ring,ringColor:ringColor, clock:clock});
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPressAboutTime(settings,context,device) {
|
keyPressSimpleCalendar(settings,context,device) {
|
||||||
if (this.getModuleEnable("about-time") == false) return;
|
if (this.getModuleEnable("foundryvtt-simple-calendar") == false) return;
|
||||||
if (game.user.isGM == false) return;
|
if (game.user.isGM == false) return;
|
||||||
|
|
||||||
const onClick = settings.aboutTimeOnClick ? settings.aboutTimeOnClick : 'none';
|
const onClick = settings.simpleCalendarOnClick ? settings.simpleCalendarOnClick : 'none';
|
||||||
if (onClick == 'none') return;
|
if (onClick == 'none') return;
|
||||||
else if (onClick == 'startStop') {
|
else if (onClick == 'startStop') {
|
||||||
const clockRunning = game.Gametime.isRunning();
|
const clockRunning = SimpleCalendar.api.clockStatus().started;
|
||||||
const startMode = settings.aboutTimeStartStopMode ? settings.aboutTimeStartStopMode : 'toggle';
|
const startMode = settings.simpleCalendarStartStopMode ? settings.simpleCalendarStartStopMode : 'toggle';
|
||||||
if ((startMode == 'toggle' && clockRunning) || startMode == 'stop') game.Gametime.stopRunning();
|
if (clockRunning && (startMode == 'toggle' || startMode == 'stop')) SimpleCalendar.api.stopClock();
|
||||||
else if ((startMode == 'toggle' && !clockRunning) || startMode == 'start') game.Gametime.startRunning();
|
else if (!clockRunning && (startMode == 'toggle' || startMode == 'start')) SimpleCalendar.api.startClock();
|
||||||
}
|
}
|
||||||
else if (onClick == 'advance') {
|
else if (onClick == 'advance') {
|
||||||
const advanceMode = settings.aboutTimeAdvanceMode ? settings.aboutTimeAdvanceMode : 'dawn';
|
const advanceMode = settings.simpleCalendarAdvanceMode ? settings.simpleCalendarAdvanceMode : 'dawn';
|
||||||
let now = Gametime.DTNow();
|
if (advanceMode == 'sunrise') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunrise);
|
||||||
if (advanceMode == 'dawn') {
|
if (advanceMode == 'midday') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midday);
|
||||||
let newDT = now.add({
|
if (advanceMode == 'sunset') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunset);
|
||||||
days: now.hours < 7 ? 0 : 1
|
if (advanceMode == 'midnight') SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midnight);
|
||||||
}).setAbsolute({
|
else if (advanceMode == '1s') SimpleCalendar.api.changeDate({seconds: 1});
|
||||||
hours: 7,
|
else if (advanceMode == '30s') SimpleCalendar.api.changeDate({seconds: 30});
|
||||||
minutes: 0,
|
else if (advanceMode == '1m') SimpleCalendar.api.changeDate({minute: 1});
|
||||||
seconds: 0
|
else if (advanceMode == '5m') SimpleCalendar.api.changeDate({minute: 5});
|
||||||
});
|
else if (advanceMode == '15m') SimpleCalendar.api.changeDate({minute: 15});
|
||||||
Gametime.setAbsolute(newDT);
|
else if (advanceMode == '1h') SimpleCalendar.api.changeDate({hour: 1});
|
||||||
}
|
else if (advanceMode == '6h') SimpleCalendar.api.changeDate({hour: 6});
|
||||||
else if (advanceMode == 'noon') {
|
else if (advanceMode == '12h') SimpleCalendar.api.changeDate({hour: 12});
|
||||||
let newDT = now.add({
|
else if (advanceMode == '1d') SimpleCalendar.api.changeDate({day: 1});
|
||||||
days: now.hours < 12 ? 0 : 1
|
else if (advanceMode == '7d') SimpleCalendar.api.changeDate({day: 7});
|
||||||
}).setAbsolute({
|
else if (advanceMode == '1M') SimpleCalendar.api.changeDate({month: 1});
|
||||||
hours: 12,
|
else if (advanceMode == '1y') SimpleCalendar.api.changeDate({year: 1});
|
||||||
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') {
|
else if (onClick == 'recede') {
|
||||||
const advanceMode = settings.aboutTimeAdvanceMode ? settings.aboutTimeAdvanceMode : 'dawn';
|
const advanceMode = settings.simpleCalendarAdvanceMode ? settings.simpleCalendarAdvanceMode : 'dawn';
|
||||||
let now = Gametime.DTNow();
|
let now = SimpleCalendar.api.currentDateTime();
|
||||||
if (advanceMode == 'dawn') {
|
if (advanceMode == 'sunrise') {
|
||||||
let newDT = now.add({
|
SimpleCalendar.api.changeDate({day: -1});
|
||||||
days: now.hours < 7 ? -1 : 0
|
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunrise);
|
||||||
}).setAbsolute({
|
|
||||||
hours: 7,
|
|
||||||
minutes: 0,
|
|
||||||
seconds: 0
|
|
||||||
});
|
|
||||||
Gametime.setAbsolute(newDT);
|
|
||||||
}
|
}
|
||||||
else if (advanceMode == 'noon') {
|
else if (advanceMode == 'midday') {
|
||||||
let newDT = now.add({
|
SimpleCalendar.api.changeDate({day: -1});
|
||||||
days: now.hours < 12 ? -1 : 0
|
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midday);
|
||||||
}).setAbsolute({
|
|
||||||
hours: 12,
|
|
||||||
minutes: 0,
|
|
||||||
seconds: 0
|
|
||||||
});
|
|
||||||
Gametime.setAbsolute(newDT);
|
|
||||||
}
|
}
|
||||||
else if (advanceMode == 'dusk') {
|
else if (advanceMode == 'sunset') {
|
||||||
let newDT = now.add({
|
SimpleCalendar.api.changeDate({day: -1});
|
||||||
days: now.hours < 20 ? -1 : 0
|
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Sunset);
|
||||||
}).setAbsolute({
|
|
||||||
hours: 20,
|
|
||||||
minutes: 0,
|
|
||||||
seconds: 0
|
|
||||||
});
|
|
||||||
Gametime.setAbsolute(newDT);
|
|
||||||
}
|
}
|
||||||
else if (advanceMode == 'midnight') {
|
else if (advanceMode == 'midnight') {
|
||||||
let newDT = Gametime.DTNow().add({
|
SimpleCalendar.api.changeDate({day: -1});
|
||||||
days: -1
|
SimpleCalendar.api.advanceTimeToPreset(SimpleCalendar.api.PresetTimeOfDay.Midnight);
|
||||||
}).setAbsolute({
|
|
||||||
hours: 0,
|
|
||||||
minutes: 0,
|
|
||||||
seconds: 0
|
|
||||||
});
|
|
||||||
Gametime.setAbsolute(newDT);
|
|
||||||
}
|
}
|
||||||
else if (advanceMode == '1s')
|
else if (advanceMode == '1s') SimpleCalendar.api.changeDate({seconds: -1});
|
||||||
game.Gametime.advanceClock(-1);
|
else if (advanceMode == '30s') SimpleCalendar.api.changeDate({seconds: -30});
|
||||||
else if (advanceMode == '30s')
|
else if (advanceMode == '1m') SimpleCalendar.api.changeDate({minute: -1});
|
||||||
game.Gametime.advanceClock(-30);
|
else if (advanceMode == '5m') SimpleCalendar.api.changeDate({minute: -5});
|
||||||
|
else if (advanceMode == '15m') SimpleCalendar.api.changeDate({minute: -15});
|
||||||
else if (advanceMode == '1m')
|
else if (advanceMode == '1h') SimpleCalendar.api.changeDate({hour: -1});
|
||||||
game.Gametime.advanceTime({ minutes: -1 });
|
else if (advanceMode == '6h') SimpleCalendar.api.changeDate({hour: -6});
|
||||||
else if (advanceMode == '5m')
|
else if (advanceMode == '12h') SimpleCalendar.api.changeDate({hour: -12});
|
||||||
game.Gametime.advanceTime({ minutes: -5 });
|
else if (advanceMode == '1d') SimpleCalendar.api.changeDate({day: -1});
|
||||||
else if (advanceMode == '15m')
|
else if (advanceMode == '7d') SimpleCalendar.api.changeDate({day: -7});
|
||||||
game.Gametime.advanceTime({ minutes: -15 });
|
else if (advanceMode == '1M') SimpleCalendar.api.changeDate({month: -1});
|
||||||
else if (advanceMode == '1h')
|
else if (advanceMode == '1y') SimpleCalendar.api.changeDate({year: -1});
|
||||||
game.Gametime.advanceTime({ hours: -1 });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -855,6 +708,7 @@ export class ExternalModules{
|
|||||||
}
|
}
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1056,6 +910,43 @@ export class ExternalModules{
|
|||||||
|
|
||||||
this.updateAll();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { moduleName, streamDeck, getPermission, hotbarUses } from "../../MaterialDeck.js";
|
||||||
import {streamDeck} from "../MaterialDeck.js";
|
import { compatibleCore } from "../misc.js";
|
||||||
import {compatibleCore} from "./misc.js";
|
|
||||||
|
|
||||||
export class MacroControl{
|
export class MacroControl{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -37,9 +36,10 @@ export class MacroControl{
|
|||||||
let src = "";
|
let src = "";
|
||||||
let macroId = undefined;
|
let macroId = undefined;
|
||||||
let uses = undefined;
|
let uses = undefined;
|
||||||
|
let macroLabel = "";
|
||||||
|
|
||||||
if (mode == 'macroBoard') { //Macro board
|
if (mode == 'macroBoard') { //Macro board
|
||||||
if ((MODULE.getPermission('MACRO','MACROBOARD') == false )) {
|
if ((getPermission('MACRO','MACROBOARD') == false )) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -57,8 +57,14 @@ export class MacroControl{
|
|||||||
else { //Execute macro
|
else { //Execute macro
|
||||||
macroNumber += this.offset - 1;
|
macroNumber += this.offset - 1;
|
||||||
if (macroNumber < 0) macroNumber = 0;
|
if (macroNumber < 0) macroNumber = 0;
|
||||||
macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
|
const macroSettings = game.settings.get(moduleName,'macroSettings');
|
||||||
background = game.settings.get(MODULE.moduleName,'macroSettings').color[macroNumber];
|
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';
|
if (background == undefined) background = '#000000';
|
||||||
ring = 0;
|
ring = 0;
|
||||||
}
|
}
|
||||||
@@ -69,11 +75,11 @@ export class MacroControl{
|
|||||||
macroId = macro?.id;
|
macroId = macro?.id;
|
||||||
}
|
}
|
||||||
else { //Macro Hotbar
|
else { //Macro Hotbar
|
||||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
|
if ((getPermission('MACRO','HOTBAR') == false )) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode == 'hotbar') macroId = game.user.data.hotbar[macroNumber];
|
if (mode == 'hotbar') macroId = game.user.hotbar[macroNumber];
|
||||||
else {
|
else {
|
||||||
let macros;
|
let macros;
|
||||||
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined)
|
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined)
|
||||||
@@ -89,9 +95,10 @@ export class MacroControl{
|
|||||||
let macro = game.macros._source.find(p => p._id == macroId);
|
let macro = game.macros._source.find(p => p._id == macroId);
|
||||||
|
|
||||||
if (macro != undefined) {
|
if (macro != undefined) {
|
||||||
if (displayName) name = macro.name;
|
if (displayName && mode == 'macroBoard') name = macroLabel;
|
||||||
|
else if (displayName) name = macro.name;
|
||||||
if (displayIcon) src = macro.img;
|
if (displayIcon) src = macro.img;
|
||||||
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
|
if (hotbarUses && displayUses) uses = await this.getUses(macro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -99,6 +106,7 @@ export class MacroControl{
|
|||||||
if (displayIcon) src = "modules/MaterialDeck/img/black.png";
|
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.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor,uses:uses});
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
}
|
}
|
||||||
@@ -115,8 +123,7 @@ export class MacroControl{
|
|||||||
if (device?.buttons == undefined) continue;
|
if (device?.buttons == undefined) continue;
|
||||||
for (let i=0; i<device.buttons.length; i++){
|
for (let i=0; i<device.buttons.length; i++){
|
||||||
const data = device.buttons[i];
|
const data = device.buttons[i];
|
||||||
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
|
if (data == undefined || data.action != 'macro' || data.settings.macroMode != 'hotbar') continue;
|
||||||
|
|
||||||
const context = data.context;
|
const context = data.context;
|
||||||
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
|
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
|
||||||
const displayName = data.settings.displayName ? data.settings.displayName : false;
|
const displayName = data.settings.displayName ? data.settings.displayName : false;
|
||||||
@@ -126,7 +133,7 @@ export class MacroControl{
|
|||||||
let macroNumber = data.settings.macroNumber;
|
let macroNumber = data.settings.macroNumber;
|
||||||
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
|
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
|
||||||
|
|
||||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
|
if ((getPermission('MACRO','HOTBAR') == false )) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -138,7 +145,7 @@ export class MacroControl{
|
|||||||
|
|
||||||
let macroId;
|
let macroId;
|
||||||
if (mode == 'hotbar'){
|
if (mode == 'hotbar'){
|
||||||
macroId = game.user.data.hotbar[macroNumber];
|
macroId = game.user.hotbar[macroNumber];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (macroNumber > 9) macroNumber = 0;
|
if (macroNumber > 9) macroNumber = 0;
|
||||||
@@ -150,8 +157,9 @@ export class MacroControl{
|
|||||||
if (macro != undefined && macro != null) {
|
if (macro != undefined && macro != null) {
|
||||||
if (displayName) name += macro.name;
|
if (displayName) name += macro.name;
|
||||||
if (displayIcon) src += macro.img;
|
if (displayIcon) src += macro.img;
|
||||||
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
|
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.setIcon(context,device,src,{background:background,uses:uses});
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
}
|
}
|
||||||
@@ -165,11 +173,11 @@ export class MacroControl{
|
|||||||
let target = settings.target ? settings.target : undefined;
|
let target = settings.target ? settings.target : undefined;
|
||||||
|
|
||||||
if (mode == 'hotbar' || mode == 'visibleHotbar' || mode == 'customHotbar'){
|
if (mode == 'hotbar' || mode == 'visibleHotbar' || mode == 'customHotbar'){
|
||||||
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) return;
|
if ((getPermission('MACRO','HOTBAR') == false )) return;
|
||||||
this.executeHotbar(macroNumber,mode);
|
this.executeHotbar(macroNumber,mode,target);
|
||||||
}
|
}
|
||||||
else if (mode == 'name') {
|
else if (mode == 'name') {
|
||||||
if ((MODULE.getPermission('MACRO','BY_NAME') == false )) return;
|
if ((getPermission('MACRO','BY_NAME') == false )) return;
|
||||||
const macroName = settings.macroNumber;
|
const macroName = settings.macroNumber;
|
||||||
const macro = game.macros.getName(macroName);
|
const macro = game.macros.getName(macroName);
|
||||||
|
|
||||||
@@ -177,28 +185,41 @@ export class MacroControl{
|
|||||||
|
|
||||||
const args = settings.macroArgs ? settings.macroArgs : "";
|
const args = settings.macroArgs ? settings.macroArgs : "";
|
||||||
|
|
||||||
let furnaceEnabled = false;
|
let advancedMacrosEnabled = false;
|
||||||
let furnace = game.modules.get("furnace");
|
if (compatibleCore('11.0')) {
|
||||||
if (furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) furnaceEnabled = true;
|
advancedMacrosEnabled = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
let advancedMacros = game.modules.get("advanced-macros");
|
let advancedMacros = game.modules.get("advanced-macros");
|
||||||
if (advancedMacros != undefined && advancedMacros.active) furnaceEnabled = true;
|
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args == "" || args == " ") furnaceEnabled = false;
|
if (args == "" || args == " ") advancedMacrosEnabled = false;
|
||||||
|
|
||||||
if (furnaceEnabled == false) macro.execute({token:target});
|
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 {
|
else {
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user._id,
|
user: game.user._id,
|
||||||
speaker: ChatMessage.getSpeaker(),
|
speaker: ChatMessage.getSpeaker(),
|
||||||
content: "/'" + macro.name + "' " + args
|
content: "/amacro '" + macro.name + "' " + args[macroNumber]
|
||||||
};
|
};
|
||||||
ChatMessage.create(chatData, {});
|
ChatMessage.create(chatData, {});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((MODULE.getPermission('MACRO','MACROBOARD') == false )) return;
|
if ((getPermission('MACRO','MACROBOARD') == false )) return;
|
||||||
if (settings.macroBoardMode == 'offset') {
|
if (settings.macroBoardMode == 'offset') {
|
||||||
let macroOffset = settings.macroOffset;
|
let macroOffset = settings.macroOffset;
|
||||||
if (macroOffset == undefined) macroOffset = 0;
|
if (macroOffset == undefined) macroOffset = 0;
|
||||||
@@ -210,9 +231,9 @@ export class MacroControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
executeHotbar(macroNumber,mode){
|
executeHotbar(macroNumber,mode,target){
|
||||||
let macroId
|
let macroId
|
||||||
if (mode == 'hotbar') macroId = game.user.data.hotbar[macroNumber];
|
if (mode == 'hotbar') macroId = game.user.hotbar[macroNumber];
|
||||||
else {
|
else {
|
||||||
let macros;
|
let macros;
|
||||||
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
|
if (mode == 'customHotbar' && game.modules.get('custom-hotbar') != undefined) {
|
||||||
@@ -224,34 +245,46 @@ export class MacroControl{
|
|||||||
}
|
}
|
||||||
if (macroId == undefined) return;
|
if (macroId == undefined) return;
|
||||||
let macro = game.macros.get(macroId);
|
let macro = game.macros.get(macroId);
|
||||||
macro.execute();
|
macro.execute({token:target});
|
||||||
}
|
}
|
||||||
|
|
||||||
executeBoard(macroNumber){
|
executeBoard(macroNumber){
|
||||||
macroNumber = parseInt(macroNumber);
|
macroNumber = parseInt(macroNumber);
|
||||||
macroNumber += this.offset - 1;
|
macroNumber += this.offset - 1;
|
||||||
if (macroNumber < 0) macroNumber = 0;
|
if (macroNumber < 0) macroNumber = 0;
|
||||||
var macroId = game.settings.get(MODULE.moduleName,'macroSettings').macros[macroNumber];
|
var macroId = game.settings.get(moduleName,'macroSettings').macros[macroNumber];
|
||||||
|
|
||||||
if (macroId != undefined){
|
if (macroId != undefined){
|
||||||
let macro = game.macros.get(macroId);
|
let macro = game.macros.get(macroId);
|
||||||
if (macro != undefined && macro != null) {
|
if (macro != undefined && macro != null) {
|
||||||
const args = game.settings.get(MODULE.moduleName,'macroSettings').args;
|
const args = game.settings.get(moduleName,'macroSettings').args;
|
||||||
let furnaceEnabled = false;
|
let advancedMacrosEnabled = false;
|
||||||
let furnace = game.modules.get("furnace");
|
if (compatibleCore('11.0')) {
|
||||||
if (furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) furnaceEnabled = true;
|
advancedMacrosEnabled = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
let advancedMacros = game.modules.get("advanced-macros");
|
let advancedMacros = game.modules.get("advanced-macros");
|
||||||
if (advancedMacros != undefined && advancedMacros.active) furnaceEnabled = true;
|
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (args == undefined || args[macroNumber] == undefined || args[macroNumber] == "") furnaceEnabled = false;
|
if (args == undefined || args[macroNumber] == undefined || args[macroNumber] == "") advancedMacrosEnabled = false;
|
||||||
|
|
||||||
if (furnaceEnabled == false) macro.execute();
|
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 {
|
else {
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user._id,
|
user: game.user._id,
|
||||||
speaker: ChatMessage.getSpeaker(),
|
speaker: ChatMessage.getSpeaker(),
|
||||||
content: "/'" + macro.name + "' " + args
|
content: "/amacro '" + macro.name + "' " + args[macroNumber]
|
||||||
};
|
};
|
||||||
ChatMessage.create(chatData, {});
|
ChatMessage.create(chatData, {});
|
||||||
}
|
}
|
||||||
@@ -259,3 +292,4 @@ export class MacroControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { streamDeck, gamingSystem, getPermission } from "../../MaterialDeck.js";
|
||||||
import {streamDeck} from "../MaterialDeck.js";
|
import { } from "../misc.js";
|
||||||
import {compatibleCore} from "./misc.js";
|
|
||||||
|
|
||||||
export class OtherControls{
|
export class OtherControls{
|
||||||
constructor(){
|
constructor(){
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.rollData = {};
|
this.rollData = {};
|
||||||
this.rollOption = 'dialog';
|
this.rollOption = 'dialog';
|
||||||
|
this.controlsOffset = 0;
|
||||||
|
this.toolsOffset = 0;
|
||||||
|
this.attackMode = 'chat';
|
||||||
}
|
}
|
||||||
|
|
||||||
setRollOption(option) {
|
setRollOption(option) {
|
||||||
@@ -14,6 +16,11 @@ export class OtherControls{
|
|||||||
this.updateAll();
|
this.updateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAttackMode(option) {
|
||||||
|
this.attackMode = option;
|
||||||
|
this.updateAll();
|
||||||
|
}
|
||||||
|
|
||||||
async updateAll(options={}){
|
async updateAll(options={}){
|
||||||
if (this.active == false) return;
|
if (this.active == false) return;
|
||||||
for (let device of streamDeck.buttonContext) {
|
for (let device of streamDeck.buttonContext) {
|
||||||
@@ -54,8 +61,12 @@ export class OtherControls{
|
|||||||
this.updateChatMessage(settings,context,device,options);
|
this.updateChatMessage(settings,context,device,options);
|
||||||
else if (mode == 'rollOptions')
|
else if (mode == 'rollOptions')
|
||||||
this.updateRollOptions(settings,context,device,options);
|
this.updateRollOptions(settings,context,device,options);
|
||||||
|
else if (mode == 'attackModes')
|
||||||
|
this.updateAttackMode(settings,context,device,options);
|
||||||
else if (mode == 'rollMode')
|
else if (mode == 'rollMode')
|
||||||
this.updateRollMode(settings,context,device,options);
|
this.updateRollMode(settings,context,device,options);
|
||||||
|
else if (mode == 'globalVolumeControls')
|
||||||
|
this.updateGlobalVolumeControls(settings, context, device, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPress(settings,context,device){
|
keyPress(settings,context,device){
|
||||||
@@ -85,14 +96,18 @@ export class OtherControls{
|
|||||||
this.keyPressChatMessage(settings);
|
this.keyPressChatMessage(settings);
|
||||||
else if (mode == 'rollOptions')
|
else if (mode == 'rollOptions')
|
||||||
this.keyPressRollOptions(settings);
|
this.keyPressRollOptions(settings);
|
||||||
|
else if (mode == 'attackModes')
|
||||||
|
this.keyPressAttackMode(settings);
|
||||||
else if (mode == 'rollMode')
|
else if (mode == 'rollMode')
|
||||||
this.keyPressRollMode(settings);
|
this.keyPressRollMode(settings);
|
||||||
|
else if (mode == 'globalVolumeControls')
|
||||||
|
this.keyPressGlobalVolumeControls(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
updatePause(settings,context,device,options={}){
|
updatePause(settings,context,device,options={}){
|
||||||
if (MODULE.getPermission('OTHER','PAUSE') == false ) {
|
if (getPermission('OTHER','PAUSE') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -112,12 +127,17 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
else if (pauseFunction == 'toggle') //toggle
|
else if (pauseFunction == 'toggle') //toggle
|
||||||
src = 'modules/MaterialDeck/img/other/pause/playpause.png';
|
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);
|
streamDeck.setTitle('',context);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPressPause(settings){
|
keyPressPause(settings){
|
||||||
if (MODULE.getPermission('OTHER','PAUSE') == false ) return;
|
if (getPermission('OTHER','PAUSE') == false ) return;
|
||||||
|
|
||||||
const pauseFunction = settings.pauseFunction ? settings.pauseFunction : 'pause';
|
const pauseFunction = settings.pauseFunction ? settings.pauseFunction : 'pause';
|
||||||
|
|
||||||
@@ -162,8 +182,12 @@ export class OtherControls{
|
|||||||
url = "modules/MaterialDeck/img/move/zoomin.png";
|
url = "modules/MaterialDeck/img/move/zoomin.png";
|
||||||
else if (dir == 'zoomOut')
|
else if (dir == 'zoomOut')
|
||||||
url = "modules/MaterialDeck/img/move/zoomout.png";
|
url = "modules/MaterialDeck/img/move/zoomout.png";
|
||||||
|
let overlay = true;
|
||||||
streamDeck.setIcon(context,device,url,{background:background,overlay:true});
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) {
|
||||||
|
url = settings.iconOverride;
|
||||||
|
overlay = false;
|
||||||
|
}
|
||||||
|
streamDeck.setIcon(context,device,url,{background:background,overlay});
|
||||||
streamDeck.setTitle('',context);
|
streamDeck.setTitle('',context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +208,7 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let viewPosition = canvas.scene._viewPosition;
|
let viewPosition = canvas.scene._viewPosition;
|
||||||
const gridSize = canvas.scene.data.grid;
|
const gridSize = canvas.scene.grid.size;
|
||||||
viewPosition.duration = 100;
|
viewPosition.duration = 100;
|
||||||
|
|
||||||
if (dir == 'up') viewPosition.y -= gridSize;
|
if (dir == 'up') viewPosition.y -= gridSize;
|
||||||
@@ -218,14 +242,16 @@ export class OtherControls{
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
updateControl(settings,context,device,options={}){
|
updateControl(settings,context,device,options={}){
|
||||||
if (MODULE.getPermission('OTHER','CONTROL') == false ) {
|
if (getPermission('OTHER','CONTROL') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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 +261,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];
|
||||||
|
|
||||||
@@ -243,18 +270,19 @@ export class OtherControls{
|
|||||||
streamDeck.noPermission(context,device,false);
|
streamDeck.noPermission(context,device,false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tool == 'open'){ //open category
|
//if (tool == 'open'){ //open category
|
||||||
txt = game.i18n.localize(selectedControl.title);
|
txt = game.i18n.localize(selectedControl.title);
|
||||||
src = selectedControl.icon;
|
src = selectedControl.icon;
|
||||||
if (activeControl == selectedControl.name)
|
if (activeControl == selectedControl.name)
|
||||||
ringColor = "#FF7B00";
|
ringColor = "#FF7B00";
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (control == 'dispTools'){ //displayed tools
|
else if (control == 'dispTools'){ //displayed tools
|
||||||
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 +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
|
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){
|
||||||
@@ -307,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.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPressControl(settings){
|
keyPressControl(settings){
|
||||||
if (MODULE.getPermission('OTHER','CONTROL') == false ) return;
|
if (getPermission('OTHER','CONTROL') == false ) return;
|
||||||
if (canvas.scene == null) return;
|
if (canvas.scene == null) return;
|
||||||
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';
|
||||||
@@ -328,18 +369,8 @@ export class OtherControls{
|
|||||||
streamDeck.noPermission(context,device,false);
|
streamDeck.noPermission(context,device,false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ui.controls.activeControl = selectedControl.name;
|
ui.controls.initialize({layer: selectedControl.layer});
|
||||||
selectedControl.activeTool = selectedControl.activeTool;
|
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||||
if (compatibleCore("0.8.2")) {
|
|
||||||
for (let layer of canvas.layers) {
|
|
||||||
if (layer.options == undefined) continue;
|
|
||||||
if (layer.options.name == selectedControl.layer) {
|
|
||||||
layer.activate();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else canvas.getLayer(selectedControl.layer).activate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (control == 'dispTools'){ //displayed tools
|
else if (control == 'dispTools'){ //displayed tools
|
||||||
@@ -365,11 +396,24 @@ export class OtherControls{
|
|||||||
else if (selectedTool.button){
|
else if (selectedTool.button){
|
||||||
selectedTool.onClick();
|
selectedTool.onClick();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
selectedControl.activeTool = selectedTool.name;
|
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
|
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){
|
||||||
@@ -378,18 +422,8 @@ export class OtherControls{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tool == 'open'){ //open category
|
if (tool == 'open'){ //open category
|
||||||
ui.controls.activeControl = control;
|
ui.controls.initialize({layer: selectedControl.layer});
|
||||||
selectedControl.activeTool = selectedControl.activeTool;
|
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||||
if (compatibleCore("0.8.2")) {
|
|
||||||
for (let layer of canvas.layers) {
|
|
||||||
if (layer.options == undefined) continue;
|
|
||||||
if (layer.options.name == selectedControl.layer) {
|
|
||||||
layer.activate();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else canvas.getLayer(selectedControl.layer).activate();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const selectedTool = selectedControl.tools.find(t => t.name == tool);
|
const selectedTool = selectedControl.tools.find(t => t.name == tool);
|
||||||
@@ -398,26 +432,23 @@ export class OtherControls{
|
|||||||
streamDeck.noPermission(context,device,false);
|
streamDeck.noPermission(context,device,false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ui.controls.activeControl = control;
|
|
||||||
if (compatibleCore("0.8.2")) {
|
|
||||||
for (let layer of canvas.layers) {
|
|
||||||
if (layer.options == undefined) continue;
|
|
||||||
if (layer.options.name == selectedControl.layer) {
|
|
||||||
layer.activate();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else canvas.getLayer(selectedControl.layer).activate();
|
|
||||||
if (selectedTool.toggle) {
|
if (selectedTool.toggle) {
|
||||||
|
ui.controls.initialize({layer: selectedControl.layer});
|
||||||
|
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||||
selectedTool.active = !selectedTool.active;
|
selectedTool.active = !selectedTool.active;
|
||||||
selectedTool.onClick(selectedTool.active);
|
selectedTool.onClick(selectedTool.active);
|
||||||
}
|
}
|
||||||
else if (selectedTool.button){
|
else if (selectedTool.button){
|
||||||
|
ui.controls.initialize({layer: selectedControl.layer});
|
||||||
|
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||||
selectedTool.onClick();
|
selectedTool.onClick();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
selectedControl.activeTool = tool;
|
|
||||||
|
ui.controls.initialize({layer: selectedControl.layer, tool: selectedTool.name});
|
||||||
|
canvas.layers.find(l => l.options.name == selectedControl.layer).activate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -428,7 +459,7 @@ export class OtherControls{
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
updateDarkness(settings,context,device,options={}){
|
updateDarkness(settings,context,device,options={}){
|
||||||
if (MODULE.getPermission('OTHER','DARKNESS') == false ) {
|
if (getPermission('OTHER','DARKNESS') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -448,48 +479,64 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
else if (func == 'disp'){ //display darkness
|
else if (func == 'disp'){ //display darkness
|
||||||
src = 'modules/MaterialDeck/img/other/darkness/darkness.png';
|
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;
|
txt += darkness;
|
||||||
}
|
}
|
||||||
streamDeck.setTitle(txt,context);
|
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) {
|
keyPressDarkness(settings) {
|
||||||
if (canvas.scene == null) return;
|
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 func = settings.darknessFunction ? settings.darknessFunction : 'value';
|
||||||
const value = parseFloat(settings.darknessValue) ? parseFloat(settings.darknessValue) : 0;
|
const value = parseFloat(settings.darknessValue) ? parseFloat(settings.darknessValue) : 0;
|
||||||
|
const animateDarkness = parseInt(settings.darknessAnimation) ? parseInt(settings.darknessAnimation) : 500;
|
||||||
|
|
||||||
if (func == 'value') //value
|
if (func == 'value') //value
|
||||||
canvas.scene.update({darkness: value});
|
canvas.scene.update({darkness: value}, {animateDarkness});
|
||||||
else if (func == 'incDec'){ //increase/decrease
|
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 > 1) darkness = 1;
|
||||||
if (darkness < 0) darkness = 0;
|
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={}){
|
updateRollDice(settings,context,device,options={}){
|
||||||
if (MODULE.getPermission('OTHER','DICE') == false ) {
|
if (getPermission('OTHER','DICE') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
let txt = '';
|
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.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){
|
keyPressRollDice(settings,context,device){
|
||||||
if (MODULE.getPermission('OTHER','DICE') == false ) return;
|
if (getPermission('OTHER','DICE') == false ) return;
|
||||||
if (settings.rollDiceFormula == undefined || settings.rollDiceFormula == '') return;
|
const formula = settings.rollDiceFormula ? settings.rollDiceFormula : '1d20 + 7';
|
||||||
|
if (formula == '') return;
|
||||||
const rollFunction = settings.rollDiceFunction ? settings.rollDiceFunction : 'public';
|
const rollFunction = settings.rollDiceFunction ? settings.rollDiceFunction : 'public';
|
||||||
|
|
||||||
let actor;
|
let actor;
|
||||||
@@ -499,10 +546,10 @@ export class OtherControls{
|
|||||||
if (actor != undefined) tokenControlled = true;
|
if (actor != undefined) tokenControlled = true;
|
||||||
|
|
||||||
let r;
|
let r;
|
||||||
if (tokenControlled) r = new Roll(settings.rollDiceFormula,actor.getRollData());
|
if (tokenControlled) r = new Roll(formula,actor.getRollData());
|
||||||
else r = new Roll(settings.rollDiceFormula);
|
else r = new Roll(formula);
|
||||||
|
|
||||||
r.evaluate();
|
r.evaluate({async:false});
|
||||||
|
|
||||||
if (rollFunction == 'public') {
|
if (rollFunction == 'public') {
|
||||||
r.toMessage(r,{rollMode:"roll"})
|
r.toMessage(r,{rollMode:"roll"})
|
||||||
@@ -511,12 +558,12 @@ export class OtherControls{
|
|||||||
r.toMessage(r,{rollMode:"selfroll"})
|
r.toMessage(r,{rollMode:"selfroll"})
|
||||||
}
|
}
|
||||||
else if (rollFunction == 'sd'){
|
else if (rollFunction == 'sd'){
|
||||||
let txt = settings.displayDiceName ? 'Roll: '+settings.rollDiceFormula + '\nResult: ' : '';
|
let txt = settings.displayDiceName ? 'Roll: '+formula + '\nResult: ' : '';
|
||||||
txt += r.total;
|
txt += r.total;
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
let data = this.rollData
|
let data = this.rollData
|
||||||
data[context] = {
|
data[context] = {
|
||||||
formula: settings.rollDiceFormula,
|
formula: formula,
|
||||||
result: txt
|
result: txt
|
||||||
}
|
}
|
||||||
this.rollData = data;
|
this.rollData = data;
|
||||||
@@ -528,7 +575,7 @@ export class OtherControls{
|
|||||||
updateRollTable(settings,context,device,options={}){
|
updateRollTable(settings,context,device,options={}){
|
||||||
const name = settings.rollTableName;
|
const name = settings.rollTableName;
|
||||||
if (name == undefined) return;
|
if (name == undefined) return;
|
||||||
if (MODULE.getPermission('OTHER','TABLES') == false ) {
|
if (getPermission('OTHER','TABLES') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -538,25 +585,26 @@ export class OtherControls{
|
|||||||
if (table == undefined) return;
|
if (table == undefined) return;
|
||||||
|
|
||||||
let txt = settings.displayRollName ? table.name : '';
|
let txt = settings.displayRollName ? table.name : '';
|
||||||
let src = settings.displayRollIcon ? table.data.img : '';
|
let src = settings.displayRollIcon ? table.img : '';
|
||||||
|
|
||||||
if (table == undefined) {
|
if (table == undefined) {
|
||||||
src = '';
|
src = '';
|
||||||
txt = '';
|
txt = '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (table.permission < 2 && MODULE.getPermission('OTHER','TABLES_ALL') == false ) {
|
if (table.permission < 2 && getPermission('OTHER','TABLES_ALL') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background});
|
streamDeck.setIcon(context,device,src,{background:background});
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPressRollTable(settings){
|
keyPressRollTable(settings){
|
||||||
if (MODULE.getPermission('OTHER','TABLES') == false ) return;
|
if (getPermission('OTHER','TABLES') == false ) return;
|
||||||
const name = settings.rollTableName;
|
const name = settings.rollTableName;
|
||||||
if (name == undefined) return;
|
if (name == undefined) return;
|
||||||
|
|
||||||
@@ -564,7 +612,7 @@ export class OtherControls{
|
|||||||
const table = game.tables.getName(name);
|
const table = game.tables.getName(name);
|
||||||
|
|
||||||
if (table != undefined) {
|
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
|
if (func == 'open'){ //open
|
||||||
const element = document.getElementById(table.sheet.id);
|
const element = document.getElementById(table.sheet.id);
|
||||||
if (element == null) table.sheet.render(true);
|
if (element == null) table.sheet.render(true);
|
||||||
@@ -581,14 +629,15 @@ export class OtherControls{
|
|||||||
|
|
||||||
getSidebarName(nr){
|
getSidebarName(nr){
|
||||||
let name;
|
let name;
|
||||||
if (nr == 'chat') name = game.i18n.localize("SIDEBAR.TabChat");
|
if (nr == 'chat') name = game.i18n.localize("DOCUMENT.ChatMessages");
|
||||||
else if (nr == 'combat') name = game.i18n.localize("SIDEBAR.TabCombat");
|
else if (nr == 'combat') name = game.i18n.localize("DOCUMENT.Combats");
|
||||||
else if (nr == 'scenes') name = game.i18n.localize("SIDEBAR.TabScenes");
|
else if (nr == 'scenes') name = game.i18n.localize("DOCUMENT.Scenes");
|
||||||
else if (nr == 'actors') name = game.i18n.localize("SIDEBAR.TabActors");
|
else if (nr == 'actors') name = game.i18n.localize("DOCUMENT.Actors");
|
||||||
else if (nr == 'items') name = game.i18n.localize("SIDEBAR.TabItems");
|
else if (nr == 'items') name = game.i18n.localize("DOCUMENT.Items");
|
||||||
else if (nr == 'journal') name = game.i18n.localize("SIDEBAR.TabJournal");
|
else if (nr == 'journal') name = game.i18n.localize("DOCUMENT.JournalEntries");
|
||||||
else if (nr == 'tables') name = game.i18n.localize("SIDEBAR.TabTables");
|
else if (nr == 'tables') name = game.i18n.localize("DOCUMENT.RollTables");
|
||||||
else if (nr == 'playlists') name = game.i18n.localize("SIDEBAR.TabPlaylists");
|
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 == '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");
|
||||||
else if (nr == 'collapse') name = game.i18n.localize("SIDEBAR.CollapseToggle");
|
else if (nr == 'collapse') name = game.i18n.localize("SIDEBAR.CollapseToggle");
|
||||||
@@ -604,6 +653,7 @@ export class OtherControls{
|
|||||||
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 = window.CONFIG.Cards.sidebarIcon;
|
||||||
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";
|
||||||
@@ -612,7 +662,7 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateSidebar(settings,context,device,options={}){
|
updateSidebar(settings,context,device,options={}){
|
||||||
if (MODULE.getPermission('OTHER','SIDEBAR') == false ) {
|
if (getPermission('OTHER','SIDEBAR') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -629,14 +679,15 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
else if (popOut == false) ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
|
else if (popOut == false) ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
|
||||||
const name = settings.displaySidebarName ? this.getSidebarName(sidebarTab) : '';
|
const name = settings.displaySidebarName ? this.getSidebarName(sidebarTab) : '';
|
||||||
const icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
|
let icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';
|
||||||
|
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) icon = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
streamDeck.setIcon(context,device,icon,{background:background,ring:2,ringColor:ringColor});
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPressSidebar(settings){
|
keyPressSidebar(settings){
|
||||||
if (MODULE.getPermission('OTHER','SIDEBAR') == false ) return;
|
if (getPermission('OTHER','SIDEBAR') == false ) return;
|
||||||
const sidebarTab = settings.sidebarTab ? settings.sidebarTab : 'chat';
|
const sidebarTab = settings.sidebarTab ? settings.sidebarTab : 'chat';
|
||||||
const popOut = settings.sidebarPopOut ? settings.sidebarPopOut : false;
|
const popOut = settings.sidebarPopOut ? settings.sidebarPopOut : false;
|
||||||
|
|
||||||
@@ -657,7 +708,7 @@ export class OtherControls{
|
|||||||
|
|
||||||
updateCompendiumBrowser(settings,context,device,options={}){
|
updateCompendiumBrowser(settings,context,device,options={}){
|
||||||
let rendered = options.renderCompendiumBrowser;
|
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);
|
else if (rendered == undefined) rendered = (document.getElementById("compendium-popout") != null);
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||||
@@ -666,18 +717,20 @@ export class OtherControls{
|
|||||||
const txt = settings.displayCompendiumName ? name : '';
|
const txt = settings.displayCompendiumName ? name : '';
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
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){
|
keyPressCompendiumBrowser(settings){
|
||||||
let element = null;
|
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");
|
else element = document.getElementById("compendium-popout");
|
||||||
const rendered = (element != null);
|
const rendered = (element != null);
|
||||||
|
|
||||||
if (rendered)
|
if (rendered)
|
||||||
element.getElementsByClassName("close")[0].click();
|
element.getElementsByClassName("close")[0].click();
|
||||||
else if (game.system.id == "pf2e")
|
else if (gamingSystem == "pf2e")
|
||||||
document.getElementsByClassName("compendium-browser-btn")[0].click()
|
document.getElementsByClassName("compendium-browser-btn")[0].click()
|
||||||
else
|
else
|
||||||
ui.compendium.renderPopout();
|
ui.compendium.renderPopout();
|
||||||
@@ -688,17 +741,17 @@ export class OtherControls{
|
|||||||
updateCompendium(settings,context,device,options={}){
|
updateCompendium(settings,context,device,options={}){
|
||||||
const name = settings.compendiumName;
|
const name = settings.compendiumName;
|
||||||
if (name == undefined) return;
|
if (name == undefined) return;
|
||||||
if (MODULE.getPermission('OTHER','COMPENDIUM') == false ) {
|
if (getPermission('OTHER','COMPENDIUM') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const compendium = game.packs.find(p=>p.metadata.label == name);
|
const compendium = game.packs.find(p=>p.metadata.label == name);
|
||||||
if (compendium == undefined) return;
|
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);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const rendered = compatibleCore("0.8.5") ? compendium.apps[0].rendered : compendium.rendered;
|
const rendered = compendium.apps[0].rendered;
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
@@ -706,19 +759,21 @@ export class OtherControls{
|
|||||||
const txt = settings.displayCompendiumName ? name : '';
|
const txt = settings.displayCompendiumName ? name : '';
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
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){
|
keyPressCompendium(settings){
|
||||||
let name = settings.compendiumName;
|
let name = settings.compendiumName;
|
||||||
if (name == undefined) return;
|
if (name == undefined) return;
|
||||||
if (MODULE.getPermission('OTHER','COMPENDIUM') == false ) return;
|
if (getPermission('OTHER','COMPENDIUM') == false ) return;
|
||||||
|
|
||||||
const compendium = game.packs.find(p=>p.metadata.label == name);
|
const compendium = game.packs.find(p=>p.metadata.label == name);
|
||||||
const rendered = compatibleCore("0.8.5") ? compendium.apps[0].rendered : compendium.rendered;
|
const rendered = compendium.apps[0].rendered;
|
||||||
if (compendium == undefined) return;
|
if (compendium == undefined) return;
|
||||||
if (compendium.private && MODULE.getPermission('OTHER','COMPENDIUM_ALL') == false) return;
|
if (compendium.private && getPermission('OTHER','COMPENDIUM_ALL') == false) return;
|
||||||
else if (rendered) compatibleCore("0.8.5") ? compendium.apps[0].close() : compendium.close();
|
else if (rendered) compendium.apps[0].close();
|
||||||
else compendium.render(true);
|
else compendium.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,11 +786,11 @@ export class OtherControls{
|
|||||||
const journal = game.journal.getName(name);
|
const journal = game.journal.getName(name);
|
||||||
if (journal == undefined) return;
|
if (journal == undefined) return;
|
||||||
|
|
||||||
if (MODULE.getPermission('OTHER','JOURNAL') == false ) {
|
if (getPermission('OTHER','JOURNAL') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (journal.permission < 2 && MODULE.getPermission('OTHER','JOURNAL_ALL') == false ) {
|
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -755,7 +810,9 @@ export class OtherControls{
|
|||||||
const txt = settings.displayCompendiumName ? name : '';
|
const txt = settings.displayCompendiumName ? name : '';
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
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){
|
keyPressJournal(settings){
|
||||||
@@ -765,8 +822,8 @@ export class OtherControls{
|
|||||||
const journal = game.journal.getName(name);
|
const journal = game.journal.getName(name);
|
||||||
if (journal == undefined) return;
|
if (journal == undefined) return;
|
||||||
|
|
||||||
if (MODULE.getPermission('OTHER','JOURNAL') == false ) return;
|
if (getPermission('OTHER','JOURNAL') == false ) return;
|
||||||
if (journal.permission < 2 && MODULE.getPermission('OTHER','JOURNAL_ALL') == false ) return;
|
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) return;
|
||||||
|
|
||||||
if (journal.sheet.rendered == false) journal.sheet.render(true);
|
if (journal.sheet.rendered == false) journal.sheet.render(true);
|
||||||
else journal.sheet.close();
|
else journal.sheet.close();
|
||||||
@@ -775,17 +832,19 @@ export class OtherControls{
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
updateChatMessage(settings,context,device,options={}){
|
updateChatMessage(settings,context,device,options={}){
|
||||||
if (MODULE.getPermission('OTHER','CHAT') == false ) {
|
if (getPermission('OTHER','CHAT') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
streamDeck.setTitle("",context);
|
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){
|
keyPressChatMessage(settings){
|
||||||
if (MODULE.getPermission('OTHER','CHAT') == false ) return;
|
if (getPermission('OTHER','CHAT') == false ) return;
|
||||||
const message = settings.chatMessage ? settings.chatMessage : '';
|
const message = settings.chatMessage ? settings.chatMessage : '';
|
||||||
|
|
||||||
let chatData = {
|
let chatData = {
|
||||||
@@ -802,11 +861,16 @@ export class OtherControls{
|
|||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
const iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
||||||
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'normal';
|
const rollOption = settings.rollOptionFunction ? settings.rollOptionFunction : 'dialog';
|
||||||
const ringColor = (rollOption == this.rollOption) ? ringOnColor : ringOffColor;
|
const ringColor = (rollOption == this.rollOption) ? ringOnColor : ringOffColor;
|
||||||
streamDeck.setTitle("",context);
|
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){
|
keyPressRollOptions(settings){
|
||||||
@@ -817,17 +881,49 @@ export class OtherControls{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
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={}){
|
updateRollMode(settings,context,device,options={}){
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
const iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
let iconSrc = "modules/MaterialDeck/img/other/d20.png";
|
||||||
const rollMode = settings.rollMode ? settings.rollMode : 'roll';
|
const rollMode = settings.rollMode ? settings.rollMode : 'roll';
|
||||||
const ringColor = (rollMode == game.settings.get('core','rollMode')) ? ringOnColor : ringOffColor;
|
const ringColor = (rollMode == game.settings.get('core','rollMode')) ? ringOnColor : ringOffColor;
|
||||||
streamDeck.setTitle("",context);
|
streamDeck.setTitle("",context);
|
||||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:2,ringColor:ringColor,overlay:true});
|
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){
|
async keyPressRollMode(settings){
|
||||||
@@ -835,4 +931,48 @@ export class OtherControls{
|
|||||||
await game.settings.set('core','rollMode',rollMode);
|
await game.settings.set('core','rollMode',rollMode);
|
||||||
this.updateAll();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { moduleName, streamDeck, getPermission } from "../../MaterialDeck.js";
|
||||||
import {streamDeck} from "../MaterialDeck.js";
|
|
||||||
import {compatibleCore} from "./misc.js";
|
|
||||||
|
|
||||||
export class PlaylistControl{
|
export class PlaylistControl{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -22,7 +20,7 @@ export class PlaylistControl{
|
|||||||
}
|
}
|
||||||
|
|
||||||
update(settings,context,device){
|
update(settings,context,device){
|
||||||
if (MODULE.getPermission('PLAYLIST','PLAY') == false ) {
|
if (getPermission('PLAYLIST','PLAY') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -36,12 +34,17 @@ export class PlaylistControl{
|
|||||||
this.updateTrack(settings,context,device);
|
this.updateTrack(settings,context,device);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const src = mode == 'stopAll' ? 'modules/MaterialDeck/img/playlist/stop.png' : 'modules/MaterialDeck/img/playlist/pause.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 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;
|
||||||
const txt = settings.displayPlaylistName ? this.getPlaylist(this.playlistOffset).name : '';
|
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);
|
streamDeck.setTitle(txt,context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,12 +87,14 @@ export class PlaylistControl{
|
|||||||
let playlistOffset = parseInt(settings.offset);
|
let playlistOffset = parseInt(settings.offset);
|
||||||
if (isNaN(playlistOffset)) playlistOffset = 0;
|
if (isNaN(playlistOffset)) playlistOffset = 0;
|
||||||
let number = parseInt(this.playlistOffset + playlistOffset);
|
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;
|
if (number < 0) number += nrOfPlaylists;
|
||||||
else if (number >= nrOfPlaylists) number -= nrOfPlaylists;
|
else if (number >= nrOfPlaylists) number -= nrOfPlaylists;
|
||||||
const targetPlaylist = this.getPlaylist(number);
|
const targetPlaylist = this.getPlaylist(number);
|
||||||
if (targetPlaylist != undefined) name = targetPlaylist.name;
|
if (targetPlaylist != undefined) name = targetPlaylist.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
}
|
}
|
||||||
@@ -104,7 +109,7 @@ export class PlaylistControl{
|
|||||||
let src = "modules/MaterialDeck/img/transparant.png";
|
let src = "modules/MaterialDeck/img/transparant.png";
|
||||||
|
|
||||||
//Play/Stop
|
//Play/Stop
|
||||||
if (playlistType == 'playStop'){
|
if (playlistType == 'playStop' || playlistType == 'incDecVol' || playlistType == 'setVol'){
|
||||||
let playlistNr = parseInt(settings.playlistNr);
|
let playlistNr = parseInt(settings.playlistNr);
|
||||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||||
playlistNr--;
|
playlistNr--;
|
||||||
@@ -116,7 +121,7 @@ export class PlaylistControl{
|
|||||||
|
|
||||||
let playlist = this.getPlaylist(playlistNr);
|
let playlist = this.getPlaylist(playlistNr);
|
||||||
if (playlist != undefined){
|
if (playlist != undefined){
|
||||||
const track = compatibleCore("0.8.1") ? playlist.sounds.contents[trackNr] : playlist.sounds[trackNr];
|
const track = playlist.sounds.contents[trackNr];
|
||||||
if (track != undefined){
|
if (track != undefined){
|
||||||
if (track.playing)
|
if (track.playing)
|
||||||
ringColor = ringOnColor;
|
ringColor = ringOnColor;
|
||||||
@@ -124,6 +129,11 @@ export class PlaylistControl{
|
|||||||
ringColor = ringOffColor;
|
ringColor = ringOffColor;
|
||||||
if (settings.displayName)
|
if (settings.displayName)
|
||||||
name = track.name;
|
name = track.name;
|
||||||
|
if (settings.displayTrackVolume) {
|
||||||
|
if (settings.displayName) name += ' ';
|
||||||
|
name += Math.round(AudioHelper.volumeToInput(track.volume)*100)/100
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,6 +146,7 @@ export class PlaylistControl{
|
|||||||
//Relative Offset
|
//Relative Offset
|
||||||
else if (playlistType == 'relativeOffset') {
|
else if (playlistType == 'relativeOffset') {
|
||||||
}
|
}
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
}
|
}
|
||||||
@@ -157,7 +168,7 @@ export class PlaylistControl{
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let playing = game.playlists.playing;
|
let playing = game.playlists.playing;
|
||||||
let settings = game.settings.get(MODULE.moduleName,'playlists');
|
let settings = game.settings.get(moduleName,'playlists');
|
||||||
let selectedPlaylists = settings.selectedPlaylist;
|
let selectedPlaylists = settings.selectedPlaylist;
|
||||||
for (let i=0; i<playing.length; i++){
|
for (let i=0; i<playing.length; i++){
|
||||||
const playlistNr = selectedPlaylists.findIndex(p => p == playing[i]._id);
|
const playlistNr = selectedPlaylists.findIndex(p => p == playing[i]._id);
|
||||||
@@ -189,14 +200,14 @@ export class PlaylistControl{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPlaylist(num){
|
getPlaylist(num){
|
||||||
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
|
let selectedPlaylists = game.settings.get(moduleName,'playlists').selectedPlaylist;
|
||||||
if (selectedPlaylists != undefined)
|
if (selectedPlaylists != undefined)
|
||||||
return game.playlists.get(selectedPlaylists[num]);
|
return game.playlists.get(selectedPlaylists[num]);
|
||||||
else return undefined;
|
else return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPress(settings,context,device){
|
keyPress(settings,context,device){
|
||||||
if (MODULE.getPermission('PLAYLIST','PLAY') == false ) return;
|
if (getPermission('PLAYLIST','PLAY') == false ) return;
|
||||||
let playlistNr = settings.playlistNr;
|
let playlistNr = settings.playlistNr;
|
||||||
if (playlistNr == undefined || playlistNr < 1) playlistNr = 1;
|
if (playlistNr == undefined || playlistNr < 1) playlistNr = 1;
|
||||||
playlistNr--;
|
playlistNr--;
|
||||||
@@ -222,13 +233,19 @@ export class PlaylistControl{
|
|||||||
if (playlistMode == 'playlist')
|
if (playlistMode == 'playlist')
|
||||||
this.playPlaylist(playlist,playlistNr);
|
this.playPlaylist(playlist,playlistNr);
|
||||||
else {
|
else {
|
||||||
const track = compatibleCore("0.8.1") ? playlist.sounds.contents[trackNr] : playlist.sounds[trackNr];
|
const track = playlist.sounds.contents[trackNr];
|
||||||
if (track != undefined){
|
if (track != undefined){
|
||||||
this.playTrack(track,playlist,playlistNr);
|
this.playTrack(track,playlist,playlistNr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (playlistType == 'playNext') {
|
||||||
|
this.getPlaylist(playlistNr).playNext();
|
||||||
|
}
|
||||||
|
else if (playlistType == 'playPrev') {
|
||||||
|
this.getPlaylist(playlistNr).playNext(null,{direction:-1});
|
||||||
|
}
|
||||||
else if (playlistType == 'offset'){
|
else if (playlistType == 'offset'){
|
||||||
if (playlistMode == 'playlist') {
|
if (playlistMode == 'playlist') {
|
||||||
this.playlistOffset = parseInt(settings.offset);
|
this.playlistOffset = parseInt(settings.offset);
|
||||||
@@ -245,7 +262,7 @@ export class PlaylistControl{
|
|||||||
let playlistOffset = parseInt(settings.offset);
|
let playlistOffset = parseInt(settings.offset);
|
||||||
if (isNaN(playlistOffset)) playlistOffset = 0;
|
if (isNaN(playlistOffset)) playlistOffset = 0;
|
||||||
let number = parseInt(this.playlistOffset + playlistOffset);
|
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;
|
if (number < 0) number += nrOfPlaylists;
|
||||||
else if (number >= nrOfPlaylists) number -= nrOfPlaylists;
|
else if (number >= nrOfPlaylists) number -= nrOfPlaylists;
|
||||||
this.playlistOffset = number;
|
this.playlistOffset = number;
|
||||||
@@ -257,6 +274,29 @@ export class PlaylistControl{
|
|||||||
}
|
}
|
||||||
this.updateAll();
|
this.updateAll();
|
||||||
}
|
}
|
||||||
|
else if (playlistType == 'incDecVol' || playlistType == 'setVol') {
|
||||||
|
const value = settings.trackVolumeValue ? parseFloat(settings.trackVolumeValue) : 0.1;
|
||||||
|
let playlist = this.getPlaylist(playlistNr);
|
||||||
|
if (playlist != undefined){
|
||||||
|
if (playlistMode != 'track') return;
|
||||||
|
const track = playlist.sounds.contents[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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -275,12 +315,15 @@ export class PlaylistControl{
|
|||||||
playlist.stopAll();
|
playlist.stopAll();
|
||||||
return;
|
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) {
|
if (mode == 0) {
|
||||||
mode = game.settings.get(MODULE.moduleName,'playlists').playMode;
|
mode = game.settings.get(moduleName,'playlists').playMode;
|
||||||
if (mode == 2) await this.stopAll();
|
if (mode == 2) await this.stopAll(true);
|
||||||
}
|
}
|
||||||
playlist.playAll();
|
playlist.playAll();
|
||||||
|
//await playlist.update({mode: originalPlayMode});
|
||||||
}
|
}
|
||||||
|
|
||||||
async playTrack(track,playlist,playlistNr){
|
async playTrack(track,playlist,playlistNr){
|
||||||
@@ -295,23 +338,25 @@ export class PlaylistControl{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let play;
|
let play;
|
||||||
|
const originalPlayMode = playlist.mode;
|
||||||
if (track.playing)
|
if (track.playing)
|
||||||
play = false;
|
play = false;
|
||||||
else {
|
else {
|
||||||
play = true;
|
play = true;
|
||||||
let mode = game.settings.get(MODULE.moduleName,'playlists').playlistMode[playlistNr];
|
let mode = game.settings.get(moduleName,'playlists').playlistMode[playlistNr];
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
mode = game.settings.get(MODULE.moduleName,'playlists').playMode;
|
mode = game.settings.get(moduleName,'playlists').playMode;
|
||||||
if (mode == 1) await playlist.stopAll();
|
if (mode == 0) await playlist.update({mode: CONST.PLAYLIST_MODES.SIMULTANEOUS});
|
||||||
else if (mode == 2) await this.stopAll();
|
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);
|
if (play) await playlist.playSound(track);
|
||||||
else if (compatibleCore("0.8.1")) await playlist.stopSound(track);
|
else await playlist.stopSound(track);
|
||||||
else await playlist.updateEmbeddedEntity("PlaylistSound", {_id: track._id, playing: play});
|
|
||||||
|
|
||||||
playlist.update({playing: play});
|
playlist.update({playing: play});
|
||||||
|
await playlist.update({mode: originalPlayMode});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { streamDeck, getPermission } from "../../MaterialDeck.js";
|
||||||
import {streamDeck} from "../MaterialDeck.js";
|
import { } from "../misc.js";
|
||||||
import {compatibleCore} from "./misc.js";
|
|
||||||
|
|
||||||
export class SceneControl{
|
export class SceneControl{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -28,13 +27,14 @@ export class SceneControl{
|
|||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
|
const ringActiveColor = settings.activeRing ? settings.activeRing : '#FFFF00'
|
||||||
let ringColor = "#000000";
|
let ringColor = "#000000";
|
||||||
let ring = 2;
|
let ring = 2;
|
||||||
|
|
||||||
let src = "";
|
let src = "";
|
||||||
let name = "";
|
let name = "";
|
||||||
if (func == 'visible') { //visible scenes
|
if (func == 'visible') { //visible scenes
|
||||||
if (MODULE.getPermission('SCENE','VISIBLE') == false ) {
|
if (getPermission('SCENE','VISIBLE') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -47,12 +47,12 @@ export class SceneControl{
|
|||||||
if (scene != undefined){
|
if (scene != undefined){
|
||||||
ringColor = scene.isView ? ringOnColor : ringOffColor;
|
ringColor = scene.isView ? ringOnColor : ringOffColor;
|
||||||
if (settings.displaySceneName) name = scene.name;
|
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)";
|
if (scene.active) name += "\n(Active)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (func == 'dir') { //from directory
|
else if (func == 'dir') { //from directory
|
||||||
if (MODULE.getPermission('SCENE','DIRECTORY') == false ) {
|
if (getPermission('SCENE','DIRECTORY') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -61,33 +61,29 @@ export class SceneControl{
|
|||||||
nr--;
|
nr--;
|
||||||
|
|
||||||
let sceneList = [];
|
let sceneList = [];
|
||||||
for (let i=0; i<ui.scenes.tree.children.length; i++){
|
sceneList = ui.scenes.documents;
|
||||||
const scenesInFolder = compatibleCore("0.8.1") ? ui.scenes.tree.children[i].contents : ui.scenes.tree.children[i].entities;
|
|
||||||
for (let j=0; j<scenesInFolder.length; j++)
|
|
||||||
sceneList.push(scenesInFolder[j])
|
|
||||||
}
|
|
||||||
for (let i=0; i<ui.scenes.tree.content.length; i++)
|
|
||||||
sceneList.push(ui.scenes.tree.content[i])
|
|
||||||
|
|
||||||
const scene = sceneList[nr+this.sceneOffset];
|
const scene = sceneList[nr+this.sceneOffset];
|
||||||
|
|
||||||
if (scene != undefined){
|
if (scene != undefined){
|
||||||
if (scene.isView)
|
if (scene.active)
|
||||||
|
ringColor = ringActiveColor;
|
||||||
|
else if (scene.isView)
|
||||||
ringColor = ringOnColor;
|
ringColor = ringOnColor;
|
||||||
else if (scene.data.navigation && scene.data.permission.default == 0)
|
else if (scene.navigation && scene.permission.default == 0)
|
||||||
ringColor = '#000791';
|
ringColor = '#000791';
|
||||||
else if (scene.data.navigation)
|
else if (scene.navigation)
|
||||||
ringColor = '#2d2d2d';
|
ringColor = '#2d2d2d';
|
||||||
else
|
else
|
||||||
ringColor = ringOffColor;
|
ringColor = ringOffColor;
|
||||||
|
|
||||||
if (settings.displaySceneName) name = scene.name;
|
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)";
|
if (scene.active) name += "\n(Active)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (func == 'any') { //by name
|
else if (func == 'any') { //by name
|
||||||
if (MODULE.getPermission('SCENE','NAME') == false ) {
|
if (getPermission('SCENE','NAME') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -95,21 +91,24 @@ export class SceneControl{
|
|||||||
let scene = game.scenes.getName(settings.sceneName);
|
let scene = game.scenes.getName(settings.sceneName);
|
||||||
|
|
||||||
if (scene != undefined){
|
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.displaySceneName) name = scene.name;
|
||||||
if (settings.displaySceneIcon) src = scene.img;
|
if (settings.displaySceneIcon) src = scene.background.src;
|
||||||
if (scene.active) name += "\n(Active)";
|
if (scene.active) name += "\n(Active)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (func == 'active'){
|
else if (func == 'active'){
|
||||||
if (MODULE.getPermission('SCENE','ACTIVE') == false ) {
|
if (getPermission('SCENE','ACTIVE') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const scene = game.scenes.active;
|
const scene = game.scenes.active;
|
||||||
if (scene == undefined) return;
|
if (scene == undefined) return;
|
||||||
if (settings.displaySceneName) name = scene.name;
|
if (settings.displaySceneName) name = scene.name;
|
||||||
if (settings.displaySceneIcon) src = scene.img;
|
if (settings.displaySceneIcon) src = scene.background.src;
|
||||||
ring = 0;
|
ring = 0;
|
||||||
}
|
}
|
||||||
else if (func == 'offset'){
|
else if (func == 'offset'){
|
||||||
@@ -119,6 +118,7 @@ export class SceneControl{
|
|||||||
src = "modules/MaterialDeck/img/transparant.png";
|
src = "modules/MaterialDeck/img/transparant.png";
|
||||||
}
|
}
|
||||||
streamDeck.setTitle(name,context);
|
streamDeck.setTitle(name,context);
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:ring,ringColor:ringColor});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ export class SceneControl{
|
|||||||
const func = settings.sceneFunction ? settings.sceneFunction : 'visible';
|
const func = settings.sceneFunction ? settings.sceneFunction : 'visible';
|
||||||
|
|
||||||
if (func == 'visible'){ //visible scenes
|
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';
|
const viewFunc = settings.sceneViewFunction ? settings.sceneViewFunction : 'view';
|
||||||
let nr = parseInt(settings.sceneNr);
|
let nr = parseInt(settings.sceneNr);
|
||||||
if (isNaN(nr) || nr < 1) nr = 1;
|
if (isNaN(nr) || nr < 1) nr = 1;
|
||||||
@@ -147,20 +147,14 @@ export class SceneControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (func == 'dir') { //from directory
|
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';
|
const viewFunc = settings.sceneViewFunction ? settings.sceneViewFunction : 'view';
|
||||||
let nr = parseInt(settings.sceneNr);
|
let nr = parseInt(settings.sceneNr);
|
||||||
if (isNaN(nr) || nr < 1) nr = 1;
|
if (isNaN(nr) || nr < 1) nr = 1;
|
||||||
nr--;
|
nr--;
|
||||||
|
|
||||||
let sceneList = [];
|
let sceneList = [];
|
||||||
for (let i=0; i<ui.scenes.tree.children.length; i++){
|
sceneList = ui.scenes.documents;
|
||||||
const scenesInFolder = compatibleCore("0.8.1") ? ui.scenes.tree.children[i].contents : ui.scenes.tree.children[i].entities;
|
|
||||||
for (let j=0; j<scenesInFolder.length; j++)
|
|
||||||
sceneList.push(scenesInFolder[j])
|
|
||||||
}
|
|
||||||
for (let i=0; i<ui.scenes.tree.content.length; i++)
|
|
||||||
sceneList.push(ui.scenes.tree.content[i])
|
|
||||||
|
|
||||||
const scene = sceneList[nr+this.sceneOffset];
|
const scene = sceneList[nr+this.sceneOffset];
|
||||||
|
|
||||||
@@ -179,7 +173,7 @@ export class SceneControl{
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (func == 'any'){ //by name
|
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;
|
if (settings.sceneName == undefined || settings.sceneName == '') return;
|
||||||
const scenes = game.scenes.entries;
|
const scenes = game.scenes.entries;
|
||||||
let scene = game.scenes.getName(settings.sceneName);
|
let scene = game.scenes.getName(settings.sceneName);
|
||||||
@@ -199,7 +193,7 @@ export class SceneControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (func == 'active'){
|
else if (func == 'active'){
|
||||||
if (MODULE.getPermission('SCENE','ACTIVE') == false ) return;
|
if (getPermission('SCENE','ACTIVE') == false ) return;
|
||||||
const scene = game.scenes.active;
|
const scene = game.scenes.active;
|
||||||
if (scene == undefined) return;
|
if (scene == undefined) return;
|
||||||
scene.view();
|
scene.view();
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { moduleName, streamDeck, getPermission } from "../../MaterialDeck.js";
|
||||||
import {streamDeck} from "../MaterialDeck.js";
|
|
||||||
import {compatibleCore} from "./misc.js";
|
|
||||||
|
|
||||||
export class SoundboardControl{
|
export class SoundboardControl{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -22,7 +20,7 @@ export class SoundboardControl{
|
|||||||
}
|
}
|
||||||
|
|
||||||
update(settings,context,device){
|
update(settings,context,device){
|
||||||
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) {
|
if (getPermission('SOUNDBOARD','PLAY') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -40,13 +38,14 @@ export class SoundboardControl{
|
|||||||
soundNr--;
|
soundNr--;
|
||||||
soundNr += this.offset;
|
soundNr += this.offset;
|
||||||
|
|
||||||
let soundboardSettings = game.settings.get(MODULE.moduleName, 'soundboardSettings');
|
let soundboardSettings = game.settings.get(moduleName, 'soundboardSettings');
|
||||||
ringColor = (this.activeSounds[soundNr]==undefined) ? soundboardSettings.colorOff[soundNr] : soundboardSettings.colorOn[soundNr];
|
ringColor = (this.activeSounds[soundNr]==undefined) ? soundboardSettings.colorOff[soundNr] : soundboardSettings.colorOn[soundNr];
|
||||||
|
|
||||||
if (settings.displayName && soundboardSettings.name != undefined) txt = soundboardSettings.name[soundNr];
|
if (settings.displayName && soundboardSettings.name != undefined) txt = soundboardSettings.name[soundNr];
|
||||||
if (settings.displayIcon && soundboardSettings.img != undefined) src = soundboardSettings.img[soundNr];
|
if (settings.displayIcon && soundboardSettings.img != undefined) src = soundboardSettings.img[soundNr];
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||||
}
|
}
|
||||||
else if (mode == 'offset') { //Offset
|
else if (mode == 'offset') { //Offset
|
||||||
@@ -59,7 +58,9 @@ export class SoundboardControl{
|
|||||||
else ringColor = ringOffColor;
|
else ringColor = ringOffColor;
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
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
|
else if (mode == 'stopAll') { //Stop all sounds
|
||||||
let src = 'modules/MaterialDeck/img/playlist/stop.png';
|
let src = 'modules/MaterialDeck/img/playlist/stop.png';
|
||||||
@@ -68,6 +69,7 @@ export class SoundboardControl{
|
|||||||
for (let i=0; i<this.activeSounds.length; i++)
|
for (let i=0; i<this.activeSounds.length; i++)
|
||||||
if (this.activeSounds[i])
|
if (this.activeSounds[i])
|
||||||
soundPlaying = true;
|
soundPlaying = true;
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) src = settings.iconOverride;
|
||||||
if (soundPlaying)
|
if (soundPlaying)
|
||||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:'#00FF00',overlay:true});
|
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:'#00FF00',overlay:true});
|
||||||
else
|
else
|
||||||
@@ -76,7 +78,7 @@ export class SoundboardControl{
|
|||||||
}
|
}
|
||||||
|
|
||||||
keyPressDown(settings){
|
keyPressDown(settings){
|
||||||
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) return;
|
if (getPermission('SOUNDBOARD','PLAY') == false ) return;
|
||||||
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
|
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
|
||||||
|
|
||||||
if (mode == 'playSound') { //Play sound
|
if (mode == 'playSound') { //Play sound
|
||||||
@@ -85,7 +87,7 @@ export class SoundboardControl{
|
|||||||
soundNr--;
|
soundNr--;
|
||||||
soundNr += this.offset;
|
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 repeat = (playMode > 0) ? true : false;
|
||||||
const play = (this.activeSounds[soundNr] == undefined) ? true : false;
|
const play = (this.activeSounds[soundNr] == undefined) ? true : false;
|
||||||
|
|
||||||
@@ -107,7 +109,7 @@ export class SoundboardControl{
|
|||||||
}
|
}
|
||||||
|
|
||||||
keyPressUp(settings){
|
keyPressUp(settings){
|
||||||
if (MODULE.getPermission('SOUNDBOARD','PLAY') == false ) return;
|
if (getPermission('SOUNDBOARD','PLAY') == false ) return;
|
||||||
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
|
const mode = settings.soundboardMode ? settings.soundboardMode : 'playSound';
|
||||||
|
|
||||||
if (mode != 'playSound') return;
|
if (mode != 'playSound') return;
|
||||||
@@ -117,14 +119,14 @@ export class SoundboardControl{
|
|||||||
soundNr--;
|
soundNr--;
|
||||||
soundNr += this.offset;
|
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)
|
if (playMode == 2)
|
||||||
this.prePlaySound(soundNr,false,false);
|
this.prePlaySound(soundNr,false,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async prePlaySound(soundNr,repeat,play){
|
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;
|
const playlistId = (soundBoardSettings.selectedPlaylists != undefined) ? soundBoardSettings.selectedPlaylists[soundNr] : undefined;
|
||||||
let src;
|
let src;
|
||||||
if (playlistId == "" || playlistId == undefined) return;
|
if (playlistId == "" || playlistId == undefined) return;
|
||||||
@@ -144,12 +146,12 @@ export class SoundboardControl{
|
|||||||
const soundId = soundBoardSettings.sounds[soundNr];
|
const soundId = soundBoardSettings.sounds[soundNr];
|
||||||
const sounds = game.playlists.get(playlistId).sounds;
|
const sounds = game.playlists.get(playlistId).sounds;
|
||||||
if (sounds == undefined) return;
|
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;
|
if (sound == undefined) return;
|
||||||
src = sound.path;
|
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);
|
volume = AudioHelper.inputToVolume(volume);
|
||||||
|
|
||||||
let payload = {
|
let payload = {
|
||||||
@@ -169,7 +171,6 @@ export class SoundboardControl{
|
|||||||
if (play){
|
if (play){
|
||||||
volume *= game.settings.get("core", "globalAmbientVolume");
|
volume *= game.settings.get("core", "globalAmbientVolume");
|
||||||
|
|
||||||
if (compatibleCore("0.8.1")) {
|
|
||||||
let newSound = new Sound(src);
|
let newSound = new Sound(src);
|
||||||
if(newSound.loaded == false) await newSound.load({autoplay:true});
|
if(newSound.loaded == false) await newSound.load({autoplay:true});
|
||||||
newSound.on('end', ()=>{
|
newSound.on('end', ()=>{
|
||||||
@@ -181,25 +182,20 @@ export class SoundboardControl{
|
|||||||
newSound.play({loop:repeat,volume:volume});
|
newSound.play({loop:repeat,volume:volume});
|
||||||
this.activeSounds[soundNr] = newSound;
|
this.activeSounds[soundNr] = newSound;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
|
|
||||||
if (repeat == false){
|
|
||||||
this.activeSounds[soundNr] = undefined;
|
|
||||||
this.updateAll();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onstop: ()=>{
|
|
||||||
this.activeSounds[soundNr] = undefined;
|
|
||||||
this.updateAll();
|
|
||||||
}});
|
|
||||||
howl.play();
|
|
||||||
this.activeSounds[soundNr] = howl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if (this.activeSounds[soundNr] != undefined) this.activeSounds[soundNr].stop();
|
if (this.activeSounds[soundNr] != undefined) this.activeSounds[soundNr].stop();
|
||||||
this.activeSounds[soundNr] = undefined;
|
this.activeSounds[soundNr] = undefined;
|
||||||
}
|
}
|
||||||
this.updateAll();
|
this.updateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { streamDeck, macroControl, otherControls, tokenHelper, getPermission } from "../../MaterialDeck.js";
|
||||||
import {streamDeck, macroControl, otherControls, tokenHelper} from "../MaterialDeck.js";
|
import { } from "../misc.js";
|
||||||
|
|
||||||
export class TokenControl{
|
export class TokenControl{
|
||||||
constructor(){
|
constructor(){
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.wildcardOffset = 0;
|
this.wildcardOffset = 0;
|
||||||
|
this.itemOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(tokenId=null){
|
async update(tokenId=null){
|
||||||
@@ -19,21 +20,20 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async pushData(tokenId,settings,context,device,ring=0,ringColor='#000000'){
|
async pushData(tokenId,settings,context,device,ring=0,ringColor='#000000',forceIcon,hideName=false){
|
||||||
const name = settings.displayName ? settings.displayName : false;
|
const name = settings.displayName ? settings.displayName : false;
|
||||||
const icon = settings.icon ? settings.icon : 'none';
|
const icon = settings.icon ? settings.icon : 'none';
|
||||||
const background = settings.background ? settings.background : "#000000";
|
|
||||||
let stats = settings.stats ? settings.stats : 'none';
|
let stats = settings.stats ? settings.stats : 'none';
|
||||||
const selection = settings.selection ? settings.selection : 'selected';
|
const selection = settings.selection ? settings.selection : 'selected';
|
||||||
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
||||||
const prependTitle = settings.prependTitle ? settings.prependTitle : '';
|
const prependTitle = settings.prependTitle ? settings.prependTitle : '';
|
||||||
const mode = settings.tokenMode ? settings.tokenMode : 'token';
|
const mode = settings.tokenMode ? settings.tokenMode : 'token';
|
||||||
|
const background = (mode == 'inventory') ? (settings.inventoryBackground ? settings.inventoryBackground : "#000000") : (settings.background ? settings.background : "#000000");
|
||||||
|
|
||||||
let validToken = false;
|
let validToken = false;
|
||||||
let token;
|
let token;
|
||||||
if (settings.combatTrackerMode) token = tokenHelper.getTokenFromTokenId(tokenId);
|
if (settings.combatTrackerMode) token = tokenHelper.getTokenFromTokenId(tokenId);
|
||||||
else token = tokenHelper.getToken(selection,tokenIdentifier);
|
else token = tokenHelper.getToken(selection,tokenIdentifier);
|
||||||
|
|
||||||
if (token != undefined) validToken = true;
|
if (token != undefined) validToken = true;
|
||||||
let txt = "";
|
let txt = "";
|
||||||
let iconSrc = "";
|
let iconSrc = "";
|
||||||
@@ -42,11 +42,11 @@ export class TokenControl{
|
|||||||
let uses = undefined;
|
let uses = undefined;
|
||||||
let hp = undefined;
|
let hp = undefined;
|
||||||
if (validToken) {
|
if (validToken) {
|
||||||
if (token.owner == false && token.observer == true && MODULE.getPermission('TOKEN','OBSERVER') == false ) {
|
if (token.owner == false && token.observer == true && getPermission('TOKEN','OBSERVER') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (token.owner == false && token.observer == false && MODULE.getPermission('TOKEN','NON_OWNED') == false ) {
|
if (token.owner == false && token.observer == false && getPermission('TOKEN','NON_OWNED') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -57,16 +57,16 @@ export class TokenControl{
|
|||||||
|
|
||||||
const permission = token.actor?.permission;
|
const permission = token.actor?.permission;
|
||||||
if (settings.combat){
|
if (settings.combat){
|
||||||
if (permission == 0 && MODULE.getPermission('COMBAT','DISPLAY_ALL_NAMES') == false) txt = "";
|
if (permission == 0 && getPermission('COMBAT','DISPLAY_ALL_NAMES') == false) txt = "";
|
||||||
else if (permission == 1 && MODULE.getPermission('COMBAT','DISPLAY_LIMITED_NAME') == false) txt = "";
|
else if (permission == 1 && getPermission('COMBAT','DISPLAY_LIMITED_NAME') == false) txt = "";
|
||||||
else if (permission == 2 && MODULE.getPermission('COMBAT','DISPLAY_OBSERVER_NAME') == false) txt = "";
|
else if (permission == 2 && getPermission('COMBAT','DISPLAY_OBSERVER_NAME') == false) txt = "";
|
||||||
|
|
||||||
if (permission == 0 && stats == 'HP') stats = 'none';
|
if (permission == 0 && stats == 'HP') stats = 'none';
|
||||||
else if (stats == 'HP' && permission == 1 && MODULE.getPermission('COMBAT','DISPLAY_LIMITED_HP') == false) stats = 'none';
|
else if (stats == 'HP' && permission == 1 && getPermission('COMBAT','DISPLAY_LIMITED_HP') == false) stats = 'none';
|
||||||
else if (stats == 'HP' && permission == 2 && MODULE.getPermission('COMBAT','DISPLAY_OBSERVER_HP') == false) stats = 'none';
|
else if (stats == 'HP' && permission == 2 && getPermission('COMBAT','DISPLAY_OBSERVER_HP') == false) stats = 'none';
|
||||||
else if (stats != 'HP' && permission < 3 && MODULE.getPermission('COMBAT','DISPLAY_NON_OWNED_STATS') == false) stats = 'none';
|
else if (stats != 'HP' && permission < 3 && getPermission('COMBAT','DISPLAY_NON_OWNED_STATS') == false) stats = 'none';
|
||||||
}
|
}
|
||||||
else if (MODULE.getPermission('TOKEN','STATS') == false) {
|
else if (getPermission('TOKEN','STATS') == false) {
|
||||||
statsOld = stats;
|
statsOld = stats;
|
||||||
stats = 'none';
|
stats = 'none';
|
||||||
}
|
}
|
||||||
@@ -77,21 +77,7 @@ export class TokenControl{
|
|||||||
|
|
||||||
if (stats == 'custom'){
|
if (stats == 'custom'){
|
||||||
const custom = settings.custom ? settings.custom : '';
|
const custom = settings.custom ? settings.custom : '';
|
||||||
let split = custom.split('[');
|
txt += this.decodeCustomStat(custom, token);
|
||||||
for (let i=0; i<split.length; i++) split[i] = split[i].split(']');
|
|
||||||
for (let i=0; i<split.length; i++)
|
|
||||||
for (let j=0; j<split[i].length; j++){
|
|
||||||
if (split[i][j][0] != '@') txt += split[i][j];
|
|
||||||
else {
|
|
||||||
const dataPath = split[i][j].split('@')[1].split('.');
|
|
||||||
let data = token;
|
|
||||||
|
|
||||||
for (let i=0; i<dataPath.length; i++)
|
|
||||||
data = data?.[dataPath[i]];
|
|
||||||
if (data == undefined) txt += '[undef]';
|
|
||||||
else txt += data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats == 'HP' || stats == 'Wounds') {
|
if (stats == 'HP' || stats == 'Wounds') {
|
||||||
@@ -106,6 +92,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;
|
||||||
@@ -136,6 +175,13 @@ export class TokenControl{
|
|||||||
heart: "#00FF00"
|
heart: "#00FF00"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (stats == 'Stamina') { //starfinder
|
||||||
|
const stamina = tokenHelper.getStamina(token);
|
||||||
|
txt += `${stamina.value}/${stamina.max}`;
|
||||||
|
}
|
||||||
|
else if (stats == 'KinAC') { //starfinder
|
||||||
|
txt += tokenHelper.getKinAC(token);
|
||||||
|
}
|
||||||
else if (stats == 'AC') txt += tokenHelper.getAC(token);
|
else if (stats == 'AC') txt += tokenHelper.getAC(token);
|
||||||
else if (stats == 'ShieldHP') txt += tokenHelper.getShieldHP(token);
|
else if (stats == 'ShieldHP') txt += tokenHelper.getShieldHP(token);
|
||||||
else if (stats == 'Speed') txt += tokenHelper.getSpeed(token);
|
else if (stats == 'Speed') txt += tokenHelper.getSpeed(token);
|
||||||
@@ -144,8 +190,16 @@ export class TokenControl{
|
|||||||
else if (stats == 'PassiveInvestigation') txt += tokenHelper.getPassiveInvestigation(token);
|
else if (stats == 'PassiveInvestigation') txt += tokenHelper.getPassiveInvestigation(token);
|
||||||
else if (stats == 'Ability') txt += tokenHelper.getAbility(token, settings.ability);
|
else if (stats == 'Ability') txt += tokenHelper.getAbility(token, settings.ability);
|
||||||
else if (stats == 'AbilityMod') txt += tokenHelper.getAbilityModifier(token, settings.ability);
|
else if (stats == 'AbilityMod') txt += tokenHelper.getAbilityModifier(token, settings.ability);
|
||||||
else if (stats == 'Save') txt += tokenHelper.getAbilitySave(token, settings.save);
|
else if (stats == 'Save') {
|
||||||
else if (stats == 'Skill') txt += tokenHelper.getSkill(token, settings.skill);
|
txt += tokenHelper.getAbilitySave(token, settings.save);
|
||||||
|
ringColor = tokenHelper.getSaveRingColor(token, settings.save);
|
||||||
|
if (ringColor != undefined) ring = 2;
|
||||||
|
}
|
||||||
|
else if (stats == 'Skill') {
|
||||||
|
txt += tokenHelper.getSkill(token, settings.skill);
|
||||||
|
ringColor = tokenHelper.getSkillRingColor(token, settings.skill);
|
||||||
|
if (ringColor != undefined) ring = 2;
|
||||||
|
}
|
||||||
else if (stats == 'Prof') txt += tokenHelper.getProficiency(token);
|
else if (stats == 'Prof') txt += tokenHelper.getProficiency(token);
|
||||||
else if (stats == 'Fate') txt += tokenHelper.getFate(token) /* WFRP4e */
|
else if (stats == 'Fate') txt += tokenHelper.getFate(token) /* WFRP4e */
|
||||||
else if (stats == 'Fortune') txt += tokenHelper.getFortune(token) /* WFRP4e */
|
else if (stats == 'Fortune') txt += tokenHelper.getFortune(token) /* WFRP4e */
|
||||||
@@ -162,12 +216,12 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (settings.onClick == 'visibility') { //toggle visibility
|
if (settings.onClick == 'visibility') { //toggle visibility
|
||||||
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) {
|
if (getPermission('TOKEN','VISIBILITY') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ring = 1;
|
ring = 1;
|
||||||
if (token.data.hidden){
|
if (token.document.hidden){
|
||||||
ring = 2;
|
ring = 2;
|
||||||
ringColor = "#FF7B00";
|
ringColor = "#FF7B00";
|
||||||
}
|
}
|
||||||
@@ -177,7 +231,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'combatState') { //toggle combat state
|
else if (settings.onClick == 'combatState') { //toggle combat state
|
||||||
if (MODULE.getPermission('TOKEN','COMBAT') == false ) {
|
if (getPermission('TOKEN','COMBAT') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -202,7 +256,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'condition') { //handle condition
|
else if (settings.onClick == 'condition') { //handle condition
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) {
|
if (getPermission('TOKEN','CONDITIONS') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -217,7 +271,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'cubCondition') { //Combat Utility Belt conditions
|
else if (settings.onClick == 'cubCondition') { //Combat Utility Belt conditions
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) {
|
if (getPermission('TOKEN','CONDITIONS') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -234,7 +288,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'wildcard') { //wildcard images
|
else if (settings.onClick == 'wildcard') { //wildcard images
|
||||||
if (MODULE.getPermission('TOKEN','WILDCARD') == false ) {
|
if (getPermission('TOKEN','WILDCARD') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -247,7 +301,7 @@ export class TokenControl{
|
|||||||
let currentImgNr = 0
|
let currentImgNr = 0
|
||||||
let imgNr;
|
let imgNr;
|
||||||
for (let i=0; i<images.length; i++)
|
for (let i=0; i<images.length; i++)
|
||||||
if (images[i] == token.data.img){
|
if (images[i] == tokenHelper.getTokenIcon(token)){
|
||||||
currentImgNr = i;
|
currentImgNr = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -273,32 +327,61 @@ export class TokenControl{
|
|||||||
else if (settings.onClick == 'initiative') //Initiative
|
else if (settings.onClick == 'initiative') //Initiative
|
||||||
iconSrc = "modules/MaterialDeck/img/token/init.png";
|
iconSrc = "modules/MaterialDeck/img/token/init.png";
|
||||||
}
|
}
|
||||||
|
else if (mode == 'offset') {
|
||||||
|
iconSrc = "modules/MaterialDeck/img/black.png";
|
||||||
|
const itemOffset = settings.itemOffset ? settings.itemOffset : 0;
|
||||||
|
ringColor = settings.offRing ? settings.offRing : '#000000';
|
||||||
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
|
ring = 1;
|
||||||
|
if (itemOffset == this.itemOffset) {
|
||||||
|
|
||||||
|
ring = 2;
|
||||||
|
ringColor = ringOnColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (mode == 'offsetRel') {
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (mode == 'dispOffset') {
|
||||||
|
iconSrc = "modules/MaterialDeck/img/black.png";
|
||||||
|
const prependTitle = settings.offsetPrepend ? settings.offsetPrepend : '';
|
||||||
|
txt += prependTitle + this.itemOffset;
|
||||||
|
}
|
||||||
//Items
|
//Items
|
||||||
else {
|
else {
|
||||||
txt += prependTitle;
|
txt += prependTitle;
|
||||||
const allItems = token.actor.items;
|
const allItems = token.actor.items;
|
||||||
const itemNr = settings.itemNr ? settings.itemNr - 1 : 0;
|
let itemNr = settings.itemNr ? settings.itemNr - 1 : 0;
|
||||||
|
itemNr += this.itemOffset;
|
||||||
const displayUses = settings.displayUses ? settings.displayUses : false;
|
const displayUses = settings.displayUses ? settings.displayUses : false;
|
||||||
const displayName = settings.displayInventoryName ? settings.displayInventoryName : false;
|
const displayName = settings.displayInventoryName ? settings.displayInventoryName : false;
|
||||||
const displayIcon = settings.displayInventoryIcon ? settings.displayInventoryIcon : false;
|
const displayIcon = settings.displayInventoryIcon ? settings.displayInventoryIcon : false;
|
||||||
|
const selectionMode = settings.inventorySelection ? settings.inventorySelection : 'order';
|
||||||
let items = allItems;
|
let items = allItems;
|
||||||
let item;
|
let item;
|
||||||
if (mode == 'inventory') {
|
if (mode == 'inventory') {
|
||||||
items = tokenHelper.getItems(token,settings.inventoryType);
|
items = tokenHelper.getItems(token,settings.inventoryType);
|
||||||
items = this.sortItems(items);
|
items = this.sortItems(items);
|
||||||
item = items[itemNr];
|
if (selectionMode == 'order') item = items[itemNr];
|
||||||
|
else if (selectionMode == 'name') item = items.filter(i => i.name == settings.itemName)[0];
|
||||||
|
else if (selectionMode == 'id') item = items.filter(i => i.id == settings.itemName)[0];
|
||||||
|
|
||||||
if (item != undefined && displayUses) uses = tokenHelper.getItemUses(item);
|
if (item != undefined && displayUses) uses = tokenHelper.getItemUses(item);
|
||||||
}
|
}
|
||||||
else if (mode == 'features') {
|
else if (mode == 'features') {
|
||||||
items = tokenHelper.getFeatures(token,settings.featureType);
|
items = tokenHelper.getFeatures(token,settings.featureType);
|
||||||
items = this.sortItems(items);
|
items = this.sortItems(items);
|
||||||
item = items[itemNr];
|
if (selectionMode == 'order') item = items[itemNr];
|
||||||
|
else if (selectionMode == 'name') item = items.filter(i => i.name == settings.itemName)[0];
|
||||||
|
else if (selectionMode == 'id') item = items.filter(i => i.id == settings.itemName)[0];
|
||||||
if (item != undefined && displayUses) uses = tokenHelper.getFeatureUses(item);
|
if (item != undefined && displayUses) uses = tokenHelper.getFeatureUses(item);
|
||||||
}
|
}
|
||||||
else if (mode == 'spellbook') {
|
else if (mode == 'spellbook') {
|
||||||
items = tokenHelper.getSpells(token,settings.spellType);
|
items = tokenHelper.getSpells(token,settings.spellType,settings.spellMode);
|
||||||
items = this.sortItems(items);
|
items = this.sortItems(items);
|
||||||
item = items[itemNr];
|
if (selectionMode == 'order') item = items[itemNr];
|
||||||
|
else if (selectionMode == 'name') item = items.filter(i => i.name == settings.itemName)[0];
|
||||||
|
else if (selectionMode == 'id') item = items.filter(i => i.id == settings.itemName)[0];
|
||||||
if (displayUses && item != undefined) uses = tokenHelper.getSpellUses(token,settings.spellType,item);
|
if (displayUses && item != undefined) uses = tokenHelper.getSpellUses(token,settings.spellType,item);
|
||||||
}
|
}
|
||||||
if (item != undefined) {
|
if (item != undefined) {
|
||||||
@@ -313,7 +396,7 @@ export class TokenControl{
|
|||||||
if (mode == 'token') {
|
if (mode == 'token') {
|
||||||
iconSrc += "";
|
iconSrc += "";
|
||||||
if (settings.onClick == 'visibility') { //toggle visibility
|
if (settings.onClick == 'visibility') { //toggle visibility
|
||||||
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) {
|
if (getPermission('TOKEN','VISIBILITY') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -324,7 +407,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'combatState') { //toggle combat state
|
else if (settings.onClick == 'combatState') { //toggle combat state
|
||||||
if (MODULE.getPermission('TOKEN','COMBAT') == false ) {
|
if (getPermission('TOKEN','COMBAT') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -342,7 +425,7 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'condition') { //toggle condition
|
else if (settings.onClick == 'condition') { //toggle condition
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) {
|
if (getPermission('TOKEN','CONDITIONS') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -351,7 +434,7 @@ export class TokenControl{
|
|||||||
if (icon == 'stats') iconSrc = tokenHelper.getConditionIcon(settings.condition);
|
if (icon == 'stats') iconSrc = tokenHelper.getConditionIcon(settings.condition);
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'cubCondition') { //Combat Utility Belt conditions
|
else if (settings.onClick == 'cubCondition') { //Combat Utility Belt conditions
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) {
|
if (getPermission('TOKEN','CONDITIONS') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -366,13 +449,13 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon == 'stats'){
|
if (icon == 'stats' && mode != 'offset' && mode != 'offsetRel'){
|
||||||
if (MODULE.getPermission('TOKEN','STATS') == false) stats = statsOld;
|
if (getPermission('TOKEN','STATS') == false) stats = statsOld;
|
||||||
if (stats == 'HP') //HP
|
if (stats == 'HP') //HP
|
||||||
iconSrc = "modules/MaterialDeck/img/token/hp_empty.png";
|
iconSrc = "modules/MaterialDeck/img/token/hp_empty.png";
|
||||||
if (stats == 'TempHP') //Temp HP
|
if (stats == 'TempHP') //Temp HP
|
||||||
iconSrc = "modules/MaterialDeck/img/token/temp_hp_empty.png";
|
iconSrc = "modules/MaterialDeck/img/token/temp_hp_empty.png";
|
||||||
else if (stats == 'AC' || stats == 'ShieldHP') //AC
|
else if (stats == 'AC' || stats == 'ShieldHP' || stats == 'KinAC') //AC
|
||||||
iconSrc = "modules/MaterialDeck/img/token/ac.webp";
|
iconSrc = "modules/MaterialDeck/img/token/ac.webp";
|
||||||
else if (stats == 'Speed') //Speed
|
else if (stats == 'Speed') //Speed
|
||||||
iconSrc = "modules/MaterialDeck/img/token/speed.webp";
|
iconSrc = "modules/MaterialDeck/img/token/speed.webp";
|
||||||
@@ -390,7 +473,6 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (stats == 'Ability' || stats == 'AbilityMod' || stats == 'Save') {
|
else if (stats == 'Ability' || stats == 'AbilityMod' || stats == 'Save') {
|
||||||
overlay = true;
|
overlay = true;
|
||||||
ring = 1;
|
|
||||||
let ability = (stats == 'Save') ? settings.save : settings.ability;
|
let ability = (stats == 'Save') ? settings.save : settings.ability;
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
if (ability == 'con') iconSrc = "modules/MaterialDeck/img/token/abilities/cons.png";
|
if (ability == 'con') iconSrc = "modules/MaterialDeck/img/token/abilities/cons.png";
|
||||||
@@ -398,10 +480,9 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
else if (stats == 'Skill') {
|
else if (stats == 'Skill') {
|
||||||
overlay = true;
|
overlay = true;
|
||||||
ring = 1;
|
|
||||||
let skill = settings.skill;
|
let skill = settings.skill;
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
else iconSrc = "modules/MaterialDeck/img/token/skills/" + skill + ".png";
|
else iconSrc = "modules/MaterialDeck/img/token/skills/" + (skill.startsWith('lor')? 'lor' : skill) + ".png";
|
||||||
}
|
}
|
||||||
else if (settings.onClick == 'center' || settings.onClick == 'centerSelect') {
|
else if (settings.onClick == 'center' || settings.onClick == 'centerSelect') {
|
||||||
overlay = true;
|
overlay = true;
|
||||||
@@ -436,13 +517,20 @@ export class TokenControl{
|
|||||||
iconSrc = "modules/MaterialDeck/img/move/rotateccw.png";
|
iconSrc = "modules/MaterialDeck/img/move/rotateccw.png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (forceIcon) {
|
||||||
|
iconSrc = forceIcon;
|
||||||
|
txt = "";
|
||||||
|
}
|
||||||
|
else if (hideName) txt = "";
|
||||||
|
if (settings.iconOverride != '' && settings.iconOverride != undefined) iconSrc = settings.iconOverride;
|
||||||
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:ring,ringColor:ringColor,overlay:overlay,uses:uses,hp:hp});
|
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:ring,ringColor:ringColor,overlay:overlay,uses:uses,hp:hp});
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
}
|
}
|
||||||
|
|
||||||
sortItems(items) {
|
sortItems(items) {
|
||||||
let sorted = Object.values(items);
|
let sorted = Object.values(items);
|
||||||
sorted.sort((a,b) => a.data.sort - b.data.sort);
|
sorted.sort((a,b) => a.sort - b.sort);
|
||||||
return sorted;
|
return sorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,13 +543,11 @@ export class TokenControl{
|
|||||||
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
|
||||||
const mode = settings.tokenMode ? settings.tokenMode : 'token';
|
const mode = settings.tokenMode ? settings.tokenMode : 'token';
|
||||||
|
|
||||||
let token;
|
let token = tokenHelper.getToken(selection,tokenIdentifier);
|
||||||
if (selection == 'selected') token = canvas.tokens.controlled[0];
|
|
||||||
else token = tokenHelper.getToken(selection,tokenIdentifier);
|
|
||||||
|
|
||||||
if (token == undefined) return;
|
if (token == undefined) return;
|
||||||
if (token.owner == false && token.observer == true && MODULE.getPermission('TOKEN','OBSERVER') == false ) return;
|
if (token.owner == false && token.observer == true && getPermission('TOKEN','OBSERVER') == false ) return;
|
||||||
if (token.owner == false && token.observer == false && MODULE.getPermission('TOKEN','NON_OWNED') == false ) return;
|
if (token.owner == false && token.observer == false && getPermission('TOKEN','NON_OWNED') == false ) return;
|
||||||
|
|
||||||
if (mode == 'token') {
|
if (mode == 'token') {
|
||||||
|
|
||||||
@@ -498,18 +584,18 @@ export class TokenControl{
|
|||||||
else token.sheet.close();
|
else token.sheet.close();
|
||||||
}
|
}
|
||||||
else if (onClick == 'visibility') { //Toggle visibility
|
else if (onClick == 'visibility') { //Toggle visibility
|
||||||
if (MODULE.getPermission('TOKEN','VISIBILITY') == false ) return;
|
if (getPermission('TOKEN','VISIBILITY') == false ) return;
|
||||||
token.toggleVisibility();
|
token.toggleVisibility();
|
||||||
}
|
}
|
||||||
else if (onClick == 'combatState') { //Toggle combat state
|
else if (onClick == 'combatState') { //Toggle combat state
|
||||||
if (MODULE.getPermission('TOKEN','COMBAT') == false ) return;
|
if (getPermission('TOKEN','COMBAT') == false ) return;
|
||||||
token.toggleCombat();
|
token.toggleCombat();
|
||||||
}
|
}
|
||||||
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') { //Handle condition
|
else if (onClick == 'condition') { //Handle condition
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) return;
|
if (getPermission('TOKEN','CONDITIONS') == false ) return;
|
||||||
const func = settings.conditionFunction ? settings.conditionFunction : 'toggle';
|
const func = settings.conditionFunction ? settings.conditionFunction : 'toggle';
|
||||||
|
|
||||||
if (func == 'toggle'){ //toggle
|
if (func == 'toggle'){ //toggle
|
||||||
@@ -527,7 +613,7 @@ export class TokenControl{
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (onClick == 'cubCondition') { //Combat Utility Belt conditions
|
else if (onClick == 'cubCondition') { //Combat Utility Belt conditions
|
||||||
if (MODULE.getPermission('TOKEN','CONDITIONS') == false ) return;
|
if (getPermission('TOKEN','CONDITIONS') == false ) return;
|
||||||
const condition = settings.cubConditionName;
|
const condition = settings.cubConditionName;
|
||||||
if (condition == undefined || condition == '') return;
|
if (condition == undefined || condition == '') return;
|
||||||
const effect = CONFIG.statusEffects.find(e => e.label === condition);
|
const effect = CONFIG.statusEffects.find(e => e.label === condition);
|
||||||
@@ -535,50 +621,93 @@ export class TokenControl{
|
|||||||
this.update(tokenId);
|
this.update(tokenId);
|
||||||
}
|
}
|
||||||
else if (onClick == 'vision'){
|
else if (onClick == 'vision'){
|
||||||
if (MODULE.getPermission('TOKEN','VISION') == false ) return;
|
if (getPermission('TOKEN','VISION') == false ) return;
|
||||||
const token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
|
||||||
if (token == undefined) return;
|
|
||||||
let tokenData = token.data;
|
|
||||||
|
|
||||||
const dimVision = parseInt(settings.dimVision);
|
let sight = {};
|
||||||
const brightVision = parseInt(settings.brightVision);
|
let light = {
|
||||||
const sightAngle = parseInt(settings.sightAngle);
|
animation: {}
|
||||||
const dimRadius = parseInt(settings.dimRadius);
|
|
||||||
const brightRadius = parseInt(settings.brightRadius);
|
|
||||||
const emissionAngle = parseInt(settings.emissionAngle);
|
|
||||||
const lightColor = settings.lightColor ? settings.lightColor : '#000000';
|
|
||||||
const colorIntensity = isNaN(parseInt(settings.colorIntensity)) ? 0 : parseInt(settings.colorIntensity)/100;
|
|
||||||
const animationType = settings.animationType ? settings.animationType : 'none';
|
|
||||||
const animationSpeed = isNaN(parseInt(settings.animationSpeed)) ? 1 : parseInt(settings.animationSpeed);
|
|
||||||
const animationIntensity = isNaN(parseInt(settings.animationIntensity)) ? 1 : parseInt(settings.animationIntensity);
|
|
||||||
|
|
||||||
let data = {};
|
|
||||||
if (isNaN(dimVision)==false) data.dimSight = dimVision;
|
|
||||||
if (isNaN(brightVision)==false) data.brightSight = brightVision;
|
|
||||||
if (isNaN(sightAngle)==false) data.sightAngle = sightAngle;
|
|
||||||
if (isNaN(dimRadius)==false) data.dimLight = dimRadius;
|
|
||||||
if (isNaN(brightRadius)==false) data.brightLight = brightRadius;
|
|
||||||
if (isNaN(emissionAngle)==false) data.lightAngle = emissionAngle;
|
|
||||||
data.lightColor = lightColor;
|
|
||||||
data.lightAlpha = Math.sqrt(colorIntensity).toNearest(0.05)
|
|
||||||
let animation = {
|
|
||||||
type: '',
|
|
||||||
speed: tokenData.lightAnimation.speed,
|
|
||||||
intensity: tokenData.lightAnimation.intensity
|
|
||||||
};
|
|
||||||
if (animationType != 'none'){
|
|
||||||
animation.type = animationType;
|
|
||||||
animation.intensity = animationIntensity;
|
|
||||||
animation.speed = animationSpeed;
|
|
||||||
}
|
}
|
||||||
data.lightAnimation = animation;
|
|
||||||
token.update(data);
|
//Vision basic config
|
||||||
|
if (settings.visionEnabled && settings.visionEnabled != 'noChange') {
|
||||||
|
if (settings.visionEnabled == 'toggle')
|
||||||
|
sight.enabled = !token.document.sight.enabled;
|
||||||
|
else
|
||||||
|
sight.enabled = settings.visionEnabled == 'enable';
|
||||||
|
}
|
||||||
|
if (settings.visionRange && isNaN(settings.visionRange) == false) sight.range = parseInt(settings.visionRange);
|
||||||
|
if (settings.visionDimRange && isNaN(settings.visionDimRange) == false) sight.dimSight = parseInt(settings.visionDimRange);
|
||||||
|
if (settings.visionBrightRange && isNaN(settings.visionBrightRange) == false) sight.brightSight = parseInt(settings.visionBrightRange);
|
||||||
|
if (settings.visionAngle && isNaN(settings.visionAngle) == false) sight.angle = parseInt(settings.visionAngle);
|
||||||
|
if (settings.visionMode && settings.visionMode != 'noChange') sight.visionMode = settings.visionMode;
|
||||||
|
|
||||||
|
//Vision detection modes
|
||||||
|
let detectionModes = token.document.detectionModes;
|
||||||
|
if (settings.visionDetectionModeEnable && settings.visionDetectionModeEnable != 'noChange' && settings.visionDetectionModeNumber && detectionModes[settings.visionDetectionModeNumber-1] != undefined) {
|
||||||
|
if (settings.visionDetectionModeEnable == 'toggle')
|
||||||
|
detectionModes[settings.visionDetectionModeNumber-1].enabled = !detectionModes[settings.visionDetectionModeNumber-1].enabled;
|
||||||
|
else if (settings.visionDetectionModeEnable == 'enable')
|
||||||
|
detectionModes[settings.visionDetectionModeNumber-1].enabled = true;
|
||||||
|
else if (settings.visionDetectionModeEnable == 'disable')
|
||||||
|
detectionModes[settings.visionDetectionModeNumber-1].enabled = false;
|
||||||
|
detectionModes = detectionModes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Vision advanced options
|
||||||
|
if (settings.visionColorEnable) sight.color = settings.visionColor ? (settings.visionColor == '#000000' ? null : settings.visionColor) : null;
|
||||||
|
if (settings.visionAttenuationEnable) sight.attenuation = settings.visionAttenuation ? parseFloat(settings.visionAttenuation) : 0;
|
||||||
|
if (settings.visionBrightnessEnable) sight.brightness = settings.visionBrightness ? parseFloat(settings.visionBrightness) : 0;
|
||||||
|
if (settings.visionSaturationEnable) sight.saturation = settings.visionSaturation ? parseFloat(settings.visionSaturation) : 0;
|
||||||
|
if (settings.visionContrastEnable) sight.contrast = settings.visionContrast ? parseFloat(settings.visionContrast) : 0;
|
||||||
|
|
||||||
|
//Light basic config
|
||||||
|
if (settings.lightDimRadius && isNaN(settings.lightDimRadius) == false) light.dim = parseInt(settings.lightDimRadius);
|
||||||
|
if (settings.lightBrightRadius && isNaN(settings.lightBrightRadius) == false) light.bright = parseInt(settings.lightBrightRadius);
|
||||||
|
if (settings.lightEmissionAngle && isNaN(settings.lightEmissionAngle) == false) light.angle = parseInt(settings.lightEmissionAngle);
|
||||||
|
if (settings.lightColorEnable) light.color = settings.lightColor ? (settings.lightColor == '#000000' ? null : settings.lightColor) : null;
|
||||||
|
if (settings.lightColorIntensityEnable) light.alpha = settings.lightColorIntensity ? parseFloat(settings.lightColorIntensity) : 0;
|
||||||
|
|
||||||
|
//Light animation
|
||||||
|
if (settings.lightAnimationType && settings.lightAnimationType != 'noChange') light.animation.type = settings.lightAnimationType == 'none' ? null : settings.lightAnimationType;
|
||||||
|
if (settings.lightAnimationSpeedEnable) light.animation.speed = settings.lightAnimationSpeed ? parseFloat(settings.lightAnimationSpeed) : 5;
|
||||||
|
if (settings.lightAnimationReverseDirection && settings.lightAnimationReverseDirection != 'noChange') {
|
||||||
|
if (settings.lightAnimationReverseDirection == 'toggle')
|
||||||
|
light.animation.reverse = !token.document.light.animation.reverse;
|
||||||
|
else if (settings.lightAnimationReverseDirection == 'enable')
|
||||||
|
light.animation.reverse = true;
|
||||||
|
else if (settings.lightAnimationReverseDirection == 'disable')
|
||||||
|
light.animation.reverse = false;
|
||||||
|
}
|
||||||
|
if (settings.lightAnimationIntensityEnable) light.animation.intensity = settings.lightAnimationIntensity ? parseFloat(settings.lightAnimationIntensity) : 5;
|
||||||
|
|
||||||
|
//Light advanced options
|
||||||
|
if (settings.lightColorationTechnique && settings.lightColorationTechnique != 'noChange') light.coloration = parseInt(settings.lightColorationTechnique);
|
||||||
|
if (settings.lightLuminosityEnable) light.luminosity = settings.lightLuminosity ? parseFloat(settings.lightLuminosity) : 0.5;
|
||||||
|
if (settings.lightGradualIllumination && settings.lightGradualIllumination != 'noChange') {
|
||||||
|
if (settings.lightGradualIllumination == 'toggle')
|
||||||
|
light.gradual = !token.data.light.gradual;
|
||||||
|
else if (settings.lightGradualIllumination == 'enable')
|
||||||
|
light.gradual = true;
|
||||||
|
else if (settings.lightGradualIllumination == 'disable')
|
||||||
|
light.gradual = false;
|
||||||
|
}
|
||||||
|
if (settings.lightAttenuationEnable) light.attenuation = settings.lightAttenuation ? parseFloat(settings.lightAttenuation) : 0.5;
|
||||||
|
if (settings.lightSaturationEnable) light.saturation = settings.lightSaturation ? parseFloat(settings.lightSaturation) : 0;
|
||||||
|
if (settings.lightContrastEnable) light.contrast = settings.lightContrast ? parseFloat(settings.lightContrast) : 0;
|
||||||
|
if (settings.lightShadowsEnable) light.shadows = settings.lightShadows ? parseFloat(settings.lightShadows) : 0;
|
||||||
|
|
||||||
|
let data;
|
||||||
|
data = {
|
||||||
|
sight,
|
||||||
|
light
|
||||||
|
}
|
||||||
|
token.document.update(data);
|
||||||
}
|
}
|
||||||
else if (onClick == 'initiative'){
|
else if (onClick == 'initiative'){
|
||||||
tokenHelper.toggleInitiative(token);
|
tokenHelper.toggleInitiative(token);
|
||||||
}
|
}
|
||||||
else if (onClick == 'wildcard') { //wildcard images
|
else if (onClick == 'wildcard') { //wildcard images
|
||||||
if (MODULE.getPermission('TOKEN','WILDCARD') == false ) return;
|
if (getPermission('TOKEN','WILDCARD') == false ) return;
|
||||||
const method = settings.wildcardMethod ? settings.wildcardMethod : 'iterate';
|
const method = settings.wildcardMethod ? settings.wildcardMethod : 'iterate';
|
||||||
let value = parseInt(settings.wildcardValue);
|
let value = parseInt(settings.wildcardValue);
|
||||||
if (isNaN(value)) value = 1;
|
if (isNaN(value)) value = 1;
|
||||||
@@ -589,7 +718,7 @@ export class TokenControl{
|
|||||||
if (method == 'iterate'){
|
if (method == 'iterate'){
|
||||||
let currentImgNr = 0
|
let currentImgNr = 0
|
||||||
for (let i=0; i<images.length; i++)
|
for (let i=0; i<images.length; i++)
|
||||||
if (images[i] == token.data.img){
|
if (images[i] == tokenHelper.getTokenIcon(token)){
|
||||||
currentImgNr = i;
|
currentImgNr = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -610,7 +739,7 @@ export class TokenControl{
|
|||||||
else return;
|
else return;
|
||||||
|
|
||||||
iconSrc = images[imgNr];
|
iconSrc = images[imgNr];
|
||||||
token.update({img: iconSrc})
|
token.document.update({img: iconSrc});
|
||||||
}
|
}
|
||||||
else if (onClick == 'macro') { //call a macro
|
else if (onClick == 'macro') { //call a macro
|
||||||
const settingsNew = {
|
const settingsNew = {
|
||||||
@@ -637,7 +766,7 @@ export class TokenControl{
|
|||||||
if (otherControls.rollOption != 'dialog') otherControls.setRollOption('normal');
|
if (otherControls.rollOption != 'dialog') otherControls.setRollOption('normal');
|
||||||
}
|
}
|
||||||
else if (onClick == 'custom') {//custom onClick function
|
else if (onClick == 'custom') {//custom onClick function
|
||||||
if (MODULE.getPermission('TOKEN','CUSTOM') == false ) return;
|
if (getPermission('TOKEN','CUSTOM') == false ) return;
|
||||||
const formula = settings.customOnClickFormula ? settings.customOnClickFormula : '';
|
const formula = settings.customOnClickFormula ? settings.customOnClickFormula : '';
|
||||||
if (formula == '') return;
|
if (formula == '') return;
|
||||||
|
|
||||||
@@ -753,7 +882,7 @@ export class TokenControl{
|
|||||||
if (path != '') path += '.';
|
if (path != '') path += '.';
|
||||||
path += targetArray[i][j];
|
path += targetArray[i][j];
|
||||||
}
|
}
|
||||||
await token.update({[path]:value})
|
await token.document.update({[path]:value});
|
||||||
this.update(token.id);
|
this.update(token.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,9 +890,21 @@ export class TokenControl{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (mode == 'offset') {
|
||||||
|
const itemOffset = settings.itemOffset ? settings.itemOffset : 0;
|
||||||
|
this.itemOffset = parseInt(itemOffset);
|
||||||
|
this.update(tokenId);
|
||||||
|
}
|
||||||
|
else if (mode == 'offsetRel') {
|
||||||
|
const itemOffset = settings.itemOffset ? settings.itemOffset : 0;
|
||||||
|
this.itemOffset += parseInt(itemOffset);
|
||||||
|
this.update(tokenId);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
const allItems = token.actor.items;
|
const allItems = token.actor.items;
|
||||||
const itemNr = settings.itemNr ? settings.itemNr - 1 : 0;
|
let itemNr = settings.itemNr ? settings.itemNr - 1 : 0;
|
||||||
|
itemNr += this.itemOffset;
|
||||||
|
const selectionMode = settings.inventorySelection ? settings.inventorySelection : 'order';
|
||||||
let items = allItems;
|
let items = allItems;
|
||||||
if (mode == 'inventory') {
|
if (mode == 'inventory') {
|
||||||
items = tokenHelper.getItems(token,settings.inventoryType);
|
items = tokenHelper.getItems(token,settings.inventoryType);
|
||||||
@@ -775,10 +916,12 @@ export class TokenControl{
|
|||||||
items = tokenHelper.getSpells(token,settings.spellType);
|
items = tokenHelper.getSpells(token,settings.spellType);
|
||||||
}
|
}
|
||||||
items = this.sortItems(items);
|
items = this.sortItems(items);
|
||||||
|
let item;
|
||||||
const item = items[itemNr];
|
if (selectionMode == 'order') item = items[itemNr];
|
||||||
|
else if (selectionMode == 'name') item = items.filter(i => i.name == settings.itemName)[0];
|
||||||
|
else if (selectionMode == 'id') item = items.filter(i => i.id == settings.itemName)[0];
|
||||||
if (item != undefined) {
|
if (item != undefined) {
|
||||||
tokenHelper.rollItem(item);
|
tokenHelper.rollItem(item, settings, otherControls.rollOption, otherControls.attackMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -818,4 +961,64 @@ export class TokenControl{
|
|||||||
pf2eCondition(condition){
|
pf2eCondition(condition){
|
||||||
return "systems/pf2e/icons/conditions-2/" + condition + ".png";
|
return "systems/pf2e/icons/conditions-2/" + condition + ".png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decodeCustomStat(custom, token) {
|
||||||
|
let txt = "";
|
||||||
|
|
||||||
|
let split = custom.split(/\[|\]/g)
|
||||||
|
|
||||||
|
for (let segment of split) {
|
||||||
|
if (segment.startsWith('if')) {
|
||||||
|
let ifA;
|
||||||
|
let ifMode;
|
||||||
|
let ifB;
|
||||||
|
let ifThen;
|
||||||
|
let ifElse;
|
||||||
|
|
||||||
|
let spaceSplit = segment.split(' ');
|
||||||
|
let count = 0;
|
||||||
|
for (let segment of spaceSplit) {
|
||||||
|
if (segment.startsWith('if')) ifA = this.decodeIfSegment(segment, token);
|
||||||
|
else if (segment.startsWith('then')) ifThen = this.decodeIfSegment(segment, token);
|
||||||
|
else if (segment.startsWith('else')) ifElse = this.decodeIfSegment(segment, token);
|
||||||
|
else {
|
||||||
|
segment = segment.split(')')[0];
|
||||||
|
if (count == 1) ifMode = segment;
|
||||||
|
else if (count == 2) ifB = segment.startsWith('@') ? this.getCustomDataPath(segment, token) : segment;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ifMode == '>') txt += ifA > ifB ? ifThen : ifElse;
|
||||||
|
else if (ifMode == '>=') txt += ifA >= ifB ? ifThen : ifElse;
|
||||||
|
else if (ifMode == '<') txt += ifA < ifB ? ifThen : ifElse;
|
||||||
|
else if (ifMode == '<=') txt += ifA <= ifB ? ifThen : ifElse;
|
||||||
|
else if (ifMode == '==') txt += ifA == ifB ? ifThen : ifElse;
|
||||||
|
}
|
||||||
|
else if (segment.startsWith('@')) txt += this.getCustomDataPath(segment, token);
|
||||||
|
else txt += segment;
|
||||||
|
}
|
||||||
|
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
decodeIfSegment(segment, token) {
|
||||||
|
let split = segment.split(/\(|\)/g);
|
||||||
|
if (split[1].startsWith('@')) return this.getCustomDataPath(split[1], token);
|
||||||
|
return split[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
getCustomDataPath(path, token) {
|
||||||
|
const dataPath = path.split('@')[1].split('.');
|
||||||
|
let data;
|
||||||
|
if (dataPath[0] == 'actor') data = token.actor;
|
||||||
|
else if (dataPath[0] == 'token') data = token;
|
||||||
|
|
||||||
|
for (let i=1; i<dataPath.length; i++) {
|
||||||
|
data = data?.[dataPath[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data == undefined) return '[undef]';
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
340
src/misc.js
@@ -1,14 +1,34 @@
|
|||||||
import {sdVersion, msVersion, moduleName, getPermission, enableModule} from "../MaterialDeck.js";
|
import { sdVersion, msVersion, moduleName, getPermission, enableModule, streamDeck, macroControl,soundboard,playlistControl, minimumMSversion, minimumSDversion } from "../MaterialDeck.js";
|
||||||
import {macroControl,soundboard,playlistControl} from "../MaterialDeck.js";
|
|
||||||
|
export function compareVersions(checkedVersion, requiredVersion) {
|
||||||
|
requiredVersion = requiredVersion.split(".");
|
||||||
|
checkedVersion = checkedVersion.split(".");
|
||||||
|
|
||||||
|
for (let i=0; i<3; i++) {
|
||||||
|
requiredVersion[i] = isNaN(parseInt(requiredVersion[i])) ? 0 : parseInt(requiredVersion[i]);
|
||||||
|
checkedVersion[i] = isNaN(parseInt(checkedVersion[i])) ? 0 : parseInt(checkedVersion[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkedVersion[0] > requiredVersion[0]) return false;
|
||||||
|
if (checkedVersion[0] < requiredVersion[0]) return true;
|
||||||
|
if (checkedVersion[1] > requiredVersion[1]) return false;
|
||||||
|
if (checkedVersion[1] < requiredVersion[1]) return true;
|
||||||
|
if (checkedVersion[2] > requiredVersion[2]) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
export function compatibleCore(compatibleVersion){
|
export function compatibleCore(compatibleVersion){
|
||||||
let coreVersion = game.data.version;
|
const split = compatibleVersion.split(".");
|
||||||
coreVersion = coreVersion.split(".");
|
if (split.length == 2) compatibleVersion = `0.${compatibleVersion}`;
|
||||||
compatibleVersion = compatibleVersion.split(".");
|
let coreVersion = game.version == undefined ? game.data.version : `0.${game.version}`;
|
||||||
if (compatibleVersion[0] > coreVersion[0]) return false;
|
return compareVersions(compatibleVersion, coreVersion);
|
||||||
if (compatibleVersion[1] > coreVersion[1]) return false;
|
}
|
||||||
if (compatibleVersion[2] > coreVersion[2]) return false;
|
|
||||||
return true;
|
export function compatibleSystem(compatibleVersion){
|
||||||
|
const split = compatibleVersion.split(".");
|
||||||
|
if (split.length == 2) compatibleVersion = `0.${compatibleVersion}`;
|
||||||
|
let coreVersion = game.system.version;
|
||||||
|
return compareVersions(coreVersion, compatibleVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class playlistConfigForm extends FormApplication {
|
export class playlistConfigForm extends FormApplication {
|
||||||
@@ -76,7 +96,7 @@ export class playlistConfigForm extends FormApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
playlists: compatibleCore("0.8.1") ? game.playlists.contents : game.playlists.entities,
|
playlists: game.playlists.contents,
|
||||||
numberOfPlaylists: numberOfPlaylists,
|
numberOfPlaylists: numberOfPlaylists,
|
||||||
playlistData: playlistData,
|
playlistData: playlistData,
|
||||||
playMode: playMode
|
playMode: playMode
|
||||||
@@ -154,7 +174,7 @@ export class macroConfigForm extends FormApplication {
|
|||||||
*/
|
*/
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
id: "macro-config",
|
id: "materialDeck_macroConfig",
|
||||||
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.MacroConfig"),
|
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.MacroConfig"),
|
||||||
template: "./modules/MaterialDeck/templates/macroConfig.html",
|
template: "./modules/MaterialDeck/templates/macroConfig.html",
|
||||||
classes: ["sheet"]
|
classes: ["sheet"]
|
||||||
@@ -170,29 +190,38 @@ export class macroConfigForm extends FormApplication {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Get the settings
|
//Get the settings
|
||||||
var selectedMacros = game.settings.get(moduleName,'macroSettings').macros;
|
const settings = game.settings.get(moduleName,'macroSettings');
|
||||||
var color = game.settings.get(moduleName,'macroSettings').color;
|
var selectedMacros = settings.macros;
|
||||||
var args = game.settings.get(moduleName,'macroSettings').args;
|
var color = settings.color;
|
||||||
|
var args = settings.args;
|
||||||
|
var labels = settings.labels;
|
||||||
|
|
||||||
//Check if the settings are defined
|
//Check if the settings are defined
|
||||||
if (selectedMacros == undefined) selectedMacros = [];
|
if (selectedMacros == undefined) selectedMacros = [];
|
||||||
if (color == undefined) color = [];
|
if (color == undefined) color = [];
|
||||||
if (args == undefined) args = [];
|
if (args == undefined) args = [];
|
||||||
|
if (labels == undefined) labels = [];
|
||||||
|
|
||||||
//Check if the Furnace is installed and enabled
|
//Check if the Furnace is installed and enabled
|
||||||
let furnaceEnabled = false;
|
|
||||||
let height = 95;
|
let height = 95;
|
||||||
let furnace = game.modules.get("furnace");
|
let advancedMacrosEnabled = false;
|
||||||
|
if (compatibleCore('11.0')) {
|
||||||
|
advancedMacrosEnabled = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
let advancedMacros = game.modules.get("advanced-macros");
|
let advancedMacros = game.modules.get("advanced-macros");
|
||||||
if ((furnace != undefined && furnace.active && compatibleCore("0.8.1")==false) || (advancedMacros != undefined && advancedMacros.active)) {
|
if (advancedMacros != undefined && advancedMacros.active) advancedMacrosEnabled = true;
|
||||||
furnaceEnabled = true;
|
if (advancedMacrosEnabled) {
|
||||||
|
advancedMacrosEnabled = true;
|
||||||
height += 50;
|
height += 50;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let iteration = this.page*32;
|
let iteration = this.page*32;
|
||||||
let macroData = [];
|
let macroData = [];
|
||||||
for (let j=0; j<4; j++){
|
for (let j=0; j<4; j++){
|
||||||
let macroThis = [];
|
let macroRowConfig = [];
|
||||||
|
|
||||||
for (let i=0; i<8; i++){
|
for (let i=0; i<8; i++){
|
||||||
let colorData = color[iteration];
|
let colorData = color[iteration];
|
||||||
@@ -207,24 +236,26 @@ export class macroConfigForm extends FormApplication {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
colorData = '#000000';
|
colorData = '#000000';
|
||||||
|
const label = labels[iteration] == undefined || labels[iteration] == "" ? game.macros.get(selectedMacros[iteration])?.name : labels[iteration];
|
||||||
let dataThis = {
|
let dataThis = {
|
||||||
iteration: iteration+1,
|
iteration: iteration+1,
|
||||||
macro: selectedMacros[iteration],
|
macro: selectedMacros[iteration],
|
||||||
color: colorData,
|
color: colorData,
|
||||||
args: args[iteration]
|
args: args[iteration],
|
||||||
|
label
|
||||||
}
|
}
|
||||||
macroThis.push(dataThis);
|
macroRowConfig.push(dataThis);
|
||||||
iteration++;
|
iteration++;
|
||||||
}
|
}
|
||||||
macroData.push({dataThis: macroThis});
|
macroData.push({macroRowConfig});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
height: height,
|
height: height,
|
||||||
macros: game.macros,
|
macros: game.macros,
|
||||||
selectedMacros: selectedMacros,
|
selectedMacros: selectedMacros,
|
||||||
macroData: macroData,
|
macroData: macroData,
|
||||||
furnace: furnaceEnabled,
|
furnace: advancedMacrosEnabled,
|
||||||
macroRange: `${this.page*32 + 1} - ${this.page*32 + 32}`,
|
macroRange: `${this.page*32 + 1} - ${this.page*32 + 32}`,
|
||||||
prevDisabled: this.page == 0 ? 'disabled' : '',
|
prevDisabled: this.page == 0 ? 'disabled' : '',
|
||||||
totalMacros: Math.max(Math.ceil(selectedMacros.length/32)*32, this.page*32 + 32)
|
totalMacros: Math.max(Math.ceil(selectedMacros.length/32)*32, this.page*32 + 32)
|
||||||
@@ -242,15 +273,16 @@ export class macroConfigForm extends FormApplication {
|
|||||||
|
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
const navNext = html.find("button[id='navNext']");
|
const navNext = html.find("button[name='navNext']");
|
||||||
const navPrev = html.find("button[id='navPrev']");
|
const navPrev = html.find("button[name='navPrev']");
|
||||||
const clearAll = html.find("button[id='clearAll']");
|
const clearAll = html.find("button[name='clearAll']");
|
||||||
const clearPage = html.find("button[id='clearPage']");
|
const clearPage = html.find("button[name='clearPage']");
|
||||||
const importBtn = html.find("button[id='import']");
|
const importBtn = html.find("button[name='import']");
|
||||||
const exportBtn = html.find("button[id='export']");
|
const exportBtn = html.find("button[name='export']");
|
||||||
const macro = html.find("select[name='macros']");
|
const macro = html.find("select[name='macros']");
|
||||||
const args = html.find("input[name='args']");
|
const args = html.find("input[name='args']");
|
||||||
const color = html.find("input[name='colorPicker']");
|
const color = html.find("input[name='colorPicker']");
|
||||||
|
const label = html.find("input[name='macroLabel']")
|
||||||
|
|
||||||
importBtn.on('click', async(event) => {
|
importBtn.on('click', async(event) => {
|
||||||
let importDialog = new importConfigForm();
|
let importDialog = new importConfigForm();
|
||||||
@@ -338,25 +370,38 @@ export class macroConfigForm extends FormApplication {
|
|||||||
})
|
})
|
||||||
|
|
||||||
macro.on("change", event => {
|
macro.on("change", event => {
|
||||||
let id = event.target.id.replace('macros','');
|
let id = event.target.id.replace('materialDeck_macroConfig_macros','');
|
||||||
let settings = game.settings.get(moduleName,'macroSettings');
|
let settings = game.settings.get(moduleName,'macroSettings');
|
||||||
settings.macros[id-1] = event.target.value;
|
settings.macros[id-1] = event.target.value;
|
||||||
|
if (settings.labels == undefined) settings.labels = [];
|
||||||
|
const macroLabel = event.target.value == '' ? '' : game.macros.get(event.target.value).name;
|
||||||
|
settings.labels[id-1] = macroLabel;
|
||||||
|
document.getElementById(`materialDeck_macroConfig_label${id}`).value = macroLabel;
|
||||||
this.updateSettings(settings);
|
this.updateSettings(settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
args.on("change", event => {
|
args.on("change", event => {
|
||||||
let id = event.target.id.replace('args','');
|
let id = event.target.id.replace('materialDeck_macroConfig_args','');
|
||||||
let settings = game.settings.get(moduleName,'macroSettings');
|
let settings = game.settings.get(moduleName,'macroSettings');
|
||||||
|
if (settings.args == undefined) settings.args = [];
|
||||||
settings.args[id-1]=event.target.value;
|
settings.args[id-1]=event.target.value;
|
||||||
this.updateSettings(settings);
|
this.updateSettings(settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
color.on("change", event => {
|
color.on("change", event => {
|
||||||
let id = event.target.id.replace('colorpicker','');
|
let id = event.target.id.replace('materialDeck_macroConfig_colorpicker','');
|
||||||
let settings = game.settings.get(moduleName,'macroSettings');
|
let settings = game.settings.get(moduleName,'macroSettings');
|
||||||
settings.color[id-1]=event.target.value;
|
settings.color[id-1]=event.target.value;
|
||||||
this.updateSettings(settings);
|
this.updateSettings(settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
label.on("change", event => {
|
||||||
|
let id = event.target.id.replace('materialDeck_macroConfig_label','');
|
||||||
|
let settings = game.settings.get(moduleName,'macroSettings');
|
||||||
|
if (settings.labels == undefined) settings.labels = [];
|
||||||
|
settings.labels[id-1] = event.target.value;
|
||||||
|
this.updateSettings(settings);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateSettings(settings){
|
async updateSettings(settings){
|
||||||
@@ -432,7 +477,7 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
*/
|
*/
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
id: "soundboard-config",
|
id: "materialDeck_soundboardConfig",
|
||||||
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.SoundboardConfig"),
|
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.SoundboardConfig"),
|
||||||
template: "./modules/MaterialDeck/templates/soundboardConfig.html",
|
template: "./modules/MaterialDeck/templates/soundboardConfig.html",
|
||||||
classes: ["sheet"],
|
classes: ["sheet"],
|
||||||
@@ -468,7 +513,7 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
playlists.push({id:"none",name:game.i18n.localize("MaterialDeck.None")});
|
playlists.push({id:"none",name:game.i18n.localize("MaterialDeck.None")});
|
||||||
playlists.push({id:"FP",name:game.i18n.localize("MaterialDeck.FilePicker")})
|
playlists.push({id:"FP",name:game.i18n.localize("MaterialDeck.FilePicker")})
|
||||||
|
|
||||||
const playlistArray = compatibleCore("0.8.1") ? game.playlists.contents : game.playlists.entities;
|
const playlistArray = game.playlists.contents;
|
||||||
for (let playlist of playlistArray)
|
for (let playlist of playlistArray)
|
||||||
playlists.push({id: playlist.id, name: playlist.name})
|
playlists.push({id: playlist.id, name: playlist.name})
|
||||||
|
|
||||||
@@ -494,7 +539,7 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
else if (this.settings.selectedPlaylists[iteration] == 'FP') selectedPlaylist = 'FP';
|
else if (this.settings.selectedPlaylists[iteration] == 'FP') selectedPlaylist = 'FP';
|
||||||
else {
|
else {
|
||||||
//Get the playlist
|
//Get the playlist
|
||||||
const playlistArray = compatibleCore("0.8.1") ? game.playlists.contents : game.playlists.entities;
|
const playlistArray = game.playlists.contents;
|
||||||
let pl = playlistArray.find(p => p.id == this.settings.selectedPlaylists[iteration])
|
let pl = playlistArray.find(p => p.id == this.settings.selectedPlaylists[iteration])
|
||||||
|
|
||||||
if (pl == undefined){
|
if (pl == undefined){
|
||||||
@@ -503,19 +548,12 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Add the sound name and id to the sounds array
|
//Add the sound name and id to the sounds array
|
||||||
if (compatibleCore("0.8.1"))
|
|
||||||
for (let sound of pl.sounds.contents)
|
for (let sound of pl.sounds.contents)
|
||||||
sounds.push({
|
sounds.push({
|
||||||
name: sound.name,
|
name: sound.name,
|
||||||
id: sound.id
|
id: sound.id
|
||||||
});
|
});
|
||||||
else {
|
|
||||||
for (let sound of pl.sounds)
|
|
||||||
sounds.push({
|
|
||||||
name: sound.name,
|
|
||||||
id: sound._id
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//Get the playlist id
|
//Get the playlist id
|
||||||
selectedPlaylist = pl.id;
|
selectedPlaylist = pl.id;
|
||||||
}
|
}
|
||||||
@@ -536,8 +574,8 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
sound: this.settings.sounds[iteration],
|
sound: this.settings.sounds[iteration],
|
||||||
sounds: sounds,
|
sounds: sounds,
|
||||||
srcPath: this.settings.src[iteration],
|
srcPath: this.settings.src[iteration],
|
||||||
colorOn: this.settings.colorOn[iteration],
|
colorOn: this.settings.colorOn[iteration] == 0 ? '#000000' : this.settings.colorOn[iteration],
|
||||||
colorOff: this.settings.colorOff[iteration],
|
colorOff: this.settings.colorOff[iteration] == 0 ? '#000000' : this.settings.colorOff[iteration],
|
||||||
mode: this.settings.mode[iteration],
|
mode: this.settings.mode[iteration],
|
||||||
volume: this.settings.volume[iteration],
|
volume: this.settings.volume[iteration],
|
||||||
imgPath: this.settings.img[iteration],
|
imgPath: this.settings.img[iteration],
|
||||||
@@ -576,12 +614,12 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
|
|
||||||
async activateListeners(html) {
|
async activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
const navNext = html.find("button[id='navNext']");
|
const navNext = html.find("button[name='navNext']");
|
||||||
const navPrev = html.find("button[id='navPrev']");
|
const navPrev = html.find("button[name='navPrev']");
|
||||||
const clearAll = html.find("button[id='clearAll']");
|
const clearAll = html.find("button[name='clearAll']");
|
||||||
const clearPage = html.find("button[id='clearPage']");
|
const clearPage = html.find("button[name='clearPage']");
|
||||||
const importBtn = html.find("button[id='import']");
|
const importBtn = html.find("button[name='import']");
|
||||||
const exportBtn = html.find("button[id='export']");
|
const exportBtn = html.find("button[name='export']");
|
||||||
const nameField = html.find("input[name='namebox']");
|
const nameField = html.find("input[name='namebox']");
|
||||||
const playlistSelect = html.find("select[name='playlist']");
|
const playlistSelect = html.find("select[name='playlist']");
|
||||||
const soundSelect = html.find("select[name='sounds']");
|
const soundSelect = html.find("select[name='sounds']");
|
||||||
@@ -676,7 +714,7 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
})
|
})
|
||||||
|
|
||||||
nameField.on("change",event => {
|
nameField.on("change",event => {
|
||||||
let id = event.target.id.replace('name','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_name','')-1;
|
||||||
this.settings.name[id]=event.target.value;
|
this.settings.name[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
@@ -686,7 +724,7 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
//Listener for when the playlist is changed
|
//Listener for when the playlist is changed
|
||||||
playlistSelect.on("change", event => {
|
playlistSelect.on("change", event => {
|
||||||
//Get the sound number
|
//Get the sound number
|
||||||
const iteration = event.target.id.replace('playlists','');
|
const iteration = event.target.id.replace('materialDeck_sbConfig_playlists','');
|
||||||
|
|
||||||
//Get the selected playlist and the sounds of that playlist
|
//Get the selected playlist and the sounds of that playlist
|
||||||
let selectedPlaylist;
|
let selectedPlaylist;
|
||||||
@@ -697,24 +735,24 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
selectedPlaylist = 'FP';
|
selectedPlaylist = 'FP';
|
||||||
|
|
||||||
//Show the file picker
|
//Show the file picker
|
||||||
document.querySelector(`#fp${iteration}`).style='';
|
document.querySelector(`#materialDeck_sbConfig_fp${iteration}`).style='';
|
||||||
|
|
||||||
//Hide the sound selector
|
//Hide the sound selector
|
||||||
document.querySelector(`#ss${iteration}`).style='display:none';
|
document.querySelector(`#materialDeck_sbConfig_ss${iteration}`).style='display:none';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Hide the file picker
|
//Hide the file picker
|
||||||
document.querySelector(`#fp${iteration}`).style='display:none';
|
document.querySelector(`#materialDeck_sbConfig_fp${iteration}`).style='display:none';
|
||||||
|
|
||||||
//Show the sound selector
|
//Show the sound selector
|
||||||
document.querySelector(`#ss${iteration}`).style='';
|
document.querySelector(`#materialDeck_sbConfig_ss${iteration}`).style='';
|
||||||
|
|
||||||
const playlistArray = compatibleCore("0.8.1") ? game.playlists.contents : game.playlists.entities;
|
const playlistArray = game.playlists.contents;
|
||||||
const pl = playlistArray.find(p => p.id == event.target.value)
|
const pl = playlistArray.find(p => p.id == event.target.value)
|
||||||
selectedPlaylist = pl.id;
|
selectedPlaylist = pl.id;
|
||||||
|
|
||||||
//Get the sound select element
|
//Get the sound select element
|
||||||
let SSpicker = document.getElementById(`soundSelect${iteration}`);
|
let SSpicker = document.getElementById(`materialDeck_sbConfig_soundSelect${iteration}`);
|
||||||
|
|
||||||
//Empty ss element
|
//Empty ss element
|
||||||
SSpicker.options.length=0;
|
SSpicker.options.length=0;
|
||||||
@@ -725,20 +763,12 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
optionNone.innerHTML = game.i18n.localize("MaterialDeck.None");
|
optionNone.innerHTML = game.i18n.localize("MaterialDeck.None");
|
||||||
SSpicker.appendChild(optionNone);
|
SSpicker.appendChild(optionNone);
|
||||||
|
|
||||||
if (compatibleCore("0.8.1"))
|
|
||||||
for (let sound of pl.sounds.contents) {
|
for (let sound of pl.sounds.contents) {
|
||||||
let newOption = document.createElement('option');
|
let newOption = document.createElement('option');
|
||||||
newOption.value = sound.id;
|
newOption.value = sound.id;
|
||||||
newOption.innerHTML = sound.name;
|
newOption.innerHTML = sound.name;
|
||||||
SSpicker.appendChild(newOption);
|
SSpicker.appendChild(newOption);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
for (let sound of pl.sounds) {
|
|
||||||
let newOption = document.createElement('option');
|
|
||||||
newOption.value = sound._id;
|
|
||||||
newOption.innerHTML = sound.name;
|
|
||||||
SSpicker.appendChild(newOption);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save the new playlist to this.settings, and update the settings
|
//Save the new playlist to this.settings, and update the settings
|
||||||
@@ -748,43 +778,43 @@ export class soundboardConfigForm extends FormApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
soundSelect.on("change", event => {
|
soundSelect.on("change", event => {
|
||||||
let id = event.target.id.replace('soundSelect','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_soundSelect','')-1;
|
||||||
this.settings.sounds[id]=event.target.value;
|
this.settings.sounds[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
soundFP.on("change",event => {
|
soundFP.on("change",event => {
|
||||||
let id = event.target.id.replace('srcPath','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_srcPath','')-1;
|
||||||
this.settings.src[id]=event.target.value;
|
this.settings.src[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
imgFP.on("change",event => {
|
imgFP.on("change",event => {
|
||||||
let id = event.target.id.replace('imgPath','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_imgPath','')-1;
|
||||||
this.settings.img[id]=event.target.value;
|
this.settings.img[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
onCP.on("change",event => {
|
onCP.on("change",event => {
|
||||||
let id = event.target.id.replace('colorOn','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_colorOn','')-1;
|
||||||
this.settings.colorOn[id]=event.target.value;
|
this.settings.colorOn[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
offCP.on("change",event => {
|
offCP.on("change",event => {
|
||||||
let id = event.target.id.replace('colorOff','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_colorOff','')-1;
|
||||||
this.settings.colorOff[id]=event.target.value;
|
this.settings.colorOff[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
playMode.on("change",event => {
|
playMode.on("change",event => {
|
||||||
let id = event.target.id.replace('playmode','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_playmode','')-1;
|
||||||
this.settings.mode[id]=event.target.value;
|
this.settings.mode[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
volume.on("change",event => {
|
volume.on("change",event => {
|
||||||
let id = event.target.id.replace('volume','')-1;
|
let id = event.target.id.replace('materialDeck_sbConfig_volume','')-1;
|
||||||
this.settings.volume[id]=event.target.value;
|
this.settings.volume[id]=event.target.value;
|
||||||
this.updateSettings(this.settings);
|
this.updateSettings(this.settings);
|
||||||
});
|
});
|
||||||
@@ -883,7 +913,7 @@ export class exportConfigForm extends FormApplication {
|
|||||||
*/
|
*/
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
id: "MD_Export",
|
id: "materialDeck_Export",
|
||||||
title: "Material Deck: " + game.i18n.localize("MaterialDeck.ExportDialog.Title"),
|
title: "Material Deck: " + game.i18n.localize("MaterialDeck.ExportDialog.Title"),
|
||||||
template: "./modules/MaterialDeck/templates/exportDialog.html",
|
template: "./modules/MaterialDeck/templates/exportDialog.html",
|
||||||
width: 500,
|
width: 500,
|
||||||
@@ -946,7 +976,7 @@ export class importConfigForm extends FormApplication {
|
|||||||
*/
|
*/
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
id: "MD_Import",
|
id: "materialDeck_Import",
|
||||||
title: "Material Deck: " + game.i18n.localize("MaterialDeck.ImportDialog.Title"),
|
title: "Material Deck: " + game.i18n.localize("MaterialDeck.ImportDialog.Title"),
|
||||||
template: "./modules/MaterialDeck/templates/importDialog.html",
|
template: "./modules/MaterialDeck/templates/importDialog.html",
|
||||||
width: 500,
|
width: 500,
|
||||||
@@ -984,7 +1014,7 @@ export class importConfigForm extends FormApplication {
|
|||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
const upload = html.find("input[id='uploadJson']");
|
const upload = html.find("input[id='materialDeck_import_uploadJson']");
|
||||||
|
|
||||||
upload.on('change',(event) => {
|
upload.on('change',(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -1015,6 +1045,7 @@ export class downloadUtility extends FormApplication {
|
|||||||
this.masterSDversion;
|
this.masterSDversion;
|
||||||
this.localMSversion = msVersion;
|
this.localMSversion = msVersion;
|
||||||
this.masterMSversion;
|
this.masterMSversion;
|
||||||
|
this.masterModuleVersion;
|
||||||
this.releaseAssets = [];
|
this.releaseAssets = [];
|
||||||
this.profiles = [];
|
this.profiles = [];
|
||||||
|
|
||||||
@@ -1022,6 +1053,7 @@ export class downloadUtility extends FormApplication {
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
parent.checkForUpdate('SD');
|
parent.checkForUpdate('SD');
|
||||||
parent.checkForUpdate('MS');
|
parent.checkForUpdate('MS');
|
||||||
|
parent.checkForUpdate('Module');
|
||||||
parent.getReleaseData();
|
parent.getReleaseData();
|
||||||
},100)
|
},100)
|
||||||
}
|
}
|
||||||
@@ -1031,7 +1063,7 @@ export class downloadUtility extends FormApplication {
|
|||||||
*/
|
*/
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
id: "MD_DownloadUtility",
|
id: "materialDeck_downloadUtility",
|
||||||
title: "Material Deck: " + game.i18n.localize("MaterialDeck.DownloadUtility.Title"),
|
title: "Material Deck: " + game.i18n.localize("MaterialDeck.DownloadUtility.Title"),
|
||||||
template: "./modules/MaterialDeck/templates/downloadUtility.html",
|
template: "./modules/MaterialDeck/templates/downloadUtility.html",
|
||||||
width: 500,
|
width: 500,
|
||||||
@@ -1057,26 +1089,17 @@ export class downloadUtility extends FormApplication {
|
|||||||
}
|
}
|
||||||
if (this.localMSversion == undefined) this.localMSversion = 'unknown';
|
if (this.localMSversion == undefined) this.localMSversion = 'unknown';
|
||||||
|
|
||||||
let minimumSdVersion;
|
|
||||||
let minimumMsVersion;
|
|
||||||
if (compatibleCore("0.8.5")) {
|
|
||||||
minimumSdVersion = game.modules.get("MaterialDeck").data.flags.minimumSDversion.replace('v','');
|
|
||||||
minimumMsVersion = game.modules.get("MaterialDeck").data.flags.minimumMSversion;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
minimumSdVersion = game.modules.get("MaterialDeck").data.minimumSDversion.replace('v','');
|
|
||||||
minimumMsVersion = game.modules.get("MaterialDeck").data.minimumMSversion;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minimumSdVersion,
|
minimumSdVersion: minimumSDversion,
|
||||||
localSdVersion: this.localSDversion,
|
localSdVersion: this.localSDversion,
|
||||||
masterSdVersion: this.masterSDversion,
|
masterSdVersion: this.masterSDversion,
|
||||||
sdDlDisable: this.masterSDversion == undefined,
|
sdDlDisable: this.masterSDversion == undefined,
|
||||||
minimumMsVersion,
|
minimumMsVersion: minimumMSversion,
|
||||||
localMsVersion: this.localMSversion,
|
localMsVersion: this.localMSversion,
|
||||||
masterMsVersion: this.masterMSversion,
|
masterMsVersion: this.masterMSversion,
|
||||||
msDlDisable: this.masterMSversion == undefined,
|
msDlDisable: this.masterMSversion == undefined,
|
||||||
|
localModuleVersion: game.modules.get('MaterialDeck').version,
|
||||||
|
masterModuleVersion: this.masterModuleVersion,
|
||||||
profiles: this.profiles,
|
profiles: this.profiles,
|
||||||
profileDlDisable: dlDisabled
|
profileDlDisable: dlDisabled
|
||||||
}
|
}
|
||||||
@@ -1094,20 +1117,20 @@ export class downloadUtility extends FormApplication {
|
|||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
const downloadSd = html.find("button[id='downloadSd']");
|
const downloadSd = html.find("button[id='materialDeck_dlUtil_downloadSd']");
|
||||||
const downloadMs = html.find("button[id='downloadMs']");
|
const downloadMs = html.find("button[id='materialDeck_dlUtil_downloadMs']");
|
||||||
const downloadProfile = html.find("button[name='downloadProfile']")
|
const downloadProfile = html.find("button[name='downloadProfile']")
|
||||||
const refresh = html.find("button[id='refresh']");
|
const refresh = html.find("button[id='materialDeck_dlUtil_refresh']");
|
||||||
|
|
||||||
downloadSd.on('click', () => {
|
downloadSd.on('click', () => {
|
||||||
const version = document.getElementById('masterSdVersion').innerHTML;
|
const version = document.getElementById('materialDeck_dlUtil_masterSdVersion').innerHTML;
|
||||||
if (version == '' || version == undefined || version == 'Error') return;
|
if (version == '' || version == undefined || version == 'Error') return;
|
||||||
const url = `https://github.com/CDeenen/MaterialDeck_SD/releases/download/v${version}/com.cdeenen.materialdeck.streamDeckPlugin`;
|
const url = `https://github.com/CDeenen/MaterialDeck_SD/releases/download/v${version}/com.cdeenen.materialdeck.streamDeckPlugin`;
|
||||||
this.downloadURI(url,'com.cdeenen.materialdeck.streamDeckPlugin')
|
this.downloadURI(url,'com.cdeenen.materialdeck.streamDeckPlugin')
|
||||||
})
|
})
|
||||||
downloadMs.on('click', () => {
|
downloadMs.on('click', () => {
|
||||||
const version = document.getElementById('masterMsVersion').innerHTML;
|
const version = document.getElementById('materialDeck_dlUtil_masterMsVersion').innerHTML;
|
||||||
const os = document.getElementById('os').value;
|
const os = document.getElementById('materialDeck_dlUtil_os').value;
|
||||||
if (version == '' || version == undefined || version == 'Error') return;
|
if (version == '' || version == undefined || version == 'Error') return;
|
||||||
let name = `MaterialServer-${os}.zip`;
|
let name = `MaterialServer-${os}.zip`;
|
||||||
let url;
|
let url;
|
||||||
@@ -1116,14 +1139,16 @@ export class downloadUtility extends FormApplication {
|
|||||||
this.downloadURI(url,name)
|
this.downloadURI(url,name)
|
||||||
})
|
})
|
||||||
downloadProfile.on('click',(event) => {
|
downloadProfile.on('click',(event) => {
|
||||||
let id = event.currentTarget.id.replace('dlProfile-','');
|
let id = event.currentTarget.id.replace('materialDeck_dlUtil_dlProfile-','');
|
||||||
this.downloadURI(this.profiles[id].url,`${this.profiles[id].label}.streamDeckProfile`);
|
this.downloadURI(this.profiles[id].url,`${this.profiles[id].label}.streamDeckProfile`);
|
||||||
})
|
})
|
||||||
refresh.on('click', () => {
|
refresh.on('click', () => {
|
||||||
document.getElementById('masterSdVersion').value = 'Getting data';
|
document.getElementById('materialDeck_dlUtil_masterSdVersion').value = 'Getting data';
|
||||||
this.checkForUpdate('SD');
|
this.checkForUpdate('SD');
|
||||||
document.getElementById('masterMsVersion').value = 'Getting data';
|
document.getElementById('materialDeck_dlUtil_masterMsVersion').value = 'Getting data';
|
||||||
this.checkForUpdate('MS');
|
this.checkForUpdate('MS');
|
||||||
|
document.getElementById('materialDeck_dlUtil_masterModuleVersion').value = 'Getting data';
|
||||||
|
this.checkForUpdate('Module');
|
||||||
this.getReleaseData();
|
this.getReleaseData();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1149,22 +1174,28 @@ export class downloadUtility extends FormApplication {
|
|||||||
const data = JSON.parse(request.responseText);
|
const data = JSON.parse(request.responseText);
|
||||||
parent.releaseAssets = data.assets;
|
parent.releaseAssets = data.assets;
|
||||||
parent.render(true);
|
parent.render(true);
|
||||||
if (type.indexOf("text") !== 1) {
|
if (type.indexOf("text") !== 1) return;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
request.onerror = function () {}
|
||||||
request.onerror = function () {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUpdate(reqType) {
|
checkForUpdate(reqType) {
|
||||||
let parent = this;
|
let parent = this;
|
||||||
let url;
|
let url;
|
||||||
if (reqType == 'SD') url = 'https://raw.githubusercontent.com/CDeenen/MaterialDeck_SD/master/Plugin/com.cdeenen.materialdeck.sdPlugin/manifest.json';
|
let elementId;
|
||||||
else if (reqType == 'MS') url = 'https://raw.githubusercontent.com/CDeenen/MaterialServer/master/src/Windows/package.json';
|
if (reqType == 'SD') {
|
||||||
const elementId = reqType == 'SD' ? 'masterSdVersion' : 'masterMsVersion';
|
elementId = 'materialDeck_dlUtil_masterSdVersion';
|
||||||
|
url = 'https://raw.githubusercontent.com/CDeenen/MaterialDeck_SD/master/Plugin/com.cdeenen.materialdeck.sdPlugin/manifest.json';
|
||||||
|
}
|
||||||
|
else if (reqType == 'MS') {
|
||||||
|
elementId = 'materialDeck_dlUtil_masterMsVersion';
|
||||||
|
url = 'https://raw.githubusercontent.com/CDeenen/MaterialServer/master/package.json';
|
||||||
|
}
|
||||||
|
else if (reqType == 'Module') {
|
||||||
|
elementId = 'materialDeck_dlUtil_masterModuleVersion';
|
||||||
|
url = game.modules.get('MaterialDeck').manifest;
|
||||||
|
}
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
request.open('GET', url, true);
|
request.open('GET', url, true);
|
||||||
@@ -1175,10 +1206,10 @@ export class downloadUtility extends FormApplication {
|
|||||||
if (type.indexOf("text") !== 1) {
|
if (type.indexOf("text") !== 1) {
|
||||||
if (reqType == 'SD') parent.masterSDversion = JSON.parse(request.responseText).Version;
|
if (reqType == 'SD') parent.masterSDversion = JSON.parse(request.responseText).Version;
|
||||||
else if (reqType == 'MS') parent.masterMSversion = JSON.parse(request.responseText).version;
|
else if (reqType == 'MS') parent.masterMSversion = JSON.parse(request.responseText).version;
|
||||||
|
else if (reqType == 'Module') parent.masterModuleVersion = JSON.parse(request.responseText).version;
|
||||||
parent.render(true);
|
parent.render(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
request.onerror = function () {
|
request.onerror = function () {
|
||||||
@@ -1186,3 +1217,90 @@ 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: "materialDeck_deviceConfig",
|
||||||
|
title: "Material Deck: " + game.i18n.localize("MaterialDeck.DeviceConfig.Title"),
|
||||||
|
template: "./modules/MaterialDeck/templates/deviceConfig.html",
|
||||||
|
width: 500,
|
||||||
|
height: "auto"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide data to the template
|
||||||
|
*/
|
||||||
|
getData() {
|
||||||
|
this.devices = [];
|
||||||
|
let dConfig = game.settings.get(moduleName, 'devices');
|
||||||
|
if (Object.prototype.toString.call(game.settings.get('MaterialDeck', 'devices')) === "[object String]") {
|
||||||
|
dConfig = {};
|
||||||
|
game.settings.set(moduleName, 'devices', dConfig);
|
||||||
|
}
|
||||||
|
for (let d of streamDeck.buttonContext) {
|
||||||
|
if (d == undefined) continue;
|
||||||
|
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.replace('materialDeck_devConf_','');;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
171
src/settings.js
@@ -1,5 +1,5 @@
|
|||||||
import * as MODULE from "../MaterialDeck.js";
|
import { moduleName, isEmpty } 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];
|
||||||
@@ -70,8 +70,9 @@ export const registerSettings = async function() {
|
|||||||
//world,global,client
|
//world,global,client
|
||||||
|
|
||||||
//Enabled the module
|
//Enabled the module
|
||||||
game.settings.register(MODULE.moduleName,'Enable', {
|
game.settings.register(moduleName,'Enable', {
|
||||||
name: "MaterialDeck.Sett.Enable",
|
name: "MaterialDeck.Sett.Enable",
|
||||||
|
hint: "MaterialDeck.Sett.EnableHint",
|
||||||
scope: "client",
|
scope: "client",
|
||||||
config: true,
|
config: true,
|
||||||
default: false,
|
default: false,
|
||||||
@@ -79,10 +80,42 @@ export const registerSettings = async function() {
|
|||||||
onChange: x => window.location.reload()
|
onChange: x => window.location.reload()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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,
|
||||||
|
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
|
* Sets the ip address of the server
|
||||||
*/
|
*/
|
||||||
game.settings.register(MODULE.moduleName,'address', {
|
game.settings.register(moduleName,'address', {
|
||||||
name: "MaterialDeck.Sett.ServerAddr",
|
name: "MaterialDeck.Sett.ServerAddr",
|
||||||
hint: "MaterialDeck.Sett.ServerAddrHint",
|
hint: "MaterialDeck.Sett.ServerAddrHint",
|
||||||
scope: "client",
|
scope: "client",
|
||||||
@@ -92,7 +125,7 @@ export const registerSettings = async function() {
|
|||||||
onChange: x => window.location.reload()
|
onChange: x => window.location.reload()
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register(MODULE.moduleName, 'imageBuffer', {
|
game.settings.register(moduleName, 'imageBuffer', {
|
||||||
name: "MaterialDeck.Sett.ImageBuffer",
|
name: "MaterialDeck.Sett.ImageBuffer",
|
||||||
hint: "MaterialDeck.Sett.ImageBufferHint",
|
hint: "MaterialDeck.Sett.ImageBufferHint",
|
||||||
default: 100,
|
default: 100,
|
||||||
@@ -103,7 +136,7 @@ export const registerSettings = async function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register(MODULE.moduleName, 'imageBrightness', {
|
game.settings.register(moduleName, 'imageBrightness', {
|
||||||
name: "MaterialDeck.Sett.ImageBrightness",
|
name: "MaterialDeck.Sett.ImageBrightness",
|
||||||
hint: "MaterialDeck.Sett.ImageBrightnessHint",
|
hint: "MaterialDeck.Sett.ImageBrightnessHint",
|
||||||
default: 50,
|
default: 50,
|
||||||
@@ -114,7 +147,7 @@ export const registerSettings = async function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register(MODULE.moduleName, 'nrOfConnMessages', {
|
game.settings.register(moduleName, 'nrOfConnMessages', {
|
||||||
name: "MaterialDeck.Sett.NrOfConnMessages",
|
name: "MaterialDeck.Sett.NrOfConnMessages",
|
||||||
hint: "MaterialDeck.Sett.NrOfConnMessagesHint",
|
hint: "MaterialDeck.Sett.NrOfConnMessagesHint",
|
||||||
default: 5,
|
default: 5,
|
||||||
@@ -126,45 +159,62 @@ export const registerSettings = async function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Create the Help button
|
//Create the Help button
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'helpMenu',{
|
game.settings.registerMenu(moduleName, 'helpMenu',{
|
||||||
name: "MaterialDeck.Sett.Help",
|
name: "MaterialDeck.Sett.Help",
|
||||||
label: "MaterialDeck.Sett.Help",
|
label: "MaterialDeck.Sett.Help",
|
||||||
type: helpMenu,
|
type: helpMenu,
|
||||||
restricted: false
|
restricted: false
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'permissionConfig',{
|
game.settings.registerMenu(moduleName, 'downloadUtility',{
|
||||||
name: "MaterialDeck.Sett.Permission",
|
|
||||||
label: "MaterialDeck.Sett.Permission",
|
|
||||||
type: userPermission,
|
|
||||||
restricted: true
|
|
||||||
});
|
|
||||||
|
|
||||||
game.settings.register(MODULE.moduleName, 'userPermission', {
|
|
||||||
name: "userPermission",
|
|
||||||
scope: "world",
|
|
||||||
type: Object,
|
|
||||||
config: false
|
|
||||||
});
|
|
||||||
|
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'downloadUtility',{
|
|
||||||
name: "MaterialDeck.DownloadUtility.Title",
|
name: "MaterialDeck.DownloadUtility.Title",
|
||||||
label: "MaterialDeck.DownloadUtility.Title",
|
label: "MaterialDeck.DownloadUtility.Title",
|
||||||
type: downloadUtility,
|
type: downloadUtility,
|
||||||
restricted: false
|
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(moduleName, 'userPermission', {
|
||||||
|
name: "userPermission",
|
||||||
|
label: "",
|
||||||
|
scope: "world",
|
||||||
|
type: Object,
|
||||||
|
config: false,
|
||||||
|
default: {}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Playlist soundboard
|
* Playlist soundboard
|
||||||
*/
|
*/
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'playlistConfigMenu',{
|
game.settings.registerMenu(moduleName, 'playlistConfigMenu',{
|
||||||
name: "MaterialDeck.Sett.PlaylistConfig",
|
name: "MaterialDeck.Sett.PlaylistConfig",
|
||||||
label: "MaterialDeck.Sett.PlaylistConfig",
|
label: "MaterialDeck.Sett.PlaylistConfig",
|
||||||
type: playlistConfigForm,
|
type: playlistConfigForm,
|
||||||
restricted: false
|
restricted: false
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register(MODULE.moduleName, 'playlists', {
|
game.settings.register(moduleName, 'playlists', {
|
||||||
name: "selectedPlaylists",
|
name: "selectedPlaylists",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -175,31 +225,33 @@ export const registerSettings = async function() {
|
|||||||
/**
|
/**
|
||||||
* Macro Board
|
* Macro Board
|
||||||
*/
|
*/
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'macroConfigMenu',{
|
game.settings.registerMenu(moduleName, 'macroConfigMenu',{
|
||||||
name: "MaterialDeck.Sett.MacroConfig",
|
name: "MaterialDeck.Sett.MacroConfig",
|
||||||
label: "MaterialDeck.Sett.MacroConfig",
|
label: "MaterialDeck.Sett.MacroConfig",
|
||||||
type: macroConfigForm,
|
type: macroConfigForm,
|
||||||
restricted: false
|
restricted: false
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register(MODULE.moduleName, 'macroSettings', {
|
game.settings.register(moduleName, 'macroSettings', {
|
||||||
name: "macroSettings",
|
name: "macroSettings",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
type: Object,
|
type: Object,
|
||||||
config: false
|
config: false,
|
||||||
|
default: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register(MODULE.moduleName, 'macroArgs', {
|
game.settings.register(moduleName, 'macroArgs', {
|
||||||
name: "macroArgs",
|
name: "macroArgs",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
type: Object,
|
type: Object,
|
||||||
config: false
|
config: false,
|
||||||
|
default: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Soundboard
|
* Soundboard
|
||||||
*/
|
*/
|
||||||
game.settings.register(MODULE.moduleName, 'soundboardSettings', {
|
game.settings.register(moduleName, 'soundboardSettings', {
|
||||||
name: "soundboardSettings",
|
name: "soundboardSettings",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -207,15 +259,16 @@ export const registerSettings = async function() {
|
|||||||
config: false
|
config: false
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.registerMenu(MODULE.moduleName, 'soundboardConfigMenu',{
|
game.settings.registerMenu(moduleName, 'soundboardConfigMenu',{
|
||||||
name: "MaterialDeck.Sett.SoundboardConfig",
|
name: "MaterialDeck.Sett.SoundboardConfig",
|
||||||
label: "MaterialDeck.Sett.SoundboardConfig",
|
label: "MaterialDeck.Sett.SoundboardConfig",
|
||||||
type: soundboardConfigForm,
|
type: soundboardConfigForm,
|
||||||
restricted: false
|
restricted: false
|
||||||
});
|
});
|
||||||
|
|
||||||
let permissionSettings = game.settings.get(MODULE.moduleName,'userPermission');
|
let permissionSettings = game.settings.get(moduleName,'userPermission');
|
||||||
if (permissionSettings == undefined || permissionSettings == null || MODULE.isEmpty(permissionSettings)) {
|
|
||||||
|
if (permissionSettings == undefined || permissionSettings == null || isEmpty(permissionSettings)) {
|
||||||
permissionSettings = {
|
permissionSettings = {
|
||||||
enable: defaultEnable,
|
enable: defaultEnable,
|
||||||
permissions: defaultUserPermissions
|
permissions: defaultUserPermissions
|
||||||
@@ -227,7 +280,7 @@ export const registerSettings = async function() {
|
|||||||
if (permissionSettings.permissions.MACRO.BY_NAME == undefined) permissionSettings.permissions.MACRO.BY_NAME = [false,false,true,true];
|
if (permissionSettings.permissions.MACRO.BY_NAME == undefined) permissionSettings.permissions.MACRO.BY_NAME = [false,false,true,true];
|
||||||
}
|
}
|
||||||
if (game.user.isGM)
|
if (game.user.isGM)
|
||||||
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
|
game.settings.set(moduleName,'userPermission',permissionSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -284,7 +337,7 @@ export class helpMenu extends FormApplication {
|
|||||||
*/
|
*/
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
id: "userPermissionConfig",
|
id: "materialDeck_userPermissionConfig",
|
||||||
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.Permission"),
|
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.Permission"),
|
||||||
template: "./modules/MaterialDeck/templates/userPermissionConfig.html",
|
template: "./modules/MaterialDeck/templates/userPermissionConfig.html",
|
||||||
width: 660,
|
width: 660,
|
||||||
@@ -297,8 +350,8 @@ export class helpMenu extends FormApplication {
|
|||||||
* Provide data to the template
|
* Provide data to the template
|
||||||
*/
|
*/
|
||||||
async getData() {
|
async getData() {
|
||||||
let settings = game.settings.get(MODULE.moduleName,'userPermission');
|
let settings = game.settings.get(moduleName,'userPermission');
|
||||||
if (settings == undefined || settings == null || MODULE.isEmpty(settings)) {
|
if (settings == undefined || settings == null || isEmpty(settings)) {
|
||||||
settings = {
|
settings = {
|
||||||
enable: defaultEnable,
|
enable: defaultEnable,
|
||||||
permissions: defaultUserPermissions
|
permissions: defaultUserPermissions
|
||||||
@@ -308,7 +361,12 @@ export class helpMenu extends FormApplication {
|
|||||||
const actions = Object.entries(duplicate(settings.permissions)).reduce((arr, e) => {
|
const actions = Object.entries(duplicate(settings.permissions)).reduce((arr, e) => {
|
||||||
const perms = Object.entries(duplicate(e[1])).reduce((arr, p) => {
|
const perms = Object.entries(duplicate(e[1])).reduce((arr, p) => {
|
||||||
let perm = {};
|
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.id = p[0];
|
||||||
perm.label = game.i18n.localize("MaterialDeck.Perm."+e[0]+"."+p[0]+".label");
|
perm.label = game.i18n.localize("MaterialDeck.Perm."+e[0]+"."+p[0]+".label");
|
||||||
perm.hint = game.i18n.localize("MaterialDeck.Perm."+e[0]+"."+p[0]+".hint");
|
perm.hint = game.i18n.localize("MaterialDeck.Perm."+e[0]+"."+p[0]+".hint");
|
||||||
@@ -328,14 +386,21 @@ export class helpMenu extends FormApplication {
|
|||||||
if (actions[i].id == 'MOVE')
|
if (actions[i].id == 'MOVE')
|
||||||
actions.splice(i,1);
|
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 {
|
return {
|
||||||
roles: Object.keys(CONST.USER_ROLES).reduce((obj, r) => {
|
roles: Object.keys(CONST.USER_ROLES).reduce((obj, r) => {
|
||||||
if ( r === "NONE" ) return obj;
|
if ( r === "NONE" ) return obj;
|
||||||
obj[r] = `USER.Role${r.titleCase()}`;
|
obj[r] = `USER.Role${r.titleCase()}`;
|
||||||
return obj;
|
return obj;
|
||||||
}, {}),
|
}, {}),
|
||||||
actions: actions,
|
actions,
|
||||||
enable: settings.enable
|
enable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,12 +410,28 @@ export class helpMenu extends FormApplication {
|
|||||||
* @param {*} formData
|
* @param {*} formData
|
||||||
*/
|
*/
|
||||||
async _updateObject(event, formData) {
|
async _updateObject(event, formData) {
|
||||||
let permissions = expandObject(formData);
|
|
||||||
let settings = {};
|
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;
|
delete permissions.ENABLE;
|
||||||
settings.permissions = permissions;
|
settings.permissions = permissions;
|
||||||
// game.settings.set(MODULE.moduleName,'userPermission',settings);
|
game.settings.set(moduleName,'userPermission',settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
async activateListeners(html) {
|
async activateListeners(html) {
|
||||||
@@ -369,7 +450,7 @@ export class helpMenu extends FormApplication {
|
|||||||
enable: defaultEnable,
|
enable: defaultEnable,
|
||||||
permissions: defaultUserPermissions
|
permissions: defaultUserPermissions
|
||||||
}
|
}
|
||||||
await game.settings.set(MODULE.moduleName,'userPermission',settings);
|
await game.settings.set(moduleName,'userPermission',settings);
|
||||||
this.render();
|
this.render();
|
||||||
ui.notifications.info(game.i18n.localize("MaterialDeck.Perm.DefaultNotification"));
|
ui.notifications.info(game.i18n.localize("MaterialDeck.Perm.DefaultNotification"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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{
|
export class StreamDeck{
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -34,7 +34,30 @@ 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 (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 +67,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 +86,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;
|
||||||
@@ -69,14 +94,14 @@ export class StreamDeck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.getActive(action) == false){
|
if (this.getActive(action) == false){
|
||||||
if (action == 'token') MODULE.tokenControl.active = false;
|
if (action == 'token') tokenControl.active = false;
|
||||||
else if (action == 'macro') MODULE.macroControl.active = false;
|
else if (action == 'macro') macroControl.active = false;
|
||||||
else if (action == 'combattracker') MODULE.combatTracker.active = false;
|
else if (action == 'combattracker') combatTracker.active = false;
|
||||||
else if (action == 'playlist') MODULE.playlistControl.active = false;
|
else if (action == 'playlist') playlistControl.active = false;
|
||||||
else if (action == 'soundboard') MODULE.soundboard.active = false;
|
else if (action == 'soundboard') soundboard.active = false;
|
||||||
else if (action == 'other') MODULE.otherControls.active = false;
|
else if (action == 'other') otherControls.active = false;
|
||||||
else if (action == 'external') MODULE.externalModules.active = false;
|
else if (action == 'external') externalModules.active = false;
|
||||||
else if (action == 'scene') MODULE.sceneControl.active = false;
|
else if (action == 'scene') sceneControl.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +135,7 @@ export class StreamDeck{
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let txtNew = "";
|
let txtNew = "";
|
||||||
let newTxtArray = ['','','','','','','','','','','','','','','','','','','',''];
|
let newTxtArray = ['','','','','','','','','','','','','','','','','','','',''];
|
||||||
counter = 0;
|
counter = 0;
|
||||||
@@ -118,8 +144,20 @@ export class StreamDeck{
|
|||||||
let txtNewPart = txtArray[i];
|
let txtNewPart = txtArray[i];
|
||||||
|
|
||||||
if (txtNewPart != undefined && txtNewPart.length > 10){
|
if (txtNewPart != undefined && txtNewPart.length > 10){
|
||||||
let syllables = this.syllabify(txtNewPart);
|
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 {
|
||||||
for (let j=0; j<syllables.length; j++){
|
for (let j=0; j<syllables.length; j++){
|
||||||
if (syllables.length == 0){
|
if (syllables.length == 0){
|
||||||
newTxtArray[counter] = txtNewPart;
|
newTxtArray[counter] = txtNewPart;
|
||||||
@@ -142,6 +180,8 @@ export class StreamDeck{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
newTxtArray[counter] = txtNewPart;
|
newTxtArray[counter] = txtNewPart;
|
||||||
counter++;
|
counter++;
|
||||||
@@ -165,15 +205,14 @@ export class StreamDeck{
|
|||||||
setTitle(txt,context){
|
setTitle(txt,context){
|
||||||
if (txt == null || txt == undefined) txt = '';
|
if (txt == null || txt == undefined) txt = '';
|
||||||
txt = this.formatTitle(txt);
|
txt = this.formatTitle(txt);
|
||||||
for (let i=0; i<32; i++){
|
|
||||||
if (this.buttonContext[i] == undefined) continue;
|
for (let device of this.buttonContext) {
|
||||||
if (this.buttonContext[i].context == context) {
|
if (device == undefined) continue;
|
||||||
if (this.buttonContext[i].txt != undefined)
|
const btn = device.buttons.find(b => b?.context == context);
|
||||||
if (this.buttonContext[i].txt == txt)
|
if (btn == undefined) continue;
|
||||||
return;
|
btn.txt = txt;
|
||||||
this.buttonContext[i].txt = txt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg = {
|
let msg = {
|
||||||
target: "SD",
|
target: "SD",
|
||||||
event: 'setTitle',
|
event: 'setTitle',
|
||||||
@@ -183,7 +222,7 @@ export class StreamDeck{
|
|||||||
target: 0
|
target: 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MODULE.sendWS(JSON.stringify(msg));
|
sendWS(JSON.stringify(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
setColor(context,color = '#000000'){
|
setColor(context,color = '#000000'){
|
||||||
@@ -195,7 +234,7 @@ export class StreamDeck{
|
|||||||
format: 'color',
|
format: 'color',
|
||||||
background: color
|
background: color
|
||||||
};
|
};
|
||||||
MODULE.sendWS(JSON.stringify(msg));
|
sendWS(JSON.stringify(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
setImage(image,context,device,nr,id){
|
setImage(image,context,device,nr,id){
|
||||||
@@ -211,7 +250,7 @@ export class StreamDeck{
|
|||||||
target: 0
|
target: 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MODULE.sendWS(JSON.stringify(json));
|
sendWS(JSON.stringify(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
setBufferImage(context,device,nr,id){
|
setBufferImage(context,device,nr,id){
|
||||||
@@ -226,7 +265,7 @@ export class StreamDeck{
|
|||||||
target: 0
|
target: 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MODULE.sendWS(JSON.stringify(json));
|
sendWS(JSON.stringify(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
setIcon(context,device,src='',options = {}){
|
setIcon(context,device,src='',options = {}){
|
||||||
@@ -241,7 +280,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;
|
||||||
@@ -280,6 +319,8 @@ export class StreamDeck{
|
|||||||
let format = split[split.length-1].split('?')[0];
|
let format = split[split.length-1].split('?')[0];
|
||||||
split = split[0].split(' ');
|
split = split[0].split(' ');
|
||||||
if (split[0] == 'fas' || split[0] == 'far' || split[0] == 'fal' || split[0] == 'fad') format = 'icon';
|
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 = {
|
let msg = {
|
||||||
target: "SD",
|
target: "SD",
|
||||||
event: 'setIcon',
|
event: 'setIcon',
|
||||||
@@ -305,7 +346,7 @@ export class StreamDeck{
|
|||||||
action: action,
|
action: action,
|
||||||
state: state
|
state: state
|
||||||
};
|
};
|
||||||
MODULE.sendWS(JSON.stringify(msg));
|
sendWS(JSON.stringify(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
setProfile(action,device){
|
setProfile(action,device){
|
||||||
@@ -322,7 +363,7 @@ export class StreamDeck{
|
|||||||
profile: profile
|
profile: profile
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
MODULE.sendWS(JSON.stringify(json));
|
sendWS(JSON.stringify(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
setPluginId(id){
|
setPluginId(id){
|
||||||
@@ -358,14 +399,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,13 +452,14 @@ 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');
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
if (format == 'color') ctx.filter = "opacity(0)";
|
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%)";
|
//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 imageAspectRatio = img.width / img.height;
|
||||||
var canvasAspectRatio = canvas.width / canvas.height;
|
var canvasAspectRatio = canvas.width / canvas.height;
|
||||||
@@ -544,7 +584,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
addToImageBuffer(img,data){
|
addToImageBuffer(img,data){
|
||||||
const id = this.getImageBufferId(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 (maxBufferSize == 0) return false;
|
||||||
if (this.imageBufferCounter > maxBufferSize) this.imageBufferCounter = 0;
|
if (this.imageBufferCounter > maxBufferSize) this.imageBufferCounter = 0;
|
||||||
|
|
||||||
@@ -561,7 +601,7 @@ export class StreamDeck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkImageBuffer(data){
|
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);
|
const id = this.getImageBufferId(data);
|
||||||
|
|
||||||
for (let i=0; i<this.imageBuffer.length; i++){
|
for (let i=0; i<this.imageBuffer.length; i++){
|
||||||
|
|||||||
@@ -1,12 +1,46 @@
|
|||||||
import { compatibleCore } from "../misc.js";
|
import { compatibleCore } from "../misc.js";
|
||||||
|
|
||||||
export class demonlord{
|
export class demonlord{
|
||||||
constructor(){
|
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) {
|
getHP(token) {
|
||||||
const hp = token.actor.data.data.characteristics.health;
|
const hp = this.getActorData(token).characteristics.health;
|
||||||
return {
|
return {
|
||||||
value: hp.value,
|
value: hp.value,
|
||||||
max: hp.max
|
max: hp.max
|
||||||
@@ -18,7 +52,7 @@ export class demonlord{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAC(token) {
|
getAC(token) {
|
||||||
return token.actor.data.data.characteristics.defense;
|
return this.getActorData(token).characteristics.defense;
|
||||||
}
|
}
|
||||||
|
|
||||||
getShieldHP(token) {
|
getShieldHP(token) {
|
||||||
@@ -26,11 +60,11 @@ export class demonlord{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSpeed(token) {
|
getSpeed(token) {
|
||||||
return token.actor.data.data.characteristics.speed;
|
return this.getActorData(token).characteristics.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
getInitiative(token) {
|
getInitiative(token) {
|
||||||
return token.actor.data.data.fastturn ? "FAST" : "SLOW";
|
return this.getActorData(token).fastturn ? "FAST" : "SLOW";
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleInitiative(token) {
|
toggleInitiative(token) {
|
||||||
@@ -50,12 +84,12 @@ export class demonlord{
|
|||||||
|
|
||||||
getAbility(token, ability) {
|
getAbility(token, ability) {
|
||||||
if (ability == undefined) ability = 'strength';
|
if (ability == undefined) ability = 'strength';
|
||||||
return token.actor.data.data.attributes?.[ability].value;
|
return this.getActorData(token).attributes?.[ability].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbilityModifier(token, ability) {
|
getAbilityModifier(token, ability) {
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
let val = token.actor.data.data.attributes?.[ability].modifier;
|
let val = this.getActorData(token).attributes?.[ability].modifier;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,9 +97,20 @@ export class demonlord{
|
|||||||
return;
|
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) {
|
getSkill(token, skill) {
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
const val = token.actor.data.data.skills?.[skill].total;
|
const val = this.getActorData(token).skills?.[skill].total;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +129,12 @@ export class demonlord{
|
|||||||
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
|
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) {
|
async toggleCondition(token,condition) {
|
||||||
if (condition == undefined) condition = 'removeAll';
|
if (condition == undefined) condition = 'removeAll';
|
||||||
if (condition == 'removeAll'){
|
if (condition == 'removeAll'){
|
||||||
@@ -114,24 +165,82 @@ export class demonlord{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemUses(item) {
|
getItemUses(item) {
|
||||||
return {available: item.data.data.quantity};
|
return {available: getItemData(item).quantity};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spells
|
* Spells
|
||||||
*/
|
*/
|
||||||
getSpells(token,level) {
|
getSpells(token,level,type) {
|
||||||
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.rank == level)
|
else return allItems.filter(i => i.type == 'spell' && getItemData(i).rank == level)
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpellUses(token,level,item) {
|
getSpellUses(token,level,item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSpellTypes() {
|
||||||
|
return [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
rollItem(item) {
|
rollItem(item) {
|
||||||
return item.roll()
|
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'}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,51 @@
|
|||||||
import { compatibleCore } from "../misc.js";
|
import { compatibleCore } from "../misc.js";
|
||||||
|
|
||||||
export class dnd35e{
|
export class dnd35e{
|
||||||
constructor(){
|
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) {
|
getHP(token) {
|
||||||
const hp = token.actor.data.data.attributes.hp;
|
const hp = this.getActorData(token).attributes.hp;
|
||||||
return {
|
return {
|
||||||
value: hp.value,
|
value: hp.value,
|
||||||
max: hp.max
|
max: hp.max
|
||||||
@@ -14,7 +53,7 @@ export class dnd35e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTempHP(token) {
|
getTempHP(token) {
|
||||||
const hp = token.actor.data.data.attributes.hp;
|
const hp = this.getActorData(token).attributes.hp;
|
||||||
return {
|
return {
|
||||||
value: (hp.temp == null) ? 0 : hp.temp,
|
value: (hp.temp == null) ? 0 : hp.temp,
|
||||||
max: (hp.tempmax == null) ? 0 : hp.tempmax
|
max: (hp.tempmax == null) ? 0 : hp.tempmax
|
||||||
@@ -22,7 +61,7 @@ export class dnd35e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAC(token) {
|
getAC(token) {
|
||||||
return token.actor.data.data.attributes.ac.normal.total;
|
return this.getActorData(token).attributes.ac.normal.total;
|
||||||
}
|
}
|
||||||
|
|
||||||
getShieldHP(token) {
|
getShieldHP(token) {
|
||||||
@@ -30,7 +69,7 @@ export class dnd35e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSpeed(token) {
|
getSpeed(token) {
|
||||||
const movement = token.actor.data.data.attributes.speed;
|
const movement = this.getActorData(token).attributes.speed;
|
||||||
let speed = "";
|
let speed = "";
|
||||||
if (movement.burrow.total > 0) speed += `Burrow: ${movement.burrow.total}Ft`;
|
if (movement.burrow.total > 0) speed += `Burrow: ${movement.burrow.total}Ft`;
|
||||||
if (movement.climb.total > 0) {
|
if (movement.climb.total > 0) {
|
||||||
@@ -53,7 +92,7 @@ export class dnd35e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInitiative(token) {
|
getInitiative(token) {
|
||||||
let initiative = token.actor.data.data.attributes.init.total;
|
let initiative = this.getActorData(token).attributes.init.total;
|
||||||
return (initiative >= 0) ? `+${initiative}` : initiative;
|
return (initiative >= 0) ? `+${initiative}` : initiative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,29 +110,53 @@ export class dnd35e{
|
|||||||
|
|
||||||
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 this.getActorData(token).abilities?.[ability].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbilityModifier(token, ability) {
|
getAbilityModifier(token, ability) {
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
let val = token.actor.data.data.abilities?.[ability].mod;
|
let val = this.getActorData(token).abilities?.[ability].mod;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbilitySave(token, ability) {
|
getAbilitySave(token, ability) {
|
||||||
if (ability == undefined) ability = 'fort';
|
if (ability == undefined) ability = 'fort';
|
||||||
let val = token.actor.data.data.attributes.savingThrows?.[ability].total;
|
let val = this.getActorData(token).attributes.savingThrows?.[ability].total;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
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) {
|
getSkill(token, skill) {
|
||||||
if (skill == undefined) skill = 'apr';
|
if (skill == undefined) skill = 'apr';
|
||||||
const val = token.actor.data.data.skills?.[skill].mod;
|
const val = this.getActorData(token).skills?.[skill].mod;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
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) {
|
getProficiency(token) {
|
||||||
const val = token.actor.data.data.attributes.prof;
|
const val = this.getActorData(token).attributes.prof;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +184,12 @@ export class dnd35e{
|
|||||||
return true;
|
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
|
||||||
*/
|
*/
|
||||||
@@ -133,13 +202,37 @@ export class dnd35e{
|
|||||||
if (roll == 'ability') token.actor.rollAbilityTest(ability,options);
|
if (roll == 'ability') token.actor.rollAbilityTest(ability,options);
|
||||||
else if (roll == 'save') token.actor.rollSavingThrow(save, null, null,options);
|
else if (roll == 'save') token.actor.rollSavingThrow(save, null, null,options);
|
||||||
else if (roll == 'skill') token.actor.rollSkill(skill,options);
|
else if (roll == 'skill') token.actor.rollSkill(skill,options);
|
||||||
else if (roll == 'initiative') token.actor.rollInitiative(options);
|
else if (roll == 'initiative') {
|
||||||
|
options.rerollInitiative = true;
|
||||||
|
token.actor.rollInitiative(options);
|
||||||
|
}
|
||||||
else if (roll == 'grapple') token.actor.rollGrapple(options);
|
else if (roll == 'grapple') token.actor.rollGrapple(options);
|
||||||
else if (roll == 'bab') token.actor.rollBAB(options);
|
else if (roll == 'bab') token.actor.rollBAB(options);
|
||||||
else if (roll == 'melee') token.actor.rollMelee(options);
|
else if (roll == 'melee') token.actor.rollMelee(options);
|
||||||
else if (roll == 'ranged') token.actor.rollRanged(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
|
* Items
|
||||||
*/
|
*/
|
||||||
@@ -147,16 +240,33 @@ export class dnd35e{
|
|||||||
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');
|
||||||
else if (game.system.id == 'D35E' && itemType == 'container') return allItems.filter(i => i.type == 'loot' && i.data.data.subType == itemType);
|
else if (game.system.id == 'D35E' && itemType == 'container') return allItems.filter(i => i.type == 'loot' && this.getItemData(i).subType == itemType);
|
||||||
else {
|
else {
|
||||||
if (itemType == 'gear' || itemType == 'ammo' || itemType == 'misc' || itemType == 'tradeGoods')
|
if (itemType == 'gear' || itemType == 'ammo' || itemType == 'misc' || itemType == 'tradeGoods')
|
||||||
return allItems.filter(i => i.type == 'loot' && i.data.data.subType == itemType);
|
return allItems.filter(i => i.type == 'loot' && this.getItemData(i).subType == itemType);
|
||||||
else return allItems.filter(i => i.type == itemType);
|
else return allItems.filter(i => i.type == itemType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemUses(item) {
|
getItemUses(item) {
|
||||||
return {available: item.data.data.quantity};
|
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 []
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,33 +280,63 @@ export class dnd35e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFeatureUses(item) {
|
getFeatureUses(item) {
|
||||||
if (item.data.type == 'class') return {available: item.data.data.levels};
|
if (item.data.type == 'class') return {available: this.getItemData(item).levels};
|
||||||
else return {
|
else return {
|
||||||
available: item.data.data.uses.value,
|
available: this.getItemData(item).uses.value,
|
||||||
maximum: item.data.data.uses.max
|
maximum: this.getItemData(item).uses.max
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFeatureTypes() {
|
||||||
|
return [
|
||||||
|
{value:'class', name:'Class'},
|
||||||
|
{value:'feat', name:'Abilities'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spells
|
* Spells
|
||||||
*/
|
*/
|
||||||
getSpells(token,level) {
|
getSpells(token,level,type) {
|
||||||
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 == level)
|
else return allItems.filter(i => i.type == 'spell' && this.getItemData(i).level == level)
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpellUses(token,level,item) {
|
getSpellUses(token,level,item) {
|
||||||
if (level == undefined) level = 'any';
|
if (level == undefined) level = 'any';
|
||||||
if (item.data.data.level == 0) return;
|
if (this.getItemData(item).level == 0) return;
|
||||||
return {
|
return {
|
||||||
available: item.charges,
|
available: item.charges,
|
||||||
maximum: item.maxCharges
|
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) {
|
rollItem(item) {
|
||||||
return item.roll()
|
return item.roll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,63 @@
|
|||||||
import {compatibleCore} from "../misc.js";
|
import { compatibleCore, compatibleSystem } from "../misc.js";
|
||||||
|
|
||||||
|
const proficiencyColors = {
|
||||||
|
0: "#000000",
|
||||||
|
0.5: "#804A00",
|
||||||
|
1: "#C0C0C0",
|
||||||
|
2: "#FFD700"
|
||||||
|
}
|
||||||
|
|
||||||
export class dnd5e{
|
export class dnd5e{
|
||||||
constructor(){
|
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) {
|
getHP(token) {
|
||||||
const hp = token.actor.data.data.attributes.hp;
|
const hp = this.getActorData(token).attributes.hp;
|
||||||
return {
|
return {
|
||||||
value: hp.value,
|
value: hp.value,
|
||||||
max: hp.max
|
max: hp.max
|
||||||
@@ -14,7 +65,7 @@ export class dnd5e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTempHP(token) {
|
getTempHP(token) {
|
||||||
const hp = token.actor.data.data.attributes.hp;
|
const hp = this.getActorData(token).attributes.hp;
|
||||||
return {
|
return {
|
||||||
value: (hp.temp == null) ? 0 : hp.temp,
|
value: (hp.temp == null) ? 0 : hp.temp,
|
||||||
max: (hp.tempmax == null) ? 0 : hp.tempmax
|
max: (hp.tempmax == null) ? 0 : hp.tempmax
|
||||||
@@ -22,7 +73,7 @@ export class dnd5e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAC(token) {
|
getAC(token) {
|
||||||
return token.actor.data.data.attributes.ac.value;
|
return this.getActorData(token).attributes.ac.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getShieldHP(token) {
|
getShieldHP(token) {
|
||||||
@@ -30,9 +81,9 @@ export class dnd5e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getSpeed(token) {
|
getSpeed(token) {
|
||||||
const movement = token.actor.data.data.attributes.movement;
|
const movement = this.getActorData(token).attributes.movement;
|
||||||
let speed = "";
|
let speed = "";
|
||||||
if (movement != undefined){
|
|
||||||
if (movement.burrow > 0) speed += `${game.i18n.localize("DND5E.MovementBurrow")}: ${movement.burrow + movement.units}`;
|
if (movement.burrow > 0) speed += `${game.i18n.localize("DND5E.MovementBurrow")}: ${movement.burrow + movement.units}`;
|
||||||
if (movement.climb > 0) {
|
if (movement.climb > 0) {
|
||||||
if (speed.length > 0) speed += '\n';
|
if (speed.length > 0) speed += '\n';
|
||||||
@@ -54,17 +105,12 @@ export class dnd5e{
|
|||||||
if (speed.length > 0) speed += '\n';
|
if (speed.length > 0) speed += '\n';
|
||||||
speed += `${game.i18n.localize("DND5E.MovementWalk")}: ${movement.walk + movement.units}`;
|
speed += `${game.i18n.localize("DND5E.MovementWalk")}: ${movement.walk + movement.units}`;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
const spd = token.actor.data.data.attributes.speed;
|
|
||||||
speed = spd.value;
|
|
||||||
if (spd.special.length > 0) speed + "\n" + spd.special;
|
|
||||||
}
|
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
getInitiative(token) {
|
getInitiative(token) {
|
||||||
let initiative = token.actor.data.data.attributes.init.total;
|
let initiative = this.getActorData(token).attributes.init.total;
|
||||||
return (initiative >= 0) ? `+${initiative}` : initiative;
|
return (initiative >= 0) ? `+${initiative}` : initiative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,38 +119,62 @@ export class dnd5e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPassivePerception(token) {
|
getPassivePerception(token) {
|
||||||
return token.actor.data.data.skills.prc.passive;
|
return this.getActorData(token).skills.prc.passive;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPassiveInvestigation(token) {
|
getPassiveInvestigation(token) {
|
||||||
return token.actor.data.data.skills.inv.passive;
|
return this.getActorData(token).skills.inv.passive;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 this.getActorData(token).abilities?.[ability].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbilityModifier(token, ability) {
|
getAbilityModifier(token, ability) {
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
let val = token.actor.data.data.abilities?.[ability].mod;
|
let val = this.getActorData(token).abilities?.[ability].mod;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbilitySave(token, ability) {
|
getAbilitySave(token, ability) {
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
let val = token.actor.data.data.abilities?.[ability].save;
|
let val = this.getActorData(token).abilities?.[ability].save;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
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) {
|
getSkill(token, skill) {
|
||||||
if (skill == undefined) skill = 'acr';
|
if (skill == undefined) skill = 'acr';
|
||||||
const val = token.actor.data.data.skills?.[skill].total;
|
const val = this.getActorData(token).skills?.[skill].total;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
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) {
|
getProficiency(token) {
|
||||||
const val = token.actor.data.data.attributes.prof;
|
const val = this.getActorData(token).attributes.prof;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +189,12 @@ export class dnd5e{
|
|||||||
return token.actor.effects.find(e => e.isTemporary === condition) != undefined;
|
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) {
|
async toggleCondition(token,condition) {
|
||||||
if (condition == undefined) condition = 'removeAll';
|
if (condition == undefined) condition = 'removeAll';
|
||||||
if (condition == 'removeAll'){
|
if (condition == 'removeAll'){
|
||||||
@@ -144,10 +220,20 @@ export class dnd5e{
|
|||||||
if (roll == 'ability') token.actor.rollAbilityTest(ability,options);
|
if (roll == 'ability') token.actor.rollAbilityTest(ability,options);
|
||||||
else if (roll == 'save') token.actor.rollAbilitySave(save,options);
|
else if (roll == 'save') token.actor.rollAbilitySave(save,options);
|
||||||
else if (roll == 'skill') token.actor.rollSkill(skill,options);
|
else if (roll == 'skill') token.actor.rollSkill(skill,options);
|
||||||
else if (roll == 'initiative') token.actor.rollInitiative(options);
|
else if (roll == 'initiative') {
|
||||||
|
options.rerollInitiative = true;
|
||||||
|
token.actor.rollInitiative(options);
|
||||||
|
}
|
||||||
else if (roll == 'deathSave') token.actor.rollDeathSave(options);
|
else if (roll == 'deathSave') token.actor.rollDeathSave(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRollTypes() {
|
||||||
|
return [
|
||||||
|
{value:'initiative', name:'Initiative'},
|
||||||
|
{value:'deathSave', name:'Death Save'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Items
|
* Items
|
||||||
*/
|
*/
|
||||||
@@ -159,7 +245,30 @@ export class dnd5e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemUses(item) {
|
getItemUses(item) {
|
||||||
return {available: item.data.data.quantity};
|
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'}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,38 +277,107 @@ export class dnd5e{
|
|||||||
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 == '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)
|
else return allItems.filter(i => i.type == featureType)
|
||||||
}
|
}
|
||||||
|
|
||||||
getFeatureUses(item) {
|
getFeatureUses(item) {
|
||||||
if (item.data.type == 'class') return {available: item.data.data.levels};
|
if (item.type == 'class') return {available: this.getItemData(item).levels};
|
||||||
else return {
|
else return {
|
||||||
available: item.data.data.uses.value,
|
available: this.getItemData(item).uses.value,
|
||||||
maximum: item.data.data.uses.max
|
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
|
* Spells
|
||||||
*/
|
*/
|
||||||
getSpells(token,level) {
|
getSpells(token,level,type) {
|
||||||
if (level == undefined) level = 'any';
|
if (level == undefined) level = 'any';
|
||||||
|
if (type == undefined) type = '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 == level)
|
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) {
|
getSpellUses(token,level,item) {
|
||||||
if (level == undefined) level = 'any';
|
if (level == undefined || level == 'any') level = this.getItemData(item).level;
|
||||||
if (item.data.data.level == 0) return;
|
if (this.getItemData(item).level == 0) return;
|
||||||
return {
|
return {
|
||||||
available: token.actor.data.data.spells?.[`spell${level}`].value,
|
available: this.getActorData(token).spells?.[`spell${level}`].value,
|
||||||
maximum: token.actor.data.data.spells?.[`spell${level}`].max
|
maximum: this.getActorData(token).spells?.[`spell${level}`].max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rollItem(item) {
|
getSpellLevels() {
|
||||||
return item.roll()
|
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
334
src/systems/forbidden-lands.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +1,96 @@
|
|||||||
import {compatibleCore} from "../misc.js";
|
|
||||||
import { otherControls } from "../../MaterialDeck.js";
|
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{
|
export class pf2e{
|
||||||
constructor(){
|
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) {
|
getHP(token) {
|
||||||
const hp = token.actor.data.data.attributes.hp;
|
const hp = token.actor.attributes?.hp;
|
||||||
return {
|
return {
|
||||||
value: hp.value,
|
value: (hp?.value == null) ? 0 : hp.value,
|
||||||
max: hp.max
|
max: (hp?.max == null) ? 0 : hp.max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTempHP(token) {
|
getTempHP(token) {
|
||||||
const hp = token.actor.data.data.attributes.hp;
|
const hp = token.actor.attributes?.hp;
|
||||||
return {
|
return {
|
||||||
value: (hp.temp == null) ? 0 : hp.temp,
|
value: (hp?.temp == null) ? 0 : hp.temp,
|
||||||
max: (hp.tempmax == null) ? 0 : hp.tempmax
|
max: (hp?.tempmax == null) ? 0 : hp.tempmax
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getAC(token) {
|
getAC(token) {
|
||||||
return token.actor.data.data.attributes.ac.value;
|
const ac = token.actor.attributes?.ac;
|
||||||
|
return (ac?.value == null) ? 10 : ac?.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getShieldHP(token) {
|
getShieldHP(token) {
|
||||||
return token.actor.data.data.attributes.shield.value;
|
const shieldhp = token.actor.attributes.shield
|
||||||
|
return (shieldhp?.value == null) ? 0 : shieldhp?.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpeed(token) {
|
getSpeed(token) {
|
||||||
let speed = `${token.actor.data.data.attributes.speed.total}'`;
|
if (this.isLimitedSheet(token.actor) || token.actor.type == 'hazard') {
|
||||||
const otherSpeeds = token.actor.data.data.attributes.speed.otherSpeeds;
|
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)
|
if (otherSpeeds.length > 0)
|
||||||
for (let os of otherSpeeds)
|
for (let os of otherSpeeds)
|
||||||
speed += `\n${os.type} ${os.total}'`;
|
speed += `\n${os.type} ${os.total}'`;
|
||||||
@@ -40,14 +98,20 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInitiative(token) {
|
getInitiative(token) {
|
||||||
let initiativeModifier = token.actor.data.data.attributes?.initiative.totalModifier;
|
if (this.isLimitedSheet(token.actor) || token.actor.type == 'familiar') return '';
|
||||||
let initiativeAbility = token.actor.data.data.attributes?.initiative.ability;
|
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) {
|
if (initiativeModifier > 0) {
|
||||||
initiativeModifier = `+${initiativeModifier}`;
|
initiativeModifier = `+${initiativeModifier}`;
|
||||||
} else {
|
} else {
|
||||||
initiativeModifier = this.getPerception(token); //NPCs won't have a valid Initiative value, so default to use Perception
|
initiativeModifier = this.getPerception(token); //NPCs won't have a valid Initiative value, so default to use Perception
|
||||||
}
|
}
|
||||||
return (initiativeAbility != '') ? `(${initiativeAbility}): ${initiativeModifier}` : `(perception): ${initiativeModifier}`;
|
return `${initiativeLabel} (${initiativeModifier})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleInitiative(token) {
|
toggleInitiative(token) {
|
||||||
@@ -63,47 +127,101 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPerception(token) {
|
getPerception(token) {
|
||||||
let perception = token.actor.data.data.attributes?.perception.totalModifier;
|
if (this.isLimitedSheet(token.actor) || token.actor.type == 'hazard') return '';
|
||||||
|
let perception = token.actor.attributes.perception?.totalModifier;
|
||||||
return (perception >= 0) ? `+${perception}` : perception;
|
return (perception >= 0) ? `+${perception}` : perception;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbility(token, ability) {
|
getAbility(token, ability) {
|
||||||
|
if (this.isLimitedSheet(token.actor) || token.actor.type == 'familiar') return '';
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
return token.actor.data.data.abilities?.[ability].value;
|
return token.actor.abilities?.[ability]?.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbilityModifier(token, ability) {
|
getAbilityModifier(token, ability) {
|
||||||
|
if (this.isLimitedSheet(token.actor) || token.actor.type == 'hazard' || token.actor.type == 'familiar') return '';
|
||||||
if (ability == undefined) ability = 'str';
|
if (ability == undefined) ability = 'str';
|
||||||
let val = token.actor.data.data.abilities?.[ability].mod;
|
let val = token.actor.abilities?.[ability]?.mod;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbilitySave(token, ability) {
|
getAbilitySave(token, ability) {
|
||||||
if (ability == undefined) ability = 'fortitude';
|
if (ability == undefined) return 'fortitude';
|
||||||
else if (ability == 'fort') ability = 'fortitude';
|
//ability = this.fixSave(ability);
|
||||||
else if (ability == 'ref') ability = 'reflex';
|
const save = this.findSave(token, ability);
|
||||||
else if (ability == 'will') ability = 'will';
|
if (save == undefined) return '';
|
||||||
let val = token.actor.data.data.saves?.[ability].value;
|
let val = save?.value;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
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) {
|
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 == undefined) skill = 'acr';
|
||||||
if (skill.startsWith('lor')) {
|
if (skill.startsWith('lor')) {
|
||||||
const index = parseInt(skill.split('_')[1])-1;
|
const index = parseInt(skill.split('_')[1])-1;
|
||||||
const loreSkills = this.getLoreSkills(token);
|
const loreSkills = this.getLoreSkills(token);
|
||||||
if (loreSkills.length > index) {
|
if (loreSkills.length > index) {
|
||||||
return `${loreSkills[index].name}: +${loreSkills[index].totalModifier}`;
|
return loreSkills[index];
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const val = token.actor.data.data.skills?.[skill].totalModifier;
|
return this.getActorData(token).skills?.[skill];
|
||||||
return (val >= 0) ? `+${val}` : val;
|
}
|
||||||
|
|
||||||
|
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) {
|
getLoreSkills(token) {
|
||||||
const skills = token.actor.data.data.skills;
|
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);
|
return Object.keys(skills).map(key => skills[key]).filter(s => s.lore == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,9 +260,7 @@ export class pf2e{
|
|||||||
const effect = this.getConditionValue(token,condition);
|
const effect = this.getConditionValue(token,condition);
|
||||||
if (effect == undefined) {
|
if (effect == undefined) {
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
const Condition = this.getConditionName(condition);
|
await game.pf2e.ConditionManager.addConditionToToken(condition, token);
|
||||||
const newCondition = game.pf2e.ConditionManager.getCondition(Condition);
|
|
||||||
await game.pf2e.ConditionManager.addConditionToToken(newCondition, token);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -166,41 +282,53 @@ export class pf2e{
|
|||||||
async toggleCondition(token,condition) {
|
async toggleCondition(token,condition) {
|
||||||
if (condition == undefined) condition = 'removeAll';
|
if (condition == undefined) condition = 'removeAll';
|
||||||
if (condition == 'removeAll'){
|
if (condition == 'removeAll'){
|
||||||
for( let effect of token.actor.items.filter(i => i.type == 'condition'))
|
for( let existing of token.actor.items.filter(i => i.type == 'condition'))
|
||||||
await effect.delete();
|
await game.pf2e.ConditionManager.removeConditionFromToken(existing.data._id, token);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const effect = this.getCondition(token,condition);
|
const effect = this.getCondition(token,condition);
|
||||||
if (effect == undefined) {
|
if (effect == undefined) {
|
||||||
const Condition = this.getConditionName(condition);
|
await game.pf2e.ConditionManager.addConditionToToken(condition, token);
|
||||||
const newCondition = game.pf2e.ConditionManager.getCondition(Condition);
|
|
||||||
newCondition.data.sources.hud = !0,
|
|
||||||
await game.pf2e.ConditionManager.addConditionToToken(newCondition, token);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
effect.delete();
|
await game.pf2e.ConditionManager.removeConditionFromToken(effect.data._id, token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
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
|
||||||
*/
|
*/
|
||||||
roll(token,roll,options,ability,skill,save) {
|
roll(token,roll,options,ability,skill,save) {
|
||||||
|
if (this.isLimitedSheet(token.actor)) return;
|
||||||
|
options.skipDialog = true;
|
||||||
if (roll == undefined) roll = 'skill';
|
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 == 'perception') {
|
||||||
if (roll == 'initiative') token.actor.rollInitiative(options);
|
this.checkRoll(`Perception Check`, token.actor.perception, 'perception-check', token.actor);
|
||||||
if (roll == 'ability') token.actor.rollAbility(options, ability);
|
}
|
||||||
|
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') {
|
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.rollSave(options, ability);
|
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') {
|
else if (roll == 'skill') {
|
||||||
if (skill.startsWith('lor')) {
|
if (skill.startsWith('lor')) {
|
||||||
@@ -213,14 +341,29 @@ export class pf2e{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
token.actor.data.data.skills?.[skill].roll(options);
|
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
|
* Items
|
||||||
*/
|
*/
|
||||||
getItems(token,itemType) {
|
getItems(token,itemType) {
|
||||||
|
if (this.isLimitedSheet(token.actor)) return [];
|
||||||
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');
|
||||||
@@ -229,22 +372,49 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemUses(item) {
|
getItemUses(item) {
|
||||||
return {available: item.data.data.quantity.value};
|
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
|
* Features
|
||||||
*/
|
*/
|
||||||
getFeatures(token,featureType) {
|
getFeatures(token,featureType) {
|
||||||
|
if (this.isLimitedSheet(token.actor)) return [];
|
||||||
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 == 'ancestry' || i.type == 'background' || i.type == 'class' || i.type == 'feat' || i.type == 'action');
|
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-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-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' && i.data.data.actionCategory?.value == 'interaction');
|
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' && i.data.data.actionCategory?.value == 'offensive');
|
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 (featureType == 'strike') { //Strikes are not in the actor.items collection
|
||||||
let actions = token.actor.data.data.actions.filter(a=>a.type == 'strike');
|
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) {
|
for (let a of actions) {
|
||||||
a.img = a.imageUrl;
|
a.img = a.imageUrl;
|
||||||
a.data = {
|
a.data = {
|
||||||
@@ -257,38 +427,227 @@ export class pf2e{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFeatureUses(item) {
|
getFeatureUses(item) {
|
||||||
if (item.data.type == 'class') return {available: item.actor.data.data.details.level.value};
|
if (item.data.type == 'class') return {available: item.parent.data.data.details.level.value};
|
||||||
else return;
|
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
|
* Spells
|
||||||
*/
|
*/
|
||||||
getSpells(token,level) {
|
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';
|
if (level == undefined) level = 'any';
|
||||||
const allItems = token.actor.items;
|
let spellData = this.getSpellData(token);
|
||||||
if (level == 'any') return allItems.filter(i => i.type == 'spell')
|
|
||||||
if (level == '0') return allItems.filter(i => i.type == 'spell' && i.isCantrip == true)
|
if (level == 'f') return this.getUniqueSpells(spellData[11]);
|
||||||
else return allItems.filter(i => i.type == 'spell' && i.level == level && i.isCantrip == false)
|
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) {
|
getSpellUses(token,level,item) {
|
||||||
|
if (this.isLimitedSheet(token.actor)) return '';
|
||||||
if (level == undefined || level == 'any') level = item.level;
|
if (level == undefined || level == 'any') level = item.level;
|
||||||
if (item.isCantrip == true) return;
|
if (item.isCantrip == true) return;
|
||||||
const spellbook = token.actor.items.filter(i => i.data.type === 'spellcastingEntry')[0];
|
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 == 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 {
|
return {
|
||||||
available: spellbook.data.data.slots?.[`slot${level}`].value,
|
available: spellbook.data.data.slots?.[`slot${level}`].value,
|
||||||
maximum: spellbook.data.data.slots?.[`slot${level}`].max
|
maximum: spellbook.data.data.slots?.[`slot${level}`].max
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rollItem(item) {
|
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;
|
let variant = 0;
|
||||||
if (otherControls.rollOption == 'map1') variant = 1;
|
if (otherControls.rollOption == 'map1') variant = 1;
|
||||||
if (otherControls.rollOption == 'map2') variant = 2;
|
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.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});
|
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);
|
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
@@ -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
@@ -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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
import {dnd5e} from "./dnd5e.js"
|
import { dnd5e } from "./dnd5e.js";
|
||||||
import {dnd35e} from "./dnd35e.js"
|
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 { starfinder } from "./starfinder.js";
|
||||||
import { compatibleCore } from "../misc.js";
|
import { compatibleCore } from "../misc.js";
|
||||||
|
import { gamingSystem } from "../../MaterialDeck.js";
|
||||||
|
|
||||||
export class TokenHelper{
|
export class TokenHelper{
|
||||||
constructor(){
|
constructor(){
|
||||||
@@ -12,10 +15,12 @@ export class TokenHelper{
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSystem() {
|
setSystem() {
|
||||||
if (game.system.id == 'D35E' || game.system.id == 'pf1') this.system = new dnd35e();
|
if (gamingSystem == 'D35E' || gamingSystem == 'pf1') this.system = new dnd35e(gamingSystem);
|
||||||
else if (game.system.id == 'pf2e') this.system = new pf2e();
|
else if (gamingSystem == 'pf2e') this.system = new pf2e();
|
||||||
else if (game.system.id == 'demonlord') this.system = new demonlord();
|
else if (gamingSystem == 'demonlord') this.system = new demonlord();
|
||||||
else if (game.system.id == 'wfrp4e') this.system = new wfrp4e();
|
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
|
else this.system = new dnd5e(); //default to dnd5e
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +36,7 @@ export class TokenHelper{
|
|||||||
else if (type == 'actorId') return this.getTokenFromActorId(identifier);
|
else if (type == 'actorId') return this.getTokenFromActorId(identifier);
|
||||||
}
|
}
|
||||||
getTokenFromTokenId(id) {
|
getTokenFromTokenId(id) {
|
||||||
return canvas.tokens.children[0].children.find(p => p.id == id);
|
return canvas.tokens.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTokenFromTokenName(name) {
|
getTokenFromTokenName(name) {
|
||||||
@@ -52,7 +57,7 @@ export class TokenHelper{
|
|||||||
|
|
||||||
moveToken(token,dir){
|
moveToken(token,dir){
|
||||||
if (dir == undefined) dir = 'up';
|
if (dir == undefined) dir = 'up';
|
||||||
const gridSize = canvas.scene.data.grid;
|
const gridSize = canvas.scene.grid.size;
|
||||||
let x = token.x;
|
let x = token.x;
|
||||||
let y = token.y;
|
let y = token.y;
|
||||||
|
|
||||||
@@ -82,8 +87,10 @@ export class TokenHelper{
|
|||||||
}
|
}
|
||||||
if (game.user.isGM == false && game.paused) 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 (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});
|
let coords = canvas.grid.getCenter(x,y);
|
||||||
else token.update({x:x,y: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) {
|
rotateToken(token,move,value) {
|
||||||
@@ -91,11 +98,10 @@ export class TokenHelper{
|
|||||||
value = isNaN(parseInt(value)) ? 0 : parseInt(value);
|
value = isNaN(parseInt(value)) ? 0 : parseInt(value);
|
||||||
|
|
||||||
let rotationVal;
|
let rotationVal;
|
||||||
if (move == 'by') rotationVal = token.data.rotation + value;
|
if (move == 'by') rotationVal = token.document.rotation + value;
|
||||||
else rotationVal = value;
|
else rotationVal = value;
|
||||||
|
|
||||||
if (compatibleCore("0.8.1")) token.document.update({rotation: rotationVal});
|
token.document.update({rotation: rotationVal});
|
||||||
else token.update({rotation: rotationVal});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
@@ -121,16 +127,29 @@ export class TokenHelper{
|
|||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
getTokenIcon(token) {
|
getTokenIcon(token) {
|
||||||
return token.data.img;
|
return token.document.texture.src;
|
||||||
}
|
}
|
||||||
|
|
||||||
getActorIcon(token) {
|
getActorIcon(token) {
|
||||||
return token.actor.data.img;
|
return token.actor.img;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* System agnostic functions
|
* System specific functions
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
getStatsList() {
|
||||||
|
return this.system.getStatsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
getAttackModes() {
|
||||||
|
return this.system.getAttackModes();
|
||||||
|
}
|
||||||
|
|
||||||
|
getOnClickList() {
|
||||||
|
return this.system.getOnClickList();
|
||||||
|
}
|
||||||
|
|
||||||
getHP(token) {
|
getHP(token) {
|
||||||
return this.system.getHP(token);
|
return this.system.getHP(token);
|
||||||
}
|
}
|
||||||
@@ -179,10 +198,22 @@ export class TokenHelper{
|
|||||||
return this.system.getAbilitySave(token, ability);
|
return this.system.getAbilitySave(token, ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAbilityList() {
|
||||||
|
return this.system.getAbilityList();
|
||||||
|
}
|
||||||
|
|
||||||
|
getSavesList() {
|
||||||
|
return this.system.getSavesList();
|
||||||
|
}
|
||||||
|
|
||||||
getSkill(token, skill) {
|
getSkill(token, skill) {
|
||||||
return this.system.getSkill(token, skill);
|
return this.system.getSkill(token, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSkillList() {
|
||||||
|
return this.system.getSkillList();
|
||||||
|
}
|
||||||
|
|
||||||
getProficiency(token) {
|
getProficiency(token) {
|
||||||
return this.system.getProficiency(token);
|
return this.system.getProficiency(token);
|
||||||
}
|
}
|
||||||
@@ -227,6 +258,36 @@ export class TokenHelper{
|
|||||||
return this.system.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
|
* Conditions
|
||||||
*/
|
*/
|
||||||
@@ -242,6 +303,10 @@ export class TokenHelper{
|
|||||||
return this.system.toggleCondition(token,condition);
|
return this.system.toggleCondition(token,condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConditionList() {
|
||||||
|
return this.system.getConditionList();
|
||||||
|
}
|
||||||
|
|
||||||
/* PF2E */
|
/* PF2E */
|
||||||
getConditionValue(token,condition) {
|
getConditionValue(token,condition) {
|
||||||
return this.system.getConditionValue(token,condition);
|
return this.system.getConditionValue(token,condition);
|
||||||
@@ -259,6 +324,10 @@ export class TokenHelper{
|
|||||||
return this.system.roll(token,roll,options,ability,skill,save);
|
return this.system.roll(token,roll,options,ability,skill,save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRollTypes() {
|
||||||
|
return this.system.getRollTypes();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Items
|
* Items
|
||||||
*/
|
*/
|
||||||
@@ -270,6 +339,14 @@ export class TokenHelper{
|
|||||||
return this.system.getItemUses(item);
|
return this.system.getItemUses(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getItemTypes() {
|
||||||
|
return this.system.getItemTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
getWeaponRollModes() {
|
||||||
|
return this.system.getWeaponRollModes();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Features
|
* Features
|
||||||
*/
|
*/
|
||||||
@@ -281,18 +358,40 @@ export class TokenHelper{
|
|||||||
return this.system.getFeatureUses(item);
|
return this.system.getFeatureUses(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFeatureTypes() {
|
||||||
|
return this.system.getFeatureTypes();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spells
|
* Spells
|
||||||
*/
|
*/
|
||||||
getSpells(token,level) {
|
getSpells(token,level,type) {
|
||||||
return this.system.getSpells(token,level);
|
return this.system.getSpells(token,level,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpellUses(token,level,item) {
|
getSpellUses(token,level,item) {
|
||||||
return this.system.getSpellUses(token,level,item);
|
return this.system.getSpellUses(token,level,item);
|
||||||
}
|
}
|
||||||
|
|
||||||
rollItem(item) {
|
rollItem(item, settings, rollOption, attackMode) {
|
||||||
return this.system.rollItem(item);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,30 +1,64 @@
|
|||||||
import { compatibleCore } from "../misc.js";
|
import { compatibleCore } from "../misc.js";
|
||||||
|
|
||||||
export class wfrp4e {
|
export class wfrp4e {
|
||||||
constructor(){
|
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) {
|
getFate(token) {
|
||||||
return token.actor.data.data.status.fate.value
|
return this.getActorData(token).status.fate.value
|
||||||
}
|
}
|
||||||
|
|
||||||
getFortune(token) {
|
getFortune(token) {
|
||||||
return token.actor.data.data.status.fortune.value
|
return this.getActorData(token).status.fortune.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getWounds(token) {
|
getWounds(token) {
|
||||||
const wounds = token.actor.data.data.status.wounds
|
const wounds = this.getActorData(token).status.wounds
|
||||||
return {
|
return {
|
||||||
value: wounds.value,
|
value: wounds.value,
|
||||||
max: wounds.max
|
max: wounds.max
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getCriticalWounds(token) {
|
getCriticalWounds(token) {
|
||||||
const criticalWounds = token.actor.data.data.status.criticalWounds
|
const criticalWounds = this.getActorData(token).status.criticalWounds
|
||||||
return {
|
return {
|
||||||
value: criticalWounds.value,
|
value: criticalWounds.value,
|
||||||
max: criticalWounds.max
|
max: criticalWounds.max
|
||||||
@@ -32,28 +66,35 @@ export class wfrp4e {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCorruption(token) {
|
getCorruption(token) {
|
||||||
return token.actor.data.data.status.corruption.value
|
return this.getActorData(token).status.corruption.value
|
||||||
}
|
}
|
||||||
|
|
||||||
getAdvantage(token) {
|
getAdvantage(token) {
|
||||||
return token.actor.data.data.status.advantage.value
|
return this.getActorData(token).status.advantage.value
|
||||||
}
|
}
|
||||||
|
|
||||||
getResolve(token) {
|
getResolve(token) {
|
||||||
return token.actor.data.data.status.resolve.value
|
return this.getActorData(token).status.resolve.value
|
||||||
}
|
}
|
||||||
|
|
||||||
getResilience(token) {
|
getResilience(token) {
|
||||||
return token.actor.data.data.status.resilience.value
|
return this.getActorData(token).status.resilience.value
|
||||||
}
|
}
|
||||||
|
|
||||||
getAbility(token, abilityName) {
|
getAbility(token, abilityName) {
|
||||||
return this.getCharacteristics(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) {
|
getCharacteristics(token, characteristicName) {
|
||||||
if (characteristicName == undefined ) characteristicName = `AG`;
|
if (characteristicName == undefined ) characteristicName = `AG`;
|
||||||
const characteristic = token.actor.data.data.characteristics[characteristicName.toLowerCase()]
|
const characteristic = this.getActorData(token).characteristics[characteristicName.toLowerCase()]
|
||||||
const val = characteristic.value;
|
const val = characteristic.value;
|
||||||
return (val >= 0) ? `+${val}` : val;
|
return (val >= 0) ? `+${val}` : val;
|
||||||
}
|
}
|
||||||
@@ -64,7 +105,14 @@ export class wfrp4e {
|
|||||||
if (featureType == 'any') return allItems.filter(i => i.type == 'skill' || i.type == 'talent' || i.type == "career" || i.type == 'trait');
|
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);
|
return allItems.filter(i => i.type == featureType);
|
||||||
}
|
}
|
||||||
getSpells(token,spellType) {
|
|
||||||
|
getFeatureTypes() {
|
||||||
|
return [
|
||||||
|
{value: 'skill', name: 'Skills'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
getSpells(token,spellLevel,type) {
|
||||||
const allItems = token.actor.items;
|
const allItems = token.actor.items;
|
||||||
return allItems.filter(i => i.type == 'spell')
|
return allItems.filter(i => i.type == 'spell')
|
||||||
}
|
}
|
||||||
@@ -73,8 +121,28 @@ export class wfrp4e {
|
|||||||
return;
|
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) {
|
getFeatureUses(item) {
|
||||||
return {available: `+${item.data.data.total.value}`};
|
return {available: `+${this.getItemData(item).total.value}`};
|
||||||
}
|
}
|
||||||
|
|
||||||
getHP(token) {
|
getHP(token) {
|
||||||
@@ -85,8 +153,15 @@ export class wfrp4e {
|
|||||||
return game.wfrp4e.utility.rollItemMacro(item.name, item.type, false);
|
return game.wfrp4e.utility.rollItemMacro(item.name, item.type, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRollTypes() {
|
||||||
|
return [
|
||||||
|
{value:'initiative', name:'Initiative'},
|
||||||
|
{value:'deathSave', name:'Death Save'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
getSpeed(token) {
|
getSpeed(token) {
|
||||||
return token.actor.data.data.details.move.value;
|
return this.getActorData(token).details.move.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -103,14 +178,17 @@ export class wfrp4e {
|
|||||||
return true;
|
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) {
|
roll(token,roll,options,ability,skill,save) {
|
||||||
//console.log("roll(", token, roll, options, ability, skill, save, ")");
|
|
||||||
if (ability == undefined) ability = 'ag';
|
if (ability == undefined) ability = 'ag';
|
||||||
return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false);
|
return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getItems(token,itemType) {
|
getItems(token,itemType) {
|
||||||
if (itemType == undefined) itemType = 'any';
|
if (itemType == undefined) itemType = 'any';
|
||||||
const allItems = token.actor.items;
|
const allItems = token.actor.items;
|
||||||
@@ -123,17 +201,29 @@ export class wfrp4e {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getItemUses(item) {
|
getItemUses(item) {
|
||||||
console.log("getItemUses(" , item , ")")
|
|
||||||
if ( item.type == 'ammunition') {
|
if ( item.type == 'ammunition') {
|
||||||
return {available: item.data.data.quantity.value};
|
return {available: this.getItemData(item).quantity.value};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
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
|
/* 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
|
to not be the superset of all possible systems
|
||||||
@@ -168,5 +258,22 @@ export class wfrp4e {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSavesList() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
getWeaponRollModes() {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ring Colors
|
||||||
|
*/
|
||||||
|
getSkillRingColor(token, skill) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getSaveRingColor(token, save) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
18
templates/deviceConfig.html
Normal 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>
|
||||||
@@ -1,64 +1,57 @@
|
|||||||
<form autocomplete="off" onsubmit="event.preventDefault()">
|
<form autocomplete="off" onsubmit="event.preventDefault()">
|
||||||
<style>
|
|
||||||
.columnLabel {
|
|
||||||
width:25%;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.columnVersion {
|
|
||||||
width:15%;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.columnOS {
|
|
||||||
width:15%;
|
|
||||||
}
|
|
||||||
.columnButton {
|
|
||||||
width:15%;
|
|
||||||
}
|
|
||||||
.btn {
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<h2>{{localize "MaterialDeck.DownloadUtility.Plugin"}}</h2>
|
<h2>{{localize "MaterialDeck.DownloadUtility.Plugin"}}</h2>
|
||||||
|
|
||||||
<table style="width:100%; min-width:400px">
|
<table style="width:100%; min-width:400px">
|
||||||
<tr>
|
<tr>
|
||||||
<th class='columnLabel'></th>
|
<th class='materialDeck_dlUtil_columnLabel'></th>
|
||||||
<th class='columnVersion'>{{localize "MaterialDeck.DownloadUtility.Current"}}</th>
|
<th class='materialDeck_dlUtil_columnVersion'>{{localize "MaterialDeck.DownloadUtility.Current"}}</th>
|
||||||
<th class='columnVersion'>{{localize "MaterialDeck.DownloadUtility.Minimum"}}</th>
|
<th class='materialDeck_dlUtil_columnVersion'>{{localize "MaterialDeck.DownloadUtility.Minimum"}}</th>
|
||||||
<th class='columnVersion'>{{localize "MaterialDeck.DownloadUtility.Latest"}}</th>
|
<th class='materialDeck_dlUtil_columnVersion'>{{localize "MaterialDeck.DownloadUtility.Latest"}}</th>
|
||||||
<th class='columnOS'>{{localize "MaterialDeck.DownloadUtility.OS"}}</th>
|
<th class='materialDeck_dlUtil_columnOS'>{{localize "MaterialDeck.DownloadUtility.OS"}}</th>
|
||||||
<th class='columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
|
<th class='materialDeck_dlUtil_columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='columnLabel'>{{localize "MaterialDeck.DownloadUtility.SDplugin"}}</td>
|
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.module"}}</td>
|
||||||
<td class='columnVersion'>{{localSdVersion}}</td>
|
<td class='materialDeck_dlUtil_columnVersion'>{{localModuleVersion}}</td>
|
||||||
<td class='columnVersion'>{{minimumSdVersion}}</td>
|
<td class='materialDeck_dlUtil_columnVersion'></td>
|
||||||
<td class='columnVersion' id='masterSdVersion'>{{masterSdVersion}}</td>
|
<td class='materialDeck_dlUtil_columnVersion' id='materialDeck_dlUtil_masterModuleVersion'>{{masterModuleVersion}}</td>
|
||||||
<td class='columnOS'></td>
|
<td class='materialDeck_dlUtil_columnOS'></td>
|
||||||
<td class='columnButton'>
|
<td class='materialDeck_dlUtil_columnButton'><button type="button" class='materialDeck_dlUtil_button' style="visibility:hidden">
|
||||||
<button type="button" class='btn' id='downloadSd' {{#if sdDlDisable}}disabled{{/if}}>
|
|
||||||
<i class="fas fa-download"></i>
|
<i class="fas fa-download"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class='columnLabel'>{{localize "MaterialDeck.DownloadUtility.MSserver"}}</td>
|
<td class='materialDeck_dlUtil_columnLabel'>{{localize "MaterialDeck.DownloadUtility.SDplugin"}}</td>
|
||||||
<td class='columnVersion'>{{localMsVersion}}</td>
|
<td class='materialDeck_dlUtil_columnVersion'>{{localSdVersion}}</td>
|
||||||
<td class='columnVersion'>{{minimumMsVersion}}</td>
|
<td class='materialDeck_dlUtil_columnVersion'>{{minimumSdVersion}}</td>
|
||||||
<td class='columnVersion' id='masterMsVersion'>{{masterMsVersion}}</td>
|
<td class='materialDeck_dlUtil_columnVersion' id='materialDeck_dlUtil_masterSdVersion'>{{masterSdVersion}}</td>
|
||||||
<td class='columnOS'>
|
<td class='materialDeck_dlUtil_columnOS'></td>
|
||||||
<select id="os" default="" {{#if msDlDisable}}disabled{{/if}}>
|
<td class='materialDeck_dlUtil_columnButton'>
|
||||||
<option value="win">{{localize "MaterialDeck.DownloadUtility.Windows"}}</option>
|
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_downloadSd' {{#if sdDlDisable}}disabled{{/if}}>
|
||||||
<option value="macos">{{localize "MaterialDeck.DownloadUtility.Macos"}}</option>
|
<i class="fas fa-download"></i>
|
||||||
<option value="linux">{{localize "MaterialDeck.DownloadUtility.Linux"}}</option>
|
</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>
|
<option value="source">{{localize "MaterialDeck.DownloadUtility.Source"}}</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td class='columnButton'>
|
<td class='materialDeck_dlUtil_columnButton'>
|
||||||
<button type="button" class='btn' id='downloadMs' {{#if msDlDisable}}disabled{{/if}}>
|
<button type="button" class='materialDeck_dlUtil_button' id='materialDeck_dlUtil_downloadMs' {{#if msDlDisable}}disabled{{/if}}>
|
||||||
<i class="fas fa-download"></i>
|
<i class="fas fa-download"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -70,14 +63,14 @@
|
|||||||
<table style="width:100%; min-width:400px">
|
<table style="width:100%; min-width:400px">
|
||||||
<tr>
|
<tr>
|
||||||
<th style='text-align: left;'>{{localize "MaterialDeck.DownloadUtility.Name"}}</th>
|
<th style='text-align: left;'>{{localize "MaterialDeck.DownloadUtility.Name"}}</th>
|
||||||
<th class='columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
|
<th class='materialDeck_dlUtil_columnButton'>{{localize "MaterialDeck.DownloadUtility.Download"}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<div id='profileContents'>
|
<div id='profileContents'>
|
||||||
{{#each profiles as |p|}}
|
{{#each profiles as |p|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{p.label}}</td>
|
<td>{{p.label}}</td>
|
||||||
<td class='columnButton'>
|
<td class='materialDeck_dlUtil_columnButton'>
|
||||||
<button type="button" class='btn' id='dlProfile-{{p.id}}' name='downloadProfile' {{#if ../profileDlDisable}}disabled{{/if}}>
|
<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>
|
<i class="fas fa-download"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -86,7 +79,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<button type="button" id='refresh'>
|
<button type="button" id='materialDeck_dlUtil_refresh'>
|
||||||
<i class="fas fa-redo"></i>
|
<i class="fas fa-redo"></i>
|
||||||
{{localize "MaterialDeck.DownloadUtility.Refresh"}}
|
{{localize "MaterialDeck.DownloadUtility.Refresh"}}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{localize "MaterialDeck.Filename"}}: </label>
|
<label>{{localize "MaterialDeck.Filename"}}: </label>
|
||||||
<input type="text" name="name" value="{{name}}" id="name" style="width:100%;" >
|
<input type="text" name="name" value="{{name}}" style="width:100%;" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" name="submit">
|
<button type="submit" name="submit">
|
||||||
|
|||||||
@@ -1,8 +1,21 @@
|
|||||||
<form autocomplete="off" onsubmit="event.preventDefault()">
|
<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">
|
<div style="width:1200px">
|
||||||
|
|
||||||
<h1>Introduction</h1>
|
<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.
|
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,
|
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>
|
control playlists, execute macros, display and control the combat tracker.<br><br>
|
||||||
@@ -12,18 +25,25 @@
|
|||||||
<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,
|
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>
|
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>Latest Releases</h1>
|
<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/releases">Module</a><br>
|
||||||
<a href="https://github.com/CDeenen/MaterialDeck_SD/releases">Stream Deck</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>
|
<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.
|
You can use the download utility in the module settings to download the Stream Deck plugin, Stream Deck profiles and Material Server.
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1>Getting Started</h1>
|
<h1 class="materialDeck_helpMenu_expandable"><img src="modules/MaterialDeck/img/right.png" class="materialDeck_helpMenu_expandableIcon" style="width:20px">Getting Started</h1>
|
||||||
Besides installing this module, you also need to install and run some other things.
|
<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>Installing the Stream Deck Software and Plugin</h2>
|
<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>
|
||||||
YOu have to download and install the <a href="https://www.elgato.com/en/gaming/downloads">Stream Deck software</a>.
|
<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.
|
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.
|
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>
|
<br>
|
||||||
@@ -41,29 +61,33 @@
|
|||||||
<li>Double-click the file, this should open the Stream Deck software</li>
|
<li>Double-click the file, this should open the Stream Deck software</li>
|
||||||
<li>Press 'Install' in the pop-up</li>
|
<li>Press 'Install' in the pop-up</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Installing a Stream Deck Profile (optional)</h2>
|
<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.
|
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>
|
<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>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>
|
<li>Double-click the file, this should load the profile into the Stream Deck software</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Downloading and Starting Material Server</h2>
|
<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.
|
Material Server acts as a bridge application, bridging the communication between the Stream Deck and Material Deck.
|
||||||
<ol>
|
<ol>
|
||||||
<li>Download the latest version for your operating system <a href="https://github.com/CDeenen/MaterialServer/releases">here</a></li>
|
<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>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>Extract the archive</li>
|
||||||
<li>Double-click the file to start the server</li>
|
<li>Run 'materialserver.exe' (Windows) or 'materialserver' (MacOS and Linux)</li>
|
||||||
</ol>
|
</ol>
|
||||||
<b>You need to always have Material Server running when you want to use Material Deck</b>
|
<b>You need to always have Material Server running when you want to use Material Deck</b><br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<a href="https://github.com/CDeenen/MaterialServer/wiki">Material Server documentation</a>
|
||||||
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.
|
</div>
|
||||||
Most things should be pretty self explanatory. After that you could look into customizing your experience, as you can read about below.
|
|
||||||
|
|
||||||
<h1>Module Setup</h1>
|
</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">
|
<img src="modules/MaterialDeck/wiki/img/ModuleSettings.png" align="right" HSPACE="5" width="450">
|
||||||
There are four buttons at the top:
|
There are four buttons at the top:
|
||||||
<ul>
|
<ul>
|
||||||
@@ -92,7 +116,8 @@
|
|||||||
|
|
||||||
<BR CLEAR="right" />
|
<BR CLEAR="right" />
|
||||||
|
|
||||||
<h2>User Permission Configuration</h2>
|
<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">
|
<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>
|
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>
|
Each action has various settings, and these settings can be set for each user role.<br>
|
||||||
@@ -101,8 +126,10 @@
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<BR CLEAR="right" />
|
<BR CLEAR="right" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Download Utility</h2>
|
<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">
|
<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>
|
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>
|
Please note that the current version of Material Server is at the moment not supported.<br>
|
||||||
@@ -112,8 +139,10 @@
|
|||||||
The refresh button at the bottom refreshes the page in case there was a connection issue.
|
The refresh button at the bottom refreshes the page in case there was a connection issue.
|
||||||
|
|
||||||
<BR CLEAR="right" />
|
<BR CLEAR="right" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Playlist Configuration</h2>
|
<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">
|
<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>
|
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'.
|
There are 2 sections: 'Settings', and 'Playlists'.
|
||||||
@@ -141,8 +170,10 @@
|
|||||||
For each playlist you can set the play mode, which overrides the default play mode for that specific playlist.<br>
|
For each playlist you can set the play mode, which overrides the default play mode for that specific playlist.<br>
|
||||||
<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.
|
<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>Macro Configuration</h2>
|
<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>
|
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>
|
<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.
|
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.
|
||||||
@@ -171,8 +202,10 @@
|
|||||||
or you might run into issues.
|
or you might run into issues.
|
||||||
|
|
||||||
<img src="modules/MaterialDeck/wiki/img/MacroConfig.png" align="center" HSPACE="5" width="100%">
|
<img src="modules/MaterialDeck/wiki/img/MacroConfig.png" align="center" HSPACE="5" width="100%">
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Soundboard Configuration</h2>
|
<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>
|
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>
|
<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.
|
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.
|
||||||
@@ -215,8 +248,11 @@
|
|||||||
or you might run into issues.
|
or you might run into issues.
|
||||||
|
|
||||||
<img src="modules/MaterialDeck/wiki/img/SoundboardConfig.png" align="center" HSPACE="5" width="100%">
|
<img src="modules/MaterialDeck/wiki/img/SoundboardConfig.png" align="center" HSPACE="5" width="100%">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1>Customization</h1>
|
<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>
|
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>
|
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>
|
<br>
|
||||||
@@ -237,15 +273,18 @@
|
|||||||
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Soundboard-Action">Soundboard 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>
|
<li><a href="https://github.com/CDeenen/MaterialDeck/wiki/Token-Action">Token Action</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<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>
|
<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>
|
<b>Author:</b> Cristian Deenen (Cris#6864 on Discord)<br>
|
||||||
<br>
|
<br>
|
||||||
Special thanks to Asmodeus#7588 who made this module possible by generously donating a Stream Deck XL
|
Special thanks to Asmodeus#7588 who made this module possible by generously donating a Stream Deck XL
|
||||||
<br>
|
<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.
|
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>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<div class="form-group upload-file">
|
<div class="form-group upload-file">
|
||||||
<label><i class="fas fa-upload fa-fw"></i> {{ localize "FILES.Upload" }}</label>
|
<label><i class="fas fa-upload fa-fw"></i> {{ localize "FILES.Upload" }}</label>
|
||||||
<input type="file" name="upload" id="uploadJson">
|
<input type="file" name="upload" id="materialDeck_import_uploadJson">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" name="submit">
|
<button type="submit" name="submit">
|
||||||
|
|||||||
@@ -1,25 +1,12 @@
|
|||||||
<form autocomplete="off" onsubmit="event.preventDefault()">
|
<form autocomplete="off" onsubmit="event.preventDefault()">
|
||||||
<style>
|
<div class="materialDeck_macroConfig_navigationDiv">
|
||||||
.boxed {
|
<button type="button" class="materialDeck_macroConfig_navigation" name="navPrev" {{prevDisabled}}>
|
||||||
border: 1px solid black ;
|
|
||||||
border-radius: 5px ;
|
|
||||||
max-width: 166px;
|
|
||||||
height: {{height}}px;
|
|
||||||
}
|
|
||||||
.navigation {
|
|
||||||
flex:1;
|
|
||||||
max-width: 8%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="navigationDiv" style="width:100%; display:flex; flex-direction:row;">
|
|
||||||
<button type="button" class="navigation" id="navPrev" {{prevDisabled}}>
|
|
||||||
<i class="fas fa-arrow-left"></i>
|
<i class="fas fa-arrow-left"></i>
|
||||||
</button>
|
</button>
|
||||||
<p style="width:84%; text-align:center; padding: 0px 0; font-size: 20px"><b>
|
<p class="materialDeck_macroConfig_p"><b>
|
||||||
{{localize "MaterialDeck.Perm.MACRO.label"}}: {{macroRange}} {{localize "MaterialDeck.Of"}} {{totalMacros}}
|
{{localize "MaterialDeck.Perm.MACRO.label"}}: {{macroRange}} {{localize "MaterialDeck.Of"}} {{totalMacros}}
|
||||||
</b></p>
|
</b></p>
|
||||||
<button type="button" class="navigation" id="navNext">
|
<button type="button" class="materialDeck_macroConfig_navigation" name="navNext">
|
||||||
<i class="fas fa-arrow-right"></i>
|
<i class="fas fa-arrow-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -27,13 +14,20 @@
|
|||||||
|
|
||||||
{{#each macroData}}
|
{{#each macroData}}
|
||||||
<div class="form-group" style="width:100%">
|
<div class="form-group" style="width:100%">
|
||||||
{{#each this.dataThis}}
|
{{#each this.macroRowConfig}}
|
||||||
<div class="boxed" style="padding: 5px; margin:2px; width:10%">
|
<div class="materialDeck_macroConfig_boxed">
|
||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
{{localize "MaterialDeck.Macro"}} {{this.iteration}}
|
{{localize "MaterialDeck.Macro"}} {{this.iteration}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<select name="macros" class="macros-select" id="macros{{this.iteration}}" default="" style="width:100%;">
|
<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}}
|
{{#select this.macro}}
|
||||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||||
{{#each ../../macros}}
|
{{#each ../../macros}}
|
||||||
@@ -44,30 +38,30 @@
|
|||||||
</div>
|
</div>
|
||||||
{{#if ../../furnace}}
|
{{#if ../../furnace}}
|
||||||
<label>{{localize "MaterialDeck.FurnaceArgs"}}</label>
|
<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}}
|
{{/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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<hr>
|
<hr>
|
||||||
<div class="navigationDiv" style="width:100%; display:flex; flex-direction:row;">
|
<div class="materialDeck_macroConfig_navigationDiv">
|
||||||
<button type="button" class="navigation" id="clearPage">
|
<button type="button" class="materialDeck_macroConfig_navigation" name="clearPage">
|
||||||
<i></i>{{localize "MaterialDeck.ClearPage"}}
|
<i></i>{{localize "MaterialDeck.ClearPage"}}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="navigation" id="clearAll">
|
<button type="button" class="materialDeck_macroConfig_navigation" name="clearAll">
|
||||||
<i></i>{{localize "MaterialDeck.ClearAll"}}
|
<i></i>{{localize "MaterialDeck.ClearAll"}}
|
||||||
</button>
|
</button>
|
||||||
<p style="width:68%;"></p>
|
<p style="width:68%;"></p>
|
||||||
<button type="button" class="navigation" id="import">
|
<button type="button" class="materialDeck_macroConfig_navigation" name="import">
|
||||||
<i></i>{{localize "MaterialDeck.Import"}}
|
<i></i>{{localize "MaterialDeck.Import"}}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="navigation" id="export">
|
<button type="button" class="materialDeck_macroConfig_navigation" name="export">
|
||||||
<i></i>{{localize "MaterialDeck.Export"}}
|
<i></i>{{localize "MaterialDeck.Export"}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{localize "MaterialDeck.PL.Mode"}}</label>
|
<label>{{localize "MaterialDeck.PL.Mode"}}</label>
|
||||||
<select name="playMode" class="playMode" default="">
|
<select name="playMode" class="materialDeck_plConfig_select" default="">
|
||||||
{{#select playMode}}
|
{{#select playMode}}
|
||||||
<option value="0">{{localize "MaterialDeck.PL.Unrestricted"}}</option>
|
<option value="0">{{localize "MaterialDeck.PL.Unrestricted"}}</option>
|
||||||
<option value="1">{{localize "MaterialDeck.PL.OneTrackPlaylist"}}</option>
|
<option value="1">{{localize "MaterialDeck.PL.OneTrackPlaylist"}}</option>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{localize "MaterialDeck.PL.Nr"}}</label>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<h2>{{localize "MaterialDeck.Playlists"}}</h2>
|
<h2>{{localize "MaterialDeck.Playlists"}}</h2>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
{{#each playlistData}}
|
{{#each playlistData}}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{localize "MaterialDeck.Playlist"}} {{this.iteration}}</label>
|
<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}}
|
{{#select this.playlist}}
|
||||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||||
{{#each ../playlists}}
|
{{#each ../playlists}}
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<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}}
|
{{#select this.playlistMode}}
|
||||||
<option value="0">{{localize "MaterialDeck.PL.Mode"}}</option>
|
<option value="0">{{localize "MaterialDeck.PL.Mode"}}</option>
|
||||||
<option value="1">{{localize "MaterialDeck.PL.Unrestricted"}}</option>
|
<option value="1">{{localize "MaterialDeck.PL.Unrestricted"}}</option>
|
||||||
|
|||||||
@@ -1,25 +1,13 @@
|
|||||||
<form autocomplete="off" onsubmit="event.preventDefault()">
|
<form autocomplete="off" onsubmit="event.preventDefault()">
|
||||||
<style>
|
|
||||||
.boxed {
|
|
||||||
border: 1px solid black ;
|
|
||||||
border-radius: 5px ;
|
|
||||||
max-width: 166px;
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navigation {
|
<div class="materialDeck_sbConfig_navigationDiv">
|
||||||
flex:1;
|
<button type="button" class="materialDeck_sbConfig_navigation" name="navPrev" {{prevDisabled}}>
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="navigation" style="width:100%; display:flex; flex-direction:row;">
|
|
||||||
<button type="button" class="navigation" id="navPrev" {{prevDisabled}}>
|
|
||||||
<i class="fas fa-arrow-left"></i>
|
<i class="fas fa-arrow-left"></i>
|
||||||
</button>
|
</button>
|
||||||
<p style="flex:15; text-align:center; padding: 0px 0; font-size: 20px"><b>
|
<p class="materialDeck_sbConfig_p"><b>
|
||||||
{{localize "MaterialDeck.Sounds"}}: {{soundRange}} {{localize "MaterialDeck.Of"}} {{totalSounds}}
|
{{localize "MaterialDeck.Sounds"}}: {{soundRange}} {{localize "MaterialDeck.Of"}} {{totalSounds}}
|
||||||
</b></p>
|
</b></p>
|
||||||
<button type="button" class="navigation" id="navNext">
|
<button type="button" class="materialDeck_sbConfig_navigation" name="navNext">
|
||||||
<i class="fas fa-arrow-right"></i>
|
<i class="fas fa-arrow-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,20 +16,20 @@
|
|||||||
{{#each soundData}}
|
{{#each soundData}}
|
||||||
<div class="form-group" style="width:100%">
|
<div class="form-group" style="width:100%">
|
||||||
{{#each this.dataThis}}
|
{{#each this.dataThis}}
|
||||||
<div class="boxed" style="padding: 5px; margin:2px; width:10%">
|
<div class="materialDeck_sbConfig_boxed">
|
||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
{{localize "MaterialDeck.Sound"}} {{this.iteration}}
|
{{localize "MaterialDeck.Sound"}} {{this.iteration}}
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
{{localize "MaterialDeck.Name"}}
|
{{localize "MaterialDeck.Name"}}
|
||||||
</div>
|
</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;">
|
<div style="text-align:center;">
|
||||||
{{localize "MaterialDeck.Playlist"}}
|
{{localize "MaterialDeck.Playlist"}}
|
||||||
</div>
|
</div>
|
||||||
<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}}
|
{{#select this.selectedPlaylist}}
|
||||||
{{#each ../../playlists}}
|
{{#each ../../playlists}}
|
||||||
<option value="{{this.id}}">{{this.name}}</option>
|
<option value="{{this.id}}">{{this.name}}</option>
|
||||||
@@ -53,8 +41,8 @@
|
|||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
{{localize "MaterialDeck.Sound"}}
|
{{localize "MaterialDeck.Sound"}}
|
||||||
</div>
|
</div>
|
||||||
<div class="form-fields" id="ss{{this.iteration}}" style="{{this.styleSS}}">
|
<div class="form-fields" id="materialDeck_sbConfig_ss{{this.iteration}}" style="{{this.styleSS}}">
|
||||||
<select name="sounds" class="sounds-select" default="" style="width:100%;" id="soundSelect{{this.iteration}}">
|
<select name="sounds" class="sounds-select" default="" style="width:100%;" id="materialDeck_sbConfig_soundSelect{{this.iteration}}">
|
||||||
{{#select this.sound}}
|
{{#select this.sound}}
|
||||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||||
{{#each sounds}}
|
{{#each sounds}}
|
||||||
@@ -63,11 +51,11 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</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">
|
<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>
|
<i class="fas fa-file-import fa-fw"></i>
|
||||||
</button>
|
</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>
|
||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
{{localize "MaterialDeck.Icon"}}
|
{{localize "MaterialDeck.Icon"}}
|
||||||
@@ -76,18 +64,18 @@
|
|||||||
<button type="button" class="file-picker" data-type="image" data-target="img{{this.iteration}}" title="Browse Files" tabindex="-1">
|
<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>
|
<i class="fas fa-file-import fa-fw"></i>
|
||||||
</button>
|
</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>
|
||||||
<div class="flex-container" style="display:flex;flex-direction:row;padding-top:5px">
|
<div class="flex-container" style="display:flex;flex-direction:row;padding-top:5px">
|
||||||
<label style="flex:1">{{localize "MaterialDeck.On"}} </label>
|
<label style="flex:1">{{localize "MaterialDeck.On"}} </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"> {{localize "MaterialDeck.Off"}} </label>
|
<label style="flex:1"> {{localize "MaterialDeck.Off"}} </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>
|
||||||
|
|
||||||
<div class="form-group options">
|
<div class="form-group options">
|
||||||
<label>{{localize "MaterialDeck.Playback"}}</label>
|
<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}}
|
{{#select this.mode}}
|
||||||
<option value="0">{{localize "MaterialDeck.Once"}}</option>
|
<option value="0">{{localize "MaterialDeck.Once"}}</option>
|
||||||
<option value="1">{{localize "MaterialDeck.Repeat"}}</option>
|
<option value="1">{{localize "MaterialDeck.Repeat"}}</option>
|
||||||
@@ -97,7 +85,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group options">
|
<div class="form-group options">
|
||||||
<label>{{localize "MaterialDeck.Volume"}}</label>
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -105,18 +93,18 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<hr>
|
<hr>
|
||||||
<div class="navigation" style="width:100%; display:flex; flex-direction:row;">
|
<div class="materialDeck_sbConfig_navigationDiv">
|
||||||
<button type="button" class="navigation" id="clearPage">
|
<button type="button" class="materialDeck_sbConfig_navigation" name="clearPage">
|
||||||
<i></i>{{localize "MaterialDeck.ClearPage"}}
|
<i></i>{{localize "MaterialDeck.ClearPage"}}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="navigation" id="clearAll">
|
<button type="button" class="materialDeck_sbConfig_navigation" name="clearAll">
|
||||||
<i></i>{{localize "MaterialDeck.ClearAll"}}
|
<i></i>{{localize "MaterialDeck.ClearAll"}}
|
||||||
</button>
|
</button>
|
||||||
<p style="flex:15;"></p>
|
<p style="flex:15;"></p>
|
||||||
<button type="button" class="navigation" id="import">
|
<button type="button" class="materialDeck_sbConfig_navigation" name="import">
|
||||||
<i></i>{{localize "MaterialDeck.Import"}}
|
<i></i>{{localize "MaterialDeck.Import"}}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="navigation" id="export">
|
<button type="button" class="materialDeck_sbConfig_navigation" name="export">
|
||||||
<i></i>{{localize "MaterialDeck.Export"}}
|
<i></i>{{localize "MaterialDeck.Export"}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,98 +1,49 @@
|
|||||||
<form autocomplete="off" onsubmit="event.preventDefault();">
|
<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>
|
<p class="notes">{{localize "MaterialDeck.Perm.Instructions"}}</p>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<h2>{{ localize "MaterialDeck.Perm.ENABLE.label" }}</h2>
|
<h2>{{ localize "MaterialDeck.Perm.ENABLE.label" }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<header class="table-header flexrow">
|
<header class="materialDeck_uPerm_table-header flexrow">
|
||||||
<label class="index">{{ localize "PERMISSION.Permission" }}</label>
|
<label class="materialDeck_uPerm_index">{{ localize "PERMISSION.Permission" }}</label>
|
||||||
{{#each roles as |rl r|}}
|
{{#each roles as |rl r|}}
|
||||||
<label>{{ localize rl}}</label>
|
<label>{{ localize rl}}</label>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<li class="materialDeck_uPerm_permission form-group">
|
||||||
<li class="permission form-group">
|
<label class="materialDeck_uPerm_index">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.label" }}</label>
|
||||||
<label class="index">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.label" }}</label>
|
|
||||||
<div class="form-fields">
|
<div class="form-fields">
|
||||||
{{#each enable as |r|}}
|
{{#each enable as |r|}}
|
||||||
<input type="checkbox" name="ENABLE" {{checked r}}>
|
<input type="checkbox" name="ENABLE.{{r.role}}" {{checked r.en}}>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
<p class="hint">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.hint" }}</p>
|
<p class="hint materialDeck_uPerm_hint">{{ localize "MaterialDeck.Perm.ENABLE.ENABLE.hint" }}</p>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
{{#each actions as |a|}}
|
{{#each actions as |a|}}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<h2>{{ localize a.label }}</h2>
|
<h2>{{ localize a.label }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<header class="table-header flexrow">
|
<header class="materialDeck_uPerm_table-header flexrow">
|
||||||
<label class="index">{{ localize "PERMISSION.Permission" }}</label>
|
<label class="materialDeck_uPerm_index">{{ localize "PERMISSION.Permission" }}</label>
|
||||||
{{#each ../roles as |rl r|}}
|
{{#each ../roles as |rl r|}}
|
||||||
<label>{{ localize rl}}</label>
|
<label>{{ localize rl}}</label>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<ul class="permissions-list">
|
<ul class="materialDeck_uPerm_permissions-list">
|
||||||
{{#each a.permissions as |p|}}
|
{{#each a.permissions as |p|}}
|
||||||
<li class="permission form-group">
|
<li class="materialDeck_uPerm_permission form-group">
|
||||||
<label class="index">{{ localize p.label }}</label>
|
<label class="materialDeck_uPerm_index">{{ localize p.label }}</label>
|
||||||
<div class="form-fields">
|
<div class="form-fields">
|
||||||
{{#each p.roles as |r|}}
|
{{#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}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
<p class="hint">{{ localize p.hint }}</p>
|
<p class="hint materialDeck_uPerm_hint">{{ localize p.hint }}</p>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||