Fix 255 also another cooldown bug:

* If you use the cooldown during the ping delay time it wouldn't init
  the cooldown again.
This commit is contained in:
BeniS 2013-01-31 20:31:21 +13:00
parent a0b2504f11
commit 9e208fa792
3 changed files with 24 additions and 24 deletions

View File

@ -8,6 +8,5 @@ function UIButton.create()
end
function UIButton:onMouseRelease(pos, button)
if self:isPressed() then return true end
return false
return self:isPressed()
end

View File

@ -78,8 +78,9 @@ function turnOffCooldown(progressRect)
end
-- create particles
local particle = g_ui.createWidget('GroupCooldownParticles', progressRect)
--[[local particle = g_ui.createWidget('GroupCooldownParticles', progressRect)
particle:fill('parent')
scheduleEvent(function() particle:destroy() end, 1000) -- hack until onEffectEnd]]
progressRect = nil
end
@ -109,9 +110,6 @@ function onSpellCooldown(iconId, duration)
local spell, profile, spellName = Spells.getSpellByIcon(iconId)
if not spellName then return end
--local ping = g_game.getPing()
--if ping > 0 then duration = duration + ping end
clientIconId = Spells.getClientId(spellName)
if not clientIconId then return end
@ -119,30 +117,33 @@ function onSpellCooldown(iconId, duration)
if not icon then
icon = g_ui.createWidget('SpellIcon', spellCooldownPanel)
icon:setId(spellName)
end
icon:setImageSource('/images/game/spells/' .. SpelllistSettings[profile].iconFile)
icon:setImageClip(Spells.getImageClip(clientIconId, profile))
local progressRect = g_ui.createWidget('SpellProgressRect', icon)
local progressRect = icon:getChildById(spellName)
if not progressRect then
progressRect = g_ui.createWidget('SpellProgressRect', icon)
progressRect:setId(spellName)
progressRect.icon = icon
progressRect:fill('parent')
else
progressRect:setPercent(0)
end
progressRect:setTooltip(spellName)
local updateFunc = function()
updateCooldown(progressRect, duration/25)
updateCooldown(progressRect, duration/20)
end
local finishFunc = function()
removeCooldown(progressRect)
end
initCooldown(progressRect, updateFunc, finishFunc)
end
end
function onSpellGroupCooldown(groupId, duration)
if not SpellGroups[groupId] then return end
--local ping = g_game.getPing()
--if ping > 0 then duration = duration + ping end
local icon = contentsPanel:getChildById('groupIcon' .. SpellGroups[groupId])
local progressRect = contentsPanel:getChildById('progressRect' .. SpellGroups[groupId])
if icon then
@ -154,7 +155,7 @@ function onSpellGroupCooldown(groupId, duration)
if progressRect then
removeEvent(progressRect.event)
local updateFunc = function()
updateCooldown(progressRect, duration/25)
updateCooldown(progressRect, duration/20)
end
local finishFunc = function()
turnOffCooldown(progressRect)