[10829] Update SpellFamily check functions.

* Move SPELLFAMILY_* to DBCEnums.h and name it as SpellFamily
* Use enum in Unit::GetAura, move family mask code to new SpellEntry helper function.
* Avoid all auras scan in search of triggred spell for 20243.
This commit is contained in:
VladimirMangos 2010-12-06 08:36:01 +03:00
parent 695a64d42b
commit b6ea36192e
8 changed files with 52 additions and 54 deletions

View file

@ -4896,19 +4896,14 @@ Aura* Unit::GetAura(uint32 spellId, SpellEffectIndex effindex)
return NULL;
}
Aura* Unit::GetAura(AuraType type, uint32 family, uint64 familyFlag, uint32 familyFlag2, uint64 casterGUID)
Aura* Unit::GetAura(AuraType type, SpellFamily family, uint64 familyFlag, uint32 familyFlag2, ObjectGuid casterGuid)
{
AuraList const& auras = GetAurasByType(type);
for(AuraList::const_iterator i = auras.begin();i != auras.end(); ++i)
{
SpellEntry const *spell = (*i)->GetSpellProto();
if (spell->SpellFamilyName == family && (spell->SpellFamilyFlags & familyFlag || spell->SpellFamilyFlags2 & familyFlag2))
{
if (casterGUID && (*i)->GetCasterGUID()!=casterGUID)
continue;
return (*i);
}
}
if ((*i)->GetSpellProto()->IsFitToFamily(family, familyFlag, familyFlag2) &&
(casterGuid.IsEmpty() || (*i)->GetCasterGuid() == casterGuid))
return *i;
return NULL;
}