-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActionBars.lua
391 lines (321 loc) · 11.2 KB
/
ActionBars.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
local AddOn = CreateFrame("Frame")
local OnEvent = function(self, event, ...) self[event](self, event, ...) end
AddOn:SetScript("OnEvent", OnEvent)
local SantaUIDB_local
local events = {}
function events:ADDON_LOADED(...)
if select(1, ...) == "SantaUI" then
SantaUIDB_local = SantaUIDB
if not SantaUIDB_local then -- addon loaded for first time
SantaUIDB_local = {}
print("SantaUI load default")
SantaUIDB_local["point"] = "CENTER"
SantaUIDB_local["relativePoint"] = "CENTER"
SantaUIDB_local["xOffset"] = 0
SantaUIDB_local["yOffset"] = 0
end
-- safe check all saved variables are there (in case older version was loaded)
if not SantaUIDB_local["point"] then SantaUIDB_local["point"] = "CENTER" end
if not SantaUIDB_local["relativePoint"] then SantaUIDB_local["relativePoint"] = "CENTER" end
if not SantaUIDB_local["xOffset"] then SantaUIDB_local["xOffset"] = 0 end
if not SantaUIDB_local["yOffset"] then SantaUIDB_local["yOffset"] = 0 end
addon:UnregisterEvent("ADDON_LOADED")
print("SantaUI Loaded")
end
end
--- gets executed once all ui information is available (like honor etc)
function events:PLAYER_ENTERING_WORLD()
addon:UnregisterEvent("PLAYER_ENTERING_WORLD")
end
function events:PLAYER_REGEN_ENABLED()
addon:UnregisterEvent("PLAYER_REGEN_ENABLED")
end
--- save variables to SavedVariables
function events:PLAYER_LOGOUT()
SantaUIDB = SantaUIDB_local
end
-- Hide graphics
for _, frame in ipairs({
MainMenuBarLeftEndCap,
MainMenuBarRightEndCap,
-- MainMenuBarPageNumber,
MainMenuXPBarTexture2,
MainMenuXPBarTexture3,
MainMenuBarTexture2,
MainMenuBarTexture3,
MainMenuMaxLevelBar0,
MainMenuMaxLevelBar1,
MainMenuMaxLevelBar2,
MainMenuMaxLevelBar3,
MainMenuBarPerformanceBarFrame,
ActionBarUpButton,
ActionBarDownButton,
BonusActionBarFrame,
GameTimeFrame
}) do
frame:Hide()
end
for _, texture in ipairs({
ReputationWatchBarTexture2,
ReputationWatchBarTexture3,
ReputationXPBarTexture2,
ReputationXPBarTexture3,
MainMenuBarTexture0,
MainMenuBarTexture1,
ReputationWatchBarTexture0,
ReputationWatchBarTexture1,
ReputationXPBarTexture0,
ReputationXPBarTexture1,
MainMenuBarLeftEndCap,
MainMenuBarRightEndCap,
MainMenuXPBarTexture0,
MainMenuXPBarTexture1,
MainMenuMaxLevelBar0,
MainMenuMaxLevelBar1,
PossessBackground1,
PossessBackground2
}) do
texture:SetTexture(nil)
end
-- BonusActionBarTexture0, BonusActionBarTexture1
local function OnDragStart(self)
if( IsAltKeyDown() ) then
self.isMoving = true
self:StartMoving()
end
end
local function OnDragStop(self)
if( self.isMoving ) then
self.isMoving = nil
self:StopMovingOrSizing()
end
end
-- Stance / Shapeshiftbar move
ShapeshiftBarFrame:ClearAllPoints()
ShapeshiftBarFrame:SetPoint("BOTTOMLEFT", 10, 102)
ShapeshiftBarFrame:SetScale(1)
ShapeshiftBarFrame.SetPoint = function() end
-- Pet/Posses Action Bar move / move with alt on PetActionButton1
local frame = CreateFrame("Frame", "DragFrame2", UIParent)
PetActionButton1:ClearAllPoints()
PetActionButton1:SetMovable(true)
PetActionButton1:EnableMouse(true)
PetActionButton1:SetClampedToScreen(true)
PetActionButton1:RegisterForDrag("LeftButton")
PetActionButton1:SetScript("OnDragStart", OnDragStart)
PetActionButton1:SetScript("OnDragStop", OnDragStop)
PetActionButton1:SetPoint("BOTTOMLEFT", 10, 152)
PetActionButton1:SetScale(1)
PetActionButton1.SetPoint = function() end
PossessBarFrame:ClearAllPoints()
PossessBarFrame:SetPoint("BOTTOMLEFT", 250, 132)
PossessBarFrame:SetScale(1)
-- PossessBarFrame.SetPoint = function() end
PossessButton1:ClearAllPoints()
PossessButton1:SetPoint("BOTTOMLEFT", 0, 60)
PossessButton1:SetScale(1)
-- Scaling
MainMenuBar:SetScale(1)
MainMenuBar:SetWidth(510)
MainMenuBarPageNumber:SetPoint("LEFT", MainMenuBar, -10, -5)
MultiBarBottomLeft:SetScale(1); MultiBarBottomRight:SetScale(1)
MultiBarRight:SetScale(1); MultiBarLeft:SetScale(1)
-- Bottom right actionbar
MainMenuBar:ClearAllPoints()
MAX_PLAYER_LEVEL = 70
if UnitLevel("player") < MAX_PLAYER_LEVEL then
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("BOTTOM", UIParent, -110, 11)
else
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("BOTTOM", UIParent, -110, 0)
end
-- MainMenuBar:ClearAllPoints()
-- MainMenuBar:SetPoint("BOTTOM", UIParent, -110, 11)
--reposition bottom right actionbar
MultiBarBottomRight:SetPoint("LEFT", MultiBarBottomLeft, "RIGHT", 5, 0)
--reposition second half of top right bar, underneath
MultiBarBottomRightButton7:SetPoint("LEFT", MainMenuBar, 513, -5)
if event == "PLAYER_ENTERING_WORLD" then
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("BOTTOM", UIParent, -110, 0)
end
-- Experience bar
MainMenuExpBar:SetScale(0.735)
ExhaustionTick:SetScale(0.735)
MainMenuExpBar:ClearAllPoints()
MainMenuExpBar:SetPoint("CENTER", ReputationWatchBar, 175, -80)
MainMenuBarExpText:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE");
MainMenuBarExpText:SetPoint("TOP", MainMenuExpBar, 0, 0)
ReputationWatchBar:SetScale(0.9)
ReputationWatchBar:SetWidth(500)
ReputationWatchStatusBar:SetScale(0.82)
ReputationWatchStatusBar:SetPoint("LEFT", ReputationWatchBar, -35, -54)
ReputationWatchStatusBarText:SetPoint("TOP", ReputationWatchBar, 160, 3)
-- ReputationWatchStatusBar:SetPoint("BOTTOMLEFT", -290, -2, -290, -2)
-- Paging
-- ActionBarUpButton:SetPoint("RIGHT", -22, 5)
-- ActionBarUpButton:SetAlpha(0.5)
-- ActionBarDownButton:SetPoint("RIGHT", -22, -16)
-- ActionBarDownButton:SetAlpha(0.5)
-- fix for bar overlap for warrior but remove bars stance
-- if select(2, UnitClass("player")) == "WARRIOR" then
-- local frame = CreateFrame("frame");
-- frame:RegisterEvent("PLAYER_ENTERING_WORLD");
-- local HIDE_BONUS_BARS = function()
-- BonusActionBarFrame:UnregisterAllEvents();
-- BonusActionBarFrame.Show = function() end
-- BonusActionBarFrame:Hide();
-- end
-- frame:SetScript("OnEvent", HIDE_BONUS_BARS);
-- end
-- Bags
local function OnDragStart(self)
if( IsAltKeyDown() ) then
self.isMoving = true
self:StartMoving()
end
end
local function OnDragStop(self)
if( self.isMoving ) then
self.isMoving = nil
self:StopMovingOrSizing()
end
local point, _, relativePoint, xOfs, yOfs = self:GetPoint()
end
MainMenuBarBackpackButton:ClearAllPoints()
MainMenuBarBackpackButton:SetMovable(true)
MainMenuBarBackpackButton:EnableMouse(true)
MainMenuBarBackpackButton:SetClampedToScreen(true)
MainMenuBarBackpackButton:RegisterForDrag("LeftButton")
MainMenuBarBackpackButton:SetScript("OnDragStart", OnDragStart)
MainMenuBarBackpackButton:SetScript("OnDragStop", OnDragStop)
MainMenuBarBackpackButton:SetPoint("BOTTOMRIGHT", "Minimap", "BOTTOMRIGHT", 10, -1030)
MainMenuBarBackpackButton:SetScale(1)
-- MainMenuBarBackpackButton:SetAlpha(0)
CharacterBag0Slot:SetScale(1)
CharacterBag1Slot:SetScale(1)
CharacterBag2Slot:SetScale(1)
CharacterBag3Slot:SetScale(1)
KeyRingButton:SetScale(1)
-- Micro menu
-- Configuration to set the position of CharacterMicroButton
local isAboveBags = true -- Default to "above bags". Change to `false` for "below bags".
-- Function to set the position of the CharacterMicroButton
local function SetCharacterMicroButtonPosition()
if InCombatLockdown() then
-- Retry after leaving combat
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:SetScript("OnEvent", function()
SetCharacterMicroButtonPosition()
f:UnregisterEvent("PLAYER_REGEN_ENABLED")
end)
return
end
CharacterMicroButton:ClearAllPoints()
if isAboveBags then
-- Position above the bags
CharacterMicroButton:SetPoint("BOTTOMRIGHT", "MainMenuBarBackpackButton", "BOTTOMRIGHT", -183, 43)
else
-- Position below the bags
CharacterMicroButton:SetPoint("BOTTOMRIGHT", "MainMenuBarBackpackButton", "BOTTOMRIGHT", -183, -40)
end
end
-- Event handlers
local function PLAYER_ENTERING_WORLD()
SetCharacterMicroButtonPosition()
end
local function PLAYER_REGEN_ENABLED()
SetCharacterMicroButtonPosition()
end
-- Add a slash command to toggle the position dynamically
SLASH_TOGGLEMICROBUTTON1 = "/movemicrobutton"
SlashCmdList["TOGGLEMICROBUTTON"] = function()
isAboveBags = not isAboveBags
SetCharacterMicroButtonPosition()
print("Character Micro Button is now " .. (isAboveBags and "above" or "below") .. " the bags.")
end
-- Register the event handlers
local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
frame:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" then
PLAYER_ENTERING_WORLD()
elseif event == "PLAYER_REGEN_ENABLED" then
PLAYER_REGEN_ENABLED()
end
end)
do
local b = {
"CharacterMicroButton",
"SpellbookMicroButton",
"TalentMicroButton",
"QuestLogMicroButton",
"SocialsMicroButton",
"LFGMicroButton",
"MainMenuMicroButton",
"HelpMicroButton"
}
for k, v in pairs(b) do
_G[v]:SetScale(0.9)
_G[v]:SetAlpha(1)
end
end
-- Ghetto fix for the micro menu resetting it's postition sometimes
local f = CreateFrame("Frame", UIParent)
f:SetHeight(20)
f:SetWidth(140)
f:SetPoint("BOTTOMLEFT", "Minimap", "BOTTOMLEFT", -40, -1100)
if isAboveBags then
-- Position above the bags
f:SetPoint("BOTTOMRIGHT", "MainMenuBarBackpackButton", "BOTTOMRIGHT", -183, 43)
else
-- Position below the bags
f:SetPoint("BOTTOMRIGHT", "MainMenuBarBackpackButton", "BOTTOMRIGHT", -183, -40)
end
local fixMicroMenu = function(frame)
local resetPos = function()
CharacterMicroButton:ClearAllPoints()
if isAboveBags then
-- Position above the bags
CharacterMicroButton:SetPoint("BOTTOMRIGHT", "MainMenuBarBackpackButton", "BOTTOMRIGHT", -183, 43)
else
-- Position below the bags
CharacterMicroButton:SetPoint("BOTTOMRIGHT", "MainMenuBarBackpackButton", "BOTTOMRIGHT", -183, -40)
end
end
frame:EnableMouse(true)
frame:HookScript("OnEnter", resetPos)
end
fixMicroMenu(f)
-- Show/hide frame on mouseover
local enableMouseOver = function(frame, includeChildren)
local show = function()
frame:SetAlpha(1)
end
local hide = function()
frame:SetAlpha(0)
end
if includeChildren then
for _, child in ipairs({frame:GetChildren()}) do
child:HookScript("OnEnter", show)
child:HookScript("OnLeave", hide)
end
end
frame:EnableMouse(true)
frame:HookScript("OnEnter", show)
frame:HookScript("OnLeave", hide)
hide()
end
BonusActionBarTexture0:Hide()
BonusActionBarTexture1:Hide()
-- enableMouseOver(ActionBarUpButton, true)
-- enableMouseOver(ActionBarDownButton, true)
-- enableMouseOver(PetActionBarFrame, true)
enableMouseOver(ShapeshiftBarFrame, true)
AddOn:RegisterEvent("PLAYER_ENTERING_WORLD")
AddOn:RegisterEvent("PLAYER_REGEN_ENABLED")
AddOn["PLAYER_REGEN_ENABLED"] = PLAYER_REGEN_ENABLED
AddOn["PLAYER_ENTERING_WORLD"] = PLAYER_ENTERING_WORLD