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:
BeniS
2013-01-21 05:09:14 +13:00
parent c28596292f
commit 8c6d5a0f5c
16 changed files with 110 additions and 54 deletions

View File

@@ -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

View File

@@ -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