File src/ChorusAuraButtonTemplate.lua changed (mode: 100644) (index d463caf..b760491) |
... |
... |
local function applyOverlay(auraButton, category) |
62 |
62 |
g = colorTuple.g |
g = colorTuple.g |
63 |
63 |
b = colorTuple.b |
b = colorTuple.b |
64 |
64 |
end |
end |
|
65 |
|
|
65 |
66 |
local overlay = auraButton.overlay |
local overlay = auraButton.overlay |
66 |
67 |
assert(overlay ~= nil) |
assert(overlay ~= nil) |
|
68 |
|
|
67 |
69 |
overlay:SetVertexColor(r, g, b) |
overlay:SetVertexColor(r, g, b) |
|
70 |
|
|
68 |
71 |
end |
end |
69 |
72 |
|
|
70 |
73 |
local function applyDuration(auraButton, now, durationSec, expirationInstance) |
local function applyDuration(auraButton, now, durationSec, expirationInstance) |
|
... |
... |
local function applyDuration(auraButton, now, durationSec, expirationInstance) |
100 |
103 |
end |
end |
101 |
104 |
|
|
102 |
105 |
label:SetText(t) |
label:SetText(t) |
|
106 |
|
|
|
107 |
|
if auraButton:GetHeight() >= 24 then |
|
108 |
|
label:SetJustifyV('BOTTOM') |
|
109 |
|
else |
|
110 |
|
label:SetJustifyV('CENTER') |
|
111 |
|
end |
103 |
112 |
end |
end |
104 |
113 |
|
|
105 |
114 |
local function auraButtonUpdateProcessor(self) |
local function auraButtonUpdateProcessor(self) |
|
... |
... |
local function auraButtonUpdateProcessor(self) |
113 |
122 |
applyDuration(self, GetTime(), durationSec, expirationInstance) |
applyDuration(self, GetTime(), durationSec, expirationInstance) |
114 |
123 |
end |
end |
115 |
124 |
|
|
|
125 |
|
local function applySize(auraButton) |
|
126 |
|
assert(auraButton ~= nil) |
|
127 |
|
|
|
128 |
|
local p = auraButton:GetParent() |
|
129 |
|
if not p then |
|
130 |
|
auraButton:SetSize(36, 36) |
|
131 |
|
return |
|
132 |
|
end |
|
133 |
|
|
|
134 |
|
local minSize = 12 |
|
135 |
|
local maxSize = 64 |
|
136 |
|
|
|
137 |
|
local a = auraButton:GetWidth() |
|
138 |
|
a = math.min(a, p:GetWidth()) |
|
139 |
|
a = math.min(math.max(minSize, a), maxSize) |
|
140 |
|
|
|
141 |
|
local b = auraButton:GetWidth() |
|
142 |
|
b = math.min(b, p:GetHeight()) |
|
143 |
|
b = math.min(math.max(minSize, b), maxSize) |
|
144 |
|
|
|
145 |
|
local c = math.min(a, b) |
|
146 |
|
auraButton:SetSize(c, c) |
|
147 |
|
|
|
148 |
|
local t = {auraButton.artwork, auraButton.overlay} |
|
149 |
|
local i = 0 |
|
150 |
|
while (i < #t) do |
|
151 |
|
i = i + 1 |
|
152 |
|
local e = t[i] |
|
153 |
|
assert(e ~= nil) |
|
154 |
|
local d = math.min(e:GetWidth(), e:GetHeight()) |
|
155 |
|
d = math.min(math.max(minSize, d), maxSize) |
|
156 |
|
e:SetSize(d, d) |
|
157 |
|
e:SetPoint('BOTTOMLEFT', (auraButton:GetWidth() - d) / 2, 0) |
|
158 |
|
end |
|
159 |
|
end |
|
160 |
|
|
116 |
161 |
local function apply(auraButton, unitDesignation, auraIndex, filter) |
local function apply(auraButton, unitDesignation, auraIndex, filter) |
117 |
162 |
auraButtonValidate(auraButton) |
auraButtonValidate(auraButton) |
118 |
163 |
|
|
|
... |
... |
local function apply(auraButton, unitDesignation, auraIndex, filter) |
149 |
194 |
return |
return |
150 |
195 |
end |
end |
151 |
196 |
|
|
|
197 |
|
applySize(auraButton) |
152 |
198 |
applyArtwork(auraButton, artworkFile, owner) |
applyArtwork(auraButton, artworkFile, owner) |
153 |
199 |
applyOverlay(auraButton, category) |
applyOverlay(auraButton, category) |
154 |
200 |
applyDuration(auraButton, GetTime(), durationSec, expirationInstance) |
applyDuration(auraButton, GetTime(), durationSec, expirationInstance) |
File src/ChorusProgressFrameTemplate.lua changed (mode: 100644) (index 06053c7..98e309b) |
... |
... |
local function validateProgressFrame(self) |
36 |
36 |
assert(string.len(strategy) >= 1) |
assert(string.len(strategy) >= 1) |
37 |
37 |
assert(string.len(strategy) <= 8192) |
assert(string.len(strategy) <= 8192) |
38 |
38 |
|
|
39 |
|
local unitDesignation = self.unit |
|
|
39 |
|
local unitDesignation = self.unit or 'none' |
40 |
40 |
assert('string' == type(unitDesignation)) |
assert('string' == type(unitDesignation)) |
41 |
41 |
unitDesignation = string.lower(strtrim(unitDesignation)) |
unitDesignation = string.lower(strtrim(unitDesignation)) |
42 |
42 |
assert(string.len(unitDesignation) >= 1) |
assert(string.len(unitDesignation) >= 1) |
|
... |
... |
local function healthFrameEventProcessor(self) |
262 |
262 |
unitDesignation = unitDesignation or p.unit |
unitDesignation = unitDesignation or p.unit |
263 |
263 |
end |
end |
264 |
264 |
|
|
|
265 |
|
unitDesignation = unitDesignation or 'none' |
|
266 |
|
|
265 |
267 |
assert(unitDesignation ~= nil) |
assert(unitDesignation ~= nil) |
266 |
268 |
assert('string' == type(unitDesignation)) |
assert('string' == type(unitDesignation)) |
267 |
269 |
unitDesignation = string.lower(strtrim(unitDesignation)) |
unitDesignation = string.lower(strtrim(unitDesignation)) |
|
... |
... |
end |
416 |
418 |
function Chorus.healthFrameMain(self, ...) |
function Chorus.healthFrameMain(self, ...) |
417 |
419 |
Chorus.progressFrameMain(self, ...) |
Chorus.progressFrameMain(self, ...) |
418 |
420 |
self.strategy = 'UnitIsFriend' |
self.strategy = 'UnitIsFriend' |
|
421 |
|
self.unit = 'none' |
419 |
422 |
self:SetScript('OnEvent', healthFrameEventProcessor) |
self:SetScript('OnEvent', healthFrameEventProcessor) |
420 |
423 |
|
|
421 |
424 |
self:RegisterEvent('UNIT_HEALTH') |
self:RegisterEvent('UNIT_HEALTH') |
|
... |
... |
end |
424 |
427 |
function Chorus.powerFrameMain(self, ...) |
function Chorus.powerFrameMain(self, ...) |
425 |
428 |
Chorus.progressFrameMain(self, ...) |
Chorus.progressFrameMain(self, ...) |
426 |
429 |
self.strategy = 'UnitPowerType' |
self.strategy = 'UnitPowerType' |
|
430 |
|
self.unit = 'none' |
427 |
431 |
self:SetScript('OnEvent', powerFrameEventProcessor) |
self:SetScript('OnEvent', powerFrameEventProcessor) |
428 |
432 |
|
|
429 |
433 |
self:RegisterEvent('UNIT_ENERGY') |
self:RegisterEvent('UNIT_ENERGY') |
File src/ChorusRaidUnitButtonTemplate.lua added (mode: 100644) (index 0000000..d7812c2) |
|
1 |
|
local Chorus = Chorus |
|
2 |
|
|
|
3 |
|
function Chorus.raidUnitButtonAttributeChangedProcessor(self, name, value) |
|
4 |
|
assert(self ~= nil) |
|
5 |
|
|
|
6 |
|
assert(name ~= nil) |
|
7 |
|
assert('string' == type(name)) |
|
8 |
|
name = strtrim(name) |
|
9 |
|
assert(string.len(name) >= 1) |
|
10 |
|
assert(string.len(name) <= 256) |
|
11 |
|
|
|
12 |
|
if not tContains({'unit'}, name) then |
|
13 |
|
return |
|
14 |
|
end |
|
15 |
|
|
|
16 |
|
self[name] = value |
|
17 |
|
|
|
18 |
|
local t = {self:GetChildren()} |
|
19 |
|
local i = 0 |
|
20 |
|
while (i < #t) do |
|
21 |
|
i = i + 1 |
|
22 |
|
local e = t[i] |
|
23 |
|
if nil == e then |
|
24 |
|
break |
|
25 |
|
end |
|
26 |
|
e[name] = value |
|
27 |
|
e:SetAttribute(name, value) |
|
28 |
|
end |
|
29 |
|
end |
|
30 |
|
|
|
31 |
|
function Chorus.raidUnitButtonMain(self) |
|
32 |
|
local buffFrame = _G[self:GetName() .. 'BuffFrame'] |
|
33 |
|
assert(buffFrame ~= nil) |
|
34 |
|
buffFrame.filter = 'HELPFUL RAID' |
|
35 |
|
|
|
36 |
|
local debuffFrame = _G[self:GetName() .. 'DebuffFrame'] |
|
37 |
|
assert(debuffFrame ~= nil) |
|
38 |
|
debuffFrame.filter = 'HARMFUL RAID' |
|
39 |
|
|
|
40 |
|
local healthFrame = _G[self:GetName() .. 'HealthFrame'] |
|
41 |
|
assert(healthFrame ~= nil) |
|
42 |
|
healthFrame.strategy = 'UnitClass' |
|
43 |
|
|
|
44 |
|
self:RegisterForClicks('AnyUp') |
|
45 |
|
self:SetAttribute('unit', 'none') |
|
46 |
|
self:SetAttribute('type1', 'target') |
|
47 |
|
--[[ TODO Add menu popup for unit frames ]]-- |
|
48 |
|
end |
File src/ChorusRaidUnitButtonTemplate.xml added (mode: 100644) (index 0000000..6f7a673) |
|
1 |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
<Ui xmlns="http://www.blizzard.com/wow/ui/"> |
|
3 |
|
<Script file="ChorusRaidUnitButtonTemplate.lua"/> |
|
4 |
|
<Button name="ChorusRaidUnitButtonTemplate" toplevel="true" inherits="SecureUnitButtonTemplate" virtual="true"> |
|
5 |
|
<Size> |
|
6 |
|
<AbsDimension x="144" y="84"/> |
|
7 |
|
</Size> |
|
8 |
|
<Layers> |
|
9 |
|
<Layer level="BACKGROUND"> |
|
10 |
|
<Texture name="$parentBackground"> |
|
11 |
|
<Color r="0" g="0" b="0"/> |
|
12 |
|
</Texture> |
|
13 |
|
</Layer> |
|
14 |
|
</Layers> |
|
15 |
|
<Frames> |
|
16 |
|
<Frame name="$parentUnitNameFrame" inherits="ChorusUnitNameFrameTemplate"> |
|
17 |
|
<Size> |
|
18 |
|
<AbsDimension x="72" y="24"/> |
|
19 |
|
</Size> |
|
20 |
|
<Anchors> |
|
21 |
|
<Anchor point="TOPLEFT"> |
|
22 |
|
<Offset> |
|
23 |
|
<AbsDimension x="0" y="0"/> |
|
24 |
|
</Offset> |
|
25 |
|
</Anchor> |
|
26 |
|
</Anchors> |
|
27 |
|
</Frame> |
|
28 |
|
<Frame name="$parentHealthFrame" inherits="ChorusHealthFrameTemplate" setAllPoints="true"> |
|
29 |
|
<Size> |
|
30 |
|
<AbsDimension x="144" y="36"/> |
|
31 |
|
</Size> |
|
32 |
|
<Anchors> |
|
33 |
|
<Anchor point="TOPLEFT"> |
|
34 |
|
<Offset> |
|
35 |
|
<AbsDimension x="0" y="0"/> |
|
36 |
|
</Offset> |
|
37 |
|
</Anchor> |
|
38 |
|
</Anchors> |
|
39 |
|
</Frame> |
|
40 |
|
<Frame name="$parentBuffFrame" inherits="ChorusAuraFrameTemplate"> |
|
41 |
|
<Size> |
|
42 |
|
<AbsDimension x="144" y="24"/> |
|
43 |
|
</Size> |
|
44 |
|
<Anchors> |
|
45 |
|
<Anchor point="TOPLEFT"> |
|
46 |
|
<Offset> |
|
47 |
|
<AbsDimension x="0" y="-36"/> |
|
48 |
|
</Offset> |
|
49 |
|
</Anchor> |
|
50 |
|
</Anchors> |
|
51 |
|
</Frame> |
|
52 |
|
<Frame name="$parentDebuffFrame" inherits="ChorusAuraFrameTemplate"> |
|
53 |
|
<Size> |
|
54 |
|
<AbsDimension x="144" y="24"/> |
|
55 |
|
</Size> |
|
56 |
|
<Anchors> |
|
57 |
|
<Anchor point="TOPLEFT" relativeTo="$parentBuffFrame" relativePoint="BOTTOMLEFT"> |
|
58 |
|
<Offset> |
|
59 |
|
<AbsDimension x="0" y="0"/> |
|
60 |
|
</Offset> |
|
61 |
|
</Anchor> |
|
62 |
|
</Anchors> |
|
63 |
|
</Frame> |
|
64 |
|
</Frames> |
|
65 |
|
<Scripts> |
|
66 |
|
<OnAttributeChanged> |
|
67 |
|
Chorus.raidUnitButtonAttributeChangedProcessor(self, name, value); |
|
68 |
|
</OnAttributeChanged> |
|
69 |
|
<OnLoad> |
|
70 |
|
Chorus.raidUnitButtonMain(self); |
|
71 |
|
</OnLoad> |
|
72 |
|
<OnEnter function="UnitFrame_OnEnter"/> |
|
73 |
|
<OnLeave function="UnitFrame_OnLeave"/> |
|
74 |
|
</Scripts> |
|
75 |
|
</Button> |
|
76 |
|
</Ui> |
File src/ChorusTestFrame.xml changed (mode: 100644) (index df2ca1f..9c0b77f) |
1 |
1 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
2 |
2 |
<Ui xmlns="http://www.blizzard.com/wow/ui/"> |
<Ui xmlns="http://www.blizzard.com/wow/ui/"> |
3 |
|
<Frame name="ChorusTestFrame"> |
|
|
3 |
|
<Frame name="ChorusPartyFrame" inherits="SecurePartyHeaderTemplate"> |
|
4 |
|
<Size> |
|
5 |
|
<AbsDimension x="800" y="600"/> |
|
6 |
|
</Size> |
|
7 |
|
<Anchors> |
|
8 |
|
<Anchor point="TOPLEFT"> |
|
9 |
|
<Offset> |
|
10 |
|
<AbsDimension x="0" y="0"/> |
|
11 |
|
</Offset> |
|
12 |
|
</Anchor> |
|
13 |
|
</Anchors> |
|
14 |
|
</Frame> |
|
15 |
|
<Frame name="ChorusRaidFrame" inherits="SecureRaidGroupHeaderTemplate"> |
4 |
16 |
<Size> |
<Size> |
5 |
|
<AbsDimension x="216" y="144"/> |
|
|
17 |
|
<AbsDimension x="800" y="600"/> |
6 |
18 |
</Size> |
</Size> |
7 |
19 |
<Anchors> |
<Anchors> |
8 |
20 |
<Anchor point="TOPLEFT"> |
<Anchor point="TOPLEFT"> |
9 |
21 |
<Offset> |
<Offset> |
10 |
|
<AbsDimension x="512" y="0"/> |
|
|
22 |
|
<AbsDimension x="0" y="0"/> |
11 |
23 |
</Offset> |
</Offset> |
12 |
24 |
</Anchor> |
</Anchor> |
|
25 |
|
</Anchors> |
|
26 |
|
</Frame> |
|
27 |
|
<Frame name="ChorusTestFrame"> |
|
28 |
|
<Size> |
|
29 |
|
<AbsDimension x="800" y="600"/> |
|
30 |
|
</Size> |
|
31 |
|
<Anchors> |
13 |
32 |
<Anchor point="CENTER"> |
<Anchor point="CENTER"> |
14 |
33 |
<Offset> |
<Offset> |
15 |
34 |
<AbsDimension x="0" y="0"/> |
<AbsDimension x="0" y="0"/> |
16 |
35 |
</Offset> |
</Offset> |
17 |
36 |
</Anchor> |
</Anchor> |
18 |
37 |
</Anchors> |
</Anchors> |
19 |
|
<Frames> |
|
20 |
|
<Frame name="ChorusTestTargetUnitNameFrame" inherits="ChorusUnitNameFrameTemplate"> |
|
21 |
|
<Anchors> |
|
22 |
|
<Anchor point="BOTTOMLEFT"> |
|
23 |
|
<Offset> |
|
24 |
|
<AbsDimension x="0" y="110"/> |
|
25 |
|
</Offset> |
|
26 |
|
</Anchor> |
|
27 |
|
</Anchors> |
|
28 |
|
</Frame> |
|
29 |
|
<Frame name="ChorusTestTargetHealthFrame" inherits="ChorusHealthFrameTemplate"> |
|
30 |
|
<Anchors> |
|
31 |
|
<Anchor point="BOTTOMLEFT"> |
|
32 |
|
<Offset> |
|
33 |
|
<AbsDimension x="0" y="86"/> |
|
34 |
|
</Offset> |
|
35 |
|
</Anchor> |
|
36 |
|
</Anchors> |
|
37 |
|
</Frame> |
|
38 |
|
<Frame name="ChorusTestTargetPowerFrame" inherits="ChorusPowerFrameTemplate"> |
|
39 |
|
<Size> |
|
40 |
|
<AbsDimension x="144" y="12"/> |
|
41 |
|
</Size> |
|
42 |
|
<Anchors> |
|
43 |
|
<Anchor point="BOTTOMLEFT"> |
|
44 |
|
<Offset> |
|
45 |
|
<AbsDimension x="0" y="72"/> |
|
46 |
|
</Offset> |
|
47 |
|
</Anchor> |
|
48 |
|
</Anchors> |
|
49 |
|
</Frame> |
|
50 |
|
<Frame name="ChorusTestTargetBuffFrame" inherits="ChorusAuraFrameTemplate"> |
|
51 |
|
<Anchors> |
|
52 |
|
<Anchor point="BOTTOMLEFT"> |
|
53 |
|
<Offset> |
|
54 |
|
<AbsDimension x="0" y="36"/> |
|
55 |
|
</Offset> |
|
56 |
|
</Anchor> |
|
57 |
|
</Anchors> |
|
58 |
|
</Frame> |
|
59 |
|
<Frame name="ChorusTestTargetDebuffFrame" inherits="ChorusAuraFrameTemplate"> |
|
60 |
|
<Anchors> |
|
61 |
|
<Anchor point="BOTTOMLEFT"> |
|
62 |
|
<Offset> |
|
63 |
|
<AbsDimension x="0" y="0"/> |
|
64 |
|
</Offset> |
|
65 |
|
</Anchor> |
|
66 |
|
</Anchors> |
|
67 |
|
</Frame> |
|
68 |
|
</Frames> |
|
69 |
38 |
<Scripts> |
<Scripts> |
70 |
39 |
<OnLoad> |
<OnLoad> |
71 |
|
ChorusTestTargetBuffFrame.filter = 'HELPFUL'; |
|
72 |
|
ChorusTestTargetBuffFrame.unit = 'target'; |
|
73 |
|
ChorusTestTargetDebuffFrame.filter = 'HARMFUL'; |
|
74 |
|
ChorusTestTargetDebuffFrame.unit = 'target'; |
|
75 |
|
ChorusTestTargetHealthFrame.strategy = 'UnitIsFriend'; |
|
76 |
|
ChorusTestTargetHealthFrame.unit = 'target'; |
|
77 |
|
ChorusTestTargetPowerFrame.unit = 'target'; |
|
78 |
|
ChorusTestTargetUnitNameFrame.unit = 'target'; |
|
79 |
|
ChorusTestTargetPowerFrame.strategy = 'UnitPowerType'; |
|
|
40 |
|
ChorusPartyFrame:SetAttribute('template', 'ChorusRaidUnitButtonTemplate'); |
|
41 |
|
ChorusPartyFrame:SetAttribute('maxColumns', 5); |
|
42 |
|
ChorusRaidFrame:SetAttribute('template', 'ChorusRaidUnitButtonTemplate'); |
|
43 |
|
ChorusRaidFrame:SetAttribute('maxColumns', 5); |
|
44 |
|
self:RegisterEvent('PARTY_MEMBERS_CHANGED'); |
|
45 |
|
self:RegisterEvent('PARTY_CONVERTED_TO_RAID'); |
80 |
46 |
</OnLoad> |
</OnLoad> |
81 |
47 |
</Scripts> |
</Scripts> |
82 |
48 |
</Frame> |
</Frame> |
File src/ChorusUnitNameFrameTemplate.lua changed (mode: 100644) (index 97bcf88..890bf97) |
... |
... |
local function unitNameEventProcessor(self) |
11 |
11 |
local label = self.label |
local label = self.label |
12 |
12 |
assert(label ~= nil) |
assert(label ~= nil) |
13 |
13 |
|
|
14 |
|
local unitDesignation = self.unit |
|
|
14 |
|
local unitDesignation = self.unit or 'none' |
|
15 |
|
assert(unitDesignation ~= nil) |
15 |
16 |
assert('string' == type(unitDesignation)) |
assert('string' == type(unitDesignation)) |
16 |
17 |
unitDesignation = string.lower(strtrim(unitDesignation)) |
unitDesignation = string.lower(strtrim(unitDesignation)) |
17 |
18 |
assert(string.len(unitDesignation) >= 1) |
assert(string.len(unitDesignation) >= 1) |
|
... |
... |
local function unitNameEventProcessor(self) |
20 |
21 |
local name = UnitName(unitDesignation) |
local name = UnitName(unitDesignation) |
21 |
22 |
label:SetText(name) |
label:SetText(name) |
22 |
23 |
|
|
|
24 |
|
if not self.strategy then |
|
25 |
|
return |
|
26 |
|
elseif 'UnitClass' ~= self.strategy then |
|
27 |
|
return |
|
28 |
|
end |
|
29 |
|
|
23 |
30 |
local _, classDesignation = UnitClass(unitDesignation) |
local _, classDesignation = UnitClass(unitDesignation) |
24 |
31 |
if not classDesignation or not UnitIsPlayer(unitDesignation) then |
if not classDesignation or not UnitIsPlayer(unitDesignation) then |
25 |
32 |
label:SetTextColor(1, 1, 1) |
label:SetTextColor(1, 1, 1) |
|
... |
... |
function Chorus.unitNameFrameMain(self) |
51 |
58 |
assert(label ~= nil) |
assert(label ~= nil) |
52 |
59 |
self.label = label |
self.label = label |
53 |
60 |
|
|
|
61 |
|
self.unit = 'none' |
|
62 |
|
|
54 |
63 |
self:SetScript('OnEvent', unitNameEventProcessor) |
self:SetScript('OnEvent', unitNameEventProcessor) |
55 |
64 |
|
|
56 |
65 |
self:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
self:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
|
... |
... |
function Chorus.unitNameFrameMain(self) |
62 |
71 |
self:RegisterEvent('PLAYER_LOGIN') |
self:RegisterEvent('PLAYER_LOGIN') |
63 |
72 |
self:RegisterEvent('PLAYER_TARGET_CHANGED') |
self:RegisterEvent('PLAYER_TARGET_CHANGED') |
64 |
73 |
self:RegisterEvent('RAID_ROSTER_UPDATE') |
self:RegisterEvent('RAID_ROSTER_UPDATE') |
|
74 |
|
self:RegisterEvent('UNIT_NAME_UPDATE') |
65 |
75 |
end |
end |