Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CDeenen committed Feb 25, 2021
1 parent de4ce7e commit e0eb0ae
Show file tree
Hide file tree
Showing 17 changed files with 519 additions and 412 deletions.
Binary file modified Plugin/Release/com.cdeenen.materialdeck.streamDeckPlugin
Binary file not shown.
63 changes: 56 additions & 7 deletions Plugin/com.cdeenen.materialdeck.sdPlugin/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ let ip = "localhost"; //Ip address of the websocket server
let port = "3001"; //Port of the websocket server
let sdCon = false;

let gameSystem = 'dnd5e';

let buttonContext = [];
for (let i=0; i<23; i++){
buttonContext[i] = undefined;
Expand Down Expand Up @@ -55,8 +57,41 @@ function connected(jsn) {
// console.log('%c%s', 'color: white; background: black; font-size: 13px;', '[app.js]propertyInspectorDidAppear:');
// });
}

var json = {
event: "getGlobalSettings",
context: $SD.uuid
};
$SD.connection.send(JSON.stringify(json));
console.log("request global settings")
};

$SD.on('com.cdeenen.materialdeck.token.propertyInspectorDidAppear', jsn => {
var json = {
action: jsn.action,
event: "sendToPropertyInspector",
context: jsn.context,
payload: {gameSystem:gameSystem}
};
$SD.connection.send(JSON.stringify(json));
});

$SD.on('com.cdeenen.materialdeck.combattracker.propertyInspectorDidAppear', jsn => {
var json = {
action: jsn.action,
event: "sendToPropertyInspector",
context: jsn.context,
payload: {gameSystem:gameSystem}
};
$SD.connection.send(JSON.stringify(json));
});

$SD.on('didReceiveGlobalSettings', jsn => {
const system = jsn.payload.settings.gameSystem;
if (system != undefined) gameSystem = system;
console.log('Stored game system: ',system);
});

function checkConnection(){

setTimeout(() => checkConnection(),2000);
Expand All @@ -77,9 +112,9 @@ const action = {

const action = jsn.action.replace("com.cdeenen.materialdeck.", "");

if (jsn.event == 'willAppear'){
jsn.payload.settings=convertSettings(jsn);
}
//if (jsn.event == 'willAppear'){
// jsn.payload.settings=convertSettings(jsn);
//}

// if (action == 'token'){
const msg = {
Expand All @@ -90,7 +125,8 @@ const action = {
action: action,
event: jsn.event,
context: jsn.context,
payload: jsn.payload
payload: jsn.payload,
version: $SD.applicationInfo.plugin.version
}
sendToServer(msg);
//}
Expand Down Expand Up @@ -620,8 +656,10 @@ function connectToServerWS() {

// Initalise Node.js WebSocket connection.
serverWS.addEventListener('open', () => {
if (sdCon)
serverWS.send(JSON.stringify({ target: 'server', source: "SD"}));
if (sdCon) {
serverWS.send(JSON.stringify({ target: 'server', source: "SD", version: $SD.applicationInfo.plugin.version}));
//serverWS.send(JSON.stringify({ target: 'MD', source: "SD", type:"version", version: $SD.applicationInfo.plugin.version}));
}
console.log('Connection to Node.js server successful.');
}, { once: true });

Expand All @@ -637,6 +675,17 @@ function connectToServerWS() {
if (data.target != 'SD') return;
if (data.type == 'init'){
sendContext();
//$SD.api.setGameSystem(data.system);
gameSystem=data.system;
console.log("Game System: ",gameSystem);

var json = {
event: "setGlobalSettings",
context: $SD.uuid,
payload: {gameSystem:gameSystem}
};
$SD.connection.send(JSON.stringify(json));
if (sdCon) serverWS.send(JSON.stringify({ target: 'MD', source: "SD", type:"version", version: $SD.applicationInfo.plugin.version}));
}
else
sendToSDWS(e.data);
Expand All @@ -656,7 +705,7 @@ function sendToSDWS(msg) {
const data = JSON.parse(msg);
const event = data.event;
const context = data.context;
//console.log(data);

if (event == 'setStateCustom'){
//setState(msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<title>com.cdeenen.materialplane.externalWindow</title>
<title>com.cdeenen.materialdeck.externalWindow</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="propertyinspector/css/sdpi.css">
<style>
Expand Down
2 changes: 1 addition & 1 deletion Plugin/com.cdeenen.materialdeck.sdPlugin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<title>com.cdeenen.materialplane Main</title>
<title>com.cdeenen.materialdeck Main</title>
<meta charset="utf-8" />
<style>
canvas {
Expand Down
2 changes: 1 addition & 1 deletion Plugin/com.cdeenen.materialdeck.sdPlugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"Name": "Material Deck",
"Icon": "vtt",
"URL": "https://github.com/CDeenen/MaterialDeck_SD",
"Version": "1.2.2",
"Version": "1.3.0",
"OS": [
{
"Platform": "mac",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<div class="sdpi-item-label">Function</div>
<select class="sdpi-item-value select" id="combatTrackerFunction" type="select">
<option value='startStop'>Start/Stop Combat</option>
<option value='endTurn'>End Turn</option>
<option value='nextTurn'>Next Turn</option>
<option value='prevTurn'>Previous Turn</option>
<option value='nextRound'>Next Round</option>
Expand All @@ -45,75 +46,14 @@

</div>
<div class="wrapper" id="combatantWrapper" style="">

<div class="sdpi-item">
<div class="sdpi-item-label">System</div>
<select class="sdpi-item-value select" id="system" type="select">
<option value='dnd5e'>DnD 5e</option>
<option value='dnd3.5e'>DnD 3.5e</option>
<option value='pf1e'>Pathfinder 1e</option>
<option value='pf2e'>Pathfinder 2e</option>
<option value='demonlord'>Shadow of the Demon Lord</option>
</select>
</div>

<div class="sdpi-item" id="dnd5eWrapper" style="">
<div class="sdpi-item-label">Stats</div>
<select class="sdpi-item-value select" id="stats" type="select">
<option value='none'>None</option>
<option value='custom'>Custom</option>
<option value='HP'>HP</option>
<option value='TempHP'>Temp HP</option>
<option value='AC'>AC</option>
<option value='Speed'>Speed</option>
<option value='Init'>Initiative</option>
<option value='PassivePerception'>Passive Perception</option>
<option value='PassiveInvestigation'>Passive Investigation</option>
</select>
</div>

<div class="sdpi-item" id="dnd35eWrapper" style="display:none">
<div class="sdpi-item-label">Stats</div>
<select class="sdpi-item-value select" id="stats" type="select">
<option value='none'>None</option>
<option value='custom'>Custom</option>
<option value='HP'>HP</option>
<option value='TempHP'>Temp HP</option>
<option value='AC'>AC</option>
<option value='Speed'>Speed</option>
<option value='Init'>Initiative</option>
</select>
</div>

<div class="sdpi-item" id="pf2eWrapper" style="display:none">
<div class="sdpi-item" style="">
<div class="sdpi-item-label">Stats</div>
<select class="sdpi-item-value select" id="stats" type="select">
<option value='none'>None</option>
<option value='custom'>Custom</option>
<option value='HP'>HP</option>
<option value='TempHP'>Temp HP</option>
<option value='AC'>AC</option>
<option value='ShieldHP'>Shield HP</option>
<option value='Speed'>Speed</option>
<option value='Init'>Initiative</option>
</select>
</div>

<div class="wrapper" id="demonlordWrapper" style="display:none">
<div class="sdpi-item">
<div class="sdpi-item-label">Stats</div>
<select class="sdpi-item-value select" id="statsDemonlord" type="select">
<option value='none'>None</option>
<option value='custom'>Custom</option>
<option value='HP'>HP</option>
<option value='TempHP'>Temp HP</option>
<option value='AC'>AC</option>
<option value='ShieldHP'>Shield HP</option>
<option value='Speed'>Speed</option>
<option value='Init'>Initiative</option>
</select>
</div>
</div>

<div class="sdpi-item" id="customContainer" style="display:none">
<div class="sdpi-item-label">Custom</div>
Expand All @@ -134,21 +74,6 @@
</div>
</div>

<div class="wrapper" id="onClickDemonWrapper" style="display:none">
<div class="sdpi-item">
<div class="sdpi-item-label">On Click</div>
<select class="sdpi-item-value select" id="onClickDemonlord" type="select">
<option value='doNothing'>Do Nothing</option>
<option value ='select'>Select Token</option>
<option value='center'>Center on Token</option>
<option value='centerSelect'>Center on Token and Select Token</option>
<option value='charSheet'>Open Character Sheet</option>
<option value='tokenConfig'>Open Token Config</option>
<option value='initiative'>Toggle Initiative</option>
</select>
</div>
</div>

<div class="sdpi-item" id="combatantNrSel" stype="display:none">
<div class="sdpi-item-label">Combatant Nr</div>
<input class="sdpi-item-value" id="combatantNr" value="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<select class="sdpi-item-value select" id="module" type="select">
<option value='fxmaster'>Fx Master</option>
<option value='gmscreen'>GM Screen</option>
<option value='triggerHappy'>Trigger Happy</option>
<option value='sharedVision'>Shared Vision</option>
<option value='lockView'>Lock View</option>
<option value='notYourTurn'>Not Your Turn!</option>
<option value='mookAI'>Mook AI</option>
</select>
</div>

Expand Down Expand Up @@ -135,6 +140,114 @@
</div>
</div>
</div>

<div class="wrapper" id="triggerHappyWrapper" style="display:none">
<div class="sdpi-item">
<div class="sdpi-item-label">Mode</div>
<select class="sdpi-item-value select" id="triggerHappyMode" type="select">
<option value='toggle'>Toggle Triggers</option>
<option value='enable'>Enable Triggers</option>
<option value='disable'>Disable Triggers</option>
</select>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Name</div>
<input class="sdpi-item-value" id="displayTriggerHappyName" type="checkbox">
<label for="displayTriggerHappyName"><span></span></label>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Icon</div>
<input class="sdpi-item-value" id="displayTriggerHappyIcon" type="checkbox">
<label for="displayTriggerHappyIcon"><span></span></label>
</div>
</div>

<div class="wrapper" id="sharedVisionWrapper" style="display:none">
<div class="sdpi-item">
<div class="sdpi-item-label">Mode</div>
<select class="sdpi-item-value select" id="sharedVisionMode" type="select">
<option value='toggle'>Toggle Global Shared Vision</option>
<option value='enable'>Enable Global Shared Vision</option>
<option value='disable'>Disable Global Shared Vision</option>
</select>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Name</div>
<input class="sdpi-item-value" id="sharedVisionName" type="checkbox">
<label for="sharedVisionName"><span></span></label>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Icon</div>
<input class="sdpi-item-value" id="sharedVisionIcon" type="checkbox">
<label for="sharedVisionIcon"><span></span></label>
</div>
</div>

<div class="wrapper" id="mookWrapper" style="display:none">
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Name</div>
<input class="sdpi-item-value" id="mookName" type="checkbox">
<label for="mookName"><span></span></label>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Icon</div>
<input class="sdpi-item-value" id="mookIcon" type="checkbox">
<label for="mookIcon"><span></span></label>
</div>
</div>

<div class="wrapper" id="notYourTurnWrapper" style="display:none">
<div class="sdpi-item">
<div class="sdpi-item-label">Mode</div>
<select class="sdpi-item-value select" id="notYourTurnMode" type="select">
<option value='toggle'>Toggle Combat Movement Block</option>
<option value='enable'>Enable Combat Movement Block</option>
<option value='disable'>Disable Combat Movement Block</option>
<option value='toggleNonCombat'>Toggle Non-Combat Movement Block</option>
<option value='enableNonCombat'>Enable Non-Combat Movement Block</option>
<option value='disableNonCombat'>Disable Non-Combat Movement Block</option>
</select>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Name</div>
<input class="sdpi-item-value" id="notYourTurnName" type="checkbox">
<label for="notYourTurnName"><span></span></label>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Icon</div>
<input class="sdpi-item-value" id="notYourTurnIcon" type="checkbox">
<label for="notYourTurnIcon"><span></span></label>
</div>
</div>

<div class="wrapper" id="lockViewWrapper" style="display:none">
<div class="sdpi-item">
<div class="sdpi-item-label">Mode</div>
<select class="sdpi-item-value select" id="lockViewMode" type="select">
<option value='panLock'>Pan Lock</option>
<option value='zoomLock'>Zoom Lock</option>
<option value='boundingBox'>Bounding Box</option>
</select>
</div>
<div class="sdpi-item">
<div class="sdpi-item-label">Toggle</div>
<select class="sdpi-item-value select" id="lockViewToggle" type="select">
<option value='toggle'>Toggle</option>
<option value='enable'>Enable</option>
<option value='disable'>Disable</option>
</select>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Name</div>
<input class="sdpi-item-value" id="lockViewName" type="checkbox">
<label for="lockViewName"><span></span></label>
</div>
<div type="checkbox" class="sdpi-item">
<div class="sdpi-item-label">Display Icon</div>
<input class="sdpi-item-value" id="lockViewIcon" type="checkbox">
<label for="lockViewIcon"><span></span></label>
</div>
</div>

<div class="sdpi-info-label hidden" style="top: -1000;" value=""></div>
<script src="js/common.js"></script>
Expand Down
Loading

0 comments on commit e0eb0ae

Please sign in to comment.