From 0fb79b98bb65f11cc53b2fdc538700b6624f2b9a Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Wed, 10 Jun 2026 23:29:15 +0200 Subject: [PATCH] [Housekeeping] V14.364 Update (#1991) * Raised compatability to foundry-364. Swapped to new resourceBar color methodology * Bumped min-version --- daggerheart.mjs | 14 ++++++++++++++ module/canvas/placeables/token.mjs | 10 ++++------ system.json | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/daggerheart.mjs b/daggerheart.mjs index a018caba..b92be2a2 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -77,6 +77,20 @@ CONFIG.Token.prototypeSheetClass = applications.sheetConfigs.DhPrototypeTokenCon CONFIG.Token.objectClass = placeables.DhTokenPlaceable; CONFIG.Token.rulerClass = placeables.DhTokenRuler; CONFIG.Token.hudClass = applications.hud.DHTokenHUD; +CONFIG.Token.barConfig = { + bar1: { + colors: { + full: Color.fromRGB([1, 0, 0]), + empty: Color.fromRGB([0, 0, 0]) + } + }, + bar2: { + colors: { + full: Color.fromString('#0032b1'), + empty: Color.fromRGB([0, 0, 0]) + } + } +}; CONFIG.ui.combat = applications.ui.DhCombatTracker; CONFIG.ui.nav = applications.ui.DhSceneNavigation; diff --git a/module/canvas/placeables/token.mjs b/module/canvas/placeables/token.mjs index 02eed7db..7ae6dc37 100644 --- a/module/canvas/placeables/token.mjs +++ b/module/canvas/placeables/token.mjs @@ -248,7 +248,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { } /** @inheritDoc */ - _drawBar(number, bar, data) { + _drawBar(index, bar, data) { // Determine sizing const { width, height } = this.document.getSize(); const s = canvas.dimensions.uiScale; @@ -256,9 +256,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { const bh = 8 * (this.document.height >= 2 ? 1.5 : 1) * s; // Determine the color to use - const Color = foundry.utils.Color; - const fillColor = number === 0 ? Color.fromRGB([1, 0, 0]) : Color.fromString('#0032b1'); - const emptyColor = Color.fromRGB([0, 0, 0]); + const { full: fullColor, empty: emptyColor } = this._getBarColors(index, data); // Draw the bar (accounting floating point numbers from bar animations) const widthUnit = bw / Math.ceil(data.max); @@ -268,7 +266,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { const x = mark * widthUnit; const marked = mark < Math.ceil(data.value); const remainder = mark === Math.ceil(data.value) - 1 ? data.value % 1 : 0; - const color = !marked ? emptyColor : remainder ? emptyColor.mix(fillColor, remainder) : fillColor; + const color = !marked ? emptyColor : remainder ? emptyColor.mix(fullColor, remainder) : fullColor; if (mark === 0 || mark === sections.length - 1) { bar.beginFill(color, marked ? 1.0 : 0.5).drawRect(x, 0, widthUnit, bh, 2 * s); // Would like drawRoundedRect, but it's very troublsome with the corners. Leaving for now. } else { @@ -277,7 +275,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token { } // Set position - const posY = number === 0 ? height - bh : 0; + const posY = index === 0 ? height - bh : 0; bar.position.set(0, posY); return true; } diff --git a/system.json b/system.json index ed14a17b..014af29a 100644 --- a/system.json +++ b/system.json @@ -4,8 +4,8 @@ "description": "An unofficial implementation of the Daggerheart system", "version": "2.3.2", "compatibility": { - "minimum": "14.361", - "verified": "14.363", + "minimum": "14.364", + "verified": "14.364", "maximum": "14" }, "url": "https://github.com/Foundryborne/daggerheart",