1 hooksecurefunc("CompactUnitFrame_UpdateStatusText",
3 if frame and not frame:IsForbidden() then
4 local frameName = frame:GetName();
5 if frameName and frameName:match("^CompactRaidFrame%d") and frame.unit then
6 -- conditions taken from CompactUnitFrame.lua
7 if not UnitIsConnected(frame.unit) or UnitIsDeadOrGhost(frame.displayedUnit) then
9 elseif ( frame.optionTable.healthText == "losthealth" ) then
10 -- only losthealth option is condensed
11 local healthLost = UnitHealthMax(frame.displayedUnit) - UnitHealth(frame.displayedUnit);
13 if healthLost > 1200000000 then -- 1.2B
14 local h1b = healthLost / 1000000000;
15 local h100m = (healthLost % 1000000000) / 100000000;
16 prettyHealth = string.format("-%d.%dB", h1b, h100m);
17 elseif healthLost > 1200000 then -- 1.2M
18 prettyHealth = string.format("-%dM", healthLost / 1000000);
19 elseif healthLost > 1000 then -- 1K
20 prettyHealth = string.format("-%dK", healthLost / 1000);
22 prettyHealth = string.format("-%d", healthLost)
25 if healthLost > 0 then
26 frame.statusText:SetText(prettyHealth);
27 frame.statusText:Show();
29 frame.statusText:Hide();