Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.59 KB | None | 0 0
  1. local holes = {468, 481, 483, 7932, 8579}
  2. local sand = {231, 9059}
  3.  
  4. local config = {
  5. aids = {5410, 5411, 5412, 5413, 5414},
  6. soul = 1
  7. }
  8.  
  9. function onUse(cid, item, fromPosition, itemEx, toPosition)
  10. if(isInArray(holes, itemEx.itemid)) then
  11. local newId = itemEx.itemid + 1
  12. if(itemEx.itemid == 8579) then
  13. newId = 8585
  14. end
  15. doTransformItem(itemEx.uid, newId)
  16. doDecayItem(itemEx.uid)
  17. elseif(isInArray(sand, itemEx.itemid)) then
  18. local rand = math.random(1, 100)
  19. if(itemEx.actionid == 100 and rand <= 20) then
  20. doTransformItem(itemEx.uid, 489)
  21. doDecayItem(itemEx.uid)
  22. elseif(rand >= 1 and rand <= 5) then
  23. doCreateItem(2159, 1, toPosition)
  24. elseif(rand > 85) then
  25. doCreateMonster("Scarab", toPosition, false)
  26. end
  27. elseif(itemEx.itemid == 7732 and itemEx.type == 1) then
  28. ground_position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
  29. ground_info = getThingfromPos(ground_position)
  30. if(isInArray(config.aids, ground_info.actionid)) then
  31. if(ground_info.itemid == 806) then
  32. if(getPlayerSoul(cid) >= config.soul) then
  33. if(getPlayerItemCount(cid, 7734) >= 1) then
  34. if(ground_info.actionid == 5410) then
  35. addEvent(makeOrange, 70*1000, {position = toPosition, cid = cid})
  36. elseif(ground_info.actionid == 5411) then
  37. addEvent(makeBanana, 45*1000, {position = toPosition, cid = cid})
  38. elseif(ground_info.actionid == 5412) then
  39. addEvent(makeCoconut, 60*1000, {position = toPosition, cid = cid})
  40. elseif(ground_info.actionid == 5413) then
  41. addEvent(makeBerry, 30*1000, {position = toPosition, cid = cid})
  42. elseif(ground_info.actionid == 5414) then
  43. addEvent(makeMango, 70*1000, {position = toPosition, cid = cid})
  44. end
  45. doRemoveItem(itemEx.uid, 1)
  46. doTransformItem(ground_info.uid, 804)
  47. doSendMagicEffect(ground_position, 53)
  48. doPlayerAddSoul(cid, -config.soul)
  49. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dug a hole and watered the seeds.")
  50. else
  51. doPlayerSendCancel(cid, "You need a watering can so you can water the seeds.")
  52. end
  53. else
  54. doPlayerSendCancel(cid, "You don't have enough soul points.")
  55. end
  56. else
  57. doPlayerSendCancel(cid, "You need to soil the ground first.")
  58. end
  59. else
  60. doPlayerSendCancel(cid, "Sorry, not possible.")
  61. end
  62. else
  63. ground_position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
  64. ground_info = getThingfromPos(ground_position)
  65. if(isInArray(config.aids, ground_info.actionid)) then
  66. if(ground_info.itemid == 806) then
  67. if(itemEx.type ~= 1) then
  68. doPlayerSendCancel(cid, "You need to place one seed.")
  69. end
  70. else
  71. doPlayerSendCancel(cid, "Sorry, not possible.")
  72. end
  73. else
  74. doPlayerSendCancel(cid, "Sorry, not possible.")
  75. end
  76. end
  77. return true
  78. end
  79.  
  80. -- ORANGE --
  81. function makeOrange(parameter)
  82. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  83. if(tree.itemid ~= 4008) then
  84. local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
  85. doCreateItem(4008, 1, treePos)
  86. if(isPlayer(parameter.cid)) then
  87. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your orange tree has grown!")
  88. if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
  89. doMoveCreature(parameter.cid, SOUTH)
  90. end
  91. end
  92. addEvent(bloomOrange, 70*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  93. end
  94. end
  95.  
  96. function bloomOrange(parameter)
  97. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  98. if(tree.itemid == 4008) then
  99. doTransformItem(tree.uid, 4006)
  100. if(isPlayer(parameter.cid)) then
  101. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your orange tree has fully grown! Harvest it before it withers!")
  102. end
  103. addEvent(orangeDie, 50*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  104. end
  105. end
  106.  
  107. function orangeDie(parameter)
  108. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  109. local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
  110. doRemoveItem(tree.uid)
  111. doTransformItem(ground.uid, 103)
  112. if(isPlayer(parameter.cid)) then
  113. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your orange tree has withered.")
  114. end
  115. end
  116.  
  117. -- BANANA --
  118. function makeBanana(parameter)
  119. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  120. if(tree.itemid ~= 5092) then
  121. local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
  122. doCreateItem(5092, 1, treePos)
  123. if(isPlayer(parameter.cid)) then
  124. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your banana tree has grown!")
  125. if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
  126. doMoveCreature(parameter.cid, SOUTH)
  127. end
  128. end
  129. addEvent(bloomBanana, 45*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  130. end
  131. end
  132.  
  133. function bloomBanana(parameter)
  134. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  135. if(tree.itemid == 5092) then
  136. doTransformItem(tree.uid, 5094)
  137. if(isPlayer(parameter.cid)) then
  138. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your banana tree has fully grown! Harvest it before it withers!")
  139. end
  140. addEvent(bananaDie, 30*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  141. end
  142. end
  143.  
  144. function bananaDie(parameter)
  145. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  146. local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
  147. doRemoveItem(tree.uid)
  148. doTransformItem(ground.uid, 103)
  149. if(isPlayer(parameter.cid)) then
  150. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your banana tree has withered.")
  151. end
  152. end
  153.  
  154. -- COCONUT --
  155. function makeCoconut(parameter)
  156. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  157. if(tree.itemid ~= 2726) then
  158. local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
  159. doCreateItem(2726, 1, treePos)
  160. if(isPlayer(parameter.cid)) then
  161. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your coconut tree has grown!")
  162. if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
  163. doMoveCreature(parameter.cid, SOUTH)
  164. end
  165. end
  166. addEvent(bloomCoconut, 60*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  167. end
  168. end
  169.  
  170. function bloomCoconut(parameter)
  171. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  172. if(tree.itemid == 2726) then
  173. doTransformItem(tree.uid, 5096)
  174. if(isPlayer(parameter.cid)) then
  175. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your coconut tree has fully grown! Harvest it before it withers!")
  176. end
  177. addEvent(coconutDie, 50*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  178. end
  179. end
  180.  
  181. function coconutDie(parameter)
  182. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  183. local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
  184. doRemoveItem(tree.uid)
  185. doTransformItem(ground.uid, 103)
  186. if(isPlayer(parameter.cid)) then
  187. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your coconut tree has withered.")
  188. end
  189. end
  190.  
  191. -- BLUEBERRY --
  192. function makeBerry(parameter)
  193. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  194. if(tree.itemid ~= 2786) then
  195. local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
  196. doCreateItem(2786, 1, treePos)
  197. if(isPlayer(parameter.cid)) then
  198. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your blueberry bush has grown!")
  199. if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
  200. doMoveCreature(parameter.cid, SOUTH)
  201. end
  202. end
  203. addEvent(bloomBerry, 30*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  204. end
  205. end
  206.  
  207. function bloomBerry(parameter)
  208. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  209. if(tree.itemid == 2786) then
  210. doTransformItem(tree.uid, 2785)
  211. if(isPlayer(parameter.cid)) then
  212. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your blueberry bush has fully grown! Harvest it before it withers!")
  213. end
  214. addEvent(berryDie, 45*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  215. end
  216. end
  217.  
  218. function berryDie(parameter)
  219. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  220. local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
  221. doRemoveItem(tree.uid)
  222. doTransformItem(ground.uid, 103)
  223. if(isPlayer(parameter.cid)) then
  224. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your blueberry bush has withered.")
  225. end
  226. end
  227.  
  228. -- MANGO --
  229. function makeMango(parameter)
  230. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  231. if(tree.itemid ~= 5156) then
  232. local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
  233. doCreateItem(5156, 1, treePos)
  234. if(isPlayer(parameter.cid)) then
  235. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your mango tree has grown!")
  236. if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
  237. doMoveCreature(parameter.cid, SOUTH)
  238. end
  239. end
  240. addEvent(bloomMango, 70*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  241. end
  242. end
  243.  
  244. function bloomMango(parameter)
  245. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  246. if(tree.itemid == 5156) then
  247. doTransformItem(tree.uid, 5157)
  248. if(isPlayer(parameter.cid)) then
  249. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your mango tree has fully grown! Harvest it before it withers!")
  250. end
  251. addEvent(mangoDie, 50*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
  252. end
  253. end
  254.  
  255. function mangoDie(parameter)
  256. local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
  257. local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
  258. doRemoveItem(tree.uid)
  259. doTransformItem(ground.uid, 103)
  260. if(isPlayer(parameter.cid)) then
  261. doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your mango tree has withered.")
  262. end
  263. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement