Advertisement
Guest User

blad lua

a guest
Jul 26th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.85 KB | None | 0 0
  1. --[[
  2.  
  3. Serpent Spawn for Mage's
  4. by Crest from Pandoriumx
  5.  
  6. ]]--
  7.  
  8.  
  9. --[[Variables]]--
  10. local minCap = 100 -- Mininum cap
  11. local minSD = 100 -- minimum sds
  12. local SD = 2000
  13. local manaPotID = 268 -- ID of mana potion
  14. local manaPotCost = 50 -- Cost of each mana potion
  15. local minManaPot = 50 -- Mininum mana potion
  16. local maxManaPot = 250 -- Maximum mana pots to buy
  17. local usingSoftboots = true -- Using Softboots? (True Or False)
  18. local usingRings = true -- Using Life/Rings of Healing? (True Or False)
  19. local minimizeEQ = true
  20. local minimizeBPS = true
  21. local lootBP = "Blue Backpack"
  22. local goldBP = "Red Backpack"
  23. local stackBP = "Backpack"
  24. local runeBP = "Golden Backpack"
  25. local Boots = 3079 -- Boots (for use with softboots script)
  26. local ManaToEquip = 4000 -- Mana to equip softboots
  27. local ManaToUnequip = 4500 -- Mana to unequip softboots
  28. local RestoreMana = false -- Uses manas < 40% mana and when no creatures on screen until > 85%
  29. local defaultTileId = 354 -- the tile id when it is closed
  30.  
  31. --[[########################################################]]--
  32. --[[##########NOTHING BELOW HERE SHOULD BE CHANGED##########]]--
  33. --[[########################################################]]--
  34. local count = 0
  35. fileName = '[Mage] Serpent Spawn Goroma'
  36.  
  37. --[[LABEL MANAGER]]--
  38. registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
  39. displayInformationMessage("Spawn: Medusa\n Vocation: Mage's\n Author: Crest from Pandoriumx")
  40. function onWalkerSelectLabel(labelName)
  41. local func = loadstring(labelName)
  42. if (func) then func()
  43. end
  44. end
  45.  
  46. --[DepositItems]]--
  47. function DepositItems()
  48. Walker.Stop()
  49. Self.ReachDepo()
  50. Self.DepositItems(14013, 14042, 14247, 12730, 3032, 3029, 815, 14008, 14041, 14040, 14043, 14250, 14011, 14044, 14012, 14010, 811, 7413, 9302, 814, 3081, 3436, 3369, 3370, 4839, {7643, 1}, {5925, 1}, {10277, 1}, {5879, 1}, {9694, 1}, {10313, 1}, {3032, 1}, {10309, 1}, {237, 1}, {3061, 1}, {3392, 1}, {10282, 1}, {3029, 1})
  51. Walker.Start()
  52. end
  53.  
  54. --[[RefillPotions]]--
  55. function Bank()
  56. Walker.Stop()
  57. local amountMp = ((maxManaPot - Self.ItemCount(manaPotID)) * manaPotCost)
  58. local countMp = math.ceil(amountMp / 1000) * 1000
  59. local amountSD = ((SD - Self.ItemCount(3155)) * 108)
  60. local countSD = math.ceil(amountSD / 1000) * 1000
  61. count = count + 1
  62. Self.SayToNpc({"hi", "deposit all", "yes", "withdraw " .. (countMp + countSD + 200), "yes", "balance"}, 65)
  63. Walker.Start()
  64. end
  65.  
  66.  
  67. --[[Follow Jack]]--
  68. function ShipSea()
  69. x = Self.Position().x
  70. Self.SayToNpc({"hi", "mission", "yes"}, 65)
  71. wait(900, 1200)
  72. if Self.Position().x == x then Walker.Goto("ShipLBCheck")
  73. end
  74. end
  75.  
  76. --[[Follow Jack]]--
  77. function ShipSvar()
  78. x = Self.Position().x
  79. Self.SayToNpc({"hi", "Svargrond", "yes"}, 65)
  80. wait(900, 1200)
  81. if Self.Position().x == x then Walker.Goto("ShipGoroCheck")
  82. end
  83. end
  84.  
  85. --[[ResetBps]]--
  86. function ResetBps()
  87. Walker.Stop()
  88. Self.CloseContainers()
  89. Self.OpenMainBackpack(true):OpenChildren({stackBP, true}, {lootBP, true}, {goldBP, true}, {runeBP, true})
  90. Container.GetFirst():Minimize()
  91. Walker.Start()
  92. end
  93.  
  94. --[[BuyPotions]]--
  95. function BuyPotions()
  96. Walker.Stop()
  97. Self.SayToNpc({"hi", "trade"}, 65)
  98. wait(900, 1200)
  99. Self.ShopBuyItemsUpTo(manaPotID, maxManaPot)
  100. wait(900, 1200)
  101. Self.ShopBuyItemsUpTo(3155, SD)
  102. Walker.Start()
  103. end
  104.  
  105. --[[StartHunt]]--
  106. function StartHunt()
  107. Looter.Start()
  108. Targeting.Start()
  109. end
  110.  
  111. --[[CheckPotions]]--
  112. function CheckPotions()
  113. delayWalker(3000)
  114. if ((Self.ItemCount(manaPotID) <= minManaPot) or (Self.Cap() <= minCap) or (Self.ItemCount(3155) <= minSD)) then
  115. wait(100, 1000)
  116. else
  117. gotoLabel("StartHunt()")
  118. end
  119. end
  120.  
  121. --[[Minimize]]--
  122. function Minimize()
  123. Walker.Stop()
  124. if minimizeEQ == true then
  125. Client.HideEquipment()
  126. end
  127. wait(500, 1400)
  128. if minimizeBPS == true then
  129. for x = 0, #Container.GetIndexes() - 1 do
  130. local bp = Container.GetFromIndex(x)
  131. bp:Minimize()
  132. wait(200, 400)
  133. end
  134. end
  135. Walker.Start()
  136. end
  137.  
  138. --[[Find Certain Items On Screen]]--
  139. Map.GetUseItems = function (id)
  140. if type(id) == "string" then
  141. id = Item.GetID(id)
  142. end
  143. local pos = Self.Position()
  144. local store = {}
  145. for x = -7, 7 do
  146. for y = -5, 5 do
  147. if Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id == id then
  148. itemPos = {x = pos.x + x, y = pos.y + y, z = pos.z}
  149. table.insert(store, itemPos)
  150. end
  151. end
  152. end
  153. return store
  154. end
  155.  
  156. --[[DepotChooser]]--
  157. Self.ReachDepo = function (attempt)
  158. local attempt = attempt or 4
  159. Walker.Stop()
  160. local DepotIDs = {8050, 823, 8043, 815}
  161. local DepotPos = {}
  162. for i = 1, #DepotIDs do
  163. local dps = Map.GetUseItems(DepotIDs[i])
  164. for d = 1, #dps do
  165. table.insert(DepotPos, dps[d])
  166. end
  167. end
  168. local function gotoDepot()
  169. local pos = Self.Position()
  170. print("Depots found: " .. tostring(#DepotPos))
  171. for i = 1, #DepotPos do
  172. location = DepotPos[i]
  173. Self.UseItemFromGround(location.x, location.y, location.z)
  174. wait(1000, 2000)
  175. if Self.DistanceFromPosition(pos.x, pos.y, pos.z) >= 1 then
  176. wait(5000, 6000)
  177. if Self.DistanceFromPosition(location.x, location.y, location.z) == 1 then
  178. Walker.Start()
  179. return true
  180. end
  181. else
  182. print("There is something blocking the path.")
  183. end
  184. end
  185. return false
  186. end
  187. repeat
  188. reachedDP = gotoDepot()
  189. if reachedDP then
  190. return true
  191. end
  192. attempt = attempt - 1
  193. sleep(100)
  194. print("Attempt to reach depot was unsuccessfull. " .. attempt .. " attempts left.")
  195. until attempt <= 0
  196. return false
  197. end
  198.  
  199. Module.New("Softboots", function(module)
  200. if usingSoftboots then
  201. if (Self.Mana() <= ManaToEquip) and (Self.Feet().id ~= 3549) then
  202. Self.Equip(6529, "feet")
  203. elseif (Self.Mana() >= ManaToUnequip) and (Self.Feet().id ~= Boots) or (Self.Feet().id == 6530) then
  204. Self.Equip(Boots, "feet")
  205. end
  206. end
  207. end)
  208.  
  209. Module.New("Rings", function(module)
  210. if usingRings then
  211. if (Self.Ring().id ~= 3100) and (Self.Ring().id ~= 3089) then
  212. if (Self.ItemCount(3098) >= 1) then
  213. Self.Equip(3098, "ring")
  214. elseif (Self.ItemCount(3052) >= 1) then
  215. Self.Equip(3052, "ring")
  216. end
  217. end
  218. end
  219. end)
  220.  
  221. Module.New("Restore Mana", function(module)
  222. if RestoreMana then
  223. for index = CREATURES_LOW, CREATURES_HIGH do
  224. local creature = Creature.GetFromIndex(index)
  225. if not (creature:isOnScreen() and creature:ID() ~= Self.ID()) then
  226. percent = (Self.Mana() / Self.MaxMana() * 100)
  227. if (percent <= 50) and (Self.ItemCount(manaPotID) > 0) and (Self.TargetID() == 0) then
  228. repeat
  229. percent = (Self.Mana() / Self.MaxMana() * 100)
  230. delayWalker(1400)
  231. Self.UseItemWithMe(manaPotID)
  232. wait(900,1300)
  233. until (percent >= 85 or Self.ItemCount(238) < 1 or creature:isOnScreen() and creature:ID() ~= Self.ID() or not Self.TargetID() == 0)
  234. end
  235. end
  236. end
  237. end
  238. module:Delay(3000)
  239. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement