Core/Entities: Replace existing GetAuraEffectsByType + iteration uses with proper helper functions

(cherry picked from commit 3a52ad8d38)
This commit is contained in:
ariel-
2016-12-13 02:06:07 -03:00
committed by DoctorKraft
parent edc68f719c
commit f20e53c138
8 changed files with 116 additions and 205 deletions
+8 -8
View File
@@ -707,17 +707,17 @@ void Player::UpdateExpertise(WeaponAttackType attack)
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
Item* weapon = GetWeaponForAttack(attack, true);
AuraEffectList const& expAuras = GetAuraEffectsByType(SPELL_AURA_MOD_EXPERTISE);
for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
expertise += GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE, [weapon](AuraEffect const* aurEff) -> bool
{
// item neutral spell
if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
expertise += (*itr)->GetAmount();
if (aurEff->GetSpellInfo()->EquippedItemClass == -1)
return true;
// item dependent spell
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
expertise += (*itr)->GetAmount();
}
else if (weapon && weapon->IsFitToSpellRequirements(aurEff->GetSpellInfo()))
return true;
return false;
});
if (expertise < 0)
expertise = 0;