Browse Source

Fix 255 also another cooldown bug:

* If you use the cooldown during the ping delay time it wouldn't init
  the cooldown again.
BeniS 8 years ago
parent
commit
9e208fa792

+ 1
- 2
modules/corelib/ui/uibutton.lua View File

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

+ 21
- 20
modules/game_cooldown/cooldown.lua View File

@@ -78,8 +78,9 @@ function turnOffCooldown(progressRect)
78 78
   end
79 79
   
80 80
   -- create particles
81
-  local particle = g_ui.createWidget('GroupCooldownParticles', progressRect)
81
+  --[[local particle = g_ui.createWidget('GroupCooldownParticles', progressRect)
82 82
   particle:fill('parent')
83
+  scheduleEvent(function() particle:destroy() end, 1000) -- hack until onEffectEnd]]
83 84
 
84 85
   progressRect = nil
85 86
 end
@@ -109,9 +110,6 @@ function onSpellCooldown(iconId, duration)
109 110
   local spell, profile, spellName = Spells.getSpellByIcon(iconId)
110 111
   if not spellName then return end
111 112
   
112
-  --local ping = g_game.getPing()
113
-  --if ping > 0 then duration = duration + ping end
114
-  
115 113
   clientIconId = Spells.getClientId(spellName)
116 114
   if not clientIconId then return end
117 115
   
@@ -119,29 +117,32 @@ function onSpellCooldown(iconId, duration)
119 117
   if not icon then
120 118
     icon = g_ui.createWidget('SpellIcon', spellCooldownPanel)
121 119
     icon:setId(spellName)
122
-    icon:setImageSource('/images/game/spells/' .. SpelllistSettings[profile].iconFile)
123
-    icon:setImageClip(Spells.getImageClip(clientIconId, profile))
124
-  
125
-    local progressRect = g_ui.createWidget('SpellProgressRect', icon)
120
+  end
121
+  icon:setImageSource('/images/game/spells/' .. SpelllistSettings[profile].iconFile)
122
+  icon:setImageClip(Spells.getImageClip(clientIconId, profile))
123
+
124
+  local progressRect = icon:getChildById(spellName)
125
+  if not progressRect then
126
+    progressRect = g_ui.createWidget('SpellProgressRect', icon)
127
+    progressRect:setId(spellName)
126 128
     progressRect.icon = icon
127 129
     progressRect:fill('parent')
128
-    progressRect:setTooltip(spellName)
130
+  else
131
+    progressRect:setPercent(0)
132
+  end
133
+  progressRect:setTooltip(spellName)
129 134
 
130
-    local updateFunc = function()
131
-      updateCooldown(progressRect, duration/25)
132
-    end
133
-    local finishFunc = function()
134
-      removeCooldown(progressRect)
135
-    end
136
-    initCooldown(progressRect, updateFunc, finishFunc)
135
+  local updateFunc = function()
136
+    updateCooldown(progressRect, duration/20)
137
+  end
138
+  local finishFunc = function()
139
+    removeCooldown(progressRect)
137 140
   end
141
+  initCooldown(progressRect, updateFunc, finishFunc)
138 142
 end
139 143
 
140 144
 function onSpellGroupCooldown(groupId, duration)
141 145
   if not SpellGroups[groupId] then return end
142
-  
143
-  --local ping = g_game.getPing()
144
-  --if ping > 0 then duration = duration + ping end
145 146
 
146 147
   local icon = contentsPanel:getChildById('groupIcon' .. SpellGroups[groupId])
147 148
   local progressRect = contentsPanel:getChildById('progressRect' .. SpellGroups[groupId])
@@ -154,7 +155,7 @@ function onSpellGroupCooldown(groupId, duration)
154 155
   if progressRect then
155 156
     removeEvent(progressRect.event)
156 157
     local updateFunc = function()
157
-      updateCooldown(progressRect, duration/25)
158
+      updateCooldown(progressRect, duration/20)
158 159
     end
159 160
     local finishFunc = function()
160 161
       turnOffCooldown(progressRect)

+ 1
- 1
modules/game_interface/gameinterface.lua View File

@@ -134,7 +134,7 @@ function onGameStart()
134 134
   -- open tibia has delay in auto walking
135 135
   if not g_game.isOfficialTibia() then
136 136
     g_game.enableFeature(GameForceFirstAutoWalkStep)
137
-   else
137
+  else
138 138
     g_game.disableFeature(GameForceFirstAutoWalkStep)
139 139
   end
140 140
 end

Loading…
Cancel
Save