mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-10-24 00:15:02 +02:00
Updated to OTCv8 3.1 rev 157
This commit is contained in:
40
modules/game_bot/default_configs/vBot_4.5/cavebot/travel.lua
Normal file
40
modules/game_bot/default_configs/vBot_4.5/cavebot/travel.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
CaveBot.Extensions.Travel = {}
|
||||
|
||||
CaveBot.Extensions.Travel.setup = function()
|
||||
CaveBot.registerAction("Travel", "#db5a5a", function(value, retries)
|
||||
local data = string.split(value, ",")
|
||||
if #data < 2 then
|
||||
warn("CaveBot[Travel]: incorrect travel value!")
|
||||
return false
|
||||
end
|
||||
|
||||
local npcName = data[1]:trim()
|
||||
local dest = data[2]:trim()
|
||||
|
||||
if retries > 5 then
|
||||
print("CaveBot[Travel]: too many tries, can't travel")
|
||||
return false
|
||||
end
|
||||
|
||||
local npc = getCreatureByName(npcName)
|
||||
if not npc then
|
||||
print("CaveBot[Travel]: NPC not found, can't travel")
|
||||
return false
|
||||
end
|
||||
|
||||
if not CaveBot.ReachNPC(npcName) then
|
||||
return "retry"
|
||||
end
|
||||
|
||||
CaveBot.Travel(dest)
|
||||
delay(storage.extras.talkDelay*3)
|
||||
print("CaveBot[Travel]: travel action finished")
|
||||
return true
|
||||
end)
|
||||
|
||||
CaveBot.Editor.registerAction("travel", "travel", {
|
||||
value="NPC name, city",
|
||||
title="Travel",
|
||||
description="NPC name, City name, delay in ms(default is 200ms)",
|
||||
})
|
||||
end
|
||||
Reference in New Issue
Block a user