mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-21 23:15:54 +02:00
Version 2.6.1
This commit is contained in:
@@ -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
|
Reference in New Issue
Block a user