mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Constants: define PLAYER_FACTION_GROUP (tag -> index map)
GetFactionColor needs the FrameXML PLAYER_FACTION_GROUP global (faction
tag -> 0/1 index) to pair with our PLAYER_FACTION_COLORS, but we only
shipped the latter, so the lookup always returned nil. Add
PLAYER_FACTION_GROUP next to it, matching Blizzard SharedConstants
({[0]="Horde",[1]="Alliance",Horde=0,Alliance=1}); `or`-guarded so a
native definition wins if present.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user