-
Notifications
You must be signed in to change notification settings - Fork 0
/
oUF_EPMT.lua
108 lines (91 loc) · 3.05 KB
/
oUF_EPMT.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
local _, ns = ...
local config = ns.config
-- power bar function
local addPowerBar
do
local PostUpdatePower = ns.PostUpdatePower
function addPowerBar(self, isTarget)
local power = CreateFrame('StatusBar', nil, self)
power:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, 0)
power:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 0, 0)
power:SetPoint('TOP', self.Health, 'BOTTOM', 0, -1)
power:SetStatusBarTexture(config.TEXTURE)
power:SetHeight(config.POWERHEIGHT)
power.colorTapping = isTarget
power.colorDisconnected = true
power.colorClass = true
power.colorReaction = isTarget
power.PostUpdate = PostUpdatePower
local powerBG = power:CreateTexture(nil, 'BORDER')
powerBG:SetAllPoints(power)
powerBG:SetTexture(1 / 3, 1 / 3, 1 / 3)
power.bg = powerBG
self.Power = power
end
end
-- Tag function
local function addTags(self)
local healthValue = self.Health:CreateFontString(nil, 'OVERLAY')
healthValue:SetPoint('RIGHT', self.Health, 'RIGHT', -2, 0)
healthValue:SetFont(config.FONT, config.FONTSIZE, config.FONTBORDER)
healthValue:SetJustifyH('RIGHT')
self:Tag(healthValue, '[ep:smallhealth]')
local name = self.Health:CreateFontString(nil, 'OVERLAY')
name:SetPoint('LEFT', self.Health, 'LEFT', 2, 0)
name:SetPoint('RIGHT', healthValue, 'LEFT', -config.SPACING, 0)
name:SetFont(config.FONT, config.FONTSIZE, config.FONTBORDER)
name:SetJustifyH('LEFT')
self:Tag(name, '[ep:name]')
end
local Style
do
local addHealthBar = ns.addHealthBar
local addRaidIcon = ns.addRaidIcon
local addRange = ns.addRange
local addMenu = ns.addMenu
function Style(self, unit)
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
self:SetBackdrop(config.BACKDROP)
self:SetBackdropColor(0, 0, 0)
addMenu(self)
addHealthBar(self)
addPowerBar(self, self:GetAttribute('unitsuffix') == 'target')
addRaidIcon(self)
addTags(self)
if self:GetAttribute('unitsuffix') ~= 'target' then
addRange(self)
end
end
end
oUF:RegisterStyle('oUF_EPMT', Style)
oUF:Factory(function(self)
self:SetActiveStyle('oUF_EPMT')
local MTFrame = self:SpawnHeader(nil, nil, 'raid',
'showRaid', true,
'yOffset', -10,
'groupFilter', 'MAINTANK',
'initial-width', config.TERTIARYUNITWIDTH,
'initial-height', config.UNITHEIGHT,
'oUF-initialConfigFunction', [[
local header = self:GetParent()
self:SetWidth(header:GetAttribute('initial-width'))
self:SetHeight(header:GetAttribute('initial-height'))
]]
)
MTFrame:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 15, -350)
local MTTFrame = self:SpawnHeader(nil, nil, 'raid',
'showRaid', true,
'yOffset', -10,
'groupFilter', 'MAINTANK',
'initial-width', config.TERTIARYUNITWIDTH,
'initial-height', config.UNITHEIGHT,
'oUF-initialConfigFunction', [[
local header = self:GetParent()
self:SetWidth(header:GetAttribute('initial-width'))
self:SetHeight(header:GetAttribute('initial-height'))
self:SetAttribute('unitsuffix', 'target')
]]
)
MTTFrame:SetPoint('TOPLEFT', MTFrame, 'TOPRIGHT', config.SPACING, 0)
end)