v1.5.1
This commit is contained in:
14
changelog.md
14
changelog.md
@@ -1,4 +1,18 @@
|
||||
# Changelog Material Deck Module
|
||||
### v1.5.1 - 28-06-2023
|
||||
Fixes:
|
||||
<ul>
|
||||
<li>Token Action => Toggle Condition: Fixed PF2e conditions</li>
|
||||
<li>Macro Action => Macro by name: Fixed macro arguments not working in v10</li>
|
||||
<li>Download Utility: Latest module version is now displayed correctly</li>
|
||||
</ul>
|
||||
|
||||
Additions:
|
||||
<ul>
|
||||
<li>Other Actions => Open Journal: Added option to open journal pages by page name or number</li>
|
||||
<li>Playlist Action: Added option to select playlists and tracks by name</li>
|
||||
</ul>
|
||||
|
||||
### v1.5.0 - 28-05-2023
|
||||
Additions:
|
||||
<ul>
|
||||
|
||||
116
module.json
116
module.json
@@ -1,58 +1,64 @@
|
||||
{
|
||||
"name": "MaterialDeck",
|
||||
"id": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.5.0",
|
||||
"author": "CDeenen",
|
||||
"authors": [
|
||||
{
|
||||
"name": "CDeenen",
|
||||
"email": "cdeenen@outlook.com",
|
||||
"discord": "Cris#6864",
|
||||
"patreon": "MaterialFoundry",
|
||||
"reddit": "CDeenen123"
|
||||
}
|
||||
],
|
||||
"esmodules": ["./MaterialDeck.js"],
|
||||
"styles": ["./css/style.css"],
|
||||
"socket": true,
|
||||
"minimumCoreVersion": "10",
|
||||
"compatibleCoreVersion": "11",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "11"
|
||||
},
|
||||
"flags": {
|
||||
"minimumMSVersion": "1.1.0",
|
||||
"minimumPluginVersion": "1.5.0"
|
||||
},
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
"path": "lang/en.json"
|
||||
"name": "MaterialDeck",
|
||||
"id": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.5.1",
|
||||
"author": "CDeenen",
|
||||
"authors": [
|
||||
{
|
||||
"name": "CDeenen",
|
||||
"email": "cdeenen@outlook.com",
|
||||
"discord": "Cris#6864",
|
||||
"patreon": "MaterialFoundry",
|
||||
"reddit": "CDeenen123"
|
||||
}
|
||||
],
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
],
|
||||
"styles": [
|
||||
"./css/style.css"
|
||||
],
|
||||
"socket": true,
|
||||
"minimumCoreVersion": "10",
|
||||
"compatibleCoreVersion": "11",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "11"
|
||||
},
|
||||
{
|
||||
"lang": "ja",
|
||||
"name": "日本語",
|
||||
"path": "lang/ja.json"
|
||||
}
|
||||
],
|
||||
"media": [
|
||||
{
|
||||
"type": "icon",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry512x512.png"
|
||||
},{
|
||||
"type": "setup",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
||||
},{
|
||||
"type": "cover",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
||||
}
|
||||
],
|
||||
"manifestPlusVersion": "1.1.0",
|
||||
"url": "https://github.com/CDeenen/MaterialDeck",
|
||||
"manifest": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json",
|
||||
"download": "https://github.com/CDeenen/MaterialDeck/archive/Master.zip"
|
||||
"flags": {
|
||||
"minimumMSVersion": "1.1.0",
|
||||
"minimumPluginVersion": "1.5.0"
|
||||
},
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
"path": "lang/en.json"
|
||||
},
|
||||
{
|
||||
"lang": "ja",
|
||||
"name": "日本語",
|
||||
"path": "lang/ja.json"
|
||||
}
|
||||
],
|
||||
"media": [
|
||||
{
|
||||
"type": "icon",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry512x512.png"
|
||||
},
|
||||
{
|
||||
"type": "setup",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
||||
},
|
||||
{
|
||||
"type": "cover",
|
||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
||||
}
|
||||
],
|
||||
"manifestPlusVersion": "1.1.0",
|
||||
"url": "https://github.com/CDeenen/MaterialDeck",
|
||||
"manifest": "https://github.com/CDeenen/MaterialDeck/releases/latest/download/module.json",
|
||||
"download": "https://github.com/CDeenen/MaterialDeck/releases/download/v1.5.1/module.zip"
|
||||
}
|
||||
@@ -211,7 +211,7 @@ export class MacroControl{
|
||||
let chatData = {
|
||||
user: game.user._id,
|
||||
speaker: ChatMessage.getSpeaker(),
|
||||
content: "/amacro '" + macro.name + "' " + args[macroNumber]
|
||||
content: "/amacro '" + macro.name + "' " + args
|
||||
};
|
||||
ChatMessage.create(chatData, {});
|
||||
}
|
||||
|
||||
@@ -780,11 +780,21 @@ export class OtherControls{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateJournal(settings,context,device,options={}){
|
||||
const name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
const name = settings.journalName;
|
||||
const pageName = settings.journalPageName;
|
||||
let pageId;
|
||||
let journalMode = settings.journalMode ? settings.journalMode : 'openJournal';
|
||||
let txt = '';
|
||||
if (name == undefined) {
|
||||
streamDeck.setTitle('',context);
|
||||
return;
|
||||
}
|
||||
|
||||
const journal = game.journal.getName(name);
|
||||
if (journal == undefined) return;
|
||||
if (journal == undefined) {
|
||||
streamDeck.setTitle('',context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (getPermission('OTHER','JOURNAL') == false ) {
|
||||
streamDeck.noPermission(context,device);
|
||||
@@ -803,11 +813,30 @@ export class OtherControls{
|
||||
else
|
||||
if (document.getElementById("journalentry-sheet-"+journal.id) != null) rendered = true;
|
||||
|
||||
txt = settings.displayJournalName == 'journal' ? name : '';
|
||||
|
||||
if (journalMode == 'openPageNr') {
|
||||
pageId = journal.pages.contents[pageName]?.id
|
||||
}
|
||||
if (journalMode == 'openPageName') {
|
||||
pageId = journal.pages.getName(pageName)?.id;
|
||||
}
|
||||
if (pageId != undefined) {
|
||||
const page = journal.pages.get(pageId);
|
||||
if (settings.displayJournalName == 'page') txt = page.name;
|
||||
else if (settings.displayJournalName == 'journal+page') txt = name + ' - ' + page.name
|
||||
|
||||
if (rendered && page != undefined) {
|
||||
const currentPage = journal.pages.contents[journal.sheet.pageIndex]
|
||||
if (currentPage.id != pageId) rendered = false;
|
||||
}
|
||||
}
|
||||
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#000000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const ringColor = rendered ? ringOnColor : ringOffColor;
|
||||
const txt = settings.displayCompendiumName ? name : '';
|
||||
//const txt = settings.displayCompendiumName ? name : '';
|
||||
|
||||
streamDeck.setTitle(txt,context);
|
||||
let src = '';
|
||||
@@ -815,18 +844,46 @@ export class OtherControls{
|
||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||
}
|
||||
|
||||
keyPressJournal(settings){
|
||||
const name = settings.compendiumName;
|
||||
async keyPressJournal(settings){
|
||||
const name = settings.journalName;
|
||||
const pageName = settings.journalPageName;
|
||||
let pageId;
|
||||
let journalMode = settings.journalMode ? settings.journalMode : 'openJournal';
|
||||
if (name == undefined) return;
|
||||
|
||||
const journal = game.journal.getName(name);
|
||||
if (journal == undefined) return;
|
||||
|
||||
if (getPermission('OTHER','JOURNAL') == false ) return;
|
||||
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) return;
|
||||
|
||||
if (journal.sheet.rendered == false) journal.sheet.render(true);
|
||||
else journal.sheet.close();
|
||||
if (journal.sheet.rendered == false) {
|
||||
if (journalMode == 'openPageNr') pageId = journal.pages.contents[pageName]?.id
|
||||
else if (journalMode == 'openPageName') pageId = journal.pages.getName(pageName)?.id
|
||||
else {
|
||||
await journal.sheet.render(true);
|
||||
return;
|
||||
}
|
||||
const page = journal.pages.get(pageId);
|
||||
if (page == undefined) return;
|
||||
await journal.sheet.render(true);
|
||||
setTimeout(() => {
|
||||
journal.sheet.goToPage(pageId)
|
||||
},10)
|
||||
}
|
||||
else {
|
||||
if (journalMode == 'openPageNr') pageId = journal.pages.contents[pageName]?.id
|
||||
else if (journalMode == 'openPageName') pageId = journal.pages.getName(pageName)?.id
|
||||
else {
|
||||
await journal.sheet.close();
|
||||
return;
|
||||
}
|
||||
|
||||
const currentPage = journal.pages.contents[journal.sheet.pageIndex]
|
||||
if (currentPage.id == pageId) journal.sheet.close();
|
||||
else {
|
||||
let page = journal.pages.get(pageId)
|
||||
if (page != undefined) journal.sheet.goToPage(pageId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -27,10 +27,10 @@ export class PlaylistControl{
|
||||
this.active = true;
|
||||
const mode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||
|
||||
if (mode == 'playlist'){
|
||||
if (mode == 'playlist' || mode == 'playlistName'){
|
||||
this.updatePlaylist(settings,context,device);
|
||||
}
|
||||
else if (mode == 'track'){
|
||||
else if (mode == 'track' || mode == 'trackName'){
|
||||
this.updateTrack(settings,context,device);
|
||||
}
|
||||
else {
|
||||
@@ -50,22 +50,30 @@ export class PlaylistControl{
|
||||
}
|
||||
|
||||
updatePlaylist(settings,context,device){
|
||||
|
||||
let name = "";
|
||||
let ringColor = "#000000"
|
||||
const background = settings.background ? settings.background : '#000000';
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||
let src = "modules/MaterialDeck/img/transparant.png";
|
||||
|
||||
//Play/Stop
|
||||
if (playlistType == 'playStop'){
|
||||
let playlistNr = parseInt(settings.playlistNr);
|
||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||
playlistNr--;
|
||||
playlistNr += this.playlistOffset;
|
||||
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
let playlist;
|
||||
if (playlistMode == 'playlist') {
|
||||
let playlistNr = parseInt(settings.playlistNr);
|
||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||
playlistNr--;
|
||||
playlistNr += this.playlistOffset;
|
||||
|
||||
playlist = this.getPlaylist(playlistNr);
|
||||
}
|
||||
else {
|
||||
playlist = game.playlists.getName(settings.playlistNr);
|
||||
}
|
||||
|
||||
if (playlist != undefined){
|
||||
if (playlist.playing)
|
||||
@@ -106,22 +114,33 @@ export class PlaylistControl{
|
||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||
let src = "modules/MaterialDeck/img/transparant.png";
|
||||
|
||||
//Play/Stop
|
||||
if (playlistType == 'playStop' || playlistType == 'incDecVol' || playlistType == 'setVol'){
|
||||
let playlistNr = parseInt(settings.playlistNr);
|
||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||
playlistNr--;
|
||||
playlistNr += this.playlistOffset;
|
||||
let trackNr = parseInt(settings.trackNr);
|
||||
if (isNaN(trackNr) || trackNr < 1) trackNr = 1;
|
||||
trackNr--;
|
||||
trackNr += this.trackOffset;
|
||||
let playlist;
|
||||
let trackNr;
|
||||
if (playlistMode == 'track') {
|
||||
let playlistNr = parseInt(settings.playlistNr);
|
||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||
playlistNr--;
|
||||
playlistNr += this.playlistOffset;
|
||||
trackNr = parseInt(settings.trackNr);
|
||||
if (isNaN(trackNr) || trackNr < 1) trackNr = 1;
|
||||
trackNr--;
|
||||
trackNr += this.trackOffset;
|
||||
|
||||
playlist = this.getPlaylist(playlistNr);
|
||||
}
|
||||
else {
|
||||
playlist = game.playlists.getName(settings.playlistNr);
|
||||
}
|
||||
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
if (playlist != undefined){
|
||||
const track = playlist.sounds.contents[trackNr];
|
||||
let track;
|
||||
if (playlistMode == 'track') track = playlist.sounds.contents[trackNr];
|
||||
else track = playlist.sounds.getName(settings.trackNr);
|
||||
if (track != undefined){
|
||||
if (track.playing)
|
||||
ringColor = ringOnColor;
|
||||
@@ -227,8 +246,11 @@ export class PlaylistControl{
|
||||
this.pauseAll();
|
||||
}
|
||||
else {
|
||||
if (playlistType == 'playStop') {
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
let playlist;
|
||||
if (playlistMode == 'playlist' || playlistMode == 'track') playlist = this.getPlaylist(playlistNr);
|
||||
else playlist = game.playlists.getName(settings.playlistNr);
|
||||
|
||||
if (playlistType == 'playStop' && (playlistMode == 'playlist' || playlistMode == 'track')) {
|
||||
if (playlist != undefined){
|
||||
if (playlistMode == 'playlist')
|
||||
this.playPlaylist(playlist,playlistNr);
|
||||
@@ -240,11 +262,28 @@ export class PlaylistControl{
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (playlistType == 'playStop') {
|
||||
if (playlist != undefined) {
|
||||
if (playlistMode == 'playlistName' && playlist.playing)
|
||||
playlist.stopAll();
|
||||
else if (playlistMode == 'playlistName')
|
||||
playlist.playAll();
|
||||
else {
|
||||
const track = playlist.sounds.getName(settings.trackNr);
|
||||
if (track != undefined && track.playing){
|
||||
playlist.stopSound(track);
|
||||
}
|
||||
else if (track != undefined) {
|
||||
playlist.playSound(track);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (playlistType == 'playNext') {
|
||||
this.getPlaylist(playlistNr).playNext();
|
||||
playlist.playNext();
|
||||
}
|
||||
else if (playlistType == 'playPrev') {
|
||||
this.getPlaylist(playlistNr).playNext(null,{direction:-1});
|
||||
playlist.playNext(null,{direction:-1});
|
||||
}
|
||||
else if (playlistType == 'offset'){
|
||||
if (playlistMode == 'playlist') {
|
||||
@@ -275,11 +314,12 @@ export class PlaylistControl{
|
||||
this.updateAll();
|
||||
}
|
||||
else if (playlistType == 'incDecVol' || playlistType == 'setVol') {
|
||||
|
||||
const value = settings.trackVolumeValue ? parseFloat(settings.trackVolumeValue) : 0.1;
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
let playlist = playlistMode == 'track' ? this.getPlaylist(playlistNr) : game.playlists.getName(settings.playlistNr);
|
||||
if (playlist != undefined){
|
||||
if (playlistMode != 'track') return;
|
||||
const track = playlist.sounds.contents[trackNr];
|
||||
if (playlistMode != 'track' && playlistMode != 'trackName') return;
|
||||
const track = playlistMode == 'track' ? playlist.sounds.contents[trackNr] : playlist.sounds.getName(settings.trackNr);
|
||||
if (track != undefined){
|
||||
let newVolume = playlistType == 'incDecVol' ? AudioHelper.volumeToInput(track.volume) + value : value;
|
||||
if (newVolume > 1) newVolume = 1;
|
||||
|
||||
@@ -1194,7 +1194,7 @@ export class downloadUtility extends FormApplication {
|
||||
}
|
||||
else if (reqType == 'Module') {
|
||||
elementId = 'materialDeck_dlUtil_masterModuleVersion';
|
||||
url = game.modules.get('MaterialDeck').manifest;
|
||||
url = 'https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json';
|
||||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
|
||||
@@ -233,7 +233,7 @@ export class pf2e{
|
||||
if (condition == undefined || condition == 'removeAll') return undefined;
|
||||
const Condition = this.getConditionName(condition);
|
||||
const effects = token.actor.items.filter(i => i.type == 'condition');
|
||||
return effects.find(e => e.name === Condition);
|
||||
return effects.find(e => e.name.split(' ')[0] === Condition);
|
||||
}
|
||||
|
||||
getConditionIcon(condition) {
|
||||
@@ -260,7 +260,8 @@ export class pf2e{
|
||||
const effect = this.getConditionValue(token,condition);
|
||||
if (effect == undefined) {
|
||||
if (delta > 0) {
|
||||
await game.pf2e.ConditionManager.addConditionToToken(condition, token);
|
||||
const newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
|
||||
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@@ -282,16 +283,17 @@ export class pf2e{
|
||||
async toggleCondition(token,condition) {
|
||||
if (condition == undefined) condition = 'removeAll';
|
||||
if (condition == 'removeAll'){
|
||||
for( let existing of token.actor.items.filter(i => i.type == 'condition'))
|
||||
await game.pf2e.ConditionManager.removeConditionFromToken(existing.data._id, token);
|
||||
for( let effect of token.actor.items.filter(i => i.type == 'condition'))
|
||||
await effect.delete();
|
||||
}
|
||||
else {
|
||||
const effect = this.getCondition(token,condition);
|
||||
if (effect == undefined) {
|
||||
await game.pf2e.ConditionManager.addConditionToToken(condition, token);
|
||||
const newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
|
||||
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
|
||||
}
|
||||
else {
|
||||
await game.pf2e.ConditionManager.removeConditionFromToken(effect.data._id, token);
|
||||
effect.delete();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user