Какие есть? (режимы)
Код:
enum AuraRemoveMode
{
AURA_REMOVE_BY_DEFAULT,
AURA_REMOVE_BY_STACK, // at replace by similar aura
AURA_REMOVE_BY_CANCEL,
AURA_REMOVE_BY_DISPEL,
AURA_REMOVE_BY_DEATH,
AURA_REMOVE_BY_DELETE, // use for speedup and prevent unexpected effects at player logout/pet unsummon (must be used _only_ after save), delete.
};
вот тут прочитать можно кое что про "что делает", пройдитесь по коду, там вроде нормально прокомментировано:
Код:
void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
{
Aura* Aur = i->second;
SpellEntry const* AurSpellInfo = Aur->GetSpellProto();
Aur->UnregisterSingleCastAura();
// remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)
if (Aur->GetModifier()->m_auraname < TOTAL_AURAS)
{
m_modAuras[Aur->GetModifier()->m_auraname].remove(Aur);
}
// Set remove mode
Aur->SetRemoveMode(mode);
// if unit currently update aura list then make safe update iterator shift to next
if (m_AurasUpdateIterator == i)
++m_AurasUpdateIterator;
// some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura
// remove aura from list before to prevent deleting it before
m_Auras.erase(i);
// now aura removed from from list and can't be deleted by indirect call but can be referenced from callers
// Statue unsummoned at aura remove
Totem* statue = NULL;
if(IsChanneledSpell(AurSpellInfo))
if(Unit* caster = Aur->GetCaster())
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
statue = ((Totem*)caster);
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
if (mode != AURA_REMOVE_BY_DELETE) // not unapply if target will deleted
Aur->ApplyModifier(false,true);
if (Aur->_RemoveAura())
{
// last aura in stack removed
if (mode != AURA_REMOVE_BY_DELETE && IsSpellLastAuraEffect(Aur->GetSpellProto(),Aur->GetEffIndex()))
Aur->HandleSpellSpecificBoosts(false);
}
// If aura in use (removed from code that plan access to it data after return)
// store it in aura list with delayed deletion
if (Aur->IsInUse())
m_deletedAuras.push_back(Aur);
else
delete Aur;
if(statue)
statue->UnSummon();
// only way correctly remove all auras from list
if( m_Auras.empty() )
i = m_Auras.end();
else
i = m_Auras.begin();
}