diff --git a/AddOns/!!!ClassicAPI/Util/ColorUtil.lua b/AddOns/!!!ClassicAPI/Util/ColorUtil.lua index 2059d3c1..0e916dc6 100644 --- a/AddOns/!!!ClassicAPI/Util/ColorUtil.lua +++ b/AddOns/!!!ClassicAPI/Util/ColorUtil.lua @@ -74,9 +74,9 @@ function GetClassColoredTextForUnit(unit, text) end function GetFactionColor(factionGroupTag) - -- PLAYER_FACTION_COLORS lives in our Constants.lua; PLAYER_FACTION_GROUP - -- is the FrameXML faction-tag -> index map. Guarded so a missing table - -- yields nil rather than erroring. + -- Both PLAYER_FACTION_GROUP (tag -> index) and PLAYER_FACTION_COLORS + -- (index -> color) live in our Constants.lua. Guarded defensively in + -- case a client variant leaves one unset. local group = PLAYER_FACTION_GROUP and PLAYER_FACTION_GROUP[factionGroupTag]; return PLAYER_FACTION_COLORS and PLAYER_FACTION_COLORS[group]; end diff --git a/AddOns/!!!ClassicAPI/Util/Constants.lua b/AddOns/!!!ClassicAPI/Util/Constants.lua index 1a2dc8d7..a344fb61 100644 --- a/AddOns/!!!ClassicAPI/Util/Constants.lua +++ b/AddOns/!!!ClassicAPI/Util/Constants.lua @@ -106,8 +106,16 @@ BAG_ITEM_QUALITY_COLORS = }; -- faction +PLAYER_FACTION_GROUP = PLAYER_FACTION_GROUP or +{ + [0] = "Horde", + [1] = "Alliance", + Horde = 0, + Alliance = 1, +}; + PLAYER_FACTION_COLORS = -{ +{ [0] = PLAYER_FACTION_COLOR_HORDE, [1] = PLAYER_FACTION_COLOR_ALLIANCE, };