Core/Movement

* Implemented a generic way of sending movement packets depending on who controls the unit (player or server controlled)
* Added possibility to specify extra elements in movement packets (such as speed, extra passenger guid, collision height and similar) without having to add a special element only for these
* Removed Unit::SendMovementFlagUpdate as it was something working only in 3.3.5a and earlier (no serverside HEARTBEAT opcode exists now)
This commit is contained in:
Shauren
2013-04-09 17:24:39 +02:00
parent c34fd8d862
commit 12a828fdbc
30 changed files with 5242 additions and 3153 deletions
+2 -2
View File
@@ -735,7 +735,7 @@ void SmartAI::SetRun(bool run)
void SmartAI::SetFly(bool fly)
{
me->SetDisableGravity(fly);
me->SendMovementFlagUpdate();
me->SendMovementDisableGravity();
}
void SmartAI::SetSwim(bool swim)
@@ -744,7 +744,7 @@ void SmartAI::SetSwim(bool swim)
me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
else
me->RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
me->SendMovementFlagUpdate();
me->SendMovementSwimming();
}
void SmartAI::sGossipHello(Player* player)
+7 -137
View File
@@ -2570,52 +2570,10 @@ bool Creature::SetWalk(bool enable)
if (!Unit::SetWalk(enable))
return false;
ObjectGuid guid = GetGUID();
WorldPacket data;
if (enable)
{
data.Initialize(SMSG_SPLINE_MOVE_SET_WALK_MODE, 9);
data.WriteBit(guid[7]);
data.WriteBit(guid[6]);
data.WriteBit(guid[5]);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[0]);
if (!movespline->Initialized())
return true;
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
}
else
{
data.Initialize(SMSG_SPLINE_MOVE_SET_RUN_MODE, 9);
data.WriteBit(guid[5]);
data.WriteBit(guid[6]);
data.WriteBit(guid[3]);
data.WriteBit(guid[7]);
data.WriteBit(guid[2]);
data.WriteBit(guid[0]);
data.WriteBit(guid[4]);
data.WriteBit(guid[1]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[3]);
}
SendMessageToSet(&data, false);
SendMovementWalkMode();
return true;
}
@@ -2629,52 +2587,7 @@ bool Creature::SetDisableGravity(bool disable, bool packetOnly/*=false*/)
if (!movespline->Initialized())
return true;
ObjectGuid guid = GetGUID();
WorldPacket data;
if (disable)
{
data.Initialize(SMSG_SPLINE_MOVE_GRAVITY_DISABLE, 9);
data.WriteBit(guid[7]);
data.WriteBit(guid[3]);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[5]);
data.WriteBit(guid[1]);
data.WriteBit(guid[0]);
data.WriteBit(guid[6]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[0]);
}
else
{
data.Initialize(SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);
data.WriteBit(guid[5]);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[6]);
data.WriteBit(guid[2]);
data.WriteBit(guid[0]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[5]);
}
SendMessageToSet(&data, false);
SendMovementDisableGravity();
return true;
}
@@ -2692,53 +2605,10 @@ bool Creature::SetHover(bool enable)
if (!movespline->Initialized())
return true;
//! Not always a packet is sent
ObjectGuid guid = GetGUID();
WorldPacket data;
if (enable)
{
data.Initialize(SMSG_SPLINE_MOVE_SET_HOVER, 9);
data.WriteBit(guid[3]);
data.WriteBit(guid[7]);
data.WriteBit(guid[0]);
data.WriteBit(guid[1]);
data.WriteBit(guid[4]);
data.WriteBit(guid[6]);
data.WriteBit(guid[2]);
data.WriteBit(guid[5]);
// If creature hovers using aura, the hover movement opcode is sent from aura handler
if (!HasAuraType(SPELL_AURA_HOVER))
SendMovementHover();
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[6]);
}
else
{
data.Initialize(SMSG_SPLINE_MOVE_UNSET_HOVER, 9);
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteBit(guid[4]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
data.WriteBit(guid[1]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[1]);
}
SendMessageToSet(&data, false);
return true;
}
+11 -245
View File
@@ -79,6 +79,7 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "MovementStructures.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -5097,7 +5098,8 @@ void Player::BuildPlayerRepop()
// convert player body to ghost
SetHealth(1);
SendMovementSetWaterWalking(true);
AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
SendMovementWaterWalking();
if (!GetSession()->isLogingOut())
SetRooted(false);
@@ -5139,7 +5141,8 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
setDeathState(ALIVE);
SendMovementSetWaterWalking(false);
RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
SendMovementWaterWalking();
SetRooted(false);
m_deathTimer = 0;
@@ -26792,256 +26795,19 @@ VoidStorageItem* Player::GetVoidStorageItem(uint64 id, uint8& slot) const
return NULL;
}
void Player::SendMovementSetCanFly(bool apply)
{
ObjectGuid guid = GetGUID();
WorldPacket data;
if (apply)
{
data.Initialize(SMSG_MOVE_SET_CAN_FLY, 1 + 8 + 4);
data.WriteBit(guid[1]);
data.WriteBit(guid[6]);
data.WriteBit(guid[5]);
data.WriteBit(guid[0]);
data.WriteBit(guid[7]);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[3]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[3]);
data << uint32(0); //! movement counter
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[5]);
}
else
{
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 1 + 8 + 4);
data.WriteBit(guid[1]);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[5]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[6]);
data << uint32(0); //! movement counter
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[7]);
}
SendDirectMessage(&data);
}
void Player::SendMovementSetCanTransitionBetweenSwimAndFly(bool apply)
{
WorldPacket data(apply ?
Movement::PacketSender(this, NULL_OPCODE, apply ?
SMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY :
SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY, 12);
data.append(GetPackGUID());
data << uint32(0); //! movement counter
SendDirectMessage(&data);
}
void Player::SendMovementSetHover(bool apply)
{
ObjectGuid guid = GetGUID();
WorldPacket data;
if (apply)
{
data.Initialize(SMSG_MOVE_SET_HOVER, 12);
data.WriteBit(guid[1]);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[3]);
data.WriteBit(guid[0]);
data.WriteBit(guid[5]);
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[7]);
data << uint32(0); // movement counter
}
else
{
data.Initialize(SMSG_MOVE_UNSET_HOVER, 12);
data.WriteBit(guid[4]);
data.WriteBit(guid[6]);
data.WriteBit(guid[3]);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[7]);
data.WriteBit(guid[5]);
data.WriteBit(guid[0]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[0]);
data << uint32(0); // movement counter
}
SendDirectMessage(&data);
}
void Player::SendMovementSetWaterWalking(bool apply)
{
ObjectGuid guid = GetGUID();
WorldPacket data;
if (apply)
{
data.Initialize(SMSG_MOVE_WATER_WALK, 1 + 4 + 8);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.WriteBit(guid[6]);
data.WriteBit(guid[0]);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[2]);
data << uint32(0); //! movement counter
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[6]);
}
else
{
data.Initialize(SMSG_MOVE_LAND_WALK, 1 + 4 + 8);
data.WriteBit(guid[5]);
data.WriteBit(guid[1]);
data.WriteBit(guid[6]);
data.WriteBit(guid[2]);
data.WriteBit(guid[3]);
data.WriteBit(guid[4]);
data.WriteBit(guid[0]);
data.WriteBit(guid[7]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[2]);
data << uint32(0); //! movement counter
}
SendDirectMessage(&data);
}
void Player::SendMovementSetFeatherFall(bool apply)
{
ObjectGuid guid = GetGUID();
WorldPacket data;
if (apply)
{
data.Initialize(SMSG_MOVE_FEATHER_FALL, 1 + 4 + 8);
data.WriteBit(guid[3]);
data.WriteBit(guid[1]);
data.WriteBit(guid[7]);
data.WriteBit(guid[0]);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[5]);
data.WriteBit(guid[6]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[2]);
data << uint32(0); //! movement counter
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[6]);
}
else
{
data.Initialize(SMSG_MOVE_NORMAL_FALL, 1 + 4 + 8);
data << uint32(0); //! movement counter
data.WriteBit(guid[3]);
data.WriteBit(guid[0]);
data.WriteBit(guid[1]);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteBit(guid[4]);
data.WriteBit(guid[6]);
data.WriteBit(guid[2]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[6]);
}
SendDirectMessage(&data);
SMSG_MOVE_UNSET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY).Send();
}
void Player::SendMovementSetCollisionHeight(float height)
{
ObjectGuid guid = GetGUID();
WorldPacket data(SMSG_MOVE_SET_COLLISION_HEIGHT, 2 + 8 + 4 + 4);
data.WriteBits(0, 2);
data.WriteBit(guid[6]);
data.WriteBit(guid[1]);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
data.FlushBits();
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[5]);
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[7]);
data << float(height);
SendDirectMessage(&data);
static MovementStatusElements const heightElement = MSEExtraFloat;
Movement::ExtraMovementStatusElement extra(&heightElement);
extra.Data.floatData = height;
Movement::PacketSender(this, NULL_OPCODE, SMSG_MOVE_SET_COLLISION_HEIGHT, SMSG_MOVE_UPDATE_COLLISION_HEIGHT, &extra).Send();
}
float Player::GetCollisionHeight(bool mounted) const
-4
View File
@@ -2488,11 +2488,7 @@ class Player : public Unit, public GridObject<Player>
/*! These methods send different packets to the client in apply and unapply case.
These methods are only sent to the current unit.
*/
void SendMovementSetCanFly(bool apply);
void SendMovementSetCanTransitionBetweenSwimAndFly(bool apply);
void SendMovementSetHover(bool apply);
void SendMovementSetWaterWalking(bool apply);
void SendMovementSetFeatherFall(bool apply);
void SendMovementSetCollisionHeight(float height);
bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
+79 -489
View File
@@ -8606,7 +8606,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (_isWalkingBeforeCharm)
{
charm->SetWalk(false);
charm->SendMovementFlagUpdate();
charm->SendMovementWalkMode();
}
m_Controlled.insert(charm);
@@ -8644,7 +8644,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (charm->IsWalking() != _isWalkingBeforeCharm)
{
charm->SetWalk(_isWalkingBeforeCharm);
charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
charm->SendMovementWalkMode();
}
if (charm->GetTypeId() == TYPEID_PLAYER
@@ -11168,418 +11168,35 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
propagateSpeedChange();
WorldPacket data;
ObjectGuid guid = GetGUID();
if (!forced)
static Opcodes const moveTypeToOpcode[MAX_MOVE_TYPE][3] =
{
switch (mtype)
{
case MOVE_WALK:
data.Initialize(SMSG_SPLINE_MOVE_SET_WALK_SPEED, 8+4+2+4+4+4+4+4+4+4);
data.WriteBit(guid[0]);
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteBit(guid[3]);
data.WriteBit(guid[5]);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[4]);
data.FlushBits();
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[3]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[5]);
break;
case MOVE_RUN:
data.Initialize(SMSG_SPLINE_MOVE_SET_RUN_SPEED, 1 + 8 + 4);
data.WriteBit(guid[4]);
data.WriteBit(guid[0]);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteBit(guid[6]);
data.WriteBit(guid[3]);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.FlushBits();
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[4]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[1]);
break;
case MOVE_RUN_BACK:
data.Initialize(SMSG_SPLINE_MOVE_SET_RUN_BACK_SPEED, 1 + 8 + 4);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[6]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
data.WriteBit(guid[7]);
data.WriteBit(guid[5]);
data.WriteBit(guid[4]);
data.FlushBits();
data.WriteByteSeq(guid[1]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[7]);
break;
case MOVE_SWIM:
data.Initialize(SMSG_SPLINE_MOVE_SET_SWIM_SPEED, 1 + 8 + 4);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[5]);
data.WriteBit(guid[0]);
data.WriteBit(guid[7]);
data.WriteBit(guid[6]);
data.WriteBit(guid[3]);
data.WriteBit(guid[1]);
data.FlushBits();
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[4]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
break;
case MOVE_SWIM_BACK:
data.Initialize(SMSG_SPLINE_MOVE_SET_SWIM_BACK_SPEED, 1 + 8 + 4);
data.WriteBit(guid[0]);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[6]);
data.WriteBit(guid[4]);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteBit(guid[2]);
data.FlushBits();
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[6]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[2]);
break;
case MOVE_TURN_RATE:
data.Initialize(SMSG_SPLINE_MOVE_SET_TURN_RATE, 1 + 8 + 4);
data.WriteBit(guid[2]);
data.WriteBit(guid[4]);
data.WriteBit(guid[6]);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteBit(guid[0]);
data.FlushBits();
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[0]);
break;
case MOVE_FLIGHT:
data.Initialize(SMSG_SPLINE_MOVE_SET_FLIGHT_SPEED, 1 + 8 + 4);
data.WriteBit(guid[7]);
data.WriteBit(guid[4]);
data.WriteBit(guid[0]);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[6]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.FlushBits();
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[6]);
data << float(GetSpeed(mtype));
break;
case MOVE_FLIGHT_BACK:
data.Initialize(SMSG_SPLINE_MOVE_SET_FLIGHT_BACK_SPEED, 1 + 8 + 4);
data.WriteBit(guid[2]);
data.WriteBit(guid[1]);
data.WriteBit(guid[6]);
data.WriteBit(guid[5]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.FlushBits();
data.WriteByteSeq(guid[5]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[4]);
break;
case MOVE_PITCH_RATE:
data.Initialize(SMSG_SPLINE_MOVE_SET_PITCH_RATE, 1 + 8 + 4);
data.WriteBit(guid[3]);
data.WriteBit(guid[5]);
data.WriteBit(guid[6]);
data.WriteBit(guid[1]);
data.WriteBit(guid[0]);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.WriteBit(guid[2]);
data.FlushBits();
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[2]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[4]);
break;
default:
sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
return;
}
{SMSG_SPLINE_MOVE_SET_WALK_SPEED, SMSG_MOVE_SET_WALK_SPEED, SMSG_MOVE_UPDATE_WALK_SPEED },
{SMSG_SPLINE_MOVE_SET_RUN_SPEED, SMSG_MOVE_SET_RUN_SPEED, SMSG_MOVE_UPDATE_RUN_SPEED },
{SMSG_SPLINE_MOVE_SET_RUN_BACK_SPEED, SMSG_MOVE_SET_RUN_BACK_SPEED, SMSG_MOVE_UPDATE_RUN_BACK_SPEED },
{SMSG_SPLINE_MOVE_SET_SWIM_SPEED, SMSG_MOVE_SET_SWIM_SPEED, SMSG_MOVE_UPDATE_SWIM_SPEED },
{SMSG_SPLINE_MOVE_SET_SWIM_BACK_SPEED, SMSG_MOVE_SET_SWIM_BACK_SPEED, SMSG_MOVE_UPDATE_SWIM_BACK_SPEED },
{SMSG_SPLINE_MOVE_SET_TURN_RATE, SMSG_MOVE_SET_TURN_RATE, SMSG_MOVE_UPDATE_TURN_RATE },
{SMSG_SPLINE_MOVE_SET_FLIGHT_SPEED, SMSG_MOVE_SET_FLIGHT_SPEED, SMSG_MOVE_UPDATE_FLIGHT_SPEED },
{SMSG_SPLINE_MOVE_SET_FLIGHT_BACK_SPEED, SMSG_MOVE_SET_FLIGHT_BACK_SPEED, SMSG_MOVE_UPDATE_FLIGHT_BACK_SPEED},
{SMSG_SPLINE_MOVE_SET_PITCH_RATE, SMSG_MOVE_SET_PITCH_RATE, SMSG_MOVE_UPDATE_PITCH_RATE },
};
SendMessageToSet(&data, true);
}
else
if (GetTypeId() == TYPEID_PLAYER)
{
if (GetTypeId() == TYPEID_PLAYER)
{
// register forced speed changes for WorldSession::HandleForceSpeedChangeAck
// and do it only for real sent packets and use run for run/mounted as client expected
++ToPlayer()->m_forced_speed_changes[mtype];
// register forced speed changes for WorldSession::HandleForceSpeedChangeAck
// and do it only for real sent packets and use run for run/mounted as client expected
++ToPlayer()->m_forced_speed_changes[mtype];
if (!isInCombat())
if (Pet* pet = ToPlayer()->GetPet())
pet->SetSpeed(mtype, m_speed_rate[mtype], forced);
}
switch (mtype)
{
case MOVE_WALK:
data.Initialize(SMSG_MOVE_SET_WALK_SPEED, 1 + 8 + 4 + 4);
data.WriteBit(guid[0]);
data.WriteBit(guid[4]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.WriteBit(guid[3]);
data.WriteBit(guid[1]);
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[5]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[2]);
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
break;
case MOVE_RUN:
data.Initialize(SMSG_MOVE_SET_RUN_SPEED, 1 + 8 + 4 + 4);
data.WriteBit(guid[6]);
data.WriteBit(guid[1]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.WriteBit(guid[7]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
data.WriteBit(guid[4]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[4]);
data << uint32(m_movementCounter++);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[2]);
break;
case MOVE_RUN_BACK:
data.Initialize(SMSG_MOVE_SET_RUN_BACK_SPEED, 1 + 8 + 4 + 4);
data.WriteBit(guid[0]);
data.WriteBit(guid[6]);
data.WriteBit(guid[2]);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[4]);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteByteSeq(guid[5]);
data << uint32(m_movementCounter++);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[6]);
break;
case MOVE_SWIM:
data.Initialize(SMSG_MOVE_SET_SWIM_SPEED, 1 + 8 + 4 + 4);
data.WriteBit(guid[5]);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.WriteBit(guid[3]);
data.WriteBit(guid[2]);
data.WriteBit(guid[0]);
data.WriteBit(guid[1]);
data.WriteBit(guid[6]);
data.WriteByteSeq(guid[0]);
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[2]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[4]);
break;
case MOVE_SWIM_BACK:
data.Initialize(SMSG_MOVE_SET_SWIM_BACK_SPEED, 1 + 8 + 4 + 4);
data.WriteBit(guid[4]);
data.WriteBit(guid[2]);
data.WriteBit(guid[3]);
data.WriteBit(guid[6]);
data.WriteBit(guid[5]);
data.WriteBit(guid[1]);
data.WriteBit(guid[0]);
data.WriteBit(guid[7]);
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[1]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[2]);
break;
case MOVE_TURN_RATE:
data.Initialize(SMSG_MOVE_SET_TURN_RATE, 1 + 8 + 4 + 4);
data.WriteBit(guid[7]);
data.WriteBit(guid[2]);
data.WriteBit(guid[1]);
data.WriteBit(guid[0]);
data.WriteBit(guid[4]);
data.WriteBit(guid[5]);
data.WriteBit(guid[6]);
data.WriteBit(guid[3]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[2]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[0]);
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[4]);
break;
case MOVE_FLIGHT:
data.Initialize(SMSG_MOVE_SET_FLIGHT_SPEED, 1 + 8 + 4 + 4);
data.WriteBit(guid[0]);
data.WriteBit(guid[5]);
data.WriteBit(guid[1]);
data.WriteBit(guid[6]);
data.WriteBit(guid[3]);
data.WriteBit(guid[2]);
data.WriteBit(guid[7]);
data.WriteBit(guid[4]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[5]);
data << float(GetSpeed(mtype));
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[4]);
break;
case MOVE_FLIGHT_BACK:
data.Initialize(SMSG_MOVE_SET_FLIGHT_BACK_SPEED, 1 + 8 + 4 + 4);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[6]);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.WriteBit(guid[3]);
data.WriteBit(guid[0]);
data.WriteBit(guid[5]);
data.WriteByteSeq(guid[3]);
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[6]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[7]);
break;
case MOVE_PITCH_RATE:
data.Initialize(SMSG_MOVE_SET_PITCH_RATE, 1 + 8 + 4 + 4);
data.WriteBit(guid[1]);
data.WriteBit(guid[2]);
data.WriteBit(guid[6]);
data.WriteBit(guid[7]);
data.WriteBit(guid[0]);
data.WriteBit(guid[3]);
data.WriteBit(guid[5]);
data.WriteBit(guid[4]);
data << float(GetSpeed(mtype));
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[0]);
data << uint32(m_movementCounter++);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[5]);
break;
default:
sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
return;
}
SendMessageToSet(&data, true);
if (!isInCombat())
if (Pet* pet = ToPlayer()->GetPet())
pet->SetSpeed(mtype, m_speed_rate[mtype], forced);
}
static MovementStatusElements const speedVal = MSEExtraFloat;
Movement::ExtraMovementStatusElement extra(&speedVal);
extra.Data.floatData = GetSpeed(mtype);
Movement::PacketSender(this, moveTypeToOpcode[mtype][0], moveTypeToOpcode[mtype][1], moveTypeToOpcode[mtype][2], &extra).Send();
}
void Unit::setDeathState(DeathState s)
@@ -13663,13 +13280,6 @@ void Unit::StopMoving()
init.Launch();
}
void Unit::SendMovementFlagUpdate(bool self /* = false */)
{
WorldPacket data;
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, self);
}
bool Unit::IsSitState() const
{
uint8 s = getStandState();
@@ -16440,13 +16050,7 @@ void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool cas
}
}
void Unit::BuildHeartBeatMsg(WorldPacket* data)
{
data->Initialize(MSG_MOVE_HEARTBEAT, 32);
WriteMovementInfo(*data);
}
void Unit::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
void Unit::ReadMovementInfo(WorldPacket& data, MovementInfo* mi, Movement::ExtraMovementStatusElement* extras /*= NULL*/)
{
if (GetTypeId() != TYPEID_PLAYER)
return;
@@ -16460,7 +16064,7 @@ void Unit::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
MovementStatusElements* sequence = GetMovementStatusElementsSequence(data.GetOpcode());
if (sequence == NULL)
{
sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::ReadMovementInfo: No movement sequence found for opcode 0x%04X", uint32(data.GetOpcode()));
sLog->outError(LOG_FILTER_NETWORKIO, "Unit::ReadMovementInfo: No movement sequence found for opcode %s", GetOpcodeNameForLogging(data.GetOpcode()).c_str());
return;
}
@@ -16501,15 +16105,6 @@ void Unit::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
continue;
}
if (element >= MSESpeedWalk &&
element <= MSESpeedPitchRate)
{
/// @TODO: Possibly verify with current speed - but need to keep in mind that core
/// might trigger multiple changes before client has a chance to reply so only check the last value
data.read_skip<float>();
continue;
}
switch (element)
{
case MSEHasMovementFlags:
@@ -16590,7 +16185,7 @@ void Unit::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
break;
case MSETransportOrientation:
if (hasTransportData)
mi->pos.SetOrientation(data.read<float>());
mi->t_pos.SetOrientation(data.read<float>());
break;
case MSETransportSeat:
if (hasTransportData)
@@ -16643,6 +16238,9 @@ void Unit::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
case MSEOneBit:
data.ReadBit();
break;
case MSEExtraElement:
extras->ReadNextElement(data);
break;
default:
ASSERT(false && "Incorrect sequence element detected at ReadMovementInfo");
break;
@@ -16729,7 +16327,7 @@ void Unit::ReadMovementInfo(WorldPacket& data, MovementInfo* mi)
#undef REMOVE_VIOLATING_FLAGS
}
void Unit::WriteMovementInfo(WorldPacket& data)
void Unit::WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusElement* extras /*= NULL*/)
{
Unit const* mover = GetCharmerGUID() ? GetCharmer() : this;
if (Player const* player = ToPlayer())
@@ -16773,7 +16371,7 @@ void Unit::WriteMovementInfo(WorldPacket& data)
MovementStatusElements* sequence = GetMovementStatusElementsSequence(data.GetOpcode());
if (!sequence)
{
sLog->outError(LOG_FILTER_NETWORKIO, "Unit::WriteMovementInfo: No movement sequence found for opcode 0x%04X", uint32(data.GetOpcode()));
sLog->outError(LOG_FILTER_NETWORKIO, "Unit::WriteMovementInfo: No movement sequence found for opcode %s", GetOpcodeNameForLogging(data.GetOpcode()).c_str());
return;
}
@@ -16814,13 +16412,6 @@ void Unit::WriteMovementInfo(WorldPacket& data)
continue;
}
if (element >= MSESpeedWalk &&
element <= MSESpeedPitchRate)
{
data << mover->GetSpeed(UnitMoveType(element - MSESpeedWalk));
continue;
}
switch (element)
{
case MSEHasMovementFlags:
@@ -16956,6 +16547,9 @@ void Unit::WriteMovementInfo(WorldPacket& data)
case MSEOneBit:
data.WriteBit(1);
break;
case MSEExtraElement:
extras->WriteNextElement(data);
break;
default:
ASSERT(false && "Incorrect sequence element detected at ReadMovementInfo");
break;
@@ -16965,7 +16559,7 @@ void Unit::WriteMovementInfo(WorldPacket& data)
void Unit::SendTeleportPacket(Position& pos)
{
// MSG_MOVE_UPDATE_TELEPORT is sent to nearby players to signal the teleport
// SMSG_MOVE_UPDATE_TELEPORT is sent to nearby players to signal the teleport
// MSG_MOVE_TELEPORT is sent to self in order to trigger MSG_MOVE_TELEPORT_ACK and update the position server side
// This oldPos actually contains the destination position if the Unit is a Player.
@@ -16977,7 +16571,7 @@ void Unit::SendTeleportPacket(Position& pos)
ObjectGuid guid = GetGUID();
ObjectGuid transGuid = GetTransGUID();
WorldPacket data(MSG_MOVE_UPDATE_TELEPORT, 38);
WorldPacket data(SMSG_MOVE_UPDATE_TELEPORT, 38);
WriteMovementInfo(data);
if (GetTypeId() == TYPEID_PLAYER)
@@ -17436,63 +17030,59 @@ bool Unit::SetHover(bool enable)
void Unit::SendMovementHover()
{
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendMovementSetHover(HasUnitMovementFlag(MOVEMENTFLAG_HOVER));
WorldPacket data(MSG_MOVE_HOVER, 64);
WriteMovementInfo(data);
SendMessageToSet(&data, false);
if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER))
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_HOVER, SMSG_MOVE_SET_HOVER).Send();
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_UNSET_HOVER, SMSG_MOVE_UNSET_HOVER).Send();
}
void Unit::SendMovementWaterWalking()
{
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendMovementSetWaterWalking(HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING));
WorldPacket data(MSG_MOVE_WATER_WALK, 64);
WriteMovementInfo(data);
SendMessageToSet(&data, false);
if (HasUnitMovementFlag(MOVEMENTFLAG_WATERWALKING))
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_WATER_WALK, SMSG_MOVE_WATER_WALK).Send();
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_LAND_WALK, SMSG_MOVE_LAND_WALK).Send();
}
void Unit::SendMovementFeatherFall()
{
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendMovementSetFeatherFall(HasUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW));
WorldPacket data(MSG_MOVE_FEATHER_FALL, 64);
WriteMovementInfo(data);
SendMessageToSet(&data, false);
}
void Unit::SendMovementGravityChange()
{
WorldPacket data(MSG_MOVE_GRAVITY_CHNG, 64);
WriteMovementInfo(data);
SendMessageToSet(&data, false);
if (HasUnitMovementFlag(MOVEMENTFLAG_FALLING_SLOW))
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_FEATHER_FALL, SMSG_MOVE_FEATHER_FALL).Send();
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_NORMAL_FALL, SMSG_MOVE_NORMAL_FALL).Send();
}
void Unit::SendMovementCanFlyChange()
{
/*!
if ( a3->MoveFlags & MOVEMENTFLAG_CAN_FLY )
{
v4->MoveFlags |= 0x1000000u;
result = 1;
}
else
{
if ( v4->MoveFlags & MOVEMENTFLAG_FLYING )
CMovement::DisableFlying(v4);
v4->MoveFlags &= 0xFEFFFFFFu;
result = 1;
}
*/
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendMovementSetCanFly(CanFly());
if (HasUnitMovementFlag(MOVEMENTFLAG_CAN_FLY))
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_FLYING, SMSG_MOVE_SET_CAN_FLY).Send();
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_UNSET_FLYING, SMSG_MOVE_UNSET_CAN_FLY).Send();
}
WorldPacket data(MSG_MOVE_UPDATE_CAN_FLY, 64);
WriteMovementInfo(data);
SendMessageToSet(&data, false);
void Unit::SendMovementDisableGravity()
{
if (HasUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY))
Movement::PacketSender(this, SMSG_SPLINE_MOVE_GRAVITY_DISABLE, SMSG_MOVE_GRAVITY_DISABLE).Send();
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_GRAVITY_ENABLE, SMSG_MOVE_GRAVITY_ENABLE).Send();
}
void Unit::SendMovementWalkMode()
{
///@ TODO: Find proper opcode for walk mode setting in player mind controlling a player case
if (HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_WALK_MODE, SMSG_SPLINE_MOVE_SET_WALK_MODE).Send();
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_RUN_MODE, SMSG_SPLINE_MOVE_SET_WALK_MODE).Send();
}
void Unit::SendMovementSwimming()
{
if (HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING))
Movement::PacketSender(this, SMSG_SPLINE_MOVE_START_SWIM, NULL_OPCODE).Send();
else
Movement::PacketSender(this, SMSG_SPLINE_MOVE_STOP_SWIM, NULL_OPCODE).Send();
}
bool Unit::IsSplineEnabled() const
+9 -8
View File
@@ -354,6 +354,10 @@ class Vehicle;
class VehicleJoinEvent;
class TransportBase;
class SpellCastTargets;
namespace Movement
{
class ExtraMovementStatusElement;
}
typedef std::list<Unit*> UnitList;
typedef std::list< std::pair<Aura*, uint8> > DispelChargesList;
@@ -1593,9 +1597,6 @@ class Unit : public WorldObject
void JumpTo(WorldObject* obj, float speedZ);
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false);
//void SetFacing(float ori, WorldObject* obj = NULL);
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
void SendMovementFlagUpdate(bool self = false);
/*! These methods send the same packet to the client in apply and unapply case.
The client-side interpretation of this packet depends on the presence of relevant movementflags
@@ -1605,8 +1606,10 @@ class Unit : public WorldObject
void SendMovementHover();
void SendMovementFeatherFall();
void SendMovementWaterWalking();
void SendMovementGravityChange();
void SendMovementCanFlyChange();
void SendMovementDisableGravity();
void SendMovementWalkMode();
void SendMovementSwimming();
bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);}
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);}
@@ -1625,8 +1628,6 @@ class Unit : public WorldObject
void SendClearTarget();
void BuildHeartBeatMsg(WorldPacket* data);
bool isAlive() const { return (m_deathState == ALIVE); }
bool isDying() const { return (m_deathState == JUST_DIED); }
bool isDead() const { return (m_deathState == DEAD || m_deathState == CORPSE); }
@@ -2111,8 +2112,8 @@ class Unit : public WorldObject
void _ExitVehicle(Position const* exitPosition = NULL);
void _EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp = NULL);
void ReadMovementInfo(WorldPacket& data, MovementInfo* mi);
void WriteMovementInfo(WorldPacket& data);
void ReadMovementInfo(WorldPacket& data, MovementInfo* mi, Movement::ExtraMovementStatusElement* extras = NULL);
void WriteMovementInfo(WorldPacket& data, Movement::ExtraMovementStatusElement* extras = NULL);
bool isMoving() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING); }
bool isTurning() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_TURNING); }
@@ -1054,7 +1054,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
pCurrChar->CastSpell(pCurrChar, 20584, true, 0);// auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
pCurrChar->SendMovementSetWaterWalking(true);
pCurrChar->AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
pCurrChar->SendMovementWaterWalking();
}
pCurrChar->ContinueTaxiFlight();
+17 -15
View File
@@ -30,6 +30,7 @@
#include "WaypointMovementGenerator.h"
#include "InstanceSaveMgr.h"
#include "ObjectMgr.h"
#include "MovementStructures.h"
void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket& /*recvPacket*/)
{
@@ -425,28 +426,19 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
uint32 opcode = recvData.GetOpcode();
/* extract packet */
uint64 guid;
uint32 unk1;
float newspeed;
recvData.readPackGUID(guid);
MovementInfo movementInfo;
static MovementStatusElements const speedElement = MSEExtraFloat;
Movement::ExtraMovementStatusElement extras(&speedElement);
GetPlayer()->ReadMovementInfo(recvData, &movementInfo, &extras);
// now can skip not our packet
if (_player->GetGUID() != guid)
if (_player->GetGUID() != movementInfo.guid)
{
recvData.rfinish(); // prevent warnings spam
return;
}
// continue parse packet
recvData >> unk1; // counter or moveEvent
MovementInfo movementInfo;
movementInfo.guid = guid;
GetPlayer()->ReadMovementInfo(recvData, &movementInfo);
recvData >> newspeed;
float newspeed = extras.Data.floatData;
/*----------------*/
// client ACK send one packet for mounted/run case and need skip all except last from its
@@ -615,3 +607,13 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
_player->SummonIfPossible(agree);
}
void WorldSession::HandleSetCollisionHeightAck(WorldPacket& recvPacket)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_SET_COLLISION_HEIGHT_ACK");
static MovementStatusElements const heightElement = MSEExtraFloat;
Movement::ExtraMovementStatusElement extra(&heightElement);
MovementInfo movementInfo;
GetPlayer()->ReadMovementInfo(recvPacket, &movementInfo, &extra);
}
@@ -19,6 +19,7 @@
#include "IdleMovementGenerator.h"
#include "CreatureAI.h"
#include "Creature.h"
#include <G3D/g3dmath.h>
IdleMovementGenerator si_idleMovement;
@@ -44,25 +45,17 @@ void RotateMovementGenerator::Initialize(Unit* owner)
owner->SetInFront(owner->getVictim());
owner->AddUnitState(UNIT_STATE_ROTATING);
owner->AttackStop();
}
bool RotateMovementGenerator::Update(Unit* owner, uint32 diff)
{
float angle = owner->GetOrientation();
if (m_direction == ROTATE_DIRECTION_LEFT)
{
angle += (float)diff * static_cast<float>(M_PI * 2) / m_maxDuration;
while (angle >= static_cast<float>(M_PI * 2)) angle -= static_cast<float>(M_PI * 2);
}
else
{
angle -= (float)diff * static_cast<float>(M_PI * 2) / m_maxDuration;
while (angle < 0) angle += static_cast<float>(M_PI * 2);
}
owner->SetOrientation(angle);
owner->SendMovementFlagUpdate(); // this is a hack. we do not have anything correct to send in the beginning
angle += (float(diff) * static_cast<float>(M_PI * 2) / m_maxDuration) * (m_direction == ROTATE_DIRECTION_LEFT ? 1.0f : -1.0f);
angle = G3D::wrap(angle, 0.0f, float(G3D::twoPi()));
owner->SetOrientation(angle); // UpdateSplinePosition does not set orientation with UNIT_STATE_ROTATING
owner->SetFacingTo(angle); // Send spline movement to clients
if (m_duration > diff)
m_duration -= diff;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -4
View File
@@ -886,12 +886,10 @@ void Map::ScriptsProcess()
if (!targetUnit)
break;
sourceUnit->SetInFront(targetUnit);
sourceUnit->SetFacingToObject(targetUnit);
}
else
sourceUnit->SetOrientation(step.script->Orientation.Orientation);
sourceUnit->SendMovementFlagUpdate();
sourceUnit->SetFacingTo(step.script->Orientation.Orientation);
}
break;
+13 -13
View File
@@ -358,15 +358,15 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(CMSG_MOVE_CHNG_TRANSPORT, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMovementOpcodes );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FALL_RESET, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleMovementOpcodes );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FEATHER_FALL_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleFeatherFallAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_FLIGHT_SPEED_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_PITCH_RATE_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_RUN_BACK_SPEED_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_RUN_SPEED_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_SWIM_BACK_SPEED_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_SWIM_SPEED_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_TURN_RATE_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_FORCE_WALK_SPEED_CHANGE_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleForceSpeedChangeAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_GRAVITY_DISABLE_ACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_GRAVITY_ENABLE_ACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_HOVER_ACK, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleMoveHoverAck );
@@ -375,7 +375,7 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(CMSG_MOVE_SET_CAN_FLY, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_SET_CAN_FLY_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleMoveSetCanFlyAckOpcode );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_SET_CAN_TRANSITION_BETWEEN_SWIM_AND_FLY_ACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_SET_COLLISION_HEIGHT_ACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_SET_COLLISION_HEIGHT_ACK, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleSetCollisionHeightAck );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_SPLINE_DONE, STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMoveSplineDoneOpcode );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_TIME_SKIPPED, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleMoveTimeSkippedOpcode );
DEFINE_OPCODE_HANDLER(CMSG_MOVE_WATER_WALK_ACK, STATUS_UNHANDLED, PROCESS_THREADSAFE, &WorldSession::HandleMoveWaterWalkAck );
@@ -595,9 +595,6 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(MSG_MOVE_TELEPORT_CHEAT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(MSG_MOVE_TIME_SKIPPED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(MSG_MOVE_TOGGLE_COLLISION_CHEAT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(MSG_MOVE_UPDATE_FLIGHT_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(MSG_MOVE_UPDATE_RUN_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(MSG_MOVE_UPDATE_TELEPORT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(MSG_MOVE_WORLDPORT_ACK, STATUS_TRANSFER, PROCESS_THREADUNSAFE, &WorldSession::HandleMoveWorldportAckOpcode );
DEFINE_OPCODE_HANDLER(MSG_NOTIFY_PARTY_SQUELCH, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(MSG_PARTY_ASSIGNMENT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandlePartyAssignmentOpcode );
@@ -1015,11 +1012,14 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UNSET_HOVER, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_COLLISION_HEIGHT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_FLIGHT_BACK_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_FLIGHT_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_KNOCK_BACK, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_PITCH_RATE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_RUN_BACK_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_RUN_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_SWIM_BACK_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_SWIM_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_TELEPORT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_TURN_RATE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_UPDATE_WALK_SPEED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_MOVE_WATER_WALK, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+3 -13
View File
@@ -596,10 +596,7 @@ enum Opcodes
MSG_MINIMAP_PING = 0x6635,
MSG_MOVE_CHARM_TELEPORT_CHEAT = 0x7A08,
MSG_MOVE_FALL_LAND = 0x380A,
MSG_MOVE_FEATHER_FALL = 0x0000,
MSG_MOVE_GRAVITY_CHNG = 0x0000,
MSG_MOVE_HEARTBEAT = 0x3914,
MSG_MOVE_HOVER = 0x0000,
MSG_MOVE_JUMP = 0x7A06,
MSG_MOVE_SET_ALL_SPEED_CHEAT = 0x0000,
MSG_MOVE_SET_COLLISION_HEIGHT = 0x0000,
@@ -639,12 +636,7 @@ enum Opcodes
MSG_MOVE_TOGGLE_COLLISION_CHEAT = 0x7B04,
MSG_MOVE_TOGGLE_FALL_LOGGING = 0x0000,
MSG_MOVE_TOGGLE_LOGGING = 0x0000,
MSG_MOVE_UPDATE_CAN_FLY = 0x0000,
MSG_MOVE_UPDATE_FLIGHT_SPEED = 0x30B1,
MSG_MOVE_UPDATE_MOUSE = 0x0000,
MSG_MOVE_UPDATE_RUN_SPEED = 0x14A6,
MSG_MOVE_UPDATE_TELEPORT = 0x50B2,
MSG_MOVE_WATER_WALK = 0x0000,
MSG_MOVE_WORLDPORT_ACK = 0x2411,
MSG_NOTIFY_PARTY_SQUELCH = 0x4D06,
MSG_PARTY_ASSIGNMENT = 0x0424,
@@ -1065,10 +1057,6 @@ enum Opcodes
SMSG_MOUNTSPECIAL_ANIM = 0x0217,
SMSG_MOVE_COLLISION_DISABLE = 0x31B0,
SMSG_MOVE_COLLISION_ENABLE = 0x11A7,
SMSG_MOVE_DISABLE_COLLISION = 0x0000,
SMSG_MOVE_DISABLE_GRAVITY = 0x0000,
SMSG_MOVE_ENABLE_COLLISION = 0x0000,
SMSG_MOVE_ENABLE_GRAVITY = 0x0000,
SMSG_MOVE_FEATHER_FALL = 0x79B0,
SMSG_MOVE_GRAVITY_DISABLE = 0x75B2,
SMSG_MOVE_GRAVITY_ENABLE = 0x30B3,
@@ -1100,12 +1088,14 @@ enum Opcodes
SMSG_MOVE_UNSET_WALK_IN_AIR = 0x0000,
SMSG_MOVE_UPDATE_COLLISION_HEIGHT = 0x59A3,
SMSG_MOVE_UPDATE_FLIGHT_BACK_SPEED = 0x74A0,
SMSG_MOVE_UPDATE_FLIGHT_SPEED = 0x30B1,
SMSG_MOVE_UPDATE_KNOCK_BACK = 0x3DB2,
SMSG_MOVE_UPDATE_PITCH_RATE = 0x1DB5,
SMSG_MOVE_UPDATE_RUN_BACK_SPEED = 0x3DA6,
SMSG_MOVE_UPDATE_RUN_SPEED = 0x14A6,
SMSG_MOVE_UPDATE_SWIM_BACK_SPEED = 0x30B5,
SMSG_MOVE_UPDATE_SWIM_SPEED = 0x59B5,
SMSG_MOVE_UPDATE_TELEPORT = 0x0000,
SMSG_MOVE_UPDATE_TELEPORT = 0x50B2,
SMSG_MOVE_UPDATE_TURN_RATE = 0x5DA1,
SMSG_MOVE_UPDATE_WALK_SPEED = 0x54A2,
SMSG_MOVE_WATER_WALK = 0x75B1,
+1
View File
@@ -430,6 +430,7 @@ class WorldSession
void HandleMoveTeleportAck(WorldPacket& recvPacket);
void HandleForceSpeedChangeAck(WorldPacket& recvData);
void HandleSetCollisionHeightAck(WorldPacket& recvPacket);
void HandlePingOpcode(WorldPacket& recvPacket);
void HandleAuthSessionOpcode(WorldPacket& recvPacket);
+9 -6
View File
@@ -185,10 +185,11 @@ public:
std::string argstr = (char*)args;
Player* target = handler->GetSession()->GetPlayer();
if (!*args)
{
argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
if (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK))
argstr = (target->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
if (target->GetCommandStatus(CHEAT_WATERWALK))
argstr = "off";
else
argstr = "on";
@@ -196,15 +197,17 @@ public:
if (argstr == "off")
{
handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_WATERWALK);
handler->GetSession()->GetPlayer()->SendMovementSetWaterWalking(false); // OFF
target->SetCommandStatusOff(CHEAT_WATERWALK);
target->RemoveUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
target->SendMovementWaterWalking(); // OFF
handler->SendSysMessage("Waterwalking is OFF. You can't walk on water.");
return true;
}
else if (argstr == "on")
{
handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_WATERWALK);
handler->GetSession()->GetPlayer()->SendMovementSetWaterWalking(true); // ON
target->SetCommandStatusOn(CHEAT_WATERWALK);
target->AddUnitMovementFlag(MOVEMENTFLAG_WATERWALKING);
target->SendMovementWaterWalking(); // ON
handler->SendSysMessage("Waterwalking is ON. You can walk on water.");
return true;
}
+9 -1
View File
@@ -1331,7 +1331,15 @@ public:
target->SetExtraUnitMovementFlags(moveFlagsExtra);
}
target->SendMovementFlagUpdate();
if (target->GetTypeId() != TYPEID_PLAYER)
target->DestroyForNearbyPlayers(); // Force new SMSG_UPDATE_OBJECT:CreateObject
else
{
WorldPacket data(SMSG_PLAYER_MOVE);
target->WriteMovementInfo(data);
target->SendMessageToSet(&data, true);
}
handler->PSendSysMessage(LANG_MOVEFLAGS_SET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags());
}
+8 -2
View File
@@ -103,9 +103,15 @@ public:
WorldPacket data;
if (strncmp(args, "on", 3) == 0)
target->SendMovementSetCanFly(true);
{
target->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
target->SendMovementCanFlyChange();
}
else if (strncmp(args, "off", 4) == 0)
target->SendMovementSetCanFly(false);
{
target->RemoveUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
target->SendMovementCanFlyChange();
}
else
{
handler->SendSysMessage(LANG_USE_BOL);
@@ -1001,10 +1001,7 @@ public:
{
case 1:
if (Unit* car = Unit::GetCreature(*me, carGUID))
{
me->SetInFront(car);
me->SendMovementFlagUpdate();
}
me->SetFacingToObject(car);
Talk(SAY_SCARLET_MINER_0);
SetRun(true);
IntroTimer = 4000;
@@ -1013,8 +1010,7 @@ public:
case 17:
if (Unit* car = Unit::GetCreature(*me, carGUID))
{
me->SetInFront(car);
me->SendMovementFlagUpdate();
me->SetFacingToObject(car);
car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ() + 1);
car->StopMoving();
car->RemoveAura(SPELL_CART_DRAG);
@@ -297,8 +297,7 @@ class npc_harrison_jones : public CreatureScript
if (me->GetCreatureTemplate()->GossipMenuId == sender && !action)
{
player->CLOSE_GOSSIP_MENU();
me->SetInFront(player);
me->SendMovementFlagUpdate(true);
me->SetFacingToObject(player);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Talk(SAY_HARRISON_0);
_gongEvent = GONG_EVENT_1;
@@ -242,8 +242,7 @@ public:
{
case 4:
SetEscortPaused(true);
me->SetOrientation(1.775791f);
me->SendMovementFlagUpdate();
me->SetFacingTo(1.775791f);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Talk(SAY_MORRIDUNE_2);
break;
@@ -479,17 +479,15 @@ public:
switch (uiWaypoint)
{
case 0:
me->SetOrientation(5.81f);
me->SetFacingTo(5.81f);
break;
case 1:
me->SetOrientation(4.60f);
me->SetFacingTo(4.60f);
break;
case 2:
me->SetOrientation(2.79f);
me->SetFacingTo(2.79f);
break;
}
me->SendMovementFlagUpdate();
}
}
@@ -191,10 +191,7 @@ public:
return;
if (uiPointId == 1)
{
me->SetOrientation(ORIENTATION);
me->SendMovementFlagUpdate();
}
me->SetFacingTo(ORIENTATION);
}
void DoSummonGrandChampion(uint32 uiBoss)
@@ -300,8 +300,7 @@ class boss_devourer_of_souls : public CreatureScript
DoCast(me, SPELL_WAILING_SOULS_STARTING);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
me->SetOrientation(me->GetAngle(target));
me->SendMovementFlagUpdate();
me->SetFacingTo(me->GetAngle(target));
DoCast(me, SPELL_WAILING_SOULS_BEAM);
}
@@ -327,8 +326,7 @@ class boss_devourer_of_souls : public CreatureScript
case EVENT_WAILING_SOULS_TICK:
beamAngle += beamAngleDiff;
me->SetOrientation(beamAngle);
me->SendMovementFlagUpdate();
me->SetFacingTo(beamAngle);
me->StopMoving();
DoCast(me, SPELL_WAILING_SOULS);
@@ -205,7 +205,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
minchar->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
minchar->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
minchar->SetCanFly(false);
minchar->SendMovementFlagUpdate();
minchar->RemoveAllAuras();
minchar->GetMotionMaster()->MoveCharge(4629.3711f, 2782.6089f, 401.5301f, SPEED_CHARGE/3.0f);
}
@@ -238,7 +237,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
me->SetDisableGravity(true);
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
me->SetCanFly(true);
me->SendMovementFlagUpdate();
me->GetMotionMaster()->MovePoint(POINT_MINCHAR, mincharPos);
}
}
@@ -318,7 +316,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
me->SetDisableGravity(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
me->SetCanFly(false);
me->SendMovementFlagUpdate();
me->SetReactState(REACT_AGGRESSIVE);
if (Unit* victim = me->SelectVictim())
AttackStart(victim);
@@ -445,7 +442,6 @@ class boss_blood_queen_lana_thel : public CreatureScript
me->SetDisableGravity(true);
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
me->SetCanFly(true);
me->SendMovementFlagUpdate();
me->GetMotionMaster()->MovePoint(POINT_AIR, airPos);
break;
case EVENT_AIR_FLY_DOWN:
@@ -294,7 +294,6 @@ class boss_sapphiron : public CreatureScript
case EVENT_LIFTOFF:
Talk(EMOTE_AIR_PHASE);
me->SetDisableGravity(true);
me->SendMovementFlagUpdate();
events.ScheduleEvent(EVENT_ICEBOLT, 1500);
_iceboltCount = RAID_MODE(2, 3);
return;
@@ -339,7 +338,6 @@ class boss_sapphiron : public CreatureScript
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
Talk(EMOTE_GROUND_PHASE);
me->SetDisableGravity(false);
me->SendMovementFlagUpdate();
events.ScheduleEvent(EVENT_GROUND, 1500);
return;
case EVENT_GROUND:
@@ -325,8 +325,7 @@ public:
break;
case 7:
Talk(SAY_SVALA_INTRO_2);
me->SetOrientation(1.58f);
me->SendMovementFlagUpdate();
me->SetFacingTo(1.58f);
arthas->SetVisible(false);
++introPhase;
introTimer = 13800;
@@ -2358,10 +2358,7 @@ public:
me->StopMoving();
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
{
me->SetInFront(player);
me->SendMovementFlagUpdate();
}
me->SetFacingToObject(player);
uiEventTimer = 3000;
uiEventPhase = 1;
}
@@ -2411,10 +2408,7 @@ public:
case NPC_SALTY_JOHN_THORPE:
Talk(SAY_HIDDEN_CULTIST_4);
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
{
me->SetInFront(player);
me->SendMovementFlagUpdate();
}
me->SetFacingToObject(player);
uiEventTimer = 3000;
uiEventPhase = 3;
break;
@@ -1372,8 +1372,7 @@ public:
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_QUEST_CREDIT, true);
CAST_AI(npc_crusade_recruit::npc_crusade_recruitAI, (creature->AI()))->m_uiPhase = 1;
creature->SetInFront(player);
creature->SendMovementFlagUpdate();
creature->SetFacingToObject(player);
}
return true;
+1 -2
View File
@@ -2293,8 +2293,7 @@ class spell_item_unusual_compass : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
caster->SetOrientation(frand(0.0f, 62832.0f) / 10000.0f);
caster->SendMovementFlagUpdate(true);
caster->SetFacingTo(frand(0.0f, 62832.0f) / 10000.0f);
}
void Register()