From 9012e834d7babadd3f2f2a41cbb8d03b8fb689a1 Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Wed, 31 Oct 2012 20:18:01 +0000 Subject: Initial 1.4.2 support. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1019 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Protocol/Protocol142.cpp | 112 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 source/Protocol/Protocol142.cpp (limited to 'source/Protocol/Protocol142.cpp') diff --git a/source/Protocol/Protocol142.cpp b/source/Protocol/Protocol142.cpp new file mode 100644 index 000000000..6784a8ea4 --- /dev/null +++ b/source/Protocol/Protocol142.cpp @@ -0,0 +1,112 @@ + +// Protocol142.cpp + +// Implements the cProtocol142 class representing the release 1.4.2 protocol (#47) + +#include "Globals.h" +#include "Protocol142.h" +#include "../Root.h" +#include "../Server.h" +#include "../ClientHandle.h" +#include "../../CryptoPP/randpool.h" +#include "../Item.h" +#include "ChunkDataSerializer.h" +#include "../Player.h" +#include "../Mobs/Monster.h" +#include "../UI/Window.h" +#include "../Pickup.h" + + + + + +#define HANDLE_PACKET_READ(Proc, Type, Var) \ + Type Var; \ + { \ + if (!m_ReceivedData.Proc(Var)) \ + { \ + return PARSE_INCOMPLETE; \ + } \ + } + + + + + +typedef unsigned char Byte; + + + + + +enum +{ + PACKET_UPDATE_TIME = 0x04, + PACKET_SOUND_PARTICLE_EFFECT = 0x3d +} ; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cProtocol142: + +cProtocol142::cProtocol142(cClientHandle * a_Client) : + super(a_Client) +{ + LOGD("Created cProtocol142 at %p", this); +} + + + + + +cProtocol142::~cProtocol142() +{ + if (!m_DataToSend.empty()) + { + LOGD("There are %d unsent bytes while deleting cProtocol142", m_DataToSend.size()); + } + LOGD("Deleted cProtocol142 at %p", this); +} + + + + + +int cProtocol142::ParseLogin(void) +{ + // This packet seems to be back in 1.4.2, no documentation yet. + return PARSE_OK; +} + + + + + +void cProtocol142::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_SOUND_PARTICLE_EFFECT); + WriteInt (a_EffectID); + WriteInt (a_SrcX / 8); + WriteByte(a_SrcY / 8); + WriteInt (a_SrcZ / 8); + WriteInt (a_Data); + WriteBool(0); + Flush(); +} + + + + + +void cProtocol142::SendTimeUpdate(Int64 a_WorldTime) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_UPDATE_TIME); + WriteInt64(1); + WriteInt64(a_WorldTime); + Flush(); +} \ No newline at end of file -- cgit v1.2.3