From d9c57aaf5812b2f8e2c75f9267d60ce1df78582c Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 24 Feb 2019 22:41:54 +0100 Subject: [PATCH] Core/Units: updated hover handling to 4.3.4 * SetHover now uses SMSG_SET_PLAY_HOVER_ANIM for playing unit hover animations * UpdateObject packets will now use the corresponding bit to make units hover --- src/server/game/Entities/Object/Object.cpp | 6 +++++- src/server/game/Entities/Unit/Unit.cpp | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 6f8e5f8770..64b737671e 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -345,6 +345,10 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const bool hasAIAnimKit = false; bool hasMovementAnimKit = false; bool hasMeleeAnimKit = false; + bool hasHoverAnim = false; + + if (Unit const* unit = ToUnit()) + hasHoverAnim = unit->HasUnitMovementFlag(MOVEMENTFLAG_HOVER); uint32 stopFrameCount = 0; if (GameObject const* go = ToGameObject()) @@ -352,7 +356,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const stopFrameCount = go->GetGOValue()->Transport.StopFrames->size(); // Bit content - data->WriteBit(0); + data->WriteBit(hasHoverAnim); data->WriteBit(0); data->WriteBit(flags & UPDATEFLAG_ROTATION); data->WriteBit(flags & UPDATEFLAG_ANIMKITS); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6c32c58232..5e1d1a854c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14409,10 +14409,15 @@ bool Unit::SetHover(bool enable, bool packetOnly /*= false*/) } } - if (enable) - Movement::PacketSender(this, SMSG_SPLINE_MOVE_SET_HOVER, SMSG_MOVE_SET_HOVER).Send(); + if (GetTypeId() == TYPEID_PLAYER) + { + if (enable) + 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(); + } else - Movement::PacketSender(this, SMSG_SPLINE_MOVE_UNSET_HOVER, SMSG_MOVE_UNSET_HOVER).Send(); + SendSetPlayHoverAnim(enable); return true; }