Advertisement
Guest User

Library by Faj. TibiaIBOT

a guest
Dec 22nd, 2012
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.42 KB | None | 0 0
  1. --[[
  2.   ______   _____   _________
  3.  |      | |     | |         |
  4.  |   ---  |  |  | |___   ___|
  5.  |   _|   |     | __  | |
  6.  |  |     |  |  | \ \_| |
  7.  |__|     |__|__|  \____|
  8.    Library   v1.0       By Faj
  9. --]]
  10.  
  11. --   FUNCTION dpdeposit()
  12. --   Open depot, open bp and deposit your items.
  13. --   Usage:
  14. --   dpdeposit(MainDPBP, LootDPBP, LOOTS)
  15. --   Ex:
  16. --   dpdeposit("brown backpack", "beach backpack", "wyrm scale", "strong health potion")
  17.  
  18. function dpdeposit(DPBP, LOOTBP, ...)
  19. return {
  20. setsettings("Settings\\Cavebot\\Settings\\OpenNextBp","no"),
  21. wait(1000,1500),
  22. reachgrounditem("depot"),
  23. openitem("depot"),
  24. wait(1000,1500),
  25. openitem(3502, "locker"),
  26. wait(1000,1500),
  27. openitem(DPBP, "depot chest"),
  28. wait(1000,1500),
  29. depotdeposit(LOOTBP, ...),
  30. wait(1000,1500),
  31. closewindow(DPBP),
  32. wait(1000,1500),
  33. setsettings("Settings\\Cavebot\\Settings\\OpenNextBp","yes")
  34. }
  35. end  
  36.  
  37. --   FUNCTION bankwithdraw()
  38. --   Withdraw from bank what you need to buy the item.
  39. --   Usage:
  40. --   bankwithdraw("ItemName", amount)
  41. --   Ex:
  42. --   bankwithdraw("mana potion", 500)
  43.  
  44.  
  45. function bankwithdraw(ITEMCOST, NUMBER)
  46. local value = itemcost(ITEMCOST)*NUMBER-itemcost(ITEMCOST)*itemcount(ITEMCOST)
  47. if value > 0 then
  48. return {
  49. say('hi'),
  50.   wait(1000,1300),
  51.    npcsay("withdraw "..value),
  52.    wait(1200,1300),
  53.    npcsay("yes"),
  54.    wait(1200,1300)
  55. }
  56. end
  57. end
  58.  
  59. --   FUNCTION buypots()
  60. --   Buy your potions.
  61. --   Usage:
  62. --   buypots("ItemName", amount)
  63. --   Ex:
  64. --   buypots("mana potion", 500)
  65. --   NOTE: it'll buy what is missing.
  66. --   (if you have 1 pot in example it'll buy 499)
  67.  
  68. function buypots(NAME, NUMBER)
  69. return {
  70. sellflasks(),
  71. wait(500,900),
  72. opentrade(),
  73. wait(500, 900),
  74. buyitemsupto(NAME, NUMBER)
  75. }
  76. end
  77.  
  78. function movetobp(ITEMNAME,WHEREHAVE,TOPLACE)
  79. while itemcount(ITEMNAME, WHEREHAVE) > 0 do
  80. return moveitems(ITEMNAME, WHEREHAVE, TOPLACE)
  81. end
  82. end
  83.  
  84. --   FUNCTION exorigranif()
  85. --   Use "exori gran" if monsters around you.
  86. --   Usage:
  87. --   exorigranif(NUMBER, NAME OF MONSTERS[optional])
  88. --   Ex:
  89. --   exorigranif(4, "wyrm", "energy elemental")
  90.  
  91. function exorigranif(NUMBER, ...)
  92. local monsters = {...}
  93.  
  94. if maround(1,unpack(monsters)) >= NUMBER  and cancast('exori gran') then
  95. return cast('exori gran')
  96. end
  97. end
  98.  
  99. --   FUNCTION exoriif()
  100. --   Use "exori" if monsters around you.
  101. --   Usage:
  102. --   exoriif(NUMBER, NAME OF MONSTERS[optional])
  103. --   Ex:
  104. --   exoriif(3, "wyrm", "energy elemental")
  105.  
  106. function exoriif(NUMBER, ...)
  107. local monsters = {...}
  108.  
  109. if maround(1,unpack(monsters)) >= NUMBER  and cancast('exori') then
  110. return cast('exori')
  111. end
  112. end
  113.  
  114. --   FUNCTION exorihuricoif()
  115. --   Use "exori hur" and "exori ico" if monsters around you.
  116. --   Usage:
  117. --   exorihuricoif(NUMBER, NAME OF MONSTERS[optional])
  118. --   Ex:
  119. --   exorihuricoif(2, "wyrm", "energy elemental")
  120.  
  121. function exorihuricoif(NUMBER, ...)
  122. local monsters = {...}
  123.  
  124. if maround(1,unpack(monsters)) >= NUMBER  and cancast('exori hur') then
  125. return cast('exori hur')
  126. end
  127. if maround(1,unpack(monsters)) >= NUMBER  and cancast('exori ico') then
  128. return cast('exori ico')
  129. end
  130. end
  131.  
  132. --   FUNCTION ksmode()
  133. --   Use "exori hur" and "exori ico" in every monsters.
  134. --   Usage:
  135. --   ksmode("yes" or "no", NAME OF MONSTERS[optional])
  136. --   Ex:
  137. --   ksmode("yes")
  138.  
  139. function ksmode(STRING, ...)
  140. local monsters = {...}
  141.  
  142. if (STRING == "yes") then
  143. if maround(1,unpack(monsters)) >= 1  and cancast('exori hur') then
  144. return cast('exori hur')
  145. end
  146. if maround(1,unpack(monsters)) >= 1  and cancast('exori ico') then
  147. return cast('exori ico')
  148. end
  149. end
  150. end
  151.  
  152. --   FUNCTION replaceboots()
  153. --   Replace Worn Soft for Specified Boots.
  154. --   Usage:
  155. --   replaceboots(NAME OF BOOTS TO CHANGE)
  156. --   Ex:
  157. --   replaceboots("boots of haste")
  158.  
  159. function replaceboots(BOOTNAME)
  160. if (boots == itemid("worn soft boots")) then
  161. moveitems(BOOTNAME, "all", "boots", 1)
  162. end
  163. end
  164.  
  165. --   FUNCTION dropvials()
  166. --   Drop empty vials.
  167. --   Usage:
  168. --   dropvials()
  169. function dropvials()
  170. if itemcount(285) > 10 then
  171. dropitems(285)
  172. end
  173. if itemcount(283) > 10 then
  174. dropitems(283)
  175. end
  176. if itemcount(284) > 10 then
  177. dropitems(284)
  178. end
  179. end
  180.  
  181. -- FUNCTION openbps()
  182. function openbps(MAINBP,LOOTBP,GOLDBP)
  183. MAINBP,LOOTBP,GOLDBP = MainBP,LootBP,GoldBP
  184. return {
  185. closewindows(),
  186. wait(500, 1000),
  187. openitem(MAINBP, 'back'),
  188. wait(500, 1000),
  189. openitem(LOOTBP, MAINBP, true),
  190. wait(500, 1000),
  191. openitem(GOLDBP, MAINBP, true),
  192. wait(500, 1000),
  193. resizewindows(),
  194. wait(500, 1000)
  195. }
  196. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement