Bot update - waypoints, attacking, looting

This commit is contained in:
OTCv8
2019-11-02 08:43:11 +01:00
parent 62ff2b1cf5
commit 6dd9a54749
15 changed files with 1640 additions and 63 deletions

View File

@@ -10,6 +10,19 @@ context.getSpectators = function(multifloor)
return g_map.getSpectators(context.player:getPosition(), multifloor)
end
context.getCreatureById = function(id, multifloor)
if type(id) ~= 'number' then return nil end
if multifloor ~= true then
multifloor = false
end
for i, spec in ipairs(g_map.getSpectators(context.player:getPosition(), multifloor)) do
if spec:getId() == id then
return spec
end
end
return nil
end
context.getCreatureByName = function(name, multifloor)
if not name then return nil end
name = name:lower()
@@ -70,6 +83,10 @@ context.autoWalk = function(destination, maxDist, ignoreFields, ignoreCreatures)
if #path < 1 then
return false
end
g_game.autoWalk(path, context.player:getPosition())
if g_game.getFeature(GameNewWalking) then
g_game.autoWalk(path, context.player:getPosition())
else
g_game.autoWalk(path, {x=0,y=0,z=0})
end
return true
end