Damage-Meter with enemies
This commit is contained in:
@@ -1657,7 +1657,31 @@ function refreshDamageMeterOverlay() {
|
||||
|
||||
function computeDamageMeterData() {
|
||||
const currentEncounterId = game.combat?.id ?? ledgerState.lastCombatId ?? null;
|
||||
const actors = game.actors.contents ?? [];
|
||||
const actorsMap = new Map();
|
||||
|
||||
// Directory actors
|
||||
for (const a of game.actors.contents ?? []) {
|
||||
actorsMap.set(a.id, a);
|
||||
}
|
||||
|
||||
// Current combatants (covers unlinked tokens)
|
||||
if (game.combat) {
|
||||
for (const c of game.combat.combatants) {
|
||||
if (c.actor) actorsMap.set(c.actor.id, c.actor);
|
||||
}
|
||||
}
|
||||
|
||||
// Last combat combatants (if not current)
|
||||
if (!game.combat && ledgerState.lastCombatId) {
|
||||
const lastCombat = game.combats?.get?.(ledgerState.lastCombatId);
|
||||
if (lastCombat) {
|
||||
for (const c of lastCombat.combatants) {
|
||||
if (c.actor) actorsMap.set(c.actor.id, c.actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const actors = Array.from(actorsMap.values());
|
||||
const totals = [];
|
||||
const includeNPCs = ledgerState.damageMeterIncludeNPCs;
|
||||
|
||||
@@ -1723,7 +1747,9 @@ function buildDamageMeterContent() {
|
||||
return `
|
||||
<div style="padding:8px; font-size: 13px; line-height: 1.4;">
|
||||
<div style="font-weight:bold; margin-bottom:4px;">Damage Meter</div>
|
||||
<div style="margin-bottom:6px;">${encounterLabel}${npcToggle} <span style="float:right;">v${MODULE_VERSION}</span></div>
|
||||
<div style="margin-bottom:6px; display:flex; align-items:center; justify-content:space-between;">
|
||||
<span>${encounterLabel}${npcToggle}</span>
|
||||
</div>
|
||||
<table style="width:100%; border-collapse:collapse; font-size:12px;">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -1747,6 +1773,7 @@ function buildDamageMeterContent() {
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<div style="text-align:center; margin-top:6px; font-size:11px; opacity:0.7;">v${MODULE_VERSION}</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user