diff --git a/src/api/PlayerMinimal.cpp b/src/api/PlayerMinimal.cpp index 37d08121..b95a3da1 100644 --- a/src/api/PlayerMinimal.cpp +++ b/src/api/PlayerMinimal.cpp @@ -8,7 +8,7 @@ extern Sapphire::Data::ExdDataGenerated g_exdDataGen; -namespace Sapphire::API { +namespace Sapphire::Api { using namespace Common; diff --git a/src/api/PlayerMinimal.h b/src/api/PlayerMinimal.h index a9af97bb..b137af20 100644 --- a/src/api/PlayerMinimal.h +++ b/src/api/PlayerMinimal.h @@ -5,7 +5,7 @@ #include #include -namespace Sapphire::API +namespace Sapphire::Api { class PlayerMinimal diff --git a/src/api/SapphireAPI.cpp b/src/api/SapphireApi.cpp similarity index 88% rename from src/api/SapphireAPI.cpp rename to src/api/SapphireApi.cpp index ed296ffd..f12da082 100644 --- a/src/api/SapphireAPI.cpp +++ b/src/api/SapphireApi.cpp @@ -1,4 +1,4 @@ -#include "SapphireAPI.h" +#include "SapphireApi.h" #include #include "Session.h" #include "PlayerMinimal.h" @@ -10,9 +10,9 @@ #include -using namespace Sapphire::API; +using namespace Sapphire::Api; -bool SapphireAPI::login( const std::string& username, const std::string& pass, std::string& sId ) +bool SapphireApi::login( const std::string& username, const std::string& pass, std::string& sId ) { std::string query = "SELECT account_id FROM accounts WHERE account_name = '" + username + "' AND account_pass = '" + pass + "';"; @@ -55,7 +55,7 @@ bool SapphireAPI::login( const std::string& username, const std::string& pass, s } -bool SapphireAPI::insertSession( const uint32_t accountId, std::string& sId ) +bool SapphireApi::insertSession( const uint32_t accountId, std::string& sId ) { // create session for the new sessionid and store to sessionlist auto pSession = std::make_shared< Session >(); @@ -68,7 +68,7 @@ bool SapphireAPI::insertSession( const uint32_t accountId, std::string& sId ) } -bool SapphireAPI::createAccount( const std::string& username, const std::string& pass, std::string& sId ) +bool SapphireApi::createAccount( const std::string& username, const std::string& pass, std::string& sId ) { // get account from login name auto pQR = g_charaDb.query( "SELECT account_id FROM accounts WHERE account_name = '" + username + "';" ); @@ -98,11 +98,11 @@ bool SapphireAPI::createAccount( const std::string& username, const std::string& } -int SapphireAPI::createCharacter( const uint32_t accountId, const std::string& name, - const std::string& infoJson, - const uint32_t gmRank ) +int SapphireApi::createCharacter( const uint32_t accountId, const std::string& name, + const std::string& infoJson, + const uint32_t gmRank ) { - API::PlayerMinimal newPlayer; + Api::PlayerMinimal newPlayer; newPlayer.setAccountId( accountId ); newPlayer.setId( getNextCharId() ); @@ -171,7 +171,7 @@ int SapphireAPI::createCharacter( const uint32_t accountId, const std::string& n return newPlayer.getAccountId(); } -void SapphireAPI::deleteCharacter( std::string name, const uint32_t accountId ) +void SapphireApi::deleteCharacter( std::string name, const uint32_t accountId ) { PlayerMinimal deletePlayer; auto charList = getCharList( accountId ); @@ -201,17 +201,17 @@ void SapphireAPI::deleteCharacter( std::string name, const uint32_t accountId ) g_charaDb.execute( "DELETE FROM charaquest WHERE CharacterId LIKE '" + std::to_string( id ) + "';" ); } -std::vector< PlayerMinimal > SapphireAPI::getCharList( uint32_t accountId ) +std::vector< PlayerMinimal > SapphireApi::getCharList( uint32_t accountId ) { - std::vector< API::PlayerMinimal > charList; + std::vector< Api::PlayerMinimal > charList; auto pQR = g_charaDb.query( "SELECT CharacterId, ContentId FROM charainfo WHERE AccountId = " + std::to_string( accountId ) + ";" ); while( pQR->next() ) { - API::PlayerMinimal player; + Api::PlayerMinimal player; uint32_t charId = pQR->getUInt( 1 ); @@ -222,7 +222,7 @@ std::vector< PlayerMinimal > SapphireAPI::getCharList( uint32_t accountId ) return charList; } -bool SapphireAPI::checkNameTaken( std::string name ) +bool SapphireApi::checkNameTaken( std::string name ) { g_charaDb.escapeString( name ); @@ -236,7 +236,7 @@ bool SapphireAPI::checkNameTaken( std::string name ) return true; } -uint32_t SapphireAPI::getNextCharId() +uint32_t SapphireApi::getNextCharId() { uint32_t charId = 0; @@ -252,7 +252,7 @@ uint32_t SapphireAPI::getNextCharId() return charId; } -uint64_t SapphireAPI::getNextContentId() +uint64_t SapphireApi::getNextContentId() { uint64_t contentId = 0; @@ -268,7 +268,7 @@ uint64_t SapphireAPI::getNextContentId() return contentId; } -int SapphireAPI::checkSession( const std::string& sId ) +int SapphireApi::checkSession( const std::string& sId ) { auto it = m_sessionMap.find( sId ); @@ -279,7 +279,7 @@ int SapphireAPI::checkSession( const std::string& sId ) } -bool SapphireAPI::removeSession( const std::string& sId ) +bool SapphireApi::removeSession( const std::string& sId ) { auto it = m_sessionMap.find( sId ); diff --git a/src/api/SapphireAPI.h b/src/api/SapphireApi.h similarity index 85% rename from src/api/SapphireAPI.h rename to src/api/SapphireApi.h index 222643b0..c11b3c89 100644 --- a/src/api/SapphireAPI.h +++ b/src/api/SapphireApi.h @@ -7,15 +7,15 @@ #include #include "PlayerMinimal.h" -namespace Sapphire::API +namespace Sapphire::Api { class Session; - class SapphireAPI + class SapphireApi { public: - SapphireAPI() = default; - ~SapphireAPI() = default; + SapphireApi() = default; + ~SapphireApi() = default; using SessionMap = std::map< std::string, std::shared_ptr< Session > >; @@ -30,7 +30,7 @@ namespace Sapphire::API bool insertSession( uint32_t accountId, std::string& sId ); - std::vector< API::PlayerMinimal > getCharList( uint32_t accountId ); + std::vector< Api::PlayerMinimal > getCharList( uint32_t accountId ); bool checkNameTaken( std::string name ); diff --git a/src/api/Session.cpp b/src/api/Session.cpp index b0992293..c5030b2f 100644 --- a/src/api/Session.cpp +++ b/src/api/Session.cpp @@ -1,6 +1,6 @@ #include "Session.h" -using namespace Sapphire::API; +using namespace Sapphire::Api; Session::Session() { diff --git a/src/api/Session.h b/src/api/Session.h index c6fc26fe..7bb0d71b 100644 --- a/src/api/Session.h +++ b/src/api/Session.h @@ -5,7 +5,7 @@ #include #include -namespace Sapphire::API +namespace Sapphire::Api { class Session diff --git a/src/api/main.cpp b/src/api/main.cpp index 191660e4..5d661387 100644 --- a/src/api/main.cpp +++ b/src/api/main.cpp @@ -29,7 +29,7 @@ #include #include -#include "SapphireAPI.h" +#include "SapphireApi.h" #include @@ -37,7 +37,7 @@ Sapphire::Common::Util::CrashHandler crashHandler; Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection > g_charaDb; Sapphire::Data::ExdDataGenerated g_exdDataGen; -Sapphire::API::SapphireAPI g_sapphireAPI; +Sapphire::Api::SapphireApi g_sapphireAPI; namespace fs = std::experimental::filesystem; diff --git a/src/common/Util/UtilMath.h b/src/common/Util/UtilMath.h index 93344253..c35ef6be 100644 --- a/src/common/Util/UtilMath.h +++ b/src/common/Util/UtilMath.h @@ -11,7 +11,7 @@ namespace Sapphire::Common::Util float distanceSq( float x, float y, float z, float x1, float y1, float z1 ); float distance( float x, float y, float z, float x1, float y1, float z1 ); - float distance( const Sapphire::Common::FFXIVARR_POSITION3& pos1, const Sapphire::Common::FFXIVARR_POSITION3& pos2 ); + float distance( const Common::FFXIVARR_POSITION3& pos1, const Common::FFXIVARR_POSITION3& pos2 ); float distance2DSq( float x, float y, float x1, float y1 ); diff --git a/src/lobby/Forwards.h b/src/lobby/Forwards.h index 58a724d6..1f54bcc7 100644 --- a/src/lobby/Forwards.h +++ b/src/lobby/Forwards.h @@ -20,10 +20,6 @@ namespace Sapphire namespace Sapphire::Lobby { TYPE_FORWARD( LobbySession ); -} - -namespace Sapphire::Lobby::Network -{ TYPE_FORWARD( GameConnection ); } diff --git a/src/lobby/GameConnection.cpp b/src/lobby/GameConnection.cpp index 034b4755..306874c0 100644 --- a/src/lobby/GameConnection.cpp +++ b/src/lobby/GameConnection.cpp @@ -22,9 +22,9 @@ using namespace Sapphire::Network::Packets; using namespace Sapphire::Network::Packets::Server; extern Lobby::ServerLobby g_serverLobby; -extern Lobby::Network::RestConnector g_restConnector; +extern Lobby::RestConnector g_restConnector; -Lobby::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive, +Lobby::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive, Sapphire::Network::AcceptorPtr pAcceptor, FrameworkPtr pFw ) : Sapphire::Network::Connection( pHive, pFw ), @@ -33,14 +33,14 @@ Lobby::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive { } -Lobby::Network::GameConnection::~GameConnection() +Lobby::GameConnection::~GameConnection() { } // overwrite the parents onConnect for our game socket needs -void Lobby::Network::GameConnection::onAccept( const std::string& host, uint16_t port ) +void Lobby::GameConnection::onAccept( const std::string& host, uint16_t port ) { auto connection = make_GameConnection( m_hive, m_pAcceptor, m_pFw ); m_pAcceptor->accept( connection ); @@ -49,12 +49,12 @@ void Lobby::Network::GameConnection::onAccept( const std::string& host, uint16_t } -void Lobby::Network::GameConnection::onDisconnect() +void Lobby::GameConnection::onDisconnect() { Logger::debug( "DISCONNECT" ); } -void Lobby::Network::GameConnection::onRecv( std::vector< uint8_t >& buffer ) +void Lobby::GameConnection::onRecv( std::vector< uint8_t >& buffer ) { m_packets.insert( std::end( m_packets ), std::begin( buffer ), std::end( buffer ) ); // This is assumed packet always start with valid FFXIVARR_PACKET_HEADER for now. @@ -72,9 +72,9 @@ void Lobby::Network::GameConnection::onRecv( std::vector< uint8_t >& buffer ) } // Dissect packet list - std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW > packetList; - const auto packetResult = Sapphire::Network::Packets::getPackets( m_packets, sizeof( struct FFXIVARR_PACKET_HEADER ), - packetHeader, packetList ); + std::vector< FFXIVARR_PACKET_RAW > packetList; + const auto packetResult = getPackets( m_packets, sizeof( struct FFXIVARR_PACKET_HEADER ), + packetHeader, packetList ); if( packetResult == Incomplete ) return; @@ -92,31 +92,31 @@ void Lobby::Network::GameConnection::onRecv( std::vector< uint8_t >& buffer ) } -void Lobby::Network::GameConnection::onError( const asio::error_code& error ) +void Lobby::GameConnection::onError( const asio::error_code& error ) { Logger::info( "GameConnection closed: {0}", error.message() ); } void -Lobby::Network::GameConnection::sendError( uint64_t sequence, uint32_t errorcode, uint16_t messageId, uint32_t tmpId ) +Lobby::GameConnection::sendError( uint64_t sequence, uint32_t errorcode, uint16_t messageId, uint32_t tmpId ) { auto errorPacket = makeLobbyPacket< FFXIVIpcLobbyError >( tmpId ); errorPacket->data().seq = sequence; errorPacket->data().error_id = errorcode; errorPacket->data().message_id = messageId; - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); pRP.addPacket( errorPacket ); sendPacket( pRP ); } -void Lobby::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) +void Lobby::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) { uint64_t sequence = *reinterpret_cast< uint64_t* >( &packet.data[ 0 ] + 0x10 ); Logger::info( "Sequence [{0}]", sequence ); Logger::info( "[{0}] ReqCharList", m_pSession->getAccountID() ); - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); auto serverListPacket = makeLobbyPacket< FFXIVIpcServerList >( tmpId ); serverListPacket->data().seq = 1; @@ -187,14 +187,14 @@ void Lobby::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, u charListPacket->data().counter = ( i * 4 ) + 1; charListPacket->data().unknown4 = 128; } - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); pRP.addPacket( charListPacket ); sendPacket( pRP ); } } -void Lobby::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) +void Lobby::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) { uint64_t sequence = *reinterpret_cast< uint64_t* >( &packet.data[ 0 ] + 0x10 ); Logger::info( "Sequence [{0}]", sequence ); @@ -223,7 +223,7 @@ void Lobby::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, ui Logger::info( "[{0}] Logging in as {1} ({2})", m_pSession->getAccountID(), logInCharName, logInCharId ); - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); auto enterWorldPacket = makeLobbyPacket< FFXIVIpcEnterWorld >( tmpId ); enterWorldPacket->data().contentId = lookupId; @@ -236,7 +236,7 @@ void Lobby::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, ui sendPacket( pRP ); } -bool Lobby::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) +bool Lobby::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) { LobbySessionPtr pSession = g_serverLobby.getSession( ( char* ) &packet.data[ 0 ] + 0x22 ); @@ -261,7 +261,7 @@ bool Lobby::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW serviceIdInfoPacket->data().u2 = 0x99; serviceIdInfoPacket->data().serviceAccount[ 0 ].id = 0x002E4A2B; - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); pRP.addPacket( serviceIdInfoPacket ); sendPacket( pRP ); } @@ -275,7 +275,7 @@ bool Lobby::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW return false; } -bool Lobby::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) +bool Lobby::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ) { uint64_t sequence = *reinterpret_cast< uint64_t* >( &packet.data[ 0 ] + 0x10 ); uint8_t type = *reinterpret_cast< uint8_t* >( &packet.data[ 0 ] + 0x29 ); @@ -294,7 +294,7 @@ bool Lobby::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pa Logger::info( "[{0}] Type 1: {1}", m_pSession->getAccountID(), name ); - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); m_pSession->newCharName = name; @@ -325,7 +325,7 @@ bool Lobby::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pa if( g_restConnector.createCharacter( ( char* ) m_pSession->getSessionId(), m_pSession->newCharName, charDetails ) != -1 ) { - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); auto charCreatePacket = makeLobbyPacket< FFXIVIpcCharCreate >( tmpId ); charCreatePacket->data().content_id = newContentId; @@ -367,7 +367,7 @@ bool Lobby::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pa charCreatePacket->data().unknown_7 = 1; charCreatePacket->data().unknown_8 = 1; - Packets::LobbyPacketContainer pRP( m_encKey ); + LobbyPacketContainer pRP( m_encKey ); pRP.addPacket( charCreatePacket ); sendPacket( pRP ); } @@ -383,7 +383,7 @@ bool Lobby::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pa return false; } -void Lobby::Network::GameConnection::handleGamePacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& packet ) +void Lobby::GameConnection::handleGamePacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& packet ) { uint32_t tmpId = packet.segHdr.target_actor; @@ -421,7 +421,7 @@ void Lobby::Network::GameConnection::handleGamePacket( Sapphire::Network::Packet } -void Lobby::Network::GameConnection::sendPacket( Packets::LobbyPacketContainer& pLpc ) +void Lobby::GameConnection::sendPacket( LobbyPacketContainer& pLpc ) { uint16_t size = pLpc.getSize(); uint8_t* dataPtr = pLpc.getRawData( false ); @@ -430,7 +430,7 @@ void Lobby::Network::GameConnection::sendPacket( Packets::LobbyPacketContainer& send( sendBuffer ); } -void Lobby::Network::GameConnection::sendPackets( Sapphire::Network::Packets::PacketContainer* pPacket ) +void Lobby::GameConnection::sendPackets( Sapphire::Network::Packets::PacketContainer* pPacket ) { std::vector< uint8_t > sendBuffer; @@ -438,14 +438,14 @@ void Lobby::Network::GameConnection::sendPackets( Sapphire::Network::Packets::Pa send( sendBuffer ); } -void Lobby::Network::GameConnection::sendSinglePacket( FFXIVPacketBasePtr pPacket ) +void Lobby::GameConnection::sendSinglePacket( FFXIVPacketBasePtr pPacket ) { PacketContainer pRP = PacketContainer(); pRP.addPacket( pPacket ); sendPackets( &pRP ); } -void Lobby::Network::GameConnection::generateEncryptionKey( uint32_t key, const std::string& keyPhrase ) +void Lobby::GameConnection::generateEncryptionKey( uint32_t key, const std::string& keyPhrase ) { memset( m_baseKey, 0, 0x2C ); m_baseKey[ 0 ] = 0x78; @@ -459,7 +459,7 @@ void Lobby::Network::GameConnection::generateEncryptionKey( uint32_t key, const Common::Util::md5( m_baseKey, m_encKey, 0x2C ); } -void Lobby::Network::GameConnection::handlePackets( const Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader, +void Lobby::GameConnection::handlePackets( const Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader, const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData ) { diff --git a/src/lobby/GameConnection.h b/src/lobby/GameConnection.h index 1ca20a89..fbed9386 100644 --- a/src/lobby/GameConnection.h +++ b/src/lobby/GameConnection.h @@ -16,10 +16,10 @@ #define DECLARE_HANDLER( x ) void x( Packets::GamePacketPtr pInPacket, Entity::PlayerPtr pPlayer ) -namespace Sapphire::Lobby::Network +namespace Sapphire::Lobby { - class GameConnection : public Sapphire::Network::Connection + class GameConnection : public Network::Connection { private: @@ -32,16 +32,16 @@ namespace Sapphire::Lobby::Network bool m_bEncryptionInitialized; - Sapphire::Network::AcceptorPtr m_pAcceptor; + Network::AcceptorPtr m_pAcceptor; LobbySessionPtr m_pSession; - Common::Util::LockedQueue< Sapphire::Network::Packets::GamePacketPtr > m_inQueue; - Common::Util::LockedQueue< Sapphire::Network::Packets::GamePacketPtr > m_outQueue; + Common::Util::LockedQueue< Network::Packets::GamePacketPtr > m_inQueue; + Common::Util::LockedQueue< Network::Packets::GamePacketPtr > m_outQueue; std::vector< uint8_t > m_packets; public: - GameConnection( Sapphire::Network::HivePtr pHive, Sapphire::Network::AcceptorPtr pAcceptor, FrameworkPtr pFw ); + GameConnection( Network::HivePtr pHive, Network::AcceptorPtr pAcceptor, FrameworkPtr pFw ); ~GameConnection(); @@ -58,26 +58,26 @@ namespace Sapphire::Lobby::Network void sendError( uint64_t sequence, uint32_t errorcode, uint16_t messageId, uint32_t tmpId ); - void getCharList( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + void getCharList( Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - void enterWorld( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + void enterWorld( Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - bool sendServiceAccountList( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + bool sendServiceAccountList( Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - bool createOrModifyChar( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + bool createOrModifyChar( Network::Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - void handlePackets( const Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader, - const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData ); + void handlePackets( const Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader, + const std::vector< Network::Packets::FFXIVARR_PACKET_RAW >& packetData ); - void handleGamePacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); + void handleGamePacket( Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); - void handlePacket( Sapphire::Network::Packets::FFXIVPacketBasePtr pPacket ); + void handlePacket( Network::Packets::FFXIVPacketBasePtr pPacket ); - void sendPackets( Sapphire::Network::Packets::PacketContainer* pPacket ); + void sendPackets( Network::Packets::PacketContainer* pPacket ); - void sendPacket( Packets::LobbyPacketContainer& pLpc ); + void sendPacket( Network::Packets::LobbyPacketContainer& pLpc ); - void sendSinglePacket( Sapphire::Network::Packets::FFXIVPacketBasePtr pPacket ); + void sendSinglePacket( Network::Packets::FFXIVPacketBasePtr pPacket ); }; diff --git a/src/lobby/LobbyPacketContainer.cpp b/src/lobby/LobbyPacketContainer.cpp index ae270d8f..fcd4e459 100644 --- a/src/lobby/LobbyPacketContainer.cpp +++ b/src/lobby/LobbyPacketContainer.cpp @@ -8,7 +8,7 @@ using namespace Sapphire; using namespace Sapphire::Common; using namespace Sapphire::Network::Packets; -Lobby::Network::Packets::LobbyPacketContainer::LobbyPacketContainer( uint8_t* encKey ) +LobbyPacketContainer::LobbyPacketContainer( uint8_t* encKey ) { memset( &m_header, 0, sizeof( Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER ) ); m_header.size = sizeof( Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER ); @@ -18,12 +18,12 @@ Lobby::Network::Packets::LobbyPacketContainer::LobbyPacketContainer( uint8_t* en memset( m_dataBuf, 0, 0x1570 ); } -Lobby::Network::Packets::LobbyPacketContainer::~LobbyPacketContainer() +LobbyPacketContainer::~LobbyPacketContainer() { m_entryList.clear(); } -void Lobby::Network::Packets::LobbyPacketContainer::addPacket( FFXIVPacketBasePtr pEntry ) +void LobbyPacketContainer::addPacket( FFXIVPacketBasePtr pEntry ) { memcpy( m_dataBuf + m_header.size, &pEntry->getData()[ 0 ], pEntry->getSize() ); @@ -39,12 +39,12 @@ void Lobby::Network::Packets::LobbyPacketContainer::addPacket( FFXIVPacketBasePt m_header.count++; } -uint16_t Lobby::Network::Packets::LobbyPacketContainer::getSize() const +uint16_t LobbyPacketContainer::getSize() const { return m_header.size; } -uint8_t* Lobby::Network::Packets::LobbyPacketContainer::getRawData( bool addstuff ) +uint8_t* LobbyPacketContainer::getRawData( bool addstuff ) { if( addstuff ) { diff --git a/src/lobby/LobbyPacketContainer.h b/src/lobby/LobbyPacketContainer.h index 44a5fd21..0ac3d0b5 100644 --- a/src/lobby/LobbyPacketContainer.h +++ b/src/lobby/LobbyPacketContainer.h @@ -9,7 +9,7 @@ #include "Forwards.h" -namespace Sapphire::Lobby::Network::Packets +namespace Sapphire::Network::Packets { using FFXIVPacketBasePtr = std::shared_ptr< Sapphire::Network::Packets::FFXIVPacketBase >; diff --git a/src/lobby/RestConnector.cpp b/src/lobby/RestConnector.cpp index 738af406..a8ee459f 100644 --- a/src/lobby/RestConnector.cpp +++ b/src/lobby/RestConnector.cpp @@ -12,17 +12,17 @@ using namespace Sapphire; typedef std::vector< std::tuple< std::string, uint32_t, uint64_t, std::string > > CharList; -Lobby::Network::RestConnector::RestConnector() +Lobby::RestConnector::RestConnector() { } -Lobby::Network::RestConnector::~RestConnector() +Lobby::RestConnector::~RestConnector() { } -HttpResponse Lobby::Network::RestConnector::requestApi( std::string endpoint, std::string data ) +HttpResponse Lobby::RestConnector::requestApi( std::string endpoint, std::string data ) { HttpClient client( restHost ); @@ -41,7 +41,7 @@ HttpResponse Lobby::Network::RestConnector::requestApi( std::string endpoint, st return r; } -Lobby::LobbySessionPtr Lobby::Network::RestConnector::getSession( char* sId ) +Lobby::LobbySessionPtr Lobby::RestConnector::getSession( char* sId ) { std::string json_string = "{\"sId\": \"" + std::string( sId ) + "\",\"secret\": \"" + serverSecret + "\"}"; @@ -83,7 +83,7 @@ Lobby::LobbySessionPtr Lobby::Network::RestConnector::getSession( char* sId ) } } -bool Lobby::Network::RestConnector::checkNameTaken( std::string name ) +bool Lobby::RestConnector::checkNameTaken( std::string name ) { std::string json_string = "{\"name\": \"" + name + "\",\"secret\": \"" + serverSecret + "\"}"; @@ -117,7 +117,7 @@ bool Lobby::Network::RestConnector::checkNameTaken( std::string name ) } } -uint32_t Lobby::Network::RestConnector::getNextCharId() +uint32_t Lobby::RestConnector::getNextCharId() { std::string json_string = "{\"secret\": \"" + serverSecret + "\"}"; @@ -156,7 +156,7 @@ uint32_t Lobby::Network::RestConnector::getNextCharId() } } -uint64_t Lobby::Network::RestConnector::getNextContentId() +uint64_t Lobby::RestConnector::getNextContentId() { std::string json_string = "{\"secret\": \"" + serverSecret + "\"}"; @@ -195,7 +195,7 @@ uint64_t Lobby::Network::RestConnector::getNextContentId() } } -CharList Lobby::Network::RestConnector::getCharList( char* sId ) +CharList Lobby::RestConnector::getCharList( char* sId ) { std::string json_string = "{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\"}"; @@ -251,7 +251,7 @@ CharList Lobby::Network::RestConnector::getCharList( char* sId ) } } -bool Lobby::Network::RestConnector::deleteCharacter( char* sId, std::string name ) +bool Lobby::RestConnector::deleteCharacter( char* sId, std::string name ) { std::string json_string = "{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name + "\"}"; @@ -285,7 +285,7 @@ bool Lobby::Network::RestConnector::deleteCharacter( char* sId, std::string name } } -int Lobby::Network::RestConnector::createCharacter( char* sId, std::string name, std::string infoJson ) +int Lobby::RestConnector::createCharacter( char* sId, std::string name, std::string infoJson ) { std::string json_string = "{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name + diff --git a/src/lobby/RestConnector.h b/src/lobby/RestConnector.h index 05461535..f361416c 100644 --- a/src/lobby/RestConnector.h +++ b/src/lobby/RestConnector.h @@ -15,7 +15,7 @@ namespace Sapphire class Session; } -namespace Sapphire::Lobby::Network +namespace Sapphire::Lobby { class LobbySession; diff --git a/src/lobby/ServerLobby.cpp b/src/lobby/ServerLobby.cpp index f8029b27..b85380c9 100644 --- a/src/lobby/ServerLobby.cpp +++ b/src/lobby/ServerLobby.cpp @@ -23,7 +23,7 @@ using namespace Sapphire; -Sapphire::Lobby::Network::RestConnector g_restConnector; +Sapphire::Lobby::RestConnector g_restConnector; namespace Sapphire::Lobby { @@ -65,9 +65,9 @@ namespace Sapphire::Lobby Logger::setLogLevel( m_config.global.general.logLevel ); - auto pFw = std::make_shared< Framework >(); - auto hive = Sapphire::Network::make_Hive(); - Sapphire::Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive, pFw ); + auto pFw = make_Framework(); + auto hive = Network::make_Hive(); + Network::addServerToHive< GameConnection >( m_ip, m_port, hive, pFw ); Logger::info( "Lobby server running on {0}:{1}", m_ip, m_port );