diff --git a/modules/corelib/ui/uibutton.lua b/modules/corelib/ui/uibutton.lua index 5be35107..90da18ae 100644 --- a/modules/corelib/ui/uibutton.lua +++ b/modules/corelib/ui/uibutton.lua @@ -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 diff --git a/modules/game_cooldown/cooldown.lua b/modules/game_cooldown/cooldown.lua index b71959c4..8aa67ec6 100644 --- a/modules/game_cooldown/cooldown.lua +++ b/modules/game_cooldown/cooldown.lua @@ -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,29 +117,32 @@ function onSpellCooldown(iconId, duration) if not icon then icon = g_ui.createWidget('SpellIcon', spellCooldownPanel) icon:setId(spellName) - icon:setImageSource('/images/game/spells/' .. SpelllistSettings[profile].iconFile) - icon:setImageClip(Spells.getImageClip(clientIconId, profile)) - - local progressRect = g_ui.createWidget('SpellProgressRect', icon) + end + icon:setImageSource('/images/game/spells/' .. SpelllistSettings[profile].iconFile) + icon:setImageClip(Spells.getImageClip(clientIconId, profile)) + + local progressRect = icon:getChildById(spellName) + if not progressRect then + progressRect = g_ui.createWidget('SpellProgressRect', icon) + progressRect:setId(spellName) progressRect.icon = icon progressRect:fill('parent') - progressRect:setTooltip(spellName) + else + progressRect:setPercent(0) + end + progressRect:setTooltip(spellName) - local updateFunc = function() - updateCooldown(progressRect, duration/25) - end - local finishFunc = function() - removeCooldown(progressRect) - end - initCooldown(progressRect, updateFunc, finishFunc) + local updateFunc = function() + updateCooldown(progressRect, duration/20) + end + local finishFunc = function() + removeCooldown(progressRect) end + initCooldown(progressRect, updateFunc, finishFunc) 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]) @@ -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) diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 77065add..b8c1243a 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -134,7 +134,7 @@ function onGameStart() -- open tibia has delay in auto walking if not g_game.isOfficialTibia() then g_game.enableFeature(GameForceFirstAutoWalkStep) - else + else g_game.disableFeature(GameForceFirstAutoWalkStep) end end