Rework smart walk, fix #247
This commit is contained in:
parent
4f8f02acad
commit
2fd3c643c4
|
@ -344,7 +344,7 @@ locale = {
|
||||||
["You are dazzled"] = "Du bist geblendet",
|
["You are dazzled"] = "Du bist geblendet",
|
||||||
["You are dead."] = "Du bist tot.",
|
["You are dead."] = "Du bist tot.",
|
||||||
["You are dead"] = "Du bist tot",
|
["You are dead"] = "Du bist tot",
|
||||||
["You are drowing"] = "Du ertrinkst",
|
["You are drowning"] = "Du ertrinkst",
|
||||||
["You are drunk"] = "Du bist betrunken",
|
["You are drunk"] = "Du bist betrunken",
|
||||||
["You are electrified"] = "Du bist elektrifiziert",
|
["You are electrified"] = "Du bist elektrifiziert",
|
||||||
["You are freezing"] = "Du bist am Erfrieren",
|
["You are freezing"] = "Du bist am Erfrieren",
|
||||||
|
|
|
@ -345,7 +345,7 @@ locale = {
|
||||||
["You are dazzled"] = "Tu estas deslumbrado",
|
["You are dazzled"] = "Tu estas deslumbrado",
|
||||||
["You are dead."] = "Tu estas muerto.",
|
["You are dead."] = "Tu estas muerto.",
|
||||||
["You are dead"] = "Tu estas muerto",
|
["You are dead"] = "Tu estas muerto",
|
||||||
["You are drowing"] = "Tu estas ahotado",
|
["You are drowning"] = "Tu estas ahotado",
|
||||||
["You are drunk"] = "Tu estas borracho",
|
["You are drunk"] = "Tu estas borracho",
|
||||||
["You are electrified"] = "Tu estas electrificado",
|
["You are electrified"] = "Tu estas electrificado",
|
||||||
["You are freezing"] = "Tu estas congelado",
|
["You are freezing"] = "Tu estas congelado",
|
||||||
|
|
|
@ -347,7 +347,7 @@ locale = {
|
||||||
["You are dazzled"] = "Jestes oslepiony",
|
["You are dazzled"] = "Jestes oslepiony",
|
||||||
["You are dead."] = "Zginales marnie.",
|
["You are dead."] = "Zginales marnie.",
|
||||||
["You are dead"] = false,
|
["You are dead"] = false,
|
||||||
["You are drowing"] = "Topisz sie",
|
["You are drowning"] = "Topisz sie",
|
||||||
["You are drunk"] = false,
|
["You are drunk"] = false,
|
||||||
["You are electrified"] = "Jestes porazony pradem",
|
["You are electrified"] = "Jestes porazony pradem",
|
||||||
["You are freezing"] = "Marzniesz",
|
["You are freezing"] = "Marzniesz",
|
||||||
|
|
|
@ -341,7 +341,7 @@ locale = {
|
||||||
["You are dazzled"] = "Você está deslumbrado",
|
["You are dazzled"] = "Você está deslumbrado",
|
||||||
["You are dead."] = "Você está morto.",
|
["You are dead."] = "Você está morto.",
|
||||||
["You are dead"] = "Você está morto",
|
["You are dead"] = "Você está morto",
|
||||||
["You are drowing"] = "Você está se afogando",
|
["You are drowning"] = "Você está se afogando",
|
||||||
["You are drunk"] = "Você está bêbado",
|
["You are drunk"] = "Você está bêbado",
|
||||||
["You are electrified"] = "Você está eletrificado",
|
["You are electrified"] = "Você está eletrificado",
|
||||||
["You are freezing"] = "Você está congelando",
|
["You are freezing"] = "Você está congelando",
|
||||||
|
|
|
@ -345,7 +345,7 @@ locale = {
|
||||||
["You are dazzled"] = "Du är chockad",
|
["You are dazzled"] = "Du är chockad",
|
||||||
["You are dead."] = "Du är död.",
|
["You are dead."] = "Du är död.",
|
||||||
["You are dead"] = "Du är död",
|
["You are dead"] = "Du är död",
|
||||||
["You are drowing"] = "Du drunknar",
|
["You are drowning"] = "Du drunknar",
|
||||||
["You are drunk"] = "Du är full.",
|
["You are drunk"] = "Du är full.",
|
||||||
["You are electrified"] = "Du är elektrifierad",
|
["You are electrified"] = "Du är elektrifierad",
|
||||||
["You are freezing"] = "Du Fryser",
|
["You are freezing"] = "Du Fryser",
|
||||||
|
|
|
@ -339,7 +339,7 @@ neededTranslations = {
|
||||||
"You are dazzled",
|
"You are dazzled",
|
||||||
"You are dead.",
|
"You are dead.",
|
||||||
"You are dead",
|
"You are dead",
|
||||||
"You are drowing",
|
"You are drowning",
|
||||||
"You are drunk",
|
"You are drunk",
|
||||||
"You are electrified",
|
"You are electrified",
|
||||||
"You are freezing",
|
"You are freezing",
|
||||||
|
|
|
@ -12,11 +12,6 @@ Panel
|
||||||
!text: tr('Enable smart walking')
|
!text: tr('Enable smart walking')
|
||||||
!tooltip: tr('Will detect when to use diagonal step based on the\nkeys you are pressing')
|
!tooltip: tr('Will detect when to use diagonal step based on the\nkeys you are pressing')
|
||||||
|
|
||||||
//OptionCheckBox
|
|
||||||
//id: walkBooster
|
|
||||||
//!text: tr('Enable walk booster')
|
|
||||||
//!tooltip: tr('Also known as dash in community, recommended\nfor playing characters with high speed')
|
|
||||||
|
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
id: showPing
|
id: showPing
|
||||||
!text: tr('Show connection ping')
|
!text: tr('Show connection ping')
|
||||||
|
|
|
@ -4,7 +4,6 @@ local defaultOptions = {
|
||||||
showPing = false,
|
showPing = false,
|
||||||
fullscreen = false,
|
fullscreen = false,
|
||||||
classicControl = false,
|
classicControl = false,
|
||||||
walkBooster = false,
|
|
||||||
smartWalk = false,
|
smartWalk = false,
|
||||||
autoChaseOverride = true,
|
autoChaseOverride = true,
|
||||||
showStatusMessagesInConsole = true,
|
showStatusMessagesInConsole = true,
|
||||||
|
@ -95,7 +94,6 @@ function init()
|
||||||
end
|
end
|
||||||
|
|
||||||
g_keyboard.bindKeyDown('Ctrl+Shift+F', function() toggleOption('fullscreen') end)
|
g_keyboard.bindKeyDown('Ctrl+Shift+F', function() toggleOption('fullscreen') end)
|
||||||
--g_keyboard.bindKeyDown('Ctrl+D', function() toggleOption('walkBooster') end)
|
|
||||||
|
|
||||||
optionsWindow = g_ui.displayUI('options')
|
optionsWindow = g_ui.displayUI('options')
|
||||||
optionsWindow:hide()
|
optionsWindow:hide()
|
||||||
|
|
|
@ -74,7 +74,7 @@ local function onWidgetKeyDown(widget, keyCode, keyboardModifiers)
|
||||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||||
local callback = widget.boundKeyDownCombos[keyComboDesc]
|
local callback = widget.boundKeyDownCombos[keyComboDesc]
|
||||||
if callback then
|
if callback then
|
||||||
callback()
|
callback(widget, keyCode)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
@ -85,7 +85,7 @@ local function onWidgetKeyUp(widget, keyCode, keyboardModifiers)
|
||||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||||
local callback = widget.boundKeyUpCombos[keyComboDesc]
|
local callback = widget.boundKeyUpCombos[keyComboDesc]
|
||||||
if callback then
|
if callback then
|
||||||
callback()
|
callback(widget, keyCode)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
@ -96,7 +96,7 @@ local function onWidgetKeyPress(widget, keyCode, keyboardModifiers, autoRepeatTi
|
||||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||||
local comboConf = widget.boundKeyPressCombos[keyComboDesc]
|
local comboConf = widget.boundKeyPressCombos[keyComboDesc]
|
||||||
if comboConf and (autoRepeatTicks >= comboConf.autoRepeatDelay or autoRepeatTicks == 0) and comboConf.callback then
|
if comboConf and (autoRepeatTicks >= comboConf.autoRepeatDelay or autoRepeatTicks == 0) and comboConf.callback then
|
||||||
comboConf.callback()
|
comboConf.callback(widget, keyCode)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -81,6 +81,20 @@ function table.removevalue(t, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function table.popvalue(value)
|
||||||
|
local index = nil
|
||||||
|
for k,v in pairs(t) do
|
||||||
|
if v == value or not value then
|
||||||
|
index = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if index then
|
||||||
|
table.remove(t, index)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function table.compare(t, other)
|
function table.compare(t, other)
|
||||||
if #t ~= #other then return false end
|
if #t ~= #other then return false end
|
||||||
for k,v in pairs(t) do
|
for k,v in pairs(t) do
|
||||||
|
|
|
@ -7,7 +7,7 @@ Icons[16] = { tooltip = tr('You are protected by a magic shield'), path = '/imag
|
||||||
Icons[32] = { tooltip = tr('You are paralysed'), path = '/images/game/states/slowed', id = 'condition_slowed' }
|
Icons[32] = { tooltip = tr('You are paralysed'), path = '/images/game/states/slowed', id = 'condition_slowed' }
|
||||||
Icons[64] = { tooltip = tr('You are hasted'), path = '/images/game/states/haste', id = 'condition_haste' }
|
Icons[64] = { tooltip = tr('You are hasted'), path = '/images/game/states/haste', id = 'condition_haste' }
|
||||||
Icons[128] = { tooltip = tr('You may not logout during a fight'), path = '/images/game/states/logout_block', id = 'condition_logout_block' }
|
Icons[128] = { tooltip = tr('You may not logout during a fight'), path = '/images/game/states/logout_block', id = 'condition_logout_block' }
|
||||||
Icons[256] = { tooltip = tr('You are drowing'), path = '/images/game/states/drowning', id = 'condition_drowning' }
|
Icons[256] = { tooltip = tr('You are drowning'), path = '/images/game/states/drowning', id = 'condition_drowning' }
|
||||||
Icons[512] = { tooltip = tr('You are freezing'), path = '/images/game/states/freezing', id = 'condition_freezing' }
|
Icons[512] = { tooltip = tr('You are freezing'), path = '/images/game/states/freezing', id = 'condition_freezing' }
|
||||||
Icons[1024] = { tooltip = tr('You are dazzled'), path = '/images/game/states/dazzled', id = 'condition_dazzled' }
|
Icons[1024] = { tooltip = tr('You are dazzled'), path = '/images/game/states/dazzled', id = 'condition_dazzled' }
|
||||||
Icons[2048] = { tooltip = tr('You are cursed'), path = '/images/game/states/cursed', id = 'condition_cursed' }
|
Icons[2048] = { tooltip = tr('You are cursed'), path = '/images/game/states/cursed', id = 'condition_cursed' }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
WALK_AUTO_REPEAT_DELAY = 180
|
WALK_REPEAT_DELAY = 60
|
||||||
WALK_STEPS_RETRY = 10
|
WALK_STEPS_RETRY = 10
|
||||||
|
|
||||||
gameRootPanel = nil
|
gameRootPanel = nil
|
||||||
|
@ -14,19 +14,9 @@ exitWindow = nil
|
||||||
bottomSplitter = nil
|
bottomSplitter = nil
|
||||||
limitZoom = false
|
limitZoom = false
|
||||||
currentViewMode = 0
|
currentViewMode = 0
|
||||||
|
smartWalkDirs = {}
|
||||||
lastDir = nil
|
smartWalkDir = nil
|
||||||
walkEvent = nil
|
smartWalkEvent = nil
|
||||||
arrowKeys = {
|
|
||||||
[North] = 'Up',
|
|
||||||
[South] = 'Down',
|
|
||||||
[East] = 'Right',
|
|
||||||
[West] = 'Left',
|
|
||||||
[NorthEast] = 'Numpad9',
|
|
||||||
[SouthEast] = 'Numpad3',
|
|
||||||
[NorthWest] = 'Numpad7',
|
|
||||||
[SouthWest] = 'Numpad1'
|
|
||||||
}
|
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
g_ui.importStyle('styles/countwindow')
|
g_ui.importStyle('styles/countwindow')
|
||||||
|
@ -41,6 +31,7 @@ function init()
|
||||||
gameRootPanel:hide()
|
gameRootPanel:hide()
|
||||||
gameRootPanel:lower()
|
gameRootPanel:lower()
|
||||||
gameRootPanel.onGeometryChange = updateStretchShrink
|
gameRootPanel.onGeometryChange = updateStretchShrink
|
||||||
|
gameRootPanel.onFocusChange = cancelSmartWalk
|
||||||
|
|
||||||
mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
|
mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
|
||||||
mouseGrabberWidget.onMouseRelease = onMouseGrabberRelease
|
mouseGrabberWidget.onMouseRelease = onMouseGrabberRelease
|
||||||
|
@ -64,24 +55,31 @@ function init()
|
||||||
end
|
end
|
||||||
|
|
||||||
function bindKeys()
|
function bindKeys()
|
||||||
g_keyboard.bindKeyPress('Up', function() smartWalk(North) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Right', function() smartWalk(East) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Down', function() smartWalk(South) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Left', function() smartWalk(West) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
|
|
||||||
g_keyboard.bindKeyDown('Up', function() changeWalkDir(North) end, gameRootPanel)
|
g_keyboard.bindKeyDown('Up', function() changeWalkDir(North) end, gameRootPanel)
|
||||||
g_keyboard.bindKeyDown('Right', function() changeWalkDir(East) end, gameRootPanel)
|
g_keyboard.bindKeyDown('Right', function() changeWalkDir(East) end, gameRootPanel)
|
||||||
g_keyboard.bindKeyDown('Down', function() changeWalkDir(South) end, gameRootPanel)
|
g_keyboard.bindKeyDown('Down', function() changeWalkDir(South) end, gameRootPanel)
|
||||||
g_keyboard.bindKeyDown('Left', function() changeWalkDir(West) end, gameRootPanel)
|
g_keyboard.bindKeyDown('Left', function() changeWalkDir(West) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad8', function() changeWalkDir(North) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad9', function() changeWalkDir(NorthEast) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad6', function() changeWalkDir(East) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad3', function() changeWalkDir(SouthEast) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad2', function() changeWalkDir(South) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad1', function() changeWalkDir(SouthWest) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad4', function() changeWalkDir(West) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyDown('Numpad7', function() changeWalkDir(NorthWest) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Up', function() changeWalkDir(North, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Right', function() changeWalkDir(East, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Down', function() changeWalkDir(South, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Left', function() changeWalkDir(West, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad8', function() changeWalkDir(North, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad9', function() changeWalkDir(NorthEast, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad6', function() changeWalkDir(East, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad3', function() changeWalkDir(SouthEast, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad2', function() changeWalkDir(South, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad1', function() changeWalkDir(SouthWest, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad4', function() changeWalkDir(West, true) end, gameRootPanel)
|
||||||
|
g_keyboard.bindKeyUp('Numpad7', function() changeWalkDir(NorthWest, true) end, gameRootPanel)
|
||||||
|
|
||||||
g_keyboard.bindKeyPress('Numpad8', function() smartWalk(North) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Numpad9', function() smartWalk(NorthEast) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Numpad6', function() smartWalk(East) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Numpad3', function() smartWalk(SouthEast) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Numpad2', function() smartWalk(South) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Numpad1', function() smartWalk(SouthWest) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Numpad4', function() smartWalk(West) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Numpad7', function() smartWalk(NorthWest) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
g_keyboard.bindKeyPress('Ctrl+Up', function() g_game.turn(North) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
g_keyboard.bindKeyPress('Ctrl+Up', function() g_game.turn(North) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||||
g_keyboard.bindKeyPress('Ctrl+Right', function() g_game.turn(East) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
g_keyboard.bindKeyPress('Ctrl+Right', function() g_game.turn(East) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||||
g_keyboard.bindKeyPress('Ctrl+Down', function() g_game.turn(South) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
g_keyboard.bindKeyPress('Ctrl+Down', function() g_game.turn(South) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
||||||
|
@ -103,6 +101,8 @@ end
|
||||||
function terminate()
|
function terminate()
|
||||||
hide()
|
hide()
|
||||||
|
|
||||||
|
cancelSmartWalk()
|
||||||
|
|
||||||
disconnect(g_game, {
|
disconnect(g_game, {
|
||||||
onGameStart = onGameStart,
|
onGameStart = onGameStart,
|
||||||
onGameEnd = onGameEnd,
|
onGameEnd = onGameEnd,
|
||||||
|
@ -209,42 +209,51 @@ function tryLogout()
|
||||||
anchor=AnchorHorizontalCenter}, yesCallback, noCallback)
|
anchor=AnchorHorizontalCenter}, yesCallback, noCallback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function changeWalkDir(dir)
|
function cancelSmartWalk()
|
||||||
local player = g_game.getLocalPlayer()
|
if smartWalkEvent then
|
||||||
local lastWalkDir = g_game.getLastWalkDir()
|
smartWalkEvent:cancel()
|
||||||
if lastWalkDir ~= dir and player:isWalking() then
|
smartWalkEvent = nil
|
||||||
smartWalk(dir)
|
|
||||||
end
|
end
|
||||||
|
smartWalkDirs = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function smartWalk(defaultDir)
|
function changeWalkDir(dir, pop)
|
||||||
local rebindKey = false
|
if pop then
|
||||||
local lastKey = arrowKeys[lastDir]
|
table.removevalue(smartWalkDirs, dir)
|
||||||
|
if #smartWalkDirs == 0 and smartWalkEvent then
|
||||||
|
smartWalkEvent:cancel()
|
||||||
|
smartWalkEvent = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table.insert(smartWalkDirs, 1, dir)
|
||||||
|
if not smartWalkEvent then
|
||||||
|
smartWalkEvent = cycleEvent(smartWalk, WALK_REPEAT_DELAY)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- choose the new direction
|
smartWalkDir = smartWalkDirs[1]
|
||||||
if not g_keyboard.isKeyPressed(arrowKeys[defaultDir]) then
|
if modules.client_options.getOption('smartWalk') and #smartWalkDirs > 1 then
|
||||||
local changeDir = false
|
for _,d in pairs(smartWalkDirs) do
|
||||||
for k,v in pairs(arrowKeys) do
|
if (smartWalkDir == North and d == West) or (smartWalkDir == West and d == North) then
|
||||||
if g_keyboard.isKeyPressed(v) then
|
smartWalkDir = NorthWest
|
||||||
defaultDir = k
|
break
|
||||||
changeDir = true
|
elseif (smartWalkDir == North and d == East) or (smartWalkDir == East and d == North) then
|
||||||
|
smartWalkDir = NorthEast
|
||||||
|
break
|
||||||
|
elseif (smartWalkDir == South and d == West) or (smartWalkDir == West and d == South) then
|
||||||
|
smartWalkDir = SouthWest
|
||||||
|
break
|
||||||
|
elseif (smartWalkDir == South and d == East) or (smartWalkDir == East and d == South) then
|
||||||
|
smartWalkDir = SouthEast
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not changeDir then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- key is still pressed from previous walk event
|
function smartWalk()
|
||||||
if lastDir and lastDir ~= defaultDir and g_keyboard.isKeyPressed(lastKey) then
|
local dir = smartWalkDir
|
||||||
if g_keyboard.isKeySetPressed(arrowKeys) then
|
|
||||||
g_keyboard.unbindKeyPress(lastKey, gameRootPanel)
|
|
||||||
rebindKey = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local dir = defaultDir
|
|
||||||
if modules.client_options.getOption('smartWalk') then
|
if modules.client_options.getOption('smartWalk') then
|
||||||
if g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Left') then
|
if g_keyboard.isKeyPressed('Up') and g_keyboard.isKeyPressed('Left') then
|
||||||
dir = NorthWest
|
dir = NorthWest
|
||||||
|
@ -257,20 +266,7 @@ function smartWalk(defaultDir)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if modules.client_options.getOption('walkBooster') then
|
|
||||||
if g_game.getLocalPlayer():canWalk(dir) then
|
|
||||||
g_game.walk(dir)
|
g_game.walk(dir)
|
||||||
else
|
|
||||||
g_game.forceWalk(dir)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
g_game.walk(dir)
|
|
||||||
end
|
|
||||||
|
|
||||||
if rebindKey then
|
|
||||||
g_keyboard.bindKeyPress(lastKey, function() smartWalk(lastDir) end, gameRootPanel, WALK_AUTO_REPEAT_DELAY)
|
|
||||||
end
|
|
||||||
lastDir = dir
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateStretchShrink()
|
function updateStretchShrink()
|
||||||
|
|
Loading…
Reference in New Issue