-- CoAClassColors.lua -- -- Forwards the live client's RAID_CLASS_COLORS palette into -- _G.CUSTOM_CLASS_COLORS so Omen renders Conquest-of-Azeroth class -- bars correctly when the !ClassColors addon is loaded. -- -- Background -- ---------- -- The CoA Voljin client (and the Ascension classic+ client) ship -- Interface/SharedXML/SharedConstants.lua with all 32 class -- file_strings populated in _G.RAID_CLASS_COLORS — 10 vanilla + HERO + -- 21 CoA customs (BARBARIAN, WITCHDOCTOR, DEMONHUNTER, FLESHWARDEN, -- MONK = Templar, PROPHET = Venomancer, …). Omen.lua:1629 reads -- RAID_CLASS_COLORS directly, so the unmodified addon already paints -- CoA classes with the realm-canonical palette. -- -- The exception is the !ClassColors path. !ClassColors injects a -- separate _G.CUSTOM_CLASS_COLORS table, populated from its own -- (vanilla-10-only) defaults plus user overrides. Omen prefers -- CUSTOM_CLASS_COLORS over RAID_CLASS_COLORS when present (Omen.lua -- :914-917, options at :2828), so on a !ClassColors-equipped client -- the 22 CoA tokens silently fall through and bars revert to the -- generic dbBar.BarColor. -- -- Strategy -- -------- -- If CUSTOM_CLASS_COLORS exists at file-load time (i.e. !ClassColors -- already loaded — Omen.toc declares it as an OptionalDep, so it loads -- first when installed), copy any RAID_CLASS_COLORS entry that -- CUSTOM_CLASS_COLORS is missing. Never overwrite — !ClassColors user -- preferences and any other addon's earlier write win. -- -- We deliberately don't touch RAID_CLASS_COLORS itself: the client -- already populates it, and any value we'd choose here would be a -- guess relative to the realm-authoritative palette in -- SharedConstants.lua. -- -- Source of truth: _G.RAID_CLASS_COLORS at FrameXML load time -- (Voljin/PTR realm: patch-B.MPQ → SharedXML/SharedConstants.lua). local CCC = _G.CUSTOM_CLASS_COLORS if type(CCC) ~= "table" then return end local CC = _G.RAID_CLASS_COLORS if type(CC) ~= "table" then return end local function colorStr(r, g, b) return string.format("ff%02x%02x%02x", r * 255 + 0.5, g * 255 + 0.5, b * 255 + 0.5) 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, src in pairs(CC) do if CCC[token] == nil then local r, g, b = unpackColor(src) if r and g and b then CCC[token] = { r = r, g = g, b = b, colorStr = colorStr(r, g, b), } end end end