Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------------------------------------------------------------------------------------------
- ---Ustawienia Backpackow---
- ----------------MAIN BACKPACKA NIE TRZEBA USTAWIAĆ, NIE MA ZNACZENIA JAKI MAMY, SAM SIĘ OTWORZY------------------------
- local manaBP = "blue backpack" --- plecak na mana poty
- local sdBP = "brocade backpack" --- plecak na sd
- local lootBP = "jewelled backpack" --- plecak na loota
- -----------------------------------------------------------------------------------------------------------------------
- --- Ustawienia Cavebota ---
- local sdLeave = 200 --- wychodzi ponizej tylu sd.
- local sdBuy = 1500 --- kupuje tyle sd.
- local manaBuy = 300 --- kupuje tyle mana potow
- local manaLeave = 50 --- wychodzi ponizej tylu mana potow
- -----------------------------------------------------------------------------------------------------------------------
- --- ID Potionow ---
- local sdID = 3155 --- id sd.
- local manaID = 23373 --- id mana potów.
- -----------------------------------------------------------------------------------------------------------------------
- Targeting.Start()
- registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
- print([[War Golems Yalahar/Start Depo Yalahar]])
- wait(10000)
- function onWalkerSelectLabel(labelName)
- if (labelName == "Depot") then
- delayWalker(2000)
- setWalkerEnabled(false)
- Self.ReachDepot()
- Self.OpenDepot()
- Self.DepositItems({3326, 0}, {7426, 0}, {7422, 0}, {7428, 0}, {3554, 0}, {7403, 0}, {820, 0}, {12305, 0})
- elseif (labelName == "Checking") then
- if (Self.ItemCount(manaID) < manaLeave) then
- Walker.Goto("Leaving")
- print("malo mana potow, wychodze z exp")
- elseif (Self.ItemCount(sdID) < sdLeave) then
- Walker.Goto("Leaving")
- print("malo sd, wychodze z exp")
- else
- Walker.Goto("Hunting")
- print("Wystarczajaco potow. Pozostalo ".. (Self.ItemCount(manaID)-manaLeave) .. " mana potionow i " .. (Self.ItemCount(sdID)-sdLeave) .. " sd do refilla")
- end
- elseif (labelName == "CheckSupplies") then
- if Self.ItemCount(manaID) < manaBuy then
- Walker.Goto("BeforePotions")
- print("za malo mana potow, kupuje na nowo")
- elseif Self.ItemCount(sdID) < sdBuy then
- Walker.Goto("BeforePotions")
- wait(1000,1000)
- print("Za malo sd, kupuje na nowo")
- else
- Walker.Goto("SkipSupplies")
- wait(1000,1000)
- print("Kupilem wszystko, ide na hunt")
- end
- elseif (labelName == "Potions") then
- Walker.Stop()
- wait(1000,1100)
- Self.SayToNpc("hi")
- wait(1000,1100)
- Self.SayToNpc("trade")
- wait(1000,1100)
- Self.ShopBuyItemsUpTo(manaID, manaBuy)
- wait(1000,1100)
- Self.SayToNpc("bye")
- wait(1000,1100)
- Self.SayToNpc("hi")
- wait(1000,1100)
- Self.SayToNpc("trade")
- wait(1000)
- Self.ShopBuyItemsUpTo(sdID, sdBuy)
- wait(1000,1100)
- Self.SayToNpc("bye")
- wait(1000)
- Walker.Start()
- elseif (labelName == "BPReset") then
- Walker.Stop()
- wait(1000,1500)
- Self.CloseContainers()
- wait(1000,1500)
- Self.OpenMainBackpack(true):OpenChildren({Item.GetID(manaBP), true}, {Item.GetID(sdBP), true}, {Item.GetID(lootBP), true})
- wait(1000,1500)
- 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("Znalezione depoty: " .. 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("ktos/cos blokuje depo, szukam nasepnego.")
- end
- end
- return false
- end
- repeat
- reachedDP = gotoDepot()
- if reachedDP then
- return true
- end
- tries = tries - 1
- sleep(100)
- print("nie znalazlem depo " .. tries .. " proby")
- 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
- Module('SortManaPotion', function(mod)
- if (#Container.GetAll() >= 1) then
- if (Container(0):CountItemsOfID(ManaPots) >=1) then
- for spot = Container(0):ItemCount()-1, 0, -1 do
- local item = Container(0):GetItemData(spot)
- if (item.id == ManaPots) then
- Container(0):MoveItemToContainer(spot, Container.GetByName(manaBP):Index(), 0)
- break
- end
- end
- end
- end
- end)
- Module('SortHealthPotion', function(mod)
- if (#Container.GetAll() >= 1) then
- if (Container(0):CountItemsOfID(HpPot) >=1) then
- for spot = Container(0):ItemCount()-1, 0, -1 do
- local item = Container(0):GetItemData(spot)
- if (item.id == HpPot) then
- Container(0):MoveItemToContainer(spot, Container.GetByName(hpBP):Index(), 0)
- break
- end
- end
- end
- end
- end)
- function OnSpeak(channel, message)
- if (message == "refill") then
- wait(500)
- Walker.Goto("Leaving")
- wait(500)
- newChannel:SendOrangeMessage("BotChat", "Ide na refill")
- end
- end
- function OnClose()
- end
- -----
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement