forked from oUF-wow/oUF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blizzard.lua
132 lines (113 loc) · 3.23 KB
/
blizzard.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
local parent, ns = ...
local oUF = ns.oUF
-- sourced from Blizzard_ArenaUI/Blizzard_ArenaUI.lua
local MAX_ARENA_ENEMIES = MAX_ARENA_ENEMIES or 5
-- sourced from FrameXML/TargetFrame.lua
local MAX_BOSS_FRAMES = MAX_BOSS_FRAMES or 5
-- sourced from FrameXML/PartyMemberFrame.lua
local MAX_PARTY_MEMBERS = MAX_PARTY_MEMBERS or 4
local hiddenParent = CreateFrame('Frame', nil, UIParent)
hiddenParent:SetAllPoints()
hiddenParent:Hide()
local function insecureOnShow(self)
self:Hide()
end
local function handleFrame(baseName, doNotReparent)
local frame
if(type(baseName) == 'string') then
frame = _G[baseName]
else
frame = baseName
end
if(frame) then
frame:UnregisterAllEvents()
frame:Hide()
if(not doNotReparent) then
frame:SetParent(hiddenParent)
end
local health = frame.healthBar or frame.healthbar
if(health) then
health:UnregisterAllEvents()
end
local power = frame.manabar
if(power) then
power:UnregisterAllEvents()
end
local spell = frame.castBar or frame.spellbar
if(spell) then
spell:UnregisterAllEvents()
end
local altpowerbar = frame.powerBarAlt
if(altpowerbar) then
altpowerbar:UnregisterAllEvents()
end
local buffFrame = frame.BuffFrame
if(buffFrame) then
buffFrame:UnregisterAllEvents()
end
end
end
function oUF:DisableBlizzard(unit)
if(not unit) then return end
if(unit == 'player') then
handleFrame(PlayerFrame)
-- For the damn vehicle support:
PlayerFrame:RegisterEvent('PLAYER_ENTERING_WORLD')
PlayerFrame:RegisterEvent('UNIT_ENTERING_VEHICLE')
PlayerFrame:RegisterEvent('UNIT_ENTERED_VEHICLE')
PlayerFrame:RegisterEvent('UNIT_EXITING_VEHICLE')
PlayerFrame:RegisterEvent('UNIT_EXITED_VEHICLE')
-- User placed frames don't animate
PlayerFrame:SetUserPlaced(true)
PlayerFrame:SetDontSavePosition(true)
elseif(unit == 'pet') then
handleFrame(PetFrame)
elseif(unit == 'target') then
handleFrame(TargetFrame)
handleFrame(ComboFrame)
elseif(unit == 'focus') then
handleFrame(FocusFrame)
handleFrame(TargetofFocusFrame)
elseif(unit == 'targettarget') then
handleFrame(TargetFrameToT)
elseif(unit:match('boss%d?$')) then
local id = unit:match('boss(%d)')
if(id) then
handleFrame('Boss' .. id .. 'TargetFrame')
else
for i = 1, MAX_BOSS_FRAMES do
handleFrame(string.format('Boss%dTargetFrame', i))
end
end
elseif(unit:match('party%d?$')) then
local id = unit:match('party(%d)')
if(id) then
handleFrame('PartyMemberFrame' .. id)
else
for i = 1, MAX_PARTY_MEMBERS do
handleFrame(string.format('PartyMemberFrame%d', i))
end
end
elseif(unit:match('arena%d?$')) then
local id = unit:match('arena(%d)')
if(id) then
handleFrame('ArenaEnemyFrame' .. id)
else
for i = 1, MAX_ARENA_ENEMIES do
handleFrame(string.format('ArenaEnemyFrame%d', i))
end
end
-- Blizzard_ArenaUI should not be loaded
Arena_LoadUI = function() end
SetCVar('showArenaEnemyFrames', '0', 'SHOW_ARENA_ENEMY_FRAMES_TEXT')
elseif(unit:match('nameplate%d+$')) then
local frame = C_NamePlate.GetNamePlateForUnit(unit)
if(frame and frame.UnitFrame) then
if(not frame.UnitFrame.isHooked) then
frame.UnitFrame:HookScript('OnShow', insecureOnShow)
frame.UnitFrame.isHooked = true
end
handleFrame(frame.UnitFrame, true)
end
end
end