Fix spell cooldown timer

master
Joao Pasqualini Costa 11 years ago
parent 71b5c5f2e4
commit 115bf08364

@ -128,12 +128,12 @@ function initCooldown(progressRect, updateCallback, finishCallback)
updateCallback() updateCallback()
end end
function updateCooldown(progressRect, interval) function updateCooldown(progressRect, duration)
progressRect:setPercent(progressRect:getPercent() + 5) progressRect:setPercent(progressRect:getPercent() + 10000/duration)
if progressRect:getPercent() < 100 then if progressRect:getPercent() < 100 then
removeEvent(progressRect.event) removeEvent(progressRect.event)
progressRect.event = scheduleEvent(function() progressRect.callback[ProgressCallback.update]() end, interval) progressRect.event = scheduleEvent(function() progressRect.callback[ProgressCallback.update]() end, 100)
else else
progressRect.callback[ProgressCallback.finish]() progressRect.callback[ProgressCallback.finish]()
end end
@ -158,7 +158,7 @@ function onSpellCooldown(iconId, duration)
progressRect:setTooltip(spellName) progressRect:setTooltip(spellName)
local updateFunc = function() local updateFunc = function()
updateCooldown(progressRect, duration/19) updateCooldown(progressRect, duration)
end end
local finishFunc = function() local finishFunc = function()
removeCooldown(progressRect) removeCooldown(progressRect)
@ -180,7 +180,7 @@ function onSpellGroupCooldown(groupId, duration)
if progressRect then if progressRect then
removeEvent(progressRect.event) removeEvent(progressRect.event)
local updateFunc = function() local updateFunc = function()
updateCooldown(progressRect, duration/19) updateCooldown(progressRect, duration)
end end
local finishFunc = function() local finishFunc = function()
turnOffCooldown(progressRect) turnOffCooldown(progressRect)

Loading…
Cancel
Save