-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAvocadoUI.lua
329 lines (276 loc) · 10.4 KB
/
AvocadoUI.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
SLASH_RELOADUI1 = "/rl"
SlashCmdList.RELOADUI = ReloadUI
function SetFramePosition()
local FrameScale = 1
local PlayerFrameCoords = { x = -300, y = 108 }
local PetFrameCoords = { x = -24, y = 64 }
local TargetFrameCoords = { x = PlayerFrameCoords.x + 92, y = PlayerFrameCoords.y - 42 }
local FocusFrameCoords = { x = -TargetFrameCoords.x + 32, y = TargetFrameCoords.y }
local TrinketCoords = { x = 86, y = 25 }
local PlayerUnitFrame = CreateFrame('Frame')
PlayerUnitFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
PlayerUnitFrame:SetScript("OnEvent", function(self, event, ...)
PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint("CENTER", UIParent, "CENTER", PlayerFrameCoords.x, PlayerFrameCoords.y)
PlayerFrame:SetScale(FrameScale)
PlayerName:SetFont(PlayerName:GetFont(), 14, 'OUTLINE')
TargetFrame:ClearAllPoints()
TargetFrame:SetPoint("CENTER", UIParent, "CENTER", TargetFrameCoords.x, TargetFrameCoords.y)
TargetFrame:SetScale(FrameScale)
FocusFrame:ClearAllPoints()
FocusFrame:SetPoint("CENTER", UIParent, "CENTER", FocusFrameCoords.x, FocusFrameCoords.y)
FocusFrame:SetScale(FrameScale)
TrinketMenu_MainFrame:ClearAllPoints()
TrinketMenu_MainFrame:SetPoint("TOPLEFT", PlayerFrame, "TOPLEFT", TrinketCoords.x, TrinketCoords.y)
TrinketMenu_MainFrame:SetScale(FrameScale)
PetFrame:ClearAllPoints()
PetFrame:SetPoint("TOPLEFT", PlayerFrame, "TOPLEFT", PetFrameCoords.x, PetFrameCoords.y)
PetFrame:SetScale(FrameScale)
end)
end
-- Hide texture and MicroButton
function HideTextureAndMicroButton()
-- Texture
MainMenuMaxLevelBar0:Hide()
MainMenuMaxLevelBar1:Hide()
MainMenuMaxLevelBar2:Hide()
MainMenuMaxLevelBar3:Hide()
MainMenuBarTexture0:Hide()
MainMenuBarTexture1:Hide()
MainMenuBarTexture2:Hide()
MainMenuBarTexture3:Hide()
MainMenuBarLeftEndCap:Hide()
MainMenuBarRightEndCap:Hide()
-- MicroButton
ActionBarUpButton:Hide()
ActionBarDownButton:Hide()
MainMenuBarPageNumber:Hide()
CharacterMicroButton:Hide()
AchievementMicroButton:Hide()
SpellbookMicroButton:Hide()
TalentMicroButton:Hide()
TalentMicroButton:HookScript("OnShow",function(self) self:Hide() end)
QuestLogMicroButton:Hide()
SocialsMicroButton:Hide()
PVPMicroButton:Hide()
LFGMicroButton:Hide()
LFGMicroButton:HookScript("OnShow",function(self) self:Hide() end)
MainMenuMicroButton:Hide()
HelpMicroButton:Hide()
MainMenuBarPerformanceBarFrame:Hide()
KeyRingButton:Hide()
KeyRingButton:HookScript("OnShow",function(self) self:Hide() end)
MainMenuBarBackpackButton:Hide()
CharacterBag0Slot:Hide()
CharacterBag1Slot:Hide()
CharacterBag2Slot:Hide()
CharacterBag3Slot:Hide()
end
function SetFont()
for i = 1, NUM_CHAT_WINDOWS do
local chat = _G['ChatFrame'..i]
local font, size = chat:GetFont()
chat:SetFont(font, size, "THINOUTLINE")
end
end
function SetActionBar()
MainMenuExpBar:ClearAllPoints()
MainMenuExpBar:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, 0)
ReputationWatchBar.StatusBar:ClearAllPoints()
ReputationWatchBar.StatusBar:SetPoint("CENTER", MainMenuExpBar, "CENTER", 0, 0)
ReputationWatchBar.OverlayFrame.Text:Hide()
-- MainBar Pos
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("BOTTOM", UIParent, "BOTTOM", -272, -100)
ActionButton1:ClearAllPoints()
ActionButton1:SetPoint("BOTTOMLEFT", MainMenuBar, "TOP", 24, 80)
-- BottomLeftBar Pos
MultiBarBottomLeftButton1:ClearAllPoints()
MultiBarBottomLeftButton1:SetPoint("BOTTOM", ActionButton1, "TOP", 0, 12)
-- BottomRightBar Pos
MultiBarBottomRightButton1:ClearAllPoints()
MultiBarBottomRightButton1:SetPoint("BOTTOM", MultiBarBottomLeftButton1, "TOP", 0, 12)
StanceButton1:ClearAllPoints()
StanceButton1:SetPoint("BOTTOMLEFT", MultiBarBottomLeftButton1, "TOPLEFT", 0, 10)
PetActionButton1:ClearAllPoints()
PetActionButton1:SetPoint("BOTTOMRIGHT", MultiBarBottomLeftButton1, "TOPRIGHT", 120, 10)
end
-- Arena Nameplate Number
function SetArenaNameplateNumber()
local U = UnitIsUnit
hooksecurefunc("CompactUnitFrame_UpdateName", function(F)
if IsActiveBattlefieldArena() and F.unit:find("nameplate") then
for i = 1, 5 do
if U(F.unit, "arena"..i) then
F.name:SetText(i)
F.name:SetScale(1.6)
F.name:SetTextColor(1, 1, 0)
break
end
end
end
end)
end
-- Class Icon
function SetClassIcon()
UICC = "Interface\\TargetingFrame\\UI-Classes-Circles";
hooksecurefunc("UnitFramePortrait_Update", function(self)
if self.portrait then
if UnitIsPlayer(self.unit) then
local t = CLASS_ICON_TCOORDS[select(2, UnitClass(self.unit))]
if t then
self.portrait:SetTexture(UICC)
self.portrait:SetTexCoord(unpack(t))
end
else
self.portrait:SetTexCoord(0,1,0,1)
end
end
end)
end
-- Combat Icon
function SetCombatIcon()
AD = "Interface\\Icons\\ABILITY_DUALWIELD"
IconSize = 32
local z = CreateFrame("Frame")
z:SetParent(TargetFrame)
z:SetPoint("Right", TargetFrame, 8, 8)
z:SetSize(IconSize, IconSize)
z.t = z:CreateTexture(nil, BORDER)
z.t:SetAllPoints()
z.t:SetTexture(AD)
z:Hide()
local function FrameOnUpdate(self)
if UnitAffectingCombat("target") then
self:Show()
else
self:Hide()
end
end
local g = CreateFrame("Frame")
g:SetScript("OnUpdate", function(self) FrameOnUpdate(z) end)
local y = CreateFrame("Frame")
y:SetParent(FocusFrame)
y:SetPoint("Left", FocusFrame, -32, 8)
y:SetSize(IconSize, IconSize)
y.t = y:CreateTexture(nil, BORDER)
y.t:SetAllPoints()
y.t:SetTexture(AD)
y:Hide()
local function FrameOnUpdate(self)
if UnitAffectingCombat("focus") then
self:Show()
else
self:Hide()
end
end
local h = CreateFrame("Frame")
h:SetScript("OnUpdate", function(self) FrameOnUpdate(y) end)
end
function ReplaceHotKeyText()
local gsub = string.gsub
local function HotkeyReplace(button)
local text = button.HotKey and button.HotKey:GetText()
if not text then return end
text = gsub(text, "(鼠标按键5)", "Mouse Button 5")
text = gsub(text, "(鼠标按键4)", "Mouse Button 4")
text = gsub(text, "(鼠标中键)", "Middle Button")
text = gsub(text, "(鼠标滚轮向上滚动)", "Mouse Wheel Up")
text = gsub(text, "(鼠标滚轮向下滚动)", "Mouse Wheel Down")
button.HotKey:SetText(text)
end
local function SetButtonFont(button)
if button.HotKey then
button.HotKey:SetFont(button.Name:GetFont(), 13, 'OUTLINE')
end
if button.Name then
button.Name:SetFont(button.Name:GetFont(), 12, 'OUTLINE')
end
end
local frame = CreateFrame('Frame')
frame:RegisterEvent('PLAYER_LOGIN')
frame:SetScript('OnEvent', function()
frame:UnregisterEvent('PLAYER_LOGIN')
local isShadowlands = not not ActionBarActionEventsFrameMixin
-- process old buttons
-- action bar
for _, button in ipairs(ActionBarButtonEventsFrame.frames) do
SetButtonFont(button)
HotkeyReplace(button)
if isShadowlands then
hooksecurefunc(button, 'UpdateHotkeys', HotkeyReplace)
end
end
-- pet action bar
for i = 1, 10 do
local button = _G['PetActionButton' .. i]
SetButtonFont(button)
button.HotKey:SetPoint('TOPRIGHT', 2, 0)
HotkeyReplace(button)
end
-- action bar
if isShadowlands then
-- 9.0 and later
hooksecurefunc(ActionBarButtonEventsFrame, 'RegisterFrame', function(_, button)
SetButtonFont(button)
hooksecurefunc(button, 'UpdateHotkeys', HotkeyReplace)
end)
else
-- 8.3.7
hooksecurefunc('ActionBarButtonEventsFrame_RegisterFrame', SetButtonFont)
hooksecurefunc('ActionButton_UpdateHotkeys', HotkeyReplace)
end
-- pet action bar
hooksecurefunc('PetActionButton_SetHotkeys', HotkeyReplace)
end)
end
function Init()
HideTextureAndMicroButton()
SetFramePosition()
SetActionBar()
SetFont()
SetClassIcon()
-- SetCombatIcon()
SetArenaNameplateNumber()
ReplaceHotKeyText()
end
Init()
-- local ArenaFrameCoords = { x = 0, y = 0, padding = 50 }
-- ArenaEnemyFrameX = 8
-- LoadAddOn("Blizzard_ArenaUI")
-- ArenaEnemyFrame1:ClearAllPoints()
-- ArenaEnemyFrame2:ClearAllPoints()
-- ArenaEnemyFrame3:ClearAllPoints()
-- ArenaEnemyFrame4:ClearAllPoints()
-- ArenaEnemyFrame5:ClearAllPoints()
-- ArenaEnemyFrame1:SetPoint("TOPRIGHT", FocusFrame, "TOPRIGHT", ArenaEnemyFrameX, 160)
-- ArenaEnemyFrame2:SetPoint("TOPRIGHT", FocusFrame, "TOPRIGHT", ArenaEnemyFrameX, 110)
-- ArenaEnemyFrame3:SetPoint("TOPRIGHT", FocusFrame, "TOPRIGHT", ArenaEnemyFrameX, 60)
-- ArenaEnemyFrame4:SetPoint("TOPRIGHT", FocusFrame, "TOPRIGHT", ArenaEnemyFrameX, 10)
-- ArenaEnemyFrame5:SetPoint("TOPRIGHT", FocusFrame, "TOPRIGHT", ArenaEnemyFrameX, -40)
-- ArenaEnemyFrame1:SetScale(FrameScale)
-- ArenaEnemyFrame2:SetScale(FrameScale)
-- ArenaEnemyFrame3:SetScale(FrameScale)
-- ArenaEnemyFrame4:SetScale(FrameScale)
-- ArenaEnemyFrame5:SetScale(FrameScale)
-- ArenaEnemyFrame1CastingBar:Show()
-- ArenaEnemyFrame2CastingBar:Show()
-- ArenaEnemyFrame3CastingBar:Show()
-- ArenaEnemyFrame4CastingBar:Show()
-- ArenaEnemyFrame5CastingBar:Show()
-- ArenaEnemyFrames:Show()
-- ArenaEnemyFrame1:Hide()
-- ArenaEnemyFrame2:Hide()
-- ArenaEnemyFrame3:Hide()
-- ArenaEnemyFrame1.SetPoint = function() end
-- ArenaEnemyFrame2.SetPoint = function() end
-- ArenaEnemyFrame3.SetPoint = function() end
-- ArenaEnemyFrame4.SetPoint = function() end
-- ArenaEnemyFrame5.SetPoint = function() end
TotemFrameTotem1:ClearAllPoints()
TotemFrameTotem1:SetPoint("CENTER", UIParent, "CENTER", -48, -72)
TotemFrameScale = 1.3
TotemFrameTotem1:SetScale(TotemFrameScale)
TotemFrameTotem2:SetScale(TotemFrameScale)
TotemFrameTotem3:SetScale(TotemFrameScale)
TotemFrameTotem4:SetScale(TotemFrameScale)