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:
BeniS
2013-01-09 04:32:37 +13:00
parent 493202afcf
commit a1a8d28f5c
11 changed files with 84 additions and 105 deletions

View File

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