Core/Units: Fixed crash with charm/possess

Port From (https://github.com/TrinityCore/TrinityCore/commit/de8e1a4820ec5b3523209f89e7519e27b53060e2)
This commit is contained in:
hondacrx
2021-11-23 21:22:57 -05:00
parent 73aa366f31
commit 044359a6b7
+2 -2
View File
@@ -560,7 +560,7 @@ namespace Game.Entities
charm.SetPvpFlags(GetPvpFlags());
Cypher.Assert(charm.GetCharmerGUID().IsEmpty(), $"Unit {charm.GetEntry()} is being charmed, but it already has a charmer {charm.GetCharmerGUID()}");
charm.SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CharmedBy), GetGUID());
charm.SetUpdateFieldValue(charm.m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CharmedBy), GetGUID());
charm.m_charmer = this;
_isWalkingBeforeCharm = charm.IsWalking();
@@ -582,7 +582,7 @@ namespace Game.Entities
}
Cypher.Assert(charm.GetCharmerGUID() == GetGUID(), $"Unit {charm.GetEntry()} is being uncharmed, but it has another charmer {charm.GetCharmerGUID()}");
charm.SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CharmedBy), ObjectGuid.Empty);
charm.SetUpdateFieldValue(charm.m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CharmedBy), ObjectGuid.Empty);
charm.m_charmer = null;
Player player = charm.GetCharmerOrOwnerPlayerOrPlayerItself();