File src/ClearcastingFrame.lua changed (mode: 100644) (index e40322e..7c61142) |
... |
... |
end |
213 |
213 |
local function getUnitAuraRemainingSecs(unitDesignation, auraId) |
local function getUnitAuraRemainingSecs(unitDesignation, auraId) |
214 |
214 |
local auraName = GetSpellInfo(auraId) |
local auraName = GetSpellInfo(auraId) |
215 |
215 |
assert (auraName ~= nil) |
assert (auraName ~= nil) |
216 |
|
local name, _, _, _, _, |
|
|
216 |
|
local name, _, _, stackQuantity, _, |
217 |
217 |
duration, expirationTime = UnitAura(unitDesignation, auraName) |
duration, expirationTime = UnitAura(unitDesignation, auraName) |
218 |
218 |
if nil == name then |
if nil == name then |
219 |
219 |
return -1 |
return -1 |
220 |
220 |
end |
end |
221 |
|
return (expirationTime - GetTime()), duration |
|
|
221 |
|
if nil == stackQuantity or type(stackQuantity) ~= 'number' then |
|
222 |
|
stackQuantity = 0 |
|
223 |
|
end |
|
224 |
|
stackQuantitiy = math.min(math.max(0, stackQuantity), 8) |
|
225 |
|
return (expirationTime - GetTime()), duration, stackQuantity |
222 |
226 |
end |
end |
223 |
227 |
|
|
224 |
228 |
local function updateEveryIndicator(rootFrame) |
local function updateEveryIndicator(rootFrame) |
|
... |
... |
local function updateEveryIndicator(rootFrame) |
231 |
235 |
if auraId ~= nil then |
if auraId ~= nil then |
232 |
236 |
assert (auraId >= 1) |
assert (auraId >= 1) |
233 |
237 |
local unitDesignation = f.unitDesignation |
local unitDesignation = f.unitDesignation |
234 |
|
local remainingSecs, duration = getUnitAuraRemainingSecs(unitDesignation, auraId) |
|
|
238 |
|
local remainingSecs, duration, stackQuantity = getUnitAuraRemainingSecs(unitDesignation, auraId) |
235 |
239 |
if remainingSecs > 0 then |
if remainingSecs > 0 then |
236 |
240 |
f:Show() |
f:Show() |
237 |
|
f.text:SetText(string.format("%.0f", remainingSecs)) |
|
|
241 |
|
local t = '' |
|
242 |
|
if stackQuantity > 1 then |
|
243 |
|
t = string.format("%.0f\r\n(%d)", remainingSecs, stackQuantity) |
|
244 |
|
else |
|
245 |
|
t = string.format("%.0f", remainingSecs) |
|
246 |
|
end |
|
247 |
|
f.text:SetText(t) |
238 |
248 |
local r = remainingSecs / duration |
local r = remainingSecs / duration |
239 |
249 |
local bleed = math.min(1.5 * r, 1) |
local bleed = math.min(1.5 * r, 1) |
240 |
250 |
f.background:SetVertexColor(1, bleed, bleed) |
f.background:SetVertexColor(1, bleed, bleed) |
|
... |
... |
local function initEveryIndicator(rootFrame) |
355 |
365 |
local _, playerClassDesignation = UnitClass('player') |
local _, playerClassDesignation = UnitClass('player') |
356 |
366 |
if 'PALADIN' == playerClassDesignation then |
if 'PALADIN' == playerClassDesignation then |
357 |
367 |
initPaladinIndicator(rootFrame) |
initPaladinIndicator(rootFrame) |
|
368 |
|
elseif 'PRIEST' == playerClassDesignation then |
|
369 |
|
initIndicator(rootFrame, 'Surge of Light', 0, 2, 33151) |
|
370 |
|
initIndicator(rootFrame, 'Serendipity', 0, 3, 63731) |
358 |
371 |
elseif 'DRUID' == playerClassDesignation then |
elseif 'DRUID' == playerClassDesignation then |
359 |
372 |
initIndicator(rootFrame, 'Clearcasting', 0, 0) |
initIndicator(rootFrame, 'Clearcasting', 0, 0) |
360 |
373 |
elseif 'WARRIOR' == playerClassDesignation then |
elseif 'WARRIOR' == playerClassDesignation then |