This commit is contained in:
OTCv8
2020-11-16 08:43:23 +01:00
parent a4f9250ddb
commit 2d1cbaae12
141 changed files with 14564 additions and 106 deletions

View File

@@ -0,0 +1,28 @@
local dest
local maxDist
local params
TargetBot.walkTo = function(_dest, _maxDist, _params)
dest = _dest
maxDist = _maxDist
params = _params
end
-- called every 100ms if targeting or looting is active
TargetBot.walk = function()
if not dest then return end
if player:isWalking() then return end
local pos = player:getPosition()
if pos.z ~= dest.z then return end
local dist = math.max(math.abs(pos.x-dest.x), math.abs(pos.y-dest.y))
if params.precision and params.precision >= dist then return end
if params.marginMin and params.marginMax then
if dist >= params.marginMin and dist <= params.marginMax then
return
end
end
local path = getPath(pos, dest, maxDist, params)
if path then
walk(path[1])
end
end