mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34: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
|
||||
|
@@ -49,7 +49,7 @@ function init()
|
||||
gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel')
|
||||
connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
|
||||
|
||||
logoutButton = modules.client_topmenu.addLeftButton('logoutButton', 'Logout', '/images/topbuttons/logout', tryLogout, true)
|
||||
logoutButton = modules.client_topmenu.addLeftButton('logoutButton', 'Exit', '/images/topbuttons/logout', tryLogout, true)
|
||||
|
||||
bindKeys()
|
||||
|
||||
@@ -111,6 +111,7 @@ function terminate()
|
||||
end
|
||||
|
||||
function onGameStart()
|
||||
logoutButton:setTooltip('Logout')
|
||||
show()
|
||||
|
||||
-- open tibia has delay in auto walking
|
||||
@@ -120,6 +121,7 @@ function onGameStart()
|
||||
end
|
||||
|
||||
function onGameEnd()
|
||||
logoutButton:setTooltip('Exit')
|
||||
hide()
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user