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.
This commit is contained in:
2026-05-07 13:41:35 +02:00
parent 7181066855
commit b7445fc4c1
3 changed files with 213 additions and 2 deletions
+91
View File
@@ -0,0 +1,91 @@
-- 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
+7 -2
View File
@@ -1,7 +1,7 @@
## Interface: 30300
## Version: 3.0.9
## Version: 3.0.9-coa1
## Title: Omen3
## Notes: A lightweight, flexible, multi-target threat meter.
## Notes: A lightweight, flexible, multi-target threat meter. (CoA fork: custom class colors)
## Notes-ruRU: Лёгкий, гибкий, измеритель угрозы.
## Notes-frFR: Un "threat meter" léger, flexible et multi-cibles.
## Notes-zhCN: 一个灵活的,多目标的,低资源占用的威胁值计量器。
@@ -49,4 +49,9 @@ Localization\zhTW.lua
Localization\zhCN.lua
Localization\ruRU.lua
## CoA patches ##
# Loaded before Omen.lua so RAID_CLASS_COLORS is populated when
# Omen.lua takes its local snapshot at the top of the file.
CoAClassColors.lua
Omen.lua
+115
View File
@@ -0,0 +1,115 @@
# coa-omen
CoA-patched fork of [Omen3](https://www.curseforge.com/wow/addons/omen-threat-meter)
3.0.9 (the version Ascension's Bronzebeard realm ships in
`Interface/AddOns/Omen/`). Adds class-color entries for the 21
Ascension custom classes plus the HERO archetype, so the threat-meter
bars render in a class-tinted color instead of falling back to the
generic neutral fill.
## What we changed
| File | Type | Why |
|-----------------------|--------|-----|
| `CoAClassColors.lua` | new | Merges 22 CoA `file_string` entries into `_G.RAID_CLASS_COLORS` (and `_G.CUSTOM_CLASS_COLORS` if `!ClassColors` is loaded). Vanilla 10 are left untouched. |
| `Omen.toc` | edit | Loads `CoAClassColors.lua` before `Omen.lua`. Version bumped to `3.0.9-coa1`. |
| `.gitattributes` | new | `* -text` — preserves upstream CRLF so future merges from Curse stay tidy. |
`Omen.lua` itself is unchanged. The bug we're fixing is in
`Omen.lua:1629`
```lua
(dbBar.UseClassColors and (RAID_CLASS_COLORS[class] or (class == "PET" and dbBar.PetBarColor))) or
```
— where `class` is the second return of `UnitClass(unit)`, i.e. the
ChrClasses.dbc `file_string`. For CoA classes that's `PROPHET` /
`MONK` / `FLESHWARDEN` / etc., none of which exist in stock
`RAID_CLASS_COLORS`, so the lookup is `nil`, the `and/or` chain
collapses, and every CoA-class bar gets `dbBar.BarColor` regardless
of `UseClassColors`. We just populate the table — no Omen logic
changes needed.
## Class color table
The 22 added file-strings are below. The CoA names on the right are
the in-game display names (slugs at `db.exil.es/class/<slug>`); the
file-strings on the left are what `UnitClass()` actually returns.
| file_string | CoA class | Hex |
|----------------|------------------|----------|
| HERO | (all-class) | #FFD100 |
| BARBARIAN | Barbarian | #C1666B |
| WITCHDOCTOR | Witch Doctor | #80C7B1 |
| DEMONHUNTER | Felsworn | #A330C9 |
| WITCHHUNTER | Witch Hunter | #B8B0A0 |
| STORMBRINGER | Stormbringer | #4ED9FF |
| FLESHWARDEN | Knight of Xoroth | #5C2E73 |
| GUARDIAN | Guardian | #4A9D59 |
| MONK | Templar | #00FFBA |
| SONOFARUGAL | Bloodmage | #AA1F1F |
| RANGER | Ranger | #5E8C3A |
| CHRONOMANCER | Chronomancer | #D68A3A |
| NECROMANCER | Necromancer | #4D7A5A |
| PYROMANCER | Pyromancer | #FF6A00 |
| CULTIST | Cultist | #7A40B8 |
| STARCALLER | Starcaller | #79C8D6 |
| SUNCLERIC | Sun Cleric | #F2C14E |
| TINKER | Tinker | #C47C4F |
| PROPHET | Venomancer | #B8D246 |
| REAPER | Reaper | #6E3A8A |
| WILDWALKER | Primalist | #8B6F47 |
| SPIRITMAGE | Runemaster | #6FB6E0 |
The colors are sensible thematic defaults, not extracted from the
client. To override them for one player, drop a `!ClassColors` config
in (the addon is already an OptionalDep of Omen). To override globally
in this fork, edit `CoAClassColors.lua`.
## Deploying
```bash
rsync -a --delete --exclude=.git --exclude='README*.md' \
/home/sub/repos/coa/coa-omen/ \
/srv/add01/wow-ascension/Interface/AddOns/Omen/
```
Then in-game: `/reload` (or full client restart). Confirm with the
Bartender4-style version check — open Omen options, the title bar
should read `Omen3 3.0.9-coa1`.
## Verifying in-game
`/run print(RAID_CLASS_COLORS["PROPHET"] and RAID_CLASS_COLORS["PROPHET"].colorStr or "missing")`
Should print `ff` followed by the hex of `#B8D246` (i.e.
`ffb8d246`). Repeat for any custom class. If a key prints `missing`,
either `CoAClassColors.lua` didn't load (check the addon list) or
the file-string was different from what's in the table.
To dump every class color the client knows about:
```
/run for k,v in pairs(RAID_CLASS_COLORS) do print(k, v.colorStr) end
```
## Merging upstream
Stock upstream Omen has a `* text=auto` `.gitattributes` that
normalises CRLF; we override with `* -text` so future merges don't
produce noise diffs.
```bash
git remote add upstream https://github.com/Nevcairiel/Omen.git
git fetch upstream
git merge --no-ff upstream/master
```
…then resolve `Omen.toc` (preserve our `## CoA patches ##` block at
the bottom) and commit.
## Repo
- Gitea: <https://git.sub-net.at/coa/coa-omen>
- Default branch: `master` (Sub-Net Gitea pre-receive hook rejects
`main`).