local ManaMax = 1500
local ManaMin = 200
local ManaPot = "mana potion"
local HpMax = 500
local HpMin = 100
local HpPot = "supreme health potion"
local AmmoMax = 900
local AmmoMin = 300
local Ammo = "crystalline arrow"
local RuneMax = 0
local RuneMin = 0
local RuneName = "avalanche"
local ItemBP = "crystal backpack"
local StackBP = "jewelled backpack"
local SuppliesBP = "orange backpack"
local MinCap = 100
local hardcore = true
----------------------------------------------------------------
--- Walker and labels to set:
--- start at depo
--- 1. RestartBps
--- way to bank
--- 2. DepositGold
--- way to potion shop
--- 3. BuyPots
--- way to ammo
--- 4. BuyAmmo - if you need ammo
--- way to rune shop
--- 5. BuyRunes - if you need runes
--- way to depo
--- 6. CheckBefore
--- way to hunt place
--- 7. StartHunt
--- route around spawn
--- 8. Check
--- way to depo
--- built in reach depo function in client
--- built in deposit items function in client
----------------------------------------------------------------
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
print("Full afk script by Trykon")
print("Happy Hunting!")
function onWalkerSelectLabel(labelName)
if(labelName == "DepositGold") then
Walker.Stop()
Self.SayToNpc("hi")
wait(200,1000)
Self.SayToNpc("deposit all")
wait(200, 1000)
Self.SayToNpc("yes")
wait(1000)
Walker.Start()
elseif(labelName == "Hardcore") then
if(hardcore == false) then
gotoLabel("SkipHardcore")
end
elseif(labelName == "BuyPots")then
Walker.Stop()
Self.SayToNpc("hi")
wait(200,1000)
Self.SayToNpc("trade")
wait(200, 1000)
Self.ShopBuyItemsUpTo(HpPot, HpMax)
wait(200, 1000)
Self.ShopBuyItemsUpTo(ManaPot, ManaMax)
wait(1000)
Walker.Start()
elseif(labelName == "BuyAmmo") then
Walker.Stop()
Self.SayToNpc("hi")
wait(200,1000)
Self.SayToNpc("trade")
wait(200, 1000)
Self.ShopBuyItemsUpTo(Ammo, AmmoMax)
wait(200, 1000)
wait(1000)
Walker.Start()
elseif(labelName == "BuyRunes") then
Walker.Stop()
Self.SayToNpc("hi")
wait(200,1000)
Self.SayToNpc("trade")
wait(200, 1000)
Self.ShopBuyItemsUpTo(RuneName, RuneMax)
wait(200, 1000)
wait(1000)
Walker.Start()
elseif(labelName == "CheckBefore") then
if(Self.Cap() < MinCap or Self.ItemCount(HpPot) < HpMax or Self.ItemCount(Ammo) < AmmoMax or Self.ItemCount(RuneName) < RuneMax or Self.ItemCount(ManaPot) < ManaMax) then
gotoLabel("RestartBps")
else
print("Check passed")
end
elseif (labelName == "DepositItems") then
-- Deposit Items
Walker.Stop()
Self.ReachDepot(5)
Self.DepositItems({812, 1}, {811, 1}, {3342, 1}, {3324, 1}, {21165, 1}, {21164, 1}, {21180, 1}, {21179, 1}, {21178, 1}, {7419, 1}, {7386, 1}, {21167, 1}, {7412, 1}, {9027, 1}, {6299, 1}, {21183, 1})
Self.DepositItems({3038, 0}, {21203, 0}, {9057, 0}, {3032, 0}, {9667, 0}, {10293, 0}, {9055, 0}, {9054, 0}, {9053, 0}, {10308, 0}, {6574, 0})
Walker.Start()
elseif(labelName == "RestartBps") then
Walker.Stop()
Self.CloseContainers()
wait(200)
Self.OpenMainBackpack(true)
Container.GetFirst():OpenChildren(ItemBP)
wait(1000)
Container.GetFirst():OpenChildren(StackBP)
wait(1000)
Container.GetFirst():OpenChildren(SuppliesBP)
wait(1000)
Container.GetByName(ItemBP):Minimize()
wait(1000)
Container.GetByName(StackBP):Minimize()
wait(1000)
Container.GetByName(SuppliesBP):Minimize()
wait(200)
Walker.Start()
elseif(labelName == "Check") then
if(Self.Cap() >= MinCap and Self.ItemCount(Ammo) >= AmmoMin and Self.ItemCount(HpPot) >= HpMin and Self.ItemCount(RuneName) >= RuneMin and Self.ItemCount(ManaPot) >= ManaMin) then
gotoLabel("StartHunt")
else
print("No supplies")
end
end
Self.ReachDepot = function (tries)
local tries = tries or 3
Walker.Stop()
local DepotIDs = {3497, 3498, 3499, 3500}
local DepotPos = {}
for i = 1, #DepotIDs do
local dps = Map.GetUseItems(DepotIDs[i])
for j = 1, #dps do
table.insert(DepotPos, dps[j])
end
end
local function gotoDepot()
local pos = Self.Position()
print("Depots found: " .. tostring(#DepotPos))
for i = 1, #DepotPos do
location = DepotPos[i]
Self.UseItemFromGround(location.x, location.y, location.z)
wait(1000, 2000)
if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then
wait(5000, 6000)
if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then
Walker.Start()
return true
end
else
print("Something is blocking the path. Trying next depot.")
end
end
return false
end
repeat
reachedDP = gotoDepot()
if reachedDP then
return true
end
tries = tries - 1
sleep(100)
print("Attempt to reach depot was unsuccessfull. " .. tries .. " tries left.")
until tries <= 0
return false
end
end