diff --git a/Util/Utils.lua b/Util/Utils.lua index e74588a..799ac26 100644 --- a/Util/Utils.lua +++ b/Util/Utils.lua @@ -667,6 +667,9 @@ function Util:GetUnitSubgroup(unit) end end +---@param unit UnitToken +---@param localized boolean +---@return string? classification function Util:GetUnitClassification(unit, localized) local classification = UnitClassification(unit) if localized then @@ -675,6 +678,15 @@ function Util:GetUnitClassification(unit, localized) return classification end +local gold, silver = "|A:nameplates-icon-elite-gold:16:16|a", "|A:nameplates-icon-elite-silver:16:16|a" +local typeIcon = { elite = gold, worldboss = gold, rareelite = silver, rare = silver } + +---@param unit UnitToken +---@return string? icon +function Util:GetUnitClassificationIcon(unit) + return typeIcon[UnitClassification(unit)] +end + ------------------------------------------------- -- MARK: Frames ------------------------------------------------- diff --git a/Widgets/Texts/CustomFormats.lua b/Widgets/Texts/CustomFormats.lua index 3cd340e..06f77ce 100644 --- a/Widgets/Texts/CustomFormats.lua +++ b/Widgets/Texts/CustomFormats.lua @@ -716,6 +716,10 @@ end, "Group", "1-8") W:AddTag("classification", "UNIT_CLASSIFICATION_CHANGED", function(unit) return Util:GetUnitClassification(unit, true) end, "Classification", (L.rare .. ", " .. L.rareelite .. ", " .. L.elite .. ", " .. L.worldboss)) +W:AddTag("classification:icon", "UNIT_CLASSIFICATION_CHANGED", function(unit) + if UnitIsPlayer(unit) then return end + return Util:GetUnitClassificationIcon(unit) +end, "Classification") -- MARK: Name for type, length in pairs(nameLengths) do