v1.5.1
This commit is contained in:
14
changelog.md
14
changelog.md
@@ -1,4 +1,18 @@
|
|||||||
# Changelog Material Deck Module
|
# 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
|
### v1.5.0 - 28-05-2023
|
||||||
Additions:
|
Additions:
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
116
module.json
116
module.json
@@ -1,58 +1,64 @@
|
|||||||
{
|
{
|
||||||
"name": "MaterialDeck",
|
"name": "MaterialDeck",
|
||||||
"id": "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.5.0",
|
"version": "1.5.1",
|
||||||
"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"],
|
"esmodules": [
|
||||||
"styles": ["./css/style.css"],
|
"./MaterialDeck.js"
|
||||||
"socket": true,
|
],
|
||||||
"minimumCoreVersion": "10",
|
"styles": [
|
||||||
"compatibleCoreVersion": "11",
|
"./css/style.css"
|
||||||
"compatibility": {
|
],
|
||||||
"minimum": "10",
|
"socket": true,
|
||||||
"verified": "11"
|
"minimumCoreVersion": "10",
|
||||||
},
|
"compatibleCoreVersion": "11",
|
||||||
"flags": {
|
"compatibility": {
|
||||||
"minimumMSVersion": "1.1.0",
|
"minimum": "10",
|
||||||
"minimumPluginVersion": "1.5.0"
|
"verified": "11"
|
||||||
},
|
|
||||||
"languages": [
|
|
||||||
{
|
|
||||||
"lang": "en",
|
|
||||||
"name": "English",
|
|
||||||
"path": "lang/en.json"
|
|
||||||
},
|
},
|
||||||
{
|
"flags": {
|
||||||
"lang": "ja",
|
"minimumMSVersion": "1.1.0",
|
||||||
"name": "日本語",
|
"minimumPluginVersion": "1.5.0"
|
||||||
"path": "lang/ja.json"
|
},
|
||||||
}
|
"languages": [
|
||||||
],
|
{
|
||||||
"media": [
|
"lang": "en",
|
||||||
{
|
"name": "English",
|
||||||
"type": "icon",
|
"path": "lang/en.json"
|
||||||
"url": "modules/MaterialDeck/img/MaterialFoundry512x512.png"
|
},
|
||||||
},{
|
{
|
||||||
"type": "setup",
|
"lang": "ja",
|
||||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
"name": "日本語",
|
||||||
},{
|
"path": "lang/ja.json"
|
||||||
"type": "cover",
|
}
|
||||||
"url": "modules/MaterialDeck/img/MaterialFoundry2560x1440.jpg"
|
],
|
||||||
}
|
"media": [
|
||||||
],
|
{
|
||||||
"manifestPlusVersion": "1.1.0",
|
"type": "icon",
|
||||||
"url": "https://github.com/CDeenen/MaterialDeck",
|
"url": "modules/MaterialDeck/img/MaterialFoundry512x512.png"
|
||||||
"manifest": "https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json",
|
},
|
||||||
"download": "https://github.com/CDeenen/MaterialDeck/archive/Master.zip"
|
{
|
||||||
|
"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 = {
|
let chatData = {
|
||||||
user: game.user._id,
|
user: game.user._id,
|
||||||
speaker: ChatMessage.getSpeaker(),
|
speaker: ChatMessage.getSpeaker(),
|
||||||
content: "/amacro '" + macro.name + "' " + args[macroNumber]
|
content: "/amacro '" + macro.name + "' " + args
|
||||||
};
|
};
|
||||||
ChatMessage.create(chatData, {});
|
ChatMessage.create(chatData, {});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -780,11 +780,21 @@ export class OtherControls{
|
|||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
updateJournal(settings,context,device,options={}){
|
updateJournal(settings,context,device,options={}){
|
||||||
const name = settings.compendiumName;
|
const name = settings.journalName;
|
||||||
if (name == undefined) return;
|
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);
|
const journal = game.journal.getName(name);
|
||||||
if (journal == undefined) return;
|
if (journal == undefined) {
|
||||||
|
streamDeck.setTitle('',context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (getPermission('OTHER','JOURNAL') == false ) {
|
if (getPermission('OTHER','JOURNAL') == false ) {
|
||||||
streamDeck.noPermission(context,device);
|
streamDeck.noPermission(context,device);
|
||||||
@@ -803,11 +813,30 @@ export class OtherControls{
|
|||||||
else
|
else
|
||||||
if (document.getElementById("journalentry-sheet-"+journal.id) != null) rendered = true;
|
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 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 ringColor = rendered ? ringOnColor : ringOffColor;
|
const ringColor = rendered ? ringOnColor : ringOffColor;
|
||||||
const txt = settings.displayCompendiumName ? name : '';
|
//const txt = settings.displayCompendiumName ? name : '';
|
||||||
|
|
||||||
streamDeck.setTitle(txt,context);
|
streamDeck.setTitle(txt,context);
|
||||||
let src = '';
|
let src = '';
|
||||||
@@ -815,18 +844,46 @@ export class OtherControls{
|
|||||||
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
streamDeck.setIcon(context,device,src,{background:background,ring:2,ringColor:ringColor});
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPressJournal(settings){
|
async keyPressJournal(settings){
|
||||||
const name = settings.compendiumName;
|
const name = settings.journalName;
|
||||||
|
const pageName = settings.journalPageName;
|
||||||
|
let pageId;
|
||||||
|
let journalMode = settings.journalMode ? settings.journalMode : 'openJournal';
|
||||||
if (name == undefined) return;
|
if (name == undefined) return;
|
||||||
|
|
||||||
const journal = game.journal.getName(name);
|
const journal = game.journal.getName(name);
|
||||||
if (journal == undefined) return;
|
if (journal == undefined) return;
|
||||||
|
|
||||||
if (getPermission('OTHER','JOURNAL') == false ) return;
|
if (getPermission('OTHER','JOURNAL') == false ) return;
|
||||||
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) return;
|
if (journal.permission < 2 && getPermission('OTHER','JOURNAL_ALL') == false ) return;
|
||||||
|
if (journal.sheet.rendered == false) {
|
||||||
if (journal.sheet.rendered == false) journal.sheet.render(true);
|
if (journalMode == 'openPageNr') pageId = journal.pages.contents[pageName]?.id
|
||||||
else journal.sheet.close();
|
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;
|
this.active = true;
|
||||||
const mode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
const mode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||||
|
|
||||||
if (mode == 'playlist'){
|
if (mode == 'playlist' || mode == 'playlistName'){
|
||||||
this.updatePlaylist(settings,context,device);
|
this.updatePlaylist(settings,context,device);
|
||||||
}
|
}
|
||||||
else if (mode == 'track'){
|
else if (mode == 'track' || mode == 'trackName'){
|
||||||
this.updateTrack(settings,context,device);
|
this.updateTrack(settings,context,device);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -50,22 +50,30 @@ export class PlaylistControl{
|
|||||||
}
|
}
|
||||||
|
|
||||||
updatePlaylist(settings,context,device){
|
updatePlaylist(settings,context,device){
|
||||||
|
|
||||||
let name = "";
|
let name = "";
|
||||||
let ringColor = "#000000"
|
let ringColor = "#000000"
|
||||||
const background = settings.background ? settings.background : '#000000';
|
const background = settings.background ? settings.background : '#000000';
|
||||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||||
|
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||||
let src = "modules/MaterialDeck/img/transparant.png";
|
let src = "modules/MaterialDeck/img/transparant.png";
|
||||||
|
|
||||||
//Play/Stop
|
//Play/Stop
|
||||||
if (playlistType == 'playStop'){
|
if (playlistType == 'playStop'){
|
||||||
let playlistNr = parseInt(settings.playlistNr);
|
let playlist;
|
||||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
if (playlistMode == 'playlist') {
|
||||||
playlistNr--;
|
let playlistNr = parseInt(settings.playlistNr);
|
||||||
playlistNr += this.playlistOffset;
|
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||||
|
playlistNr--;
|
||||||
let playlist = this.getPlaylist(playlistNr);
|
playlistNr += this.playlistOffset;
|
||||||
|
|
||||||
|
playlist = this.getPlaylist(playlistNr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
playlist = game.playlists.getName(settings.playlistNr);
|
||||||
|
}
|
||||||
|
|
||||||
if (playlist != undefined){
|
if (playlist != undefined){
|
||||||
if (playlist.playing)
|
if (playlist.playing)
|
||||||
@@ -106,22 +114,33 @@ export class PlaylistControl{
|
|||||||
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
const ringOffColor = settings.offRing ? settings.offRing : '#FF0000';
|
||||||
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
const ringOnColor = settings.onRing ? settings.onRing : '#00FF00';
|
||||||
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
const playlistType = settings.playlistType ? settings.playlistType : 'playStop';
|
||||||
|
const playlistMode = settings.playlistMode ? settings.playlistMode : 'playlist';
|
||||||
let src = "modules/MaterialDeck/img/transparant.png";
|
let src = "modules/MaterialDeck/img/transparant.png";
|
||||||
|
|
||||||
//Play/Stop
|
//Play/Stop
|
||||||
if (playlistType == 'playStop' || playlistType == 'incDecVol' || playlistType == 'setVol'){
|
if (playlistType == 'playStop' || playlistType == 'incDecVol' || playlistType == 'setVol'){
|
||||||
let playlistNr = parseInt(settings.playlistNr);
|
let playlist;
|
||||||
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
let trackNr;
|
||||||
playlistNr--;
|
if (playlistMode == 'track') {
|
||||||
playlistNr += this.playlistOffset;
|
let playlistNr = parseInt(settings.playlistNr);
|
||||||
let trackNr = parseInt(settings.trackNr);
|
if (isNaN(playlistNr) || playlistNr < 1) playlistNr = 1;
|
||||||
if (isNaN(trackNr) || trackNr < 1) trackNr = 1;
|
playlistNr--;
|
||||||
trackNr--;
|
playlistNr += this.playlistOffset;
|
||||||
trackNr += this.trackOffset;
|
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){
|
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 != undefined){
|
||||||
if (track.playing)
|
if (track.playing)
|
||||||
ringColor = ringOnColor;
|
ringColor = ringOnColor;
|
||||||
@@ -227,8 +246,11 @@ export class PlaylistControl{
|
|||||||
this.pauseAll();
|
this.pauseAll();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (playlistType == 'playStop') {
|
let playlist;
|
||||||
let playlist = this.getPlaylist(playlistNr);
|
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 (playlist != undefined){
|
||||||
if (playlistMode == 'playlist')
|
if (playlistMode == 'playlist')
|
||||||
this.playPlaylist(playlist,playlistNr);
|
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') {
|
else if (playlistType == 'playNext') {
|
||||||
this.getPlaylist(playlistNr).playNext();
|
playlist.playNext();
|
||||||
}
|
}
|
||||||
else if (playlistType == 'playPrev') {
|
else if (playlistType == 'playPrev') {
|
||||||
this.getPlaylist(playlistNr).playNext(null,{direction:-1});
|
playlist.playNext(null,{direction:-1});
|
||||||
}
|
}
|
||||||
else if (playlistType == 'offset'){
|
else if (playlistType == 'offset'){
|
||||||
if (playlistMode == 'playlist') {
|
if (playlistMode == 'playlist') {
|
||||||
@@ -275,11 +314,12 @@ export class PlaylistControl{
|
|||||||
this.updateAll();
|
this.updateAll();
|
||||||
}
|
}
|
||||||
else if (playlistType == 'incDecVol' || playlistType == 'setVol') {
|
else if (playlistType == 'incDecVol' || playlistType == 'setVol') {
|
||||||
|
|
||||||
const value = settings.trackVolumeValue ? parseFloat(settings.trackVolumeValue) : 0.1;
|
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 (playlist != undefined){
|
||||||
if (playlistMode != 'track') return;
|
if (playlistMode != 'track' && playlistMode != 'trackName') return;
|
||||||
const track = playlist.sounds.contents[trackNr];
|
const track = playlistMode == 'track' ? playlist.sounds.contents[trackNr] : playlist.sounds.getName(settings.trackNr);
|
||||||
if (track != undefined){
|
if (track != undefined){
|
||||||
let newVolume = playlistType == 'incDecVol' ? AudioHelper.volumeToInput(track.volume) + value : value;
|
let newVolume = playlistType == 'incDecVol' ? AudioHelper.volumeToInput(track.volume) + value : value;
|
||||||
if (newVolume > 1) newVolume = 1;
|
if (newVolume > 1) newVolume = 1;
|
||||||
|
|||||||
@@ -1194,7 +1194,7 @@ export class downloadUtility extends FormApplication {
|
|||||||
}
|
}
|
||||||
else if (reqType == 'Module') {
|
else if (reqType == 'Module') {
|
||||||
elementId = 'materialDeck_dlUtil_masterModuleVersion';
|
elementId = 'materialDeck_dlUtil_masterModuleVersion';
|
||||||
url = game.modules.get('MaterialDeck').manifest;
|
url = 'https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json';
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ export class pf2e{
|
|||||||
if (condition == undefined || condition == 'removeAll') return undefined;
|
if (condition == undefined || condition == 'removeAll') return undefined;
|
||||||
const Condition = this.getConditionName(condition);
|
const Condition = this.getConditionName(condition);
|
||||||
const effects = token.actor.items.filter(i => i.type == 'condition');
|
const effects = token.actor.items.filter(i => i.type == 'condition');
|
||||||
return effects.find(e => e.name === Condition);
|
return effects.find(e => e.name.split(' ')[0] === Condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
getConditionIcon(condition) {
|
getConditionIcon(condition) {
|
||||||
@@ -260,7 +260,8 @@ 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) {
|
||||||
await game.pf2e.ConditionManager.addConditionToToken(condition, token);
|
const newEffect = game.pf2e.ConditionManager.conditions.get(condition).toObject();
|
||||||
|
await token.actor?.createEmbeddedDocuments("Item", [newEffect]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -282,16 +283,17 @@ 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 existing of token.actor.items.filter(i => i.type == 'condition'))
|
for( let effect of token.actor.items.filter(i => i.type == 'condition'))
|
||||||
await game.pf2e.ConditionManager.removeConditionFromToken(existing.data._id, token);
|
await effect.delete();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const effect = this.getCondition(token,condition);
|
const effect = this.getCondition(token,condition);
|
||||||
if (effect == undefined) {
|
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 {
|
else {
|
||||||
await game.pf2e.ConditionManager.removeConditionFromToken(effect.data._id, token);
|
effect.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user