diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-16 17:11:07 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-08-16 17:11:07 +0200 |
commit | dee50239be8fff566b3ca687bc70900b391a8164 (patch) | |
tree | 6ff6ae2e8e2ea5109d031be8c588f4b8f38f68eb /src/Packet.hpp | |
parent | 2017-08-12 (diff) | |
download | AltCraft-dee50239be8fff566b3ca687bc70900b391a8164.tar AltCraft-dee50239be8fff566b3ca687bc70900b391a8164.tar.gz AltCraft-dee50239be8fff566b3ca687bc70900b391a8164.tar.bz2 AltCraft-dee50239be8fff566b3ca687bc70900b391a8164.tar.lz AltCraft-dee50239be8fff566b3ca687bc70900b391a8164.tar.xz AltCraft-dee50239be8fff566b3ca687bc70900b391a8164.tar.zst AltCraft-dee50239be8fff566b3ca687bc70900b391a8164.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Packet.hpp | 200 |
1 files changed, 199 insertions, 1 deletions
diff --git a/src/Packet.hpp b/src/Packet.hpp index f48088d..c499720 100644 --- a/src/Packet.hpp +++ b/src/Packet.hpp @@ -9,7 +9,7 @@ enum PacketNameLoginSB { EncryptionResponse = 0x01, }; enum PacketNamePlaySB { - TeleportConfirm, + TeleportConfirm = 0x00, PrepareCraftingGrid, TabCompleteSB, ChatMessageSB, @@ -553,4 +553,202 @@ struct PacketSpawnObject : Packet { short VelocityX; short VelocityY; short VelocityZ; +}; + +struct PacketEntityRelativeMove : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + EntityId = stream->ReadVarInt(); + DeltaX = stream->ReadShort(); + DeltaY = stream->ReadShort(); + DeltaZ = stream->ReadShort(); + OnGround = stream->ReadBool(); + } + + int GetPacketId() override { + return PacketNamePlayCB::EntityRelativeMove; + } + + int EntityId; + short DeltaX, DeltaY, DeltaZ; + bool OnGround; +}; + +struct PacketEntityLookAndRelativeMove : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + EntityId = stream->ReadVarInt(); + DeltaX = stream->ReadShort(); + DeltaY = stream->ReadShort(); + DeltaZ = stream->ReadShort(); + return; + //TODO: WTF? + Yaw = stream->ReadAngle(); + Pitch = stream->ReadAngle(); + OnGround = stream->ReadBool(); + } + + int GetPacketId() override { + return PacketNamePlayCB::EntityLookAndRelativeMove; + } + + int EntityId; + short DeltaX, DeltaY, DeltaZ; + unsigned char Yaw, Pitch; + bool OnGround; +}; + +struct PacketEntityLook : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + EntityId = stream->ReadVarInt(); + Yaw = stream->ReadAngle(); + Pitch = stream->ReadAngle(); + OnGround = stream->ReadBool(); + } + + int GetPacketId() override { + return PacketNamePlayCB::EntityLook; + } + + int EntityId; + unsigned char Yaw, Pitch; + bool OnGround; +}; + +struct PacketEntityVelocity : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + EntityId = stream->ReadVarInt(); + VelocityX = stream->ReadShort(); + VelocityY = stream->ReadShort(); + VelocityZ = stream->ReadShort(); + } + + int GetPacketId() override { + return PacketNamePlayCB::EntityVelocity; + } + + int EntityId; + short VelocityX; + short VelocityY; + short VelocityZ; +}; + +struct PacketEntityTeleport : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + EntityId = stream->ReadVarInt(); + X = stream->ReadDouble(); + Y = stream->ReadDouble(); + Z = stream->ReadDouble(); + Yaw = stream->ReadAngle(); + Pitch = stream->ReadAngle(); + OnGround = stream->ReadBool(); + } + + int GetPacketId() override { + return PacketNamePlayCB::EntityTeleport; + } + + int EntityId; + double X, Y, Z; + unsigned char Yaw, Pitch; + bool OnGround; +}; + +struct PacketSpawnPlayer : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + EntityId = stream->ReadVarInt(); + PlayerUuid = stream->ReadUuid(); + X = stream->ReadDouble(); + Y = stream->ReadDouble(); + Z = stream->ReadDouble(); + Yaw = stream->ReadAngle(); + Pitch = stream->ReadAngle(); + } + + int GetPacketId() override { + return PacketNamePlayCB::SpawnPlayer; + } + + int EntityId; + Uuid PlayerUuid; + double X, Y, Z; + unsigned char Yaw, Pitch; + + +}; + +struct PacketDestroyEntities : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + int count = stream->ReadVarInt(); + EntityIds.reserve(count); + for (int i = 0; i < count; i++) { + int entityId = stream->ReadVarInt(); + EntityIds.push_back(entityId); + } + } + + int GetPacketId() override { + return PacketNamePlayCB::DestroyEntities; + } + + std::vector <unsigned int> EntityIds; +}; + +struct PacketSpawnMob : Packet { + void ToStream(StreamOutput *stream) override { + + } + + void FromStream(StreamInput *stream) override { + EntityId = stream->ReadVarInt(); + EntityUuid = stream->ReadUuid(); + type = stream->ReadVarInt(); + X = stream->ReadDouble(); + Y = stream->ReadDouble(); + Z = stream->ReadDouble(); + Yaw = stream->ReadAngle(); + Pitch = stream->ReadAngle(); + HeadPitch = stream->ReadAngle(); + VelocityX = stream->ReadShort(); + VelocityY = stream->ReadShort(); + VelocityZ = stream->ReadShort(); + } + + int GetPacketId() override { + return PacketNamePlayCB::SpawnMob; + } + + unsigned int EntityId; + Uuid EntityUuid; + int type; + double X, Y, Z; + unsigned char Yaw, Pitch, HeadPitch; + short VelocityX, VelocityY, VelocityZ; + //Metadata };
\ No newline at end of file |