Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. --------------------------ZMIENNE----------------------------
  2.  
  3. local LootdBP = 'brocade backpack'
  4. local SuplieBP = 'grey backpack'
  5. local LeaveCap = 80 --- wychodzi ponizej tylu cap
  6. local LeaveManas = 40 --- wychodzi ponizej typu mana potkow
  7. local MaxManas = 170 --- kupuje tyle manaskow
  8. local MaxSDSD = 1000 --- kupuje tyle sd
  9. local LeaveSDSD = 160 --- wychodzi ponizej tylu sd
  10.  
  11. local idMana = 23373 -- id manaskow
  12. local idSD = 3155 --- id sd
  13.  
  14.  
  15. registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
  16. print("witam")
  17. wait(10000)
  18.  
  19. function onWalkerSelectLabel(labelName)
  20. ---------------------------------otwieranie bp-----------------
  21. if (labelName == "ResetBPs") then
  22.  
  23. Walker.Stop()
  24. wait(1000,1500)
  25. Self.CloseContainers()
  26. wait(1000,1500)
  27. Self.OpenMainBackpack(true):OpenChildren({Item.GetID(LootdBP), true}, {Item.GetID(SuplieBP), true})
  28. wait(1000,1500)
  29. Walker.Start()
  30.  
  31. ----------------------DEPOSITER------------------------------
  32.  
  33. elseif (labelName == 'DepositItems') then
  34. delayWalker(2000)
  35. setWalkerEnabled(false)
  36. Self.ReachDepot()
  37.  
  38. local validBackpacks = {3083, 6299, 3037, 3067, 3371, 3324, 812, 3063, 811, 3332, 3039, 3038, 3041, 3554, 6499, 3030, 5887, 282, 239, 3032, 5944, 3057}
  39. local lootContainer = Container.New(8860, 2869)
  40.  
  41. repeat
  42. Self.DepositItems ({3386, 0}, {7402, 0}, {3392, 0}, {3280, 0}, {7399, 0}, {5882, 1}, {5948, 1}, {3029, 1})
  43.  
  44. if (table.contains(validBackpacks, lootContainer:GetItemData(0).id)) then
  45. lootContainer:UseItem(0, true)
  46. wait(500)
  47. end
  48. until
  49. lootContainer:GetItemData(0).id == 0
  50.  
  51.  
  52. ---------------------MANA SHOP------------------------------
  53.  
  54. elseif (labelName == 'Buy') then
  55. Walker.Stop()
  56. wait(1000,1100)
  57. Self.SayToNpc("hi")
  58. wait(1000,1100)
  59. Self.SayToNpc("trade")
  60. wait(1000,1100)
  61. Self.ShopBuyItemsUpTo(idMana, MaxManas)
  62. wait(1000,1100)
  63. Self.SayToNpc("bye")
  64. wait(1000,1100)
  65. Self.SayToNpc("hi")
  66. wait(1000,1100)
  67. Self.SayToNpc("trade")
  68. wait(1000,1100)
  69. Self.ShopBuyItemsUpTo(idSD, MaxSDSD)
  70. wait(1000,1100)
  71. Self.SayToNpc("bye")
  72. Walker.Start()
  73.  
  74. elseif (labelName == "checksupplies") then
  75. if(Self.ItemCount(idMana) < MaxManas) then
  76. Walker.Goto("BeforeBuy")
  77. print("za malo manasow kupuje na nowo")
  78. elseif (Self.ItemCount(idSD) < MaxSDSD) then
  79. Walker.Goto("BeforeBuy")
  80. print("za malo sd kupuje na nowo")
  81. else
  82. Walker.Goto("skipsupplies")
  83. print("kupilem wszystko")
  84. end
  85.  
  86. elseif (labelName == "Check") then
  87. if (Self.ItemCount(idMana) < LeaveManas) then
  88. Walker.Goto("Leaving")
  89. print("za malo manasow, ide na refill")
  90. elseif (Self.ItemCount(idSD) < LeaveSDSD) then
  91. Walker.Goto("Leaving")
  92. print("za malo sd, ide na refill")
  93. else
  94. Walker.Goto("Continue")
  95. print("wystarczajaco supli, expie dalej")
  96. end
  97. end
  98. end
  99.  
  100. Self.ReachDepot = function (tries)
  101. local tries = tries or 3
  102. Walker.Stop()
  103. local DepotIDs = {3497, 3498, 3499, 3500}
  104. local DepotPos = {}
  105. for i = 1, #DepotIDs do
  106. local dps = Map.GetUseItems(DepotIDs[i])
  107. for j = 1, #dps do
  108. table.insert(DepotPos, dps[j])
  109. end
  110. end
  111. local function gotoDepot()
  112. local pos = Self.Position()
  113. print("Znalezione depoty: " .. tostring(#DepotPos))
  114. for i = 1, #DepotPos do
  115. location = DepotPos[i]
  116. Self.UseItemFromGround(location.x, location.y, location.z)
  117. wait(1000, 2000)
  118. if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then
  119. wait(5000, 6000)
  120. if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then
  121. Walker.Start()
  122. return true
  123. end
  124. else
  125. print("ktos/cos blokuje depo, szukam nasepnego.")
  126. end
  127. end
  128. return false
  129. end
  130.  
  131. repeat
  132. reachedDP = gotoDepot()
  133. if reachedDP then
  134. return true
  135. end
  136. tries = tries - 1
  137. sleep(100)
  138. print("nie znalazlem depo " .. tries .. " proby")
  139. until tries <= 0
  140.  
  141. return false
  142. end
  143.  
  144. Map.GetUseItems = function (id)
  145. if type(id) == "string" then
  146. id = Item.GetID(id)
  147. end
  148. local pos = Self.Position()
  149. local store = {}
  150. for x = -7, 7 do
  151. for y = -5, 5 do
  152. if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
  153. itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
  154. table.insert(store, itemPos)
  155. end
  156. end
  157. end
  158. return store
  159. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement