Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------ZMIENNE----------------------------
- local LootdBP = 'brocade backpack'
- local SuplieBP = 'grey backpack'
- local LeaveCap = 80 --- wychodzi ponizej tylu cap
- local LeaveManas = 40 --- wychodzi ponizej typu mana potkow
- local MaxManas = 170 --- kupuje tyle manaskow
- local MaxSDSD = 1000 --- kupuje tyle sd
- local LeaveSDSD = 160 --- wychodzi ponizej tylu sd
- local idMana = 23373 -- id manaskow
- local idSD = 3155 --- id sd
- registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
- print("witam")
- wait(10000)
- function onWalkerSelectLabel(labelName)
- ---------------------------------otwieranie bp-----------------
- if (labelName == "ResetBPs") then
- Walker.Stop()
- wait(1000,1500)
- Self.CloseContainers()
- wait(1000,1500)
- Self.OpenMainBackpack(true):OpenChildren({Item.GetID(LootdBP), true}, {Item.GetID(SuplieBP), true})
- wait(1000,1500)
- Walker.Start()
- ----------------------DEPOSITER------------------------------
- elseif (labelName == 'DepositItems') then
- delayWalker(2000)
- setWalkerEnabled(false)
- Self.ReachDepot()
- local validBackpacks = {3083, 6299, 3037, 3067, 3371, 3324, 812, 3063, 811, 3332, 3039, 3038, 3041, 3554, 6499, 3030, 5887, 282, 239, 3032, 5944, 3057}
- local lootContainer = Container.New(8860, 2869)
- repeat
- Self.DepositItems ({3386, 0}, {7402, 0}, {3392, 0}, {3280, 0}, {7399, 0}, {5882, 1}, {5948, 1}, {3029, 1})
- if (table.contains(validBackpacks, lootContainer:GetItemData(0).id)) then
- lootContainer:UseItem(0, true)
- wait(500)
- end
- until
- lootContainer:GetItemData(0).id == 0
- ---------------------MANA SHOP------------------------------
- elseif (labelName == 'Buy') then
- Walker.Stop()
- wait(1000,1100)
- Self.SayToNpc("hi")
- wait(1000,1100)
- Self.SayToNpc("trade")
- wait(1000,1100)
- Self.ShopBuyItemsUpTo(idMana, MaxManas)
- wait(1000,1100)
- Self.SayToNpc("bye")
- wait(1000,1100)
- Self.SayToNpc("hi")
- wait(1000,1100)
- Self.SayToNpc("trade")
- wait(1000,1100)
- Self.ShopBuyItemsUpTo(idSD, MaxSDSD)
- wait(1000,1100)
- Self.SayToNpc("bye")
- Walker.Start()
- elseif (labelName == "checksupplies") then
- if(Self.ItemCount(idMana) < MaxManas) then
- Walker.Goto("BeforeBuy")
- print("za malo manasow kupuje na nowo")
- elseif (Self.ItemCount(idSD) < MaxSDSD) then
- Walker.Goto("BeforeBuy")
- print("za malo sd kupuje na nowo")
- else
- Walker.Goto("skipsupplies")
- print("kupilem wszystko")
- end
- elseif (labelName == "Check") then
- if (Self.ItemCount(idMana) < LeaveManas) then
- Walker.Goto("Leaving")
- print("za malo manasow, ide na refill")
- elseif (Self.ItemCount(idSD) < LeaveSDSD) then
- Walker.Goto("Leaving")
- print("za malo sd, ide na refill")
- else
- Walker.Goto("Continue")
- print("wystarczajaco supli, expie dalej")
- end
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement