-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathElements.lua
605 lines (520 loc) · 21.2 KB
/
Elements.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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
local addon, ns = ...
local oUF = ns.oUF
local C, F, G, T = unpack(ns)
-- elements: create elements
--===================================================--
----------------- [[ Castbar ]] -----------------
--===================================================--
-- [[ 嵌入施法條 ]] --
T.CreateCastbar = function(self, unit)
-- 創建一個條
local Castbar = F.CreateStatusbar(self, G.addon..unit.."_CastBar", "ARTWORK", nil, nil, 0, 0, 0, 0)
Castbar:SetAllPoints(self.Health)
Castbar:SetFrameLevel(self:GetFrameLevel() + 4)
-- 圖示
Castbar.Icon = Castbar:CreateTexture(nil, "OVERLAY", nil, 1)
Castbar.Icon:SetSize(C.PHeight + C.PPHeight*2, C.PHeight + C.PPHeight*2)
Castbar.Icon:SetTexCoord(.08, .92, .08, .92)
-- 邊框
Castbar.Border = F.CreateBD(Castbar, Castbar.Icon, 1, 0, 0, 0, 1)
-- 陰影
Castbar.Shadow = F.CreateSD(Castbar, Castbar.Border, 4)
-- 文本
Castbar.Text = F.CreateText(Castbar, "OVERLAY", G.Font, G.NameFS, G.FontFlag, nil)
Castbar.Time = F.CreateText(Castbar, "OVERLAY", G.Font, G.NameFS, G.FontFlag, nil)
-- 進度高亮
Castbar.Spark = Castbar:CreateTexture(nil, "OVERLAY", nil, -1)
Castbar.Spark:SetTexture(G.media.spark)
Castbar.Spark:SetBlendMode("ADD")
Castbar.Spark:SetVertexColor(1, 1, .85, .8)
-- 隊列
--Castbar.SafeZone = Castbar:CreateTexture(nil, "OVERLAY")
--Castbar.SafeZone:SetAlpha(.6)
-- 橫豎的spark不一樣
if self.mystyle ~= "H" then
Castbar:SetOrientation("VERTICAL")
Castbar.Spark:SetRotation(math.rad(90)) -- spark材質也要轉90度
Castbar.Spark:SetSize(C.PHeight, C.PHeight)
Castbar.Spark:SetPoint("TOP", Castbar:GetStatusBarTexture(), 0, 0)
else
Castbar.Spark:SetSize(C.PHeight, C.PHeight)
Castbar.Spark:SetPoint("RIGHT", Castbar:GetStatusBarTexture(), 0, 0)
end
-- 選項
Castbar.timeToHold = 0.05
-- 註冊到ouf
self.Castbar = Castbar
self.Castbar.PostCastStart = T.PostCastStart -- 開始施法
self.Castbar.PostCastStop = T.PostCastStop -- 施法結束
self.Castbar.CustomTimeText = T.CustomTimeText -- 施法時間
self.Castbar.CustomDelayText = T.CustomTimeText -- 施法時間
self.Castbar.PostCastFail = T.PostCastFailed -- 施法失敗
self.Castbar.PostCastInterruptible = T.PostUpdateCast -- 打斷狀態刷新
-- 當前目標正在施法時,切換目標會重新獲取名字,防止丟失
self:RegisterEvent("UNIT_NAME_UPDATE", T.PostCastStopUpdate)
table.insert(self.__elements, T.PostCastStopUpdate)
end
-- [[ 獨立施法條 ]] --
T.CreateStandaloneCastbar = function(self, unit)
-- 創建一個條
local Castbar = F.CreateStatusbar(self, G.addon..unit.."_CastBar", "ARTWORK", nil, nil, .6, .6, .6, 1)
Castbar:SetFrameLevel(self:GetFrameLevel() + 4)
-- 背景與邊框
Castbar.BarBG = F.CreateBD(Castbar, Castbar, 1, .15, .15, .15, .4)
-- 陰影
Castbar.BarShadow = F.CreateSD(Castbar, Castbar, 4)
-- 圖示
Castbar.Icon = Castbar:CreateTexture(nil, "OVERLAY", nil, 1)
Castbar.Icon:SetTexCoord(.08, .92, .08, .92)
-- 圖示邊框
Castbar.Shadow = F.CreateSD(Castbar, Castbar.Icon, 4)
-- 進度高亮
Castbar.Spark = Castbar:CreateTexture(nil, "OVERLAY", nil, -1)
Castbar.Spark:SetTexture(G.media.spark)
Castbar.Spark:SetBlendMode("ADD")
Castbar.Spark:SetVertexColor(1, 1, .85, .5)
-- 不同模式的布局
if self.mystyle == "S" then
-- 簡易焦點
Castbar:SetSize(C.PWidth/2, C.PHeight)
Castbar.Icon:SetSize(C.PHeight * 1.5, C.PHeight * 1.5)
Castbar.Spark:SetSize(C.PHeight, C.PHeight)
Castbar.Spark:SetPoint("RIGHT", Castbar:GetStatusBarTexture(), 0, 0)
Castbar.Text = F.CreateText(Castbar, "OVERLAY", G.Font, G.NameFS, G.FontFlag, "LEFT")
Castbar.Text:SetPoint("LEFT", 5, 0)
Castbar.Text:SetWidth(self:GetWidth())
elseif self.mystyle == "H" then
-- 橫式
Castbar:SetHeight(C.PHeight)
Castbar.Icon:SetSize(C.PHeight, C.PHeight)
Castbar.Spark:SetSize(C.PHeight, C.PHeight)
Castbar.Spark:SetPoint("RIGHT", Castbar:GetStatusBarTexture(), 0, 0)
Castbar.Text = F.CreateText(Castbar, "OVERLAY", G.Font, G.NameFS, G.FontFlag, "LEFT")
Castbar.Text:SetPoint("LEFT", 5, 0)
Castbar.Time = F.CreateText(Castbar, "OVERLAY", G.Font, G.NameFS, G.FontFlag, "RIGHT")
Castbar.Time:SetPoint("RIGHT", -5, 0)
else
-- 直式
Castbar:SetSize(C.PHeight, C.PWidth-C.PHeight-C.PPOffset)
Castbar.Icon:SetSize(C.PHeight, C.PHeight)
Castbar:SetOrientation("VERTICAL")
Castbar.Spark:SetRotation(math.rad(90)) -- spark材質也要轉90度
Castbar.Spark:SetSize(C.PHeight, C.PHeight)
Castbar.Spark:SetPoint("TOP", Castbar:GetStatusBarTexture(), 0, 0)
Castbar.Text = F.CreateText(Castbar, "OVERLAY", G.Font, G.NameFS, G.FontFlag, nil)
Castbar.Time = F.CreateText(Castbar, "OVERLAY", G.Font, G.NameFS, G.FontFlag, nil)
end
-- 選項
Castbar.timeToHold = 0.05
-- 註冊到ouf
self.Castbar = Castbar
self.Castbar.PostCastStart = T.PostStandaloneCastStart -- 施法開始
self.Castbar.CustomTimeText = T.CustomTimeText -- 施法時間
self.Castbar.PostCastFail = T.PostStandaloneCastFailed -- 施法失敗
self.Castbar.PostCastInterruptible = T.PostUpdateStandaloneCast -- 打斷狀態更新
end
--===================================================--
------------------- [[ Auras ]] -----------------
--===================================================--
-- [[ 減益 ]] --
T.CreateDebuffs = function(self, button)
local Debuffs = CreateFrame("Frame", nil, self)
Debuffs.spacing = 6
Debuffs:SetFrameLevel(self:GetFrameLevel() + 4)
-- 選項
Debuffs.disableCooldown = true
Debuffs.showDebuffType = true
-- 註冊到ouf
self.Debuffs = Debuffs
self.Debuffs.PostCreateButton = T.PostCreateIcon
self.Debuffs.PostUpdateButton = T.PostUpdateIcon
self.Debuffs.FilterAura = T.CustomFilter
end
-- [[ 增益 ]] --
T.CreateBuffs = function(self, button)
local Buffs = CreateFrame("Frame", nil, self)
Buffs.spacing = 6
Buffs:SetFrameLevel(self:GetFrameLevel() + 4)
-- 選項
Buffs.disableCooldown = true
-- 註冊到ouf
self.Buffs = Buffs
self.Buffs.PostCreateButton = T.PostCreateIcon
self.Buffs.PostUpdateButton = T.PostUpdateIcon
self.Buffs.FilterAura = T.CustomFilter
end
-- [[ 光環 ]] --
T.CreateAuras = function(self, button)
local Auras = CreateFrame("Frame", nil, self)
Auras.spacing = 6
Auras.size = C.buSize
Auras:SetFrameLevel(self:GetFrameLevel() + 4)
if self.mystyle == "S" then
-- Simple focus
Auras.numBuffs = 2
Auras.numDebuffs = 4
Auras.numTotal = 4
Auras.gap = false
Auras.iconsPerRow = 4
Auras.initialAnchor = "BOTTOMLEFT"
Auras.tooltipAnchor = "ANCHOR_TOPRIGHT"
Auras["growth-x"] = "RIGHT"
Auras["growth-y"] = "UP"
Auras:SetPoint("BOTTOMLEFT", self.HealthText, "TOPLEFT", 3, 0)
Auras:SetWidth(C.buSize * Auras.numTotal + Auras.spacing * (Auras.numTotal - 1))
Auras:SetHeight(C.buSize)
else
if self.mystyle == "H" then
-- Player/Target/Focus
local iconsPerLine = math.floor(self:GetWidth() / (C.buSize + Auras.spacing) + 0.5)
Auras.numBuffs = iconsPerLine
Auras.numDebuffs = C.maxAura
Auras.numTotal = C.maxAura
Auras.gap = true
Auras.initialAnchor = "BOTTOMLEFT"
Auras.tooltipAnchor = "ANCHOR_TOPLEFT"
Auras["growth-x"] = "RIGHT"
Auras["growth-y"] = "UP"
Auras:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 1, C.PPOffset * 2 + C.PPHeight)
Auras:SetWidth(self:GetWidth())
Auras:SetHeight(C.buSize * (Auras.numTotal/iconsPerLine) + Auras.spacing * (Auras.numTotal/iconsPerLine-1))
else
-- VL=Player/VR=Target
local iconsPerLine = math.floor(self:GetHeight() / (C.buSize + Auras.spacing) + 0.5)
Auras.numBuffs = iconsPerLine
Auras.numDebuffs = C.maxAura
Auras.numTotal = C.maxAura
Auras.gap = true
Auras.initialAnchor = "BOTTOMRIGHT"
Auras["growth-x"] = "LEFT"
Auras["growth-y"] = "UP"
Auras:SetPoint("BOTTOMRIGHT", self.Health, "BOTTOMLEFT", -C.PPOffset - 1, 1)
Auras:SetWidth(C.buSize * (Auras.numTotal/iconsPerLine) + Auras.spacing * (Auras.numTotal/iconsPerLine-1))
Auras:SetHeight(self:GetHeight())
end
end
-- 選項
Auras.disableCooldown = true
Auras.showDebuffType = true
-- 註冊到ouf
self.Auras = Auras
self.Auras.SetPosition = T.SetPosition -- 為垂直排列重寫set position
self.Auras.PostCreateButton = T.PostCreateIcon
self.Auras.PostUpdateButton = T.PostUpdateIcon
if self.mystyle ~= "S" then
self.Auras.PostUpdateGapButton = T.PostUpdateGapIcon -- 間隔圖示
end
self.Auras.FilterAura = T.CustomFilter -- 光環過濾
self.Auras.PostUpdateInfo = T.BolsterPostUpdateInfo -- 激勵
end
--===================================================--
------------------ [[ Others ]] -----------------
--===================================================--
-- [[ 職業資源 ]] --
T.CreateClassPower = function(self, unit)
if not F.Multicheck(G.myClass, "PRIEST", "MAGE", "WARLOCK", "ROGUE", "MONK", "DRUID", "PALADIN", "DEATHKNIGHT", "EVOKER") then return end
--if F.Multicheck(G.myClass, "WARRIOR", "HUNTER", "SHAMAN") then return end
local isDK = G.myClass == "DEATHKNIGHT"
local maxPoint = (isDK and 6) or 7
local index = GetSpecialization() or 0
local id = GetSpecializationInfo(index)
local ClassPower = {}
for i = 1, maxPoint do
-- 創建總體條
ClassPower[i] = F.CreateStatusbar(self, G.addon..unit.."_ClassPowerBar"..i, "ARTWORK", nil, nil, 1, 1, 0, 1)
ClassPower[i].border = F.CreateSD(ClassPower[i], ClassPower[i], 4)
ClassPower[i]:SetFrameLevel(self:GetFrameLevel() + 2)
if self.mystyle == "VL" then
-- 單獨的每個豆子
ClassPower[i]:SetOrientation("VERTICAL")
ClassPower[i]:SetSize(C.PPHeight, (C.PWidth - (maxPoint-1)*C.PPOffset)/maxPoint)
if i == 1 then
ClassPower[i]:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", C.PPOffset, 0)
else
ClassPower[i]:SetPoint("BOTTOM", ClassPower[i-1], "TOP", 0, C.PPOffset)
end
elseif self.mystyle == "NPP" or self.mystyle == "BPP" then
ClassPower[i]:SetSize((C.PlayerNPWidth - (maxPoint-1)*C.PPOffset)/maxPoint, C.PPHeight)
if C.NumberStylePP then
if i == 1 then
ClassPower[i]:SetPoint("TOP", self.HealthText, "BOTTOM", -(C.PlayerNPWidth - 3*C.PPOffset)/2, -C.PPOffset)
else
ClassPower[i]:SetPoint("LEFT", ClassPower[i-1], "RIGHT", C.PPOffset, 0)
end
else
if i == 1 then
ClassPower[i]:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -4)
else
ClassPower[i]:SetPoint("LEFT", ClassPower[i-1], "RIGHT", C.PPOffset, 0)
end
end
else
ClassPower[i]:SetSize((C.PWidth - (maxPoint-1)*C.PPOffset)/maxPoint, C.PPHeight)
if i == 1 then
ClassPower[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, C.PPOffset)
else
ClassPower[i]:SetPoint("LEFT", ClassPower[i-1], "RIGHT", C.PPOffset, 0)
end
end
if isDK then
ClassPower[i].bg = ClassPower[i]:CreateTexture(nil, "BACKGROUND")
ClassPower[i].bg:SetAllPoints()
ClassPower[i].bg:SetTexture(G.media.blank)
ClassPower[i].bg.multiplier = .4
ClassPower[i].timer = F.CreateText(ClassPower[i], "OVERLAY", G.Font, G.NameFS, G.FontFlag, "CENTER")
ClassPower[i].timer:SetPoint("CENTER", 0, 0)
end
--[[if G.myClass == "EVOKER" then
ClassPower[i].bg = ClassPower[i]:CreateTexture(nil, "BACKGROUND")
ClassPower[i].bg:SetAllPoints()
ClassPower[i].bg:SetTexture(G.media.blank)
ClassPower[i].bg.multiplier = .4
ClassPower[i].timer = F.CreateText(ClassPower[i], "OVERLAY", G.Font, G.NameFS, G.FontFlag, "CENTER")
ClassPower[i].timer:SetPoint("CENTER", 0, 0)
end]]--
end
-- 註冊到ouf並整合符文顯示
if isDK then
ClassPower.colorSpec = true
ClassPower.sortOrder = "asc"
--ClassPower.__max = 6
self.Runes = ClassPower
self.Runes.PostUpdate = T.PostUpdateRunes
else
self.ClassPower = ClassPower
--self.ClassPower.PreUpdate = T.PostUpdateHolyPower
self.ClassPower.PostUpdate = T.PostUpdateClassPower
end
end
-- [[ 額外能量 暗牧鳥德薩滿的法力 ]] --
T.CreateAddPower = function(self, unit)
if not F.Multicheck(G.myClass, "DRUID", "SHAMAN", "PRIEST") then return end
-- 創建一個條
local AddPower = F.CreateStatusbar(self, G.addon..unit.."_AddPowerBar", "ARTWORK", nil, nil, 1, 1, 0, 1)
AddPower:SetFrameLevel(self:GetFrameLevel() + 2)
if C.vertPlayer then
AddPower:SetWidth(C.PPHeight)
AddPower:SetOrientation("VERTICAL")
AddPower:SetPoint("BOTTOMLEFT", self.Health, "BOTTOMRIGHT", C.PPOffset, 0)
AddPower:SetPoint("TOPLEFT", self.Health, "TOPRIGHT", C.PPOffset, 0)
else
AddPower:SetHeight(C.PPHeight)
AddPower:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, C.PPOffset)
AddPower:SetPoint("BOTTOMRIGHT", self.Health, "TOPRIGHT", 0, C.PPOffset)
end
-- 選項
AddPower.colorPower = true
-- 背景
AddPower.bg = AddPower:CreateTexture(nil, "BACKGROUND")
AddPower.bg:SetAllPoints()
AddPower.bg:SetTexture(G.media.blank)
AddPower.bg.multiplier = .3
-- 陰影
AddPower.border = F.CreateSD(AddPower, AddPower, 4)
-- 註冊到ouf
self.AdditionalPower = AddPower
-- 文本
self.AdditionalPower.value = F.CreateText(self.AdditionalPower, "OVERLAY", G.Font, G.NameFS, G.FontFlag, "LEFT")
end
-- [[ 特殊能量 ]] --
T.CreateAltPowerBar = function(self, unit)
local AltPower = F.CreateStatusbar(self, G.addon..unit.."_AltPowerBar", "ARTWORK", nil, nil, 1, 1, 0, 1)
AltPower:SetFrameLevel(self:GetFrameLevel() + 2)
-- 根據樣式創建條
if self.mystyle == "H" then
AltPower:SetHeight(C.PPHeight)
AltPower:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -C.PPOffset)
AltPower:SetPoint("TOPRIGHT", self.Power, "BOTTOMRIGHT", 0, -C.PPOffset)
else
AltPower:SetWidth(C.PPHeight)
AltPower:SetOrientation("VERTICAL")
-- 垂直模式分別在左右兩側
if self.mystyle == "VL" then
AltPower:SetPoint("TOPRIGHT", self.Power, "TOPLEFT", -C.PPOffset, 0)
AltPower:SetPoint("BOTTOMRIGHT", self.Power, "BOTTOMLEFT", -C.PPOffset, (C.PWidth - C.TOTWidth))
elseif self.mystyle == "VR" then
AltPower:SetPoint("TOPLEFT", self.Power, "TOPRIGHT", C.PPOffset, 0)
AltPower:SetPoint("BOTTOMLEFT", self.Power, "BOTTOMRIGHT", C.PPOffset, (C.PWidth - C.TOTWidth))
end
end
-- 背景
AltPower.bg = F.CreateBD(AltPower, AltPower, 1, .15, .15, .15, .6)
-- 陰影
AltPower.border = F.CreateSD(AltPower, AltPower, 4)
-- 註冊到ouf
self.AlternativePower = AltPower
self.AlternativePower.PostUpdate = T.PostUpdateAltPower
-- 文本
self.AlternativePower.value = F.CreateText(self.AlternativePower, "OVERLAY", G.Font, G.NameFS, G.FontFlag, "CENTER")
--self:Tag(self.AlternativePower.value, "[altpower]") --不用這個,用postupdate
end
-- [[ 酒池 ]] --
T.CreateStagger = function(self, unit)
if G.myClass ~= "MONK" then return end
local Stagger = F.CreateStatusbar(self, G.addon..unit.."_StaggerBar", "ARTWORK", nil, nil, 1, 1, 0, 1)
Stagger:SetFrameLevel(self:GetFrameLevel() + 2)
if C.vertPlayer then
Stagger:SetWidth(C.PPHeight)
Stagger:SetOrientation("VERTICAL")
Stagger:SetPoint("BOTTOMLEFT", self.Health, "BOTTOMRIGHT", C.PPOffset, 0)
Stagger:SetPoint("TOPLEFT", self.Health, "TOPRIGHT", C.PPOffset, 0)
else
Stagger:SetHeight(C.PPHeight)
Stagger:SetPoint("BOTTOMLEFT", self.Health, "TOPLEFT", 0, C.PPOffset)
Stagger:SetPoint("BOTTOMRIGHT", self.Health, "TOPRIGHT", 0, C.PPOffset)
end
-- 背景
Stagger.bg = Stagger:CreateTexture(nil, "BACKGROUND")
Stagger.bg:SetAllPoints()
Stagger.bg:SetTexture(G.media.blank)
Stagger.bg.multiplier = .3
-- 陰影
Stagger.border = F.CreateSD(Stagger, Stagger, 4)
-- 註冊到ouf
self.Stagger = Stagger
self.Stagger.PostUpdate = T.PostUpdateStagger
-- 文本
self.Stagger.value = F.CreateText(self.Stagger, "OVERLAY", G.Font, G.NameFS, G.FontFlag, nil)
if self.mystyle == "VL" then
self.Stagger.value:SetPoint("BOTTOMRIGHT", self.Power, "BOTTOMLEFT", -C.PPOffset, (G.NameFS + 2)*2)
self.Stagger.value:SetJustifyH("RIGHT")
else
self.Stagger.value:SetPoint("CENTER", self.Stagger, 0, 0)
self.Stagger.value:SetJustifyH("CENTER")
end
end
-- [[ 預估治療 ]] --
T.CreateHealthPrediction = function(self, unit)
-- Why GetSize()?
-- Unitframe和Raidframe的self大小等於self.health大小,且創建時用了Custom API,size是nil
-- Nameplate的self是點擊範圍,self.health是元素實際大小
-- Unitframe和Raidframe的吸收盾錨點相反是因為血量條反轉
-- 吸收盾
local abb = F.CreateStatusbar(self, G.addon..unit.."_AbsorbBar", "ARTWORK", nil, nil, 0, .5, .8, .5)
abb:SetFrameLevel(self:GetFrameLevel() + 2)
if self.mystyle == "VL" or self.mystyle == "VR" then
-- 直式
abb:SetOrientation("VERTICAL")
abb:SetSize(self:GetSize())
abb:SetPoint("BOTTOM", self.Health:GetStatusBarTexture(), "BOTTOM")
elseif F.Multicheck(self.mystyle, "H", "R") then
-- 橫式
abb:SetSize(self:GetSize())
abb:SetPoint("LEFT", self.Health:GetStatusBarTexture(), "LEFT")
elseif F.Multicheck(self.mystyle, "BP", "BPP") then
-- 條形名條
abb:SetSize(self.Health:GetSize())
abb:SetPoint("LEFT", self.Health:GetStatusBarTexture(), "RIGHT")
end
-- 滿血時的吸收盾
--[[local abbo = F.CreateStatusbar(self, G.addon..unit.."_OverAbsorbBar", "ARTWORK", nil, nil, 0, .5, .8, .5)
abbo:SetFrameLevel(self:GetFrameLevel() + 2)
if F.Multicheck(self.mystyle, "VL", "VR") then
-- 直式
abbo:SetOrientation("VERTICAL")
abbo:SetSize(self:GetSize())
abbo:SetPoint("TOP", self.Health:GetStatusBarTexture(), "BOTTOM")
elseif F.Multicheck(self.mystyle, "H", "R") then
-- 橫式
abbo:SetSize(self:GetSize())
abbo:SetPoint("RIGHT", self.Health:GetStatusBarTexture(), "LEFT")
elseif F.Multicheck(self.mystyle, "BP", "BPP") then
-- 條形名條
abbo:SetSize(self.Health:GetSize())
abbo:SetPoint("RIGHT", self.Health:GetStatusBarTexture(), "RIGHT")
end]]--
local abbo = self.Health:CreateTexture(nil, "OVERLAY")
abbo:SetTexture(G.media.blank, true, true)
abbo:SetBlendMode("ADD")
abbo:SetVertexColor( 0, .5, .8, .7)
if F.Multicheck(self.mystyle, "VL", "VR") then
-- 直式
abbo:SetSize(self:GetSize())
abbo:SetPoint("TOP", self.Health:GetStatusBarTexture(), "BOTTOM")
elseif F.Multicheck(self.mystyle, "H", "R") then
-- 橫式
abbo:SetSize(self:GetSize())
abbo:SetPoint("RIGHT", self.Health:GetStatusBarTexture(), "LEFT")
elseif F.Multicheck(self.mystyle, "BP", "BPP") then
-- 條形名條
abbo:SetSize(self.Health:GetSize())
abbo:SetPoint("RIGHT", self.Health:GetStatusBarTexture(), "RIGHT")
end
self.HealthPrediction = {
absorbBar = abb, -- 吸收盾
-- healAbsorbBar
overAbsorb = abbo, -- 過量吸收盾
-- overHealAbsorb
frequentUpdates = true,
maxOverflow = 1.01,
}
self.HealthPrediction.PostUpdate = T.PostUpdateHealthPrediction
end
-- [[ 坦克資源 ]] --
T.CreateTankResource = function(self, unit)
local TankResource = {}
local maxLength = 2
TankResource.overrideSpellOptions = {
["PALADIN"] = {
[432459] = {1, 1, 0},
[432472] = {0, 1, .92}
}
}
for i = 1, maxLength do
TankResource[i] = F.CreateStatusbar(self, G.addon..unit.."_TankResourceBar"..i, "ARTWORK", nil, nil, 1, 1, 0, 1)
TankResource[i].border = F.CreateSD(TankResource[i], TankResource[i], 4)
TankResource[i]:SetFrameLevel(self:GetFrameLevel() + 2)
-- 背景
TankResource[i].bg = TankResource[i]:CreateTexture(nil, "BACKGROUND")
TankResource[i].bg:SetAllPoints()
TankResource[i].bg:SetTexture(G.media.blank)
TankResource[i].bg.multiplier = .3
if self.mystyle == "VL" then
-- 單獨的每個豆子
TankResource[i]:SetOrientation("VERTICAL")
TankResource[i]:SetSize(C.PPHeight, (C.PWidth - C.PPOffset)/2)
if F.Multicheck(G.myClass, "DEATHKNIGHT", "MONK") then
-- DK的在符文前面,武僧的在酒池前面
if i == 1 then
TankResource[i]:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", C.PPOffset*2+C.PPHeight, 0)
else
TankResource[i]:SetPoint("BOTTOM", TankResource[i-1], "TOP", 0, C.PPOffset)
end
else
if i == 1 then
TankResource[i]:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", C.PPOffset, 0)
else
TankResource[i]:SetPoint("BOTTOM", TankResource[i-1], "TOP", 0, C.PPOffset)
end
end
else
TankResource[i]:SetSize((C.PWidth - C.PPOffset)/2, C.PPHeight)
if F.Multicheck(G.myClass, "DEATHKNIGHT", "MONK") then
-- DK的在符文上面,武僧的在酒池上面
if i == 1 then
TankResource[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, C.PPOffset*2+C.PPHeight)
else
TankResource[i]:SetPoint("LEFT", TankResource[i-1], "RIGHT", C.PPOffset, 0)
end
else
if i == 1 then
TankResource[i]:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, C.PPOffset)
else
TankResource[i]:SetPoint("LEFT", TankResource[i-1], "RIGHT", C.PPOffset, 0)
end
end
end
end
--[[
TankResource.colors = {
["WARRIOR"] = {.2,.5,.7},
["PALDAIN"] = {1, 1, 0},
["DEMONHUNTER"] = {.7,.6,.4},
["MONK"] = {.7,.6,.4},
}
]]--
-- Register with oUF
self.TankResource = TankResource
--self.TankResource.PostUpdate = T.PostUpdateTankResource
--self.TankResource.UpdateColor = T.PostUpdateTankResourceColor
end