mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-20 23:01:36 -04:00
*Use one dynobj to handle multiple aura effects.
--HG-- branch : trunk
This commit is contained in:
+6
-25
@@ -4109,6 +4109,10 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
||||
|
||||
++m_removedAurasCount;
|
||||
|
||||
if(Aur->IsPersistent())
|
||||
if(DynamicObject *dynObj = ObjectAccessor::GetObjectInWorld(Aur->GetSourceGUID(), (DynamicObject*)NULL))
|
||||
dynObj->RemoveAffected(this);
|
||||
|
||||
Aur->UnregisterSingleCastAura();
|
||||
|
||||
if(Aur->GetSpellProto()->AuraInterruptFlags)
|
||||
@@ -4428,24 +4432,6 @@ void Unit::RemoveAllDynObjects()
|
||||
}
|
||||
}
|
||||
|
||||
DynamicObject * Unit::GetDynObject(uint32 spellId, uint32 effIndex)
|
||||
{
|
||||
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
||||
{
|
||||
DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
|
||||
if(!dynObj)
|
||||
{
|
||||
i = m_dynObjGUIDs.erase(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dynObj->GetSpellId() == spellId && dynObj->GetEffIndex() == effIndex)
|
||||
return dynObj;
|
||||
++i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DynamicObject * Unit::GetDynObject(uint32 spellId)
|
||||
{
|
||||
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
|
||||
@@ -14489,17 +14475,12 @@ void Unit::HandleAuraEffect(AuraEffect * aureff, bool apply)
|
||||
{
|
||||
if (!aureff->IsApplied())
|
||||
return;
|
||||
|
||||
aureff->SetApplied(false);
|
||||
// remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)
|
||||
m_modAuras[aureff->GetAuraName()].remove(aureff);
|
||||
aureff->ApplyModifier(false, true);
|
||||
Unit * caster = aureff->GetParentAura()->GetCaster();
|
||||
if(caster && aureff->IsPersistent())
|
||||
{
|
||||
DynamicObject *dynObj = caster->GetDynObject(aureff->GetId(), aureff->GetEffIndex());
|
||||
if (dynObj)
|
||||
dynObj->RemoveAffected(this);
|
||||
}
|
||||
|
||||
// Remove all triggered by aura spells vs unlimited duration
|
||||
aureff->CleanupTriggeredSpells();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user