*More fix about move flag.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-02-23 13:14:04 -06:00
parent e425ba5837
commit 34517a860f
24 changed files with 73 additions and 49 deletions

View File

@@ -362,10 +362,41 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 MovementFl
transitTime = static_cast<uint32>(dist / speed + 0.5);
}
//float orientation = (float)atan2((double)dy, (double)dx);
SendMonsterMove(x, y, z, 0, MovementFlags, transitTime, player);
SendMonsterMove(x, y, z, transitTime, player);
}
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player)
void Unit::SendMonsterStop()
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
data << GetPositionX() << GetPositionY() << GetPositionZ();
data << getMSTime();
data << uint8(1);
SendMessageToSet(&data, true);
}
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player)
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
data << GetPositionX() << GetPositionY() << GetPositionZ();
data << getMSTime();
data << uint8(0);
data << uint32((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
data << Time; // Time in between points
data << uint32(1); // 1 single waypoint
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
if(player)
player->GetSession()->SendPacket(&data);
else
SendMessageToSet( &data, true );
}
/*void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player)
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
@@ -404,9 +435,9 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
player->GetSession()->SendPacket(&data);
else
SendMessageToSet( &data, true );
}
}*/
void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uint32 MovementFlags)
void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end)
{
uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32);
@@ -418,13 +449,10 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uin
data << GetPositionY();
data << GetPositionZ();
// unknown field - unrelated to orientation
// seems to increment about 1000 for every 1.7 seconds
// for now, we'll just use mstime
data << getMSTime();
data << uint8( 0 );
data << uint32( MovementFlags );
data << uint32((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
data << uint32( traveltime );
data << uint32( pathSize );
data.append( (char*)path.GetNodes(start), pathSize * 4 * 3 );
@@ -11992,7 +12020,7 @@ void Unit::StopMoving()
// Relocate(GetPositionX(), GetPositionY(), z);
Relocate(GetPositionX(), GetPositionY(),GetPositionZ());
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, true, 0);
SendMonsterStop();
// update position and orientation;
WorldPacket data;