Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.92 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4. local talkState = {}
  5.  
  6. function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid)        end
  7. function onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid)        end
  8. function onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg)    end
  9. function onThink()                npcHandler:onThink()                end
  10.  
  11. local pokes = {
  12. ["Zubat"] = {maxh = 642},
  13. ["Zapdos"] = {maxh = 100},
  14. ["Wygglypuff"] = {maxh = 100},
  15. ["Wigglytuff"] = {maxh = 4000},
  16. ["Weezing"] = {maxh = 3450},
  17. ["Weepinbell"] = {maxh = 1280},
  18. ["Weedle"] = {maxh = 291},
  19. ["Wartortle"] = {maxh = 4115},
  20. ["Vulpix"] = {maxh = 1200},
  21. ["Voltorb"] = {maxh = 1000},
  22. ["Vileplume"] = {maxh = 4100},
  23. ["Victribell"] = {maxh = 3850},
  24. ["Venusaur"] = {maxh = 11170},
  25. ["Venonat"] = {maxh = 1250},
  26. ["Venomoth"] = {maxh = 3950},
  27. ["Vaporeon"] = {maxh = 100},
  28. ["Tentacruel"] = {maxh = 8200},
  29. ["Tentacool"] = {maxh = 914},
  30. ["Tauros"] = {maxh = 4100},
  31. ["Tangela"] = {maxh = 4060},
  32. ["Staryu"] = {maxh = 1000},
  33. ["Starmie"] = {maxh = 3850},
  34. ["Squirtle"] = {maxh = 1600},
  35. ["Spearow"] = {maxh = 642},
  36. ["Snorlax"] = {maxh = 15350},
  37. ["Slowpoke"] = {maxh = 1280},
  38. ["Slowbro"] = {maxh = 4020},
  39. ["Shellder"] = {maxh = 968},
  40. ["Seel"] = { maxh = 1470},
  41. ["Seaking"] = {maxh = 2315},
  42. ["Seadra"] = {maxh = 900},
  43. ["Scyther"] = {maxh = 6810},
  44. ["Sandslash"] = {maxh = 5700},
  45. ["Sandshrew"] = {maxh = 1019},
  46. ["Rhyhorn"] = {maxh = 1750},
  47. ["Rhydon"] = {maxh = 5115},
  48. ["Rattata"] = {maxh = 291},
  49. ["Raticate"] = {maxh = 1300},
  50. ["Rapidash"] = {maxh = 5020},
  51. ["Raichu"] = {maxh = 4115},
  52. ["Psyduck"] = {maxh = 1210},
  53. ["Primeape"] = {maxh = 4760},
  54. ["Porygon"] = {maxh = 100},
  55. ["Ponyta"] = {maxh = 980},
  56. ["Poliwrath"] = {maxh = 4950},
  57. ["Poliwhirl"] = {maxh = 1650},
  58. ["Poliwag"] = {maxh = 631},
  59. ["Pinsir"] = {maxh = 3150},
  60. ["Pikachu"] = {maxh = 1600},
  61. ["Pidgeot"] = {maxh = 5870},
  62. ["Pidgey"] = {maxh = 292},
  63. ["Pidgeotto"] = {maxh = 1280},
  64. ["Persian"] = {maxh = 2850},
  65. ["Parasect"] = {maxh = 4100},
  66. ["Paras"] = {maxh = 425},
  67. ["Onix"] = {maxh = 4100},
  68. ["Omastar"] = {maxh = 100},
  69. ["Omanyte"] = {maxh = 4530},
  70. ["Oddish"] = {maxh = 460},
  71. ["Ninetales"] = {maxh = 5800},
  72. ["Nidorino"] = {maxh = 2100},
  73. ["Nidorina"] = {maxh = 2300},
  74. ["Nidoranma"] = {maxh = 985},
  75. ["Nidoranfe"] = {maxh = 100},
  76. ["Nidoqueen"] = {maxh = 7800},
  77. ["Nidoking"] = {maxh = 7800},
  78. ["Muk"] = {maxh = 3250},
  79. ["Mr.Mime"] = {maxh = 5320},
  80. ["Moltres"] = {maxh = 100},
  81. ["Mewtwo"] = {maxh = 100},
  82. ["Mew"] = {maxh = 100},
  83. ["Metapod"] = {maxh = 1120},
  84. ["Meowth"] = {maxh = 1040},
  85. ["Marowak"] = {maxh = 4125},
  86. ["Mankey"] = {maxh = 1000},
  87. ["Magneton"] = {maxh = 4100},
  88. ["Magnemite"] = {maxh = 614},
  89. ["Magmar"] = {maxh = 7050},
  90. ["Magikarp"] = {maxh = 250},
  91. ["Machop"] = {maxh = 1640},
  92. ["Machoke"] = {maxh = 3755},
  93. ["Machamp"] = {maxh = 7560},
  94. ["Lickitung"] = {maxh = 5320},
  95. ["Lapras"] = {maxh = 7320},
  96. ["Krabby"] = {maxh = 744},
  97. ["Koffing"] = {maxh = 975},
  98. ["Kingler"] = {maxh = 3115},
  99. ["Kangaskhan"] = {maxh = 7550},
  100. ["Kakuna"] = {maxh = 1120},
  101. ["Kadabra"] = {maxh = 2765},
  102. ["Kabutops"] = {maxh = 100},
  103. ["Kabuto"] = {maxh = 100},
  104. ["Jynx"] = {maxh = 7060},
  105. ["Jyglipuff"] = {maxh = 100},
  106. ["Jolteon"] = {maxh = 100},
  107. ["Jigglypuff"] = {maxh = 1695},
  108. ["Ivysaur"] = {maxh = 4115},
  109. ["Hypno"] = {maxh = 4590},
  110. ["Horsea"] = {maxh = 604},
  111. ["Hitmonlee"] = {maxh = 7000},
  112. ["Hitmonchan"] = {maxh = 7000},
  113. ["Haunter"] = {maxh = 4250},
  114. ["Gyarados"] = {maxh = 10150},
  115. ["Growlithe"] = {maxh = 1200},
  116. ["Goldeen"] = {maxh = 900},
  117. ["Golduck"] = {maxh = 5115},
  118. ["Golem"] = {maxh = 5250},
  119. ["Graveler"] = {maxh = 3100},
  120. ["Grimer"] = {maxh = 1050},
  121. ["Golbat"] = {maxh = 2480},
  122. ["Gloom"] = {maxh = 1530},
  123. ["Geodude"] = {maxh = 1528},
  124. ["Gengar"] = {maxh = 8400},
  125. ["Gastly"] = {maxh = 1160},
  126. ["Flareon"] = {maxh = 100},
  127. ["Fearow"] = {maxh = 3495},
  128. ["Farfetch"] = {maxh = 3870},
  129. ["Exeggutor"] = {maxh = 4550},
  130. ["Exeggcute"] = {maxh = 1100},
  131. ["Ekans"] = {maxh = 882},
  132. ["Shiny Charizard"] = {maxh = 13170},
  133. ["Electabuzz"] = {maxh = 7050},
  134. ["Electrode"] = {maxh = 3150},
  135. ["Dugtrio"] = {maxh = 3280},
  136. ["Drowzee"] = {maxh = 1950},
  137. ["Dratini"] = {maxh = 1810},
  138. ["Dragonite"] = {maxh = 17150},
  139. ["Dragonair"] = {maxh = 7600},
  140. ["Doduo"] = {maxh = 936},
  141. ["Dodrio"] = {maxh = 3570},
  142. ["Ditto"] = {maxh = 4115},
  143. ["Diglett"] = {maxh = 696},
  144. ["Dewgong"] = {maxh = 7300},
  145. ["Cubone"] = {maxh = 1640},
  146. ["Crystal Onix"] = {maxh = 100},
  147. ["Cloyster"] = {maxh = 5825},
  148. ["Clefairy"] = {maxh = 1695},
  149. ["Clefabe"] = {maxh = 4400},
  150. ["Charmeleon"] = {maxh = 4115},
  151. ["Charmander"] = {maxh = 1600},
  152. ["Charizard"] = {maxh = 11170},
  153. ["Chansey"] = {maxh = 5000},
  154. ["Caterpie"] = {maxh = 291},
  155. ["Butterfree"] = {maxh = 2200},
  156. ["Bulbasaur"] = {maxh = 1600},
  157. ["Blastoise"] = {maxh = 11170},
  158. ["Bellsprout"] = {maxh = 838},
  159. ["Beedrill"] = {maxh = 2200},
  160. ["Articuno"] = {maxh = 100},
  161. ["Arcanine"] = {maxh = 7800},
  162. ["Arbok"] = {maxh = 2405},
  163. ["Alakazam"] = {maxh = 7350},
  164. ["Aerodactyl"] = {maxh = 100},
  165. ["Abra"] = {maxh = 870},
  166. }
  167.  
  168. function creatureSayCallback(cid, type, msg)
  169.  
  170.     if(not npcHandler:isFocused(cid)) then
  171.         return false
  172.     end
  173.    
  174.     if msgcontains(msg, 'heal') then
  175.         if #getCreatureSummons(cid) >= 1 then
  176.             return selfSay('Voce precisa botar seus pokemons dentro da pokebola.', cid)
  177.         end
  178.  
  179.     for slo = CONST_SLOT_FIRST, CONST_SLOT_LAST do
  180.         local item = getPlayerSlotItem(cid, slo)
  181.             if isContainer(item.uid) then
  182.                     for i,x in pairs(pokes) do
  183.             if i == getItemsInContainerById(item.uid, pokeout) then
  184.                         doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]")
  185.                         doTransformItem(x, pokein)
  186.                     end
  187.             end
  188.                     for i,x in pairs(pokes) do
  189.             if i == getItemsInContainerById(item.uid, pokein) then
  190.                         doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]")
  191.                      end
  192.              end
  193.  
  194.                     elseif item.itemid == pokeout or item.itemid == pokein then
  195.              for i,x in pairs(pokes) do
  196.              if i == getItemAttribute(item, "poke") then
  197.                          doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..x.maxh.."/"..x.maxh.."]")
  198.                          doTransformItem(item.uid, pokein)
  199.                     end
  200.              end
  201.       end
  202.        
  203. end
  204.         selfSay('Pronto, Seus pokemons estao com a vida maxima.', cid)  
  205.     end
  206.     return true
  207. end
  208.  
  209. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  210. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement