Advertisement
Snowsz

Untitled

Feb 5th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.39 KB | None | 0 0
  1. local description = "Contains a %pokename."
  2.  
  3. function onUse(cid, item, frompos, item2, topos)
  4. local name = getItemNameById(item2.itemid)
  5. if item.itemid == 2147 then           -- POKEBALL
  6. catchrate = 300
  7. oncatch = 24
  8. onfail = 23
  9. bolabola = 2222
  10. tstorage = 0101
  11. tcount = 5
  12. titem = 2000
  13. tmessage = "Você ganhou uma bosta"
  14. elseif item.itemid == 2642 then       -- GREATBALL
  15. catchrate = 400
  16. oncatch = 198
  17. onfail = 197
  18. bolabola = 2651
  19. tstorage = 0202
  20. tcount = 5
  21. titem = 2000
  22. tmessage = "Você ganhou uma bosta"
  23. elseif item.itemid == 2645 then       -- SUPERBALL
  24. catchrate = 500
  25. oncatch = 202
  26. onfail = 201
  27. bolabola = 2653
  28. tstorage = 0303
  29. tcount = 5
  30. titem = 2000
  31. tmessage = "Você ganhou uma bosta"
  32. elseif item.itemid == 2146 then        -- ULTRABALL
  33. catchrate = 600
  34. oncatch = 200
  35. onfail = 199
  36. bolabola = 2220
  37. tstorage = 0404
  38. tcount = 5
  39. titem = 2000
  40. tmessage = "Você ganhou uma bosta"
  41. elseif item.itemid == 2149 then        -- MASTERBALL
  42. catchrate = 1500000
  43. oncatch = 209
  44. onfail = 187
  45. bolabola = 11618
  46. tstorage = 0505
  47. tcount = 5
  48. titem = 2000
  49. tmessage = "Você ganhou uma bosta"
  50. elseif item.itemid == 2644 then      -- EXBALL(Saffari)
  51. catchrate = 450
  52. oncatch = 204
  53. onfail = 203
  54. bolabola = 2655
  55. tstorage = 0606
  56. tcount = 5
  57. titem = 2000
  58. tmessage = "Você ganhou uma bosta"
  59. end
  60. local rate = (catchrate)
  61. local catch = oncatch
  62. local fail = onfail
  63. local newid = bolabola
  64. for i,x in pairs(pokesCatch) do
  65. if getItemNameById(item2.itemid):find(i:lower()) then
  66. if getItemIdByName(name) == pokesCatch[i].corpse then
  67. if cid ~= getItemAttribute(item2.uid, "corpseowner") and isInArray({1,8}, getPlayerGroupId(cid)) then
  68. doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
  69. return true
  70. end
  71. doRemoveItem(item.uid, 1)
  72. doRemoveItem(item2.uid, 1)
  73. local pegar = math.random(1, x.chance)
  74. if pegar <= 1*(rate) then
  75. doSendMagicEffect(topos, catch)
  76.  
  77. local nas = {
  78. ["%%pokename"] = i
  79. }
  80. for i,x in pairs(nas) do
  81. if description:find(i) then
  82. description = description:gsub(i, x)
  83. end
  84. end
  85.  
  86. local function capturou(params)
  87. if not isCreature(params.cid) then
  88. return true
  89. end
  90. if not string.find(getPlayerStorageValue(cid, 54842), ""..i..",") then
  91. doPlayerAddSoul(cid, 1)
  92. setPlayerStorageValue(cid, 54842, getPlayerStorageValue(cid, 54842)..""..i..", ")
  93. end
  94. if getPlayerFreeCap(cid) <= 0.99 then
  95. item = doCreateItemEx(newid-1)
  96. local pokelife = x.maxhealth
  97. doItemSetAttribute(item, "poke", params.poke)
  98. doItemSetAttribute(item, "nome", params.nome)
  99. doItemSetAttribute(item, "hp", pokelife)
  100. doItemSetAttribute(item, "maxhealth", pokelife)
  101. doItemSetAttribute(item, "description", params.description)
  102. doPlayerSendMailByName(getCreatureName(params.cid), item, 1)
  103. doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
  104. doPlayerSendTextMessage(cid, 27, "Since you are already holding six pokemons, this pokeball has been sent to your depot.")
  105. else
  106. local pokelife = x.maxhealth
  107. item = doCreateItemEx(params.ball)
  108. doItemSetAttribute(item, "poke", params.poke)
  109. doItemSetAttribute(item, "nome", params.nome)
  110. doItemSetAttribute(item, "maxhealth", pokelife)
  111. doItemSetAttribute(item, "hp", pokelife)
  112. doItemSetAttribute(item, "description", params.description)
  113. doPlayerAddItemEx(params.cid, item, true)
  114. doTransformItem(item, newid)
  115. doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
  116. end
  117.         --ALTERADO!!!!!!!!!!!!!!!!!!
  118. if getPlayerStorageValue(cid, 37013)==17 then
  119.         if (getPlayerItemCount(cid, 2644)<1) then -- COLOCAR O ID DA SAFFARI BALL
  120.                 setPlayerStorageValue(cid, 37013, -1)
  121.                 doPlayerSendTextMessage(cid, 27, "Suas Saffari Balls acabaram... Até mais, volte sempre!") -- ACABARAM AS BALLS
  122.                 local goto = {x = 1066, y = 1489, z = 7} --LOCAL A SER TELETRANSPORTADO
  123.                 doTeleportThing(cid, goto)    
  124.         end
  125. end
  126.         --ALTERADO!!!!!!!!!!!!!!!!!!
  127. if #getCreatureSummons(cid) >= 1 then
  128. doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 178)
  129. else
  130. doSendMagicEffect(getThingPos(cid), 178)
  131. end
  132. end
  133.  
  134. local description = "Contains a "..i.."."
  135.  
  136. addEvent(capturou, 4000, {cid = cid, poke = i, nome = i, description = description, ball = 2219, letter = 2597})
  137. else
  138. function ruim(params)
  139. if not isCreature(params.cid) then
  140. return true
  141. end
  142. doPlayerSendTextMessage(params.cid, 27, "Sorry, you didn\'t catch that pokemon.")
  143.         --ALTERADO!!!!!!!!!!!!!!!!!!
  144. if getPlayerStorageValue(cid, 37013)==17 then
  145.         if (getPlayerItemCount(cid, 2644)<1) then -- COLOCAR O ID DA SAFFARI BALL
  146.                 setPlayerStorageValue(cid, 37013, -1)
  147.                 doPlayerSendTextMessage(cid, 27, "Suas Saffari Balls acabaram... Até mais, volte sempre!") -- ACABARAM AS BALLS
  148.                 local goto = {x = 1027, y = 1489, z = 6} --LOCAL A SER TELETRANSPORTADO
  149.                 doTeleportThing(cid, goto)    
  150.         end
  151. end
  152.         --ALTERADO!!!!!!!!!!!!!!!!!!
  153. if #getCreatureSummons(params.cid) >= 1 then
  154. doSendMagicEffect(getThingPos(getCreatureSummons(params.cid)[1]), 166)
  155. else
  156. doSendMagicEffect(getThingPos(params.cid), 166)
  157. end
  158. end
  159. addEvent(ruim, 4000, {cid = cid})
  160. doSendMagicEffect(topos, fail)
  161. end
  162. end
  163. end
  164. end
  165. if getPlayerStorageValue(cid, tstorage) >= ((tcount)-1) then
  166. doPlayerAddItem(cid, titem)
  167. doPlayerSendTextMessage(cid,TALKTYPE_ORANGE_2, tmessage)
  168. else
  169. setPlayerStorageValue(cid, tstorage, getPlayerStorageValue(cid, tstorage)+1)
  170. end
  171. return TRUE
  172. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement