Merge pull request #296 from conde2/master

Fix spell cooldown
This commit is contained in:
Henrique Santiago 2013-03-04 18:58:47 -08:00
commit a85ca0fb17
1 changed files with 5 additions and 5 deletions

View File

@ -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)