Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local holes = {468, 481, 483, 7932, 8579}
- local sand = {231, 9059}
- local config = {
- aids = {5410, 5411, 5412, 5413, 5414},
- soul = 1
- }
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- if(isInArray(holes, itemEx.itemid)) then
- local newId = itemEx.itemid + 1
- if(itemEx.itemid == 8579) then
- newId = 8585
- end
- doTransformItem(itemEx.uid, newId)
- doDecayItem(itemEx.uid)
- elseif(isInArray(sand, itemEx.itemid)) then
- local rand = math.random(1, 100)
- if(itemEx.actionid == 100 and rand <= 20) then
- doTransformItem(itemEx.uid, 489)
- doDecayItem(itemEx.uid)
- elseif(rand >= 1 and rand <= 5) then
- doCreateItem(2159, 1, toPosition)
- elseif(rand > 85) then
- doCreateMonster("Scarab", toPosition, false)
- end
- elseif(itemEx.itemid == 7732 and itemEx.type == 1) then
- ground_position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
- ground_info = getThingfromPos(ground_position)
- if(isInArray(config.aids, ground_info.actionid)) then
- if(ground_info.itemid == 806) then
- if(getPlayerSoul(cid) >= config.soul) then
- if(getPlayerItemCount(cid, 7734) >= 1) then
- if(ground_info.actionid == 5410) then
- addEvent(makeOrange, 70*1000, {position = toPosition, cid = cid})
- elseif(ground_info.actionid == 5411) then
- addEvent(makeBanana, 45*1000, {position = toPosition, cid = cid})
- elseif(ground_info.actionid == 5412) then
- addEvent(makeCoconut, 60*1000, {position = toPosition, cid = cid})
- elseif(ground_info.actionid == 5413) then
- addEvent(makeBerry, 30*1000, {position = toPosition, cid = cid})
- elseif(ground_info.actionid == 5414) then
- addEvent(makeMango, 70*1000, {position = toPosition, cid = cid})
- end
- doRemoveItem(itemEx.uid, 1)
- doTransformItem(ground_info.uid, 804)
- doSendMagicEffect(ground_position, 53)
- doPlayerAddSoul(cid, -config.soul)
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dug a hole and watered the seeds.")
- else
- doPlayerSendCancel(cid, "You need a watering can so you can water the seeds.")
- end
- else
- doPlayerSendCancel(cid, "You don't have enough soul points.")
- end
- else
- doPlayerSendCancel(cid, "You need to soil the ground first.")
- end
- else
- doPlayerSendCancel(cid, "Sorry, not possible.")
- end
- else
- ground_position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
- ground_info = getThingfromPos(ground_position)
- if(isInArray(config.aids, ground_info.actionid)) then
- if(ground_info.itemid == 806) then
- if(itemEx.type ~= 1) then
- doPlayerSendCancel(cid, "You need to place one seed.")
- end
- else
- doPlayerSendCancel(cid, "Sorry, not possible.")
- end
- else
- doPlayerSendCancel(cid, "Sorry, not possible.")
- end
- end
- return true
- end
- -- ORANGE --
- function makeOrange(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid ~= 4008) then
- local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
- doCreateItem(4008, 1, treePos)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your orange tree has grown!")
- if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
- doMoveCreature(parameter.cid, SOUTH)
- end
- end
- addEvent(bloomOrange, 70*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function bloomOrange(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid == 4008) then
- doTransformItem(tree.uid, 4006)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your orange tree has fully grown! Harvest it before it withers!")
- end
- addEvent(orangeDie, 50*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function orangeDie(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
- doRemoveItem(tree.uid)
- doTransformItem(ground.uid, 103)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your orange tree has withered.")
- end
- end
- -- BANANA --
- function makeBanana(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid ~= 5092) then
- local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
- doCreateItem(5092, 1, treePos)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your banana tree has grown!")
- if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
- doMoveCreature(parameter.cid, SOUTH)
- end
- end
- addEvent(bloomBanana, 45*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function bloomBanana(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid == 5092) then
- doTransformItem(tree.uid, 5094)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your banana tree has fully grown! Harvest it before it withers!")
- end
- addEvent(bananaDie, 30*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function bananaDie(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
- doRemoveItem(tree.uid)
- doTransformItem(ground.uid, 103)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your banana tree has withered.")
- end
- end
- -- COCONUT --
- function makeCoconut(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid ~= 2726) then
- local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
- doCreateItem(2726, 1, treePos)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your coconut tree has grown!")
- if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
- doMoveCreature(parameter.cid, SOUTH)
- end
- end
- addEvent(bloomCoconut, 60*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function bloomCoconut(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid == 2726) then
- doTransformItem(tree.uid, 5096)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your coconut tree has fully grown! Harvest it before it withers!")
- end
- addEvent(coconutDie, 50*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function coconutDie(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
- doRemoveItem(tree.uid)
- doTransformItem(ground.uid, 103)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your coconut tree has withered.")
- end
- end
- -- BLUEBERRY --
- function makeBerry(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid ~= 2786) then
- local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
- doCreateItem(2786, 1, treePos)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your blueberry bush has grown!")
- if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
- doMoveCreature(parameter.cid, SOUTH)
- end
- end
- addEvent(bloomBerry, 30*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function bloomBerry(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid == 2786) then
- doTransformItem(tree.uid, 2785)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your blueberry bush has fully grown! Harvest it before it withers!")
- end
- addEvent(berryDie, 45*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function berryDie(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
- doRemoveItem(tree.uid)
- doTransformItem(ground.uid, 103)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your blueberry bush has withered.")
- end
- end
- -- MANGO --
- function makeMango(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid ~= 5156) then
- local treePos = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z}
- doCreateItem(5156, 1, treePos)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your mango tree has grown!")
- if(isInArea(getPlayerPosition(parameter.cid), treePos, treePos)) then
- doMoveCreature(parameter.cid, SOUTH)
- end
- end
- addEvent(bloomMango, 70*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function bloomMango(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- if(tree.itemid == 5156) then
- doTransformItem(tree.uid, 5157)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your mango tree has fully grown! Harvest it before it withers!")
- end
- addEvent(mangoDie, 50*1000, {position = {x = parameter.position.x, y = parameter.position.y, z = parameter.position.z }, cid = parameter.cid})
- end
- end
- function mangoDie(parameter)
- local tree = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 1}
- local ground = getThingfromPos{x = parameter.position.x, y = parameter.position.y, z = parameter.position.z, stackpos = 0}
- doRemoveItem(tree.uid)
- doTransformItem(ground.uid, 103)
- if(isPlayer(parameter.cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, "Your mango tree has withered.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement