-
Notifications
You must be signed in to change notification settings - Fork 105
/
RaidHeal.lua
442 lines (395 loc) · 16.3 KB
/
RaidHeal.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
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
local T, C, L, _ = unpack(select(2, ...))
if C.unitframe.enable ~= true then return end
----------------------------------------------------------------------------------------
-- UnitFrames based on oUF_Caellian(by Caellian)
----------------------------------------------------------------------------------------
local _, ns = ...
local oUF = ns.oUF
-- Frame size
local unit_width = 60.2
local unit_height = 26
-- Create layout
local function Shared(self, unit)
local unit = (self:GetParent():GetName():match("oUF_Party")) and "party"
or (self:GetParent():GetName():match("oUF_RaidHeal")) and "raid"
or (self:GetParent():GetName():match("oUF_MainTank")) and "tank" or unit
-- Set our own colors
self.colors = T.oUF_colors
-- Register click
self:RegisterForClicks("AnyUp")
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
-- Backdrop for every units
self:CreateBackdrop("Default")
-- Health bar
self.Health = CreateFrame("StatusBar", nil, self)
self.Health:SetPoint("TOPLEFT")
self.Health:SetPoint("TOPRIGHT")
if (self:GetAttribute("unitsuffix") == "pet" or self:GetAttribute("unitsuffix") == "target") and unit ~= "tank" then
self.Health:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, 0)
self.Health:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
else
self.Health:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, 3)
self.Health:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 3)
end
self.Health:SetStatusBarTexture(C.media.texture)
if C.raidframe.vertical_health == true then
self.Health:SetOrientation("VERTICAL")
end
self.Health.frequentUpdates = true
if C.unitframe.own_color == true then
self.Health.colorDisconnected = false
self.Health.colorReaction = false
self.Health.colorClass = false
self.Health:SetStatusBarColor(unpack(C.unitframe.uf_color))
else
self.Health.colorDisconnected = true
self.Health.colorReaction = true
self.Health.colorClass = true
end
-- Health bar background
self.Health.bg = self.Health:CreateTexture(nil, "BORDER")
self.Health.bg:SetAllPoints(self.Health)
self.Health.bg:SetTexture(C.media.texture)
if C.unitframe.own_color == true then
self.Health.bg:SetVertexColor(C.unitframe.uf_color[1], C.unitframe.uf_color[2], C.unitframe.uf_color[3], 0.2)
else
self.Health.bg.multiplier = 0.2
end
-- Names
self.Info = T.SetFontString(self.Health, C.font.unit_frames_font, C.font.unit_frames_font_size, C.font.unit_frames_font_style)
if (self:GetAttribute("unitsuffix") == "pet" or self:GetAttribute("unitsuffix") == "target") and unit ~= "tank" then
self.Info:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
else
self.Info:SetPoint("TOP", self.Health, "TOP", 0, -4)
end
self:Tag(self.Info, "[GetNameColor][NameShort]")
if not (self:GetAttribute("unitsuffix") == "pet" or (self:GetAttribute("unitsuffix") == "target" and unit ~= "tank")) then
self.Health.value = T.SetFontString(self.Health, C.font.unit_frames_font, C.font.unit_frames_font_size, C.font.unit_frames_font_style)
self.Health.value:SetPoint("TOP", self.Info, "BOTTOM", 0, -1)
self.Health.value:SetTextColor(1, 1, 1)
self.Health.PostUpdate = T.PostUpdateRaidHealth
-- Power bar
self.Power = CreateFrame("StatusBar", nil, self)
self.Power:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, 0)
self.Power:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
self.Power:SetPoint("TOP", self, "BOTTOM", 0, 2)
self.Power:SetStatusBarTexture(C.media.texture)
self.Power.frequentUpdates = true
self.Power.colorDisconnected = true
if C.unitframe.own_color == true then
self.Power.colorClass = true
else
self.Power.colorPower = true
end
-- Power bar background
self.Power.bg = self.Power:CreateTexture(nil, "BORDER")
self.Power.bg:SetAllPoints(self.Power)
self.Power.bg:SetTexture(C.media.texture)
self.Power.bg:SetAlpha(1)
self.Power.bg.multiplier = 0.2
end
-- Agro border
if C.raidframe.aggro_border == true then
table.insert(self.__elements, T.UpdateThreat)
self:RegisterEvent("PLAYER_TARGET_CHANGED", T.UpdateThreat)
self:RegisterEvent("UNIT_THREAT_LIST_UPDATE", T.UpdateThreat)
self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", T.UpdateThreat)
end
-- Raid marks
if C.raidframe.icons_raid_mark == true then
self.RaidIcon = self.Health:CreateTexture(nil, "OVERLAY")
self.RaidIcon:SetSize(12, 12)
self.RaidIcon:SetPoint("BOTTOMLEFT", self.Health, -2, -5)
end
-- LFD role icons
if C.raidframe.icons_role == true and not (self:GetAttribute("unitsuffix") == "target") then
self.LFDRole = self.Health:CreateTexture(nil, "OVERLAY")
self.LFDRole:SetSize(12, 12)
self.LFDRole:SetPoint("TOP", self.Health, 0, 8)
end
-- Ready check icons
if C.raidframe.icons_ready_check == true and not (self:GetAttribute("unitsuffix") == "target" or self:GetAttribute("unitsuffix") == "targettarget") then
self.ReadyCheck = self.Health:CreateTexture(nil, "OVERLAY")
self.ReadyCheck:SetSize(12, 12)
self.ReadyCheck:SetPoint("BOTTOMRIGHT", self.Health, 2, 1)
end
-- Leader/Assistant/ML icons
if C.raidframe.icons_leader == true and not (self:GetAttribute("unitsuffix") == "target" or self:GetAttribute("unitsuffix") == "targettarget") then
-- Leader icon
self.Leader = self.Health:CreateTexture(nil, "OVERLAY")
self.Leader:SetSize(12, 12)
self.Leader:SetPoint("TOPLEFT", self.Health, -3, 8)
-- Assistant icon
self.Assistant = self.Health:CreateTexture(nil, "OVERLAY")
self.Assistant:SetSize(12, 12)
self.Assistant:SetPoint("TOPLEFT", self.Health, -3, 8)
-- Master looter icon
self.MasterLooter = self.Health:CreateTexture(nil, "OVERLAY")
self.MasterLooter:SetSize(12, 12)
self.MasterLooter:SetPoint("TOPRIGHT", self.Health, 3, 8)
end
-- Resurrect icon
self.ResurrectIcon = self.Health:CreateTexture(nil, "OVERLAY")
--self.ResurrectIcon:SetTexture("Interface\\Icons\\Spell_Holy_Resurrection")
--self.ResurrectIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
self.ResurrectIcon:SetSize(13, 13)
self.ResurrectIcon:SetPoint("BOTTOMRIGHT", self.Health, 2, -7)
-- Debuff highlight
if not (self:GetAttribute("unitsuffix") == "target" or self:GetAttribute("unitsuffix") == "targettarget") then
self.DebuffHighlight = self.Health:CreateTexture(nil, "OVERLAY")
self.DebuffHighlight:SetAllPoints(self.Health)
self.DebuffHighlight:SetTexture(C.media.highlight)
self.DebuffHighlight:SetVertexColor(0, 0, 0, 0)
self.DebuffHighlight:SetBlendMode("ADD")
self.DebuffHighlightAlpha = 1
self.DebuffHighlightFilter = true
end
-- Incoming heal text/bar
if C.raidframe.plugins_healcomm == true then
local mhpb = CreateFrame("StatusBar", nil, self.Health)
if C.raidframe.vertical_health == true then
mhpb:SetOrientation("VERTICAL")
mhpb:SetPoint("BOTTOM", self.Health:GetStatusBarTexture(), "TOP", 0, 0)
mhpb:SetHeight(unit_height)
else
mhpb:SetPoint("TOPLEFT", self.Health:GetStatusBarTexture(), "TOPRIGHT", 0, 0)
mhpb:SetPoint("BOTTOMLEFT", self.Health:GetStatusBarTexture(), "BOTTOMRIGHT", 0, 0)
end
mhpb:SetWidth(unit_width)
mhpb:SetStatusBarTexture(C.media.texture)
mhpb:SetStatusBarColor(0, 1, 0.5, 0.2)
local ohpb = CreateFrame("StatusBar", nil, self.Health)
if C.raidframe.vertical_health == true then
ohpb:SetOrientation("VERTICAL")
ohpb:SetPoint("BOTTOM", mhpb:GetStatusBarTexture(), "TOP", 0, 0)
ohpb:SetHeight(unit_height)
else
ohpb:SetPoint("TOPLEFT", mhpb:GetStatusBarTexture(), "TOPRIGHT", 0, 0)
ohpb:SetPoint("BOTTOMLEFT", mhpb:GetStatusBarTexture(), "BOTTOMRIGHT", 0, 0)
end
ohpb:SetWidth(unit_width)
ohpb:SetStatusBarTexture(C.media.texture)
ohpb:SetStatusBarColor(0, 1, 0, 0.2)
self.HealPrediction = {
myBar = mhpb,
otherBar = ohpb,
}
--self.IncHeal = T.SetFontString(self.Health, C.font.unit_frames_font, C.font.unit_frames_font_size, C.font.unit_frames_font_style)
--self.IncHeal:SetPoint("CENTER", self.Health, "TOP", 0, 0)
--self:Tag(self.IncHeal, "[IncHeal]")
end
-- Range alpha
if C.raidframe.show_range == true and not (self:GetAttribute("unitsuffix") == "target" or self:GetAttribute("unitsuffix") == "targettarget") then
self.Range = {insideAlpha = 1, outsideAlpha = C.raidframe.range_alpha}
end
-- Smooth bars
if C.unitframe.plugins_smooth_bar == true then
self.Health.Smooth = true
if not (self:GetAttribute("unitsuffix") == "pet" or self:GetAttribute("unitsuffix") == "target") then
self.Power.Smooth = true
end
end
if C.raidframe.plugins_aura_watch == true and not (self:GetAttribute("unitsuffix") == "pet" or self:GetAttribute("unitsuffix") == "target" or self:GetAttribute("unitsuffix") == "targettarget") then
-- Classbuffs
T.CreateAuraWatch(self, unit)
-- Raid debuffs
self.RaidDebuffs = CreateFrame("Frame", nil, self)
self.RaidDebuffs:SetHeight(19)
self.RaidDebuffs:SetWidth(19)
self.RaidDebuffs:SetPoint("CENTER", self, 0, 1)
self.RaidDebuffs:SetFrameStrata("MEDIUM")
self.RaidDebuffs:SetFrameLevel(10)
self.RaidDebuffs:SetTemplate("Default")
self.RaidDebuffs.icon = self.RaidDebuffs:CreateTexture(nil, "BORDER")
self.RaidDebuffs.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
self.RaidDebuffs.icon:SetPoint("TOPLEFT", 2, -2)
self.RaidDebuffs.icon:SetPoint("BOTTOMRIGHT", -2, 2)
if C.raidframe.plugins_aura_watch_timer == true then
self.RaidDebuffs.time = T.SetFontString(self.RaidDebuffs, C.font.unit_frames_font, C.font.unit_frames_font_size, C.font.unit_frames_font_style)
self.RaidDebuffs.time:SetPoint("CENTER", 1, 1)
self.RaidDebuffs.time:SetTextColor(1, 1, 1)
end
self.RaidDebuffs.count = T.SetFontString(self.RaidDebuffs, C.font.unit_frames_font, C.font.unit_frames_font_size, C.font.unit_frames_font_style)
self.RaidDebuffs.count:SetPoint("BOTTOMRIGHT", self.RaidDebuffs, "BOTTOMRIGHT", 3, -1)
self.RaidDebuffs.count:SetTextColor(1, 1, 1)
if C.aura.show_spiral == true then
self.RaidDebuffs.cd = CreateFrame("Cooldown", nil, self.RaidDebuffs, "CooldownFrameTemplate")
self.RaidDebuffs.cd:SetPoint("TOPLEFT", 2, -2)
self.RaidDebuffs.cd:SetPoint("BOTTOMRIGHT", -2, 2)
self.RaidDebuffs.cd:SetReverse(true)
self.RaidDebuffs.cd.noOCC = true
self.RaidDebuffs.parent = CreateFrame("Frame", nil, self.RaidDebuffs)
self.RaidDebuffs.parent:SetFrameLevel(self.RaidDebuffs.cd:GetFrameLevel() + 1)
if C.raidframe.plugins_aura_watch_timer == true then
self.RaidDebuffs.time:SetParent(self.RaidDebuffs.parent)
end
self.RaidDebuffs.count:SetParent(self.RaidDebuffs.parent)
end
self.RaidDebuffs.ShowDispellableDebuff = C.raidframe.plugins_debuffhighlight_icon
self.RaidDebuffs.FilterDispellableDebuff = true
self.RaidDebuffs.MatchBySpellName = true
self.RaidDebuffs.Debuffs = T.RaidDebuffs
end
return self
end
----------------------------------------------------------------------------------------
-- Default position of ShestakUI unitframes
----------------------------------------------------------------------------------------
oUF:Factory(function(self)
if SavedOptions == nil or SavedOptions.RaidLayout ~= "HEAL" then return end
oUF:RegisterStyle("ShestakHeal", Shared)
oUF:SetActiveStyle("ShestakHeal")
if C.raidframe.show_party == true then
-- Party
local party = self:SpawnHeader("oUF_Party", nil, "custom [@raid6,exists] hide;show",
"oUF-initialConfigFunction", [[
local header = self:GetParent()
self:SetWidth(header:GetAttribute("initial-width"))
self:SetHeight(header:GetAttribute("initial-height"))
]],
"initial-width", unit_width,
"initial-height", T.Scale(unit_height),
"showSolo", C.raidframe.solo_mode,
"showPlayer", C.raidframe.player_in_party,
"groupBy", C.raidframe.by_role and "ASSIGNEDROLE",
"groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE",
"sortMethod", C.raidframe.by_role and "NAME",
"showParty", true,
"showRaid", true,
"xOffset", T.Scale(7),
"point", "LEFT"
)
if C.raidframe.player_in_party == true then
party:SetPoint(unpack(C.position.unitframes.party_heal))
else
party:SetPoint(C.position.unitframes.party_heal[1], C.position.unitframes.party_heal[2], C.position.unitframes.party_heal[3], C.position.unitframes.party_heal[4] + 32, C.position.unitframes.party_heal[5])
end
-- Party targets
local partytarget = self:SpawnHeader("oUF_PartyTarget", nil, "custom [@raid6,exists] hide;show",
"oUF-initialConfigFunction", [[
local header = self:GetParent()
self:SetWidth(header:GetAttribute("initial-width"))
self:SetHeight(header:GetAttribute("initial-height"))
self:SetAttribute("unitsuffix", "target")
]],
"initial-width", unit_width,
"initial-height", T.Scale(unit_height / 2),
"showSolo", C.raidframe.solo_mode,
"showPlayer", C.raidframe.player_in_party,
"groupBy", C.raidframe.by_role and "ASSIGNEDROLE",
"groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE",
"sortMethod", C.raidframe.by_role and "NAME",
"showParty", true,
"showRaid", true,
"xOffset", T.Scale(7),
"point", "LEFT"
)
partytarget:SetPoint("TOPLEFT", party, "BOTTOMLEFT", 0, -7)
-- Party pets
local partypet = self:SpawnHeader("oUF_PartyPet", nil, "custom [@raid6,exists] hide;show",
"oUF-initialConfigFunction", [[
local header = self:GetParent()
self:SetWidth(header:GetAttribute("initial-width"))
self:SetHeight(header:GetAttribute("initial-height"))
self:SetAttribute("useOwnerUnit", "true")
self:SetAttribute("unitsuffix", "pet")
]],
"initial-width", unit_width,
"initial-height", T.Scale(unit_height / 2),
"showSolo", C.raidframe.solo_mode,
"showPlayer", C.raidframe.player_in_party,
"groupBy", C.raidframe.by_role and "ASSIGNEDROLE",
"groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE",
"sortMethod", C.raidframe.by_role and "NAME",
"showParty", true,
"showRaid", true,
"xOffset", T.Scale(7),
"point", "LEFT"
)
partypet:SetPoint("TOPLEFT", party, "BOTTOMLEFT", 0, -((unit_height / 2) + 14.5))
end
if C.raidframe.show_raid == true then
if C.raidframe.raid_groups_vertical then
-- Raid vertical
local raid = {}
for i = 1, C.raidframe.raid_groups do
local raidgroup = self:SpawnHeader("oUF_RaidHeal"..i, nil, "custom [@raid6,exists] show;hide",
"oUF-initialConfigFunction", [[
local header = self:GetParent()
self:SetWidth(header:GetAttribute("initial-width"))
self:SetHeight(header:GetAttribute("initial-height"))
]],
"initial-width", unit_width,
"initial-height", T.Scale(unit_height),
"showRaid", true,
"yOffset", T.Scale(-5),
"point", "TOPLEFT",
"groupFilter", tostring(i),
"groupBy", C.raidframe.by_role and "ASSIGNEDROLE",
"groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE",
"sortMethod", C.raidframe.by_role and "NAME",
"maxColumns", 5,
"unitsPerColumn", 1,
"columnSpacing", T.Scale(7),
"columnAnchorPoint", "TOP"
)
if i == 1 then
raidgroup:SetPoint(unpack(C.position.unitframes.raid_heal))
else
raidgroup:SetPoint("TOPLEFT", raid[i-1], "TOPRIGHT", 7, 0)
end
raid[i] = raidgroup
end
else
-- Raid horizontal
local raid = {}
for i = 1, C.raidframe.raid_groups do
local raidgroup = self:SpawnHeader("oUF_RaidHeal"..i, nil, "custom [@raid6,exists] show;hide",
"oUF-initialConfigFunction", [[
local header = self:GetParent()
self:SetWidth(header:GetAttribute("initial-width"))
self:SetHeight(header:GetAttribute("initial-height"))
]],
"initial-width", unit_width,
"initial-height", T.Scale(unit_height),
"showRaid", true,
"groupFilter", tostring(i),
"groupBy", C.raidframe.by_role and "ASSIGNEDROLE",
"groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE",
"sortMethod", C.raidframe.by_role and "NAME",
"point", "LEFT",
"maxColumns", 5,
"unitsPerColumn", 1,
"columnSpacing", T.Scale(7),
"columnAnchorPoint", "LEFT"
)
if i == 1 then
raidgroup:SetPoint(unpack(C.position.unitframes.raid_heal))
else
raidgroup:SetPoint("TOPLEFT", raid[i-1], "BOTTOMLEFT", 0, -7)
end
raid[i] = raidgroup
end
end
if C.raidframe.raid_tanks == true then
-- Tanks
if C.raidframe.raid_tanks_tt == true then
mt_template = "oUF_MainTankTT"
else
mt_template = "oUF_MainTank"
end
local raidtank = self:SpawnHeader("oUF_MainTank", nil, "raid",
"oUF-initialConfigFunction", ([[
self:SetWidth(%d)
self:SetHeight(%d)
]]):format(unit_width, unit_height),
"showRaid", true,
"yOffset", T.Scale(-7),
"groupFilter", "MAINTANK",
"template", mt_template
)
raidtank:SetPoint(unpack(C.position.unitframes.tank))
end
end
end)