From 1e37002528a534730b73b3bb75eeb7acd6a08447 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 5 Jul 2013 20:56:54 +0000 Subject: ProtoProxy: Updated to protocol 1.6.1 (#73) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1648 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- ProtoProxy/Connection.cpp | 121 ++++++++++++++++++++++++++++++---------------- ProtoProxy/Connection.h | 5 +- ProtoProxy/ProtoProxy.txt | 2 +- 3 files changed, 83 insertions(+), 45 deletions(-) diff --git a/ProtoProxy/Connection.cpp b/ProtoProxy/Connection.cpp index fa8c5b570..f23eecbe8 100644 --- a/ProtoProxy/Connection.cpp +++ b/ProtoProxy/Connection.cpp @@ -137,6 +137,7 @@ enum PACKET_ENTITY_EFFECT = 0x29, PACKET_ENTITY_EFFECT_REMOVE = 0x2a, PACKET_SET_EXPERIENCE = 0x2b, + PACKET_ENTITY_PROPERTIES = 0x2c, PACKET_MAP_CHUNK = 0x33, PACKET_MULTI_BLOCK_CHANGE = 0x34, PACKET_BLOCK_CHANGE = 0x35, @@ -617,6 +618,7 @@ bool cConnection::DecodeServersPackets(const char * a_Data, int a_Size) case PACKET_ENTITY_HEAD_LOOK: HANDLE_SERVER_READ(HandleServerEntityHeadLook); break; case PACKET_ENTITY_LOOK: HANDLE_SERVER_READ(HandleServerEntityLook); break; case PACKET_ENTITY_METADATA: HANDLE_SERVER_READ(HandleServerEntityMetadata); break; + case PACKET_ENTITY_PROPERTIES: HANDLE_SERVER_READ(HandleServerEntityProperties); break; case PACKET_ENTITY_RELATIVE_MOVE: HANDLE_SERVER_READ(HandleServerEntityRelativeMove); break; case PACKET_ENTITY_RELATIVE_MOVE_LOOK: HANDLE_SERVER_READ(HandleServerEntityRelativeMoveLook); break; case PACKET_ENTITY_STATUS: HANDLE_SERVER_READ(HandleServerEntityStatus); break; @@ -825,9 +827,11 @@ bool cConnection::HandleClientEntityAction(void) { HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, PlayerID); HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, ActionType); + HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, UnknownHorseVal); Log("Received a PACKET_ENTITY_ACTION from the client:"); Log(" PlayerID = %d", PlayerID); Log(" ActionType = %d", ActionType); + Log(" UnknownHorseVal = %d (0x%08x)", UnknownHorseVal, UnknownHorseVal); COPY_TO_SERVER(); return true; } @@ -911,12 +915,12 @@ bool cConnection::HandleClientPing(void) bool cConnection::HandleClientPlayerAbilities(void) { HANDLE_CLIENT_PACKET_READ(ReadChar, char, Flags); - HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, FlyingSpeed); - HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, WalkingSpeed); + HANDLE_CLIENT_PACKET_READ(ReadBEFloat, float, FlyingSpeed); + HANDLE_CLIENT_PACKET_READ(ReadBEFloat, float, WalkingSpeed); Log("Receives a PACKET_PLAYER_ABILITIES from the client:"); - Log(" Flags = %d (0x%x)", Flags, Flags); - Log(" FlyingSpeed = %d", FlyingSpeed); - Log(" WalkingSpeed = %d", WalkingSpeed); + Log(" Flags = %d (0x%02x)", Flags, Flags); + Log(" FlyingSpeed = %f", FlyingSpeed); + Log(" WalkingSpeed = %f", WalkingSpeed); COPY_TO_SERVER(); return true; } @@ -1084,11 +1088,13 @@ bool cConnection::HandleClientWindowClose(void) bool cConnection::HandleServerAttachEntity(void) { - HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); - HANDLE_SERVER_PACKET_READ(ReadBEInt, int, VehicleID); + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, VehicleID); + HANDLE_SERVER_PACKET_READ(ReadBool, bool, Leash); Log("Received a PACKET_ATTACH_ENTITY from the server:"); Log(" EntityID = %d (0x%x)", EntityID, EntityID); Log(" VehicleID = %d (0x%x)", VehicleID, VehicleID); + Log(" Leash = %s", Leash ? "true" : "false"); COPY_TO_CLIENT(); return true; } @@ -1263,6 +1269,27 @@ bool cConnection::HandleServerEntity(void) +bool cConnection::HandleServerEntityEquipment(void) +{ + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); + HANDLE_SERVER_PACKET_READ(ReadBEShort, short, SlotNum); + AString Item; + if (!ParseSlot(m_ServerBuffer, Item)) + { + return false; + } + Log("Received a PACKET_ENTITY_EQUIPMENT from the server:"); + Log(" EntityID = %d", EntityID); + Log(" SlotNum = %d", SlotNum); + Log(" Item = %s", Item.c_str()); + COPY_TO_CLIENT(); + return true; +} + + + + + bool cConnection::HandleServerEntityHeadLook(void) { HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); @@ -1278,20 +1305,15 @@ bool cConnection::HandleServerEntityHeadLook(void) -bool cConnection::HandleServerEntityMetadata(void) +bool cConnection::HandleServerEntityLook(void) { - HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); - AString Metadata; - if (!ParseMetadata(m_ServerBuffer, Metadata)) - { - return false; - } - AString HexDump; - CreateHexDump(HexDump, Metadata.data(), Metadata.size(), 32); - Log("Received a PACKET_ENTITY_METADATA from the server:"); + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); + HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Yaw); + HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Pitch); + Log("Received a PACKET_ENTITY_LOOK from the server:"); Log(" EntityID = %d", EntityID); - Log(" Metadata, length = %d (0x%x):\n%s", Metadata.length(), Metadata.length(), HexDump.c_str()); - LogMetadata(Metadata, 4); + Log(" Yaw = %d", Yaw); + Log(" Pitch = %d", Pitch); COPY_TO_CLIENT(); return true; } @@ -1300,19 +1322,20 @@ bool cConnection::HandleServerEntityMetadata(void) -bool cConnection::HandleServerEntityEquipment(void) +bool cConnection::HandleServerEntityMetadata(void) { - HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); - HANDLE_SERVER_PACKET_READ(ReadBEShort, short, SlotNum); - AString Item; - if (!ParseSlot(m_ServerBuffer, Item)) + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); + AString Metadata; + if (!ParseMetadata(m_ServerBuffer, Metadata)) { return false; } - Log("Received a PACKET_ENTITY_EQUIPMENT from the server:"); + AString HexDump; + CreateHexDump(HexDump, Metadata.data(), Metadata.size(), 32); + Log("Received a PACKET_ENTITY_METADATA from the server:"); Log(" EntityID = %d", EntityID); - Log(" SlotNum = %d", SlotNum); - Log(" Item = %s", Item.c_str()); + Log(" Metadata, length = %d (0x%x):\n%s", Metadata.length(), Metadata.length(), HexDump.c_str()); + LogMetadata(Metadata, 4); COPY_TO_CLIENT(); return true; } @@ -1321,15 +1344,19 @@ bool cConnection::HandleServerEntityEquipment(void) -bool cConnection::HandleServerEntityLook(void) +bool cConnection::HandleServerEntityProperties(void) { - HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); - HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Yaw); - HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Pitch); - Log("Received a PACKET_ENTITY_LOOK from the server:"); + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, Count); + Log("Received a PACKET_ENTITY_PROPERTIES from the server:"); Log(" EntityID = %d", EntityID); - Log(" Yaw = %d", Yaw); - Log(" Pitch = %d", Pitch); + Log(" Count = %d", Count); + for (int i = 0; i < Count; i++) + { + HANDLE_SERVER_PACKET_READ(ReadBEUTF16String16, AString, Key); + HANDLE_SERVER_PACKET_READ(ReadBEDouble, double, Value); + Log(" \"%s\" = %f", Key.c_str(), Value); + } // for i COPY_TO_CLIENT(); return true; } @@ -1432,8 +1459,8 @@ bool cConnection::HandleServerEntityVelocity(void) bool cConnection::HandleServerIncrementStatistic(void) { // 0xc8 - HANDLE_SERVER_PACKET_READ(ReadBEInt, int, StatisticID); - HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Amount); + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, StatisticID); + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, Amount); Log("Received a PACKET_INCREMENT_STATISTIC from the server:"); Log(" StatisticID = %d (0x%x)", StatisticID, StatisticID); Log(" Amount = %d", Amount); @@ -1648,12 +1675,12 @@ bool cConnection::HandleServerNamedSoundEffect(void) bool cConnection::HandleServerPlayerAbilities(void) { HANDLE_SERVER_PACKET_READ(ReadChar, char, Flags); - HANDLE_SERVER_PACKET_READ(ReadChar, char, FlyingSpeed); - HANDLE_SERVER_PACKET_READ(ReadChar, char, WalkingSpeed); + HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, FlyingSpeed); + HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, WalkingSpeed); Log("Received a PACKET_PLAYER_ABILITIES from the server:"); - Log(" Flags = 0x%x", Flags); - Log(" FlyingSpeed = %d", FlyingSpeed); - Log(" WalkingSpeed = %d", WalkingSpeed); + Log(" Flags = %d (0x%02x)", Flags, Flags); + Log(" FlyingSpeed = %f", FlyingSpeed); + Log(" WalkingSpeed = %f", WalkingSpeed); COPY_TO_CLIENT(); return true; } @@ -1994,7 +2021,7 @@ bool cConnection::HandleServerTimeUpdate(void) bool cConnection::HandleServerUpdateHealth(void) { - HANDLE_SERVER_PACKET_READ(ReadBEShort, short, Health); + HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, Health); HANDLE_SERVER_PACKET_READ(ReadBEShort, short, Food); HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, Saturation); Log("Received a PACKET_UPDATE_HEALTH from the server"); @@ -2096,11 +2123,21 @@ bool cConnection::HandleServerWindowOpen(void) HANDLE_SERVER_PACKET_READ(ReadBEUTF16String16, AString, Title); HANDLE_SERVER_PACKET_READ(ReadByte, Byte, NumSlots); HANDLE_SERVER_PACKET_READ(ReadByte, Byte, UseProvidedTitle); + int HorseInt = 0; + if (WindowType == 11) // Horse / Donkey / Mule + { + HANDLE_SERVER_PACKET_READ(ReadBEInt, int, intHorseInt); + HorseInt = intHorseInt; + } Log("Received a PACKET_WINDOW_OPEN from the server:"); Log(" WindowID = %d", WindowID); Log(" WindowType = %d", WindowType); Log(" Title = \"%s\", Use = %d", Title.c_str(), UseProvidedTitle); Log(" NumSlots = %d", NumSlots); + if (WindowType == 11) + { + Log(" HorseInt = %d (0x%08x)", HorseInt, HorseInt); + } COPY_TO_CLIENT(); return true; } diff --git a/ProtoProxy/Connection.h b/ProtoProxy/Connection.h index 1d2267f9e..013471302 100644 --- a/ProtoProxy/Connection.h +++ b/ProtoProxy/Connection.h @@ -140,10 +140,11 @@ protected: bool HandleServerEncryptionKeyRequest(void); bool HandleServerEncryptionKeyResponse(void); bool HandleServerEntity(void); - bool HandleServerEntityHeadLook(void); - bool HandleServerEntityMetadata(void); bool HandleServerEntityEquipment(void); + bool HandleServerEntityHeadLook(void); bool HandleServerEntityLook(void); + bool HandleServerEntityMetadata(void); + bool HandleServerEntityProperties(void); bool HandleServerEntityRelativeMove(void); bool HandleServerEntityRelativeMoveLook(void); bool HandleServerEntityStatus(void); diff --git a/ProtoProxy/ProtoProxy.txt b/ProtoProxy/ProtoProxy.txt index fde0d7778..d232d41fd 100644 --- a/ProtoProxy/ProtoProxy.txt +++ b/ProtoProxy/ProtoProxy.txt @@ -20,7 +20,7 @@ You need to set the server *not* to verify usernames ("online-mode=false" in ser ProtoProxy is not much dependent on the protocol - it will work with unknown packets, it just won't parse them into human-readable format. -The latest protocol which has been tested is 1.5.2 (#61). +The latest protocol which has been tested is 1.6.1 (#73). */ -- cgit v1.2.3