1
0

ProtoProxy: Updated to protocol 1.6.1 (#73)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1648 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-07-05 20:56:54 +00:00
parent ae22e2545d
commit 1e37002528
3 changed files with 84 additions and 46 deletions

View File

@ -137,6 +137,7 @@ enum
PACKET_ENTITY_EFFECT = 0x29, PACKET_ENTITY_EFFECT = 0x29,
PACKET_ENTITY_EFFECT_REMOVE = 0x2a, PACKET_ENTITY_EFFECT_REMOVE = 0x2a,
PACKET_SET_EXPERIENCE = 0x2b, PACKET_SET_EXPERIENCE = 0x2b,
PACKET_ENTITY_PROPERTIES = 0x2c,
PACKET_MAP_CHUNK = 0x33, PACKET_MAP_CHUNK = 0x33,
PACKET_MULTI_BLOCK_CHANGE = 0x34, PACKET_MULTI_BLOCK_CHANGE = 0x34,
PACKET_BLOCK_CHANGE = 0x35, 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_HEAD_LOOK: HANDLE_SERVER_READ(HandleServerEntityHeadLook); break;
case PACKET_ENTITY_LOOK: HANDLE_SERVER_READ(HandleServerEntityLook); break; case PACKET_ENTITY_LOOK: HANDLE_SERVER_READ(HandleServerEntityLook); break;
case PACKET_ENTITY_METADATA: HANDLE_SERVER_READ(HandleServerEntityMetadata); 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: HANDLE_SERVER_READ(HandleServerEntityRelativeMove); break;
case PACKET_ENTITY_RELATIVE_MOVE_LOOK: HANDLE_SERVER_READ(HandleServerEntityRelativeMoveLook); break; case PACKET_ENTITY_RELATIVE_MOVE_LOOK: HANDLE_SERVER_READ(HandleServerEntityRelativeMoveLook); break;
case PACKET_ENTITY_STATUS: HANDLE_SERVER_READ(HandleServerEntityStatus); 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(ReadBEInt, int, PlayerID);
HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, ActionType); HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, ActionType);
HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, UnknownHorseVal);
Log("Received a PACKET_ENTITY_ACTION from the client:"); Log("Received a PACKET_ENTITY_ACTION from the client:");
Log(" PlayerID = %d", PlayerID); Log(" PlayerID = %d", PlayerID);
Log(" ActionType = %d", ActionType); Log(" ActionType = %d", ActionType);
Log(" UnknownHorseVal = %d (0x%08x)", UnknownHorseVal, UnknownHorseVal);
COPY_TO_SERVER(); COPY_TO_SERVER();
return true; return true;
} }
@ -911,12 +915,12 @@ bool cConnection::HandleClientPing(void)
bool cConnection::HandleClientPlayerAbilities(void) bool cConnection::HandleClientPlayerAbilities(void)
{ {
HANDLE_CLIENT_PACKET_READ(ReadChar, char, Flags); HANDLE_CLIENT_PACKET_READ(ReadChar, char, Flags);
HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, FlyingSpeed); HANDLE_CLIENT_PACKET_READ(ReadBEFloat, float, FlyingSpeed);
HANDLE_CLIENT_PACKET_READ(ReadByte, Byte, WalkingSpeed); HANDLE_CLIENT_PACKET_READ(ReadBEFloat, float, WalkingSpeed);
Log("Receives a PACKET_PLAYER_ABILITIES from the client:"); Log("Receives a PACKET_PLAYER_ABILITIES from the client:");
Log(" Flags = %d (0x%x)", Flags, Flags); Log(" Flags = %d (0x%02x)", Flags, Flags);
Log(" FlyingSpeed = %d", FlyingSpeed); Log(" FlyingSpeed = %f", FlyingSpeed);
Log(" WalkingSpeed = %d", WalkingSpeed); Log(" WalkingSpeed = %f", WalkingSpeed);
COPY_TO_SERVER(); COPY_TO_SERVER();
return true; return true;
} }
@ -1086,9 +1090,11 @@ bool cConnection::HandleServerAttachEntity(void)
{ {
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID);
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, VehicleID); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, VehicleID);
HANDLE_SERVER_PACKET_READ(ReadBool, bool, Leash);
Log("Received a PACKET_ATTACH_ENTITY from the server:"); Log("Received a PACKET_ATTACH_ENTITY from the server:");
Log(" EntityID = %d (0x%x)", EntityID, EntityID); Log(" EntityID = %d (0x%x)", EntityID, EntityID);
Log(" VehicleID = %d (0x%x)", VehicleID, VehicleID); Log(" VehicleID = %d (0x%x)", VehicleID, VehicleID);
Log(" Leash = %s", Leash ? "true" : "false");
COPY_TO_CLIENT(); COPY_TO_CLIENT();
return true; 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) bool cConnection::HandleServerEntityHeadLook(void)
{ {
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID);
@ -1278,6 +1305,23 @@ bool cConnection::HandleServerEntityHeadLook(void)
bool cConnection::HandleServerEntityLook(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:");
Log(" EntityID = %d", EntityID);
Log(" Yaw = %d", Yaw);
Log(" Pitch = %d", Pitch);
COPY_TO_CLIENT();
return true;
}
bool cConnection::HandleServerEntityMetadata(void) bool cConnection::HandleServerEntityMetadata(void)
{ {
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID);
@ -1300,36 +1344,19 @@ bool cConnection::HandleServerEntityMetadata(void)
bool cConnection::HandleServerEntityEquipment(void) bool cConnection::HandleServerEntityProperties(void)
{ {
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, EntityID);
HANDLE_SERVER_PACKET_READ(ReadBEShort, short, SlotNum); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, Count);
AString Item; Log("Received a PACKET_ENTITY_PROPERTIES from the server:");
if (!ParseSlot(m_ServerBuffer, Item)) Log(" EntityID = %d", EntityID);
Log(" Count = %d", Count);
for (int i = 0; i < Count; i++)
{ {
return false; HANDLE_SERVER_PACKET_READ(ReadBEUTF16String16, AString, Key);
} HANDLE_SERVER_PACKET_READ(ReadBEDouble, double, Value);
Log("Received a PACKET_ENTITY_EQUIPMENT from the server:"); Log(" \"%s\" = %f", Key.c_str(), Value);
Log(" EntityID = %d", EntityID); } // for i
Log(" SlotNum = %d", SlotNum);
Log(" Item = %s", Item.c_str());
COPY_TO_CLIENT();
return true;
}
bool cConnection::HandleServerEntityLook(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:");
Log(" EntityID = %d", EntityID);
Log(" Yaw = %d", Yaw);
Log(" Pitch = %d", Pitch);
COPY_TO_CLIENT(); COPY_TO_CLIENT();
return true; return true;
} }
@ -1433,7 +1460,7 @@ bool cConnection::HandleServerIncrementStatistic(void)
{ {
// 0xc8 // 0xc8
HANDLE_SERVER_PACKET_READ(ReadBEInt, int, StatisticID); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, StatisticID);
HANDLE_SERVER_PACKET_READ(ReadByte, Byte, Amount); HANDLE_SERVER_PACKET_READ(ReadBEInt, int, Amount);
Log("Received a PACKET_INCREMENT_STATISTIC from the server:"); Log("Received a PACKET_INCREMENT_STATISTIC from the server:");
Log(" StatisticID = %d (0x%x)", StatisticID, StatisticID); Log(" StatisticID = %d (0x%x)", StatisticID, StatisticID);
Log(" Amount = %d", Amount); Log(" Amount = %d", Amount);
@ -1648,12 +1675,12 @@ bool cConnection::HandleServerNamedSoundEffect(void)
bool cConnection::HandleServerPlayerAbilities(void) bool cConnection::HandleServerPlayerAbilities(void)
{ {
HANDLE_SERVER_PACKET_READ(ReadChar, char, Flags); HANDLE_SERVER_PACKET_READ(ReadChar, char, Flags);
HANDLE_SERVER_PACKET_READ(ReadChar, char, FlyingSpeed); HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, FlyingSpeed);
HANDLE_SERVER_PACKET_READ(ReadChar, char, WalkingSpeed); HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, WalkingSpeed);
Log("Received a PACKET_PLAYER_ABILITIES from the server:"); Log("Received a PACKET_PLAYER_ABILITIES from the server:");
Log(" Flags = 0x%x", Flags); Log(" Flags = %d (0x%02x)", Flags, Flags);
Log(" FlyingSpeed = %d", FlyingSpeed); Log(" FlyingSpeed = %f", FlyingSpeed);
Log(" WalkingSpeed = %d", WalkingSpeed); Log(" WalkingSpeed = %f", WalkingSpeed);
COPY_TO_CLIENT(); COPY_TO_CLIENT();
return true; return true;
} }
@ -1994,7 +2021,7 @@ bool cConnection::HandleServerTimeUpdate(void)
bool cConnection::HandleServerUpdateHealth(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(ReadBEShort, short, Food);
HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, Saturation); HANDLE_SERVER_PACKET_READ(ReadBEFloat, float, Saturation);
Log("Received a PACKET_UPDATE_HEALTH from the server"); 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(ReadBEUTF16String16, AString, Title);
HANDLE_SERVER_PACKET_READ(ReadByte, Byte, NumSlots); HANDLE_SERVER_PACKET_READ(ReadByte, Byte, NumSlots);
HANDLE_SERVER_PACKET_READ(ReadByte, Byte, UseProvidedTitle); 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("Received a PACKET_WINDOW_OPEN from the server:");
Log(" WindowID = %d", WindowID); Log(" WindowID = %d", WindowID);
Log(" WindowType = %d", WindowType); Log(" WindowType = %d", WindowType);
Log(" Title = \"%s\", Use = %d", Title.c_str(), UseProvidedTitle); Log(" Title = \"%s\", Use = %d", Title.c_str(), UseProvidedTitle);
Log(" NumSlots = %d", NumSlots); Log(" NumSlots = %d", NumSlots);
if (WindowType == 11)
{
Log(" HorseInt = %d (0x%08x)", HorseInt, HorseInt);
}
COPY_TO_CLIENT(); COPY_TO_CLIENT();
return true; return true;
} }

View File

@ -140,10 +140,11 @@ protected:
bool HandleServerEncryptionKeyRequest(void); bool HandleServerEncryptionKeyRequest(void);
bool HandleServerEncryptionKeyResponse(void); bool HandleServerEncryptionKeyResponse(void);
bool HandleServerEntity(void); bool HandleServerEntity(void);
bool HandleServerEntityHeadLook(void);
bool HandleServerEntityMetadata(void);
bool HandleServerEntityEquipment(void); bool HandleServerEntityEquipment(void);
bool HandleServerEntityHeadLook(void);
bool HandleServerEntityLook(void); bool HandleServerEntityLook(void);
bool HandleServerEntityMetadata(void);
bool HandleServerEntityProperties(void);
bool HandleServerEntityRelativeMove(void); bool HandleServerEntityRelativeMove(void);
bool HandleServerEntityRelativeMoveLook(void); bool HandleServerEntityRelativeMoveLook(void);
bool HandleServerEntityStatus(void); bool HandleServerEntityStatus(void);

View File

@ -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. 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).
*/ */