-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShamanFix.lua
73 lines (60 loc) · 1.83 KB
/
ShamanFix.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local _G = getfenv(0) -- this should improve lookup speed
-- Fix shaman colors.
_G.RAID_CLASS_COLORS["SHAMAN"] = { r = 0, g = 0.44, b = 0.87}
-- Reapply the fix 1 sec after loading.
-- TODO make this less hacky.
local time = GetTime();
local f = CreateFrame("Frame", nil, UIParent);
-- Table of hexadecimal values of class colors.
local ClassColorsHex = {}
for k,v in _G.RAID_CLASS_COLORS do
ClassColorsHex[k] = string.format("%2x%2x%2x", v.r*255, v.g*255, v.b*255)
end
-- Just to be sure.
ClassColorsHex["SHAMAN"] = "0070de";
function ShamanFix_FixShamanColor()
_G.RAID_CLASS_COLORS["SHAMAN"] = { r = 0, g = 0.44, b = 0.87}
-- Hack for WIM.
if _G["WIM_ClassColors"] then
_G.WIM_ClassColors[WIM_LOCALIZED_SHAMAN] = "0070de";
end
-- Hack for TinyTip.
-- Tinytip doesn't expose its hex color table so instead we override its ColorPlayer function.
TinyTip_ColorPlayer = ShamanFix_ColorPlayer;
-- Hack for Grid
if _G["GridStatusName"] then
GridStatusName:Reset();
end
end
f:SetScript("OnUpdate", function()
if GetTime() - time > 1 then
f:SetScript("OnUpdate", nil);
ShamanFix_FixShamanColor();
print("Shamans fixed!");
end
end)
f:SetScript("OnLoad", function()
f:RegisterEvent("PLAYER_ENTERING_WORLD");
f:RegisterEvent("VARIABLES_LOADED");
f:RegisterEvent("PARTY_MEMBERS_CHANGED");
end)
f:SetScript("OnEvent", function()
if (event == "PLAYER_ENTERING_WORLD") then
ShamanFix_FixShamanColor();
end
if (event == "VARIABLES_LOADED") then
ShamanFix_FixShamanColor();
end
if (event == "PARTY_MEMBERS_CHANGED") then
ShamanFix_FixShamanColor();
end
end)
-- Tinytip replacement function.
function ShamanFix_ColorPlayer(unit)
_,tmp=_G.UnitClass(unit)
if tmp and ClassColorsHex[tmp] then
return ClassColorsHex[tmp]
else
return "FFFFFF"
end
end