fix ArenaX option being overwritten by unit name

This commit is contained in:
Sumsebrum 2021-05-24 12:53:33 +02:00
parent df58544f6e
commit 5e42a9b51f

View File

@ -98,8 +98,9 @@ function Healthbar.OnEvent(self, event, unit)
if event == "UNIT_HEALTH" then if event == "UNIT_HEALTH" then
local health = UnitHealth(unit) local health = UnitHealth(unit)
local healthMax = UnitHealthMax(unit) local healthMax = UnitHealthMax(unit)
Healthbar:SetHealthText(self, health, healthMax) self.hp:SetMinMaxValues(0, healthMax)
self.hp:SetValue(UnitHealth(unit)) self.hp:SetValue(UnitHealth(unit))
Healthbar:SetHealthText(self, health, healthMax)
elseif event == "UNIT_MAXHEALTH" then elseif event == "UNIT_MAXHEALTH" then
local health = UnitHealth(unit) local health = UnitHealth(unit)
local healthMax = UnitHealthMax(unit) local healthMax = UnitHealthMax(unit)
@ -109,8 +110,10 @@ function Healthbar.OnEvent(self, event, unit)
elseif event == "UNIT_NAME_UPDATE" then elseif event == "UNIT_NAME_UPDATE" then
local name = UnitName(unit) local name = UnitName(unit)
Gladdy.buttons[unit].name = name Gladdy.buttons[unit].name = name
if Gladdy.db.healthName and not Gladdy.db.healthNameToArenaId then
self.nameText:SetText(name) self.nameText:SetText(name)
end end
end
if not Gladdy.buttons[unit].class then if not Gladdy.buttons[unit].class then
Gladdy:SpotEnemy(unit, true) Gladdy:SpotEnemy(unit, true)
end end