1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 08:57:44 +00:00
This commit is contained in:
amibu 2017-10-17 22:49:33 +02:00
parent b0a2eb853a
commit 4bb0cd0f7b
3 changed files with 3 additions and 6 deletions

View file

@ -98,5 +98,5 @@ void Core::Network::Packets::GamePacket::savePacket()
std::string Core::Network::Packets::GamePacket::toString() const std::string Core::Network::Packets::GamePacket::toString() const
{ {
return Core::Util::binaryToHexString( const_cast<uint8_t *>(&m_dataBuf[0]), getSize() ); return Core::Util::binaryToHexDump( const_cast<uint8_t *>( &m_dataBuf[0] ), getSize() );
} }

View file

@ -18,7 +18,7 @@ std::string Core::Util::binaryToHexString(uint8_t* pBinData, uint16_t size)
std::string Core::Util::binaryToHexDump( uint8_t* pBinData, uint16_t size ) std::string Core::Util::binaryToHexDump( uint8_t* pBinData, uint16_t size )
{ {
int bytesPerLine = 16; int bytesPerLine = 16;
std::string hexChars = "0123456789ABCDEF"; constexpr char hexChars[] = "0123456789ABCDEF";
int offsetBlock = 8 + 3; int offsetBlock = 8 + 3;
int byteBlock = offsetBlock + bytesPerLine * 3 + ( bytesPerLine - 1 ) / 8 + 2; int byteBlock = offsetBlock + bytesPerLine * 3 + ( bytesPerLine - 1 ) / 8 + 2;
@ -62,7 +62,7 @@ std::string Core::Util::binaryToHexDump( uint8_t* pBinData, uint16_t size )
uint8_t by = pBinData[i + j]; uint8_t by = pBinData[i + j];
line[hexColumn] = hexChars[( by >> 4 ) & 0xF]; line[hexColumn] = hexChars[( by >> 4 ) & 0xF];
line[hexColumn + 1] = hexChars[by & 0xF]; line[hexColumn + 1] = hexChars[by & 0xF];
line[charColumn] = by < 32 ? '.' : static_cast<char>(by); line[charColumn] = by < 32 ? '.' : static_cast<char>( by );
} }
hexColumn += 3; hexColumn += 3;

View file

@ -42,9 +42,6 @@ using namespace Core::Network::Packets::Server;
void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inPacket, void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inPacket,
Entity::PlayerPtr pPlayer ) Entity::PlayerPtr pPlayer )
{ {
g_log.debug( inPacket.toString() );
uint8_t type = inPacket.getValAt< uint32_t >( 0x21 ); uint8_t type = inPacket.getValAt< uint32_t >( 0x21 );
uint32_t action = inPacket.getValAt< uint32_t >( 0x24 ); uint32_t action = inPacket.getValAt< uint32_t >( 0x24 );