This repository has been archived by the owner on Jan 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathNeuron-DisableBlizzardUI.lua
222 lines (195 loc) · 6.94 KB
/
Neuron-DisableBlizzardUI.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
-- Neuron is a World of Warcraft® user interface addon.
-- Copyright (c) 2017-2023 Britt W. Yazel
-- Copyright (c) 2006-2014 Connor H. Chenoweth
-- This code is licensed under the MIT license (see LICENSE for details)
local _, addonTable = ...
local Neuron = addonTable.Neuron
-- Hidden parent frame
local UIHider = CreateFrame("Frame")
UIHider:Hide()
local function disableBarFrame(frame)
if frame then
frame:UnregisterAllEvents()
frame:SetParent(UIHider)
frame:Hide()
end
end
local function disableButtonFrame(frame)
if frame then
frame:UnregisterAllEvents()
frame:SetAttribute("statehidden", true)
frame:Hide()
end
end
local function disableFrameSlidingAnimation(frame)
if frame and frame.slideOut then
local animation = {frame.slideOut:GetAnimations()}
animation[1]:SetOffset(0,0)
end
end
function Neuron:HideBlizzardUI(profileDatabase)
local blizzBars = profileDatabase.blizzBars
----------------------------
----- Disable Buttons ------
----------------------------
--Hide and disable the individual buttons on most of our bars
if not blizzBars.ActionBar then
for i=1,12 do
disableButtonFrame(_G["ActionButton"..i])
disableButtonFrame(_G["MultiBarBottomLeftButton"..i])
disableButtonFrame(_G["MultiBarBottomRightButton"..i])
disableButtonFrame(_G["MultiBarRightButton"..i])
disableButtonFrame(_G["MultiBarLeftButton"..i])
end
for i=1,6 do
disableButtonFrame(_G["OverrideActionBarButton"..i])
end
--disable main blizzard bar and graphics
disableBarFrame(MainMenuBar)
disableBarFrame(MainMenuBarArtFrame)
disableBarFrame(MainMenuBarArtFrameBackground)
disableFrameSlidingAnimation(MainMenuBar)
--disable bottom bonus bars
disableBarFrame(MultiBarBottomLeft)
disableBarFrame(MultiBarBottomRight)
--disable side bonus bars
disableBarFrame(MultiBarLeft)
disableBarFrame(MultiBarRight)
disableBarFrame(MultiBar5)
disableBarFrame(MultiBar6)
disableBarFrame(MultiBar7)
disableBarFrame(StanceBar)
disableBarFrame(StanceBarFrame)
disableBarFrame(PossessBar)
disableBarFrame(PossessBarFrame)
disableBarFrame(OverrideActionBar)
disableFrameSlidingAnimation(OverrideActionBar)
-- i think this is the shaman bar, it seems like it was deprecated in cata
-- just leave it on always https://github.com/brittyazel/Neuron/issues/444
-- disableBarFrame(MultiCastActionBarFrame)
--disable the ActionBarController to avoid potential for taint
ActionBarController:UnregisterAllEvents()
--these two get called when opening the spellbook so it's best to just silence them ahead of time
if not Neuron:IsHooked("MultiActionBar_ShowAllGrids") then
Neuron:RawHook("MultiActionBar_ShowAllGrids", function() end, true)
end
if not Neuron:IsHooked("MultiActionBar_HideAllGrids") then
Neuron:RawHook("MultiActionBar_HideAllGrids", function() end, true)
end
end
-- we can't hide the microbutton/bag bar without also hiding the
-- group finder eye :-/ also it hides the big bag icon
if not blizzBars.BagBar and not blizzBars.MenuBar then
-- disableBarFrame(MicroButtonAndBagsBar)
end
if not blizzBars.BagBar then
--hide the weird color border around bag bars
--[[
CharacterReagentBag0Slot.IconBorder:Hide()
CharacterBag0Slot.IconBorder:Hide()
CharacterBag1Slot.IconBorder:Hide()
CharacterBag2Slot.IconBorder:Hide()
CharacterBag3Slot.IconBorder:Hide()
--overwrite the Show function with a null function because it keeps coming back and won't stay hidden
if not Neuron:IsHooked(CharacterReagentBag0Slot.IconBorder, "Show") then
Neuron:RawHook(CharacterBag0Slot.IconBorder, "Show", function() end, true)
end
if not Neuron:IsHooked(CharacterBag0Slot.IconBorder, "Show") then
Neuron:RawHook(CharacterBag0Slot.IconBorder, "Show", function() end, true)
end
if not Neuron:IsHooked(CharacterBag1Slot.IconBorder, "Show") then
Neuron:RawHook(CharacterBag1Slot.IconBorder, "Show", function() end, true)
end
if not Neuron:IsHooked(CharacterBag2Slot.IconBorder, "Show") then
Neuron:RawHook(CharacterBag2Slot.IconBorder, "Show", function() end, true)
end
if not Neuron:IsHooked(CharacterBag3Slot.IconBorder, "Show") then
Neuron:RawHook(CharacterBag3Slot.IconBorder, "Show", function() end, true)
end
]]
end
if not blizzBars.CastBar then
if Neuron.isWoWRetail then
PlayerCastingBarFrame:UnregisterAllEvents()
PlayerCastingBarFrame:SetParent(Neuron.hiddenFrame)
else
CastingBarFrame:UnregisterAllEvents()
CastingBarFrame:SetParent(Neuron.hiddenFrame)
end
end
if not blizzBars.ExitBar then
disableBarFrame(MainMenuBarVehicleLeaveButton)
end
if not blizzBars.ExtraBar then
disableButtonFrame(_G["ExtraActionButton1"])
disableBarFrame(ExtraAbilityContainer)
disableBarFrame(ExtraActionBarFrame)
end
if not blizzBars.MenuBar then
-- we don't actually want to disable these, we will just reparent them
--[[
disableButtonFrame(CharacterMicroButton)
disableButtonFrame(SpellbookMicroButton)
disableButtonFrame(TalentMicroButton)
disableButtonFrame(AchievementMicroButton)
disableButtonFrame(QuestLogMicroButton)
disableButtonFrame(GuildMicroButton)
disableButtonFrame(GroupFinderMicroButton)
disableButtonFrame(CollectionsMicroButton)
disableButtonFrame(EJMicroButton)
disableButtonFrame(StoreMicroButton)
disableButtonFrame(MainMenuMicroButton)
]]
end
if not blizzBars.MirrorBar then
UIParent:UnregisterEvent("MIRROR_TIMER_START")
MirrorTimer1:UnregisterAllEvents()
MirrorTimer1:SetParent(Neuron.hiddenFrame)
MirrorTimer2:UnregisterAllEvents()
MirrorTimer2:SetParent(Neuron.hiddenFrame)
MirrorTimer3:UnregisterAllEvents()
MirrorTimer3:SetParent(Neuron.hiddenFrame)
end
if not blizzBars.PetBar then
disableBarFrame(PetActionBar)
disableBarFrame(PetActionBarFrame)
end
if not blizzBars.RepBar then
disableBarFrame(ReputationWatchBar)
--disable the controller for status bars as we're going to handle this ourselves
if StatusTrackingBarManager then
StatusTrackingBarManager:Hide()
StatusTrackingBarManager:UnregisterAllEvents()
end
end
if not blizzBars.XPBar then
disableBarFrame(MainMenuExpBar)
disableBarFrame(MainMenuBarMaxLevelBar)
--disable the controller for status bars as we're going to handle this ourselves
if StatusTrackingBarManager then
StatusTrackingBarManager:Hide()
StatusTrackingBarManager:UnregisterAllEvents()
end
end
if not blizzBars.ZoneAbilityBar then
disableBarFrame(ZoneAbilityFrame)
end
----------------------------
----- Disable Tutorial -----
----------------------------
--it's important we shut down the tutorial or we will get a ton of errors
--this cleanly shuts down the tutorial and returns visibility to all UI elements hidden
if Tutorials then --the Tutorials table is only available during the tutorial scenario, ignore if otherwise
Tutorials:Shutdown()
end
end
function Neuron:ToggleBlizzUI(blizzBars)
if InCombatLockdown() then
return
end
if blizzBars then
local DB = Neuron.db.profile
DB.blizzBars = CopyTable(DB.blizzBars)
MergeTable(DB.blizzBars, blizzBars)
end
end