Advertisement
Guest User

exphitbom

a guest
May 13th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. -- CONFIGURAÇÕES DE EXPERIENCIA --
  2.  
  3. useStages = true -- Usar sistema de Stages , true/false
  4. premiumMultipliqueExp = 2 -- Players Premiums terão exp multiplicada, caso não querer deixe 1.
  5. rateExp = 50 -- Exp caso não for usar stages.
  6.  
  7.  
  8. local stages = { -- ["DELEVEL-ATELEVEL"] = EXP, (OBS: NUNCA REPETIR O MSM NUMERO, SEMPRE COLOCAR UM A MAIS.)
  9. ["1-50"] = 50,
  10. ["51-100"] = 45,
  11. ["101-150"] = 40,
  12. ["151-200"] = 35,
  13. ["201-250"] = 30,
  14. ["251-300"] = 25,
  15. ["351-400"] = 20,
  16. }
  17. ultimateExp = 15 -- exp que vai usar caso o level do player não tiver mais na tabela .
  18.  
  19. -- CONFIGURAÇÕES DA PARTY
  20.  
  21. partyPorcent = 40 -- Quantos Porcento da exp vai para os membros da party
  22. levelBlockParty = 1000 -- Diferença Maxima de Level permitida para membro da party ganhar exp.
  23. expShareRadiusX = 30 -- Distancia maxima permitida no eixo X para membro da party ganhar exp.
  24. expShareRadiusY = 30 -- Distancia maxima permitida no eixo Y para membro da party ganhar exp.
  25. expShareRadiusZ = 1 -- Distancia maxima permitida no eixo Z para membro da party ganhar exp.
  26.  
  27. -- CONFIGURAÇÕES DE RINGS --
  28.  
  29. local rings = { -- [ID DO ANEL] = EXP MULTIPLICADA POR X EXP.
  30. [3048] = 2,
  31. [3049] = 4,
  32. [3050] = 6,
  33. }
  34.  
  35. -- FIM DAS CONFIGURAÇÕES --
  36.  
  37.  
  38. function CalculeExp(monsterhp, exptotal, hit)
  39. hit = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
  40. return hit < 0 and 0 or hit
  41. end
  42.  
  43. function isSummon(uid)
  44. return uid ~= getCreatureMaster(uid) or false
  45. end
  46.  
  47. function onStatsChange(cid, attacker, type, combat, value)
  48. if getCreatureStorage(cid, 50001) ~= 1 then
  49. doCreatureSetStorage(cid, 50002, getMonsterInfo(getCreatureName(cid)).experience * rateExp)
  50. doCreatureSetStorage(cid, 50001, 1)
  51. end
  52. if type == STATSCHANGE_HEALTHLOSS then
  53. if isMonster(cid) then
  54. if isSummon(cid) then
  55. return true
  56. end
  57. if isCreature(attacker) then
  58. local _cid = isSummon(attacker) and getCreatureMaster(attacker) or attacker
  59. if isPlayer(_cid) then
  60. if useStages then
  61. for strstage, experience in pairs(stages) do
  62. tabstage = string.explode(strstage, "-")
  63. if getPlayerLevel(_cid) >= tabstage[1] and getPlayerLevel(_cid) <= tabstage[2] then
  64. ultimateExp = experience
  65. end
  66. end
  67. experienceRate = ultimateExp
  68. else
  69. experienceRate = rateExp
  70. end
  71. local expgain = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * experienceRate, value)
  72. local ringexp = 1
  73. for idring, expring in pairs(rings) do
  74. if getPlayerSlotItem(_cid, 9).itemid == idring then
  75. ringexp = expring
  76. break
  77. end
  78. end
  79. local premiumMultipliqueExp = isPremium(_cid) and premiumMultipliqueExp or 1
  80. expgain = expgain * ringexp * premiumMultipliqueExp
  81. if getCreatureStorage(cid, 50002) > 0 then
  82. if getCreatureStorage(cid, 50002) - expgain < 0 then
  83. expgain = getCreatureStorage(cid, 50002)
  84. end
  85. doCreatureSetStorage(cid, 50002, getCreatureStorage(cid, 50002) - expgain)
  86. local party = false
  87. if isInParty(_cid) then
  88. local partyMembers, expParty = getPartyMembers(getPartyLeader(_cid)), expgain / 100 * partyPorcent
  89. for indice, partyMember in pairs(partyMembers) do
  90. attackerLevel, partyLevel = getPlayerLevel(_cid), getPlayerLevel(partyMember)
  91. attackerPos, partyPos = getThingPos(_cid), getThingPos(partyMember)
  92. x = false
  93. if math.abs(attackerLevel - partyLevel) > levelBlockParty then
  94. x = true
  95. elseif math.abs(attackerPos.x - partyPos.x) > expShareRadiusX then
  96. x = true
  97. elseif math.abs(attackerPos.y - partyPos.y) > expShareRadiusY then
  98. x = true
  99. elseif attackerPos.z ~= partyPos.z then
  100. x = true
  101. elseif _cid == partyMember then
  102. x = true
  103. end
  104. if x then
  105. partyMembers[indice] = nil
  106. end
  107. end
  108. if #partyMembers ~= 0 then
  109. expParty = math.ceil(expgain / 100 * partyPorcent)
  110. expmember = math.ceil(expParty / #partyMembers)
  111. for _, member in pairs(partyMembers) do
  112. if member ~= _cid then
  113. doPlayerSendTextMessage(member, 12, "You received "..expmember.." party exp.")
  114. doPlayerAddExp(member, expmember)
  115. end
  116. end
  117. doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp. (" ..partyPorcent.."% send to party)")
  118. doPlayerAddExp(_cid, expgain - expParty)
  119. party = true
  120. else
  121. party = false
  122. end
  123. end
  124. if not party then
  125. doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp.")
  126. doPlayerAddExp(_cid, expgain)
  127. end
  128. end
  129. end
  130. end
  131. end
  132. end
  133. return true
  134. end
  135.  
  136. function onCombat(cid, target)
  137. if isMonster(target) and not isSummon(target) and not isPlayer(target) then
  138. registerCreatureEvent(target, "ExpGain")
  139. end
  140. return true
  141. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement