Advertisement
Kevick

pokeexp.lua

Apr 28th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. local balls = {10975, 11826, 11828, 11829, 11831, 11832, 11834, 11835, 11837, 12972,
  2. 11737, 11739, 11740, 11742, 11743, 11745, 11746, 11748, 12621, 13259}
  3.  
  4. local function playerAddExp(cid, exp)
  5. doPlayerAddExp(cid, exp)
  6. doSendAnimatedText(getThingPos(cid), exp, 215)
  7. end
  8.  
  9.  
  10. function onDeath(cid, corpse, deathList)
  11.  
  12. --if not isCreature(cid) then return true end
  13. if isSummon(cid) or not deathList or corpse.itemid == 0 or getCreatureName(cid) == "Evolution" then return true end
  14.  
  15. -------------Edited Golden Arena-------------------------
  16. if getPlayerStorageValue(cid, 22546) == 1 then
  17. setGlobalStorageValue(22548, getGlobalStorageValue(22548)-1)
  18. doItemSetAttribute(corpse.uid, "golden", 1) --alterado v2.6
  19. end --alterado v2.4
  20. if getPlayerStorageValue(cid, 22546) == 1 and (getGlobalStorageValue(22547) == -1 or getGlobalStorageValue(22547) == #wavesGolden+1) and getGlobalStorageValue(22548) <= 0 then
  21. for _, sid in ipairs(getPlayersOnline()) do
  22. if getPlayerStorageValue(sid, 22545) == 1 then
  23. doPlayerSendTextMessage(sid, 20, "You have win the golden arena! Take your reward!")
  24. doPlayerAddItem(sid, 2152, 100) --premio
  25. setPlayerStorageValue(sid, 22545, -1)
  26. doTeleportThing(sid, getClosestFreeTile(sid, posBackGolden), false) --alterado v2.4
  27. end --nao esqueçam de fazer as alteraçoes no lib/configuration.lua!!
  28. end
  29. end
  30. ---------------------------------------------------
  31.  
  32. local givenexp = getWildPokemonExp(cid)
  33. local expstring = ""..cid.."expEx"
  34. local killer = getItemAttribute(corpse.uid, "corpseowner")
  35.  
  36. if givenexp > 0 then
  37. for a = 1, #deathList do
  38. local pk = deathList[a]
  39. if isCreature(pk) then
  40. playerAddExp(pk, math.floor(playerExperienceRate * givenexp))
  41. local firstball = getPlayerSlotItem(pk, 8)
  42.  
  43. if firstball and getItemAttribute(firstball.uid, expstring) and getItemAttribute(firstball.uid, expstring) > 0 then
  44. local percent = getItemAttribute(firstball.uid, expstring) <= 1 and getItemAttribute(firstball.uid, expstring) or 1
  45. local gainexp = math.ceil(percent * givenexp)
  46. doItemSetAttribute(firstball.uid, expstring, 0)
  47. givePokemonExp(pk, firstball, gainexp)
  48. end
  49.  
  50. for b = 1, #balls do
  51. local pokes = getItemsInContainerById(getPlayerSlotItem(pk, 3).uid, balls[b])
  52. if #pokes >= 1 then
  53. for _, uid in pairs (pokes) do
  54. if getItemAttribute(uid, expstring) and getItemAttribute(uid, expstring) > 0 then
  55. local percent = getItemAttribute(uid, expstring) <= 1 and getItemAttribute(uid, expstring) or 1
  56. local gainexp = math.ceil(percent * givenexp)
  57. doItemSetAttribute(uid, expstring, 0)
  58. givePokemonExpInBp(pk, uid, gainexp, balls[b])
  59. end
  60. end
  61. end
  62. end
  63. end
  64. end
  65. end
  66.  
  67.  
  68.  
  69.  
  70. doItemSetAttribute(corpse.uid, "offense", getPlayerStorageValue(cid, 1011))
  71. doItemSetAttribute(corpse.uid, "defense", getPlayerStorageValue(cid, 1012))
  72. doItemSetAttribute(corpse.uid, "speed", getPlayerStorageValue(cid, 1013))
  73. doItemSetAttribute(corpse.uid, "vitality", getPlayerStorageValue(cid, 1014))
  74. doItemSetAttribute(corpse.uid, "spattack", getPlayerStorageValue(cid, 1015))
  75. doItemSetAttribute(corpse.uid, "level", getLevel(cid))
  76. doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid))
  77. return true
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement