From ab4425ad3552d9266b39909898c6094e825a748f Mon Sep 17 00:00:00 2001 From: Olion Date: Thu, 24 Sep 2015 14:10:12 +0300 Subject: [PATCH] Better handling of movement generators when fear/confuse ends for a player. Untested as a fix, but it is an improvement anyway. --- src/game/Object/Unit.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index 1f025c49..8ea8a1cd 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -8570,7 +8570,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); - GetMotionMaster()->MovementExpired(false); + GetMotionMaster()->MovementExpired(GetTypeId() == TYPEID_PLAYER); if (GetTypeId() != TYPEID_PLAYER && IsAlive()) { @@ -8591,7 +8591,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t } if (GetTypeId() == TYPEID_PLAYER) - { ((Player*)this)->SetClientControl(this, !apply); } + { ((Player*)this)->SetClientControl(this, apply ? 0 : 1); } } void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID) @@ -8613,23 +8613,23 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID) { RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); - GetMotionMaster()->MovementExpired(false); + GetMotionMaster()->MovementExpired(GetTypeId() == TYPEID_PLAYER); if (GetTypeId() != TYPEID_PLAYER && IsAlive()) { - // restore appropriate movement generator - if (getVictim()) - { - SetTargetGuid(getVictim()->GetObjectGuid()); - GetMotionMaster()->MoveChase(getVictim()); - } - else - { GetMotionMaster()->Initialize(); } + // restore appropriate movement generator + if (getVictim()) + { + SetTargetGuid(getVictim()->GetObjectGuid()); + GetMotionMaster()->MoveChase(getVictim()); + } + else + { GetMotionMaster()->Initialize(); } } } if (GetTypeId() == TYPEID_PLAYER) - { ((Player*)this)->SetClientControl(this, !apply); } + { ((Player*)this)->SetClientControl(this, apply ? 0 : 1); } } void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid /*= ObjectGuid()*/)