Core/Auras: Properly clean up partial charm applications

Port From (https://github.com/TrinityCore/TrinityCore/commit/57d9d16442677201bc7c27729e3f167830b2e495)
This commit is contained in:
hondacrx
2022-05-30 14:15:00 -04:00
parent 0cccf91411
commit ae6c864107
+6
View File
@@ -368,7 +368,13 @@ namespace Game.Entities
// charm is set by aura, and aura effect remove handler was called during apply handler execution
// prevent undefined behaviour
if (aurApp != null && aurApp.GetRemoveMode() != 0)
{
// properly clean up charm changes up to this point to avoid leaving the unit in partially charmed state
SetFaction(_oldFactionId);
GetMotionMaster().InitializeDefault();
charmer.SetCharm(this, false);
return false;
}
// Pets already have a properly initialized CharmInfo, don't overwrite it.
if (type != CharmType.Vehicle && GetCharmInfo() == null)