mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
Auto walker update must be done from C++ not lua due to bot protection.
* Moved the auto walk checker to the source. * Implemented a temporary fix for findPath method (will now choose other tiles over null tiles).
This commit is contained in:
@@ -98,47 +98,3 @@ function Player:dismount()
|
||||
g_game.mount(false)
|
||||
end
|
||||
end
|
||||
|
||||
function Player:getLastDestination()
|
||||
return self.lastDestination
|
||||
end
|
||||
|
||||
function Player:setLastDestination(destination)
|
||||
self.lastDestination = destination
|
||||
end
|
||||
|
||||
function Player:getWalkSteps(destination)
|
||||
if not self.walkSteps or not destination then
|
||||
return nil
|
||||
end
|
||||
return self.walkSteps[destination]
|
||||
end
|
||||
|
||||
function Player:setWalkStep(destination)
|
||||
if not self.walkSteps then
|
||||
self.walkSteps = {}
|
||||
end
|
||||
if destination then
|
||||
if not self.walkSteps[destination] then
|
||||
self.walkSteps[destination] = {}
|
||||
end
|
||||
table.insert(self.walkSteps[destination], true)
|
||||
end
|
||||
end
|
||||
|
||||
function Player:clearWalkSteps()
|
||||
self.walkSteps = {}
|
||||
end
|
||||
|
||||
function Player:autoWalk(destination)
|
||||
self:clearWalkSteps()
|
||||
self:setLastDestination(destination)
|
||||
local dirs = g_map.findPath(self:getPosition(), destination, 127, PathFindFlags.AllowNullTiles)
|
||||
|
||||
if #dirs == 0 then
|
||||
modules.game_textmessage.displayStatusMessage(tr('There is no way.'))
|
||||
return false
|
||||
end
|
||||
g_game.autoWalk(dirs)
|
||||
return true
|
||||
end
|
Reference in New Issue
Block a user