-
Notifications
You must be signed in to change notification settings - Fork 2
/
BuffBelow.lua
277 lines (257 loc) · 11.6 KB
/
BuffBelow.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
local targetBuffSize = BuffSizerDB.targetbuffSize
local targetDebuffSize = BuffSizerDB.targetdebuffSize
local focusBuffSize = BuffSizerDB.focusbuffSize
local focusDebuffSize = BuffSizerDB.focusdebuffSize
local buffOffset = BuffSizerDB.buffOffset
local debuffOffset = BuffSizerDB.debuffOffset
function BuffSizer_TargetBelow()
-- move ToT
local biggestIcon
if BuffSizerDB.targetbuffSize < BuffSizerDB.targetdebuffSize then
biggestIcon = BuffSizerDB.targetdebuffSize
else
biggestIcon = BuffSizerDB.targetbuffSize
end
TargetofTargetFrame:ClearAllPoints()
TargetofTargetFrame:SetPoint("BOTTOMRIGHT", TargetFrame, -10,-10)
-- Update buff positioning/size
function TargetFrame_UpdateBuffAnchor(buffName, index, numFirstRowBuffs, numDebuffs, buffSize, offset, ...)
local buff = getglobal(buffName..index);
buffSize = BuffSizerDB.targetbuffSize
offset = buffOffset
-- buff/debuff area is ~55% of the frame, portait comes after that
local i = 1
while (TargetFrame:GetWidth()*0.55) > (BuffSizerDB.targetbuffSize*i) do
numFirstRowBuffs = i
i = i + 1
end
if ( index == 1 ) then
if ( UnitIsFriend("player", "target") ) then
buff:SetPoint("TOPLEFT", TargetFrame, "BOTTOMLEFT", TargetFrame.buffStartX, TargetFrame.buffStartY);
else
if ( numDebuffs > 0 ) then
buff:SetPoint("TOPLEFT", TargetFrameDebuffs, "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
else
buff:SetPoint("TOPLEFT", TargetFrame, "BOTTOMLEFT", TargetFrame.buffStartX, TargetFrame.buffStartY);
end
end
TargetFrameBuffs:SetPoint("TOPLEFT", buff, "TOPLEFT", 0, 0);
TargetFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
elseif ( index == (numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..1), "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
TargetFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
elseif ( hasTargetofTarget and index == (2*numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..(numFirstRowBuffs+1)), "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
TargetFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
elseif ( (index > numFirstRowBuffs) and (mod(index+(TARGET_BUFFS_PER_ROW-numFirstRowBuffs), TARGET_BUFFS_PER_ROW) == 1) and not hasTargetofTarget ) then
-- Make a new row, have to take the number of buffs in the first row into account
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-TARGET_BUFFS_PER_ROW)), "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
TargetFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
else
-- Just anchor to previous
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-1)), "TOPRIGHT", offset, 0);
end
-- Resize
buff:SetWidth(buffSize);
buff:SetHeight(buffSize);
end
-- Update debuff positioning/size
function TargetFrame_UpdateDebuffAnchor(buffName, index, numFirstRowBuffs, numBuffs, buffSize, offset, ...)
local buff = getglobal(buffName..index);
buffSize = BuffSizerDB.targetdebuffSize
offset = debuffOffset
-- buff/debuff area is ~55% of the frame, portait comes after that
local i = 1
while (TargetFrame:GetWidth()*0.55) > (BuffSizerDB.targetdebuffSize*i) do
numFirstRowBuffs = i
i = i + 1
end
if ( index == 1 ) then
if ( UnitIsFriend("player", "target") and (numBuffs > 0) ) then
buff:SetPoint("TOPLEFT", TargetFrameBuffs, "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
else
buff:SetPoint("TOPLEFT", TargetFrame, "BOTTOMLEFT", TargetFrame.buffStartX, TargetFrame.buffStartY);
end
TargetFrameDebuffs:SetPoint("TOPLEFT", buff, "TOPLEFT", 0, 0);
TargetFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
elseif ( index == (numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..1), "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
TargetFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
elseif ( hasTargetofTarget and index == (2*numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..(numFirstRowBuffs+1)), "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
TargetFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
elseif ( (index > numFirstRowBuffs) and (mod(index+(TARGET_DEBUFFS_PER_ROW-numFirstRowBuffs), TARGET_DEBUFFS_PER_ROW) == 1) and not hasTargetofTarget ) then
-- Make a new row
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-TARGET_DEBUFFS_PER_ROW)), "BOTTOMLEFT", 0, -TargetFrame.buffSpacing);
TargetFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
TargetFrame.buffRows = TargetFrame.buffRows+1;
else
-- Just anchor to previous
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-1)), "TOPRIGHT", offset, 0);
end
-- Resize
buff:SetWidth(buffSize);
buff:SetHeight(buffSize);
local debuffFrame = getglobal(buffName..index.."Border");
debuffFrame:SetWidth(buffSize+2);
debuffFrame:SetHeight(buffSize+2);
end
function Target_Spellbar_AdjustPosition()
local yPos = 5;
local rowSize = 0
if BuffSizerDB.targetbuffSize < BuffSizerDB.targetdebuffSize then
rowSize = BuffSizerDB.targetdebuffSize
else
rowSize = BuffSizerDB.targetbuffSize
end
if ( TargetFrame.buffRows and TargetFrame.buffRows <= 2 ) then
yPos = 15 + rowSize;
elseif ( TargetFrame.buffRows ) then
yPos = 15 + rowSize* TargetFrame.buffRows
end
if ( TargetofTargetFrame:IsShown() ) then
if ( yPos <= 25 ) then
yPos = yPos + 25;
end
else
yPos = yPos - 5;
local classification = UnitClassification("target");
if ( (yPos < rowSize) and ((classification == "worldboss") or (classification == "rareelite") or (classification == "elite") or (classification == "rare")) ) then
yPos = rowSize;
end
end
TargetFrameSpellBar:SetPoint("BOTTOM", "TargetFrame", "BOTTOM", -15, -yPos);
end
end
function BuffSizer_FocusBelow()
-- move ToF
local biggestIcon
if BuffSizerDB.focusbuffSize < BuffSizerDB.focusdebuffSize then
biggestIcon = BuffSizerDB.focusdebuffSize
else
biggestIcon = BuffSizerDB.focusbuffSize
end
TargetofFocusFrame:ClearAllPoints()
TargetofFocusFrame:SetPoint("BOTTOMRIGHT", FocusFrame,-15,-10)
function FocusFrame_UpdateBuffAnchor(buffName, index, numFirstRowBuffs, numDebuffs, buffSize, offset, ...)
local buff = getglobal(buffName..index);
buffSize = BuffSizerDB.focusbuffSize
offset = buffOffset
-- buff/debuff area is ~55% of the frame, portait comes after that
local i = 1
while (FocusFrame:GetWidth()*0.55) > (BuffSizerDB.focusbuffSize*i) do
numFirstRowBuffs = i
i = i + 1
end
if ( index == 1 ) then
if ( UnitIsFriend("player", "Focus") ) then
buff:SetPoint("TOPLEFT", FocusFrame, "BOTTOMLEFT", FocusFrame.buffStartX, FocusFrame.buffStartY);
else
if ( numDebuffs > 0 ) then
buff:SetPoint("TOPLEFT", FocusFrameDebuffs, "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
else
buff:SetPoint("TOPLEFT", FocusFrame, "BOTTOMLEFT", FocusFrame.buffStartX, FocusFrame.buffStartY);
end
end
FocusFrameBuffs:SetPoint("TOPLEFT", buff, "TOPLEFT", 0, 0);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( index == (numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..1), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( hasTargetofFocus and index == (2*numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..(numFirstRowBuffs+1)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( (index > numFirstRowBuffs) and (mod(index+(FOCUS_BUFFS_PER_ROW-numFirstRowBuffs), FOCUS_BUFFS_PER_ROW) == 1) and not hasTargetofFocus ) then
-- Make a new row, have to take the number of buffs in the first row into account
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-FOCUS_BUFFS_PER_ROW)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameBuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
else
-- Just anchor to previous
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-1)), "TOPRIGHT", offset, 0);
end
-- Resize
buff:SetWidth(buffSize);
buff:SetHeight(buffSize);
end
-- Update debuff positioning/size
function FocusFrame_UpdateDebuffAnchor(buffName, index, numFirstRowBuffs, numBuffs, buffSize, offset, ...)
local buff = getglobal(buffName..index);
buffSize = BuffSizerDB.focusdebuffSize
offset = debuffOffset
-- buff/debuff area is ~55% of the frame, portait comes after that
local i = 1
while (FocusFrame:GetWidth()*0.55) > (BuffSizerDB.focusdebuffSize*i) do
numFirstRowBuffs = i
i = i + 1
end
if ( index == 1 ) then
if ( UnitIsFriend("player", "Focus") and (numBuffs > 0) ) then
buff:SetPoint("TOPLEFT", FocusFrameBuffs, "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
else
buff:SetPoint("TOPLEFT", FocusFrame, "BOTTOMLEFT", FocusFrame.buffStartX, FocusFrame.buffStartY);
end
FocusFrameDebuffs:SetPoint("TOPLEFT", buff, "TOPLEFT", 0, 0);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( index == (numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..1), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( hasTargetofFocus and index == (2*numFirstRowBuffs+1) ) then
buff:SetPoint("TOPLEFT", getglobal(buffName..(numFirstRowBuffs+1)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
elseif ( (index > numFirstRowBuffs) and (mod(index+(FOCUS_DEBUFFS_PER_ROW-numFirstRowBuffs), FOCUS_DEBUFFS_PER_ROW) == 1) and not hasTargetofFocus ) then
-- Make a new row
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-FOCUS_DEBUFFS_PER_ROW)), "BOTTOMLEFT", 0, -FocusFrame.buffSpacing);
FocusFrameDebuffs:SetPoint("BOTTOMLEFT", buff, "BOTTOMLEFT", 0, 0);
FocusFrame.buffRows = FocusFrame.buffRows+1;
else
-- Just anchor to previous
buff:SetPoint("TOPLEFT", getglobal(buffName..(index-1)), "TOPRIGHT", offset, 0);
end
-- Resize
buff:SetWidth(buffSize);
buff:SetHeight(buffSize);
local debuffFrame = getglobal(buffName..index.."Border");
debuffFrame:SetWidth(buffSize+2);
debuffFrame:SetHeight(buffSize+2);
end
function Focus_Spellbar_AdjustPosition()
local yPos = 5;
local rowSize = 0
if BuffSizerDB.focusbuffSize < BuffSizerDB.focusdebuffSize then
rowSize = BuffSizerDB.focusdebuffSize
else
rowSize = BuffSizerDB.focusbuffSize
end
if ( FocusFrame.buffRows and FocusFrame.buffRows <= 2 ) then
yPos = 15 + rowSize;
elseif ( FocusFrame.buffRows ) then
yPos = 15 + rowSize* FocusFrame.buffRows
end
if ( TargetofFocusFrame:IsShown() ) then
if ( yPos <= 25 ) then
yPos = yPos + 25;
end
else
yPos = yPos - 5;
local classification = UnitClassification("Focus");
if ( (yPos < rowSize) and ((classification == "worldboss") or (classification == "rareelite") or (classification == "elite") or (classification == "rare")) ) then
yPos = rowSize;
end
end
FocusFrameSpellBar:SetPoint("BOTTOM", "FocusFrame", "BOTTOM", -15, -yPos);
end
end