diff --git a/src/macros_new/gowlers-tracking-ledger/foundry.gowlershome.dyndns.org/modules/gowlers-tracking-ledger/scripts/gowlers-tracking-ledger.js b/src/macros_new/gowlers-tracking-ledger/foundry.gowlershome.dyndns.org/modules/gowlers-tracking-ledger/scripts/gowlers-tracking-ledger.js index 3a7c802b..c62e38e5 100644 --- a/src/macros_new/gowlers-tracking-ledger/foundry.gowlershome.dyndns.org/modules/gowlers-tracking-ledger/scripts/gowlers-tracking-ledger.js +++ b/src/macros_new/gowlers-tracking-ledger/foundry.gowlershome.dyndns.org/modules/gowlers-tracking-ledger/scripts/gowlers-tracking-ledger.js @@ -1540,6 +1540,34 @@ function formatDamagePartsWithIcons(parts) { .join(" "); } +function renderDamageBar(composition = [], total = 0) { + const iconMap = { + slashing: { icon: "ra ra-sword", color: "#e3c000" }, + piercing: { icon: "ra ra-spear-head", color: "#2c7be5" }, + bludgeoning: { icon: "ra ra-large-hammer", color: "#e03131" }, + fire: { icon: "ra ra-fire", color: "#f76707" }, + cold: { icon: "ra ra-snowflake", color: "#3bc9db" }, + electricity: { icon: "ra ra-lightning-bolt", color: "#f0c419" }, + acid: { icon: "ra ra-round-bottom-flask", color: "#2f9e44" }, + sonic: { icon: "ra ra-megaphone", color: "#22b8cf" }, + force: { icon: "ra ra-crystal-ball", color: "#845ef7" }, + negative: { icon: "ra ra-skull", color: "#7950f2" }, + positive: { icon: "ra ra-sun", color: "#fab005" }, + precision: { icon: "ra ra-target-arrows", color: "#000" }, + nonlethal: { icon: "ra ra-hand", color: "#000" }, + untyped: { icon: "ra ra-uncertainty", color: "#666" }, + }; + if (!total || !composition.length) return ""; + const segments = composition.map((c) => { + const pct = Math.max(2, Math.round((c.value / total) * 100)); + const entry = iconMap[c.type?.toLowerCase?.()] ?? iconMap.untyped; + return `