Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.06 KB | None | 0 0
  1. --[[ CONFIG ]]--
  2. mainBP = "backpack of holding"
  3. lootBP = "zaoan chess box"
  4. goldBP = "red backpack"
  5.  
  6. manaID = 268 -- Mana Potion ID, Leave as is.
  7. manaCost = 50 -- Cost of the Mana Potion
  8. minManas = 150 -- Less than this amount, Bot will go refill.
  9. maxManas = 400 -- Amount of Mana Potions to buy up to at Shop.
  10.  
  11. healthID = 239 -- Mana Potion ID, Leave as is.
  12. healthCost = 190 -- Cost of the Mana Potion
  13. minHealths = 10 -- Less than this amount, Bot will go refill.
  14. maxHealths = 22 -- Amount of Mana Potions to buy up to at Shop.
  15.  
  16. minCap = 300 ---- if less then script will exit spawn
  17.  
  18. dropEmpties = false
  19. useTp = false
  20.  
  21. print("#Yolo #Swag")
  22. registerEventListener(WALKER_SELECTLABEL, "onLabel")
  23. function onLabel(label)
  24. if label == "Bp Reset" then
  25. setWalkerEnabled(false)
  26. Self.CloseContainers() wait(500,750)
  27. wait(500, 900)
  28. while Self.OpenMainBackpack():OpenChildren(lootBP, goldBP) do
  29. wait(500,750)
  30. end
  31. if #Container.GetIndexes() < 3 then
  32. gotoLabel("Start")
  33. end
  34. setWalkerEnabled(true)
  35. elseif label == "Bank" then
  36. if not(Self.Position().x == 33014 and Self.Position().y == 31492 and Self.Position().z == 10) then
  37. gotoLabel("beforeBank")
  38. end
  39. setWalkerEnabled(false)
  40. Self.SayToNpc({'hi','deposit all','yes','withdraw ' .. ((maxManas-Self.ItemCount(manaID)) * manaCost)+((maxHealths-Self.ItemCount(healthID)) * healthCost),'yes','balance'},65)
  41. setWalkerEnabled(true)
  42. elseif label == "Shop" then
  43. setWalkerEnabled(false)
  44. Self.SayToNpc({'hi','flasks','yes'},65)
  45. while Self.ItemCount(284) > 0 or Self.ItemCount(285) > 0 do
  46. Self.SayToNpc('yes')
  47. wait(200, 500)
  48. end
  49. Self.SayToNpc({'hi','trade'},70)
  50. wait(200, 500)
  51. if Self.ItemCount(manaID) < maxManas then
  52. Self.ShopBuyItem (manaID, maxManas - Self.ItemCount(manaID))
  53. wait(700,1000)
  54. end
  55. if Self.ItemCount(healthID) < maxHealths then
  56. Self.ShopBuyItem(healthID, maxHealths - Self.ItemCount(healthID))
  57. wait(500, 900)
  58. end
  59. setWalkerEnabled(true)
  60. elseif label == "Bp Reset2" then
  61. setWalkerEnabled(false)
  62. Self.CloseContainers() wait(500,750)
  63. wait(500, 900)
  64. while Self.OpenMainBackpack():OpenChildren(lootBP, goldBP) do
  65. wait(500,750)
  66. end
  67. if #Container.GetIndexes() < 3 then
  68. gotoLabel("beforePots")
  69. end
  70. setWalkerEnabled(true)
  71. elseif label == "useLever" then
  72. if not(Self.Position().x == 33061 and Self.Position().y == 31527 and Self.Position().z == 10) then
  73. gotoLabel("goHunt")
  74. end
  75. setBotEnabled(false)
  76. for i = 1,2 do
  77. Self.UseLever(33062, 31527, 10)
  78. wait(1000, 1500)
  79. end
  80. setBotEnabled(true)
  81. elseif label == "checkTp" then
  82. if not(Self.Position().x == 32995 and Self.Position().y == 31553 and Self.Position().z == 4) then
  83. gotoLabel("useLever")
  84. end
  85. if useTp == false then
  86. gotoLabel("contWalk")
  87. end
  88. elseif label == "useLever2" then
  89. if not(Self.Position().x == 32991 and Self.Position().y == 31539 and Self.Position().z == 4) then
  90. gotoLabel("contTp")
  91. end
  92. setBotEnabled(false)
  93. for i = 1, 2 do
  94. Self.UseLever(32992, 31539, 4)
  95. wait(1000, 1500)
  96. end
  97. setBotEnabled(true)
  98. elseif label == "afterExani" then
  99. if not(Self.Position().x == 33008 and Self.Position().y == 31554 and Self.Position().z == 4) then
  100. gotoLabel("contWalk")
  101. end
  102. elseif label == "afterExani2" then
  103. if not(Self.Position().x == 33027 and Self.Position().y == 31549 and Self.Position().z == 6) then
  104. gotoLabel("beforeExani")
  105. end
  106. elseif label == "Check" then
  107. if (Self.Cap() > minCap and Self.ItemCount(manaID) > minManas and Self.ItemCount(healthID) > minHealths) then
  108. gotoLabel("Spawn")
  109. end
  110. if (Self.Position().z == 7 and Self.Cap() > minCap and Self.ItemCount(manaID) > minManas and Self.ItemCount(healthID) > minHealths) then
  111. gotoLabel("beforeHunt")
  112. end
  113. elseif label == "afterExani3" then
  114. if not(Self.Position().x == 33026 and Self.Position().y == 31549 and Self.Position().z == 5) then
  115. gotoLabel("beforeExani2")
  116. end
  117. elseif label == "useLever3" then
  118. if not(Self.Position().x == 32993 and Self.Position().y == 31547 and Self.Position().z == 4) then
  119. gotoLabel("contWalk3")
  120. end
  121. setBotEnabled(false)
  122. for i = 1, 2 do
  123. Self.UseLever(32994, 31547, 4)
  124. wait(1000, 1500)
  125. end
  126. setBotEnabled(true)
  127. elseif label == "Bank2" then
  128. if not(Self.Position().x == 33013 and Self.Position().y == 31492 and Self.Position().z == 10) then
  129. gotoLabel("beforeBank3")
  130. end
  131. setWalkerEnabled(false)
  132. Self.SayToNpc({'hi','deposit all','yes','balance'},65)
  133. setWalkerEnabled(true)
  134. elseif label == "Depot" then
  135. setWalkerEnabled(false)
  136. Self.ReachDepot()
  137. Self.DepositItems({3032, 0}, {10328, 0}, {10279, 0}, {3556, 1}, {281, 0}, {282, 0})
  138. wait(850,1250)
  139. end
  140. end
  141.  
  142. Module.New('vial-dropper', function()
  143. if dropEmpties == true and Self.Cap() < minCap then
  144. wait(150,300)
  145. Self.DropFlasks(Self.Position().x, Self.Position().y, Self.Position().z)
  146. end
  147. end)
  148.  
  149. Map.GetUseItems = function (id)
  150. if type(id) == "string" then
  151. id = Item.GetID(id)
  152. end
  153. local pos = Self.Position()
  154. local store = {}
  155. for x = -7, 7 do
  156. for y = -5, 5 do
  157. if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
  158. itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
  159. table.insert(store, itemPos)
  160. end
  161. end
  162. end
  163. return store
  164. end
  165.  
  166. Self.ReachDepot = function (tries)
  167. local tries = tries or 3
  168. setWalkerEnabled(false)
  169. local DepotIDs = {3497, 3498, 3499, 3500}
  170. local DepotPos = {}
  171. for i = 1, #DepotIDs do
  172. local dps = Map.GetUseItems(DepotIDs[i])
  173. for j = 1, #dps do
  174. table.insert(DepotPos, dps[j])
  175. end
  176. end
  177. local function gotoDepot()
  178. local pos = Self.Position()
  179. print("Depots found: " .. tostring(#DepotPos))
  180. for i = 1, #DepotPos do
  181. location = DepotPos[i]
  182. Self.UseItemFromGround(location.x, location.y, location.z)
  183. wait(1000, 2000)
  184. if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then
  185. wait(5000, 6000)
  186. if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then
  187. setWalkerEnabled(true)
  188. return true
  189. end
  190. else
  191. print("Something is blocking the path. Trying next depot.")
  192. end
  193. end
  194. return false
  195. end
  196.  
  197. repeat
  198. reachedDP = gotoDepot()
  199. if reachedDP then
  200. return true
  201. end
  202. tries = tries - 1
  203. sleep(100)
  204. print("Attempt to reach depot was unsuccessfull. " .. tries .. " tries left.")
  205. until tries <= 0
  206.  
  207. return false
  208. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement