Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.96 KB | None | 0 0
  1. -----------------------------------------------------------------------------------------------------------------------
  2. ---Ustawienia Backpackow---
  3. ----------------MAIN BACKPACKA NIE TRZEBA USTAWIAĆ, NIE MA ZNACZENIA JAKI MAMY, SAM SIĘ OTWORZY------------------------
  4. local manaBP = "blue backpack" --- plecak na mana poty
  5. local sdBP = "brocade backpack" --- plecak na sd
  6. local lootBP = "jewelled backpack" --- plecak na loota
  7.  
  8. -----------------------------------------------------------------------------------------------------------------------
  9. --- Ustawienia Cavebota ---
  10. local sdLeave = 200 --- wychodzi ponizej tylu sd.
  11. local sdBuy = 1500 --- kupuje tyle sd.
  12. local manaBuy = 300 --- kupuje tyle mana potow
  13. local manaLeave = 50 --- wychodzi ponizej tylu mana potow
  14.  
  15. -----------------------------------------------------------------------------------------------------------------------
  16. --- ID Potionow ---
  17. local sdID = 3155 --- id sd.
  18. local manaID = 23373 --- id mana potów.
  19.  
  20. -----------------------------------------------------------------------------------------------------------------------
  21.  
  22.  
  23.  
  24.  
  25. Targeting.Start()
  26. registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
  27.  
  28. print([[War Golems Yalahar/Start Depo Yalahar]])
  29. wait(10000)
  30.  
  31. function onWalkerSelectLabel(labelName)
  32.  
  33. if (labelName == "Depot") then
  34. delayWalker(2000)
  35. setWalkerEnabled(false)
  36. Self.ReachDepot()
  37. Self.OpenDepot()
  38. Self.DepositItems({3326, 0}, {7426, 0}, {7422, 0}, {7428, 0}, {3554, 0}, {7403, 0}, {820, 0}, {12305, 0})
  39.  
  40. elseif (labelName == "Checking") then
  41. if (Self.ItemCount(manaID) < manaLeave) then
  42. Walker.Goto("Leaving")
  43. print("malo mana potow, wychodze z exp")
  44. elseif (Self.ItemCount(sdID) < sdLeave) then
  45. Walker.Goto("Leaving")
  46. print("malo sd, wychodze z exp")
  47. else
  48. Walker.Goto("Hunting")
  49. print("Wystarczajaco potow. Pozostalo ".. (Self.ItemCount(manaID)-manaLeave) .. " mana potionow i " .. (Self.ItemCount(sdID)-sdLeave) .. " sd do refilla")
  50. end
  51.  
  52.  
  53. elseif (labelName == "CheckSupplies") then
  54. if Self.ItemCount(manaID) < manaBuy then
  55. Walker.Goto("BeforePotions")
  56. print("za malo mana potow, kupuje na nowo")
  57. elseif Self.ItemCount(sdID) < sdBuy then
  58. Walker.Goto("BeforePotions")
  59. wait(1000,1000)
  60. print("Za malo sd, kupuje na nowo")
  61. else
  62. Walker.Goto("SkipSupplies")
  63. wait(1000,1000)
  64. print("Kupilem wszystko, ide na hunt")
  65. end
  66.  
  67. elseif (labelName == "Potions") then
  68. Walker.Stop()
  69. wait(1000,1100)
  70. Self.SayToNpc("hi")
  71. wait(1000,1100)
  72. Self.SayToNpc("trade")
  73. wait(1000,1100)
  74. Self.ShopBuyItemsUpTo(manaID, manaBuy)
  75. wait(1000,1100)
  76. Self.SayToNpc("bye")
  77. wait(1000,1100)
  78. Self.SayToNpc("hi")
  79. wait(1000,1100)
  80. Self.SayToNpc("trade")
  81. wait(1000)
  82. Self.ShopBuyItemsUpTo(sdID, sdBuy)
  83. wait(1000,1100)
  84. Self.SayToNpc("bye")
  85. wait(1000)
  86. Walker.Start()
  87.  
  88. elseif (labelName == "BPReset") then
  89. Walker.Stop()
  90. wait(1000,1500)
  91. Self.CloseContainers()
  92. wait(1000,1500)
  93. Self.OpenMainBackpack(true):OpenChildren({Item.GetID(manaBP), true}, {Item.GetID(sdBP), true}, {Item.GetID(lootBP), true})
  94. wait(1000,1500)
  95. Walker.Start()
  96. end
  97. end
  98.  
  99.  
  100.  
  101. -----
  102.  
  103.  
  104. Self.ReachDepot = function (tries)
  105. local tries = tries or 3
  106. Walker.Stop()
  107. local DepotIDs = {3497, 3498, 3499, 3500}
  108. local DepotPos = {}
  109. for i = 1, #DepotIDs do
  110. local dps = Map.GetUseItems(DepotIDs[i])
  111. for j = 1, #dps do
  112. table.insert(DepotPos, dps[j])
  113. end
  114. end
  115. local function gotoDepot()
  116. local pos = Self.Position()
  117. print("Znalezione depoty: " .. tostring(#DepotPos))
  118. for i = 1, #DepotPos do
  119. location = DepotPos[i]
  120. Self.UseItemFromGround(location.x, location.y, location.z)
  121. wait(1000, 2000)
  122. if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then
  123. wait(5000, 6000)
  124. if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then
  125. Walker.Start()
  126. return true
  127. end
  128. else
  129. print("ktos/cos blokuje depo, szukam nasepnego.")
  130. end
  131. end
  132. return false
  133. end
  134.  
  135. repeat
  136. reachedDP = gotoDepot()
  137. if reachedDP then
  138. return true
  139. end
  140. tries = tries - 1
  141. sleep(100)
  142. print("nie znalazlem depo " .. tries .. " proby")
  143. until tries <= 0
  144.  
  145. return false
  146. end
  147.  
  148. Map.GetUseItems = function (id)
  149. if type(id) == "string" then
  150. id = Item.GetID(id)
  151. end
  152. local pos = Self.Position()
  153. local store = {}
  154. for x = -7, 7 do
  155. for y = -5, 5 do
  156. if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
  157. itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
  158. table.insert(store, itemPos)
  159. end
  160. end
  161. end
  162. return store
  163. end
  164.  
  165. Module('SortManaPotion', function(mod)
  166. if (#Container.GetAll() >= 1) then
  167. if (Container(0):CountItemsOfID(ManaPots) >=1) then
  168. for spot = Container(0):ItemCount()-1, 0, -1 do
  169. local item = Container(0):GetItemData(spot)
  170. if (item.id == ManaPots) then
  171. Container(0):MoveItemToContainer(spot, Container.GetByName(manaBP):Index(), 0)
  172. break
  173. end
  174. end
  175. end
  176. end
  177. end)
  178.  
  179. Module('SortHealthPotion', function(mod)
  180. if (#Container.GetAll() >= 1) then
  181. if (Container(0):CountItemsOfID(HpPot) >=1) then
  182. for spot = Container(0):ItemCount()-1, 0, -1 do
  183. local item = Container(0):GetItemData(spot)
  184. if (item.id == HpPot) then
  185. Container(0):MoveItemToContainer(spot, Container.GetByName(hpBP):Index(), 0)
  186. break
  187. end
  188. end
  189. end
  190. end
  191. end)
  192.  
  193. function OnSpeak(channel, message)
  194. if (message == "refill") then
  195. wait(500)
  196. Walker.Goto("Leaving")
  197. wait(500)
  198. newChannel:SendOrangeMessage("BotChat", "Ide na refill")
  199. end
  200. end
  201.  
  202. function OnClose()
  203. end
  204.  
  205. -----
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement