Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----SETTINGS--------------------------------------------------------------
- --POTIONS--
- local ManaID = 268 --- Which mana potions are you using?
- local MinMana = 1 --- How many mana potions until you leave the hunt.
- local MaxMana = 3 --- How many mana potions you begin the hunt with.
- local ManaPrice = 50 --- What is the price of your selected mana potions?
- local HealthID = 23375 --- Which health potions are you using?
- local MinHealth = 100 --- How many health potions until you leave the hunt.
- local MaxHealth = 600 --- How many health potions you begin the hunt with.
- local HealthPrice = 310 --- What is the price of your selected mana potions?
- local AmmoID = 16141 --- Wchich ammo are you using?
- local MinAmmo = 100 --- How many ammo until you leave the hunt.
- local MaxAmmo = 1500 --- How many ammo you begin the hunt with.
- local AmmoPrice = 20 --- What is the price of your selected ammo?
- --CAP--
- local MinCap = 1 --- Leaves spawn when character reaches this cap.
- -- Backpack Configuration:
- local MainBp = "backpack" ----- Main Backpack
- local GoldBp = "brocade backpack" ---- Backpack to put gold in
- local LootBp = "yellow backpack" ---- Loot Bp
- local PotionBp = "camouflage backpack" ---- Potion Bp
- -- Spawn Options
- local HuntMiddle = false
- -- These are the flask IDs, not worth changing since it will sell all flasks regardless of type.
- local FlaskID = 283
- local FlaskIDA = 284
- local FlaskIDB = 285
- -- local GoldBP = 5801 --- Item ID of your gold backpack.
- registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
- function onWalkerSelectLabel(labelName)
- if (labelName == "Checker") then
- -- Check Supplies, Hunt or Leave
- Walker.ConditionalGoto((Self.ItemCount(ManaID) <= MinMana) or (Self.Cap() < MinCap) or (Self.ItemCount(HealthID) <= MinHealth) or (Self.ItemCount(AmmoID) <= MinAmmo), "Leave", "BeginHunt")
- elseif (labelName == "Start") then
- Walker.ConditionalGoto((Self.Position().z == 11), "BeginHunt", "ReachDepot")
- elseif (labelName == "DepositGold") then
- -- Deposit Gold, check balance.
- Walker.Stop()
- Self.SayToNpc({"hi", "deposit all", "yes"}, 100)
- local withdrawManas = math.max(MaxMana - Self.ItemCount(ManaID), 0)*ManaPrice
- local withdrawHealths = math.max(MaxHealth - Self.ItemCount(HealthID), 0)*HealthPrice
- local withdrawAmmo = math.max(MaxAmmo - Self.ItemCount(AmmoID), 0)*AmmoPrice
- local total = math.abs(withdrawManas + withdrawHealths + withdrawAmmo)
- if total >= 1 then
- Self.SayToNpc({"withdraw " .. total, "yes", "balance"}, 100)
- end
- Walker.Start()
- elseif (labelName == "DepositItems") then
- -- Deposit Items
- Walker.Stop()
- Self.ReachDepot(5)
- Self.DepositItems({268, 1}, {6499, 1}, {5889, 1}, {5887, 1}, {11457, 1}, {3724, 1}, {5877, 1}, {3061, 1}, {7367, 0}, {3371, 0}, {2958, 0}, {7399, 0}, {3332, 0}, {3416, 0}, {3554, 0}, {3369, 0}, {7452, 0}, {9056, 0}, {7421, 0})
- Walker.Start()
- elseif (labelName == "BuyManas") then
- -- Buy Mana Potions
- Walker.Stop()
- if (Self.ItemCount(ManaID) < MaxMana) or (Self.ItemCount(HealthID) < MaxHealth) then
- print("Buying manas or healths")
- Self.SayToNpc({"hi", "flasks"}, 100)
- while (Self.ItemCount(FlaskID) >= 1) or (Self.ItemCount(FlaskIDA) >= 1) or (Self.ItemCount(FlaskIDB) >= 1) do
- Self.SayToNpc("yes", 100)
- end
- wait(2000)
- Self.SayToNpc("trade", 100)
- wait(2000)
- while (Self.ItemCount(ManaID) < MaxMana) do
- Self.ShopBuyItemsUpTo(ManaID, MaxMana)
- wait(500,800)
- end
- if (Self.ItemCount(HealthID) < MaxHealth) then
- Self.ShopBuyItemsUpTo(HealthID, MaxHealth)
- wait(500)
- end
- wait(200, 500)
- end
- Walker.Start()
- elseif (labelName == "CheckGoneUp") then
- -- Check we're on floor 3
- Walker.ConditionalGoto((Self.Position().z == 7), "OpenSouth", "Leave")
- elseif (labelName == "CheckGoneDown") then
- -- Check we're on floor 7
- Walker.ConditionalGoto((Self.Position().z == 11), "AmDown", "EnterResp")
- elseif (labelName == "BuySpears") then
- --------------------------------- TODO -------------------------
- Walker.Stop()
- Self.SayToNpc({"hi", "trade"}, 100)
- -- Buy spears, make sure Self.ItemCount returns items in hands.
- while (Self.ItemCount(AmmoID) < MaxAmmo) do
- Self.ShopBuyItemsUpTo(AmmoID, MaxAmmo)
- wait(500,800)
- end
- Walker.Start()
- elseif (labelName == "Check1") then
- setWalkerEnabled(false)
- setTargetingEnabled(true)
- if (Self.Cap() > MinCap and Self.ItemCount(ManaID) > MinMana) and (Self.ItemCount(HealthID) > MinHealth) and (Self.ItemCount(AmmoID) > MinAmmo) and (Self.Stamina() > 840) then
- print("**Expienie Wznowione !**")
- setWalkerEnabled(true)
- else
- setTargetingEnabled(false)
- gotoLabel("Refill")
- print("**Wracam Do Miasta !**")
- setWalkerEnabled(true)
- end
- elseif (labelName == "TargetingOff") then
- setTargetingEnabled(false)
- print("&Targeting Wylaczony !&")
- wait(900, 1200)
- elseif (labelName == "TargetingOn") then
- setTargetingEnabled(false)
- print("&Targeting Wlaczony !&")
- wait(900, 1200)
- elseif (labelName == "ResetBps") then
- -- Reset Backpacks
- Walker.Stop()
- Self.CloseContainers()
- Self.OpenMainBackpack(true):OpenChildren({LootBp, true}, {GoldBp, true}, {PotionBp, true})
- Container.GetFirst():Minimize()
- Walker.Start()
- elseif (labelName == "OpenNorth") then
- Walker.Stop()
- Self.UseItemFromGround(Self.Position().x, Self.Position().y - 1, Self.Position().z)
- Walker.Start()
- elseif (labelName == "OpenSouth") then
- Walker.Stop()
- Self.UseItemFromGround(Self.Position().x, Self.Position().y + 1, Self.Position().z)
- Walker.Start()
- elseif (labelName == "MiddleSpawn") then
- Walker.Stop()
- Walker.ConditionalGoto(HuntMiddle, "MiddleGo", "MiddleDone")
- Walker.Start()
- 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
- Map.GetUseItems = function (id)
- if type(id) == "string" then
- id = Item.GetID(id)
- end
- local pos = Self.Position()
- local store = {}
- for x = -7, 7 do
- for y = -5, 5 do
- if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
- itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
- table.insert(store, itemPos)
- end
- end
- end
- return store
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement