Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. local config = {
  2. level = 2
  3. }
  4.  
  5. local items = {9010,11337,7441,7442,7444,7445}
  6.  
  7. local SKINS = {
  8. -- Minotaurs
  9. [2830] = {55000, 5878},
  10. [2871] = {55000, 5878},
  11. [2866] = {55000, 5878},
  12. [2876] = {55000, 5878},
  13. [3090] = {55000, 5878},
  14.  
  15. -- Lizards
  16. [4259] = {55000, 5876},
  17. [4262] = {55000, 5876},
  18. [4256] = {55000, 5876},
  19.  
  20. -- Dragons
  21. [3104] = {55000, 5877},
  22. [2844] = {55000, 5877},
  23.  
  24. -- Dragon Lords
  25. [2881] = {55000, 5948},
  26.  
  27. -- Behemoths
  28. [2931] = {55000, 5893},
  29.  
  30. -- Bone Beasts
  31. [3031] = {55000, 5925}
  32. }
  33.  
  34. function onUse(cid, item, fromPosition, itemEx, toPosition)
  35. if(getPlayerLevel(cid) < config.level) then
  36. doPlayerSendCancel(cid, "You have to be at least Level " .. config.level .. " to use this tool.")
  37. return true
  38. end
  39.  
  40. local skin = SKINS[itemEx.itemid]
  41. if(not skin) and not isInArray(items,itemEx.itemid) then
  42. doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
  43. return true
  44. end
  45.  
  46. --
  47. if isInArray(items,itemEx.itemid) then
  48. if itemEx.itemid == 9010 then
  49. if getPlayerStorageValue(cid, 65049) <= 0 then
  50. doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
  51. doPlayerAddItem(cid, 8310, 1)
  52. setPlayerStorageValue(cid, 65049, 1)
  53. else
  54. doCreatureSayWithRadius(cid, "You already used your knife on the corpse.", TALKTYPE_ORANGE_1, 1, 1)
  55. end
  56. elseif itemEx.itemid == 11337 then --piece of marble
  57. statue = math.random(1, 100)
  58. if statue <= 70 then
  59. doItemSetAttribute(itemEx.uid, "description", "This shoddy work was made by "..getCreatureName(cid)..".")
  60. doTransformItem(itemEx.uid, 11338) ---rough
  61. elseif statue <= 99 then
  62. doItemSetAttribute(itemEx.uid, "description", "This little figurine made by "..getCreatureName(cid).." has some room for improvement.")
  63. doTransformItem(itemEx.uid, 11339) --regular
  64. else
  65. doItemSetAttribute(itemEx.uid, "description", "This little figurine of Tibiasula was masterfully sculpted by "..getCreatureName(cid)..".")
  66. doTransformItem(itemEx.uid, 11340) --
  67. end
  68. elseif itemEx.itemid == 7441 then --ice cube
  69. if math.random(1, 100) <= 30 then --30%
  70. doTransformItem(itemEx.uid, 7442) --1 carve
  71. else
  72. doPlayerSendDefaultCancel(cid, "You broke the ice cube")
  73. doRemoveItem(itemEx.uid)
  74. end
  75. elseif itemEx.itemid == 7442 then --ice cube, 1 carve
  76. if math.random(1, 100) <= 20 then --20%
  77. doTransformItem(itemEx.uid, 7444) --2 carve
  78. else
  79. doPlayerSendDefaultCancel(cid, "You broke the ice cube")
  80. doRemoveItem(itemEx.uid)
  81. end
  82. elseif itemEx.itemid == 7444 then --ice cube, 2 carve
  83. if math.random(1, 100) <= 10 then --10%
  84. doTransformItem(itemEx.uid, 7445) --3 carve
  85. else
  86. doPlayerSendDefaultCancel(cid, "You broke the ice cube")
  87. doRemoveItem(itemEx.uid)
  88. end
  89. elseif itemEx.itemid == 7445 then --ice cube, 3 carve
  90. if math.random(1, 100) <= 5 then --5%
  91. doTransformItem(itemEx.uid, 7446) --ice mammoth
  92. else
  93. doPlayerSendDefaultCancel(cid, "You broke the ice cube")
  94. doRemoveItem(itemEx.uid)
  95. end
  96. end
  97. doSendMagicEffect(toPosition, effect)
  98. return true
  99. end
  100. ---
  101.  
  102. local random, effect = math.random(1, 100000), CONST_ME_GROUNDSHAKER
  103. if(random <= skin[1]) then
  104. doPlayerAddItem(cid, skin[2], 1)
  105. elseif(skin[3] and random >= skin[3]) then
  106. doPlayerAddItem(cid, skin[4], 1)
  107. else
  108. effect = CONST_ME_POFF
  109. end
  110.  
  111. doSendMagicEffect(toPosition, effect)
  112. doTransformItem(itemEx.uid, itemEx.itemid + 1)
  113. return true
  114. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement