File src/ChorusAuraButtonTemplate.lua changed (mode: 100644) (index 6527d36..0fb5a03) |
... |
... |
watch that unit, then apply relevant changes to the aura button. |
365 |
365 |
@see apply |
@see apply |
366 |
366 |
@tparam frame self the aura button |
@tparam frame self the aura button |
367 |
367 |
@tparam string eventCategory event category designation of the given event |
@tparam string eventCategory event category designation of the given event |
368 |
|
@param unitDesignation vararg, given `UNIT_AURA`, |
|
|
368 |
|
@param unitDesignation vararg, given `UNIT_AURA`, the relevant unit |
369 |
369 |
@return nothing |
@return nothing |
370 |
370 |
]] |
]] |
371 |
371 |
function Chorus.auraButtonEventProcessor(self, eventCategory, ...) |
function Chorus.auraButtonEventProcessor(self, eventCategory, ...) |
|
... |
... |
end |
459 |
459 |
Initialize the aura button frame with callbacks and children. |
Initialize the aura button frame with callbacks and children. |
460 |
460 |
|
|
461 |
461 |
@function auraButtonMain |
@function auraButtonMain |
462 |
|
@tparam frame self |
|
|
462 |
|
@tparam frame self |
463 |
463 |
@return nothing |
@return nothing |
464 |
464 |
]] |
]] |
465 |
465 |
function Chorus.auraButtonMain(self) |
function Chorus.auraButtonMain(self) |
|
... |
... |
function Chorus.auraButtonMain(self) |
470 |
470 |
self.label2 = _G[n .. 'Text2'] |
self.label2 = _G[n .. 'Text2'] |
471 |
471 |
self.overlay = _G[n .. 'Overlay'] |
self.overlay = _G[n .. 'Overlay'] |
472 |
472 |
end |
end |
473 |
|
self:SetScript('OnEvent', auraButtonEventProcessor) |
|
|
473 |
|
self:SetScript('OnEvent', Chorus.auraButtonEventProcessor) |
474 |
474 |
self:RegisterEvent('ADDON_LOADED') |
self:RegisterEvent('ADDON_LOADED') |
475 |
475 |
self:RegisterEvent('UNIT_AURA') |
self:RegisterEvent('UNIT_AURA') |
476 |
476 |
auraButtonValidate(self) |
auraButtonValidate(self) |
File src/ChorusAuraTooltipFrameTemplate.lua changed (mode: 100644) (index e8798fd..a1630c5) |
1 |
1 |
--[[-- |
--[[-- |
2 |
|
`ChorusAuraTooltipFrameTemplate` is *not* the familiar tooltip frame. Instead, |
|
3 |
|
it is intended to conditionally show all auras on a given unit. |
|
4 |
|
|
|
5 |
|
`ChorusAuraFrameTemplate` is intended to show only a relevant subset of auras |
|
6 |
|
on a given unit at a time. Almost never all of the auras. When the need arises |
|
7 |
|
for the user to read all auras on a particular unit, they click a specific |
|
8 |
|
button, and it displays a detailed tooltip for all auras. |
|
9 |
|
`ChorusAuraTooltipFrameTemplate` that is this module handles this tooltip. |
|
10 |
|
|
|
11 |
|
Note that showing a frame in combat is a restricted action. This template |
|
12 |
|
accounts for that and must work in combat as expected. |
|
13 |
|
|
|
14 |
2 |
@submodule chorus |
@submodule chorus |
15 |
3 |
]] |
]] |
16 |
4 |
|
|
|
... |
... |
local function getButtonAssociatedTooltipFrame(self) |
31 |
19 |
return tooltipFrame |
return tooltipFrame |
32 |
20 |
end |
end |
33 |
21 |
|
|
|
22 |
|
--[[-- |
|
23 |
|
Initialize the button to toggle `ChorusAuraTooltipFrame` in restricted |
|
24 |
|
environment. |
|
25 |
|
|
|
26 |
|
When this button is clicked, it must show a frame, that contains an exhaustive |
|
27 |
|
list of auras that effect the corresponding unit. |
|
28 |
|
|
|
29 |
|
@function auraTooltipToggleButtonMain |
|
30 |
|
@tparam frame self this aura tooltip toggle button |
|
31 |
|
]] |
34 |
32 |
local function auraTooltipToggleButtonMain(self) |
local function auraTooltipToggleButtonMain(self) |
35 |
33 |
assert(self ~= nil) |
assert(self ~= nil) |
36 |
34 |
|
|
37 |
|
--[[ WARNING For some bizzare reason, only programmatically created |
|
38 |
|
secure handlers, or secure handlers that descend from secure frames, |
|
39 |
|
define the required method of `SetFrameRef`. ]]-- |
|
|
35 |
|
--[[ @warning For some bizzare reason, only programmatically created |
|
36 |
|
secure handlers, or secure handlers that descend from secure frames, |
|
37 |
|
define the required method of `SetFrameRef`. ]]-- |
|
38 |
|
|
|
39 |
|
local nama = (self:GetName() or '') .. 'SecureClickHandlerFrame' |
|
40 |
|
|
|
41 |
|
local secureClickHandler = _G[nama] or CreateFrame('FRAME', nama, self, |
|
42 |
|
'SecureHandlerClickTemplate') |
40 |
43 |
|
|
41 |
|
local secureClickHandler = _G[self:GetName() .. 'SecureClickHandlerFrame'] or |
|
42 |
|
CreateFrame('FRAME', self:GetName() .. 'SecureClickHandlerFrame', self, 'SecureHandlerClickTemplate'); |
|
43 |
44 |
assert(secureClickHandler ~= nil) |
assert(secureClickHandler ~= nil) |
44 |
45 |
|
|
45 |
46 |
local tooltipFrame = getButtonAssociatedTooltipFrame(self) |
local tooltipFrame = getButtonAssociatedTooltipFrame(self) |
|
... |
... |
local function auraTooltipToggleButtonMain(self) |
67 |
68 |
RegisterUnitWatch(self) |
RegisterUnitWatch(self) |
68 |
69 |
end |
end |
69 |
70 |
|
|
|
71 |
|
--[[-- |
|
72 |
|
`ChorusAuraTooltipFrameTemplate` is *not* the familiar tooltip frame. Instead, |
|
73 |
|
it is intended to conditionally show all auras on a given unit. |
|
74 |
|
|
|
75 |
|
`ChorusAuraFrameTemplate` is intended to show only a relevant subset of auras |
|
76 |
|
on a given unit at a time. Almost never all of the auras. When the need arises |
|
77 |
|
for the user to read all auras on a particular unit, they click a specific |
|
78 |
|
button, and it displays a detailed tooltip for all auras. |
|
79 |
|
`ChorusAuraTooltipFrameTemplate` that is this module handles this tooltip. |
|
80 |
|
|
|
81 |
|
Note that showing a frame in combat is a restricted action. This template |
|
82 |
|
accounts for that and must work in combat as expected. |
|
83 |
|
|
|
84 |
|
@function auraTooltipFrameMain |
|
85 |
|
@tparam frame self this Chorus aura tooltip frame |
|
86 |
|
]] |
70 |
87 |
local function auraTooltipFrameMain(self) |
local function auraTooltipFrameMain(self) |
71 |
88 |
assert(self ~= nil) |
assert(self ~= nil) |
72 |
89 |
|
|
File src/ChorusGroupFrame.lua changed (mode: 100644) (index 81027a9..8e976d9) |
1 |
1 |
--[[-- |
--[[-- |
2 |
|
`ChorusGroupFrame` toggles party, raid or solo frames where appropriate |
|
3 |
|
automatically. |
|
4 |
|
|
|
5 |
|
Toggling frames in combat is a restricted action. Workarounds are employed to |
|
6 |
|
make it work, similarly to how it is done in `ShadowedUnitFrames`. That is, |
|
7 |
|
with `FrameXML/SecureStateDriver.lua`. It executes a macro-like commands on |
|
8 |
|
demand, instead of the usual event processors, that are then handled by |
|
9 |
|
`FrameXML/SecureHandlers.lua`. |
|
10 |
|
|
|
11 |
2 |
@submodule chorus |
@submodule chorus |
12 |
3 |
]] |
]] |
13 |
4 |
|
|
14 |
5 |
local GetInstanceInfo = Chorus.test.GetInstanceInfo or GetInstanceInfo |
local GetInstanceInfo = Chorus.test.GetInstanceInfo or GetInstanceInfo |
15 |
|
local GetNumRaidMembers = Chorus.test.GetNumRaidMembers or GetNumRaidMembers |
|
|
6 |
|
local GetNumRaidMembers = Chorus.test.GetNumRaidMembers or GetNumRaidMembers |
16 |
7 |
local InCombatLockdown = Chorus.test.InCombatLockdown or InCombatLockdown |
local InCombatLockdown = Chorus.test.InCombatLockdown or InCombatLockdown |
17 |
8 |
|
|
18 |
9 |
local Chorus = Chorus |
local Chorus = Chorus |
|
... |
... |
local ChorusPartyFrame = ChorusPartyFrame |
21 |
12 |
local ChorusSmallRaidFrame = ChorusSmallRaidFrame |
local ChorusSmallRaidFrame = ChorusSmallRaidFrame |
22 |
13 |
local ChorusTinyRaidFrame = ChorusTinyRaidFrame |
local ChorusTinyRaidFrame = ChorusTinyRaidFrame |
23 |
14 |
|
|
|
15 |
|
--[[-- |
|
16 |
|
Toggle the visibility raid group profile frame. |
|
17 |
|
|
|
18 |
|
Evaluate a list of all possible raid frame profiles. Consider current player's |
|
19 |
|
raid size and current zone. Then, show the most appropriate profile and hide |
|
20 |
|
all others. |
|
21 |
|
|
|
22 |
|
Each raid frame profile exists in memory from initialization. |
|
23 |
|
|
|
24 |
|
This may only be run effectively in unrestricted execution environment, that is |
|
25 |
|
out of combat. |
|
26 |
|
|
|
27 |
|
The group frame secure handler implements the same feature. However, it uses |
|
28 |
|
state drivers and secure frames, that may be executed in restricted environment |
|
29 |
|
and during combat. |
|
30 |
|
|
|
31 |
|
@function groupFrameToggleInsecure |
|
32 |
|
@return nothing |
|
33 |
|
]] |
24 |
34 |
function Chorus.groupFrameToggleInsecure() |
function Chorus.groupFrameToggleInsecure() |
25 |
35 |
if InCombatLockdown() then |
if InCombatLockdown() then |
26 |
36 |
return |
return |
|
... |
... |
function Chorus.groupFrameToggleInsecure() |
41 |
51 |
local thef = nil |
local thef = nil |
42 |
52 |
local _, instanceType = GetInstanceInfo() |
local _, instanceType = GetInstanceInfo() |
43 |
53 |
if 'arena' == instanceType then |
if 'arena' == instanceType then |
44 |
|
--[[ TODO Add real arena group frame, with enemy frames. ]]-- |
|
|
54 |
|
--[[ @todo Add real arena group frame, with enemy frames. ]]-- |
45 |
55 |
thef = ChorusPartyFrame |
thef = ChorusPartyFrame |
46 |
56 |
elseif 'raid' == instanceType or 'none' == instanceType then |
elseif 'raid' == instanceType or 'none' == instanceType then |
47 |
57 |
local n = GetNumRaidMembers() |
local n = GetNumRaidMembers() |
|
... |
... |
function Chorus.groupFrameToggleInsecure() |
61 |
71 |
end |
end |
62 |
72 |
end |
end |
63 |
73 |
|
|
|
74 |
|
--[[-- |
|
75 |
|
`ChorusGroupFrame` toggles party, raid or solo frames where appropriate |
|
76 |
|
automatically. |
|
77 |
|
|
|
78 |
|
Toggling frames in combat is a restricted action. Workarounds are employed to |
|
79 |
|
make it work, similarly to how it is done in `ShadowedUnitFrames`. That is, |
|
80 |
|
with `FrameXML/SecureStateDriver.lua`. It executes a macro-like commands on |
|
81 |
|
demand, instead of the usual event processors, that are then handled by |
|
82 |
|
`FrameXML/SecureHandlers.lua`. |
|
83 |
|
|
|
84 |
|
@function groupFrameMain |
|
85 |
|
@tparam self this group frame |
|
86 |
|
]] |
64 |
87 |
function Chorus.groupFrameMain(self) |
function Chorus.groupFrameMain(self) |
65 |
88 |
assert(self ~= nil) |
assert(self ~= nil) |
66 |
89 |
|
|
|
... |
... |
function Chorus.groupFrameMain(self) |
90 |
113 |
--[[ NOTE: The order of switch cases in the macro is significant. The |
--[[ NOTE: The order of switch cases in the macro is significant. The |
91 |
114 |
first match takes precedence. ]]-- |
first match takes precedence. ]]-- |
92 |
115 |
|
|
93 |
|
--[[ TODO Replace the arena conditional with actual arena frame, when implemented. ]]-- |
|
94 |
|
--[[ FIXME This does not work. ]]-- |
|
|
116 |
|
--[[ @todo Replace the arena conditional with actual arena frame, when implemented. ]]-- |
|
117 |
|
--[[ @fixme This does not work. ]]-- |
95 |
118 |
local secureCmd = [=[[@arena1,exists] ChorusPartyFrame; |
local secureCmd = [=[[@arena1,exists] ChorusPartyFrame; |
96 |
119 |
[@raid26,exists][@raid31,exists][@raid36,exists] ChorusTinyRaidFrame; |
[@raid26,exists][@raid31,exists][@raid36,exists] ChorusTinyRaidFrame; |
97 |
120 |
[@raid6,exists][@raid11,exists][@raid16,exists][@raid21,exists] ChorusSmallRaidFrame; |
[@raid6,exists][@raid11,exists][@raid16,exists][@raid21,exists] ChorusSmallRaidFrame; |
|
... |
... |
function Chorus.groupFrameMain(self) |
103 |
126 |
`secureHandler` changes value, toggle all of the known raid frame |
`secureHandler` changes value, toggle all of the known raid frame |
104 |
127 |
profiles, and only choose to show the most appropriate one. ]]-- |
profiles, and only choose to show the most appropriate one. ]]-- |
105 |
128 |
|
|
106 |
|
--[[ TODO Implement separate or additional arena unit group frame. ]]-- |
|
|
129 |
|
--[[ @todo Implement separate or additional arena unit group frame. ]]-- |
107 |
130 |
secureHandler:WrapScript(secureHandler, 'OnAttributeChanged', [[ |
secureHandler:WrapScript(secureHandler, 'OnAttributeChanged', [[ |
108 |
131 |
if name ~= 'state-group' then |
if name ~= 'state-group' then |
109 |
132 |
return |
return |
File src/ChorusProgressFrameTemplate.lua changed (mode: 100644) (index aaf9335..0f20b9c) |
1 |
1 |
--[[-- |
--[[-- |
2 |
|
`ChorusProgressFrameTemplate` is a generalization for health bars and power |
|
3 |
|
(mana) bars. |
|
4 |
|
|
|
5 |
|
The features are shared between both health and power bars, but there exist |
|
6 |
|
separate corresponding templates: `ChorusHealthFrameTemplate` and |
|
7 |
|
`ChorusPowerFrameTemplate`. |
|
8 |
|
|
|
9 |
|
Frames that inherit from this template may define field `strategy`. This field |
|
10 |
|
may be either `UnitIsFriend` or `UnitPowerType`. The bar will be colored by |
|
11 |
|
either unit reaction to the player, or the power type (blue for mana, red for |
|
12 |
|
rage, etc.). |
|
13 |
|
|
|
14 |
2 |
@submodule chorus |
@submodule chorus |
15 |
3 |
]] |
]] |
16 |
4 |
|
|
|
... |
... |
local CORPSE = CORPSE or 'CORPSE' |
34 |
22 |
local DEAD = DEAD or 'DEAD' |
local DEAD = DEAD or 'DEAD' |
35 |
23 |
local DEATH_RELEASE = DEATH_RELEASE or 'DEATH_RELEASE' |
local DEATH_RELEASE = DEATH_RELEASE or 'DEATH_RELEASE' |
36 |
24 |
local PLAYER_OFFLINE = PLAYER_OFFLINE or 'PLAYER_OFFLINE' |
local PLAYER_OFFLINE = PLAYER_OFFLINE or 'PLAYER_OFFLINE' |
37 |
|
|
|
|
25 |
|
|
38 |
26 |
local PowerBarColor = PowerBarColor |
local PowerBarColor = PowerBarColor |
39 |
27 |
local RAID_CLASS_COLORS = RAID_CLASS_COLORS |
local RAID_CLASS_COLORS = RAID_CLASS_COLORS |
40 |
28 |
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
|
... |
... |
local function applyOverlayHealthDeficit(self, a, b) |
213 |
201 |
end |
end |
214 |
202 |
end |
end |
215 |
203 |
|
|
|
204 |
|
--[[-- |
|
205 |
|
Update this health frame with the state of the given unit. |
|
206 |
|
|
|
207 |
|
@see FrameXML/GlobalStrings.lua:CORPSE |
|
208 |
|
|
|
209 |
|
@function applyOverlayHealth |
|
210 |
|
@tparam frame self this health frame |
|
211 |
|
@tparam string unitDesignation given unit |
|
212 |
|
]] |
216 |
213 |
local function applyOverlayHealth(self, unitDesignation) |
local function applyOverlayHealth(self, unitDesignation) |
217 |
214 |
assert(self ~= nil) |
assert(self ~= nil) |
218 |
215 |
|
|
|
... |
... |
local function applyOverlayHealth(self, unitDesignation) |
231 |
228 |
applyOverlay(self, a, b) |
applyOverlay(self, a, b) |
232 |
229 |
applyOverlayHealthDeficit(self, a, b) |
applyOverlayHealthDeficit(self, a, b) |
233 |
230 |
else |
else |
234 |
|
--[[ TODO Separate health status bar and unit statues. ]]-- |
|
|
231 |
|
--[[ @todo Separate health status bar and unit statues. ]]-- |
235 |
232 |
local t = {self.label1, self.label2, self.label3} |
local t = {self.label1, self.label2, self.label3} |
236 |
233 |
local i = 0 |
local i = 0 |
237 |
234 |
while (i < #t) do |
while (i < #t) do |
|
... |
... |
local function applyOverlayHealth(self, unitDesignation) |
247 |
244 |
return |
return |
248 |
245 |
end |
end |
249 |
246 |
|
|
250 |
|
--[[ See `FrameXML/GlobalStrings.lua`. ]]-- |
|
251 |
247 |
local s = nil |
local s = nil |
252 |
248 |
if UnitIsCorpse(unitDesignation) then |
if UnitIsCorpse(unitDesignation) then |
253 |
249 |
s = '(' .. (CORPSE or 'CORPSE') .. ')' |
s = '(' .. (CORPSE or 'CORPSE') .. ')' |
|
... |
... |
local function applyOverlayHealth(self, unitDesignation) |
256 |
252 |
elseif UnitIsDead(unitDesignation) then |
elseif UnitIsDead(unitDesignation) then |
257 |
253 |
s = '(' .. (DEAD or 'DEAD') .. ')' |
s = '(' .. (DEAD or 'DEAD') .. ')' |
258 |
254 |
elseif not UnitIsConnected(unitDesignation) then |
elseif not UnitIsConnected(unitDesignation) then |
259 |
|
--[[ FIXME The 'Player offline' label is never rendered. ]]-- |
|
260 |
|
--[[ TODO Add separate offline indicator widget. ]]-- |
|
|
255 |
|
--[[ @fixme The 'Player offline' label is never rendered. ]]-- |
|
256 |
|
--[[ @todo Add separate offline indicator widget. ]]-- |
261 |
257 |
s = '(' .. (PLAYER_OFFLINE or 'PLAYER_OFFLINE') .. ')' |
s = '(' .. (PLAYER_OFFLINE or 'PLAYER_OFFLINE') .. ')' |
262 |
258 |
end |
end |
263 |
259 |
label1:SetText(s) |
label1:SetText(s) |
|
... |
... |
local function powerFrameEventProcessor(self, eventCategory, ...) |
497 |
493 |
end |
end |
498 |
494 |
end |
end |
499 |
495 |
|
|
500 |
|
--[[ TODO Maybe make progress frame completely generic, by removing the unit field. ]]-- |
|
|
496 |
|
--[[-- |
|
497 |
|
`ChorusProgressFrameTemplate` is a generalization for health bars and power |
|
498 |
|
(mana) bars. |
|
499 |
|
|
|
500 |
|
The features are shared between both health and power bars, but there exist |
|
501 |
|
separate corresponding templates: `ChorusHealthFrameTemplate` and |
|
502 |
|
`ChorusPowerFrameTemplate`. |
|
503 |
|
|
|
504 |
|
Frames that inherit from this template may define field `strategy`. This field |
|
505 |
|
may be either `UnitIsFriend` or `UnitPowerType`. The bar will be colored by |
|
506 |
|
either unit reaction to the player, or the power type (blue for mana, red for |
|
507 |
|
rage, etc.). |
|
508 |
|
|
|
509 |
|
@todo Maybe make progress frame completely generic, by removing the unit field. |
|
510 |
|
|
|
511 |
|
@function progressFrameMain |
|
512 |
|
]] |
501 |
513 |
function Chorus.progressFrameMain(self) |
function Chorus.progressFrameMain(self) |
502 |
514 |
assert(self ~= nil) |
assert(self ~= nil) |
503 |
515 |
|
|
File src/ChorusRangeFrameTemplate.lua changed (mode: 100644) (index 13286ca..50055e3) |
1 |
1 |
--[[-- |
--[[-- |
2 |
|
`ChorusRangeFrameTemplate` displays approximate distance from player character |
|
3 |
|
to the corresponding unit, in yards. |
|
4 |
|
|
|
5 |
|
This works by checking the reach of each spell in the player's character's |
|
6 |
|
current spell book. |
|
7 |
|
|
|
8 |
|
FIXME Currently range indicator does not work in Cataclysm client (interface |
|
9 |
|
40300). Specifically, `function GetSpellName` is not defined for that client. |
|
10 |
|
Additionally, the current implementation may violate some additional |
|
11 |
|
restrictions found in interface `40300` but not in interface `30300`. |
|
12 |
|
|
|
13 |
2 |
@submodule chorus |
@submodule chorus |
14 |
3 |
]] |
]] |
15 |
4 |
|
|
|
... |
... |
local MAX_SPELLS = MAX_SPELLS |
20 |
9 |
|
|
21 |
10 |
local Chorus = Chorus |
local Chorus = Chorus |
22 |
11 |
|
|
23 |
|
--[[ See ChorusRangeFrameTemplate.lua:function spellRangeMapUpdate. ]]-- |
|
24 |
|
--[[ See ChorusRangeFrameTemplate.lua:function rangeFrameUpdate. ]]-- |
|
|
12 |
|
--[[-- |
|
13 |
|
Map of localized spell names to their maximum reach in yards. |
|
14 |
|
|
|
15 |
|
@table spellRangeMap |
|
16 |
|
@see spellRangeMapUpdate |
|
17 |
|
@see rangeFrameUpdate |
|
18 |
|
]] |
25 |
19 |
local spellRangeMap = {} |
local spellRangeMap = {} |
26 |
20 |
|
|
|
21 |
|
Chorus.spellRangeMap = spellRangeMap |
|
22 |
|
|
|
23 |
|
--[[-- |
|
24 |
|
Read player spell book and initialize `spellRangeMap` appropriately. |
|
25 |
|
|
|
26 |
|
@see FrameXML/SpellBookFrame.lua:MAX_SPELLS |
|
27 |
|
@see spellRangeMap |
|
28 |
|
@function spellRangeMapUpdate |
|
29 |
|
]] |
27 |
30 |
local function spellRangeMapUpdate() |
local function spellRangeMapUpdate() |
28 |
31 |
local maxSpells = MAX_SPELLS or 1024 |
local maxSpells = MAX_SPELLS or 1024 |
29 |
32 |
maxSpells = math.min(math.max(1, math.abs(math.floor(maxSpells)), 8192)) |
maxSpells = math.min(math.max(1, math.abs(math.floor(maxSpells)), 8192)) |
|
... |
... |
local function spellRangeMapUpdate() |
37 |
40 |
--[[ Get player spell book button number "i", and request it's |
--[[ Get player spell book button number "i", and request it's |
38 |
41 |
corresponding spell name. This is NOT a unique spell |
corresponding spell name. This is NOT a unique spell |
39 |
42 |
identifier. Every spell rank is a separate button. ]]-- |
identifier. Every spell rank is a separate button. ]]-- |
40 |
|
--[[ FIXME function GetSpellName is not available in Cata client. ]]-- |
|
|
43 |
|
--[[ @fixme function GetSpellName is not available in Cata client. ]]-- |
41 |
44 |
local spellName = GetSpellName(i, 'player') |
local spellName = GetSpellName(i, 'player') |
42 |
45 |
if not spellName then |
if not spellName then |
43 |
46 |
break |
break |
|
... |
... |
local function spellRangeMapUpdate() |
90 |
93 |
spellRangeMap = buffer |
spellRangeMap = buffer |
91 |
94 |
end |
end |
92 |
95 |
|
|
|
96 |
|
--[[-- |
|
97 |
|
Update range frame to show approximate amount of yards to the given unit. |
|
98 |
|
|
|
99 |
|
@see spellRangeMap |
|
100 |
|
|
|
101 |
|
@function rangeFrameUpdate |
|
102 |
|
@tparam frame self this range frame |
|
103 |
|
]] |
93 |
104 |
local function rangeFrameUpdate(self) |
local function rangeFrameUpdate(self) |
94 |
105 |
assert(self ~= nil) |
assert(self ~= nil) |
95 |
106 |
|
|
|
... |
... |
local function rangeFrameMain(self) |
169 |
180 |
self:SetScript('OnUpdate', rangeFrameUpdateProcessor) |
self:SetScript('OnUpdate', rangeFrameUpdateProcessor) |
170 |
181 |
end |
end |
171 |
182 |
|
|
|
183 |
|
--[[-- |
|
184 |
|
`ChorusRangeFrameTemplate` displays approximate distance from player character |
|
185 |
|
to the corresponding unit, in yards. |
|
186 |
|
|
|
187 |
|
This works by checking the reach of each spell in the player's character's |
|
188 |
|
current spell book. This ensures that the range approximation feature works in |
|
189 |
|
any client, regardless of localization. This also allows the feature to span |
|
190 |
|
several different WoW API interface versions more easily. |
|
191 |
|
|
|
192 |
|
The spell range map is updated every time the player character learns a new |
|
193 |
|
spell or enters the world. |
|
194 |
|
|
|
195 |
|
@fixme Currently range indicator does not work in Cataclysm client (interface |
|
196 |
|
40300). Specifically, `function GetSpellName` is not defined for that client. |
|
197 |
|
Additionally, the current implementation may violate some additional |
|
198 |
|
restrictions found in interface `40300` but not in interface `30300`. |
|
199 |
|
|
|
200 |
|
@function rangeSpellMapFrameMain |
|
201 |
|
@tparam frame self this spell map frame |
|
202 |
|
]]-- |
172 |
203 |
local function rangeSpellMapFrameMain(self) |
local function rangeSpellMapFrameMain(self) |
173 |
204 |
assert(self ~= nil) |
assert(self ~= nil) |
174 |
205 |
|
|
File src/ChorusUnitButtonTemplate.lua changed (mode: 100644) (index b0765bb..077a287) |
1 |
1 |
--[[-- |
--[[-- |
2 |
|
`ChorusUnitButtonTemplate` handles only the secure, clickable portion of unit |
|
3 |
|
buttons, and *none* of the visuals. |
|
4 |
|
|
|
5 |
|
The root template for unit buttons is `ChorusUnitFrameTemplate`. |
|
6 |
|
|
|
7 |
2 |
@submodule chorus |
@submodule chorus |
8 |
3 |
]] |
]] |
9 |
4 |
|
|
|
... |
... |
local Chorus = Chorus |
12 |
7 |
local GameTooltip = GameTooltip |
local GameTooltip = GameTooltip |
13 |
8 |
local GameTooltipTextLeft1 = GameTooltipTextLeft1 |
local GameTooltipTextLeft1 = GameTooltipTextLeft1 |
14 |
9 |
|
|
15 |
|
--[[ See `FrameXML/UnitPopup.lua:UnitPopupFrames`. ]]-- |
|
16 |
10 |
local TargetFrameDropDown = TargetFrameDropDown |
local TargetFrameDropDown = TargetFrameDropDown |
17 |
11 |
local PlayerFrameDropDown = PlayerFrameDropDown |
local PlayerFrameDropDown = PlayerFrameDropDown |
18 |
12 |
local FocusFrameDropDown = FocusFrameDropDown |
local FocusFrameDropDown = FocusFrameDropDown |
|
... |
... |
local PartyMemberFrame2DropDown = PartyMemberFrame2DropDown |
21 |
15 |
local PartyMemberFrame3DropDown = PartyMemberFrame3DropDown |
local PartyMemberFrame3DropDown = PartyMemberFrame3DropDown |
22 |
16 |
local PartyMemberFrame4DropDown = PartyMemberFrame4DropDown |
local PartyMemberFrame4DropDown = PartyMemberFrame4DropDown |
23 |
17 |
|
|
24 |
|
--[[ See `FrameXML/UIDropDownMenu.lua:function ToggleDropDownMenu`. ]]-- |
|
25 |
18 |
local ToggleDropDownMenu = ToggleDropDownMenu |
local ToggleDropDownMenu = ToggleDropDownMenu |
26 |
19 |
|
|
27 |
20 |
local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor |
local GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor |
28 |
21 |
local GameTooltip_UnitColor = GameTooltip_UnitColor |
local GameTooltip_UnitColor = GameTooltip_UnitColor |
29 |
22 |
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
30 |
23 |
|
|
31 |
|
--[[ TODO Add incoming healing bar. ]]-- |
|
32 |
|
--[[ TODO Add incoming resurrection indicator. ]]-- |
|
33 |
|
--[[ FIXME Unclickable areas on screen again. ]]-- |
|
34 |
|
|
|
35 |
24 |
local function unitButtonLeaveProcessor() |
local function unitButtonLeaveProcessor() |
36 |
25 |
assert(GameTooltip ~= nil) |
assert(GameTooltip ~= nil) |
37 |
26 |
|
|
|
... |
... |
local function contextMenuToggle(self, unitDesignation, buttonDesignation, butto |
88 |
77 |
ToggleDropDownMenu(level, value, contextMenu, anchorName, offsetX, offsetY) |
ToggleDropDownMenu(level, value, contextMenu, anchorName, offsetX, offsetY) |
89 |
78 |
end |
end |
90 |
79 |
|
|
|
80 |
|
--[[-- |
|
81 |
|
`ChorusUnitButtonTemplate` handles only the secure, clickable portion of unit |
|
82 |
|
buttons, and *none* of the visuals. |
|
83 |
|
|
|
84 |
|
The root template for unit buttons is `ChorusUnitFrameTemplate`. |
|
85 |
|
|
|
86 |
|
@todo Add incoming healing bar. |
|
87 |
|
@todo Add incoming resurrection indicator. |
|
88 |
|
|
|
89 |
|
@see FrameXML/UnitPopup.lua:UnitPopupFrames |
|
90 |
|
@see FrameXML/UIDropDownMenu.lua:function ToggleDropDownMenu |
|
91 |
|
|
|
92 |
|
@function unitButtonMain |
|
93 |
|
@tparam frame self this unit button |
|
94 |
|
]] |
91 |
95 |
function Chorus.unitButtonMain(self) |
function Chorus.unitButtonMain(self) |
92 |
96 |
self:RegisterForClicks('AnyUp') |
self:RegisterForClicks('AnyUp') |
93 |
97 |
|
|
|
... |
... |
function Chorus.unitButtonMain(self) |
99 |
103 |
|
|
100 |
104 |
self.menu = contextMenuToggle |
self.menu = contextMenuToggle |
101 |
105 |
|
|
102 |
|
--[[ FIXME Selecting "Set focus" option in the context menu for Chorus |
|
|
106 |
|
--[[ @fixme Selecting "Set focus" option in the context menu for Chorus |
103 |
107 |
unit button results in permission violation exception (restricted |
unit button results in permission violation exception (restricted |
104 |
108 |
execution environment issue). ]]-- |
execution environment issue). ]]-- |
105 |
109 |
|
|
File src/ChorusUnitFrameTemplate.lua changed (mode: 100644) (index 476cc5f..9a0d100) |
1 |
1 |
--[[-- |
--[[-- |
2 |
|
`ChorusUnitFrameTemplate` is the root template for all unit button variations. |
|
3 |
|
|
|
4 |
|
All widgets are conditionally included as children to instances of this |
|
5 |
|
template. For example health bars, power bars, aura frames, combat indicator, |
|
6 |
|
range indicator. These widgets are separated into their own templates. |
|
7 |
|
|
|
8 |
|
The template is further specialized into the following profiles. |
|
9 |
|
|
|
10 |
|
* `ChorusTinyUnitFrameTemplate`; |
|
11 |
|
* `ChorusSmallUnitFrameTemplate`; |
|
12 |
|
* `ChorusLargeUnitFrameTemplate`; |
|
13 |
|
* `ChorusHugeUnitFrameTemplate`; |
|
14 |
|
|
|
15 |
|
When instancing a unit button, one of these specializations is to be used. |
|
16 |
|
|
|
17 |
|
Group frame templates may define further specialized templates. |
|
18 |
|
|
|
19 |
2 |
@submodule chorus |
@submodule chorus |
20 |
3 |
]] |
]] |
21 |
4 |
|
|
|
... |
... |
local function applyTOT(self) |
61 |
44 |
end |
end |
62 |
45 |
|
|
63 |
46 |
--[[ Notify backdrop to toggle visibility when appropriate. ]]-- |
--[[ Notify backdrop to toggle visibility when appropriate. ]]-- |
64 |
|
local backdropFrame = self.backdropFrame |
|
|
47 |
|
local backdropFrame = self.backdropFrame |
65 |
48 |
if backdropFrame then |
if backdropFrame then |
66 |
49 |
local callback3 = backdropFrame:GetScript('OnEvent') |
local callback3 = backdropFrame:GetScript('OnEvent') |
67 |
50 |
--[[ Skip checks and error handing for performance. ]]-- |
--[[ Skip checks and error handing for performance. ]]-- |
|
... |
... |
local function applyUnitInRange(self) |
88 |
71 |
|
|
89 |
72 |
--[[ Only apply transparency to select subset of children or referenced |
--[[ Only apply transparency to select subset of children or referenced |
90 |
73 |
frames. Specifically exclude ChorusAuraTooltipFrame instances. ]]-- |
frames. Specifically exclude ChorusAuraTooltipFrame instances. ]]-- |
91 |
|
--[[ FIXME Performance abyslmal, probably issue here . ]]-- |
|
92 |
74 |
|
|
93 |
75 |
local healthFrame = self.healthFrame |
local healthFrame = self.healthFrame |
94 |
76 |
local powerFrame = self.powerFrame |
local powerFrame = self.powerFrame |
|
... |
... |
local function attributeProcessor(self, name, value) |
217 |
199 |
end |
end |
218 |
200 |
end |
end |
219 |
201 |
|
|
|
202 |
|
--[[-- |
|
203 |
|
`ChorusUnitFrameTemplate` is the root template for all unit button variations. |
|
204 |
|
|
|
205 |
|
All widgets are conditionally included as children to instances of this |
|
206 |
|
template. For example health bars, power bars, aura frames, combat indicator, |
|
207 |
|
range indicator. These widgets are separated into their own templates. |
|
208 |
|
|
|
209 |
|
The template is further specialized into the following profiles. |
|
210 |
|
|
|
211 |
|
* `ChorusTinyUnitFrameTemplate`; |
|
212 |
|
* `ChorusSmallUnitFrameTemplate`; |
|
213 |
|
* `ChorusLargeUnitFrameTemplate`; |
|
214 |
|
* `ChorusHugeUnitFrameTemplate`; |
|
215 |
|
|
|
216 |
|
When instancing a unit button, one of these specializations is to be used. |
|
217 |
|
|
|
218 |
|
Group frame templates may define further specialized templates. |
|
219 |
|
|
|
220 |
|
@function unitFrameMain |
|
221 |
|
]] |
220 |
222 |
local function unitFrameMain(self) |
local function unitFrameMain(self) |
221 |
223 |
assert(self ~= nil) |
assert(self ~= nil) |
222 |
224 |
|
|
File src/ChorusUnitGroupRoleFrameTemplate.lua changed (mode: 100644) (index 5dd9745..c43d488) |
|
1 |
|
--[[-- |
|
2 |
|
@submodule chorus |
|
3 |
|
|
|
4 |
|
@todo Since `function UnitSetRole` is backported, implement mechanism to set it |
|
5 |
|
automatically, inferred from talents. |
|
6 |
|
]] |
|
7 |
|
|
1 |
8 |
local Chorus = Chorus |
local Chorus = Chorus |
2 |
9 |
|
|
3 |
10 |
local strtrim = strtrim |
local strtrim = strtrim |
|
... |
... |
local fallbackRoleMap |
12 |
19 |
|
|
13 |
20 |
local cache = {} |
local cache = {} |
14 |
21 |
|
|
15 |
|
--[[ TODO Since `function UnitSetRole` is backported, implement mechanism to |
|
16 |
|
set it automatically, inferred from talents. ]]-- |
|
17 |
|
|
|
18 |
22 |
local function updateEveryRoleWidget() |
local function updateEveryRoleWidget() |
19 |
23 |
assert(cache ~= nil) |
assert(cache ~= nil) |
20 |
24 |
assert('table' == type(cache)) |
assert('table' == type(cache)) |
|
... |
... |
using this function. |
39 |
43 |
It is expected from the user to call this function manually or at least |
It is expected from the user to call this function manually or at least |
40 |
44 |
explicitly with a thin layer of graphical buttons. |
explicitly with a thin layer of graphical buttons. |
41 |
45 |
|
|
42 |
|
@function Chorus.UnitSetRole |
|
|
46 |
|
@function UnitSetRole |
|
47 |
|
@tparam string unitDesignation unit to which assign the role |
|
48 |
|
@tparam string unitDesignation either `DAMAGER`, `HEALER` or `TANK` |
|
49 |
|
@treturn bool |
43 |
50 |
]] |
]] |
44 |
51 |
function Chorus.UnitSetRole(unitDesignation, roleDesignation) |
function Chorus.UnitSetRole(unitDesignation, roleDesignation) |
45 |
52 |
assert(unitDesignation ~= nil) |
assert(unitDesignation ~= nil) |
|
... |
... |
do |
82 |
89 |
end |
end |
83 |
90 |
end |
end |
84 |
91 |
|
|
|
92 |
|
--[[-- |
|
93 |
|
Query the role designation of the given unit. |
|
94 |
|
|
|
95 |
|
This function is intended to work for both Cataclysm and Wrath clients equally. |
|
96 |
|
|
|
97 |
|
First, this function will query the game with native API. Second, if there is a |
|
98 |
|
override explicitly set by the user, the function will evaluate the override. |
|
99 |
|
|
|
100 |
|
@function getUnitGroupRoleDesignation |
|
101 |
|
@tparam string unitDesignation unit to query the role of |
|
102 |
|
@treturn string either `TANK`, `HEALER` or `DAMAGER`. |
|
103 |
|
]] |
85 |
104 |
local function getUnitGroupRoleDesignation(unitDesignation) |
local function getUnitGroupRoleDesignation(unitDesignation) |
86 |
105 |
assert(unitDesignation ~= nil) |
assert(unitDesignation ~= nil) |
87 |
106 |
assert('string' == type(unitDesignation)) |
assert('string' == type(unitDesignation)) |
|
... |
... |
local function roleMapFrameMain(self) |
203 |
222 |
end) |
end) |
204 |
223 |
end |
end |
205 |
224 |
|
|
206 |
|
local function main(self) |
|
|
225 |
|
--[[-- |
|
226 |
|
@function unitGroupRoleFrameMain |
|
227 |
|
@tparam frame self this unit group role frame |
|
228 |
|
]] |
|
229 |
|
local function unitGroupRoleFrameMain(self) |
207 |
230 |
assert(self ~= nil) |
assert(self ~= nil) |
208 |
231 |
|
|
209 |
232 |
local artwork = _G[self:GetName() .. 'Artwork'] |
local artwork = _G[self:GetName() .. 'Artwork'] |
|
... |
... |
Chorus.unitGroupRoleMapFrameMain = function(...) |
224 |
247 |
return roleMapFrameMain(...) |
return roleMapFrameMain(...) |
225 |
248 |
end |
end |
226 |
249 |
Chorus.unitGroupRoleFrameMain = function(...) |
Chorus.unitGroupRoleFrameMain = function(...) |
227 |
|
return main(...) |
|
|
250 |
|
return unitGroupRoleFrameMain(...) |
228 |
251 |
end |
end |
File src/ChorusUnitNameFrameTemplate.lua changed (mode: 100644) (index cdd27c9..3cab8c4) |
1 |
1 |
--[[-- |
--[[-- |
2 |
|
`ChorusUnitNameFrameTemplate` shows corresponding unit's human readable |
|
3 |
|
localized name, conditionally color coded. |
|
4 |
|
|
|
5 |
2 |
@submodule chorus |
@submodule chorus |
6 |
3 |
]] |
]] |
7 |
4 |
|
|
|
... |
... |
local UnitName = Chorus.test.UnitName or UnitName |
16 |
13 |
local RAID_CLASS_COLORS = RAID_CLASS_COLORS |
local RAID_CLASS_COLORS = RAID_CLASS_COLORS |
17 |
14 |
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
18 |
15 |
|
|
|
16 |
|
--[[-- |
|
17 |
|
Update this unit name frame. |
|
18 |
|
|
|
19 |
|
@see FrameXML/Constants.lua:RAID_CLASS_COLORS |
|
20 |
|
@function unitNameEventProcessor |
|
21 |
|
@tparam frame self this unit name frame |
|
22 |
|
]] |
19 |
23 |
local function unitNameEventProcessor(self) |
local function unitNameEventProcessor(self) |
20 |
24 |
assert(self ~= nil) |
assert(self ~= nil) |
21 |
25 |
|
|
|
... |
... |
local function unitNameEventProcessor(self) |
69 |
73 |
label:SetTextColor(r, g, b) |
label:SetTextColor(r, g, b) |
70 |
74 |
end |
end |
71 |
75 |
|
|
|
76 |
|
--[[-- |
|
77 |
|
`ChorusUnitNameFrameTemplate` shows corresponding unit's human readable |
|
78 |
|
localized name, conditionally color coded. |
|
79 |
|
|
|
80 |
|
@function unitNameFrameMain |
|
81 |
|
@tparam frame self this unit name frame |
|
82 |
|
]] |
72 |
83 |
function Chorus.unitNameFrameMain(self) |
function Chorus.unitNameFrameMain(self) |
73 |
84 |
assert(self ~= nil) |
assert(self ~= nil) |
74 |
85 |
|
|
|
... |
... |
function Chorus.unitNameFrameMain(self) |
76 |
87 |
assert(label ~= nil) |
assert(label ~= nil) |
77 |
88 |
self.label = label |
self.label = label |
78 |
89 |
|
|
79 |
|
--[[ FIXME Sometimes some unit buttons in raid frames cannot be clicked. ]]-- |
|
|
90 |
|
--[[ @fixme Sometimes some unit buttons in raid frames cannot be clicked. ]]-- |
80 |
91 |
self:SetScript('OnEvent', unitNameEventProcessor) |
self:SetScript('OnEvent', unitNameEventProcessor) |
81 |
92 |
|
|
82 |
93 |
self:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
self:RegisterEvent('PARTY_CONVERTED_TO_RAID') |