[Unit::SetCharm] Restore original walking state when removing charm. Fixes mind control + walk bug.
This commit is contained in:
1 parent
a4c115a494
commit
1e2ee2d680
2 files changed
+12
-4
No files matched your search
@@ -9978,7 +9978,8 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
|
||||
sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
|
||||
|
||||
if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
|
||||
m_isWalkingBeforeCharm = charm->IsWalking();
|
||||
if (m_isWalkingBeforeCharm)
|
||||
{
|
||||
charm->SetWalk(false);
|
||||
charm->SendMovementFlagUpdate();
|
||||
@@ -10015,6 +10016,12 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
|
||||
}
|
||||
|
||||
if (charm->IsWalking() != m_isWalkingBeforeCharm)
|
||||
{
|
||||
charm->SetWalk(m_isWalkingBeforeCharm);
|
||||
charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
|
||||
}
|
||||
|
||||
if (charm->GetTypeId() == TYPEID_PLAYER
|
||||
|| !charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_MINION)
|
||||
@@ -14763,11 +14770,11 @@ void Unit::StopMoving()
|
||||
init.Launch();
|
||||
}
|
||||
|
||||
void Unit::SendMovementFlagUpdate()
|
||||
void Unit::SendMovementFlagUpdate(bool self /* = false */)
|
||||
{
|
||||
WorldPacket data;
|
||||
BuildHeartBeatMsg(&data);
|
||||
SendMessageToSet(&data, false);
|
||||
SendMessageToSet(&data, self);
|
||||
}
|
||||
|
||||
bool Unit::IsSitState() const
|
||||
|
||||
Reference in new issue
Block a user