Commit 380e436f authored by Simpy's avatar Simpy 🐹
Browse files

Unknown units (when name is Unknown but unit exists) caused nil error in...

Unknown units (when name is Unknown but unit exists) caused nil error in name:health when using class color as base, this patches namecolor tag to return light grey in that case and also patches NameHealthColor to fallback to default color (even tho in this case its not needed to do both, it's mainly just incase someone changes the namecolor tag)
parent f35fd3d1
......@@ -300,7 +300,7 @@ end
local function NameHealthColor(tags,hex,unit,default)
if hex == 'class' or hex == 'reaction' then
return tags.namecolor(unit)
return tags.namecolor(unit) or default
elseif hex and strmatch(hex, '^%x%x%x%x%x%x$') then
return '|cFF'..hex
......@@ -532,13 +532,11 @@ ElvUF.Tags.Events['namecolor'] = 'UNIT_NAME_UPDATE UNIT_FACTION INSTANCE_ENCOUNT
ElvUF.Tags.Methods['namecolor'] = function(unit)
if UnitIsPlayer(unit) then
local _, unitClass = UnitClass(unit)
local class = ElvUF.colors.class[unitClass]
if class then
return Hex(class[1], class[2], class[3])
local cs = ElvUF.colors.class[unitClass]
return (cs and Hex(cs[1], cs[2], cs[3])) or '|cFFcccccc'
local color = ElvUF.colors.reaction[UnitReaction(unit, 'player')]
return (color and Hex(color[1], color[2], color[3])) or '|cFFC2C2C2'
local cr = ElvUF.colors.reaction[UnitReaction(unit, 'player')]
return (cr and Hex(cr[1], cr[2], cr[3])) or '|cFFcccccc'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment