Files
coa-altoholic/Altoholic/CoAClassColors.lua
T
florian.berthold bbe2492a5b chore: flatten Altoholic-Addon/ wrapper + add standard .gitignore/.gitattributes
Each DataStore_* / Altoholic_* addon now lives at the repo root, matching
the Exiles fork-layout convention (one folder per addon, no wrapper dir).
2026-05-25 10:59:24 +02:00

48 lines
1.8 KiB
Lua

-- CoAClassColors.lua
--
-- Mirrors the live client's RAID_CLASS_COLORS palette into
-- Altoholic.ClassInfo so the guild/character/profession panes render
-- the 21 Conquest-of-Azeroth custom classes (plus HERO) instead of
-- defaulting to WHITE via the `or WHITE` fallback at
-- Altoholic.lua:581.
--
-- Background
-- ----------
-- Altoholic ships a hardcoded ChatColor table keyed by the 10 vanilla
-- englishClass tokens (Altoholic.lua:23-32). On the CoA Voljin/PTR
-- realm, UnitClass / GetGuildRosterInfo return tokens like BARBARIAN,
-- WITCHDOCTOR, CHRONOMANCER, … which fall through the table.
--
-- The realm-authoritative palette is shipped by the client itself in
-- _G.RAID_CLASS_COLORS (Interface/SharedXML/SharedConstants.lua inside
-- patch-B.MPQ — 10 vanilla + HERO + 21 CoA = 32 entries on Voljin).
-- Other Exiles addon ports follow the same mirror pattern
-- (coa-omen/CoAClassColors.lua → CUSTOM_CLASS_COLORS,
-- coa-shadowedunitframes/.../CoAClassColors.lua → SUF profile,
-- coa-kui-nameplates/.../CoAClassColors.lua → !ClassColors).
--
-- Source of truth: db.exil.es /coa/dev for the full palette;
-- _G.RAID_CLASS_COLORS at FrameXML load time for the running client.
local AC = _G.Altoholic and _G.Altoholic.ClassInfo
if type(AC) ~= "table" then return end
local source = _G.RAID_CLASS_COLORS
if type(source) ~= "table" then return end
local function unpackColor(c)
if type(c) ~= "table" then return end
if c.GetRGB then return c:GetRGB() end
return c.r, c.g, c.b
end
for token, color in pairs(source) do
if AC[token] == nil then
local r, g, b = unpackColor(color)
if r and g and b then
AC[token] = string.format("|cFF%02X%02X%02X",
r * 255 + 0.5, g * 255 + 0.5, b * 255 + 0.5)
end
end
end