Advertisement
Kevick

goback.lua

Apr 27th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.23 KB | None | 0 0
  1. local EFFECTS = {
  2. --[OutfitID] = {Effect}
  3. ["Magmar"] = 35,
  4. ["Magmortar"] = 35,
  5. ["Shiny Magmar"] = 35,
  6. ["Jynx"] = 17, --alterado v2.5
  7. ["Shiny Jynx"] = 17,
  8. ["Mamoswine"] = 205,
  9. ["Piloswine"] = 205, --alterado v2.8
  10. ["Swinub"] = 205,
  11. }
  12.  
  13. function onUse(cid, item, frompos, item2, topos)
  14.  
  15.  
  16.  
  17.  
  18. if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 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 or getPlayerStorageValue(cid, 5700) >= 1 then --alterado v2.9 <<
  22. return true
  23. end
  24.  
  25. local ballName = getItemAttribute(item.uid, "poke")
  26. local btype = getPokeballType(item.itemid)
  27. local usando = pokeballs[btype].use
  28.  
  29. local effect = pokeballs[btype].effect
  30. if not effect then
  31. effect = 21
  32. end
  33.  
  34. unLock(item.uid) --alterado v2.8
  35. if item.itemid == usando then
  36. --if getPlayerGroupId == 8 then
  37. --doPlayerSendTextMessage(cid, 19, "TESTS 1!")
  38. --setPlayerGroupId(cid,1)
  39. --return true
  40. --end
  41.  
  42.  
  43.  
  44. if getPlayerStorageValue(cid, 990) == 1 then -- GYM
  45. doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.")
  46. return true
  47. end
  48.  
  49. if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v2.6
  50. if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then
  51. BackTeam(cid)
  52. end
  53. end
  54.  
  55. if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then
  56. doPlayerSendCancel(cid, "You can't do that while is controling a mind")
  57. return true --alterado v2.5
  58. end
  59.  
  60. if #getCreatureSummons(cid) <= 0 then
  61. if isInArray(pokeballs[btype].all, item.itemid) then
  62. doTransformItem(item.uid, pokeballs[btype].on)
  63. doItemSetAttribute(item.uid, "hp", 1)
  64. --setPlayerGroupId(cid,1)
  65. doPlayerSendCancel(cid, "[Ball-Desbloqueado] Balls Desbloqueado com Sucesso!")
  66. doPlayerSendTextMessage(cid, 21, "[Ball-Desbloqueado] Balls Desbloqueado com Sucesso!")
  67. doSendMagicEffect(getThingPos(cid), 29)
  68. doSendAnimatedText(getCreaturePosition(cid),"Unlock",math.random(1,255))
  69. return true
  70. end
  71. end
  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. doReturnPokemon(cid, z, item, effect)
  84. elseif item.itemid == pokeballs[btype].on then
  85. --doPlayerSendTextMessage(cid, 19, "TESTS 3!")
  86. --setPlayerGroupId(cid,8)
  87.  
  88. if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
  89. doPlayerSendCancel(cid, "You must put your pokeball in the correct place!")
  90. return TRUE
  91. end
  92.  
  93. local thishp = getItemAttribute(item.uid, "hp")
  94.  
  95. if thishp <= 0 then
  96. if isInArray(pokeballs[btype].all, item.itemid) then
  97. doTransformItem(item.uid, pokeballs[btype].off)
  98. doItemSetAttribute(item.uid, "hp", 0)
  99. doPlayerSendCancel(cid, "This pokemon is fainted.")
  100. return true
  101. end
  102. end
  103.  
  104. local pokemon = getItemAttribute(item.uid, "poke")
  105.  
  106. if not pokes[pokemon] then
  107. return true
  108. end
  109.  
  110. ----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto ---------------------------------
  111. if not isInArray({5, 6}, getPlayerGroupId(cid)) then --alterado v2.9 \/
  112. local balls = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)
  113. local low = {}
  114. local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"}
  115. if #balls >= 1 then
  116. for _, uid in ipairs(balls) do
  117. local nome = getItemAttribute(uid, "poke")
  118. if not isInArray(lowPokes, pokemon) and nome == pokemon then
  119. return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry two pokemons equals!")
  120. else
  121. if nome == pokemon then
  122. table.insert(low, nome)
  123. end
  124. end
  125. end
  126. end
  127. if #low >= 3 then
  128. return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!")
  129. end
  130. end
  131. ---------------------------------------------------------------------------------------------------------------------------------------------------
  132.  
  133. local x = pokes[pokemon]
  134. local boosts = getItemAttribute(item.uid, "boost") or 0
  135.  
  136. if getPlayerLevel(cid) + pokemonMaxLevelAbovePlayer < getItemAttribute(item.uid, "level") + boosts then
  137. doPlayerSendCancel(cid, "Your pokemon's level is much higher than yours, you can't use him.")
  138. return true
  139. end
  140. doSummonMonster(cid, pokemon)
  141.  
  142. local pk = getCreatureSummons(cid)[1]
  143. if not isCreature(pk) then return true end
  144. ------------------------passiva hitmonchan------------------------------
  145. if isSummon(pk) then --alterado v2.8 \/
  146. if pokemon == "Shiny Hitmonchan" or pokemon == "Hitmonchan" then
  147. if not getItemAttribute(item.uid, "hands") then
  148. doSetItemAttribute(item.uid, "hands", 0)
  149. end
  150. local hands = getItemAttribute(item.uid, "hands")
  151. doSetCreatureOutfit(pk, {lookType = hitmonchans[pokemon][hands].out}, -1)
  152. end
  153. end
  154. -------------------------------------------------------------------------
  155. ---------movement magmar, jynx-------------
  156. if EFFECTS[getCreatureName(pk)] then
  157. markPosEff(pk, getThingPos(pk))
  158. sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk)) --alterado v2.5
  159. end
  160. --------------------------------------------------------------------------
  161.  
  162. if getCreatureName(pk) == "Ditto" then
  163.  
  164. local left = getItemAttribute(item.uid, "transLeft")
  165. local name = getItemAttribute(item.uid, "transName")
  166.  
  167. if left and left > 0 then
  168. setPlayerStorageValue(pk, 1010, name)
  169. doSetCreatureOutfit(pk, {lookType = getItemAttribute(item.uid, "transOutfit")}, -1)
  170. addEvent(deTransform, left * 1000, pk, getItemAttribute(item.uid, "transTurn"))
  171. doItemSetAttribute(item.uid, "transBegin", os.clock())
  172. else
  173. setPlayerStorageValue(pk, 1010, "Ditto")
  174. end
  175. end
  176.  
  177. if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end
  178.  
  179. doCreatureSetLookDir(pk, 2)
  180.  
  181. adjustStatus(pk, item.uid, true, false, true)
  182. doAddPokemonInOwnList(cid, pokemon)
  183.  
  184. doTransformItem(item.uid, item.itemid+1)
  185.  
  186. local pokename = getPokeName(pk) --alterado v2.7
  187.  
  188. local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)
  189. doCreatureSay(cid, mgo, TALKTYPE_SAY)
  190.  
  191. doSendMagicEffect(getCreaturePosition(pk), effect)
  192.  
  193. if useOTClient then
  194. doPlayerSendCancel(cid, '12//,show') --alterado v2.7
  195. end
  196.  
  197. else
  198. doPlayerSendCancel(cid, "This pokemon is fainted.")
  199. end
  200.  
  201. if useKpdoDlls then
  202. doUpdateMoves(cid)
  203. end
  204. return true
  205. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement