Advertisement
Guest User

exphitbug

a guest
May 13th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. rateExp = 50 -- 0 a 50
  2. rateExp1 = 30 -- 50 a 100
  3. rateExp2 = 10 -- 100 a 130
  4. rateExp3 = 5 -- 151 a 200
  5. rateExp4 = 3 -- 201 a 250
  6. rateExp5 = 2 -- 251 a 300
  7. rateExp6 = 1.5 -- 301 a 400
  8. rateExp7 = 1 -- 401 a 450
  9. rateExp8 = 0.5 -- 451
  10. bonus = 1.5 -- Bonus por estar com exp ring
  11. expringid = 148 -- Id do exp ring
  12. ------------------------------
  13. function CalculeExp(monsterhp, exptotal, hit)
  14. local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
  15. local x2 = x - 20 + math.random(20)
  16. return x2 > 0 and x2 or 0
  17. end
  18. function isSummon(uid)
  19. return uid ~= getCreatureMaster(uid) or false
  20. end
  21. function onStatsChange(cid, attacker, type, combat, value)
  22. if type == STATSCHANGE_HEALTHLOSS then
  23. if isMonster(cid) then
  24. if isCreature(attacker) then
  25. local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker
  26. if isPlayer(sid) and getPlayerLevel(sid) <= 50 then
  27. local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp, value)
  28. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." exp.")
  29. doSendAnimatedText(getThingPos(sid), expg, 215)
  30. doPlayerAddExp(sid, expg)
  31. elseif isPlayer(sid) and getPlayerLevel(sid) > 50 and getPlayerLevel(sid) <= 100 then
  32. local expg1 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp1, value)
  33. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg1.." exp.")
  34. doSendAnimatedText(getThingPos(sid), expg1, 215)
  35. doPlayerAddExp(sid, expg1)
  36. elseif isPlayer(sid) and getPlayerLevel(sid) > 100 and getPlayerLevel(sid) <= 130 then
  37. local expg2 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp2, value)
  38. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg2.." exp.")
  39. doSendAnimatedText(getThingPos(sid), expg2, 215)
  40. doPlayerAddExp(sid, expg2)
  41. elseif isPlayer(sid) and getPlayerLevel(sid) > 130 and getPlayerLevel(sid) <= 150 then
  42. local expg3 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp3, value)
  43. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg3.." exp.")
  44. doSendAnimatedText(getThingPos(sid), expg3, 215)
  45. doPlayerAddExp(sid, expg3)
  46. elseif isPlayer(sid) and getPlayerLevel(sid) > 150 and getPlayerLevel(sid) <= 200 then
  47. local expg4 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp4, value)
  48. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg4.." exp.")
  49. doSendAnimatedText(getThingPos(sid), expg4, 215)
  50. doPlayerAddExp(sid, expg4)
  51. elseif isPlayer(sid) and getPlayerLevel(sid) > 200 and getPlayerLevel(sid) <= 250 then
  52. local expg5 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp5, value)
  53. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg5.." exp.")
  54. doSendAnimatedText(getThingPos(sid), expg5, 215)
  55. doPlayerAddExp(sid, expg5)
  56. elseif isPlayer(sid) and getPlayerLevel(sid) > 250 and getPlayerLevel(sid) <= 300 then
  57. local expg6 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp6, value)
  58. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg6.." exp.")
  59. doSendAnimatedText(getThingPos(sid), expg6, 215)
  60. doPlayerAddExp(sid, expg6)
  61. elseif isPlayer(sid) and getPlayerLevel(sid) > 300 and getPlayerLevel(sid) <= 450 then
  62. local expg7 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp7, value)
  63. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg7.." exp.")
  64. doSendAnimatedText(getThingPos(sid), expg7, 215)
  65. doPlayerAddExp(sid, expg7)
  66. elseif isPlayer(sid) and getPlayerLevel(sid) > 450 then
  67. local expg8 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp8, value)
  68. doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg8.." exp.")
  69. doSendAnimatedText(getThingPos(sid), expg8, 215)
  70. doPlayerAddExp(sid, expg8)
  71. end
  72. end
  73. end
  74. elseif type == STATSCHANGE_HEALTHGAIN then
  75. return false
  76. end
  77. return true
  78. end
  79. function onCombat(cid, target)
  80. if isMonster(target) and not isSummon(target) and not isPlayer(target) then
  81. registerCreatureEvent(target, "ExpGain")
  82. end
  83. return true
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement