1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-23 05:07:46 +00:00

start moving old packets to new incoming packet system

This commit is contained in:
NotAdam 2018-07-06 22:43:49 +10:00
parent f774ba9d33
commit 09d00b8a7f
5 changed files with 48 additions and 19 deletions

View file

@ -195,7 +195,7 @@ public:
auto log = g_fw.get< Core::Logger >();
if( log )
{
log->debug( "rawpacket size" + std::to_string( rawPacket.segHdr.size ) + "\n" + Util::binaryToHexDump( const_cast< uint8_t* >( &rawPacket.data[0] ), rawPacket.segHdr.size ) );
log->debug( "rawpacket size " + std::to_string( rawPacket.segHdr.size ) + "\n" + Util::binaryToHexDump( const_cast< uint8_t* >( &rawPacket.data[0] ), rawPacket.segHdr.size ) );
log->debug( "T size " + std::to_string( sizeof( T ) ) + "\n" + Util::binaryToHexDump( reinterpret_cast< uint8_t* >( &m_data ), sizeof( T ) ) );
}

View file

@ -18,6 +18,34 @@ struct FFXIVIpcGmCommand1 : FFXIVIpcBasePacket< GMCommand1 >
/* 0018 */ uint32_t param3;
};
struct FFXIVIpcGmCommand2 : FFXIVIpcBasePacket< GMCommand2 >
{
/* 0000 */ uint32_t commandId;
/* 0004 */ char unk_4[0x10];
/* 0014 */ char param1[0x20];
};
struct FFXIVIpcClientTrigger : FFXIVIpcBasePacket< ClientTrigger >
{
/* 0000 */ uint16_t commandId;
/* 0002 */ char unk_2[2];
/* 0004 */ uint64_t param1;
/* 000C */ uint32_t param2;
/* 0010 */ char unk_10[8];
/* 0018 */ uint64_t param3;
};
struct FFXIVIpcSkillHandler : FFXIVIpcBasePacket< SkillHandler >
{
/* 0000 */ char pad_0000[1];
/* 0001 */ uint8_t type;
/* 0002 */ char pad_0002[2];
/* 0004 */ uint32_t actionId;
/* 0008 */ uint32_t useCount;
/* 000C */ char pad_000C[4];
/* 0010 */ uint64_t targetId;
};
}
}
}

View file

@ -7,6 +7,7 @@
#include <Exd/ExdDataGenerated.h>
#include <Network/PacketContainer.h>
#include <Network/CommonActorControl.h>
#include <Network/PacketDef/Zone/ClientZoneDef.h>
#include "Zone/Zone.h"
#include "Zone/ZonePosition.h"
@ -42,15 +43,16 @@ using namespace Core::Network::ActorControl;
void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
Entity::Player& player )
{
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
auto pLog = g_fw.get< Logger >();
uint16_t commandId = *reinterpret_cast< uint16_t* >( &copy.data[0x10] );
uint64_t param1 = *reinterpret_cast< uint64_t* >( &copy.data[0x14] );
uint32_t param11 = *reinterpret_cast< uint32_t* >( &copy.data[0x14] );
uint32_t param12 = *reinterpret_cast< uint32_t* >( &copy.data[0x18] );
uint32_t param2 = *reinterpret_cast< uint32_t* >( &copy.data[0x1C] );
uint64_t param3 = *reinterpret_cast< uint64_t* >( &copy.data[0x28] );
auto packet = ZoneChannelPacket< Client::FFXIVIpcClientTrigger >( inPacket );
auto commandId = packet.data().commandId;
auto param1 = packet.data().param1;
auto param11 = *reinterpret_cast< uint32_t* >( &packet.data().param1 );
auto param12 = *reinterpret_cast< uint32_t* >( &packet.data().param1 + sizeof( uint32_t ) );
auto param2 = packet.data().param2;
auto param3 = packet.data().param3;
pLog->debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) +

View file

@ -489,10 +489,10 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R
auto pLog = g_fw.get< Logger >();
auto pServerZone = g_fw.get< ServerZone >();
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
auto commandId = *reinterpret_cast< uint32_t* >( &copy.data[0x10] );
auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand2 >( inPacket );
auto param1 = std::string( reinterpret_cast< char* >( &copy.data[0x24] ) );
auto commandId = packet.data().commandId;
auto param1 = std::string( packet.data().param1 );
pLog->debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );

View file

@ -6,6 +6,7 @@
#include <Network/GamePacketNew.h>
#include <Network/PacketContainer.h>
#include <Network/CommonActorControl.h>
#include <Network/PacketDef/Zone/ClientZoneDef.h>
#include <Logging/Logger.h>
#include "Network/GameConnection.h"
@ -38,14 +39,12 @@ using namespace Core::Network::ActorControl;
void Core::Network::GameConnection::skillHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
Entity::Player& player )
{
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
auto packet = ZoneChannelPacket< Client::FFXIVIpcSkillHandler >( inPacket );
uint8_t type = inPacket.data[0x11];
auto action = *reinterpret_cast< uint32_t* >( &copy.data[0x14] );
auto useCount = *reinterpret_cast< uint32_t* >( &copy.data[0x18] );
auto targetId = *reinterpret_cast< uint64_t* >( &copy.data[0x20] );
auto type = packet.data().type;
auto action = packet.data().actionId;
auto useCount = packet.data().useCount;
auto targetId = packet.data().targetId;
player.sendDebug( "Skill type:" + std::to_string( type ) );