Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function skinMonster(cid,item,skin)
- local random = math.random(1,15)
- if(random < 4) then
- doPlayerAddItem(cid,skin,1)
- doSendMagicEffect(getThingPos(item.uid), CONST_ME_MAGIC_GREEN)
- else
- doSendMagicEffect(getThingPos(item.uid), CONST_ME_BLOCKHIT)
- end
- doTransformItem(item.uid,item.itemid+1)
- end
- function transfer_crystal_back(pos)
- doTransformItem(getTileItemById(pos, 8633).uid, 8635)
- doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
- return true
- end
- function transfer_coral_back(pos)
- doTransformItem(getTileItemById(pos, 5422).uid, 15566)
- doSendMagicEffect(pos, CONST_ME_POFF)
- return true
- end
- function doShovel(cid, item, itemEx)
- local holes = {468, 481, 483}
- local p = getThingPos(itemEx.uid)
- local th = getThingfromPos({x = p.x, y = p.y, z = p.z, stackpos = 0})
- if isInArray(holes, th.itemid) then
- doTransformItem(th.uid, th.itemid + 1)
- doDecayItem(th.uid)
- elseif th.itemid == 231 then
- local rand = math.random(1, 100)
- if rand == 1 then
- doCreateItem(2159, 1, getThingPos(itemEx.uid))
- elseif rand > 95 then
- doSummonCreature("Scarab", getThingPos(itemEx.uid))
- end
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_POFF)
- elseif th.itemid == 7932 then
- doTransformItem(th.uid, th.itemid + 1)
- doDecayItem(th.uid)
- else
- return false
- end
- return true
- end
- function doRope(cid, item, itemEx)
- if itemEx.uid == 0 then
- return false
- end
- local toPosition = getThingPos(itemEx.uid)
- local SPOTS = { 384, 418, 8278, 8592, 13189, 15635 }
- local holeId = {294, 369, 370, 383, 392, 408, 409, 410, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136, 7933, 7938, 8170, 8286, 8285, 8284, 8281, 8280, 8279, 8277, 8276, 8323, 8567, 8585, 8596, 8595, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8972, 9606, 9625, 13190, 14461, 19519, 21536}
- if toPosition.x == CONTAINER_POSITION or (toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0) then
- return false
- end
- local groundTile = Tile(toPosition):getGround():getId()
- if isInArray(SPOTS, groundTile) then
- doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, FALSE)
- return true
- elseif isInArray(holeId, itemEx.itemid) then
- local thing = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
- if thing.uid > 0 then
- -- if isCreature(thing.uid) and thing.type ~= THING_TYPE_PLAYER then
- -- return false
- -- end
- toPosition.y = toPosition.y + 1
- doTeleportThing(thing.uid, toPosition)
- return true
- end
- end
- return false
- end
- function doScythe(cid, item, itemEx)
- if itemEx.itemid == 2739 then
- doTransformItem(itemEx.uid, 2737)
- doCreateItem(2694, 1, getThingPos(itemEx.uid))
- doDecayItem(itemEx.uid)
- return true
- end
- return false
- end
- function doPick(cid, item, itemEx)
- if (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355) then
- doTransformItem(itemEx.uid, 392)
- doDecayItem(itemEx.uid)
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_POFF)
- return true
- elseif(itemEx.itemid == 7200) then
- doTransformItem(itemEx.uid, 7236)
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_BLOCKHIT)
- return true
- elseif(itemEx.uid == 65532 and itemEx.itemid == 1304) then
- doRemoveItem(itemEx.uid)
- local stonepos = {x=359, y=375, z=11, stackpos=0}
- local tiles =
- {
- {x=360, y=374, z=11},
- {x=361, y=374, z=11},
- {x=362, y=374, z=11},
- {x=363, y=374, z=11},
- {x=364, y=374, z=11},
- {x=365, y=374, z=11},
- {x=358, y=375, z=11},
- {x=359, y=375, z=11},
- {x=360, y=375, z=11},
- {x=361, y=375, z=11},
- {x=362, y=375, z=11},
- {x=363, y=375, z=11},
- {x=364, y=375, z=11},
- {x=365, y=375, z=11},
- {x=358, y=376, z=11},
- {x=359, y=376, z=11},
- {x=360, y=376, z=11},
- {x=361, y=376, z=11},
- {x=362, y=376, z=11},
- {x=363, y=376, z=11},
- {x=364, y=376, z=11},
- {x=365, y=376, z=11},
- {x=358, y=377, z=11},
- {x=359, y=377, z=11},
- {x=360, y=377, z=11},
- {x=361, y=377, z=11},
- {x=362, y=377, z=11},
- {x=356, y=378, z=11},
- {x=357, y=378, z=11},
- {x=358, y=378, z=11},
- {x=359, y=378, z=11},
- {x=360, y=378, z=11},
- {x=361, y=378, z=11},
- {x=362, y=378, z=11},
- {x=356, y=379, z=11},
- {x=357, y=379, z=11},
- {x=358, y=379, z=11},
- {x=359, y=379, z=11},
- {x=360, y=379, z=11},
- {x=361, y=379, z=11},
- {x=362, y=379, z=11},
- {x=356, y=380, z=11},
- {x=357, y=380, z=11},
- {x=360, y=380, z=11},
- {x=361, y=380, z=11}
- }
- for lawa = 1, #tiles do
- doCreateItem(5815,1, tiles[lawa])
- doSendMagicEffect(tiles[lawa],CONST_ME_FIREATTACK)
- end
- doCreateItem(2256, 1, stonepos)
- return true
- elseif itemEx.itemid == 8635 then
- if isInRange(getThingPos(itemEx.uid), {x = 175, y = 726, z = 12}, {x = 266, y = 803, z = 14}) then
- if exhaustion.get(cid, 987) ~= false then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You have to wait before you gather strength to dig another gem.")
- return true
- end
- addEvent(transfer_crystal_back, 60000, getThingPos(itemEx.uid))
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HITAREA)
- exhaustion.set(cid, 987, 30)
- local cr_chance = math.random(1, 10)
- if cr_chance < 3 then
- doPlayerAddItem(cid, 15565, 1)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "With considerable effort you manage to knock a lardely unscathed rough gem out of the rocks.")
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
- doTransformItem(itemEx.uid, 8633)
- return true
- elseif cr_chance > 2 and cr_chance < 7 then
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You gathered nothing more than small chips of red gem.")
- doTransformItem(itemEx.uid, 8633)
- return true
- elseif cr_chance > 6 then
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Suddenly a guard jumps at you from behind!")
- doSummonCreature("deepling guard", getThingPos(cid))
- return true
- end
- else
- return false
- end
- elseif itemEx.itemid == 15566 then
- if getPlayerStorageValue(cid, 994) == 1 then
- if exhaustion.get(cid, 995) ~= false then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You have to wait before you gather strength to mine another coral.")
- return true
- end
- exhaustion.set(cid, 995, 15)
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HITAREA)
- addEvent(transfer_coral_back, 60000, getThingPos(itemEx.uid))
- doTransformItem(itemEx.uid, 5422)
- if math.random(1,5) == 4 then
- doPlayerAddItem(cid, 15568, 1)
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You mined come coral with enough quality to build the stairs.")
- return true
- end
- doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You mined some coral, but its quality is too poor to build the stairs.")
- return true
- -- 15568
- else
- return false
- end
- elseif itemEx.itemid == 5422 then
- if getPlayerStorageValue(cid, 994) == 1 then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "This coral was mined a while ago and has no material to provide.")
- return true
- else
- return false
- end
- end
- return false
- end
- function doMachete(cid, item, itemEx)
- if itemEx.itemid == 2782 then
- doTransformItem(itemEx.uid, 2781)
- doDecayItem(itemEx.uid)
- return true
- elseif itemEx.itemid == 3985 then
- doTransformItem(itemEx.uid, 3984)
- doDecayItem(itemEx.uid)
- return true
- elseif itemEx.itemid == 1499 then
- doRemoveItem(itemEx.uid)
- return true
- end
- return false
- end
- function doCrowbar(cid, item, itemEx)
- -- TODO
- return false
- end
- function doKnife(cid, item, itemEx)
- -- TODO
- return false
- end
- function doSpoon(cid, item, itemEx)
- -- TODO
- return false
- end
- function doObsidianKnife(cid, item, itemEx)
- local minotaurs = {2830, 3090, 2871, 2866, 2876}
- local lizards = {4259, 4262, 4256}
- local lizardsh = {11269, 11273, 11277, 11281, 11285}
- local greendragons = {3104, 2844}
- local reddragons = {2881}
- local behemoth = {2931}
- local bonebeast = {3031}
- local cube = {7441, 7444, 7445}
- local cube2 = {7442}
- local marble = {11343}
- local random = math.random(1,10)
- if isInArray(minotaurs, itemEx.itemid) then
- skinMonster(cid, itemEx, 5878)
- return true
- elseif isInArray(lizards, itemEx.itemid) then
- skinMonster(cid, itemEx, 5876)
- return true
- elseif isInArray(lizardsh, itemEx.itemid) then
- skinMonster(cid, itemEx, 5876)
- return true
- elseif isInArray(greendragons, itemEx.itemid) then
- skinMonster(cid, itemEx, 5877)
- return true
- elseif isInArray(reddragons, itemEx.itemid) then
- skinMonster(cid, itemEx, 5948)
- return true
- elseif isInArray(behemoth, itemEx.itemid) then
- skinMonster(cid, itemEx, 5893)
- return true
- elseif isInArray(bonebeast, itemEx.itemid) then
- skinMonster(cid, itemEx, 5925)
- return true
- elseif isInArray(marble, itemEx.itemid) then
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_ICEAREA)
- doRemoveItem(itemEx.uid,1)
- local check = math.random(1,10)
- if(check < 6) then
- goblet = doPlayerAddItem(cid, 11344, 1)
- doSetItemSpecialDescription(goblet, "This shoddy work was made by " .. getCreatureName(cid) .. ".")
- else
- if(check < 8) then
- goblet = doPlayerAddItem(cid, 11345, 1)
- doSetItemSpecialDescription(goblet, "This little figurine made by " .. getCreatureName(cid) .. " has some room for improvement.")
- else
- goblet = doPlayerAddItem(cid, 11346, 1)
- doSetItemSpecialDescription(goblet, "This little figurine of Tibiasula was masterfully sculpted by " .. getCreatureName(cid) .. ".")
- end
- end
- return true
- elseif isInArray(cube, itemEx.itemid) or isInArray(cube2, itemEx.itemid) then
- if random < 4 then
- if isInArray(cube2, itemEx.itemid) then ice_cube_transform = 2 else ice_cube_transform = 1 end
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HITAREA)
- doTransformItem(itemEx.uid, itemEx.itemid + ice_cube_transform)
- return true
- else
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HITAREA)
- doRemoveItem(itemEx.uid)
- doCreatureSay(cid, "The attempt of sculpting failed miserably.", TALKTYPE_MONSTER)
- return true
- end
- end
- return false
- end
- function doLockPick(cid, item, itemEx)
- -- TODO
- return false
- end
- function doRake(cid, item, itemEx)
- -- TODO
- return false
- end
- function doSaw(cid, item, itemEx)
- -- TODO
- return false
- end
- function doWoodenStake(cid, item, itemEx)
- local DUSTS = {
- -- Demons
- [2956] = {25000, 5905},
- [5527] = {50000, 5906},
- -- Vampires
- [2916] = {25000, 5906}
- }
- local dust = DUSTS[itemEx.itemid]
- if DUSTS[itemEx.itemid] == nil then
- return false
- end
- local random = math.random(1, 100000)
- if(random <= dust[1]) then
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_GROUNDSHAKER)
- doPlayerAddItem(cid, dust[2], 1)
- elseif(dust[3] and random >= dust[3]) then
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_GROUNDSHAKER)
- doPlayerAddItem(cid, dust[4], 1)
- else
- doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_POFF)
- end
- doTransformItem(itemEx.uid, itemEx.itemid + 1)
- return true
- end
- function onUse(player, item, fromPosition, itemEx, toPosition)
- local cid = player:getId()
- local shovel = 1
- local rope = 2
- local scythe = 3
- local pick = 4
- local machete = 5
- local crowbar = 6
- local knife = 7
- local spoon = 8
- local obsidianknife = 9
- local lockpick = 10
- local rake = 11
- local saw = 12
- local bws = 13
- local tools = {
- [2120] = {rope},
- [2416] = {crowbar},
- [2420] = {machete},
- [2442] = {machete},
- [2549] = {rake},
- [2550] = {scythe},
- [2553] = {pick},
- [2554] = {shovel},
- [2558] = {saw},
- [2565] = {spoon},
- [2566] = {knife},
- [2567] = {spoon},
- [5710] = {shovel},
- [5908] = {obsidianknife},
- [5942] = {bws},
- [7731] = {rope},
- [10511] = {rope, shovel, pick, spoon, knife, machete},
- [10513] = {rope, shovel, pick, scythe, saw, machete},
- [10515] = {rope, shovel, pick, crowbar, knife, machete},
- [21553] = {shovel}
- }
- if tools[item.itemid] == nil then
- return false
- end
- for i = 1, #tools[item.itemid] do
- if tools[item.itemid][i] == shovel then
- if doShovel(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == rope then
- if doRope(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == scythe then
- if doScythe(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == pick then
- if doPick(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == machete then
- if doMachete(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == crowbar then
- if doCrowbar(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == knife then
- if doKnife(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == spoon then
- if doSpoon(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == obsidianknife then
- if doObsidianKnife(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == lockpick then
- if doLockPick(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == rake then
- if doRake(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == saw then
- if doSaw(cid, item, itemEx) then
- return true
- end
- elseif tools[item.itemid][i] == bws then
- if doWoodenStake(cid, item, itemEx) then
- return true
- end
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement