Update Healer Man server
This commit is contained in:
1 parent
48a678dcc5
commit
9c5fb4c614
18 files changed
+397
-46
No files matched your search
+12
-10
@@ -30,24 +30,26 @@ function auraDisplayExpiry(aura: ActiveAura): number {
|
||||
|
||||
/** Collapses a spell's multiple DBC aura effects and repeated sources into one HUD icon. */
|
||||
export function groupAurasForDisplay(auras: readonly ActiveAura[]): ActiveAura[] {
|
||||
const grouped = new Map<string, ActiveAura>();
|
||||
const grouped = new Map<string, { representative: ActiveAura; stacksByDefinition: Map<string, number> }>();
|
||||
for (const aura of auras) {
|
||||
const key = auraDisplayGroupKey(aura);
|
||||
const existing = grouped.get(key);
|
||||
if (!existing) {
|
||||
grouped.set(key, aura);
|
||||
grouped.set(key, { representative: aura, stacksByDefinition: new Map([[aura.definition.id, aura.stacks]]) });
|
||||
continue;
|
||||
}
|
||||
const representative = auraDisplayExpiry(aura) > auraDisplayExpiry(existing)
|
||||
|| (auraDisplayExpiry(aura) === auraDisplayExpiry(existing) && aura.appliedAt > existing.appliedAt)
|
||||
const representative = auraDisplayExpiry(aura) > auraDisplayExpiry(existing.representative)
|
||||
|| (auraDisplayExpiry(aura) === auraDisplayExpiry(existing.representative) && aura.appliedAt > existing.representative.appliedAt)
|
||||
? aura
|
||||
: existing;
|
||||
const stacks = Math.max(existing.stacks, aura.stacks);
|
||||
grouped.set(key, representative.stacks === stacks
|
||||
? representative
|
||||
: { ...representative, stacks });
|
||||
: existing.representative;
|
||||
existing.stacksByDefinition.set(aura.definition.id,
|
||||
(existing.stacksByDefinition.get(aura.definition.id) ?? 0) + aura.stacks);
|
||||
existing.representative = representative;
|
||||
}
|
||||
return [...grouped.values()];
|
||||
return [...grouped.values()].map(({ representative, stacksByDefinition }) => {
|
||||
const stacks = Math.max(...stacksByDefinition.values());
|
||||
return representative.stacks === stacks ? representative : { ...representative, stacks };
|
||||
});
|
||||
}
|
||||
|
||||
/** Permanent and one-minute-or-longer auras are persistent party-frame clutter. */
|
||||
|
||||
Reference in new issue
Block a user