File src/ChorusAuraButtonTemplate.lua changed (mode: 100644) (index 0151ce4..006aed5) |
... |
... |
local DebuffTypeColor = DebuffTypeColor |
2 |
2 |
local GetTime = GetTime |
local GetTime = GetTime |
3 |
3 |
local UnitAura = UnitAura |
local UnitAura = UnitAura |
4 |
4 |
local UnitExists = UnitExists |
local UnitExists = UnitExists |
|
5 |
|
local UnitIsConnected = UnitIsConnected |
5 |
6 |
|
|
6 |
7 |
local Chorus = Chorus |
local Chorus = Chorus |
7 |
8 |
|
|
|
... |
... |
local function apply(auraButton, unitDesignation, auraIndex, filter) |
221 |
222 |
assert(string.len(filter) <= 256) |
assert(string.len(filter) <= 256) |
222 |
223 |
|
|
223 |
224 |
|
|
224 |
|
if not UnitExists(unitDesignation) then |
|
|
225 |
|
if not UnitExists(unitDesignation) or not UnitIsConnected(unitDesignation) then |
225 |
226 |
auraButton:Hide() |
auraButton:Hide() |
226 |
227 |
auraButton:SetScript('OnUpdate', nil) |
auraButton:SetScript('OnUpdate', nil) |
227 |
228 |
return |
return |
|
... |
... |
local function auraButtonEventProcessor(self, eventCategory) |
262 |
263 |
assert(string.len(u) >= 1) |
assert(string.len(u) >= 1) |
263 |
264 |
assert(string.len(u) <= 256) |
assert(string.len(u) <= 256) |
264 |
265 |
|
|
265 |
|
if UnitExists(u) then |
|
|
266 |
|
if UnitExists(u) and UnitIsConnected(u) then |
266 |
267 |
self:Show() |
self:Show() |
267 |
268 |
else |
else |
268 |
269 |
self:Hide() |
self:Hide() |
File src/ChorusAuraFrameTemplate.lua changed (mode: 100644) (index cb1d4f4..703e773) |
1 |
1 |
local Chorus = Chorus |
local Chorus = Chorus |
2 |
2 |
|
|
3 |
3 |
local UnitAura = UnitAura |
local UnitAura = UnitAura |
|
4 |
|
local UnitExists = UnitExists |
|
5 |
|
local UnitIsConnected = UnitIsConnected |
4 |
6 |
|
|
5 |
7 |
--[[ TODO Globalize special spells. ]]-- |
--[[ TODO Globalize special spells. ]]-- |
6 |
8 |
local auraWeightMap = { |
local auraWeightMap = { |
|
... |
... |
local function auraFrameEventProcessor(self, eventCategory, ...) |
136 |
138 |
assert(string.len(unitDesignation) >= 1) |
assert(string.len(unitDesignation) >= 1) |
137 |
139 |
assert(string.len(unitDesignation) <= 256) |
assert(string.len(unitDesignation) <= 256) |
138 |
140 |
|
|
139 |
|
if UnitExists(unitDesignation) then |
|
|
141 |
|
if UnitExists(unitDesignation) and UnitIsConnected(unitDesignation) then |
140 |
142 |
self:Show() |
self:Show() |
141 |
143 |
else |
else |
142 |
144 |
self:Hide() |
self:Hide() |
File src/ChorusProgressFrameTemplate.lua changed (mode: 100644) (index 4045059..1815f31) |
... |
... |
local UnitClass = UnitClass |
4 |
4 |
local UnitExists = UnitExists |
local UnitExists = UnitExists |
5 |
5 |
local UnitHealth = UnitHealth |
local UnitHealth = UnitHealth |
6 |
6 |
local UnitHealthMax = UnitHealthMax |
local UnitHealthMax = UnitHealthMax |
|
7 |
|
local UnitIsConnected = UnitIsConnected |
7 |
8 |
local UnitIsCorpse = UnitIsCorpse |
local UnitIsCorpse = UnitIsCorpse |
8 |
9 |
local UnitIsDead = UnitIsDead |
local UnitIsDead = UnitIsDead |
9 |
10 |
local UnitIsGhost = UnitIsGhost |
local UnitIsGhost = UnitIsGhost |
|
... |
... |
local function getRatio(a, b) |
59 |
60 |
|
|
60 |
61 |
assert(b ~= nil) |
assert(b ~= nil) |
61 |
62 |
assert('number' == type(b)) |
assert('number' == type(b)) |
62 |
|
--[[ FIXME Power frame fails when relevant player is disconnected ]]-- |
|
63 |
63 |
assert(b > 0) |
assert(b > 0) |
64 |
64 |
|
|
65 |
65 |
assert(a <= b) |
assert(a <= b) |
|
... |
... |
local function applySize(self) |
88 |
88 |
end |
end |
89 |
89 |
|
|
90 |
90 |
local function applyRatio(self, a, b) |
local function applyRatio(self, a, b) |
|
91 |
|
--[[ Work around quirks of the native API. ]]-- |
|
92 |
|
b = math.max(b, 1) |
|
93 |
|
|
91 |
94 |
self:SetValue(getRatio(a, b)) |
self:SetValue(getRatio(a, b)) |
92 |
95 |
end |
end |
93 |
96 |
|
|
|
... |
... |
local function applyOverlay(self, a, b) |
100 |
103 |
|
|
101 |
104 |
assert(b ~= nil) |
assert(b ~= nil) |
102 |
105 |
assert('number' == type(b)) |
assert('number' == type(b)) |
|
106 |
|
--[[ Work around quirks of the native API. ]]-- |
|
107 |
|
b = math.max(b, 1) |
103 |
108 |
assert(b > 0) |
assert(b > 0) |
104 |
109 |
|
|
105 |
110 |
assert(a <= b) |
assert(a <= b) |
|
... |
... |
local function healthFrameEventProcessor(self) |
269 |
274 |
assert(string.len(unitDesignation) >= 1) |
assert(string.len(unitDesignation) >= 1) |
270 |
275 |
assert(string.len(unitDesignation) <= 256) |
assert(string.len(unitDesignation) <= 256) |
271 |
276 |
|
|
272 |
|
if UnitExists(unitDesignation) then |
|
|
277 |
|
if UnitExists(unitDesignation) and UnitIsConnected(unitDesignation) then |
273 |
278 |
self:Show() |
self:Show() |
274 |
279 |
else |
else |
275 |
280 |
self:Hide() |
self:Hide() |
|
... |
... |
local function powerFrameEventProcessor(self) |
341 |
346 |
assert(string.len(unitDesignation) >= 1) |
assert(string.len(unitDesignation) >= 1) |
342 |
347 |
assert(string.len(unitDesignation) <= 256) |
assert(string.len(unitDesignation) <= 256) |
343 |
348 |
|
|
344 |
|
if UnitExists(unitDesignation) then |
|
|
349 |
|
if UnitExists(unitDesignation) and UnitIsConnected(unitDesignation) then |
345 |
350 |
self:Show() |
self:Show() |
346 |
351 |
else |
else |
347 |
352 |
self:Hide() |
self:Hide() |
File src/ChorusUnitNameFrameTemplate.lua changed (mode: 100644) (index 890bf97..48bbe16) |
... |
... |
local function unitNameEventProcessor(self) |
21 |
21 |
local name = UnitName(unitDesignation) |
local name = UnitName(unitDesignation) |
22 |
22 |
label:SetText(name) |
label:SetText(name) |
23 |
23 |
|
|
|
24 |
|
if UnitIsConnected(unitDesignation) and UnitExists(unitDesignation) then |
|
25 |
|
label:SetTextColor(1, 1, 1) |
|
26 |
|
else |
|
27 |
|
label:SetTextColor(0.7, 0.7, 0.7) |
|
28 |
|
return |
|
29 |
|
end |
|
30 |
|
|
24 |
31 |
if not self.strategy then |
if not self.strategy then |
25 |
32 |
return |
return |
26 |
33 |
elseif 'UnitClass' ~= self.strategy then |
elseif 'UnitClass' ~= self.strategy then |
|
... |
... |
function Chorus.unitNameFrameMain(self) |
67 |
74 |
self:RegisterEvent('PARTY_MEMBER_DISABLE') |
self:RegisterEvent('PARTY_MEMBER_DISABLE') |
68 |
75 |
self:RegisterEvent('PARTY_MEMBER_ENABLE') |
self:RegisterEvent('PARTY_MEMBER_ENABLE') |
69 |
76 |
self:RegisterEvent('PLAYER_ALIVE') |
self:RegisterEvent('PLAYER_ALIVE') |
|
77 |
|
self:RegisterEvent('PLAYER_ENTERING_WORLD') |
70 |
78 |
self:RegisterEvent('PLAYER_FOCUS_CHANGED') |
self:RegisterEvent('PLAYER_FOCUS_CHANGED') |
71 |
79 |
self:RegisterEvent('PLAYER_LOGIN') |
self:RegisterEvent('PLAYER_LOGIN') |
|
80 |
|
self:RegisterEvent('PLAYER_LOGOUT') |
72 |
81 |
self:RegisterEvent('PLAYER_TARGET_CHANGED') |
self:RegisterEvent('PLAYER_TARGET_CHANGED') |
73 |
82 |
self:RegisterEvent('RAID_ROSTER_UPDATE') |
self:RegisterEvent('RAID_ROSTER_UPDATE') |
74 |
83 |
self:RegisterEvent('UNIT_NAME_UPDATE') |
self:RegisterEvent('UNIT_NAME_UPDATE') |