Core/Movement: Fix players still able to fly on SPELL_AURA_FLY and SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED unapply.
Closes #5731
This commit is contained in:
@@ -25173,3 +25173,21 @@ bool Player::SetHover(bool enable)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::SendMovementSetCanFly(bool apply)
|
||||||
|
{
|
||||||
|
WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12);
|
||||||
|
data.append(GetPackGUID());
|
||||||
|
data << uint32(0); //! movement counter
|
||||||
|
SendDirectMessage(&data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::SendMovementSetCanTransitionBetweenSwimAndFly(bool apply)
|
||||||
|
{
|
||||||
|
WorldPacket data(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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -2483,6 +2483,13 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
|
|
||||||
#pragma region Player Movement
|
#pragma region Player Movement
|
||||||
|
|
||||||
|
|
||||||
|
/*! 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);
|
||||||
|
|
||||||
bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
|
bool CanFly() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY); }
|
||||||
|
|
||||||
//! Return collision height sent to client
|
//! Return collision height sent to client
|
||||||
|
|||||||
@@ -17541,3 +17541,36 @@ void Unit::SendMovementFeatherFall()
|
|||||||
BuildMovementPacket(&data);
|
BuildMovementPacket(&data);
|
||||||
SendMessageToSet(&data, true);
|
SendMessageToSet(&data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::SendMovementGravityChange()
|
||||||
|
{
|
||||||
|
WorldPacket data(MSG_MOVE_GRAVITY_CHNG, 64);
|
||||||
|
data.append(GetPackGUID());
|
||||||
|
BuildMovementPacket(&data);
|
||||||
|
SendMessageToSet(&data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
WorldPacket data(MSG_MOVE_UPDATE_CAN_FLY, 64);
|
||||||
|
data.append(GetPackGUID());
|
||||||
|
BuildMovementPacket(&data);
|
||||||
|
SendMessageToSet(&data, true);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1631,9 +1631,18 @@ class Unit : public WorldObject
|
|||||||
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
|
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
|
||||||
void SendMonsterMoveTransport(Unit* vehicleOwner);
|
void SendMonsterMoveTransport(Unit* vehicleOwner);
|
||||||
void SendMovementFlagUpdate();
|
void SendMovementFlagUpdate();
|
||||||
|
|
||||||
|
/*! 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
|
||||||
|
which are sent with movementinfo. Furthermore, these packets are broadcast to nearby players as well
|
||||||
|
as the current unit.
|
||||||
|
*/
|
||||||
void SendMovementHover();
|
void SendMovementHover();
|
||||||
void SendMovementFeatherFall();
|
void SendMovementFeatherFall();
|
||||||
void SendMovementWaterWalking();
|
void SendMovementWaterWalking();
|
||||||
|
void SendMovementGravityChange();
|
||||||
|
void SendMovementCanFlyChange();
|
||||||
|
|
||||||
bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);}
|
bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);}
|
||||||
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);}
|
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);}
|
||||||
virtual bool SetWalk(bool enable);
|
virtual bool SetWalk(bool enable);
|
||||||
|
|||||||
@@ -2844,21 +2844,14 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target->GetTypeId() == TYPEID_UNIT)
|
//! Not entirely sure if this should be sent for creatures as well, but I don't think so.
|
||||||
target->SetCanFly(apply);
|
target->SetCanFly(apply);
|
||||||
|
Player* player = target->ToPlayer();
|
||||||
|
if (!player)
|
||||||
|
player = target->m_movedPlayer;
|
||||||
|
|
||||||
if (Player* player = target->m_movedPlayer)
|
if (player)
|
||||||
{
|
player->SendMovementCanFlyChange();
|
||||||
// allow flying
|
|
||||||
WorldPacket data;
|
|
||||||
if (apply)
|
|
||||||
data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
|
|
||||||
else
|
|
||||||
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
|
|
||||||
data.append(target->GetPackGUID());
|
|
||||||
data << uint32(0); // movement counter
|
|
||||||
player->SendDirectMessage(&data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
void AuraEffect::HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||||
@@ -3231,25 +3224,22 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
|
|||||||
|
|
||||||
Unit* target = aurApp->GetTarget();
|
Unit* target = aurApp->GetTarget();
|
||||||
|
|
||||||
// Enable Fly mode for flying mounts
|
//! Update ability to fly
|
||||||
if (GetAuraType() == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)
|
if (GetAuraType() == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)
|
||||||
{
|
{
|
||||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||||
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
|
if (mode & AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK && (apply || (!target->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !target->HasAuraType(SPELL_AURA_FLY))))
|
||||||
{
|
{
|
||||||
if (Player* player = target->m_movedPlayer)
|
target->SetCanFly(apply);
|
||||||
{
|
Player* player = target->ToPlayer();
|
||||||
WorldPacket data;
|
if (!player)
|
||||||
if (apply)
|
player = target->m_movedPlayer;
|
||||||
data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12);
|
|
||||||
else
|
if (player)
|
||||||
data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12);
|
player->SendMovementCanFlyChange();
|
||||||
data.append(player->GetPackGUID());
|
|
||||||
data << uint32(0); // unknown
|
|
||||||
player->SendDirectMessage(&data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Someone should clean up these hacks and remove it from this function. It doesn't even belong here.
|
||||||
if (mode & AURA_EFFECT_HANDLE_REAL)
|
if (mode & AURA_EFFECT_HANDLE_REAL)
|
||||||
{
|
{
|
||||||
//Players on flying mounts must be immune to polymorph
|
//Players on flying mounts must be immune to polymorph
|
||||||
|
|||||||
Reference in New Issue
Block a user