From 16904ba2c8353dfcbedcaddb60120765fd7e0bed Mon Sep 17 00:00:00 2001 From: mBlinkii Date: Sun, 20 Nov 2022 16:20:56 +0100 Subject: [PATCH] new function custom class colors --- core/init.lua | 23 +++ core/mOptions.lua | 14 ++ core/mSettings.lua | 20 ++- misc/load_misc.xml | 1 + misc/mCustomClassColors.lua | 325 ++++++++++++++++++++++++++++++++++++ 5 files changed, 382 insertions(+), 1 deletion(-) create mode 100644 misc/mCustomClassColors.lua diff --git a/core/init.lua b/core/init.lua index 67422359..4a095458 100644 --- a/core/init.lua +++ b/core/init.lua @@ -33,6 +33,29 @@ end -- addon laden function mMT:Initialize() + if E.db[mPlugin].mCustomClassColors.enable then + mMT:SetCustomColors() + + function E:ClassColor(class, usePriestColor) + if not class then return end + + local color = (E.db[mPlugin].mCustomClassColors.colors and E.db[mPlugin].mCustomClassColors.colors[class]) or (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[class]) or _G.RAID_CLASS_COLORS[class] + if type(color) ~= 'table' then return end + + if not color.colorStr then + color.colorStr = E:RGBToHex(color.r, color.g, color.b, 'ff') + elseif strlen(color.colorStr) == 6 then + color.colorStr = 'ff'..color.colorStr + end + + if usePriestColor and class == 'PRIEST' and tonumber(color.colorStr, 16) > tonumber(E.PriestColors.colorStr, 16) then + return E.PriestColors + else + return color + end + end + end + mMT:mMisc() -- module laden if E.Retail then diff --git a/core/mOptions.lua b/core/mOptions.lua index 6ec59adf..1b0608b4 100644 --- a/core/mOptions.lua +++ b/core/mOptions.lua @@ -395,6 +395,13 @@ local function OptionsCore() childGroups = "tab", args = {}, }, + customclasscolors = { + order = 6, + type = "group", + name = L["Custom Class colors"], + childGroups = "tab", + args = {}, + }, }, }, about = { @@ -847,6 +854,13 @@ local function OptionsCoreClassic() childGroups = "tab", args = {}, }, + customclasscolors = { + order = 5, + type = "group", + name = L["Custom Class colors"], + childGroups = "tab", + args = {}, + }, }, }, about = { diff --git a/core/mSettings.lua b/core/mSettings.lua index 38b8d3e0..1bf88f1d 100644 --- a/core/mSettings.lua +++ b/core/mSettings.lua @@ -432,5 +432,23 @@ P[mPlugin] = { ["power"] = {["enable"] = false, ["texture"] = "mMediaTag M1"}, ["castbar"] = {["enable"] = false, ["texture"] = "mMediaTag P4"} }, - ["mCustomCombatIcons"] = 1 + ["mCustomCombatIcons"] = 1, + ["mCustomClassColors"] = { + ["enable"] = false, ["emediaenable"] = false, + ["colors"] = { + ["HUNTER"] = {["r"] = 0.67, ["g"] = 0.83, ["b"] = 0.45}, + ["WARLOCK"] = {["r"] = 0.53,["g"] = 0.53,["b"] = 0.93}, + ["PRIEST"] = {["r"] = 1.00,["g"] = 1.00,["b"] = 1.00}, + ["PALADIN"] = {["r"] = 0.96,["g"] = 0.55,["b"] = 0.73}, + ["MAGE"] = {["r"] = 0.20, ["g"] = 0.78, ["b"] = 0.92}, + ["ROGUE"] = {["r"] = 1.00,["g"] = 0.96,["b"] = 0.41}, + ["DRUID"] = {["r"] = 1.00, ["g"] = 0.49, ["b"] = 0.04}, + ["SHAMAN"] = {["r"] = 0.00,["g"] = 0.44,["b"] = 0.87}, + ["WARRIOR"] = {["r"] = 0.78,["g"] = 0.61,["b"] = 0.43}, + ["DEATHKNIGHT"] = {["r"] = 0.77, ["g"] = 0.12, ["b"] = 0.23}, + ["MONK"] = {["r"] = 0.00, ["g"] = 1.00, ["b"] = 0.60}, + ["DEMONHUNTER"] = {["r"] = 0.64, ["g"] = 0.19, ["b"] = 0.79}, + ["EVOKER"] = {["r"] = 0.20, ["g"] = 0.58, ["b"] = 0.50}, + } + }, } diff --git a/misc/load_misc.xml b/misc/load_misc.xml index d1e87293..fe2fd911 100644 --- a/misc/load_misc.xml +++ b/misc/load_misc.xml @@ -5,6 +5,7 @@