[10620] Fixed MSG_MOVE_HEARTBEAT structure.

Thx Wojta for pointing.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
zerg 2010-10-19 00:38:43 +04:00 committed by VladimirMangos
parent 811a86baf5
commit 3c6d5e985f
4 changed files with 14 additions and 31 deletions

View file

@ -70,14 +70,12 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
owner.AddSplineFlag(SPLINEFLAG_WALKMODE); owner.AddSplineFlag(SPLINEFLAG_WALKMODE);
// restore orientation of not moving creature at returning to home // restore orientation of not moving creature at returning to home
if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE) if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE)
{ {
if(CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow())) if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow()))
{ {
owner.SetOrientation(data->orientation); owner.SetOrientation(data->orientation);
WorldPacket packet; owner.SendHeartBeat(false);
owner.BuildHeartBeatMsg(&packet);
owner.SendMessageToSet(&packet, false);
} }
} }

View file

@ -432,22 +432,12 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTim
SendMonsterMove(x, y, z, SPLINETYPE_NORMAL, flags, transitTime, player); SendMonsterMove(x, y, z, SPLINETYPE_NORMAL, flags, transitTime, player);
} }
void Unit::BuildHeartBeatMsg(WorldPacket *data) const void Unit::SendHeartBeat(bool toSelf)
{ {
MovementFlags move_flags = GetTypeId()==TYPEID_PLAYER WorldPacket data(MSG_MOVE_HEARTBEAT, 64);
? ((Player const*)this)->m_movementInfo.GetMovementFlags() data << GetPackGUID();
: MOVEFLAG_NONE; data << m_movementInfo;
SendMessageToSet(&data, toSelf);
data->Initialize(MSG_MOVE_HEARTBEAT, 32);
*data << GetPackGUID();
*data << uint32(move_flags); // movement flags
*data << uint16(0); // 2.3.0
*data << uint32(getMSTime()); // time
*data << float(GetPositionX());
*data << float(GetPositionY());
*data << float(GetPositionZ());
*data << float(GetOrientation());
*data << uint32(0);
} }
void Unit::resetAttackTimer(WeaponAttackType type) void Unit::resetAttackTimer(WeaponAttackType type)
@ -3694,9 +3684,7 @@ void Unit::SetFacingTo(float ori, bool bToSelf /*= false*/)
SetOrientation(ori); SetOrientation(ori);
// and client // and client
WorldPacket data; SendHeartBeat(bToSelf);
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, bToSelf);
} }
// Consider move this to Creature:: since only creature appear to be able to use this // Consider move this to Creature:: since only creature appear to be able to use this
@ -9822,9 +9810,7 @@ void Unit::StopMoving()
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), SPLINETYPE_STOP, GetTypeId() == TYPEID_PLAYER ? SPLINEFLAG_WALKMODE : SPLINEFLAG_NONE, 0); SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), SPLINETYPE_STOP, GetTypeId() == TYPEID_PLAYER ? SPLINEFLAG_WALKMODE : SPLINEFLAG_NONE, 0);
// update position and orientation for near players // update position and orientation for near players
WorldPacket data; SendHeartBeat(false);
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, false);
} }
void Unit::SetFeared(bool apply, uint64 const& casterGUID, uint32 spellID, uint32 time) void Unit::SetFeared(bool apply, uint64 const& casterGUID, uint32 spellID, uint32 time)
@ -10398,9 +10384,8 @@ void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool ca
GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation); GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
WorldPacket data; SendHeartBeat(false);
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, false);
// finished relocation, movegen can different from top before creature relocation, // finished relocation, movegen can different from top before creature relocation,
// but apply Reset expected to be safe in any case // but apply Reset expected to be safe in any case
if (!c->GetMotionMaster()->empty()) if (!c->GetMotionMaster()->empty())

View file

@ -1464,7 +1464,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void SendThreatRemove(HostileReference* pHostileReference); void SendThreatRemove(HostileReference* pHostileReference);
void SendThreatUpdate(); void SendThreatUpdate();
void BuildHeartBeatMsg( WorldPacket *data ) const; void SendHeartBeat(bool toSelf);
virtual void MoveOutOfRange(Player &) { }; virtual void MoveOutOfRange(Player &) { };

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10619" #define REVISION_NR "10620"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__