forked from brittyazel/Neuron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNeuron-Startup.lua
275 lines (217 loc) · 6.64 KB
/
Neuron-Startup.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
--Neuron, a World of Warcraft® user interface addon.
--This file is part of Neuron.
--
--Neuron is free software: you can redistribute it and/or modify
--it under the terms of the GNU General Public License as published by
--the Free Software Foundation, either version 3 of the License, or
--(at your option) any later version.
--
--Neuron is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU General Public License for more details.
--
--You should have received a copy of the GNU General Public License
--along with Foobar. If not, see <https://www.gnu.org/licenses/>.
--
--Copyright for portions of Neuron are held by Connor Chenoweth,
--a.k.a Maul, 2014 as part of his original project, Ion. All other
--copyrights for Neuron are held by Britt Yazel, 2017-2018.
local DB
local L = LibStub("AceLocale-3.0"):GetLocale("Neuron")
function Neuron:Startup()
DB = Neuron.db.profile
Neuron:RegisterBars()
Neuron:RegisterGUI()
Neuron:CreateBarsAndButtons()
Neuron:Overrides()
end
function Neuron:RegisterBars()
--Neuron Action Bar
Neuron:RegisterBarClass("ActionBar", "ActionBar", L["Action Bar"], "Action Button", DB.ActionBar, Neuron.ACTIONBUTTON, 250)
--Neuron Zone Ability Bar
Neuron:RegisterBarClass("ZoneAbilityBar", "ZoneAbilityBar", L["Zone Action Bar"], "Zone Action Button", DB.ZoneAbilityBar, Neuron.ZONEABILITYBTN, 1)
--Neuron Extra Bar
Neuron:RegisterBarClass("ExtraBar", "ExtraBar", L["Extra Action Bar"], "Extra Action Button", DB.ExtraBar, Neuron.EXTRABTN,1)
--Neuron Bag Bar
Neuron:RegisterBarClass("BagBar", "BagBar", L["Bag Bar"], "Bag Button", DB.BagBar, Neuron.BAGBTN,5)
--Neuron Status Bar
Neuron:RegisterBarClass("StatusBar", "StatusBar", L["Status Bar"], "Status Bar", DB.StatusBar, Neuron.STATUSBTN, 20)
--Neuron Exit Bar
Neuron:RegisterBarClass("ExitBar", "ExitBar", L["Vehicle Exit Bar"], "Vehicle Exit Button", DB.ExitBar, Neuron.EXITBTN,1)
--Neuron Menu Bar
Neuron:RegisterBarClass("MenuBar", "MenuBar", L["Menu Bar"], "Menu Button", DB.MenuBar, Neuron.MENUBTN, 11)
--Neuron Pet Bar
Neuron:RegisterBarClass("PetBar", "PetBar", L["Pet Bar"], "Pet Button", DB.PetBar, Neuron.PETBTN, 10)
end
function Neuron:RegisterGUI()
--Neuron Action Bar
Neuron:RegisterGUIOptions("ActionBar", {
AUTOHIDE = true,
SHOWGRID = true,
SPELLGLOW = true,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
MULTISPEC = true,
HIDDEN = true,
LOCKBAR = true,
TOOLTIPS = true,
BINDTEXT = true,
MACROTEXT = true,
COUNTTEXT = true,
RANGEIND = true,
CDTEXT = true,
CDALPHA = true,
AURATEXT = true,
AURAIND = true },
true, 115)
--Neuron Zone Ability Bar
Neuron:RegisterGUIOptions("ZoneAbilityBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true,
BINDTEXT = true,
COUNTTEXT = true,},
false, 65)
--Neuron Extra Bar
Neuron:RegisterGUIOptions("ExtraBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true,
BINDTEXT = true,
COUNTTEXT = true,},
false, 65)
--Neuron Bag Bar
Neuron:RegisterGUIOptions("BagBar", {
AUTOHIDE = true,
SHOWGRID = false,
SPELLGLOW = false,
SNAPTO = true,
MULTISPEC = false,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true, },
false, false)
--Neuron Status Bar
Neuron:RegisterGUIOptions("StatusBar", {
AUTOHIDE = true,
SNAPTO = true,
HIDDEN = true,
TOOLTIPS = true },
false, false)
--Neuron Exit Bar
Neuron:RegisterGUIOptions("ExitBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false, },
false, 65)
--Neuron Menu Bar
Neuron:RegisterGUIOptions("MenuBar", {
AUTOHIDE = true,
SHOWGRID = false,
SPELLGLOW = false,
SNAPTO = true,
MULTISPEC = false,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true },
false, false)
--Neuron Pet Bar
Neuron:RegisterGUIOptions("PetBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = true,
TOOLTIPS = true,
BINDTEXT = true,
RANGEIND = true,
CDTEXT = true,
CDALPHA = true },
false, 65)
end
function Neuron:CreateBarsAndButtons()
if (DB.firstRun) then
for barClass, barDefaults in pairs(NeuronDefaultBarOptions) do
for i, defaults in ipairs(barDefaults) do
Neuron.BAR:CreateNewBar(barClass, i, defaults) --this calls the bar constructor
end
end
DB.firstRun = false
else
for barClass, barClassData in pairs (Neuron.registeredBarData) do
for id,data in pairs(barClassData.barDB) do
if (data ~= nil) then
Neuron.BAR:CreateNewBar(barClass, id)
end
end
end
end
end
function Neuron:Overrides()
--bag bar overrides
if DB.blizzbar == false then
---hide the weird color border around bag bars
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(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
--status bar overrides
local disableDefaultCast = false
local disableDefaultMirror = false
for _,v in ipairs(Neuron.BARIndex) do
if v.barType == "StatusBar" then
for _, button in ipairs(v.buttons) do
if button.config.sbType == "cast" then
disableDefaultCast = true
elseif button.config.sbType == "mirror" then
disableDefaultMirror = true
end
end
end
end
if disableDefaultCast then
CastingBarFrame:UnregisterAllEvents()
CastingBarFrame:SetParent(Neuron.hiddenFrame)
end
if disableDefaultMirror 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
end