From 299bec67b586746b77174358b5d32dac8d742093 Mon Sep 17 00:00:00 2001 From: Alan Davies Date: Fri, 26 May 2023 13:37:21 +0100 Subject: [PATCH] Fixed warning in v11 --- scripts/multistatus.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/multistatus.js b/scripts/multistatus.js index 76f0123..a5603fb 100644 --- a/scripts/multistatus.js +++ b/scripts/multistatus.js @@ -21,12 +21,18 @@ Hooks.once("ready", () => { class MultiStatus { static #isV10 = null; + static #isV11 = null; static get isV10() { MultiStatus.#isV10 ??= !isNewerVersion("10", game.version ?? game.data.version); return MultiStatus.#isV10; } + static get isV11() { + MultiStatus.#isV11 ??= !isNewerVersion("11", game.version ?? game.data.version); + return MultiStatus.#isV11; + } + static getTokenData(token) { return (MultiStatus.isV10 ? token.document : token.data); } @@ -45,7 +51,11 @@ class MultiStatus { // Handle dnd35/pf1e buffs, or other fallback processing return wrapper(event, options); } - hasStatus = (token) => token.actor.effects.some(e => e.getFlag("core", "statusId") === effect.id); + + if (MultiStatus.isV11) + hasStatus = (token) => token.actor.effects.some(e => e.statuses.has(effect.id)); + else + hasStatus = (token) => token.actor.effects.some(e => e.getFlag("core", "statusId") === effect.id); } else { effect = img.getAttribute("src"); hasStatus = (token) => {