Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. local EFFECTS = {
  2. --[OutfitID] = {Effect}
  3. ["Magmar"] = 35,
  4. ["Shiny Magmar"] = 35,
  5. ["Shiny Magmortar"] = 35,
  6. ["Shiny Electivire"] = 48,
  7. ["Magmortar"] = 35,
  8. ["Electivire"] = 48,
  9. ["Jynx"] = 17, --alterado v1.5
  10. ["Shiny Jynx"] = 17,
  11. ["Piloswine"] = 205, --alterado v1.8
  12. ["Swinub"] = 205,
  13. }
  14.  
  15. function onUse(cid, item, frompos, item2, topos)
  16.  
  17. if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end
  18. if isRiderOrFlyOrSurf(cid) then return true end
  19.  
  20. if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1
  21. or getPlayerStorageValue(cid, 75846) >= 1 then --alterado v1.9 <<
  22. doPlayerSendCancel(cid, "You can't return your pokemon while ride.")
  23. return true
  24. end
  25.  
  26. local ballName = getItemAttribute(item.uid, "poke")
  27. local btype = getPokeballType(item.itemid)
  28. local usando = pokeballs[btype].use
  29.  
  30. local effect = pokeballs[btype].effect
  31. if not effect then
  32. effect = 21
  33. end
  34.  
  35. unLock(item.uid) --alterado v1.8
  36.  
  37. if item.itemid == usando and #getCreatureSummons(cid) > 0 then
  38. local summon = getCreatureSummons(cid)[1]
  39. if getPlayerStorageValue(summon, 9658783) == 1 and isInArray({"Aggron", "Sudowoodo", "Mega Aggron"}, getCreatureName(summon)) then
  40. doKillWildPoke(getCreatureSummons(cid)[1], getCreatureSummons(cid)[1])
  41. doPlayerSendCancel(cid, "This pokemon is fainted.")
  42. if isInDuel(cid) then
  43. doRemoveCountPokemon(cid)
  44. end
  45. return true
  46. end
  47.  
  48. if getPlayerStorageValue(cid, 990) == 1 then -- GYM
  49. doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.")
  50. return true
  51. end
  52. if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6
  53. if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then
  54. BackTeam(cid)
  55. end
  56. end
  57. if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then
  58. doPlayerSendCancel(cid, "You can't do that while is controling a mind")
  59. return true --alterado v1.5
  60. end
  61.  
  62. if #getCreatureSummons(cid) <= 0 then
  63. if isInArray(pokeballs[btype].all, item.itemid) then
  64. doTransformItem(item.uid, pokeballs[btype].off)
  65. doItemSetAttribute(item.uid, "hp", 0)
  66. doPlayerSendCancel(cid, "This pokemon is fainted.")
  67. return true
  68. end
  69. end
  70.  
  71.  
  72.  
  73. local cd = getCD(item.uid, "blink", 30)
  74. if cd > 0 then
  75. setCD(item.uid, "blink", 0)
  76. end
  77.  
  78. local z = getCreatureSummons(cid)[1]
  79.  
  80. if getCreatureCondition(z, CONDITION_INVISIBLE) and not isGhostPokemon(z) then
  81. return true
  82. end
  83.  
  84. if isInDuel(cid) then
  85. doRemoveCountPokemon(cid)
  86. end
  87.  
  88. checkGiveUp(cid)
  89.  
  90. doReturnPokemon(cid, z, item, effect)
  91. doPlayerSendCancel(cid, '12//,hide') --alterado v1.7
  92. doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_DITTO_MEMORY, "sair") -- ditto memory system
  93.  
  94.  
  95. elseif item.itemid == pokeballs[btype].on then
  96.  
  97. if #getCreatureSummons(cid) >= 1 then
  98. doPlayerSendCancel(cid, "You can't do that.")
  99. BackTeam(cid)
  100. return true --alterado v1.5
  101. end
  102. if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
  103. doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")
  104. return TRUE
  105. end
  106.  
  107. -- rever a seguranca do pokemon ser sumanado com 0 de hp
  108.  
  109. local pokemon = getItemAttribute(item.uid, "poke")
  110.  
  111. if not pokes[pokemon] then
  112. return true
  113. end
  114.  
  115. ----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto ---------------------------------
  116. if not isInArray({5, 6}, getPlayerGroupId(cid)) then
  117. local balls = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)
  118. local low = {}
  119. local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"}
  120. if #balls >= 1 then
  121. for _, uid in ipairs(balls) do
  122. local nome = getItemAttribute(uid, "poke")
  123. if not isInArray(lowPokes, pokemon) and nome == pokemon and not isGod(cid) then
  124. return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry two pokemons equals!")
  125. else
  126. if nome == pokemon then
  127. table.insert(low, nome)
  128. end
  129. end
  130. end
  131. end
  132. if #low >= 3 then
  133. return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!")
  134. end
  135. end
  136. ---------------------------------------------------------------------------------------------------------------------------------------------------
  137.  
  138. local x = pokes[pokemon]
  139. local boost = getItemAttribute(item.uid, "boost") or 0
  140.  
  141. if getPlayerLevel(cid) < (x.level+boost) then
  142. doPlayerSendCancel(cid, "You need level "..(x.level+boost).." to use this pokemon.")
  143. return true
  144. end
  145.  
  146. ---------------------------- Sistema pokes de clan --------------------------------------
  147. local shinysClan = {
  148. ["Shiny Fearow"] = {4, "Wingeon"},
  149. ["Shiny Flareon"] = {1, "Volcanic"},
  150. ["Shiny Vaporeon"] = {2, "Seavel"},
  151. ["Shiny Jolteon"] = {9, "Raibolt"},
  152. ["Shiny Hypno"] = {7, "Psycraft"},
  153. ["Shiny Golem"] = {3, "Orebound"},
  154. ["Shiny Vileplume"] = {8, "Naturia"},
  155. ["Shiny Nidoking"] = {5, "Malefic"},
  156. ["Shiny Hitmontop"] = {6, "Gardestrike"}, --alterado v1.4
  157. }
  158.  
  159. if shinysClan[pokemon] and getPlayerGroupId(cid) < 4 then --alterado v1.9 \/
  160. if getPlayerClanNum(cid) ~= shinysClan[pokemon][1] then
  161. doPlayerSendCancel(cid, "You need be a member of the clan "..shinysClan[pokemon][2].." to use this pokemon!")
  162. return true
  163. elseif getPlayerClanRank(cid) < 3 then
  164. doPlayerSendCancel(cid, "You need be atleast rank 3 to use this pokemon!")
  165. return true
  166. end
  167. end
  168. --------------------------------------------------------------------------------------
  169. local isNicked, nick, pokemonRealName = false, pokemon, pokemon
  170. local pokeSourceCode = "sim"
  171.  
  172. if getItemAttribute(item.uid, "copyName") then -- ditto system
  173. pokemon = getItemAttribute(item.uid, "copyName")
  174. pokemonRealName = getItemAttribute(item.uid, "poke")
  175. end
  176.  
  177. if getItemAttribute(item.uid, "nick") and getItemAttribute(item.uid, "nick") ~= "" then
  178. isNicked = true nick = getItemAttribute(item.uid, "nick")
  179. pokeSourceCode = doCreateMonsterNick(cid, pokemon, getItemAttribute(item.uid, "nick"), getThingPos(cid), true)
  180. else
  181. pokeSourceCode = doCreateMonsterNick(cid, pokemon, retireShinyName(pokemonRealName), getThingPos(cid), true) -- chama o pokemon com nome verdadeiro, mas se for shiny ja tera seu nome alterado
  182. end
  183.  
  184. if pokeSourceCode == "Nao" then
  185. doSendMsg(cid, "There is no room for your Pokémon.")
  186. return true
  187. end
  188.  
  189.  
  190.  
  191. if pokeSourceCode == "Nao" then
  192. doSendMsg(cid, "No room for your pokemon.")
  193. return true
  194. end
  195.  
  196.  
  197. local pk = getCreatureSummons(cid)[1]
  198.  
  199. setMoveSummon(cid, true)
  200. if not isCreature(pk) then return true end
  201.  
  202. ------------------------passiva hitmonchan------------------------------
  203. if isSummon(pk) then --alterado v1.8 \/
  204. if pokemon == "Shiny Hitmonchan" or pokemon == "Hitmonchan" then
  205. if not getItemAttribute(item.uid, "hands") then
  206. doSetItemAttribute(item.uid, "hands", 0)
  207. end
  208. local hands = getItemAttribute(item.uid, "hands")
  209. doSetCreatureOutfit(pk, {lookType = hitmonchans[pokemon][hands].out}, -1)
  210. end
  211. end
  212. -------------------------------------------------------------------------
  213. ---------movement magmar, jynx-------------
  214. if EFFECTS[getCreatureName(pk)] then
  215. markPosEff(pk, getThingPos(pk))
  216. sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk))
  217. end
  218. --------------------------------------------------------------------------
  219.  
  220. doCreatureSetLookDir(pk, 2)
  221.  
  222.  
  223. adjustStatus(pk, item.uid, true, true, true)
  224. doRegenerateWithY(getCreatureMaster(pk), pk)
  225. doCureWithY(getCreatureMaster(pk), pk)
  226.  
  227. doTransformItem(item.uid, pokeballs[btype].use)
  228.  
  229.  
  230. local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", (isNicked and nick or retireShinyName(pokemon)))
  231. doCreatureSay(cid, mgo, TALKTYPE_ORANGE_1)
  232.  
  233. doSendMagicEffect(getCreaturePosition(pk), effect)
  234. doSendParticleAura(pk, 81)
  235. doPlayerSendCancel(cid, '12//,show')
  236. doSendPlayerExtendedOpcode(cid, opcodes.OPCODE_BATTLE_POKEMON, tostring(pk))
  237. setPokemonGhost(pk)
  238.  
  239.  
  240. else
  241.  
  242. doPlayerSendCancel(cid, "This pokemon is fainted.")
  243.  
  244. end
  245.  
  246. -- otclient life
  247. doSendLifePokeToOTC(cid)
  248. doUpdateMoves(cid)
  249. -- otclient life
  250.  
  251. return true
  252. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement