Files
coa-omen/CoAClassColors.lua
T
florian.berthold b7445fc4c1 feat: CoA class colors for the 21 Ascension custom classes
Adds CoAClassColors.lua which merges 22 entries (HERO + 21 custom) into _G.RAID_CLASS_COLORS at file-load time, before Omen.lua takes its local snapshot. Vanilla 10 are left untouched. !ClassColors is also folded in if loaded.

Fixes: Omen bars rendering generic dbBar.BarColor for all CoA classes because Omen.lua:1629 looks up RAID_CLASS_COLORS[class] keyed on the file_string returned by UnitClass(), and PROPHET / MONK / FLESHWARDEN / etc. don't exist in stock Blizzard tables.
2026-05-08 03:52:23 +02:00

92 lines
4.5 KiB
Lua

-- CoAClassColors.lua
--
-- Augments _G.RAID_CLASS_COLORS with the 22 Conquest-of-Azeroth class
-- file-tokens (10 vanilla-style + 21 Ascension custom + HERO) that
-- stock Blizzard / Omen don't know about.
--
-- Why this fixes the threat-meter
-- -------------------------------
-- Omen's bar-color path (Omen.lua:1629) does:
-- dbBar.UseClassColors and (RAID_CLASS_COLORS[class] or ...)
-- where `class` is the second return of UnitClass(unit) — i.e.
-- ChrClasses.dbc `file_string`. For a Venomancer that is "PROPHET",
-- a Templar "MONK", a Knight of Xoroth "FLESHWARDEN", and so on; none
-- of those keys exist in stock RAID_CLASS_COLORS, so the lookup
-- returns nil, the whole and/or chain collapses, and the bar
-- silently falls back to the generic dbBar.BarColor.
--
-- We populate the table with sensible thematic defaults below. We
-- only set keys that are missing, so the vanilla 10 (WARRIOR …
-- DRUID + DEATHKNIGHT) keep their Blizzard / !ClassColors values.
--
-- The colours below are deliberate placeholders chosen to be
-- visually distinct on a dark threat bar. They can be retuned
-- in-game via !ClassColors (Bartender4-style) without re-patching.
local CC = _G.RAID_CLASS_COLORS
if type(CC) ~= "table" then
CC = {}
_G.RAID_CLASS_COLORS = CC
end
-- file_string -> {r, g, b} (0..1 floats)
-- Display name in comment is the in-game class name on Ascension CoA.
-- Source of truth: coa-db `class.file_string` (ChrClasses.dbc record id).
local COA_COLORS = {
HERO = { 1.000, 0.820, 0.000 }, -- #FFD100 CoA brand gold (Ascension all-class archetype)
BARBARIAN = { 0.757, 0.400, 0.420 }, -- #C1666B Barbarian, dusty crimson
WITCHDOCTOR = { 0.502, 0.780, 0.694 }, -- #80C7B1 Witch Doctor, voodoo teal
DEMONHUNTER = { 0.639, 0.188, 0.788 }, -- #A330C9 Felsworn, fel purple (same hex retail uses)
WITCHHUNTER = { 0.722, 0.690, 0.627 }, -- #B8B0A0 Witch Hunter, plate-bone
STORMBRINGER = { 0.306, 0.851, 1.000 }, -- #4ED9FF Stormbringer, lightning cyan
FLESHWARDEN = { 0.361, 0.180, 0.451 }, -- #5C2E73 Knight of Xoroth, necrotic purple
GUARDIAN = { 0.290, 0.616, 0.349 }, -- #4A9D59 Guardian, emerald
MONK = { 0.000, 1.000, 0.729 }, -- #00FFBA Templar, jade (matches retail Monk)
SONOFARUGAL = { 0.667, 0.122, 0.122 }, -- #AA1F1F Bloodmage, blood red
RANGER = { 0.369, 0.549, 0.227 }, -- #5E8C3A Ranger, forest green (kept distinct from Hunter)
CHRONOMANCER = { 0.839, 0.541, 0.227 }, -- #D68A3A Chronomancer, bronze
NECROMANCER = { 0.302, 0.478, 0.353 }, -- #4D7A5A Necromancer, grave green
PYROMANCER = { 1.000, 0.416, 0.000 }, -- #FF6A00 Pyromancer, fire orange
CULTIST = { 0.478, 0.251, 0.722 }, -- #7A40B8 Cultist, eldritch purple
STARCALLER = { 0.475, 0.784, 0.839 }, -- #79C8D6 Starcaller, astral cyan
SUNCLERIC = { 0.949, 0.757, 0.306 }, -- #F2C14E Sun Cleric, solar gold
TINKER = { 0.769, 0.486, 0.310 }, -- #C47C4F Tinker, copper
PROPHET = { 0.722, 0.824, 0.275 }, -- #B8D246 Venomancer, toxic chartreuse
REAPER = { 0.431, 0.227, 0.541 }, -- #6E3A8A Reaper, death violet
WILDWALKER = { 0.545, 0.435, 0.278 }, -- #8B6F47 Primalist, earth brown
SPIRITMAGE = { 0.435, 0.714, 0.878 }, -- #6FB6E0 Runemaster, rune frost
}
-- Build the colorStr lazily — Blizzard's |c%02x%02x%02x%02x escape format,
-- so frames that ask for it (chat link colouring, threat-warning prints,
-- etc.) get a string that matches the rgb.
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
for token, rgb in pairs(COA_COLORS) do
-- Only set if missing — !ClassColors and any user override wins.
if CC[token] == nil then
CC[token] = {
r = rgb[1], g = rgb[2], b = rgb[3],
colorStr = colorStr(rgb[1], rgb[2], rgb[3]),
}
end
end
-- Ascension exposes CUSTOM_CLASS_COLORS only when the !ClassColors addon
-- is loaded; if it is, fold our entries in there too so any addon that
-- prefers CUSTOM_CLASS_COLORS (Omen does, see Omen.lua:914) still
-- renders CoA classes correctly. Same nil-only policy.
if type(_G.CUSTOM_CLASS_COLORS) == "table" then
local CCC = _G.CUSTOM_CLASS_COLORS
for token, rgb in pairs(COA_COLORS) do
if CCC[token] == nil then
CCC[token] = {
r = rgb[1], g = rgb[2], b = rgb[3],
colorStr = colorStr(rgb[1], rgb[2], rgb[3]),
}
end
end
end