Fixes aura assert by not removing player when crash from map.

This commit is contained in:
hondacrx
2022-08-01 11:32:31 -04:00
parent bd3dfeb637
commit 8caa99803f
3 changed files with 9 additions and 9 deletions
+4 -4
View File
@@ -3393,11 +3393,11 @@ namespace Game.Entities
// we want to have all auras removed, so use your brain when linking events // 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++) for (int counter = 0; !m_appliedAuras.Empty() || !m_ownedAuras.Empty(); counter++)
{ {
foreach (var aurAppIter in GetAppliedAuras()) while (!m_appliedAuras.Empty())
_UnapplyAura(aurAppIter, AuraRemoveMode.Default); _UnapplyAura(m_appliedAuras.First(), AuraRemoveMode.Default);
foreach (var aurIter in GetOwnedAuras()) while (!m_ownedAuras.Empty())
RemoveOwnedAura(aurIter); RemoveOwnedAura(m_ownedAuras.First());
const int maxIteration = 50; const int maxIteration = 50;
// give this loop a few tries, if there are still auras then log as much information as possible // give this loop a few tries, if there are still auras then log as much information as possible
+4 -5
View File
@@ -517,27 +517,26 @@ namespace Game.Spells
// mark all auras as ready to remove // mark all auras as ready to remove
foreach (var app in m_applications) foreach (var app in m_applications)
{ {
var existing = targets.FirstOrDefault(p => p.Key == app.Value.GetTarget());
// not found in current area - remove the aura // 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()); targetsToRemove.Add(app.Value.GetTarget());
else else
{ {
// needs readding - remove now, will be applied in next update cycle // 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) // (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()); targetsToRemove.Add(app.Value.GetTarget());
continue; continue;
} }
// needs to add/remove effects from application, don't remove from map so it gets updated // 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; continue;
// nothing to do - aura already applied // nothing to do - aura already applied
// remove from auras to register list // remove from auras to register list
targets.Remove(existing.Key); targets.Remove(app.Value.GetTarget());
} }
} }
// register auras for units // register auras for units
+1
View File
@@ -236,6 +236,7 @@ namespace Game
decrease_session = false; decrease_session = false;
m_sessionsByBnetGuid.Remove(old.GetBattlenetAccountGUID(), old); m_sessionsByBnetGuid.Remove(old.GetBattlenetAccountGUID(), old);
old.Dispose();
} }
} }