diff options
| author | megamage <none@none> | 2009-02-23 13:14:04 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-02-23 13:14:04 -0600 |
| commit | 34517a860f018ee8bde34556b83b63a6ff2dd9f2 (patch) | |
| tree | 3be1cf262377045fbb6c2abd42c11cd4d942bcef /src/game/Unit.cpp | |
| parent | e425ba5837427a611f1b5b4856edd35c0e2adef7 (diff) | |
*More fix about move flag.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 8ba170a84f1..a9b300cd943 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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; |
