Implement dash walking and zoom out again

This commit is contained in:
Eduardo Bart
2013-02-26 16:37:02 -03:00
parent 2a225b99b7
commit d0576da69d
9 changed files with 107 additions and 18 deletions

View File

@@ -12,6 +12,11 @@ Panel
!text: tr('Enable smart walking')
!tooltip: tr('Will detect when to use diagonal step based on the\nkeys you are pressing')
OptionCheckBox
id: dashWalk
!text: tr('Enable dash walking')
!tooltip: tr('Will boost your walk on high speed characters')
OptionCheckBox
id: showPing
!text: tr('Show connection ping')

View File

@@ -5,6 +5,7 @@ local defaultOptions = {
fullscreen = false,
classicControl = false,
smartWalk = false,
dashWalk = false,
autoChaseOverride = true,
showStatusMessagesInConsole = true,
showEventMessagesInConsole = true,

View File

@@ -15,14 +15,13 @@ limitZoom = false
currentViewMode = 0
smartWalkDirs = {}
smartWalkDir = nil
walkFunction = g_game.walk
walkFunction = nil
function init()
g_ui.importStyle('styles/countwindow')
connect(g_game, {
onGameStart = onGameStart,
onGMActions = onGMActions,
onGameEnd = onGameEnd,
onLoginAdvice = onLoginAdvice,
}, true)
@@ -119,7 +118,6 @@ function terminate()
disconnect(g_game, {
onGameStart = onGameStart,
onGMActions = onGMActions,
onGameEnd = onGameEnd,
onLoginAdvice = onLoginAdvice
})
@@ -139,6 +137,16 @@ function onGameStart()
else
g_game.disableFeature(GameForceFirstAutoWalkStep)
end
addEvent(function()
if not limitZoom or g_game.isGM() then
gameMapPanel:setMaxZoomOut(513)
gameMapPanel:setLimitVisibleRange(false)
else
gameMapPanel:setMaxZoomOut(11)
gameMapPanel:setLimitVisibleRange(true)
end
end)
end
function onGameEnd()
@@ -152,8 +160,6 @@ function show()
gameRootPanel:show()
gameRootPanel:focus()
gameMapPanel:followCreature(g_game.getLocalPlayer())
gameMapPanel:setMaxZoomOut(11)
gameMapPanel:setLimitVisibleRange(true)
setupViewMode(0)
updateStretchShrink()
logoutButton:setTooltip(tr('Logout'))
@@ -199,6 +205,7 @@ function onLoginAdvice(message)
end
function forceExit()
g_game.cancelLogin()
scheduleEvent(exit, 10)
return true
end
@@ -284,11 +291,16 @@ end
function smartWalk(dir)
if g_keyboard.getModifiers() == KeyboardNoModifier then
if smartWalkDir then
walkFunction(smartWalkDir)
else
walkFunction(dir)
local func = walkFunction
if not func then
if modules.client_options.getOption('dashWalk') then
func = g_game.dashWalk
else
func = g_game.walk
end
end
local dire = smartWalkDir or dir
func(dire)
return true
end
return false
@@ -760,9 +772,3 @@ end
function limitZoom()
limitZoom = true
end
function onGMActions()
if not limitZoom then return end
gameMapPanel:setMaxZoomOut(513)
gameMapPanel:setLimitVisibleRange(false)
end

View File

@@ -50,6 +50,10 @@ function terminate()
onGameEnd = offline,
})
disconnect(LocalPlayer, {
onPositionChange = updateCameraPosition
})
local gameRootPanel = modules.game_interface.getRootPanel()
g_keyboard.unbindKeyPress('Alt+Left', gameRootPanel)
g_keyboard.unbindKeyPress('Alt+Right', gameRootPanel)