Core/Units: Fixed crash with charm/possess
Port From (https://github.com/TrinityCore/TrinityCore/commit/de8e1a4820ec5b3523209f89e7519e27b53060e2)
This commit is contained in:
@@ -560,7 +560,7 @@ namespace Game.Entities
|
|||||||
charm.SetPvpFlags(GetPvpFlags());
|
charm.SetPvpFlags(GetPvpFlags());
|
||||||
|
|
||||||
Cypher.Assert(charm.GetCharmerGUID().IsEmpty(), $"Unit {charm.GetEntry()} is being charmed, but it already has a charmer {charm.GetCharmerGUID()}");
|
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;
|
charm.m_charmer = this;
|
||||||
|
|
||||||
_isWalkingBeforeCharm = charm.IsWalking();
|
_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()}");
|
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;
|
charm.m_charmer = null;
|
||||||
|
|
||||||
Player player = charm.GetCharmerOrOwnerPlayerOrPlayerItself();
|
Player player = charm.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||||
|
|||||||
Reference in New Issue
Block a user