Advertisement
Guest User

Untitled

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