mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Movement: converted SMSG_MOVE_KNOCK_BACK to packet class
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "LootMgr.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "MovementGenerator.h"
|
||||
#include "MovementPackets.h"
|
||||
#include "MovementPacketBuilder.h"
|
||||
#include "MovementStructures.h"
|
||||
#include "MoveSpline.h"
|
||||
@@ -12739,38 +12740,13 @@ void Unit::UpdateObjectVisibility(bool forced)
|
||||
|
||||
void Unit::SendMoveKnockBack(Player* player, float speedXY, float speedZ, float vcos, float vsin)
|
||||
{
|
||||
ObjectGuid guid = GetGUID();
|
||||
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (1+8+4+4+4+4+4));
|
||||
data.WriteBit(guid[0]);
|
||||
data.WriteBit(guid[3]);
|
||||
data.WriteBit(guid[6]);
|
||||
data.WriteBit(guid[7]);
|
||||
data.WriteBit(guid[2]);
|
||||
data.WriteBit(guid[5]);
|
||||
data.WriteBit(guid[1]);
|
||||
data.WriteBit(guid[4]);
|
||||
|
||||
data.WriteByteSeq(guid[1]);
|
||||
|
||||
data << float(vsin);
|
||||
data << uint32(0);
|
||||
|
||||
data.WriteByteSeq(guid[6]);
|
||||
data.WriteByteSeq(guid[7]);
|
||||
|
||||
data << float(speedXY);
|
||||
|
||||
data.WriteByteSeq(guid[4]);
|
||||
data.WriteByteSeq(guid[5]);
|
||||
data.WriteByteSeq(guid[3]);
|
||||
|
||||
data << float(speedZ);
|
||||
data << float(vcos);
|
||||
|
||||
data.WriteByteSeq(guid[2]);
|
||||
data.WriteByteSeq(guid[0]);
|
||||
|
||||
player->SendDirectMessage(&data);
|
||||
WorldPackets::Movement::MoveKnockBack moveKnockBack;
|
||||
moveKnockBack.MoverGUID = GetGUID();
|
||||
moveKnockBack.SequenceIndex = m_movementCounter++;
|
||||
moveKnockBack.Speeds.HorzSpeed = speedXY;
|
||||
moveKnockBack.Speeds.VertSpeed = speedZ;
|
||||
moveKnockBack.Direction = Position(vcos, vsin);
|
||||
player->SendDirectMessage(moveKnockBack.Write());
|
||||
}
|
||||
|
||||
void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
|
||||
|
||||
@@ -95,3 +95,37 @@ WorldPacket const* WorldPackets::Movement::MoveSetCollisionHeight::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Movement::MoveKnockBack::Write()
|
||||
{
|
||||
_worldPacket.WriteBit(MoverGUID[0]);
|
||||
_worldPacket.WriteBit(MoverGUID[3]);
|
||||
_worldPacket.WriteBit(MoverGUID[6]);
|
||||
_worldPacket.WriteBit(MoverGUID[7]);
|
||||
_worldPacket.WriteBit(MoverGUID[2]);
|
||||
_worldPacket.WriteBit(MoverGUID[5]);
|
||||
_worldPacket.WriteBit(MoverGUID[1]);
|
||||
_worldPacket.WriteBit(MoverGUID[4]);
|
||||
|
||||
_worldPacket.WriteByteSeq(MoverGUID[1]);
|
||||
|
||||
_worldPacket << float(Direction.Pos.GetPositionY());
|
||||
_worldPacket << int32(SequenceIndex);
|
||||
|
||||
_worldPacket.WriteByteSeq(MoverGUID[6]);
|
||||
_worldPacket.WriteByteSeq(MoverGUID[7]);
|
||||
|
||||
_worldPacket << float(Speeds.HorzSpeed);
|
||||
|
||||
_worldPacket.WriteByteSeq(MoverGUID[4]);
|
||||
_worldPacket.WriteByteSeq(MoverGUID[5]);
|
||||
_worldPacket.WriteByteSeq(MoverGUID[3]);
|
||||
|
||||
_worldPacket << float(Speeds.VertSpeed);
|
||||
_worldPacket << float(Direction.Pos.GetPositionX());
|
||||
|
||||
_worldPacket.WriteByteSeq(MoverGUID[2]);
|
||||
_worldPacket.WriteByteSeq(MoverGUID[0]);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,25 @@ namespace WorldPackets
|
||||
float Height = 1.0f;
|
||||
UpdateCollisionHeightReason Reason = UPDATE_COLLISION_HEIGHT_MOUNT;
|
||||
};
|
||||
|
||||
struct MoveKnockBackSpeeds
|
||||
{
|
||||
float HorzSpeed = 0.0f;
|
||||
float VertSpeed = 0.0f;
|
||||
};
|
||||
|
||||
class MoveKnockBack final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
MoveKnockBack() : ServerPacket(SMSG_MOVE_KNOCK_BACK, 1 + 8 + 4 + 4 + 4 + 4 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid MoverGUID;
|
||||
TaggedPosition<Position::XY> Direction;
|
||||
MoveKnockBackSpeeds Speeds;
|
||||
uint32 SequenceIndex = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user