Skip to content

Commit

Permalink
Fixed warning in v11
Browse files Browse the repository at this point in the history
  • Loading branch information
cs96and committed May 26, 2023
1 parent f4a32fa commit 299bec6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/multistatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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) => {
Expand Down

0 comments on commit 299bec6

Please sign in to comment.