summaryrefslogtreecommitdiffstats
path: root/src/packet/PacketParser.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-06-17 16:23:53 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-06-17 16:23:53 +0200
commit789f70b6f1a9067843dfc1ff73d86b645efe1da9 (patch)
treef3db085f2ac1ec5fd6ad0869a63e77a7f0fb1a17 /src/packet/PacketParser.cpp
parent2017-06-14 (diff)
downloadAltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.gz
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.bz2
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.lz
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.xz
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.tar.zst
AltCraft-789f70b6f1a9067843dfc1ff73d86b645efe1da9.zip
Diffstat (limited to '')
-rw-r--r--src/packet/PacketParser.cpp147
1 files changed, 0 insertions, 147 deletions
diff --git a/src/packet/PacketParser.cpp b/src/packet/PacketParser.cpp
deleted file mode 100644
index a609011..0000000
--- a/src/packet/PacketParser.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-#include "PacketParser.hpp"
-
-void PacketParser::Parse(Packet &packet, ConnectionState state, bool ClientBound) {
- if (ClientBound) {
- switch (state) {
- case Login:
- ParseLogin(packet);
- break;
- case Handshaking:
- break;
- case Play:
- ParsePlay(packet);
- break;
- case Status:
-
- break;
- }
- } else {
- ParseServerBound(packet, state);
- }
-}
-
-void PacketParser::ParseServerBound(Packet &packet, ConnectionState state) {
- if (packet.GetLength() != state)
- throw 107;
-}
-
-void PacketParser::ParseLogin(Packet &packet) {
- switch (packet.GetId()) {
- case 0x00:
- ParseLogin0x00(packet);
- break;
- case 0x02:
- ParseLogin0x02(packet);
- break;
- default: {
-
- //throw 112;
- }
- }
-}
-
-void PacketParser::ParsePlay(Packet &packet) {
- switch (packet.GetId()) {
- case 0x23:
- ParsePlay0x23(packet);
- break;
- case 0x1F:
- ParsePlay0x1F(packet);
- break;
- case 0x0D:
- ParsePlay0x0D(packet);
- break;
- case 0x2B:
- ParsePlay0x2B(packet);
- break;
- case 0x43:
- ParsePlay0x43(packet);
- break;
- case 0x2E:
- ParsePlay0x2E(packet);
- break;
- case 0x1A:
- ParsePlay0x1A(packet);
- break;
- case 0x20:
- ParsePlay0x20(packet);
- break;
- case 0x07:
- ParsePlay0x07(packet);
- default:
- //throw 113;
- break;
- }
-}
-
-void PacketParser::ParseLogin0x00(Packet &packet) {
- packet.ParseField(String);
-}
-
-void PacketParser::ParseLogin0x02(Packet &packet) {
- packet.ParseField(String);
- packet.ParseField(String);
-}
-
-void PacketParser::ParsePlay0x23(Packet &packet) {
- packet.ParseField(Int);
- packet.ParseField(UnsignedByte);
- packet.ParseField(Int);
- packet.ParseField(UnsignedByte);
- packet.ParseField(UnsignedByte);
- packet.ParseField(String);
- packet.ParseField(Boolean);
-}
-
-void PacketParser::ParsePlay0x1F(Packet &packet) {
- packet.ParseField(VarIntType);
-}
-
-void PacketParser::ParsePlay0x0D(Packet &packet) {
- packet.ParseField(UnsignedByte);
-}
-
-void PacketParser::ParsePlay0x2B(Packet &packet) {
- packet.ParseField(Byte8_t);
- packet.ParseField(Float);
- packet.ParseField(Float);
-}
-
-void PacketParser::ParsePlay0x43(Packet &packet) {
- packet.ParseField(Position);
-}
-
-void PacketParser::ParsePlay0x2E(Packet &packet) {
- packet.ParseField(Double);
- packet.ParseField(Double);
- packet.ParseField(Double);
- packet.ParseField(Float);
- packet.ParseField(Float);
- packet.ParseField(Byte8_t);
- packet.ParseField(VarIntType);
-}
-
-void PacketParser::ParsePlay0x1A(Packet &packet) {
- packet.ParseField(String);
-}
-
-void PacketParser::ParsePlay0x20(Packet &packet) {
- packet.ParseField(Int);
- packet.ParseField(Int);
- packet.ParseField(Boolean);
- packet.ParseField(VarIntType);
- packet.ParseField(VarIntType);
- packet.ParseField(ByteArray, packet.GetField(4).GetVarInt());
- packet.ParseField(VarIntType);
- //packet.ParseField(NbtTag);
- //packet.GetField(7).SetArray(packet.GetField(6).GetVarInt());
-}
-
-void PacketParser::ParsePlay0x07(Packet &packet) {
- packet.ParseField(VarIntType);
- packet.AddField(Field());
- for (int i = 0; i < packet.GetField(0).GetVarInt(); i++) {
- packet.ParseFieldArray(packet.GetField(1), String, 0);
- packet.ParseFieldArray(packet.GetField(1), VarIntType, 0);
- }
-}