WeakAuras reads class colours inline at two call sites with the
whole-table-pick pattern — no per-key fallback:
WeakAuras/Types.lua:15
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[classFilename]
WeakAuras/AuraEnvironment.lua:108
local classData = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
local coloredName = ("|c%s%s|r"):format(classData.colorStr, name)
When !ClassColors is loaded it injects a vanilla-10-only
CUSTOM_CLASS_COLORS, so the 22 CoA tokens silently miss. Types.lua
returns the white fallback; AuraEnvironment.lua:109 *hard-crashes* on
classData.colorStr.
New file mirrors any RAID_CLASS_COLORS entry that CUSTOM_CLASS_COLORS
is missing, when !ClassColors is loaded. Idempotent — only fills nil
keys, so user customisations win. Loaded after Compatibility.lua and
ahead of every Types/AuraEnvironment call site. !ClassColors added to
OptionalDeps so it loads first when installed.
Same pattern as coa-omen, coa-kui-nameplates, and
coa-shadowedunitframes.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
-- CoAClassColors.lua
|
||||
--
|
||||
-- Forwards the live client's RAID_CLASS_COLORS palette into
|
||||
-- _G.CUSTOM_CLASS_COLORS so WeakAuras renders Conquest-of-Azeroth
|
||||
-- class names and 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, …).
|
||||
--
|
||||
-- WeakAuras reads the colour table inline at two call sites with the
|
||||
-- whole-table-pick pattern — no per-key fallback:
|
||||
--
|
||||
-- WeakAuras/Types.lua:15 (WA_GetClassColor)
|
||||
-- local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[classFilename]
|
||||
-- WeakAuras/AuraEnvironment.lua:108 (unit name colourisation)
|
||||
-- local classData = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
|
||||
-- local coloredName = ("|c%s%s|r"):format(classData.colorStr, name)
|
||||
--
|
||||
-- When !ClassColors is loaded it injects a separate
|
||||
-- _G.CUSTOM_CLASS_COLORS populated from its own (vanilla-10-only)
|
||||
-- defaults plus user overrides, so the 22 CoA tokens silently miss.
|
||||
-- Types.lua:15 then returns "ffffffff" (white instead of the class
|
||||
-- colour); AuraEnvironment.lua:109 *hard-crashes* on
|
||||
-- `classData.colorStr` when classData is nil.
|
||||
--
|
||||
-- Strategy
|
||||
-- --------
|
||||
-- If CUSTOM_CLASS_COLORS exists at file-load time (i.e. !ClassColors
|
||||
-- already loaded — WeakAuras.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
|
||||
+11
-2
@@ -1,7 +1,7 @@
|
||||
## Interface: 30300
|
||||
## Title: WeakAuras
|
||||
## Author: The WeakAuras Team
|
||||
## Version: 5.21.2
|
||||
## Version: 5.22.0
|
||||
## IconTexture: Interface\AddOns\WeakAuras\Media\Textures\icon.blp
|
||||
## X-Flavor: 3.3.5
|
||||
## Notes: A powerful, comprehensive utility for displaying graphics and information based on buffs, debuffs, and other triggers.
|
||||
@@ -20,10 +20,19 @@
|
||||
## DefaultState: Enabled
|
||||
## LoadOnDemand: 0
|
||||
## SavedVariables: WeakAurasSaved
|
||||
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibGetFrame-1.0, LibGroupTalents, !!AddonLocale, CustomNames, BigWigs, DBM-Core
|
||||
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibGetFrame-1.0, LibGroupTalents, !!AddonLocale, CustomNames, BigWigs, DBM-Core, !ClassColors
|
||||
|
||||
Compatibility.lua
|
||||
|
||||
## CoA patches ##
|
||||
# Mirror RAID_CLASS_COLORS into CUSTOM_CLASS_COLORS for the 22 CoA
|
||||
# class tokens before any WeakAuras file reads them. Loaded ahead of
|
||||
# Types.lua (WA_GetClassColor) and AuraEnvironment.lua (unit name
|
||||
# colourisation) — without this, AuraEnvironment.lua:109 hard-crashes
|
||||
# on classData.colorStr for any CoA-class unit when !ClassColors is
|
||||
# installed.
|
||||
CoAClassColors.lua
|
||||
|
||||
# External code + initialization
|
||||
embeds.xml
|
||||
Init.lua
|
||||
|
||||
Reference in New Issue
Block a user