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 = {
- soul = 1
- }
- local trees = {
- [5410] = {maketime = 75 * 1000, bloomtime = 70*1000, deathtime = 50*1000, makeid = 4008, growid = 4006, MakeMsg = "Your orange tree has grown!", BloomMsg="Your orange tree has fully grown! Harvest it before it withers!", DeathMsg="Your orange tree has withered."};
- [5411] = {maketime = 45 * 1000, bloomtime = 45*1000, deathtime = 30*1000, makeid = 5092, growid = 5094, MakeMsg = "Your banana tree has grown!", BloomMsg="Your banana tree has fully grown! Harvest it before it withers!", DeathMsg="Your banana tree has withered."};
- [5412] = {maketime = 60 * 1000, bloomtime = 60*1000, deathtime = 50*1000, makeid = 2726, growid = 5096, MakeMsg = "Your coconut tree has grown!", BloomMsg="Your coconut tree has fully grown! Harvest it before it withers!", DeathMsg="Your coconut tree has withered."};
- [5413] = {maketime = 30 * 1000, bloomtime = 30*1000, deathtime = 45*1000, makeid = 2786, growid = 2785, MakeMsg = "Your blueberry bush has grown!", BloomMsg="Your blueberry busy has fully grown! Harvest it before it withers!", DeathMsg="Your blueberry bush has withered."};
- [5414] = {maketime = 70 * 1000, bloomtime = 70*1000, deathtime = 50*1000, makeid = 5156, growid = 5157, MakeMsg = "Your mango tree has grown!", BloomMsg="Your mango tree has fully grown! Harvest it before it withers!", DeathMsg="Your mango tree has withered."};
- }
- 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
- local ground_position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
- local 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(trees[ground_info.actionid] ~= nil then
- addEvent(doMakeTree, trees[ground_info.actionid].maketime, toPosition, cid, ground_info.actionid)
- 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
- local ground_position = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
- local 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 doMakeTree(pos, cid, aid)
- local tree = getThingfromPos{x = pos.x, y = pos.y, z = pos.z, stackpos = 1}
- if(tree.itemid ~= trees[aid].makeid) then
- local treePos = {x = pos.x, y = pos.y, z = pos.z}
- doCreateItem(trees[aid].makeid, 1, treePos)
- if(isPlayer(cid)) then
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, trees[aid].MakeMsg)
- if(isInArea(getPlayerPosition(cid), treePos, treePos)) then
- doMoveCreature(cid, SOUTH)
- end
- end
- addEvent(doBloomTree, trees[aid].bloomtime, {x = pos.x, y = pos.y, z = pos.z }, cid, aid)
- end
- end
- function doBloomTree(pos, cid, aid)
- local tree = getThingfromPos{x = pos.x, y = pos.y, z = pos.z, stackpos = 1}
- if(tree.itemid == trees[aid].makeid) then
- doTransformItem(tree.uid, trees[aid].growid)
- if(isPlayer(cid)) then
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, trees[aid].BloomMsg)
- end
- addEvent(doDieTree, trees[aid].deathtime, {x = pos.x, y = pos.y, z = pos.z }, cid, aid)
- end
- end
- function doDieTree(pos, cid, aid)
- local tree = getThingfromPos{x = pos.x, y = pos.y, z = pos.z, stackpos = 1}
- local ground = getThingfromPos{x = pos.x, y = pos.y, z = pos.z, stackpos = 0}
- doRemoveItem(tree.uid)
- doTransformItem(ground.uid, 103)
- if(isPlayer(cid)) then
- doPlayerSendTextMessage(parameter.cid, MESSAGE_INFO_DESCR, trees[aid].DeathMsg)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement