Entities/Unit: Fix an issue where Unit pointers could be left dangling if a channeled Charm was interrupted by a control aura application.
Port From (https://github.com/TrinityCore/TrinityCore/commit/d10554da14fb8371072567f673c9f919cbe6b929)
This commit is contained in:
@@ -7217,7 +7217,11 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
// still affected by some aura that shouldn't allow control, only allow on last such aura to be removed
|
// still affected by some aura that shouldn't allow control, only allow on last such aura to be removed
|
||||||
if (allowMove && target.HasUnitState(UnitState.CantClientControl))
|
if (allowMove && target.HasUnitState(UnitState.CantClientControl))
|
||||||
|
{
|
||||||
|
// this should never happen, otherwise m_unitBeingMoved might be left dangling!
|
||||||
|
Cypher.Assert(GetUnitBeingMoved() == target);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ControlUpdate packet = new();
|
ControlUpdate packet = new();
|
||||||
packet.Guid = target.GetGUID();
|
packet.Guid = target.GetGUID();
|
||||||
|
|||||||
@@ -1043,15 +1043,6 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RemoveFromWorld()
|
|
||||||
{
|
|
||||||
if (!IsInWorld)
|
|
||||||
return;
|
|
||||||
|
|
||||||
RemoveCharmedBy(null);
|
|
||||||
base.RemoveFromWorld();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ForcedUnsummonDelayEvent : BasicEvent
|
public class ForcedUnsummonDelayEvent : BasicEvent
|
||||||
|
|||||||
@@ -1125,12 +1125,14 @@ namespace Game.Entities
|
|||||||
if (HasUnitState(state))
|
if (HasUnitState(state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (state.HasFlag(UnitState.Controlled))
|
||||||
|
CastStop();
|
||||||
|
|
||||||
AddUnitState(state);
|
AddUnitState(state);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case UnitState.Stunned:
|
case UnitState.Stunned:
|
||||||
SetStunned(true);
|
SetStunned(true);
|
||||||
CastStop();
|
|
||||||
break;
|
break;
|
||||||
case UnitState.Root:
|
case UnitState.Root:
|
||||||
if (!HasUnitState(UnitState.Stunned))
|
if (!HasUnitState(UnitState.Stunned))
|
||||||
@@ -1143,7 +1145,6 @@ namespace Game.Entities
|
|||||||
SendMeleeAttackStop();
|
SendMeleeAttackStop();
|
||||||
// SendAutoRepeatCancel ?
|
// SendAutoRepeatCancel ?
|
||||||
SetConfused(true);
|
SetConfused(true);
|
||||||
CastStop();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UnitState.Fleeing:
|
case UnitState.Fleeing:
|
||||||
@@ -1153,7 +1154,6 @@ namespace Game.Entities
|
|||||||
SendMeleeAttackStop();
|
SendMeleeAttackStop();
|
||||||
// SendAutoRepeatCancel ?
|
// SendAutoRepeatCancel ?
|
||||||
SetFeared(true);
|
SetFeared(true);
|
||||||
CastStop();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user