Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.04 KB | None | 0 0
  1. function getPlayerPokeballs(cid) --alterado v1.9 \/
  2. local ret = {}
  3. local container = 0
  4.  
  5. if isCreature(cid) then
  6. container = getPlayerSlotItem(cid, 3).uid
  7. local myball = getPlayerSlotItem(cid, 8)
  8. if myball.uid > 0 then
  9. table.insert(ret, myball)
  10. end
  11. else
  12. container = cid
  13. end
  14.  
  15. if isContainer(container) and getContainerSize(container) > 0 then
  16. for slot = 0, (getContainerSize(container) - 1) do
  17. local item = getContainerItem(container, slot)
  18. if isContainer(item.uid) then
  19. local itemsbag = getPlayerPokeballs(item.uid)
  20. if itemsbag and #itemsbag > 0 then
  21. for i = 0, #itemsbag do
  22. table.insert(ret, itemsbag[i])
  23. end
  24. end
  25. elseif isPokeball(item.itemid) then
  26. table.insert(ret, item)
  27. end
  28. end
  29. end
  30. return ret
  31. end
  32.  
  33. function getNewMoveTable(table, n)
  34. if table == nil or not n then return false end
  35.  
  36. local moves = {table.move1, table.move2, table.move3, table.move4, table.move5, table.move6, table.move7, table.move8, table.move9,
  37. table.move10, table.move11, table.move12}
  38.  
  39. return moves[n] or false
  40. end
  41.  
  42.  
  43. function doUpdateMoves(cid)
  44. if not isCreature(cid) then return true end
  45. local summon = getCreatureSummons(cid)[1]
  46. local ret = {}
  47. table.insert(ret, "12&,")
  48. if not summon then
  49. for a = 1, 12 do
  50. table.insert(ret, "n/n,")
  51. end
  52. doPlayerSendCancel(cid, table.concat(ret))
  53. doPlayerSendCancel(cid, "")
  54. addEvent(doUpdateCooldowns, 100, cid)
  55. return true
  56. end
  57. if isTransformed(summon) then --alterado v1.9
  58. moves = movestable[getPlayerStorageValue(summon, 1010)]
  59. else
  60. moves = movestable[getCreatureName(summon)]
  61. end
  62. for a = 1, 12 do
  63. local b = getNewMoveTable(moves, a)
  64. if b then
  65. table.insert(ret, b.name..",")
  66. else
  67. table.insert(ret, "n/n,")
  68. end
  69. end
  70. doPlayerSendCancel(cid, table.concat(ret))
  71. doPlayerSendCancel(cid, "")
  72. addEvent(doUpdateCooldowns, 100, cid)
  73. end
  74.  
  75. function doUpdateCooldowns(cid)
  76. if not isCreature(cid) then return true end
  77. local a = getPlayerSlotItem(cid, 8)
  78. local ret = {}
  79. table.insert(ret, "12|,")
  80. if a.uid <= 0 or #getCreatureSummons(cid) <= 0 then
  81. for cds = 1, 12 do
  82. if useOTClient then table.insert(ret, "-1|0,") else table.insert(ret, "-1,") end
  83. end
  84. doPlayerSendCancel(cid, table.concat(ret))
  85. doPlayerSendCancel(cid, "")
  86. return true
  87. end
  88. for cds = 1, 12 do
  89. ----
  90. local summon = getCreatureSummons(cid)[1]
  91. if summon and getPlayerStorageValue(summon, 212123) >= 1 then
  92. cdzin = "cm_move"..cds
  93. else
  94. cdzin = "move"..cds
  95. end
  96. ----
  97. if isTransformed(summon) then --alterado v1.9
  98. moves = movestable[getPlayerStorageValue(summon, 1010)]
  99. else
  100. moves = movestable[getCreatureName(summon)]
  101. end
  102. local b = getNewMoveTable(moves, cds)
  103. if not b then
  104. for cds = 1, 12 do
  105. if useOTClient then table.insert(ret, "-1|0,") else table.insert(ret, "-1,") end --alterado v1.9
  106. end
  107. doPlayerSendCancel(cid, table.concat(ret))
  108. doPlayerSendCancel(cid, "")
  109. return true
  110. end
  111. ----
  112. if getCD(a.uid, cdzin) > 0 then
  113. if (useOTClient and b) then table.insert(ret, (getCD(a.uid, cdzin)).."|"..b.level..",") else table.insert(ret, (getCD(a.uid, cdzin))..",") end
  114. else
  115. if (useOTClient and b) then table.insert(ret, "0|"..b.level..",") else table.insert(ret, "0,") end
  116. end
  117. end
  118. doPlayerSendCancel(cid, table.concat(ret))
  119. doPlayerSendCancel(cid, "")
  120. end
  121.  
  122. function getBallsAttributes(item)
  123. local t = {"poke", "gender", "nick", "boost", "happy", "hp", "description", "transBegin", "hunger", "transLeft", "transTurn", "transOutfit", "transName",
  124. "trans", "light", "blink", "move1", "move2", "move3", "move4", "move5", "move6", "move7", "move8", "move9", "move10", "move11", "move12", "ballorder",
  125. "hands", "aura", "burn", "burndmg", "poison", "poisondmg", "confuse", "sleep", "miss", "missSpell", "missEff", "fear", "fearSkill", "silence",
  126. "silenceEff", "stun", "stunEff", "stunSpell", "paralyze", "paralyzeEff", "slow", "slowEff", "leech", "leechdmg", "Buff1", "Buff2", "Buff3", "Buff1skill",
  127. "Buff2skill", "Buff3skill", "control", "unique", "task", "lock"}
  128. local ret = {}
  129. for a = 1, #t do
  130. if getItemAttribute(item, t[a]) == "hands" then
  131. return
  132. end
  133. ret[t[a]] = getItemAttribute(item, t[a]) or false
  134. end
  135. return ret
  136. end
  137.  
  138. function doChangeBalls(cid, item1, item2)
  139. if not isCreature(cid) then return true end
  140. if item1.uid == item2.uid then
  141. if #getCreatureSummons(cid) <= 0 then
  142. doGoPokemon(cid, getPlayerSlotItem(cid, 8))
  143. else
  144. doReturnPokemon(cid, getCreatureSummons(cid)[1], getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect)
  145. end
  146. return true
  147. end
  148.  
  149. if item1.uid > 0 and item2.uid > 0 then
  150. local io = getBallsAttributes(item1.uid)
  151. local it = getBallsAttributes(item2.uid)
  152. for a, b in pairs (io) do
  153. if b then
  154. doItemSetAttribute(item2.uid, a, b)
  155. else
  156. doItemEraseAttribute(item2.uid, a)
  157. end
  158. end
  159. for a, b in pairs (it) do
  160. if b then
  161. doItemSetAttribute(item1.uid, a, b)
  162. else
  163. doItemEraseAttribute(item1.uid, a)
  164. end
  165. end
  166. local id = item2.itemid
  167. doTransformItem(item2.uid, item1.itemid)
  168. doTransformItem(item1.uid, id)
  169. doGoPokemon(cid, getPlayerSlotItem(cid, 8))
  170. else
  171. local id = item2.itemid
  172. local b = getBallsAttributes(item2.uid)
  173. local a = doPlayerAddItem(cid, 2643, false)
  174. for c, d in pairs (b) do
  175. if d then
  176. doItemSetAttribute(a, c, d)
  177. else
  178. doItemEraseAttribute(a, c)
  179. end
  180. end
  181. doRemoveItem(item2.uid, 1)
  182. doTransformItem(a, id)
  183. doGoPokemon(cid, getPlayerSlotItem(cid, 8))
  184. end
  185. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement