diff options
Diffstat (limited to 'source/packets')
47 files changed, 0 insertions, 1893 deletions
diff --git a/source/packets/cPacket.cpp b/source/packets/cPacket.cpp deleted file mode 100644 index 8307e67fa..000000000 --- a/source/packets/cPacket.cpp +++ /dev/null @@ -1,153 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket.h" -#include "../Endianness.h" - - - - - -/* -// These checks cannot be done in preprocessor, since sizeof() is evaluated while compiling, so in preprocessing it's unknown. -// Check some basic type assumptions: -#if (sizeof(int) != 4) - #error "Bad size for int, protocol won't work" -#endif - -#if (sizeof(float) != 4) - #error "Bad size for float, protocol won't work" -#endif - -#if (sizeof(double) != 8) - #error "Bad size for double, protocol won't work" -#endif -*/ - - - - - -void cPacket::AppendString(AString & a_Dst, const AString & a_String) -{ - AppendShort(a_Dst, (unsigned short)a_String.size()); - a_Dst.append(a_String); -} - - - - - -void cPacket::AppendString16(AString & a_Dst, const AString & a_String) -{ - AppendShort(a_Dst, (unsigned short)a_String.size()); - AString UTF16; - UTF16.resize(a_String.size() * sizeof(short)); - for( unsigned int i = 0; i < a_String.size(); ++i ) - { - UTF16[i * sizeof( short )] = 0x00; - UTF16[i * sizeof( short ) + 1] = a_String[i]; - } - a_Dst.append(UTF16.data(), a_String.size() * sizeof(short)); -} - - - - - -void cPacket::AppendShort(AString & a_Dst, short a_Short) -{ - short ConvertedShort = htons( a_Short ); - a_Dst.append((const char *)&ConvertedShort, sizeof(short)); -} - - - - - -void cPacket::AppendShort(AString & a_Dst, unsigned short a_Short) -{ - short ConvertedShort = htons( a_Short ); - a_Dst.append((const char *)&ConvertedShort, sizeof(short)); -} - - - - - -void cPacket::AppendInteger(AString & a_Dst, int a_Integer) -{ - int ConvertedInt = htonl( a_Integer ); - a_Dst.append((const char *)&ConvertedInt, sizeof(int)); -} - - - - - -void cPacket::AppendInteger(AString & a_Dst, unsigned int a_Integer) -{ - unsigned int ConvertedInt = htonl( a_Integer ); - a_Dst.append((const char *)&ConvertedInt, sizeof(int)); -} - - - - - -void cPacket::AppendFloat(AString & a_Dst, float a_Float) -{ - unsigned int ConvertedFloat = HostToNetwork4(&a_Float); - a_Dst.append((const char *)&ConvertedFloat, sizeof(int)); -} - - - - - -void cPacket::AppendDouble(AString & a_Dst, const double & a_Double) -{ - unsigned long long ConvertedDouble = HostToNetwork8(&a_Double); - a_Dst.append((const char *)&ConvertedDouble, 8); -} - - - - - -void cPacket::AppendByte(AString & a_Dst, char a_Byte) -{ - a_Dst.append(&a_Byte, 1); -} - - - - - -void cPacket::AppendLong(AString & a_Dst, const long long & a_Long) -{ - unsigned long long ConvertedLong = HostToNetwork8(&a_Long); - a_Dst.append((const char *)&ConvertedLong, sizeof(a_Long)); -} - - - - - -void cPacket::AppendBool(AString & a_Dst, bool a_Bool) -{ - a_Dst.append((const char *)&a_Bool, 1); -} - - - - - -void cPacket::AppendData(AString & a_Dst, const char * a_Data, unsigned int a_Size) -{ - a_Dst.append(a_Data, a_Size); -} - - - - diff --git a/source/packets/cPacket.h b/source/packets/cPacket.h deleted file mode 100644 index 580cd6771..000000000 --- a/source/packets/cPacket.h +++ /dev/null @@ -1,80 +0,0 @@ - -#pragma once - -#include "../cSocket.h" -#include "../PacketID.h" -#include "../ByteBuffer.h" - - - - - -enum -{ - PACKET_INCOMPLETE = -2, - PACKET_ERROR = -1, - PACKET_OK = 1, -} ; - - - - - -// Use this macro to simplify handling several ReadXXX in a row. It assumes that you want [a_Data, a_Size] parsed (which is true for all Parse() functions) -#define HANDLE_PACKET_READ(Proc, Var, TotalBytes) \ - { \ - if (!a_Buffer.Proc(Var)) \ - { \ - return PACKET_INCOMPLETE; \ - } \ - TotalBytes = PACKET_OK; \ - } - - - - - -class cPacket -{ -public: - cPacket() - : m_PacketID( 0 ) - {} - virtual ~cPacket() {} - - /// Called to parse the packet. Packet type has already been read and the correct packet type created. Return PACKET_INCOMPLETE for incomplete data, PACKET_ERROR for error, any positive number for success - virtual int Parse(cByteBuffer & a_Buffer) - { - // There are packets that are sent S->C only, those don't have a parsing function - UNUSED(a_Buffer); - LOGERROR("Packet type 0x%02x has no parser defined!", m_PacketID); - ASSERT(!"Unparsed packet type!"); - return PACKET_ERROR; - } - - virtual cPacket * Clone() const = 0; - - unsigned char m_PacketID; - -protected: - // These append the data into the a_Dst string: - static void AppendString ( AString & a_Dst, const AString & a_String); - static void AppendString16( AString & a_Dst, const AString & a_String); - static void AppendShort ( AString & a_Dst, short a_Short); - static void AppendShort ( AString & a_Dst, unsigned short a_Short); - static void AppendInteger ( AString & a_Dst, int a_Integer); - static void AppendInteger ( AString & a_Dst, unsigned int a_Integer); - static void AppendFloat ( AString & a_Dst, float a_Float); - static void AppendDouble ( AString & a_Dst, const double & a_Double); - static void AppendByte ( AString & a_Dst, char a_Byte); - static void AppendLong ( AString & a_Dst, const long long & a_Long); - static void AppendBool ( AString & a_Dst, bool a_Bool); - static void AppendData ( AString & a_Dst, const char * a_Data, unsigned int a_Size); -}; - -typedef std::list <cPacket*> PacketList; -typedef std::deque<cPacket *> PacketQueue; - - - - diff --git a/source/packets/cPacket_13.cpp b/source/packets/cPacket_13.cpp deleted file mode 100644 index f31c67704..000000000 --- a/source/packets/cPacket_13.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_13.h" - - - - - -int cPacket_13::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEInt, m_EntityID, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_ActionID, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_13.h b/source/packets/cPacket_13.h deleted file mode 100644 index c9f274b38..000000000 --- a/source/packets/cPacket_13.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "cPacket.h" - - -class cPacket_13 : public cPacket -{ -public: - enum ENUM_ACTION - { - ACTION_CROUCH = 1, - ACTION_UNCROUCH = 2, - ACTION_LEAVEBED = 3, - ACTION_STARTSPRINTING = 4, - ACTION_STOPSPRINTING = 5, - }; - - cPacket_13() - : m_EntityID( 0 ) - , m_ActionID( 0 ) - { m_PacketID = E_PACKET_ENTITY_ACTION; } - virtual cPacket* Clone() const { return new cPacket_13( *this ); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_EntityID; - char m_ActionID; - - static const unsigned int c_Size = 1; -}; - - - - diff --git a/source/packets/cPacket_ArmAnim.cpp b/source/packets/cPacket_ArmAnim.cpp deleted file mode 100644 index 8d46da39f..000000000 --- a/source/packets/cPacket_ArmAnim.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_ArmAnim.h" - - - - - -int cPacket_ArmAnim::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEInt, m_EntityID, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_Animation, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_ArmAnim.h b/source/packets/cPacket_ArmAnim.h deleted file mode 100644 index c4f4694ce..000000000 --- a/source/packets/cPacket_ArmAnim.h +++ /dev/null @@ -1,30 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_ArmAnim : - public cPacket -{ -public: - cPacket_ArmAnim() - : m_EntityID( 0 ) - , m_Animation( 0 ) - { - m_PacketID = E_ANIMATION; - } - virtual cPacket* Clone() const { return new cPacket_ArmAnim(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_EntityID; - char m_Animation; -}; - - - - diff --git a/source/packets/cPacket_BlockDig.cpp b/source/packets/cPacket_BlockDig.cpp deleted file mode 100644 index 8c7cc5955..000000000 --- a/source/packets/cPacket_BlockDig.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_BlockDig.h" - - - - - -int cPacket_BlockDig::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadChar, m_Status, TotalBytes); - HANDLE_PACKET_READ(ReadBEInt, m_PosX, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_PosY, TotalBytes); - HANDLE_PACKET_READ(ReadBEInt, m_PosZ, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_Direction, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_BlockDig.h b/source/packets/cPacket_BlockDig.h deleted file mode 100644 index 1678dcaf3..000000000 --- a/source/packets/cPacket_BlockDig.h +++ /dev/null @@ -1,37 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_BlockDig : - public cPacket -{ -public: - cPacket_BlockDig() - : m_Status( 0 ) - , m_PosX( 0 ) - , m_PosY( 0 ) - , m_PosZ( 0 ) - , m_Direction( 0 ) - { - m_PacketID = E_BLOCK_DIG; - } - - virtual cPacket* Clone() const { return new cPacket_BlockDig(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - char m_Status; - int m_PosX; - char m_PosY; - int m_PosZ; - char m_Direction; -}; - - - - diff --git a/source/packets/cPacket_BlockPlace.cpp b/source/packets/cPacket_BlockPlace.cpp deleted file mode 100644 index 6b4219a8b..000000000 --- a/source/packets/cPacket_BlockPlace.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_BlockPlace.h" -#include "cPacket_ItemData.h" - - - - - -int cPacket_BlockPlace::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEInt, m_PosX, TotalBytes); - HANDLE_PACKET_READ(ReadByte, m_PosY, TotalBytes); - HANDLE_PACKET_READ(ReadBEInt, m_PosZ, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_Direction, TotalBytes); - - cPacket_ItemData Item(m_HeldItem); - int res = Item.Parse(a_Buffer); - if (res < 0) - { - return res; - } - TotalBytes += res; - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_BlockPlace.h b/source/packets/cPacket_BlockPlace.h deleted file mode 100644 index 187abf549..000000000 --- a/source/packets/cPacket_BlockPlace.h +++ /dev/null @@ -1,38 +0,0 @@ - -#pragma once - -#include "cPacket.h" -#include "../cItem.h" - - - - - -class cPacket_BlockPlace : - public cPacket -{ -public: - cPacket_BlockPlace() - : m_PosX( 0 ) - , m_PosY( 0 ) - , m_PosZ( 0 ) - , m_Direction( 0 ) - { - m_PacketID = E_BLOCK_PLACE; - } - - virtual cPacket* Clone() const { return new cPacket_BlockPlace(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_PosX; - unsigned char m_PosY; - int m_PosZ; - char m_Direction; - - cItem m_HeldItem; -} ; - - - - diff --git a/source/packets/cPacket_Chat.cpp b/source/packets/cPacket_Chat.cpp deleted file mode 100644 index b475848b0..000000000 --- a/source/packets/cPacket_Chat.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_Chat.h" - - - - - -int cPacket_Chat::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Message, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_Chat.h b/source/packets/cPacket_Chat.h deleted file mode 100644 index ff5c70b5b..000000000 --- a/source/packets/cPacket_Chat.h +++ /dev/null @@ -1,24 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_Chat : - public cPacket -{ -public: - cPacket_Chat() { m_PacketID = E_CHAT; } - virtual cPacket* Clone() const { return new cPacket_Chat(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - AString m_Message; -}; - - - - diff --git a/source/packets/cPacket_CreativeInventoryAction.cpp b/source/packets/cPacket_CreativeInventoryAction.cpp deleted file mode 100644 index 41a45125b..000000000 --- a/source/packets/cPacket_CreativeInventoryAction.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_CreativeInventoryAction.h" -#include "cPacket_ItemData.h" - - - - - -cPacket_CreativeInventoryAction::cPacket_CreativeInventoryAction( const cPacket_CreativeInventoryAction & a_Copy ) -{ - m_PacketID = E_CREATIVE_INVENTORY_ACTION; - m_SlotNum = a_Copy.m_SlotNum; - m_ClickedItem = a_Copy.m_ClickedItem; -} - - - - - -int cPacket_CreativeInventoryAction::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEShort, m_SlotNum, TotalBytes); - - cPacket_ItemData Item(m_ClickedItem); - int res = Item.Parse(a_Buffer); - if (res < 0) - { - return res; - } - TotalBytes += res; - return TotalBytes; -} - - - - - diff --git a/source/packets/cPacket_CreativeInventoryAction.h b/source/packets/cPacket_CreativeInventoryAction.h deleted file mode 100644 index 885478496..000000000 --- a/source/packets/cPacket_CreativeInventoryAction.h +++ /dev/null @@ -1,32 +0,0 @@ - -#pragma once - -#include "cPacket.h" -#include "../cItem.h" - - - - - -class cPacket_CreativeInventoryAction : - public cPacket -{ -public: - cPacket_CreativeInventoryAction() : - m_SlotNum(0) - { - m_PacketID = E_CREATIVE_INVENTORY_ACTION; - } - - cPacket_CreativeInventoryAction( const cPacket_CreativeInventoryAction & a_Copy ); - virtual cPacket* Clone() const { return new cPacket_CreativeInventoryAction(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - short m_SlotNum; - cItem m_ClickedItem; -} ; - - - - diff --git a/source/packets/cPacket_Disconnect.cpp b/source/packets/cPacket_Disconnect.cpp deleted file mode 100644 index d1d433475..000000000 --- a/source/packets/cPacket_Disconnect.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_Disconnect.h" - - - - - -int cPacket_Disconnect::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Reason, TotalBytes); - return TotalBytes; -} - - - - - diff --git a/source/packets/cPacket_Disconnect.h b/source/packets/cPacket_Disconnect.h deleted file mode 100644 index 77b6cf615..000000000 --- a/source/packets/cPacket_Disconnect.h +++ /dev/null @@ -1,25 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_Disconnect : public cPacket -{ -public: - cPacket_Disconnect() { m_PacketID = E_DISCONNECT; } - cPacket_Disconnect(const AString & a_Reason) { m_PacketID = E_DISCONNECT; m_Reason = a_Reason; } - virtual cPacket* Clone() const { return new cPacket_Disconnect(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - AString m_Reason; - static const unsigned int c_Size = 3; // Minimum size -}; - - - - diff --git a/source/packets/cPacket_Explosion.cpp b/source/packets/cPacket_Explosion.cpp deleted file mode 100644 index d4a244c01..000000000 --- a/source/packets/cPacket_Explosion.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_Explosion.h" - - - - - -cPacket_Explosion::~cPacket_Explosion() -{ - if( m_Records ) - { - delete [] m_Records; - } -} - - - - - -cPacket_Explosion::cPacket_Explosion( const cPacket_Explosion & a_Copy ) -{ - m_PacketID = E_EXPLOSION; - m_PosX = a_Copy.m_PosX; - m_PosY = a_Copy.m_PosY; - m_PosZ = a_Copy.m_PosZ; - m_Radius = a_Copy.m_Radius; //might not be radius - m_RecordsCount= a_Copy.m_RecordsCount; - - m_Records = new char[(m_RecordsCount * 3)]; - memcpy( m_Records, a_Copy.m_Records, (m_RecordsCount * 3) ); -} - - - - - -void cPacket_Explosion::Serialize(AString & a_Data) const -{ - AppendByte (a_Data, m_PacketID); - AppendDouble (a_Data, m_PosX); - AppendDouble (a_Data, m_PosY); - AppendDouble (a_Data, m_PosZ); - AppendFloat (a_Data, m_Radius); - AppendInteger(a_Data, m_RecordsCount); - AppendData (a_Data, m_Records, (m_RecordsCount * 3)); -} - - - - diff --git a/source/packets/cPacket_Explosion.h b/source/packets/cPacket_Explosion.h deleted file mode 100644 index 468d72fe4..000000000 --- a/source/packets/cPacket_Explosion.h +++ /dev/null @@ -1,40 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_Explosion : public cPacket -{ -public: - cPacket_Explosion() - : m_PosX( 0 ) - , m_PosY( 0 ) - , m_PosZ( 0 ) - , m_Radius( 0 ) - , m_RecordsCount( 0 ) - , m_Records( 0 ) - { m_PacketID = E_EXPLOSION; m_Records = 0; } - cPacket_Explosion( const cPacket_Explosion & a_Copy ); - ~cPacket_Explosion(); - virtual cPacket* Clone() const { return new cPacket_Explosion(*this); } - - virtual void Serialize(AString & a_Data) const; - - double m_PosX; // The entity ID of the thunderbolt - double m_PosY; // Always true. Might have a meaning in the future... - double m_PosZ; // Thunderbolt X as Absolute Integer - float m_Radius; // Thunderbolt Y as Absolute Integer - int m_RecordsCount; // Thunderbolt Z as Absolute Integer - - static const unsigned int c_Size = 1 + 8 + 8 + 8 + 4 + 4; - - char* m_Records; -}; - - - - diff --git a/source/packets/cPacket_Flying.cpp b/source/packets/cPacket_Flying.cpp deleted file mode 100644 index bc730cb5e..000000000 --- a/source/packets/cPacket_Flying.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_Flying.h" - - - - - -int cPacket_Flying::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes= 0; - HANDLE_PACKET_READ(ReadBool, m_bFlying, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_Flying.h b/source/packets/cPacket_Flying.h deleted file mode 100644 index 52f33e7fd..000000000 --- a/source/packets/cPacket_Flying.h +++ /dev/null @@ -1,27 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_Flying : public cPacket -{ -public: - // The BS packet - cPacket_Flying() - : m_bFlying( false ) - { m_PacketID = E_FLYING; } - virtual cPacket* Clone() const { return new cPacket_Flying(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - bool m_bFlying; - static const unsigned int c_Size = 2; -}; - - - - diff --git a/source/packets/cPacket_Handshake.cpp b/source/packets/cPacket_Handshake.cpp deleted file mode 100644 index 5229cdba3..000000000 --- a/source/packets/cPacket_Handshake.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_Handshake.h" - - - - - -int cPacket_Handshake::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Username, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_Handshake.h b/source/packets/cPacket_Handshake.h deleted file mode 100644 index 86bc8a286..000000000 --- a/source/packets/cPacket_Handshake.h +++ /dev/null @@ -1,23 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_Handshake : public cPacket -{ -public: - cPacket_Handshake() { m_PacketID = E_HANDSHAKE; } - virtual cPacket* Clone() const { return new cPacket_Handshake(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - std::string m_Username; -}; - - - - diff --git a/source/packets/cPacket_ItemData.cpp b/source/packets/cPacket_ItemData.cpp deleted file mode 100644 index 4f0803475..000000000 --- a/source/packets/cPacket_ItemData.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_ItemData.h" - - - - - -int cPacket_ItemData::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEShort, m_Dst.m_ItemType, TotalBytes); - - if (m_Dst.m_ItemType <= -1) - { - m_Dst.Empty(); - return TotalBytes; - } - - HANDLE_PACKET_READ(ReadChar, m_Dst.m_ItemCount, TotalBytes); - HANDLE_PACKET_READ(ReadBEShort, m_Dst.m_ItemDamage, TotalBytes); - - if (cItem::IsEnchantable(m_Dst.m_ItemType)) - { - short EnchantNumBytes; - HANDLE_PACKET_READ(ReadBEShort, EnchantNumBytes, TotalBytes); - - if (EnchantNumBytes > 0) - { - // TODO: Enchantment not implemented yet! - a_Buffer.SkipRead(EnchantNumBytes); - } - } - return TotalBytes; -} - - - - - -int cPacket_ItemData::GetSize(short a_ItemID) -{ - if(a_ItemID <= -1) - return 2; - if(cItem::IsEnchantable((ENUM_ITEM_ID) a_ItemID)) - return 7; - return 5; -} - - - - - -void cPacket_ItemData::AppendItem(AString & a_Data, const cItem & a_Item) -{ - return AppendItem(a_Data, a_Item.m_ItemType, a_Item.m_ItemCount, a_Item.m_ItemDamage); -} - - - - - -void cPacket_ItemData::AppendItem(AString & a_Data, short a_ItemType, char a_Quantity, short a_Damage) -{ - short ItemType = a_ItemType; - ASSERT(ItemType >= -1); // Check validity of packets in debug runtime - if (ItemType <= 0) - { - // Fix, to make sure no invalid values are sent. - ItemType = -1; - } - - AppendShort(a_Data, ItemType); - if (a_ItemType > -1) - { - AppendByte (a_Data, a_Quantity); - AppendShort(a_Data, a_Damage); - - if (cItem::IsEnchantable(a_ItemType)) - { - // TODO: Implement enchantments - AppendShort(a_Data, (short) -1); - } - } -} - - - - diff --git a/source/packets/cPacket_ItemData.h b/source/packets/cPacket_ItemData.h deleted file mode 100644 index e1a6c547d..000000000 --- a/source/packets/cPacket_ItemData.h +++ /dev/null @@ -1,34 +0,0 @@ - -#pragma once - - -#include "cPacket.h" -#include "../cItem.h" - - - - - -class cPacket_ItemData : public cPacket -{ - cItem & m_Dst; - -public: - cPacket_ItemData(cItem & a_Dst) : - m_Dst(a_Dst) - { - } - - virtual cPacket * Clone() const { return new cPacket_ItemData(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - static void AppendItem(AString & a_Data, short a_ItemType, char a_Quantity, short a_Damage); - static void AppendItem(AString & a_Data, const cItem & a_Item); - - int GetSize(short a_ItemID); -} ; - - - - diff --git a/source/packets/cPacket_ItemSwitch.cpp b/source/packets/cPacket_ItemSwitch.cpp deleted file mode 100644 index 864214a66..000000000 --- a/source/packets/cPacket_ItemSwitch.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_ItemSwitch.h" - - - - - -int cPacket_ItemSwitch::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEShort, m_SlotNum, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_ItemSwitch.h b/source/packets/cPacket_ItemSwitch.h deleted file mode 100644 index 667b24044..000000000 --- a/source/packets/cPacket_ItemSwitch.h +++ /dev/null @@ -1,25 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_ItemSwitch : public cPacket -{ -public: - cPacket_ItemSwitch() - : m_SlotNum( 0 ) - { m_PacketID = E_ITEM_SWITCH; } - virtual cPacket* Clone() const { return new cPacket_ItemSwitch(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - short m_SlotNum; -}; - - - - diff --git a/source/packets/cPacket_KeepAlive.cpp b/source/packets/cPacket_KeepAlive.cpp deleted file mode 100644 index 090e90671..000000000 --- a/source/packets/cPacket_KeepAlive.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_KeepAlive.h" - - - - - -int cPacket_KeepAlive::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEInt, m_KeepAliveID, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_KeepAlive.h b/source/packets/cPacket_KeepAlive.h deleted file mode 100644 index b68aa5691..000000000 --- a/source/packets/cPacket_KeepAlive.h +++ /dev/null @@ -1,24 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_KeepAlive : public cPacket -{ -public: - cPacket_KeepAlive() { m_PacketID = E_KEEP_ALIVE; } - cPacket_KeepAlive(int a_PingID) { m_KeepAliveID = a_PingID; } - virtual cPacket * Clone() const { return new cPacket_KeepAlive(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_KeepAliveID; -}; - - - - diff --git a/source/packets/cPacket_Login.cpp b/source/packets/cPacket_Login.cpp deleted file mode 100644 index 017227071..000000000 --- a/source/packets/cPacket_Login.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_Login.h" - - - - - -const char * cPacket_Login::LEVEL_TYPE_DEFAULT = "DEFAULT"; -const char * cPacket_Login::LEVEL_TYPE_SUPERFLAT = "SUPERFLAT"; - - - - - -int cPacket_Login::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - m_Username.clear(); - HANDLE_PACKET_READ(ReadBEInt, m_ProtocolVersion, TotalBytes); - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Username, TotalBytes); - HANDLE_PACKET_READ(ReadBEUTF16String16, m_LevelType, TotalBytes); - HANDLE_PACKET_READ(ReadBEInt, m_ServerMode, TotalBytes); - HANDLE_PACKET_READ(ReadBEInt, m_Dimension, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_Difficulty, TotalBytes); - HANDLE_PACKET_READ(ReadByte, m_WorldHeight, TotalBytes); - HANDLE_PACKET_READ(ReadByte, m_MaxPlayers, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_Login.h b/source/packets/cPacket_Login.h deleted file mode 100644 index df7545edd..000000000 --- a/source/packets/cPacket_Login.h +++ /dev/null @@ -1,41 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_Login : public cPacket -{ -public: - cPacket_Login() - : m_ProtocolVersion( 0 ) - , m_ServerMode( 0 ) - , m_Dimension( 0 ) - , m_Difficulty( 0 ) - , m_WorldHeight( 0 ) - , m_MaxPlayers( 0 ) - , m_LevelType( LEVEL_TYPE_DEFAULT ) - { m_PacketID = E_LOGIN; } - virtual cPacket* Clone() const { return new cPacket_Login(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_ProtocolVersion; - AString m_Username; - AString m_LevelType; - int m_ServerMode; - int m_Dimension; - char m_Difficulty; - unsigned char m_WorldHeight; - unsigned char m_MaxPlayers; - - static const char * LEVEL_TYPE_DEFAULT; - static const char * LEVEL_TYPE_SUPERFLAT; -}; - - - - diff --git a/source/packets/cPacket_MultiBlock.cpp b/source/packets/cPacket_MultiBlock.cpp deleted file mode 100644 index 68daf2700..000000000 --- a/source/packets/cPacket_MultiBlock.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_MultiBlock.h" - - - - - -cPacket_MultiBlock::cPacket_MultiBlock(const cPacket_MultiBlock & a_Copy) -{ - m_PacketID = E_MULTI_BLOCK; - m_ChunkX = a_Copy.m_ChunkX; - m_ChunkZ = a_Copy.m_ChunkZ; - m_NumBlocks = a_Copy.m_NumBlocks; - m_Data = new sBlockChange[m_NumBlocks]; - memcpy(m_Data, a_Copy.m_Data, sizeof(sBlockChange) * m_NumBlocks); -} - - - - - -cPacket_MultiBlock::~cPacket_MultiBlock() -{ - delete[] m_Data; -} - - - - - -void cPacket_MultiBlock::Serialize(AString & a_Data) const -{ - AppendByte (a_Data, m_PacketID); - AppendInteger(a_Data, m_ChunkX); - AppendInteger(a_Data, m_ChunkZ); - AppendShort (a_Data, m_NumBlocks); - - AppendInteger(a_Data, sizeof(*m_Data) * m_NumBlocks); - for (short i = 0; i < m_NumBlocks; ++i) - { - AppendInteger(a_Data, m_Data[i].Data); - } -} - - - - diff --git a/source/packets/cPacket_MultiBlock.h b/source/packets/cPacket_MultiBlock.h deleted file mode 100644 index 7399fe853..000000000 --- a/source/packets/cPacket_MultiBlock.h +++ /dev/null @@ -1,43 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_MultiBlock : public cPacket -{ -public: - struct sBlockChange - { - unsigned int Data; - // short Data; // 4bits metadata ... 12bits block ID - // short Coords; // 8bits Y ... 4bits Z ... 4bits X - }; - - cPacket_MultiBlock() - : m_ChunkX( 0 ) - , m_ChunkZ( 0 ) - , m_NumBlocks( 0 ) - , m_Data( NULL ) - { - m_PacketID = E_MULTI_BLOCK; - } - - cPacket_MultiBlock(const cPacket_MultiBlock & a_Copy); - ~cPacket_MultiBlock(); - virtual cPacket* Clone() const { return new cPacket_MultiBlock(*this); } - - virtual void Serialize(AString & a_Data) const override; - - int m_ChunkX; - int m_ChunkZ; - short m_NumBlocks; - sBlockChange * m_Data; // m_NumBlocks items in the array -}; - - - - diff --git a/source/packets/cPacket_Ping.h b/source/packets/cPacket_Ping.h deleted file mode 100644 index f74385a81..000000000 --- a/source/packets/cPacket_Ping.h +++ /dev/null @@ -1,24 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_Ping : public cPacket -{ -public: - cPacket_Ping() - { m_PacketID = E_PING; } - virtual cPacket* Clone() const { return new cPacket_Ping(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override {return 0; } - - static const unsigned int c_Size = 1; -}; - - - - diff --git a/source/packets/cPacket_Player.cpp b/source/packets/cPacket_Player.cpp deleted file mode 100644 index d0acc17d0..000000000 --- a/source/packets/cPacket_Player.cpp +++ /dev/null @@ -1,166 +0,0 @@ - -// cPacket_Player.cpp - -/* Implements the player-related packets: - - PlayerAbilities (0xca) - - PlayerListItem (0xc9) - - PlayerLook (0x0c) - - PlayerMoveLook (0x0d) - - PlayerPosition (0x0b) -*/ - -#include "Globals.h" - -#include "cPacket_Player.h" -#include "../cPlayer.h" -#include "../cChatColor.h" - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerAbilities: - -int cPacket_PlayerAbilities::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBool, m_Invulnerable, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsFlying, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_CanFly, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_InstaMine, TotalBytes); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerListItem: - -cPacket_PlayerListItem::cPacket_PlayerListItem(const AString & a_PlayerName, bool a_Online, short a_Ping) -{ - m_PacketID = E_PLAYER_LIST_ITEM; - m_PlayerName = a_PlayerName; - m_Online = a_Online; - m_Ping = a_Ping; -} - - - - - -int cPacket_PlayerListItem::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEUTF16String16, m_PlayerName, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_Online, TotalBytes); - HANDLE_PACKET_READ(ReadBEShort, m_Ping, TotalBytes); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerLook: - -cPacket_PlayerLook::cPacket_PlayerLook( cPlayer* a_Player ) -{ - m_PacketID = E_PLAYERLOOK; - m_Rotation = a_Player->GetRotation(); - m_Pitch = a_Player->GetPitch(); - m_IsOnGround = a_Player->IsOnGround(); -} - - - - - -int cPacket_PlayerLook::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEFloat, m_Rotation, TotalBytes); - HANDLE_PACKET_READ(ReadBEFloat, m_Pitch, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsOnGround, TotalBytes); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerMoveLook: - -cPacket_PlayerMoveLook::cPacket_PlayerMoveLook(const cPlayer & a_Player) -{ - m_PacketID = E_PLAYERMOVELOOK; - m_PosX = a_Player.GetPosX(); - m_PosY = a_Player.GetPosY() + 0.03; // Add a small amount so that the player doesn't start inside a block - m_PosZ = a_Player.GetPosZ(); - m_Stance = a_Player.GetStance() + 0.03; // Add a small amount so that the player doesn't start inside a block - m_Rotation = a_Player.GetRotation(); - m_Pitch = a_Player.GetPitch(); - m_IsOnGround = a_Player.IsOnGround(); -} - - - - - -int cPacket_PlayerMoveLook::Parse(cByteBuffer & a_Buffer) -{ - // NOTE that Stance and Y are swapped when sent C->S vs S->C - // This is the C->S case: - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEDouble, m_PosX, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosY, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_Stance, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosZ, TotalBytes); - HANDLE_PACKET_READ(ReadBEFloat, m_Rotation, TotalBytes); - HANDLE_PACKET_READ(ReadBEFloat, m_Pitch, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsOnGround, TotalBytes); - // LOGD("Recv PML: {%0.2f, %0.2f, %0.2f}, Stance %0.2f, Gnd: %d", m_PosX, m_PosY, m_PosZ, m_Stance, m_IsOnGround ? 1 : 0); - return TotalBytes; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPacket_PlayerPosition: - -cPacket_PlayerPosition::cPacket_PlayerPosition(const cPlayer & a_Player) -{ - m_PacketID = E_PLAYERPOS; - - m_PosX = a_Player.GetPosX(); - m_PosY = a_Player.GetPosY(); - m_PosZ = a_Player.GetPosZ(); - m_Stance = a_Player.GetStance(); - m_IsOnGround = a_Player.IsOnGround(); -} - - - - - -int cPacket_PlayerPosition::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEDouble, m_PosX, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosY, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_Stance, TotalBytes); - HANDLE_PACKET_READ(ReadBEDouble, m_PosZ, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsOnGround, TotalBytes); - // LOGD("Recv PlayerPos: {%0.2f %0.2f %0.2f}, Stance %0.2f, Gnd: %d", m_PosX, m_PosY, m_PosZ, m_Stance, m_IsOnGround ? 1 : 0); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_Player.h b/source/packets/cPacket_Player.h deleted file mode 100644 index 1a647a5fc..000000000 --- a/source/packets/cPacket_Player.h +++ /dev/null @@ -1,151 +0,0 @@ - -// cPacket_Player.h - -/* Interfaces to the player-related packets: - - PlayerAbilities (0xca) - - PlayerListItem (0xc9) - - PlayerLook (0x0c) - - PlayerMoveLook (0x0d) - - PlayerPosition (0x0b) -*/ - -#pragma once - - - - - -#include "cPacket.h" - - - - - -// fwd: -class cPlayer; - - - - - -class cPacket_PlayerAbilities : public cPacket -{ -public: - cPacket_PlayerAbilities(void) { m_PacketID = E_PLAYER_LIST_ITEM; } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - virtual cPacket * Clone() const { return new cPacket_PlayerAbilities(*this); } - - bool m_Invulnerable; // Speculation - bool m_IsFlying; - bool m_CanFly; - bool m_InstaMine; // Speculation -} ; - - - - - -class cPacket_PlayerListItem : public cPacket -{ -public: - cPacket_PlayerListItem() { m_PacketID = E_PLAYER_LIST_ITEM; } - cPacket_PlayerListItem(const AString & a_PlayerName, bool a_Online, short a_Ping); - - virtual int Parse(cByteBuffer & a_Buffer) override; - - virtual cPacket* Clone() const { return new cPacket_PlayerListItem(*this); } - - AString m_PlayerName; // Supports chat coloring, limited to 16 characters. - bool m_Online; - short m_Ping; -} ; - - - - - -class cPacket_PlayerLook : public cPacket -{ -public: - cPacket_PlayerLook() - : m_Rotation( 0 ) - , m_Pitch( 0 ) - , m_IsOnGround( false ) - { - m_PacketID = E_PLAYERLOOK; - } - - cPacket_PlayerLook( cPlayer* a_Player ); - virtual cPacket* Clone() const { return new cPacket_PlayerLook(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - float m_Rotation; - float m_Pitch; - bool m_IsOnGround; -} ; - - - - - -class cPacket_PlayerMoveLook : public cPacket -{ -public: - cPacket_PlayerMoveLook() - : m_PosX( 0.0 ) - , m_PosY( 0.0 ) - , m_Stance( 0.0 ) - , m_PosZ( 0.0 ) - , m_Rotation( 0.f ) - , m_Pitch( 0.f ) - , m_IsOnGround( false ) - { - m_PacketID = E_PLAYERMOVELOOK; - } - - cPacket_PlayerMoveLook(const cPlayer & a_Player); - virtual cPacket * Clone() const { return new cPacket_PlayerMoveLook(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - double m_PosX; - double m_PosY; - double m_Stance; - double m_PosZ; - float m_Rotation; - float m_Pitch; - bool m_IsOnGround; -} ; - - - - - -class cPacket_PlayerPosition : public cPacket -{ -public: - cPacket_PlayerPosition(const cPlayer & a_Player); - cPacket_PlayerPosition() - : m_PosX( 0.0 ) - , m_PosY( 0.0 ) - , m_PosZ( 0.0 ) - , m_Stance( 0.0 ) - , m_IsOnGround(true) - { m_PacketID = E_PLAYERPOS; } - virtual cPacket* Clone() const { return new cPacket_PlayerPosition(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - double m_PosX; - double m_PosY; - double m_PosZ; - double m_Stance; - bool m_IsOnGround; -} ; - - - - diff --git a/source/packets/cPacket_Respawn.cpp b/source/packets/cPacket_Respawn.cpp deleted file mode 100644 index 0e46ea01e..000000000 --- a/source/packets/cPacket_Respawn.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_Respawn.h" - - - - - -int cPacket_Respawn::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - - HANDLE_PACKET_READ(ReadBEInt, m_Dimension, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_Difficulty, TotalBytes); - HANDLE_PACKET_READ(ReadChar, m_CreativeMode, TotalBytes); - HANDLE_PACKET_READ(ReadBEShort, m_WorldHeight, TotalBytes); - HANDLE_PACKET_READ(ReadBEUTF16String16, m_LevelType, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_Respawn.h b/source/packets/cPacket_Respawn.h deleted file mode 100644 index 9292658e7..000000000 --- a/source/packets/cPacket_Respawn.h +++ /dev/null @@ -1,38 +0,0 @@ - -#pragma once - -#include "cPacket.h" -#include "cPacket_Login.h" - - - - - -class cPacket_Respawn : - public cPacket -{ -public: - cPacket_Respawn() - : m_Dimension(0) - , m_Difficulty(0) - , m_CreativeMode(0) - , m_WorldHeight(256) - , m_LevelType( cPacket_Login::LEVEL_TYPE_DEFAULT ) - { - m_PacketID = E_RESPAWN; - } - - virtual cPacket * Clone() const { return new cPacket_Respawn( *this ); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_Dimension; - char m_Difficulty; - char m_CreativeMode; - short m_WorldHeight; - AString m_LevelType; -}; - - - - diff --git a/source/packets/cPacket_SoundEffect.cpp b/source/packets/cPacket_SoundEffect.cpp deleted file mode 100644 index efc9b8e6b..000000000 --- a/source/packets/cPacket_SoundEffect.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_SoundEffect.h" - - - - - -cPacket_SoundEffect::cPacket_SoundEffect( const cPacket_SoundEffect & a_Copy ) -{ - m_PacketID = E_SOUND_EFFECT; - m_SoundID = a_Copy.m_SoundID; - m_PosX = a_Copy.m_PosX; - m_PosY = a_Copy.m_PosY; - m_PosZ = a_Copy.m_PosZ; - m_SoundData = a_Copy.m_SoundData; -} - - - - - -void cPacket_SoundEffect::Serialize(AString & a_Data) const -{ - AppendByte (a_Data, m_PacketID); - AppendInteger(a_Data, m_SoundID); - AppendInteger(a_Data, m_PosX); - AppendByte (a_Data, m_PosY); - AppendInteger(a_Data, m_PosZ); - AppendInteger(a_Data, m_SoundData); -} - - - - diff --git a/source/packets/cPacket_SoundEffect.h b/source/packets/cPacket_SoundEffect.h deleted file mode 100644 index 9293d53f0..000000000 --- a/source/packets/cPacket_SoundEffect.h +++ /dev/null @@ -1,36 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_SoundEffect : public cPacket -{ -public: - cPacket_SoundEffect() - : m_SoundID( 0 ) - , m_PosX( 0 ) - , m_PosY( 0 ) - , m_PosZ( 0 ) - , m_SoundData( 0 ) - { m_PacketID = E_SOUND_EFFECT; } - cPacket_SoundEffect( const cPacket_SoundEffect & a_Copy ); - virtual cPacket* Clone() const { return new cPacket_SoundEffect(*this); } - - virtual void Serialize(AString & a_Data) const override; - - int m_SoundID; // Sound ID - int m_PosX; // Block X Coordinate - char m_PosY; // Block Y Coordinate - int m_PosZ; // Block Z Coordinate - int m_SoundData;// Extra Sound Data - - static const unsigned int c_Size = 1 + 4 + 4 + 1 + 4 + 4; -}; - - - - diff --git a/source/packets/cPacket_UpdateSign.cpp b/source/packets/cPacket_UpdateSign.cpp deleted file mode 100644 index b258fc9c3..000000000 --- a/source/packets/cPacket_UpdateSign.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_UpdateSign.h" - - - - - -int cPacket_UpdateSign::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEInt, m_BlockX, TotalBytes); - HANDLE_PACKET_READ(ReadBEShort, m_BlockY, TotalBytes); - HANDLE_PACKET_READ(ReadBEInt, m_BlockZ, TotalBytes); - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Line1, TotalBytes); - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Line2, TotalBytes); - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Line3, TotalBytes); - HANDLE_PACKET_READ(ReadBEUTF16String16, m_Line4, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_UpdateSign.h b/source/packets/cPacket_UpdateSign.h deleted file mode 100644 index e7b4977b2..000000000 --- a/source/packets/cPacket_UpdateSign.h +++ /dev/null @@ -1,36 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_UpdateSign : public cPacket -{ -public: - cPacket_UpdateSign() - : m_BlockX( 0 ) - , m_BlockY( 0 ) - , m_BlockZ( 0 ) - { - m_PacketID = E_UPDATE_SIGN; - } - - virtual cPacket * Clone() const { return new cPacket_UpdateSign( *this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_BlockX; - short m_BlockY; - int m_BlockZ; - AString m_Line1; - AString m_Line2; - AString m_Line3; - AString m_Line4; -}; - - - - diff --git a/source/packets/cPacket_UseEntity.cpp b/source/packets/cPacket_UseEntity.cpp deleted file mode 100644 index 9ecb3bffc..000000000 --- a/source/packets/cPacket_UseEntity.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_UseEntity.h" - - - - - -int cPacket_UseEntity::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadBEInt, m_SourceEntityID, TotalBytes); - HANDLE_PACKET_READ(ReadBEInt, m_TargetEntityID, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsLeftClick, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_UseEntity.h b/source/packets/cPacket_UseEntity.h deleted file mode 100644 index ff33ccd93..000000000 --- a/source/packets/cPacket_UseEntity.h +++ /dev/null @@ -1,33 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_UseEntity : - public cPacket -{ -public: - cPacket_UseEntity() - : m_SourceEntityID(0) - , m_TargetEntityID(0) - , m_IsLeftClick(false) - { - m_PacketID = E_USE_ENTITY; - } - - virtual cPacket * Clone() const { return new cPacket_UseEntity(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - int m_SourceEntityID; - int m_TargetEntityID; - bool m_IsLeftClick; -}; - - - - diff --git a/source/packets/cPacket_WindowClick.cpp b/source/packets/cPacket_WindowClick.cpp deleted file mode 100644 index a0a7afbda..000000000 --- a/source/packets/cPacket_WindowClick.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_WindowClick.h" -#include "cPacket_ItemData.h" - - - - - -int cPacket_WindowClick::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadChar, m_WindowID, TotalBytes); - HANDLE_PACKET_READ(ReadBEShort, m_SlotNum, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsRightClick, TotalBytes); - HANDLE_PACKET_READ(ReadBEShort, m_TransactionID, TotalBytes); - HANDLE_PACKET_READ(ReadBool, m_IsShiftPressed, TotalBytes); - - cPacket_ItemData Item(m_HeldItem); - int res = Item.Parse(a_Buffer); - if (res < 0) - { - return res; - } - TotalBytes += res; - - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_WindowClick.h b/source/packets/cPacket_WindowClick.h deleted file mode 100644 index e0f6f964e..000000000 --- a/source/packets/cPacket_WindowClick.h +++ /dev/null @@ -1,39 +0,0 @@ - -#pragma once - -#include "cPacket.h" -#include "../cItem.h" - - - - - -class cPacket_WindowClick : public cPacket // [C -> S] -{ -public: - cPacket_WindowClick() - : m_WindowID( 0 ) - , m_SlotNum( 0 ) - , m_IsRightClick(false) - , m_TransactionID( 0 ) - , m_IsShiftPressed( false ) - { - m_PacketID = E_WINDOW_CLICK; - } - - virtual cPacket* Clone() const { return new cPacket_WindowClick(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - char m_WindowID; - short m_SlotNum; - bool m_IsRightClick; - short m_TransactionID; - bool m_IsShiftPressed; // Shift pressed when clicked? - - cItem m_HeldItem; -}; - - - - diff --git a/source/packets/cPacket_WindowClose.cpp b/source/packets/cPacket_WindowClose.cpp deleted file mode 100644 index f1280ae28..000000000 --- a/source/packets/cPacket_WindowClose.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "cPacket_WindowClose.h" - - - - - -int cPacket_WindowClose::Parse(cByteBuffer & a_Buffer) -{ - int TotalBytes = 0; - HANDLE_PACKET_READ(ReadChar, m_WindowID, TotalBytes); - return TotalBytes; -} - - - - diff --git a/source/packets/cPacket_WindowClose.h b/source/packets/cPacket_WindowClose.h deleted file mode 100644 index 0851fa20d..000000000 --- a/source/packets/cPacket_WindowClose.h +++ /dev/null @@ -1,28 +0,0 @@ - -#pragma once - -#include "cPacket.h" - - - - - -class cPacket_WindowClose : public cPacket -{ -public: - cPacket_WindowClose() - : m_WindowID( 0 ) - { - m_PacketID = E_WINDOW_CLOSE; - } - - virtual cPacket* Clone() const { return new cPacket_WindowClose(*this); } - - virtual int Parse(cByteBuffer & a_Buffer) override; - - char m_WindowID; -}; - - - - |