TargetPercent

2 - [patch] Do not show percent if 100%

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

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

>

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
User When Change
spiralofhope Feb 25, 2015 at 11:41 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

Facts

Reported
Feb 25, 2015
Status
New - Issue has not had initial review yet.
Type
Enhancement - A change which is intended to better the project in some way
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees