-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTotemPlates.lua
137 lines (126 loc) · 4.07 KB
/
TotemPlates.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
local AddOn = "TotemPlates"
local numChildren = -1
local Table = {
["Nameplates"] = {},
["Snakes"] = {
"Viper",
"Venomous Snake",
},
["Totems"] = {
["Mana Spring Totem VIII"] = true,
["Cleansing Totem"] = true,
["Magma Totem VII"] = false,
["Earth Elemental Totem"] = true,
["Earthbind Totem"] = true,
["Fire Resistance Totem VI"] = false,
["Flametongue Totem VIII"] = false,
["Frost Resistance Totem VI"] = false,
["Grounding Totem"] = true,
["Healing Stream Totem IX"] = false,
["Nature Resistance Totem VI"] = false,
["Searing Totem X"] = false,
["Sentry Totem"] = false,
["Stoneclaw Totem X"] = true,
["Stoneskin Totem X"] = false,
["Strength of Earth Totem VIII"] = false,
["Totem of Wrath IV"] = false,
["Tremor Totem"] = true,
["Windfury Totem"] = false,
["Wrath of Air Totem"] = false,
["Fire Elemental Totem"] = true,
["Mana Tide Totem"] = true,
-- autres spells
["Spirit Wolf"] = true,
["Treant"] = true,
},
xOfs = 0,
yOfs = 0,
Scale = 0.8,
}
local function UpdateObjects(hp)
frame = hp:GetParent()
local threat, hpborder, cbshield, cbborder, cbicon, overlay, oldname, level, bossicon, raidicon, elite = frame:GetRegions()
local name = oldname:GetText()
overlay:SetAlpha(1)
threat:Show()
hpborder:Show()
oldname:Show()
level:Show()
hp:SetAlpha(1)
if frame.totem then frame.totem:Hide() end
for _,snake in pairs(Table["Snakes"]) do
if ( name == snake ) then
overlay:SetAlpha(1)
threat:Hide()
hpborder:Hide()
oldname:Hide()
level:Hide()
hp:SetAlpha(1)
break
end
end
for totem in pairs(Table["Totems"]) do
if ( name == totem and Table["Totems"][totem] == true ) then
overlay:SetAlpha(0)
threat:Hide()
hpborder:Hide()
oldname:Hide()
level:Hide()
hp:SetAlpha(0)
if not frame.totem then
frame.totem = frame:CreateTexture(nil, "BACKGROUND")
frame.totem:ClearAllPoints()
frame.totem:SetPoint("CENTER",frame,"CENTER",Table.xOfs,Table.yOfs)
else
frame.totem:Show()
end
frame.totem:SetTexture("Interface\\AddOns\\" .. AddOn .. "\\Textures\\" .. totem)
frame.totem:SetWidth(64 *Table.Scale)
frame.totem:SetHeight(64 *Table.Scale)
break
elseif ( name == totem ) then
overlay:SetAlpha(0)
threat:Hide()
hpborder:Hide()
oldname:Hide()
level:Hide()
hp:SetAlpha(0)
break
end
end
end
local function SkinObjects(frame)
local HealthBar, CastBar = frame:GetChildren()
local threat, hpborder, cbshield, cbborder, cbicon, overlay, oldname, level, bossicon, raidicon, elite = frame:GetRegions()
HealthBar:HookScript("OnShow", UpdateObjects)
HealthBar:HookScript("OnSizeChanged", UpdateObjects)
UpdateObjects(HealthBar)
Table["Nameplates"][frame] = true
end
local select = select
local function HookFrames(...)
for index = 1, select('#', ...) do
local frame = select(index, ...)
local region = frame:GetRegions()
if ( not Table["Nameplates"][frame] and not frame:GetName() and region and region:GetObjectType() == "Texture" and region:GetTexture() == "Interface\\TargetingFrame\\UI-TargetingFrame-Flash" ) then
SkinObjects(frame)
frame.region = region
end
end
end
local Frame = CreateFrame("Frame")
Frame:RegisterEvent("PLAYER_ENTERING_WORLD")
Frame:SetScript("OnUpdate", function(self, elapsed)
if ( WorldFrame:GetNumChildren() ~= numChildren ) then
numChildren = WorldFrame:GetNumChildren()
HookFrames(WorldFrame:GetChildren())
end
end)
Frame:SetScript("OnEvent", function(self, event, name)
if ( event == "PLAYER_ENTERING_WORLD" ) then
if ( not _G[AddOn .. "_PlayerEnteredWorld"] ) then
ChatFrame1:AddMessage("|cff00ccff" .. AddOn .. "|cffffffff Loaded")
_G[AddOn .. "_PlayerEnteredWorld"] = true
end
end
end)