Preserve class color table when applying blue shaman
This commit is contained in:
+32
-19
@@ -1,6 +1,5 @@
|
|||||||
local _G = ShaguTweaks.GetGlobalEnv()
|
local _G = ShaguTweaks.GetGlobalEnv()
|
||||||
local T = ShaguTweaks.T
|
local T = ShaguTweaks.T
|
||||||
local GetExpansion = ShaguTweaks.GetExpansion
|
|
||||||
|
|
||||||
local module = ShaguTweaks:register({
|
local module = ShaguTweaks:register({
|
||||||
title = T["Blue Shaman Class Colors"],
|
title = T["Blue Shaman Class Colors"],
|
||||||
@@ -10,6 +9,9 @@ local module = ShaguTweaks:register({
|
|||||||
enabled = true,
|
enabled = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local BLUE_SHAMAN = { r = 0.14, g = 0.35, b = 1.0, colorStr = "ff2459ff" }
|
||||||
|
local UNKNOWN_CLASS_COLOR = { r = 0.6, g = 0.6, b = 0.6, colorStr = "ff999999" }
|
||||||
|
|
||||||
local function ChatTweaksOwnsClassColors()
|
local function ChatTweaksOwnsClassColors()
|
||||||
local configured = ShaguTweaks_config and ShaguTweaks_config[T["Chat Tweaks"]]
|
local configured = ShaguTweaks_config and ShaguTweaks_config[T["Chat Tweaks"]]
|
||||||
if configured ~= nil then return configured == 1 end
|
if configured ~= nil then return configured == 1 end
|
||||||
@@ -21,25 +23,36 @@ local function ChatTweaksOwnsClassColors()
|
|||||||
end
|
end
|
||||||
|
|
||||||
module.enable = function(self)
|
module.enable = function(self)
|
||||||
-- The current enhanced Chat Tweaks module already carries this exact color
|
-- The current enhanced Chat Tweaks module already applies the same shaman
|
||||||
-- table. Avoid applying it twice while keeping Blue Shaman independent when
|
-- color. Avoid touching the global table twice while keeping this module
|
||||||
-- Chat Tweaks is disabled.
|
-- independent when Chat Tweaks is disabled.
|
||||||
if ChatTweaksOwnsClassColors() then return end
|
if ChatTweaksOwnsClassColors() then return end
|
||||||
|
|
||||||
-- update table to get unknown colors and blue shamans for vanilla
|
-- Keep Blizzard/Turtle's RAID_CLASS_COLORS table (and any references held by
|
||||||
RAID_CLASS_COLORS = {
|
-- other addons) intact. Only change the SHAMAN entry instead of replacing
|
||||||
["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43, colorStr = "ffc79c6e" },
|
-- the complete table just to alter one class color.
|
||||||
["MAGE"] = { r = 0.41, g = 0.8, b = 0.94, colorStr = "ff69ccf0" },
|
RAID_CLASS_COLORS = RAID_CLASS_COLORS or {}
|
||||||
["ROGUE"] = { r = 1, g = 0.96, b = 0.41, colorStr = "fffff569" },
|
local shaman = RAID_CLASS_COLORS["SHAMAN"]
|
||||||
["DRUID"] = { r = 1, g = 0.49, b = 0.04, colorStr = "ffff7d0a" },
|
if shaman then
|
||||||
["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45, colorStr = "ffabd473" },
|
shaman.r = BLUE_SHAMAN.r
|
||||||
["SHAMAN"] = { r = 0.14, g = 0.35, b = 1.0, colorStr = "ff2459ff" },
|
shaman.g = BLUE_SHAMAN.g
|
||||||
["PRIEST"] = { r = 1, g = 1, b = 1, colorStr = "ffffffff" },
|
shaman.b = BLUE_SHAMAN.b
|
||||||
["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79, colorStr = "ff9482c9" },
|
shaman.colorStr = BLUE_SHAMAN.colorStr
|
||||||
["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73, colorStr = "fff58cba" },
|
else
|
||||||
}
|
RAID_CLASS_COLORS["SHAMAN"] = {
|
||||||
|
r = BLUE_SHAMAN.r,
|
||||||
|
g = BLUE_SHAMAN.g,
|
||||||
|
b = BLUE_SHAMAN.b,
|
||||||
|
colorStr = BLUE_SHAMAN.colorStr,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
RAID_CLASS_COLORS = setmetatable(RAID_CLASS_COLORS, { __index = function(tab,key)
|
-- Preserve any metatable installed by Turtle or another addon. The original
|
||||||
return { r = 0.6, g = 0.6, b = 0.6, colorStr = "ff999999" }
|
-- module supplied a gray fallback for unknown class keys, so retain that
|
||||||
end})
|
-- behavior only when no owner already provides one.
|
||||||
|
if not getmetatable(RAID_CLASS_COLORS) then
|
||||||
|
setmetatable(RAID_CLASS_COLORS, { __index = function()
|
||||||
|
return UNKNOWN_CLASS_COLOR
|
||||||
|
end })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user