local UnitIsConnected = UnitIsConnected; local UnitIsDeadOrGhost = UnitIsDeadOrGhost; local UnitHealthMax = UnitHealthMax; local UnitHealth = UnitHealth; local format = string.format hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(frame) -- allowClassColorsForNPCs only in regular raid frames, -- match only to them if frame.optionTable.allowClassColorsForNPCs ~= nil then -- conditions taken from CompactUnitFrame.lua if not UnitIsConnected(frame.unit) or UnitIsDeadOrGhost(frame.displayedUnit) then return; elseif (frame.optionTable.healthText == "losthealth") then -- only losthealth option is condensed local healthLost = UnitHealthMax(frame.displayedUnit) - UnitHealth(frame.displayedUnit); if healthLost <= 0 then return end local prettyHealth; if healthLost > 1200000000 then -- 1.2B prettyHealth = format("-%.1fB", healthLost / 1000000000); elseif healthLost > 1200000 then -- 1.2M prettyHealth = format("-%.1fM", healthLost / 1000000); elseif healthLost > 1000 then -- 1K prettyHealth = format("-%dK", healthLost / 1000); else prettyHealth = format("-%d", healthLost) end frame.statusText:SetText(prettyHealth); end end end);