From 351edebb8ac6311aa4ca0c825a1cc150ff42243a Mon Sep 17 00:00:00 2001 From: Joe Spandrusyszyn Date: Sun, 7 Aug 2022 17:42:56 -0400 Subject: [PATCH] Updated for Foundry v10 --- module/module.json | 11 +++++------ module/scripts/effect-scaler.js | 4 ++-- module/scripts/hud-button-scaler.js | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/module/module.json b/module/module.json index ed77259..b2f4fdc 100644 --- a/module/module.json +++ b/module/module.json @@ -1,14 +1,15 @@ { - "name": "illandril-token-hud-scale", + "id": "illandril-token-hud-scale", "title": "Illandril's Token HUD scaler", "description": "Improves the visibility of the Token HUD and Status Effect icons. More specifically, this increases the scale of the Token HUD by 50%, adjusts the size of token status effects so they fit 3 across for the token (60% larger than standard for 1:1 tokens, much larger than standard for double-sized tokens, slightly smaller than standard for half-size tokens), and increases the opacity of the background behind both the Token HUD and Status Effect icons.", "version": "1.5.1", "library": "false", "manifestPlusVersion": "1.2.0", - "minimumCoreVersion": "0.8.5", - "compatibleCoreVersion": "9", + "compatibility": { + "minimum": 10, + "verified": 10 + }, "type": "module", - "author": "Joe Spandrusyszyn (illandril)", "authors": [ { "name": "Joe Spandrusyszyn (illandril)", @@ -20,8 +21,6 @@ "reddit": "u/illandril" } ], - "dependencies": [], - "conflicts": [], "esmodules": [ "./scripts/index.js" ], diff --git a/module/scripts/effect-scaler.js b/module/scripts/effect-scaler.js index 48227a6..5f55fd5 100644 --- a/module/scripts/effect-scaler.js +++ b/module/scripts/effect-scaler.js @@ -25,7 +25,7 @@ function countEffects(token) { if (!token) { return 0; } - const tokenEffects = token.data.effects; + const tokenEffects = token.document.effects; const actorEffects = (token.actor && token.actor.temporaryEffects) || []; let numEffects = tokenEffects.length; actorEffects.forEach((actorEffect) => { @@ -43,7 +43,7 @@ function updateEffectScales(token) { const layout = Settings.EffectIconsLayout.get(); const above = layout === 'above'; const horizontal = above || layout === 'horizontal'; - const iconsPerRow = Math.ceil(Settings.EffectIconsPerRow.get() * (horizontal ? token.data.width : token.data.height)); + const iconsPerRow = Math.ceil(Settings.EffectIconsPerRow.get() * (horizontal ? token.document.width : token.document.height)); const w = (horizontal ? token.w : token.h) / iconsPerRow; const bg = effectsHUD.children[0]; diff --git a/module/scripts/hud-button-scaler.js b/module/scripts/hud-button-scaler.js index f3f40b1..23099ca 100644 --- a/module/scripts/hud-button-scaler.js +++ b/module/scripts/hud-button-scaler.js @@ -2,7 +2,7 @@ import Settings, { SETTINGS_UPDATED } from './settings.js'; const baselineSetPosition = TokenHUD.prototype.setPosition; const rescaleSetPosition = function () { - const td = this.object.data; + const td = this.object.document; const ratio = canvas.dimensions.size / 100; let scale = Settings.HUDButtonScale.get(); if (Settings.EnableStaticSizedHUD.get()) {