Fixed Class tags showing hostile NPCs with class in all caps

UnitClassBase apparently changed in 8.0 to return the unlocalized class name, so now we take the class index from UnitClassBase and pass it to GetClassInfo to print the localized, properly-capitalized class name.
This commit is contained in:
Parnic
2018-08-30 16:45:52 -05:00
parent f3baacc232
commit 4a306b17c9

View File

@ -20,6 +20,7 @@ local L = DogTag_Unit.L
-- Pre 3.2.0 compatability support
local wow_320 = select(4, GetBuildInfo()) >= 30200
local wow_700 = select(4, GetBuildInfo()) >= 70000
local wow_800 = select(4, GetBuildInfo()) >= 80000
local GetQuestDifficultyColor
if not wow_320 then
GetQuestDifficultyColor = _G.GetDifficultyColor
@ -184,7 +185,12 @@ local function Class(unit)
if UnitIsPlayer(unit) then
return UnitClass(unit) or UNKNOWN
else
return UnitClassBase(unit) or UNKNOWN
if wow_800 then
local classbase, classindex = UnitClassBase(unit)
return classbase and GetClassInfo(classindex) or UNKNOWN
else
return UnitClassBase(unit) or UNKNOWN
end
end
end