File src/ClearcastingFrame.lua changed (mode: 100644) (index 103353d..235a400) |
... |
... |
Clearcasting addon. |
4 |
4 |
@script clearcasting |
@script clearcasting |
5 |
5 |
]] |
]] |
6 |
6 |
|
|
|
7 |
|
local function debug(msg) |
|
8 |
|
if true == ClearcastingDebugFlag then |
|
9 |
|
print('[Clearcasting]: ' .. tostring(msg) .. '.') |
|
10 |
|
end |
|
11 |
|
end |
|
12 |
|
|
7 |
13 |
--[[-- |
--[[-- |
8 |
14 |
Attempt to find a file that contains picture appropriate for given effect. |
Attempt to find a file that contains picture appropriate for given effect. |
9 |
15 |
@function findPictureFile |
@function findPictureFile |
|
... |
... |
local function findPictureFile(auraName) |
42 |
48 |
["Judgements of the Pure"] = "Interface\\Icons\\Ability_Paladin_JudgementofthePure", |
["Judgements of the Pure"] = "Interface\\Icons\\Ability_Paladin_JudgementofthePure", |
43 |
49 |
["Light's Grace"] = "Interface\\Icons\\Spell_Holy_LightsGrace", |
["Light's Grace"] = "Interface\\Icons\\Spell_Holy_LightsGrace", |
44 |
50 |
["Serendipity"] = "Interface\\Icons\\Spell_Holy_Serendipity", |
["Serendipity"] = "Interface\\Icons\\Spell_Holy_Serendipity", |
|
51 |
|
["Borrowed Time"] = "Interface\\Icons\\Spell_Holy_BorrowedTime", |
45 |
52 |
["Surge of Light"] = "Interface\\Icons\\Spell_Holy_SurgeofLight", |
["Surge of Light"] = "Interface\\Icons\\Spell_Holy_SurgeofLight", |
46 |
53 |
["Enrage"] = "Interface\\Icons\\Spell_Shadow_UnholyFrenzy", |
["Enrage"] = "Interface\\Icons\\Spell_Shadow_UnholyFrenzy", |
47 |
54 |
} |
} |
|
... |
... |
local function createIndicator(frameName, parentFrame, unitDesignation, auraName |
95 |
102 |
f.text = t |
f.text = t |
96 |
103 |
f.unitDesignation = unitDesignation |
f.unitDesignation = unitDesignation |
97 |
104 |
|
|
98 |
|
print('[Clearcasting]: create indicator ' .. auraName .. ' ' .. tostring(auraId) .. |
|
|
105 |
|
debug('create indicator ' .. auraName .. ' ' .. tostring(auraId) .. |
99 |
106 |
' ' .. icon ) |
' ' .. icon ) |
100 |
107 |
|
|
101 |
108 |
f:Hide() |
f:Hide() |
|
... |
... |
local function acceptUnitAura(rootFrame, unitDesignation) |
124 |
131 |
j = j + 1 |
j = j + 1 |
125 |
132 |
local _, _, icon, _, _, _, _, |
local _, _, icon, _, _, _, _, |
126 |
133 |
_, _, _, |
_, _, _, |
127 |
|
spellId = UnitAura('player', j) |
|
|
134 |
|
spellId = UnitAura(unitDesignation, j) |
128 |
135 |
if nil == spellId then |
if nil == spellId then |
129 |
136 |
break |
break |
130 |
137 |
end |
end |
|
... |
... |
local function getAuraId(spellName, spellCategory) |
165 |
172 |
end |
end |
166 |
173 |
|
|
167 |
174 |
local function reload(rootFrame) |
local function reload(rootFrame) |
168 |
|
print('[Clearcasting]: enter reload') |
|
|
175 |
|
debug('enter reload') |
169 |
176 |
assert (rootFrame ~= nil) |
assert (rootFrame ~= nil) |
170 |
177 |
|
|
171 |
178 |
local t = rootFrame.indicatorTable |
local t = rootFrame.indicatorTable |
|
... |
... |
local function reload(rootFrame) |
191 |
198 |
if not f.auraId then |
if not f.auraId then |
192 |
199 |
f.auraId = getAuraId(auraName) |
f.auraId = getAuraId(auraName) |
193 |
200 |
if not f.auraId then |
if not f.auraId then |
194 |
|
print('[Clearcasting]: spell "' .. tostring(auraName) .. '" is unavailable (188).') |
|
|
201 |
|
debug('spell "' .. tostring(auraName) .. '" is unavailable (188).') |
195 |
202 |
end |
end |
196 |
203 |
end |
end |
197 |
204 |
|
|
|
... |
... |
local function reload(rootFrame) |
207 |
214 |
|
|
208 |
215 |
i = i - 1 |
i = i - 1 |
209 |
216 |
end |
end |
210 |
|
print('[Clearcasting]: exit reload') |
|
|
217 |
|
debug('exit reload') |
211 |
218 |
end |
end |
212 |
219 |
|
|
213 |
220 |
function ClearcastingReload() |
function ClearcastingReload() |
|
... |
... |
local function updateEveryIndicator(rootFrame) |
261 |
268 |
f:Show() |
f:Show() |
262 |
269 |
local t = '' |
local t = '' |
263 |
270 |
if stackQuantity > 1 then |
if stackQuantity > 1 then |
264 |
|
t = string.format("%.0f\r\n(%d)", remainingSecs, stackQuantity) |
|
|
271 |
|
t = string.format("%.0f\r\n%d*", remainingSecs, stackQuantity) |
265 |
272 |
else |
else |
266 |
273 |
t = string.format("%.0f", remainingSecs) |
t = string.format("%.0f", remainingSecs) |
267 |
274 |
end |
end |
|
... |
... |
local function initIndicator(rootFrame, auraName, column, row, auraId) |
334 |
341 |
end |
end |
335 |
342 |
|
|
336 |
343 |
if not isSpellAvailable(auraName) then |
if not isSpellAvailable(auraName) then |
337 |
|
print('[Clearcasting]: cannot initialise spell "' .. tostring(auraName) .. '" ' .. |
|
|
344 |
|
debug('cannot initialise spell "' .. tostring(auraName) .. '" ' .. |
338 |
345 |
'aura identifier ' .. tostring(auraId) .. ' (line 343)') |
'aura identifier ' .. tostring(auraId) .. ' (line 343)') |
339 |
346 |
end |
end |
340 |
347 |
|
|
|
... |
... |
local function initPaladinIndicator(rootFrame) |
376 |
383 |
initIndicator(rootFrame, "Hand of Protection", 0, 3) |
initIndicator(rootFrame, "Hand of Protection", 0, 3) |
377 |
384 |
initIndicator(rootFrame, "Hand of Sacrifice", 2, 1) |
initIndicator(rootFrame, "Hand of Sacrifice", 2, 1) |
378 |
385 |
initIndicator(rootFrame, "Hand of Salvation", 2, 3) |
initIndicator(rootFrame, "Hand of Salvation", 2, 3) |
379 |
|
initIndicator(rootFrame, "Holy Shield", 1, 0) |
|
|
386 |
|
initIndicator(rootFrame, "Holy Shield", 1, 3) |
380 |
387 |
initIndicator(rootFrame, "Infusion of Light", 1, 3, 54149) |
initIndicator(rootFrame, "Infusion of Light", 1, 3, 54149) |
381 |
388 |
initIndicator(rootFrame, "Judgements of the Pure", 1, 1, 54153) |
initIndicator(rootFrame, "Judgements of the Pure", 1, 1, 54153) |
382 |
389 |
initIndicator(rootFrame, "Light's Grace", 1, 2, 31834) |
initIndicator(rootFrame, "Light's Grace", 1, 2, 31834) |
|
... |
... |
local function initWarriorIndicator(rootFrame) |
395 |
402 |
initIndicator(rootFrame, "Shield Block", 0, 1) |
initIndicator(rootFrame, "Shield Block", 0, 1) |
396 |
403 |
initIndicator(rootFrame, "Shield Wall", 0, 0) |
initIndicator(rootFrame, "Shield Wall", 0, 0) |
397 |
404 |
initIndicator(rootFrame, "Spell Reflection", 2, 2) |
initIndicator(rootFrame, "Spell Reflection", 2, 2) |
398 |
|
initIndicator(rootFrame, "Sudden Death", 1, 3) |
|
|
405 |
|
initIndicator(rootFrame, "Sudden Death", 1, 2, 29723) |
399 |
406 |
initIndicator(rootFrame, "Sword and Board", 1, 3, 50227) |
initIndicator(rootFrame, "Sword and Board", 1, 3, 50227) |
400 |
|
initIndicator(rootFrame, "Taste for Blood", 1, 3) |
|
|
407 |
|
initIndicator(rootFrame, "Taste for Blood", 1, 3, 60503) |
401 |
408 |
end |
end |
402 |
409 |
|
|
403 |
410 |
local function initEveryIndicator(rootFrame) |
local function initEveryIndicator(rootFrame) |
404 |
411 |
local _, playerClassDesignation = UnitClass('player') |
local _, playerClassDesignation = UnitClass('player') |
405 |
|
if 'PALADIN' == playerClassDesignation then |
|
|
412 |
|
if 'DEATHKNIGHT' == playerClassDesignation then |
|
413 |
|
initIndicator(rootFrame, 'Anti-Magic Shell', 0, 2) |
|
414 |
|
initIndicator(rootFrame, 'Icebound Fortitude', 0, 3) |
|
415 |
|
initIndicator(rootFrame, 'Anti-Magic Zone', 0, 0) |
|
416 |
|
elseif 'PALADIN' == playerClassDesignation then |
406 |
417 |
initPaladinIndicator(rootFrame) |
initPaladinIndicator(rootFrame) |
407 |
418 |
elseif 'PRIEST' == playerClassDesignation then |
elseif 'PRIEST' == playerClassDesignation then |
408 |
419 |
initIndicator(rootFrame, 'Surge of Light', 0, 2, 33151) |
initIndicator(rootFrame, 'Surge of Light', 0, 2, 33151) |
409 |
420 |
initIndicator(rootFrame, 'Serendipity', 0, 3, 63731) |
initIndicator(rootFrame, 'Serendipity', 0, 3, 63731) |
|
421 |
|
initIndicator(rootFrame, 'Borrowed Time', 0, 3, 59891) |
410 |
422 |
elseif 'DRUID' == playerClassDesignation then |
elseif 'DRUID' == playerClassDesignation then |
411 |
423 |
initIndicator(rootFrame, 'Clearcasting', 0, 0) |
initIndicator(rootFrame, 'Clearcasting', 0, 0) |
412 |
424 |
elseif 'WARRIOR' == playerClassDesignation then |
elseif 'WARRIOR' == playerClassDesignation then |
413 |
425 |
initWarriorIndicator(rootFrame) |
initWarriorIndicator(rootFrame) |
414 |
426 |
elseif 'WARLOCK' == playerClassDesignation then |
elseif 'WARLOCK' == playerClassDesignation then |
415 |
|
initIndicator(rootFrame, 'Backdraft', 0, 1) |
|
416 |
|
initIndicator(rootFrame, 'Backlash', 0, 2) |
|
417 |
|
initIndicator(rootFrame, 'Decimation', 0, 1) |
|
|
427 |
|
initIndicator(rootFrame, 'Backdraft', 0, 1, 47260) |
|
428 |
|
initIndicator(rootFrame, 'Backlash', 0, 2, 34939) |
|
429 |
|
initIndicator(rootFrame, 'Decimation', 0, 1, 63158) |
418 |
430 |
initIndicator(rootFrame, 'Eradication', 0, 1, 64371) |
initIndicator(rootFrame, 'Eradication', 0, 1, 64371) |
419 |
|
initIndicator(rootFrame, 'Molten Core', 0, 1) |
|
|
431 |
|
initIndicator(rootFrame, 'Molten Core', 0, 1, 71165) |
420 |
432 |
initIndicator(rootFrame, 'Shadow Trance', 0, 2, 17941) |
initIndicator(rootFrame, 'Shadow Trance', 0, 2, 17941) |
421 |
433 |
initIndicator(rootFrame, 'Life Tap', 0, 0, 63321) |
initIndicator(rootFrame, 'Life Tap', 0, 0, 63321) |
422 |
434 |
else |
else |
|
... |
... |
local function initEveryIndicator(rootFrame) |
426 |
438 |
end |
end |
427 |
439 |
|
|
428 |
440 |
local function init(rootFrame) |
local function init(rootFrame) |
429 |
|
print('[Clearcasting]: enter init') |
|
|
441 |
|
debug('enter init') |
430 |
442 |
local t = initEveryIndicator(rootFrame) |
local t = initEveryIndicator(rootFrame) |
431 |
443 |
assert (t ~= nil) |
assert (t ~= nil) |
432 |
444 |
assert (#t >= 1) |
assert (#t >= 1) |
|
... |
... |
local function init(rootFrame) |
440 |
452 |
|
|
441 |
453 |
rootFrame:RegisterEvent('UNIT_AURA') |
rootFrame:RegisterEvent('UNIT_AURA') |
442 |
454 |
rootFrame:RegisterEvent('SPELLS_CHANGED') |
rootFrame:RegisterEvent('SPELLS_CHANGED') |
443 |
|
print('[Clearcasting]: exit init') |
|
|
455 |
|
debug('exit init') |
444 |
456 |
end |
end |
445 |
457 |
|
|
446 |
458 |
local function main() |
local function main() |