TargetPercent

TargetPercent

247k Downloads

[patch] Do not show percent if 100%

spiralofhope opened this issue ยท 1 comments

commented

I'm re-creating this issue on GitHub for reference.

I find it useless to show a percentage when the target is full. I made the following change:

From:

local healthUpdate = function(frame, _, unit)
	unit = unit or frame.unit
	local hp = UnitHealth(unit)
	if hp > 0 then
		hp = hp / UnitHealthMax(unit) * 100
		addon[unit]:SetFormattedText("%.1f%%", hp)
	else
		addon[unit]:SetText("0%")
	end
end

To:

local healthUpdate = function(frame, _, unit)
	unit = unit or frame.unit
	local hp = UnitHealth(unit)
	local maxhp = UnitHealthMax(unit)
    if hp == maxhp then
        addon[unit]:SetText("")
	elseif hp > 0 then
		hp = hp / UnitHealthMax(unit) * 100
		addon[unit]:SetFormattedText("%.1f%%", hp)
	else
		addon[unit]:SetText("0%")
	end
end
commented

Originally closed, without discussion, by funkydude as Invalid.