File chorus.toc changed (mode: 100644) (index 1096ef5..2d0e2e9) |
... |
... |
src\ChorusAuraFrameTemplate.xml |
8 |
8 |
src\ChorusProgressFrameTemplate.xml |
src\ChorusProgressFrameTemplate.xml |
9 |
9 |
src\ChorusHealthFrameTemplate.xml |
src\ChorusHealthFrameTemplate.xml |
10 |
10 |
src\ChorusPowerFrameTemplate.xml |
src\ChorusPowerFrameTemplate.xml |
|
11 |
|
src\ChorusUnitNameFrameTemplate.xml |
11 |
12 |
src\ChorusTestFrame.xml |
src\ChorusTestFrame.xml |
File src/ChorusTestFrame.xml changed (mode: 100644) (index 53a2369..df2ca1f) |
17 |
17 |
</Anchor> |
</Anchor> |
18 |
18 |
</Anchors> |
</Anchors> |
19 |
19 |
<Frames> |
<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> |
20 |
29 |
<Frame name="ChorusTestTargetHealthFrame" inherits="ChorusHealthFrameTemplate"> |
<Frame name="ChorusTestTargetHealthFrame" inherits="ChorusHealthFrameTemplate"> |
21 |
30 |
<Anchors> |
<Anchors> |
22 |
31 |
<Anchor point="BOTTOMLEFT"> |
<Anchor point="BOTTOMLEFT"> |
|
66 |
75 |
ChorusTestTargetHealthFrame.strategy = 'UnitIsFriend'; |
ChorusTestTargetHealthFrame.strategy = 'UnitIsFriend'; |
67 |
76 |
ChorusTestTargetHealthFrame.unit = 'target'; |
ChorusTestTargetHealthFrame.unit = 'target'; |
68 |
77 |
ChorusTestTargetPowerFrame.unit = 'target'; |
ChorusTestTargetPowerFrame.unit = 'target'; |
|
78 |
|
ChorusTestTargetUnitNameFrame.unit = 'target'; |
69 |
79 |
ChorusTestTargetPowerFrame.strategy = 'UnitPowerType'; |
ChorusTestTargetPowerFrame.strategy = 'UnitPowerType'; |
70 |
80 |
</OnLoad> |
</OnLoad> |
71 |
81 |
</Scripts> |
</Scripts> |
File src/ChorusUnitNameFrameTemplate.lua added (mode: 100644) (index 0000000..97bcf88) |
|
1 |
|
local RAID_CLASS_COLORS = RAID_CLASS_COLORS |
|
2 |
|
local UnitClass = UnitClass |
|
3 |
|
local UnitIsPlayer = UnitIsPlayer |
|
4 |
|
local UnitName = UnitName |
|
5 |
|
|
|
6 |
|
local Chorus = Chorus |
|
7 |
|
|
|
8 |
|
local function unitNameEventProcessor(self) |
|
9 |
|
assert(self ~= nil) |
|
10 |
|
|
|
11 |
|
local label = self.label |
|
12 |
|
assert(label ~= nil) |
|
13 |
|
|
|
14 |
|
local unitDesignation = self.unit |
|
15 |
|
assert('string' == type(unitDesignation)) |
|
16 |
|
unitDesignation = string.lower(strtrim(unitDesignation)) |
|
17 |
|
assert(string.len(unitDesignation) >= 1) |
|
18 |
|
assert(string.len(unitDesignation) <= 256) |
|
19 |
|
|
|
20 |
|
local name = UnitName(unitDesignation) |
|
21 |
|
label:SetText(name) |
|
22 |
|
|
|
23 |
|
local _, classDesignation = UnitClass(unitDesignation) |
|
24 |
|
if not classDesignation or not UnitIsPlayer(unitDesignation) then |
|
25 |
|
label:SetTextColor(1, 1, 1) |
|
26 |
|
return |
|
27 |
|
end |
|
28 |
|
|
|
29 |
|
local map = RAID_CLASS_COLORS |
|
30 |
|
assert(map ~= nil) |
|
31 |
|
assert('table' == type(map)) |
|
32 |
|
local colorTuple = map[classDesignation] |
|
33 |
|
|
|
34 |
|
local r = 1 |
|
35 |
|
local g = 1 |
|
36 |
|
local b = 1 |
|
37 |
|
if colorTuple then |
|
38 |
|
assert('table' == type(colorTuple)) |
|
39 |
|
r = math.min(math.max(0, math.abs(colorTuple.r)), 1) |
|
40 |
|
g = math.min(math.max(0, math.abs(colorTuple.g)), 1) |
|
41 |
|
b = math.min(math.max(0, math.abs(colorTuple.b)), 1) |
|
42 |
|
end |
|
43 |
|
|
|
44 |
|
label:SetTextColor(r, g, b) |
|
45 |
|
end |
|
46 |
|
|
|
47 |
|
function Chorus.unitNameFrameMain(self) |
|
48 |
|
assert(self ~= nil) |
|
49 |
|
|
|
50 |
|
local label = _G[self:GetName() .. 'Text'] |
|
51 |
|
assert(label ~= nil) |
|
52 |
|
self.label = label |
|
53 |
|
|
|
54 |
|
self:SetScript('OnEvent', unitNameEventProcessor) |
|
55 |
|
|
|
56 |
|
self:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
|
57 |
|
self:RegisterEvent('PARTY_MEMBERS_CHANGED') |
|
58 |
|
self:RegisterEvent('PARTY_MEMBER_DISABLE') |
|
59 |
|
self:RegisterEvent('PARTY_MEMBER_ENABLE') |
|
60 |
|
self:RegisterEvent('PLAYER_ALIVE') |
|
61 |
|
self:RegisterEvent('PLAYER_FOCUS_CHANGED') |
|
62 |
|
self:RegisterEvent('PLAYER_LOGIN') |
|
63 |
|
self:RegisterEvent('PLAYER_TARGET_CHANGED') |
|
64 |
|
self:RegisterEvent('RAID_ROSTER_UPDATE') |
|
65 |
|
end |
File src/ChorusUnitNameFrameTemplate.xml added (mode: 100644) (index 0000000..90a0a7c) |
|
1 |
|
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
<Ui xmlns="http://www.blizzard.com/wow/ui/"> |
|
3 |
|
<Script file="ChorusUnitNameFrameTemplate.lua"/> |
|
4 |
|
<Frame name="ChorusUnitNameFrameTemplate" virtual="true"> |
|
5 |
|
<Size> |
|
6 |
|
<AbsDimension x="144" y="24" /> |
|
7 |
|
</Size> |
|
8 |
|
<Layers> |
|
9 |
|
<Layer level="OVERLAY"> |
|
10 |
|
<FontString name="$parentText" inherits="SystemFont_Shadow_Med1" setAllPoints="true"/> |
|
11 |
|
</Layer> |
|
12 |
|
</Layers> |
|
13 |
|
<Scripts> |
|
14 |
|
<OnLoad>Chorus.unitNameFrameMain(self);</OnLoad> |
|
15 |
|
</Scripts> |
|
16 |
|
</Frame> |
|
17 |
|
</Ui> |