[8665] Correctly implement XP bonus auras.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2009-10-18 11:33:49 +02:00
parent c0ffd1b48c
commit ec10a5bf3c
4 changed files with 39 additions and 28 deletions

View file

@ -2357,10 +2357,21 @@ void Player::GiveXP(uint32 xp, Unit* victim)
if(level >= sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
return;
// handle SPELL_AURA_MOD_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_PCT);
for(Unit::AuraList::const_iterator i = ModXPPctAuras.begin();i != ModXPPctAuras.end(); ++i)
xp = uint32(xp*(1.0f + (*i)->GetModifier()->m_amount / 100.0f));
if(victim)
{
// handle SPELL_AURA_MOD_KILL_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_KILL_XP_PCT);
for(Unit::AuraList::const_iterator i = ModXPPctAuras.begin();i != ModXPPctAuras.end(); ++i)
xp = uint32(xp*(1.0f + (*i)->GetModifier()->m_amount / 100.0f));
}
else
{
// handle SPELL_AURA_MOD_QUEST_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_QUEST_XP_PCT);
for(Unit::AuraList::const_iterator i = ModXPPctAuras.begin();i != ModXPPctAuras.end(); ++i)
xp = uint32(xp*(1.0f + (*i)->GetModifier()->m_amount / 100.0f));
}
// XP resting bonus for kill
uint32 rested_bonus_xp = victim ? GetXPRestBonus(xp) : 0;