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 end
function UIButton:onMouseRelease(pos, button) function UIButton:onMouseRelease(pos, button)
if self:isPressed() then return true end return self:isPressed()
return false
end end

View File

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