mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
Finalizing auto walk enhancements, closes #63, also other fixes:
* Can now auto walk up to 1000 steps! * Re-added sexy topmenu buttons :) * Tooltip for logout/edit will now change * Changed xxStackpos to xxStackPos
This commit is contained in:
@@ -209,7 +209,7 @@ function addCreature(creature)
|
||||
battleButton:setup(creature)
|
||||
|
||||
battleButton.onHoverChange = onBattleButtonHoverChange
|
||||
battleButton.onMouseRelease = onMouseRelease
|
||||
battleButton.onMouseRelease = onBattleButtonMouseRelease
|
||||
|
||||
battleButtonsByCreaturesList[creatureId] = battleButton
|
||||
|
||||
@@ -225,7 +225,27 @@ function addCreature(creature)
|
||||
end
|
||||
end
|
||||
|
||||
function onMouseRelease(self, mousePosition, mouseButton)
|
||||
function removeAllCreatures()
|
||||
for i, v in pairs(battleButtonsByCreaturesList) do
|
||||
removeCreature(v.creature)
|
||||
end
|
||||
end
|
||||
|
||||
function removeCreature(creature)
|
||||
if hasCreature(creature) then
|
||||
local creatureId = creature:getId()
|
||||
|
||||
if lastBattleButtonSwitched == battleButtonsByCreaturesList[creatureId] then
|
||||
lastBattleButtonSwitched = nil
|
||||
end
|
||||
|
||||
battleButtonsByCreaturesList[creatureId].creature:hideStaticSquare()
|
||||
battleButtonsByCreaturesList[creatureId]:destroy()
|
||||
battleButtonsByCreaturesList[creatureId] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function onBattleButtonMouseRelease(self, mousePosition, mouseButton)
|
||||
if mouseWidget.cancelNextRelease then
|
||||
mouseWidget.cancelNextRelease = false
|
||||
return false
|
||||
@@ -249,26 +269,6 @@ function onMouseRelease(self, mousePosition, mouseButton)
|
||||
return false
|
||||
end
|
||||
|
||||
function removeAllCreatures()
|
||||
for i, v in pairs(battleButtonsByCreaturesList) do
|
||||
removeCreature(v.creature)
|
||||
end
|
||||
end
|
||||
|
||||
function removeCreature(creature)
|
||||
if hasCreature(creature) then
|
||||
local creatureId = creature:getId()
|
||||
|
||||
if lastBattleButtonSwitched == battleButtonsByCreaturesList[creatureId] then
|
||||
lastBattleButtonSwitched = nil
|
||||
end
|
||||
|
||||
battleButtonsByCreaturesList[creatureId].creature:hideStaticSquare()
|
||||
battleButtonsByCreaturesList[creatureId]:destroy()
|
||||
battleButtonsByCreaturesList[creatureId] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function onBattleButtonHoverChange(widget, hovered)
|
||||
if widget.isBattleButton then
|
||||
widget.isHovered = hovered
|
||||
|
Reference in New Issue
Block a user