-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunitframes.lua
More file actions
192 lines (163 loc) · 5.84 KB
/
Copy pathunitframes.lua
File metadata and controls
192 lines (163 loc) · 5.84 KB
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
local addonName, ns = ...
local oUF = ns.oUF or _G.oUF
-- Texture for bars
local texture = "Interface\\TargetingFrame\\UI-StatusBar"
local font = "Fonts\\FRIZQT__.TTF"
local function Shared(self, unit)
-- Base settings
self:SetScript('OnEnter', UnitFrame_OnEnter)
self:SetScript('OnLeave', UnitFrame_OnLeave)
self:RegisterForClicks('AnyUp')
-- Health Bar
local Health = CreateFrame("StatusBar", nil, self)
Health:SetPoint("TOP")
Health:SetPoint("LEFT")
Health:SetPoint("RIGHT")
Health:SetHeight(32) -- Fixed height, better for init
Health:SetStatusBarTexture(texture)
Health.colorTapping = true
Health.colorDisconnected = true
Health.colorClass = true
Health.colorReaction = true
local HealthBG = Health:CreateTexture(nil, "BACKGROUND")
HealthBG:SetAllPoints()
HealthBG:SetTexture(texture)
HealthBG.multiplier = 0.3
Health.bg = HealthBG
-- Health Text
local HealthText = Health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
HealthText:SetPoint("RIGHT", Health, "RIGHT", -2, 0)
HealthText:SetFont(font, 12, "OUTLINE")
self:Tag(HealthText, "[curhp] - [perhp]%")
Health.value = HealthText
self.Health = Health
-- Power Bar
local Power = CreateFrame("StatusBar", nil, self)
Power:SetPoint("TOP", Health, "BOTTOM", 0, -1)
Power:SetPoint("LEFT")
Power:SetPoint("RIGHT")
Power:SetHeight(7) -- Fixed height, better for init
Power:SetStatusBarTexture(texture)
Power.colorPower = true
local PowerBG = Power:CreateTexture(nil, "BACKGROUND")
PowerBG:SetAllPoints()
PowerBG:SetTexture(texture)
PowerBG.multiplier = 0.3
Power.bg = PowerBG
-- Power Text
local PowerText = Power:CreateFontString(nil, "OVERLAY", "GameFontNormal")
PowerText:SetPoint("LEFT", Power, "LEFT", 2, 0)
PowerText:SetFont(font, 10, "OUTLINE")
self:Tag(PowerText, "[curpp]")
Power.value = PowerText
self.Power = Power
-- Name
local Name = Health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
Name:SetPoint("LEFT", Health, "LEFT", 2, 0)
Name:SetFont(font, 12, "OUTLINE")
self:Tag(Name, "[name]")
self.Name = Name
-- Castbar
local Castbar = CreateFrame("StatusBar", nil, self)
Castbar:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -5)
Castbar:SetPoint("TOPRIGHT", self, "BOTTOMRIGHT", 0, -5)
Castbar:SetHeight(15)
Castbar:SetStatusBarTexture(texture)
Castbar:SetStatusBarColor(1, 0.7, 0)
local CastbarBG = Castbar:CreateTexture(nil, "BACKGROUND")
CastbarBG:SetAllPoints()
CastbarBG:SetTexture(texture)
CastbarBG:SetVertexColor(0.2, 0.2, 0.2, 0.8)
local CastbarText = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormal")
CastbarText:SetPoint("LEFT", Castbar, "LEFT", 2, 0)
CastbarText:SetFont(font, 10, "OUTLINE")
Castbar.Text = CastbarText
local CastbarTime = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormal")
CastbarTime:SetPoint("RIGHT", Castbar, "RIGHT", -2, 0)
CastbarTime:SetFont(font, 10, "OUTLINE")
Castbar.Time = CastbarTime
local CastbarIcon = Castbar:CreateTexture(nil, "OVERLAY")
CastbarIcon:SetSize(15, 15)
CastbarIcon:SetPoint("RIGHT", Castbar, "LEFT", -2, 0)
Castbar.Icon = CastbarIcon
self.Castbar = Castbar
-- Auras (Buffs & Debuffs)
local Auras = CreateFrame("Frame", nil, self)
Auras:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 5)
Auras:SetSize(self:GetWidth() > 0 and self:GetWidth() or 200, 30)
Auras.size = 30
Auras.numBuffs = 8
Auras.numDebuffs = 8
Auras.spacing = 2
Auras.initialAnchor = "BOTTOMLEFT"
Auras["growth-x"] = "RIGHT"
Auras["growth-y"] = "UP"
self.Auras = Auras
end
-- Register layout
oUF:RegisterStyle("WoWUI", Shared)
oUF:SetActiveStyle("WoWUI")
-- Spawn frames
local player = oUF:Spawn("player", "WoWUIPlayer")
player:SetSize(200, 40)
player:SetPoint("CENTER", -150, -150)
ns.WoWUI:RegisterMovable(player, "PlayerFrame")
local target = oUF:Spawn("target", "WoWUITarget")
target:SetSize(200, 40)
target:SetPoint("CENTER", 150, -150)
ns.WoWUI:RegisterMovable(target, "TargetFrame")
local pet = oUF:Spawn("pet", "WoWUIPet")
pet:SetSize(100, 20)
pet:SetPoint("TOPLEFT", player, "BOTTOMLEFT", 0, -25)
ns.WoWUI:RegisterMovable(pet, "PetFrame")
-- Party Group
local party = oUF:SpawnHeader("WoWUIParty", nil, "party",
"showParty", true,
"showPlayer", true,
"showSolo", false,
"yOffset", -20,
"oUF-initialConfigFunction", [[
self:SetWidth(150)
self:SetHeight(30)
]]
)
party:SetPoint("TOPLEFT", 20, -200)
-- Registering a header for moving works differently, wrapping it in a frame
local partyMover = CreateFrame("Frame", "WoWUIPartyMover", UIParent)
partyMover:SetSize(150, 200)
partyMover:SetPoint("TOPLEFT", 20, -200)
party:SetPoint("TOPLEFT", partyMover, "TOPLEFT")
ns.WoWUI:RegisterMovable(partyMover, "PartyFrames")
-- Raid Group
local raid = oUF:SpawnHeader("WoWUIRaid", nil, "raid",
"showRaid", true,
"showParty", false,
"showSolo", false,
"xOffset", 5,
"yOffset", -5,
"groupFilter", "1,2,3,4,5,6,7,8",
"groupBy", "GROUP",
"groupingOrder", "1,2,3,4,5,6,7,8",
"sortMethod", "INDEX",
"maxColumns", 8,
"unitsPerColumn", 5,
"columnSpacing", 5,
"point", "TOP",
"columnAnchorPoint", "LEFT",
"oUF-initialConfigFunction", [[
self:SetWidth(80)
self:SetHeight(25)
]]
)
raid:SetPoint("TOPLEFT", 20, -200)
local raidMover = CreateFrame("Frame", "WoWUIRaidMover", UIParent)
raidMover:SetSize(400, 150)
raidMover:SetPoint("TOPLEFT", 20, -20)
raid:SetPoint("TOPLEFT", raidMover, "TOPLEFT")
ns.WoWUI:RegisterMovable(raidMover, "RaidFrames")
-- Add unit frames to the global table
table.insert(ns.WoWUI.unitFrames, player)
table.insert(ns.WoWUI.unitFrames, target)
table.insert(ns.WoWUI.unitFrames, pet)
table.insert(ns.WoWUI.unitFrames, party)
table.insert(ns.WoWUI.unitFrames, raid)