Fixes aura assert by not removing player when crash from map.
This commit is contained in:
@@ -3393,11 +3393,11 @@ namespace Game.Entities
|
||||
// we want to have all auras removed, so use your brain when linking events
|
||||
for (int counter = 0; !m_appliedAuras.Empty() || !m_ownedAuras.Empty(); counter++)
|
||||
{
|
||||
foreach (var aurAppIter in GetAppliedAuras())
|
||||
_UnapplyAura(aurAppIter, AuraRemoveMode.Default);
|
||||
while (!m_appliedAuras.Empty())
|
||||
_UnapplyAura(m_appliedAuras.First(), AuraRemoveMode.Default);
|
||||
|
||||
foreach (var aurIter in GetOwnedAuras())
|
||||
RemoveOwnedAura(aurIter);
|
||||
while (!m_ownedAuras.Empty())
|
||||
RemoveOwnedAura(m_ownedAuras.First());
|
||||
|
||||
const int maxIteration = 50;
|
||||
// give this loop a few tries, if there are still auras then log as much information as possible
|
||||
|
||||
@@ -517,27 +517,26 @@ namespace Game.Spells
|
||||
// mark all auras as ready to remove
|
||||
foreach (var app in m_applications)
|
||||
{
|
||||
var existing = targets.FirstOrDefault(p => p.Key == app.Value.GetTarget());
|
||||
// not found in current area - remove the aura
|
||||
if (existing.Key == null)
|
||||
if (!targets.TryGetValue(app.Value.GetTarget(), out uint existing))
|
||||
targetsToRemove.Add(app.Value.GetTarget());
|
||||
else
|
||||
{
|
||||
// needs readding - remove now, will be applied in next update cycle
|
||||
// (dbcs do not have auras which apply on same type of targets but have different radius, so this is not really needed)
|
||||
if (!CanBeAppliedOn(existing.Key))
|
||||
if (!CanBeAppliedOn(app.Value.GetTarget()))
|
||||
{
|
||||
targetsToRemove.Add(app.Value.GetTarget());
|
||||
continue;
|
||||
}
|
||||
|
||||
// needs to add/remove effects from application, don't remove from map so it gets updated
|
||||
if (app.Value.GetEffectMask() != existing.Value)
|
||||
if (app.Value.GetEffectMask() != existing)
|
||||
continue;
|
||||
|
||||
// nothing to do - aura already applied
|
||||
// remove from auras to register list
|
||||
targets.Remove(existing.Key);
|
||||
targets.Remove(app.Value.GetTarget());
|
||||
}
|
||||
}
|
||||
// register auras for units
|
||||
|
||||
@@ -236,6 +236,7 @@ namespace Game
|
||||
decrease_session = false;
|
||||
|
||||
m_sessionsByBnetGuid.Remove(old.GetBattlenetAccountGUID(), old);
|
||||
old.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user