diff options
Diffstat (limited to '')
-rw-r--r-- | source/cClientHandle.cpp | 24 | ||||
-rw-r--r-- | source/packets/cPacket_Thunderbolt.cpp | 26 | ||||
-rw-r--r-- | source/packets/cPacket_Thunderbolt.h | 3 |
3 files changed, 42 insertions, 11 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 4c09c4309..f8a9ebd21 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -57,6 +57,7 @@ #include "packets/cPacket_EntityEquipment.h"
#include "packets/cPacket_CreateInventoryAction.h"
#include "packets/cPacket_NewInvalidState.h"
+#include "packets/cPacket_Thunderbolt.h" //for testing.
#include "packets/cPacket_UseEntity.h"
#include "packets/cPacket_WindowClose.h"
#include "packets/cPacket_13.h"
@@ -485,8 +486,9 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) break;
case E_BLOCK_DIG:
{
- LOG("TimeP: %f", m_Player->GetLastBlockActionTime() );
- LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() );
+
+ //LOG("TimeP: %f", m_Player->GetLastBlockActionTime() );
+ //LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() );
if ( cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime() < 0.1 ) { //only allow block interactions every 0.1 seconds
LOGWARN("Player %s tried to interact with a block too quickly! (could indicate bot)", GetUsername() );
m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time.
@@ -603,8 +605,8 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) break;
case E_BLOCK_PLACE:
{
- LOG("TimeP: %f", m_Player->GetLastBlockActionTime() );
- LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() );
+ //LOG("TimeP: %f", m_Player->GetLastBlockActionTime() );
+ //LOG("TimeN: %f", cRoot::Get()->GetWorld()->GetTime() );
if ( cRoot::Get()->GetWorld()->GetTime() - m_Player->GetLastBlockActionTime() < 0.1 ) { //only allow block interactions every 0.1 seconds
LOGWARN("Player %s tried to interact with a block too quickly! (could indicate bot)", GetUsername() );
m_Player->SetLastBlockActionTime(); //Player tried to interact with a block. Reset last block interation time.
@@ -642,10 +644,17 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) {
case E_BLOCK_WORKBENCH:
{
- LOG("WorkBench");
+ ////////////// For testing V
cPacket_NewInvalidState RainPacket;
RainPacket.m_Reason = 1; //begin rain
- Send( RainPacket );
+ Send( RainPacket );
+ //also strike table with lightning for test purposes
+ cPacket_Thunderbolt ThunderboltPacket;
+ ThunderboltPacket.m_xLBPos = PacketData->m_PosX;
+ ThunderboltPacket.m_yLBPos = PacketData->m_PosY;
+ ThunderboltPacket.m_zLBPos = PacketData->m_PosZ;
+ Send( ThunderboltPacket );
+ ////////////// For testing ^
bPlaceBlock = false;
cWindow* Window = new cCraftingWindow( 0, true );
m_Player->OpenWindow( Window );
@@ -654,10 +663,11 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) case E_BLOCK_FURNACE:
case E_BLOCK_CHEST:
{
- LOG("Chest");
+ ////////////// For testing V
cPacket_NewInvalidState RainPacket;
RainPacket.m_Reason = 2; //end rain
Send( RainPacket );
+ ////////////// For testing ^
bPlaceBlock = false;
cBlockEntity* BlockEntity = m_Player->GetWorld()->GetBlockEntity( PacketData->m_PosX, PacketData->m_PosY, PacketData->m_PosZ );
if( BlockEntity )
diff --git a/source/packets/cPacket_Thunderbolt.cpp b/source/packets/cPacket_Thunderbolt.cpp index c6fdefb60..dd61bc815 100644 --- a/source/packets/cPacket_Thunderbolt.cpp +++ b/source/packets/cPacket_Thunderbolt.cpp @@ -1,5 +1,20 @@ #include "cPacket_Thunderbolt.h" +cPacket_Thunderbolt::cPacket_Thunderbolt( const cPacket_Thunderbolt & a_Copy ) +{ + m_PacketID = E_THUNDERBOLT; + m_UniqueID = 237183; //just a random Ent ID. I don't think this matters at all. + m_Unknown = true; + m_xLBPos = a_Copy.m_xLBPos; + m_yLBPos = a_Copy.m_yLBPos; + m_zLBPos = a_Copy.m_zLBPos; +printf("blot-packet %i %i %i\n", m_xLBPos,m_yLBPos,m_zLBPos); + + + +} + + bool cPacket_Thunderbolt::Send(cSocket & a_Socket) { unsigned int TotalSize = c_Size; @@ -9,9 +24,14 @@ bool cPacket_Thunderbolt::Send(cSocket & a_Socket) AppendByte ( (char)m_PacketID, Message, i ); AppendInteger ( m_UniqueID, Message, i ); AppendBool ( m_Unknown, Message, i ); - AppendInteger ( m_xLBPos, Message, i ); - AppendInteger ( m_yLBPos, Message, i ); - AppendInteger ( m_zLBPos, Message, i ); + AppendInteger ( m_xLBPos*32, Message, i ); + AppendInteger ( m_yLBPos*32, Message, i ); + AppendInteger ( m_zLBPos*32, Message, i ); + + for( unsigned int iii = 1; iii < TotalSize; ++iii ){ + + printf("packetdata %i\n", (int)Message[iii]); + } bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) ); delete [] Message; diff --git a/source/packets/cPacket_Thunderbolt.h b/source/packets/cPacket_Thunderbolt.h index 51dad5814..8f7dfb60a 100644 --- a/source/packets/cPacket_Thunderbolt.h +++ b/source/packets/cPacket_Thunderbolt.h @@ -12,7 +12,8 @@ public: , m_xLBPos( 0 ) , m_yLBPos( 0 ) , m_zLBPos( 0 ) - { m_PacketID = E_THUNDERBOLT;} + { m_PacketID = E_THUNDERBOLT; m_Unknown = true; } + cPacket_Thunderbolt( const cPacket_Thunderbolt & a_Copy ); virtual cPacket* Clone() const { return new cPacket_Thunderbolt(*this); } bool Send(cSocket & a_Socket); |