Advertisement
Guest User

Catch.lua

a guest
Jun 29th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. local ballcatch = { --id normal, id da ball shiy
  2. [2394] = {cr = 1, on = 193, off = 192, ball = {11826, 11737}, send = 47, typeee = "normal", boost = "0"}, --alterado v1.9 \/
  3. [2391] = {cr = 3, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great", boost = "0"},
  4. [2393] = {cr = 6, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super", boost = "0"},
  5. [2392] = {cr = 10, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra", boost = "0"},
  6. [12617] = {cr = 11, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari", boost = "0"},
  7. [12832] = {cr = 100000, on = 23, off = 24, ball = {12826, 12829}, send = 181, typeee = "dark", boost = "50"},
  8. [14299] = {cr = 35, on = 200, off = 199, ball = {11826, 11737}, send = 49, typeee = "mega", boost = "0"},
  9. }
  10.  
  11. function onUse(cid, item, frompos, item3, topos)
  12.  
  13. local item2 = getTopCorpse(topos)
  14. if item2 == null then
  15. return true
  16. end
  17.  
  18. if getItemAttribute(item2.uid, "catching") == 1 then
  19. return true
  20. end
  21.  
  22. if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
  23. return doPlayerSendCancel(cid, "Você não pode capturar pokemon na Golden Arena!")
  24. end
  25.  
  26. local name = string.lower(getItemNameById(item2.itemid))
  27. name = string.gsub(name, "fainted ", "")
  28. name = string.gsub(name, "defeated ", "")
  29. name = doCorrectPokemonName(name)
  30. local x = pokecatches[name]
  31.  
  32. if not x then return true end
  33.  
  34. local shinys = {"Shiny Scizor", "Shiny Houndoom", "Shiny Tangrowth", "Shiny Kabutops", "Shiny Slowking", "Shiny Swellow", "Shiny Ludicolo", "Shiny Wobbuffet", "Shiny Tropius", "Shiny Metagross", "Shiny Sceptile", "Shiny Blaziken", "Shiny Swampert", "Shiny Tangrowth", "Shiny Alakazam", "Shiny Scyther", "Shiny Electivire", "Shiny Magmortar", "Shiny Salamence", "Shiny Magmar", "Shiny Mantine", "Shiny Gyarados", "Shiny Snorlax", "Shiny Onix", "Shiny Electabuzz", "Shiny Pidgeot", "Aerodactyl", "Ditto", "Shiny Gengar"}
  35. if item.itemid == 12832 and isInArray(shinys, name) then
  36. doPlayerSendCancel(cid, "Você não pode capturar esse pokemon com a master ball!")
  37. return true
  38. end
  39.  
  40. local storage = newpokedex[name].stoCatch
  41. if getPlayerStorageValue(cid, storage) == -1 or not string.find(getPlayerStorageValue(cid, storage), ";") then --alterado v1.9
  42. setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0, dark = 0;") --alterado v1.9
  43. end
  44.  
  45. local owner = getItemAttribute(item2.uid, "corpseowner")
  46.  
  47. if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then
  48. doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
  49. return true
  50. end
  51.  
  52. local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v1.9
  53. local typeee = ballcatch[item.itemid].typeee
  54. local boost = ballcatch[item.itemid].boost
  55.  
  56.  
  57. local catchinfo = {}
  58. catchinfo.rate = ballcatch[item.itemid].cr
  59. catchinfo.catch = ballcatch[item.itemid].on
  60. catchinfo.fail = ballcatch[item.itemid].off
  61. catchinfo.newid = newidd
  62. catchinfo.name = doCorrectPokemonName(name)
  63. catchinfo.topos = topos
  64. catchinfo.chance = x.chance
  65.  
  66. doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
  67. doRemoveItem(item.uid, 1)
  68.  
  69. local d = getDistanceBetween(getThingPos(cid), topos)
  70.  
  71. if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then --alterado v1.9
  72. setPlayerStorageValue(cid, 98796, -1)
  73. setPlayerStorageValue(cid, 98797, -1)
  74. doTeleportThing(cid, SafariOut, false)
  75. doSendMagicEffect(getThingPos(cid), 21)
  76. doPlayerSendTextMessage(cid, 27, "Você usou todas as saffari balls, boa sorte na próxima vez...")
  77. end
  78.  
  79. addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)
  80. addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
  81. return true
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement