Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rateExp = 50 -- 0 a 50
- rateExp1 = 30 -- 50 a 100
- rateExp2 = 10 -- 100 a 130
- rateExp3 = 5 -- 151 a 200
- rateExp4 = 3 -- 201 a 250
- rateExp5 = 2 -- 251 a 300
- rateExp6 = 1.5 -- 301 a 400
- rateExp7 = 1 -- 401 a 450
- rateExp8 = 0.5 -- 451
- bonus = 1.5 -- Bonus por estar com exp ring
- expringid = 148 -- Id do exp ring
- ------------------------------
- function CalculeExp(monsterhp, exptotal, hit)
- local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
- local x2 = x - 20 + math.random(20)
- return x2 > 0 and x2 or 0
- end
- function isSummon(uid)
- return uid ~= getCreatureMaster(uid) or false
- end
- function onStatsChange(cid, attacker, type, combat, value)
- if type == STATSCHANGE_HEALTHLOSS then
- if isMonster(cid) then
- if isCreature(attacker) then
- local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker
- if isPlayer(sid) and getPlayerLevel(sid) <= 50 then
- local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." exp.")
- doSendAnimatedText(getThingPos(sid), expg, 215)
- doPlayerAddExp(sid, expg)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 50 and getPlayerLevel(sid) <= 100 then
- local expg1 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp1, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg1.." exp.")
- doSendAnimatedText(getThingPos(sid), expg1, 215)
- doPlayerAddExp(sid, expg1)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 100 and getPlayerLevel(sid) <= 130 then
- local expg2 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp2, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg2.." exp.")
- doSendAnimatedText(getThingPos(sid), expg2, 215)
- doPlayerAddExp(sid, expg2)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 130 and getPlayerLevel(sid) <= 150 then
- local expg3 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp3, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg3.." exp.")
- doSendAnimatedText(getThingPos(sid), expg3, 215)
- doPlayerAddExp(sid, expg3)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 150 and getPlayerLevel(sid) <= 200 then
- local expg4 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp4, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg4.." exp.")
- doSendAnimatedText(getThingPos(sid), expg4, 215)
- doPlayerAddExp(sid, expg4)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 200 and getPlayerLevel(sid) <= 250 then
- local expg5 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp5, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg5.." exp.")
- doSendAnimatedText(getThingPos(sid), expg5, 215)
- doPlayerAddExp(sid, expg5)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 250 and getPlayerLevel(sid) <= 300 then
- local expg6 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp6, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg6.." exp.")
- doSendAnimatedText(getThingPos(sid), expg6, 215)
- doPlayerAddExp(sid, expg6)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 300 and getPlayerLevel(sid) <= 450 then
- local expg7 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp7, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg7.." exp.")
- doSendAnimatedText(getThingPos(sid), expg7, 215)
- doPlayerAddExp(sid, expg7)
- elseif isPlayer(sid) and getPlayerLevel(sid) > 450 then
- local expg8 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp8, value)
- doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg8.." exp.")
- doSendAnimatedText(getThingPos(sid), expg8, 215)
- doPlayerAddExp(sid, expg8)
- end
- end
- end
- elseif type == STATSCHANGE_HEALTHGAIN then
- return false
- end
- return true
- end
- function onCombat(cid, target)
- if isMonster(target) and not isSummon(target) and not isPlayer(target) then
- registerCreatureEvent(target, "ExpGain")
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement