From 3997639af1138d70073383f121a6e511d299a17c Mon Sep 17 00:00:00 2001 From: p4535992 Date: Thu, 3 Nov 2022 15:57:18 +0100 Subject: [PATCH] version 3.3.3 --- package-lock.json | 4 +-- package.json | 2 +- src/module.json | 6 ++--- src/scripts/api.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index fbf1b77..83e9069 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mountup", - "version": "3.3.1", + "version": "3.3.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mountup", - "version": "3.3.1", + "version": "3.3.2", "license": "SEE LICENSE IN LICENSE", "dependencies": { "build": "^0.1.4", diff --git a/package.json b/package.json index ca6ffe1..592d680 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "mountup", "title": "FoundryVTT Mount Up!", "description": "Allows tokens to carry or be carried by other tokens. This is completely system agnostic, and fully customizable to fit right into your game.", - "version": "3.3.2", + "version": "3.3.3", "main": "mountup.js", "scripts": { "publish": "gulp publish --update", diff --git a/src/module.json b/src/module.json index adf2912..5e12716 100644 --- a/src/module.json +++ b/src/module.json @@ -2,7 +2,7 @@ "id": "mountup", "title": "Mount Up!", "description": "Allows tokens to carry or be carried by other tokens. This is completely system agnostic, and fully customizable to fit right into your game.", - "version": "3.3.2", + "version": "3.3.3", "authors": [ { "name": "Brunhine" @@ -69,8 +69,8 @@ "url": "https://github.com/p4535992/foundryvtt-mountup", "manifest": "https://github.com/p4535992/foundryvtt-mountup/releases/latest/download/module.json", "download": "https://github.com/p4535992/foundryvtt-mountup/releases/latest/download/module.zip", - "readme": "https://github.com/p4535992/foundryvtt-mountup/blob/v3.3.2/README.md", - "changelog": "https://github.com/p4535992/foundryvtt-mountup/blob/v3.3.2/changelog.md", + "readme": "https://github.com/p4535992/foundryvtt-mountup/blob/v3.3.3/README.md", + "changelog": "https://github.com/p4535992/foundryvtt-mountup/blob/v3.3.3/changelog.md", "bugs": "https://github.com/p4535992/foundryvtt-mountup/issues", "allowBugReporter": true, "manifestPlusVersion": "1.2.0", diff --git a/src/scripts/api.ts b/src/scripts/api.ts index bbd0272..de65a17 100644 --- a/src/scripts/api.ts +++ b/src/scripts/api.ts @@ -199,6 +199,41 @@ const API = { warn(`No token found on the canvas for id '${token.id}'`, true); } } + // OLD + for (const token of tokens) { + if (token && token.document) { + if (getProperty(token.document, `flags.${"foundryvtt-mountup"}`)) { + const p = getProperty(token.document, `flags.${"foundryvtt-mountup"}`); + for (const key in p) { + const senseOrConditionIdKey = key; + const senseOrConditionValue = p[key]; + await token.document.unsetFlag("foundryvtt-mountup", senseOrConditionIdKey); + } + const attached = token.document.getFlag("token-attacher", `attached`); + if (attached) { + await window["tokenAttacher"].detachAllElementsFromToken(token, true); + } + info(`Cleaned up token '${token.name}'`, true); + } + } else { + warn(`No token found on the canvas for id '${token.id}'`, true); + } + } + for (const token of tokens) { + if (token && token.actor) { + if (getProperty(token.actor, `flags.${"foundryvtt-mountup"}`)) { + const p = getProperty(token.actor, `flags.${"foundryvtt-mountup"}`); + for (const key in p) { + const senseOrConditionIdKey = key; + const senseOrConditionValue = p[key]; + await token.actor.unsetFlag("foundryvtt-mountup", senseOrConditionIdKey); + } + info(`Cleaned up actor '${token.name}'`, true); + } + } else { + warn(`No token found on the canvas for id '${token.id}'`, true); + } + } }, async cleanUpToken(token: Token) { @@ -233,6 +268,38 @@ const API = { } else { warn(`No token found on the canvas for id '${token.id}'`, true); } + // OLD + if (token && token.document) { + if (getProperty(token.document, `flags.${"foundryvtt-mountup"}`)) { + const p = getProperty(token.document, `flags.${"foundryvtt-mountup"}`); + for (const key in p) { + const senseOrConditionIdKey = key; + const senseOrConditionValue = p[key]; + await token.document.unsetFlag("foundryvtt-mountup", senseOrConditionIdKey); + } + const attached = token.document.getFlag("token-attacher", `attached`); + if (attached) { + await window["tokenAttacher"].detachAllElementsFromToken(token, true); + } + info(`Cleaned up token '${token.name}'`, true); + } + } else { + warn(`No token found on the canvas for id '${token.id}'`, true); + } + + if (token && token.actor) { + if (getProperty(token.actor, `flags.${"foundryvtt-mountup"}`)) { + const p = getProperty(token.actor, `flags.${"foundryvtt-mountup"}`); + for (const key in p) { + const senseOrConditionIdKey = key; + const senseOrConditionValue = p[key]; + await token.actor.unsetFlag("foundryvtt-mountup", senseOrConditionIdKey); + } + info(`Cleaned up actor '${token.name}'`, true); + } + } else { + warn(`No token found on the canvas for id '${token.id}'`, true); + } }, async cleanUpTokenDialog(token: Token) {