Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.33 KB | None | 0 0
  1. SPOTS = {384, 418, 8278, 8592}
  2. ROPABLE = { 294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136, 7933, 7938, 8170, 8286, 8285,
  3.         8284, 8281, 8280, 8279, 8277, 8276, 8323, 8380, 8567, 8585, 8596, 8595, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8972, 9606, 9625 }
  4.  
  5. HOLES = {468, 481, 483, 7932, 8579}
  6. SAND_HOLES = {[9059] = 489, [8568] = 8567}
  7. SAND = 231
  8.  
  9. JUNGLE_GRASS = {2782, 3985}
  10. SPIDER_WEB = {7538, 7539}
  11. WILD_GROWTH = {1499, 11099}
  12.  
  13. PUMPKIN = 2683
  14. PUMPKIN_HEAD = 2096
  15.  
  16. POOL = 2016
  17.  
  18. SPECIAL_FOODS = {
  19.         [9992] = "Gulp.", [9993] = "Chomp.", [9994] = "Chomp.", [9995] = "Chomp.", [9997] = "Yum.",
  20.         [9998] = "Munch.", [9999] = "Chomp.", [10000] = "Mmmm.", [10001] = "Smack."
  21. }
  22.  
  23. function destroyItem(cid, itemEx, toPosition)
  24.         if(itemEx.uid <= 65535 or itemEx.actionid > 0) then
  25.                 return false
  26.         end
  27.  
  28.         if not(isInArray({1770, 2098, 1774, 2064, 2094, 2095, 1619, 2602, 3805, 3806}, itemEx.itemid) or
  29.                 (itemEx.itemid >= 1724 and itemEx.itemid <= 1741) or
  30.                 (itemEx.itemid >= 2581 and itemEx.itemid <= 2588) or
  31.                 (itemEx.itemid >= 1747 and itemEx.itemid <= 1753) or
  32.                 (itemEx.itemid >= 1714 and itemEx.itemid <= 1717) or
  33.                 (itemEx.itemid >= 1650 and itemEx.itemid <= 1653) or
  34.                 (itemEx.itemid >= 1666 and itemEx.itemid <= 1677) or
  35.                 (itemEx.itemid >= 1614 and itemEx.itemid <= 1616) or
  36.                 (itemEx.itemid >= 3813 and itemEx.itemid <= 3820) or
  37.                 (itemEx.itemid >= 3807 and itemEx.itemid <= 3810) or
  38.                 (itemEx.itemid >= 2080 and itemEx.itemid <= 2085) or
  39.                 (itemEx.itemid >= 2116 and itemEx.itemid <= 2119)) then
  40.                 return false
  41.         end
  42.  
  43.         if(math.random(1, 7) == 1) then
  44.                 if(isInArray({1738, 1739, 1770, 2098, 1774, 1775, 2064}, itemEx.itemid) or
  45.                         (itemEx.itemid >= 2581 and itemEx.itemid <= 2588)) then
  46.                                 doCreateItem(2250, 1, toPosition)
  47.                 elseif((itemEx.itemid >= 1747 and itemEx.itemid <= 1749) or itemEx.itemid == 1740) then
  48.                         doCreateItem(2251, 1, toPosition)
  49.                 elseif((itemEx.itemid >= 1714 and itemEx.itemid <= 1717)) then
  50.                         doCreateItem(2252, 1, toPosition)
  51.                 elseif((itemEx.itemid >= 1650 and itemEx.itemid <= 1653) or
  52.                         (itemEx.itemid >= 1666 and itemEx.itemid <= 1677) or
  53.                         (itemEx.itemid >= 1614 and itemEx.itemid <= 1616) or
  54.                         (itemEx.itemid >= 3813 and itemEx.itemid <= 3820) or
  55.                         (itemEx.itemid >= 3807 and itemEx.itemid <= 3810)) then
  56.                                 doCreateItem(2253, 1, toPosition)
  57.                 elseif((itemEx.itemid >= 1724 and itemEx.itemid <= 1737) or
  58.                         (itemEx.itemid >= 2080 and itemEx.itemid <= 2085) or
  59.                         (itemEx.itemid >= 2116 and itemEx.itemid <= 2119) or
  60.                         isInArray({2094, 2095}, itemEx.itemid)) then
  61.                                 doCreateItem(2254, 1, toPosition)
  62.                 elseif((itemEx.itemid >= 1750 and itemEx.itemid <= 1753) or isInArray({1619, 1741}, itemEx.itemid)) then
  63.                         doCreateItem(2255, 1, toPosition)
  64.                 elseif(itemEx.itemid == 2602) then
  65.                         doCreateItem(2257, 1, toPosition)
  66.                 elseif(itemEx.itemid == 3805 or itemEx.itemid == 3806) then
  67.                         doCreateItem(2259, 1, toPosition)
  68.                 end
  69.  
  70.                 doRemoveItem(itemEx.uid, 1)
  71.         end
  72.  
  73.         doSendMagicEffect(toPosition, CONST_ME_POFF)
  74.         return true
  75. end
  76.  
  77. TOOLS = {}
  78. TOOLS.ROPE = function(cid, item, fromPosition, itemEx, toPosition)
  79.         if(toPosition.x == CONTAINER_POSITION) then
  80.                 doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
  81.                 return true
  82.         end
  83.  
  84.         toPosition.stackpos = STACKPOS_GROUND
  85.         local ground = getThingFromPos(toPosition)
  86.         if(isInArray(SPOTS, ground.itemid)) then
  87.                 doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
  88.                 return true
  89.         elseif(isInArray(ROPABLE, itemEx.itemid)) then
  90.                 local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
  91.                 if(isPlayer(hole.uid) and (not isPlayerGhost(hole.uid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(hole.uid))) then
  92.                         doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
  93.                 else
  94.                         doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
  95.                 end
  96.  
  97.                 return true
  98.         end
  99.  
  100.         return false
  101. end
  102.  
  103. TOOLS.PICK = function(cid, item, fromPosition, itemEx, toPosition)
  104.         local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND})
  105.         if(isInArray(SPOTS, ground.itemid) and isInArray({354, 355}, itemEx.itemid)) then
  106.                 doTransformItem(itemEx.uid, 392)
  107.                 doDecayItem(itemEx.uid)
  108.  
  109.                 doSendMagicEffect(toPosition, CONST_ME_POFF)
  110.                 return true
  111.         end
  112.  
  113.         if(itemEx.itemid == 7200) then
  114.                 doTransformItem(itemEx.uid, 7236)
  115.                 doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
  116.                 return true
  117.         end
  118.  
  119.         return false
  120. end
  121.  
  122. TOOLS.MACHETE = function(cid, item, fromPosition, itemEx, toPosition, destroy)
  123.         if(isInArray(JUNGLE_GRASS, itemEx.itemid)) then
  124.                 doTransformItem(itemEx.uid, itemEx.itemid - 1)
  125.                 doDecayItem(itemEx.uid)
  126.                 return true
  127.         end
  128.  
  129.         if(isInArray(SPIDER_WEB, itemEx.itemid)) then
  130.                 doTransformItem(itemEx.uid, (itemEx.itemid + 6))
  131.                 doDecayItem(itemEx.uid)
  132.                 return true
  133.         end
  134.  
  135.         if(isInArray(WILD_GROWTH, itemEx.itemid)) then
  136.                 doSendMagicEffect(toPosition, CONST_ME_POFF)
  137.                 doRemoveItem(itemEx.uid)
  138.                 doCreatureSay(cid, "Druid got owned!", TALKTYPE_MONSTER)
  139.                 doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -2000, -3000, CONST_ME_FIRE)
  140.                 return true
  141.         end
  142.  
  143.         return destroy and destroyItem(cid, itemEx, toPosition) or false
  144. end
  145.  
  146. TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition)
  147.         if(isInArray(HOLES, itemEx.itemid)) then
  148.                 if(itemEx.itemid ~= 8579) then
  149.                         itemEx.itemid = itemEx.itemid + 1
  150.                 else
  151.                         itemEx.itemid = 8585
  152.                 end
  153.  
  154.                 doTransformItem(itemEx.uid, itemEx.itemid)
  155.                 doDecayItem(itemEx.uid)
  156.                 return true
  157.         elseif(SAND_HOLES[itemEx.itemid] ~= nil) then
  158.                 doSendMagicEffect(toPosition, CONST_ME_POFF)
  159.                 doTransformItem(itemEx.uid, SAND_HOLES[itemEx.itemid])
  160.  
  161.                 doDecayItem(itemEx.uid)
  162.                 return true
  163.         elseif(itemEx.itemid == SAND and not isRookie(cid)) then
  164.                 local rand = math.random(1, 100)
  165.                 if(rand >= 1 and rand <= 5) then
  166.                         doCreateItem(ITEM_SCARAB_COIN, 1, toPosition)
  167.                 elseif(rand > 85) then
  168.                         doCreateMonster("Scarab", toPosition, false)
  169.                 end
  170.  
  171.                 doSendMagicEffect(toPosition, CONST_ME_POFF)
  172.                 return true
  173.         end
  174.  
  175.         return false
  176. end
  177.  
  178. TOOLS.SCYTHE = function(cid, item, fromPosition, itemEx, toPosition, destroy)
  179.         if(itemEx.itemid == 2739) then
  180.                 doTransformItem(itemEx.uid, 2737)
  181.                 doCreateItem(2694, 1, toPosition)
  182.  
  183.                 doDecayItem(itemEx.uid)
  184.                 return true
  185.         end
  186.  
  187.         return destroy and destroyItem(cid, itemEx, toPosition) or false
  188. end
  189.  
  190. TOOLS.KNIFE = function(cid, item, fromPosition, itemEx, toPosition)
  191.         if(itemEx.itemid ~= PUMPKIN) then
  192.                 return false
  193.         end
  194.  
  195.         doTransformItem(itemEx.uid, PUMPKIN_HEAD)
  196.         return true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement