This commit is contained in:
CDeenen
2021-05-05 01:00:18 +02:00
parent bf8c5c0076
commit 484b7a0b7f
39 changed files with 197 additions and 117 deletions

View File

@@ -22,7 +22,6 @@ export var externalModules;
export var sceneControl;
export const moduleName = "MaterialDeck";
export var selectedTokenId;
let ready = false;
let activeSounds = [];
@@ -116,7 +115,7 @@ async function analyzeWSmessage(msg){
if (action == 'token'){
tokenControl.active = true;
tokenControl.pushData(selectedTokenId,settings,context,device);
tokenControl.pushData(canvas.tokens.controlled[0]?.id,settings,context,device);
}
else if (action == 'move')
move.update(settings,context,device);
@@ -317,6 +316,43 @@ Hooks.once('ready', async()=>{
for (let i=0; i<64; i++)
activeSounds[i] = false;
if (game.user.isGM) {
let soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
let macroSettings = game.settings.get(moduleName, 'macroSettings');
let array = [];
for (let i=0; i<64; i++) array[i] = "";
let arrayVolume = [];
for (let i=0; i<64; i++) arrayVolume[i] = "50";
let arrayZero = [];
for (let i=0; i<64; i++) arrayZero[i] = "0";
if (macroSettings.color == undefined){
game.settings.set(moduleName,'macroSettings',{
macros: array,
color: arrayZero
});
}
const settings = {
playlist: "",
sounds: array,
colorOn: arrayZero,
colorOff: arrayZero,
mode: arrayZero,
toggle: arrayZero,
volume: arrayVolume
};
if (soundBoardSettings.colorOff == undefined){
game.settings.set(moduleName,'soundboardSettings',settings);
}
}
if (enableModule == false) return;
if (getPermission('ENABLE') == false) {
ready = true;
@@ -325,33 +361,6 @@ Hooks.once('ready', async()=>{
startWebsocket();
let soundBoardSettings = game.settings.get(moduleName,'soundboardSettings');
let macroSettings = game.settings.get(moduleName, 'macroSettings');
let array = [];
for (let i=0; i<64; i++) array[i] = "";
let arrayVolume = [];
for (let i=0; i<64; i++) arrayVolume[i] = "50";
let arrayZero = [];
for (let i=0; i<64; i++) arrayZero[i] = "0";
if (macroSettings.color == undefined){
game.settings.set(moduleName,'macroSettings',{
macros: array,
color: arrayZero
});
}
if (soundBoardSettings.colorOff == undefined){
game.settings.set(moduleName,'soundboardSettings',{
playlist: "",
sounds: array,
colorOn: arrayZero,
colorOff: arrayZero,
mode: arrayZero,
toggle: arrayZero,
volume: arrayVolume
});
}
const hotbarUsesTemp = game.modules.get("illandril-hotbar-uses");
if (hotbarUsesTemp != undefined) hotbarUses = true;
});
@@ -359,7 +368,7 @@ Hooks.once('ready', async()=>{
Hooks.on('updateToken',(scene,token)=>{
if (enableModule == false || ready == false) return;
let tokenId = token._id;
if (tokenId == selectedTokenId) tokenControl.update(selectedTokenId);
if (tokenId == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
if (macroControl != undefined) macroControl.updateAll();
});
@@ -369,8 +378,8 @@ Hooks.on('updateActor',(scene,actor)=>{
for (let i=0; i<children.length; i++){
if (children[i].actor.id == actor._id){
let tokenId = children[i].id;
if (tokenId == selectedTokenId) {
tokenControl.update(selectedTokenId);
if (tokenId == canvas.tokens.controlled[0]?.id) {
tokenControl.update(canvas.tokens.controlled[0]?.id);
}
}
@@ -381,16 +390,14 @@ Hooks.on('updateActor',(scene,actor)=>{
Hooks.on('controlToken',(token,controlled)=>{
if (enableModule == false || ready == false) return;
if (controlled) {
selectedTokenId = token.data._id;
tokenControl.update(selectedTokenId);
tokenControl.update(token.data._id);
if (controlTokenTimer != undefined) {
clearTimeout(controlTokenTimer);
controlTokenTimer = undefined;
}
}
else {
controlTokenTimer = setTimeout(function(){tokenControl.update(selectedTokenId);},10)
selectedTokenId = undefined;
controlTokenTimer = setTimeout(function(){tokenControl.update(canvas.tokens.controlled[0]?.id);},10)
}
if (macroControl != undefined) macroControl.updateAll();
@@ -401,7 +408,6 @@ Hooks.on('updateOwnedItem',()=>{
})
Hooks.on('renderHotbar', (hotbar)=>{
if (compatibleCore("0.8.1")) return;
if (enableModule == false || ready == false) return;
if (macroControl != undefined) macroControl.hotbar(hotbar.macros);
});
@@ -416,7 +422,7 @@ Hooks.on('render', (app)=>{
Hooks.on('renderCombatTracker',()=>{
if (enableModule == false || ready == false) return;
if (combatTracker != undefined) combatTracker.updateAll();
if (tokenControl != undefined) tokenControl.update(selectedTokenId);
if (tokenControl != undefined) tokenControl.update(canvas.tokens.controlled[0]?.id);
});
Hooks.on('renderPlaylistDirectory', (playlistDirectory)=>{
@@ -473,7 +479,7 @@ Hooks.on('renderSceneControls',()=>{
Hooks.on('targetToken',(user,token,targeted)=>{
if (enableModule == false || ready == false) return;
if (token.id == selectedTokenId) tokenControl.update(selectedTokenId);
if (token.id == canvas.tokens.controlled[0]?.id) tokenControl.update(canvas.tokens.controlled[0]?.id);
});
Hooks.on('sidebarCollapse',()=>{

View File

@@ -1,4 +1,23 @@
# Changelog Material Deck Module
### v1.4.3 - 05-05-2021
Fixes:
<ul>
<li>Fixed issue where the module would break if multiple Stream Decks were configured in the Stream Deck application, but not all of them had MD actions assigned to them</li>
<li>In the User Permission Configuration, the Scene Directory hint wasn't displayed properly</li>
<li>Got rid of warnings that popped up on initialization when using MD as a player</li>
<li>Fixed issue where the soundboard and macro board could not be configured by players, if it hadn't first been configured by a GM</li>
</ul>
Other
<ul>
<li>Added compatibility for Foundry 0.8.2. Some functions no longer work in 0.8.1 (they still do in 0.7.9)</li>
</ul>
<br>
<b>Compatible server app and SD plugin:</b><br>
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
SD plugin v1.4.2 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
### v1.4.2 - 23-04-2021
Fixes:
<ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -98,7 +98,7 @@
"MaterialDeck.Perm.MACRO.MACROBOARD.label": "Macro Board",
"MaterialDeck.Perm.MACRO.MACROBOARD.hint": "Allow users to use the macro board",
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.label": "Configure the Macro Board",
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "Allow users to configure the macro board",
"MaterialDeck.Perm.MACRO.MACROBOARD_CONFIGURE.hint": "Allow users to configure the macro board. To allow users to pick icons using the filepicker, enable 'Browse File Explorer' for that user in the core Permission Configuration",
"MaterialDeck.Perm.MOVE.label": "Move",
"MaterialDeck.Perm.MOVE.TOKEN.label": "Token",
@@ -144,7 +144,7 @@
"MaterialDeck.Perm.SCENE.ACTIVE.label": "Active Scene",
"MaterialDeck.Perm.SCENE.ACTIVE.hint": "Allow users to view the active scene",
"MaterialDeck.Perm.SCENE.DIRECTORY.label": "Scene Directory",
"MaterialDeck.Perm.SCENE.DIRECTOR.hint": "Allow users to view and control scenes from the scene directory",
"MaterialDeck.Perm.SCENE.DIRECTORY.hint": "Allow users to view and control scenes from the scene directory",
"MaterialDeck.Perm.SCENE.NAME.label": "Scene by Name",
"MaterialDeck.Perm.SCENE.NAME.hint": "Allow users to view and control any scene by name",
@@ -152,7 +152,7 @@
"MaterialDeck.Perm.SOUNDBOARD.PLAY.label": "Enable",
"MaterialDeck.Perm.SOUNDBOARD.PLAY.hint": "Allow users to play sounds from the soundboard",
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.label": "Configure",
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.hint": "Allow users to configure the soundboard",
"MaterialDeck.Perm.SOUNDBOARD.CONFIGURE.hint": "Allow users to configure the soundboard. To allow users to pick files and icons using the filepicker, enable 'Browse File Explorer' for that user in the core Permission Configuration",
"MaterialDeck.Perm.TOKEN.label": "Token",
"MaterialDeck.Perm.TOKEN.STATS.label": "Display Stats",

View File

@@ -1,25 +1,40 @@
{
"name": "MaterialDeck",
"title": "Material Deck",
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
"version": "1.4.2",
"minimumSDversion": "1.4.2",
"minimumMSversion": "1.0.2",
"author": "CDeenen",
"esmodules": [
"./MaterialDeck.js"
],
"socket": true,
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.8.1",
"languages": [
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
}
],
"url": "https://github.com/CDeenen/MaterialDeck",
"manifest": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json",
"download": "https://github.com/CDeenen/MaterialDeck/archive/Master.zip"
}
"name": "MaterialDeck",
"title": "Material Deck",
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
"version": "1.4.3",
"minimumSDversion": "1.4.2",
"minimumMSversion": "1.0.2",
"author": "CDeenen",
"authors": {
"name": "CDeenen",
"email": "cdeenen@outlook.com",
"discord": "Cris#6864",
"patreon": "MaterialFoundry",
"reddit": "CDeenen123"
},
"esmodules": [
"./MaterialDeck.js"
],
"socket": true,
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.8.2",
"languages": [
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
}
],
"media": [
{
"type": "icon",
"url": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/img/MaterialFoundry512x512.png"
}
],
"manifestPlusVersion": "1.1.0",
"url": "https://github.com/CDeenen/MaterialDeck",
"manifest": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json",
"download": "https://github.com/CDeenen/MaterialDeck/archive/Master.zip"
}

View File

@@ -11,6 +11,7 @@ export class CombatTracker{
async updateAll(){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'combattracker') continue;

View File

@@ -13,6 +13,7 @@ export class ExternalModules{
}
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'external') continue;

View File

@@ -11,6 +11,7 @@ export class MacroControl{
async updateAll(){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'macro') continue;
@@ -109,48 +110,51 @@ export class MacroControl{
return uses;
}
async hotbar(macros){
for (let i=0; i<32; i++){
const data = streamDeck.buttonContext[i];
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
async hotbar(){
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'macro' || data.settings.macroMode == 'macroBoard') continue;
const context = data.context;
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
const displayName = data.settings.displayName ? data.settings.displayName : false;
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
let background = data.settings.background ? data.settings.background : '#000000';
let macroNumber = data.settings.macroNumber;
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
const context = data.context;
const mode = data.settings.macroMode ? data.settings.macroMode : 'hotbar';
const displayName = data.settings.displayName ? data.settings.displayName : false;
const displayIcon = data.settings.displayIcon ? data.settings.displayIcon : false;
const displayUses = data.settings.displayUses ? data.settings.displayUses : false;
let background = data.settings.background ? data.settings.background : '#000000';
let macroNumber = data.settings.macroNumber;
if(macroNumber == undefined || isNaN(parseInt(macroNumber))) macroNumber = 1;
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
streamDeck.noPermission(context,device);
return;
}
if ((MODULE.getPermission('MACRO','HOTBAR') == false )) {
streamDeck.noPermission(context,device);
return;
}
let src = "";
let name = "";
let src = "";
let name = "";
if (mode == 'Macro Board') continue;
let macroId;
if (mode == 'hotbar'){
macroId = game.user.data.hotbar[macroNumber];
if (mode == 'Macro Board') continue;
let macroId;
if (mode == 'hotbar'){
macroId = game.user.data.hotbar[macroNumber];
}
else {
if (macroNumber > 9) macroNumber = 0;
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
}
let macro = undefined;
let uses = undefined;
if (macroId != undefined) macro = game.macros._source.find(p => p._id == macroId);
if (macro != undefined && macro != null) {
if (displayName) name += macro.name;
if (displayIcon) src += macro.img;
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
}
streamDeck.setIcon(context,device,src,{background:background,uses:uses});
streamDeck.setTitle(name,context);
}
else {
if (macroNumber > 9) macroNumber = 0;
macroId = game.macros.apps[0].macros.find(m => m.key == macroNumber).macro?.id
}
let macro = undefined;
let uses = undefined;
if (macroId != undefined) macro = game.macros._source.find(p => p._id == macroId);
if (macro != undefined && macro != null) {
if (displayName) name += macro.name;
if (displayIcon) src += macro.img;
if (MODULE.hotbarUses && displayUses) uses = await this.getUses(macro);
}
streamDeck.setIcon(context,device,src,{background:background,uses:uses});
streamDeck.setTitle(name,context);
}
}

View File

@@ -70,7 +70,7 @@ export class Move{
const selection = settings.selection ? settings.selection : 'selected';
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
if (selection == 'selected') token = canvas.tokens.children[0].children.find(p => p.id == MODULE.selectedTokenId);
if (selection == 'selected') token = canvas.tokens.controlled[0];
else if (selection != 'selected' && tokenIdentifier == '') {}
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
else if (selection == 'actorName') token = canvas.tokens.children[0].children.find(p => p.actor.name == tokenIdentifier);

View File

@@ -17,10 +17,11 @@ export class OtherControls{
async updateAll(options={}){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'other') continue;
await this.update(data.settings,data.context,device.device);
await this.update(data.settings,data.context,device.device,options);
}
}
}
@@ -240,7 +241,16 @@ export class OtherControls{
}
ui.controls.activeControl = selectedControl.name;
selectedControl.activeTool = selectedControl.activeTool;
canvas.getLayer(selectedControl.layer).activate();
if (compatibleCore("0.8.2")) {
for (let layer of canvas.layers) {
if (layer.options == undefined) continue;
if (layer.options.name == selectedControl.layer) {
layer.activate();
break;
}
}
}
else canvas.getLayer(selectedControl.layer).activate();
}
}
else if (control == 'dispTools'){ //displayed tools
@@ -281,7 +291,16 @@ export class OtherControls{
if (tool == 'open'){ //open category
ui.controls.activeControl = control;
selectedControl.activeTool = selectedControl.activeTool;
canvas.getLayer(selectedControl.layer).activate();
if (compatibleCore("0.8.2")) {
for (let layer of canvas.layers) {
if (layer.options == undefined) continue;
if (layer.options.name == selectedControl.layer) {
layer.activate();
break;
}
}
}
else canvas.getLayer(selectedControl.layer).activate();
}
else {
const selectedTool = selectedControl.tools.find(t => t.name == tool);
@@ -291,7 +310,16 @@ export class OtherControls{
return;
}
ui.controls.activeControl = control;
canvas.getLayer(selectedControl.layer).activate();
if (compatibleCore("0.8.2")) {
for (let layer of canvas.layers) {
if (layer.options == undefined) continue;
if (layer.options.name == selectedControl.layer) {
layer.activate();
break;
}
}
}
else canvas.getLayer(selectedControl.layer).activate();
if (selectedTool.toggle) {
selectedTool.active = !selectedTool.active;
selectedTool.onClick(selectedTool.active);
@@ -378,7 +406,7 @@ export class OtherControls{
let actor;
let tokenControlled = false;
if (MODULE.selectedTokenId != undefined) actor = canvas.tokens.children[0].children.find(p => p.id == MODULE.selectedTokenId).actor;
if (canvas.tokens.controlled[0] != undefined) actor = canvas.tokens.controlled[0].actor;
if (actor != undefined) tokenControlled = true;
let r;
@@ -418,6 +446,7 @@ export class OtherControls{
const background = settings.background ? settings.background : '#000000';
const table = game.tables.getName(name);
if (table == undefined) return;
let txt = settings.displayRollName ? table.name : '';
let src = settings.displayRollIcon ? table.data.img : '';
@@ -509,7 +538,7 @@ export class OtherControls{
if (popOut && options.sidebarTab == sidebarTab) {
ringColor = options.renderPopout ? ringOnColor : ringOffColor;
}
else ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
else if (popOut == false) ringColor = (sidebarTab == 'collapse' && collapsed || (activeTab == sidebarTab)) ? ringOnColor : ringOffColor;
const name = settings.displaySidebarName ? this.getSidebarName(sidebarTab) : '';
const icon = settings.displaySidebarIcon ? this.getSidebarIcon(sidebarTab) : '';

View File

@@ -12,6 +12,7 @@ export class PlaylistControl{
async updateAll(){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'playlist') continue;

View File

@@ -12,6 +12,7 @@ export class SceneControl{
async updateAll(){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'scene') continue;

View File

@@ -222,7 +222,8 @@ export const registerSettings = async function() {
if (permissionSettings.permissions.TOKEN.OBSERVER == undefined) permissionSettings.permissions.TOKEN.OBSERVER = [false,true,true,true];
if (permissionSettings.permissions.MACRO.BY_NAME == undefined) permissionSettings.permissions.MACRO.BY_NAME = [false,false,true,true];
}
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
if (game.user.isGM)
game.settings.set(MODULE.moduleName,'userPermission',permissionSettings);
}

View File

@@ -14,6 +14,7 @@ export class SoundboardControl{
async updateAll(){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'soundboard') continue;
@@ -171,7 +172,7 @@ export class SoundboardControl{
volume *= game.settings.get("core", "globalAmbientVolume");
if (compatibleCore("0.8.1")) {
let newSound = new SoundNode(src);
let newSound = new Sound(src);
if(newSound.loaded == false) await newSound.load({autoplay:true});
newSound.on('end', ()=>{
if (repeat == false) {

View File

@@ -35,6 +35,7 @@ export class StreamDeck{
}
setContext(device,size,iteration,action,context,coordinates = {column:0,row:0},settings){
if (device == undefined) return;
if (this.buttonContext[iteration] == undefined) {
const deckSize = size.columns*size.rows;
let buttons = [];

View File

@@ -11,6 +11,7 @@ export class TokenControl{
async update(tokenId=null){
if (this.active == false) return;
for (let device of streamDeck.buttonContext) {
if (device?.buttons == undefined) continue;
for (let i=0; i<device.buttons.length; i++){
const data = device.buttons[i];
if (data == undefined || data.action != 'token') continue;
@@ -649,8 +650,7 @@ export class TokenControl{
let skill = settings.skill;
if (skill == undefined) skill = 'acr';
else iconSrc = "modules/MaterialDeck/img/token/skills/" + skill + ".png";
}
}
}
streamDeck.setIcon(context,device,iconSrc,{background:background,ring:ring,ringColor:ringColor,overlay:overlay,uses:uses,hp:hp});
streamDeck.setTitle(txt,context);
@@ -659,13 +659,13 @@ export class TokenControl{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
async keyPress(settings){
const tokenId = MODULE.selectedTokenId;
const tokenId = canvas.tokens.controlled[0]?.id;
const selection = settings.selection ? settings.selection : 'selected';
const tokenIdentifier = settings.tokenName ? settings.tokenName : '';
let token;
if (selection == 'selected') token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
if (selection == 'selected') token = canvas.tokens.controlled[0];
else if (selection != 'selected' && tokenIdentifier == '') {}
else if (selection == 'tokenName') token = canvas.tokens.children[0].children.find(p => p.name == tokenIdentifier);
else if (selection == 'actorName') token = canvas.tokens.children[0].children.find(p => p.actor.name == tokenIdentifier);
@@ -834,7 +834,7 @@ export class TokenControl{
}
else if (method == 'offset'){
this.wildcardOffset = value;
this.update(MODULE.selectedTokenId);
this.update(canvas.tokens.controlled[0]?.id);
}
else return;