diff --git a/bin/config/settings_lobby.xml b/bin/config/settings_lobby.xml index dfcd4781..f41c6c7f 100644 --- a/bin/config/settings_lobby.xml +++ b/bin/config/settings_lobby.xml @@ -29,5 +29,8 @@ false 67 + + + Sapphire \ No newline at end of file diff --git a/bin/config/settings_zone.xml b/bin/config/settings_zone.xml index c4093b9a..a09254e9 100644 --- a/bin/config/settings_zone.xml +++ b/bin/config/settings_zone.xml @@ -17,4 +17,8 @@ + + + <<<Welcome to Sapphire>>> + diff --git a/src/servers/Server_Lobby/GameConnection.cpp b/src/servers/Server_Lobby/GameConnection.cpp index d0c6fe23..c9388e5d 100644 --- a/src/servers/Server_Lobby/GameConnection.cpp +++ b/src/servers/Server_Lobby/GameConnection.cpp @@ -136,10 +136,10 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui serverListPacket.data().seq = 1; serverListPacket.data().offset = 0; serverListPacket.data().numServers = 1; - serverListPacket.data().server[0].id = g_serverLobby.m_pConfig->getValue( "Settings.Parameters.WorldID", 1 ); + serverListPacket.data().server[0].id = g_serverLobby.getConfig()->getValue( "Settings.Parameters.WorldID", 1 ); serverListPacket.data().server[0].index = 0; serverListPacket.data().final = 1; - sprintf( serverListPacket.data().server[0].name, "Sapphire" ); + sprintf( serverListPacket.data().server[0].name, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() ); pRP.addPacket( serverListPacket ); @@ -173,11 +173,11 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui auto& charEntry = charList[charIndex]; details.uniqueId = get<1>( charEntry ); details.contentId = get<2>( charEntry ); - details.serverId = g_serverLobby.m_pConfig->getValue( "Settings.Parameters.WorldID", 1 ); + details.serverId = g_serverLobby.getConfig()->getValue( "Settings.Parameters.WorldID", 1 ); details.index = charIndex; strcpy( details.charDetailJson, get<3>( charEntry ).c_str() ); strcpy( details.nameChara, get<0>( charEntry ).c_str() ); - strcpy( details.nameServer, "Sapphire" ); + strcpy( details.nameServer, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() ); charListPacket.data().charaDetails[j] = details; @@ -243,8 +243,8 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin enterWorldPacket.data().contentId = lookupId; enterWorldPacket.data().seq = sequence; - strcpy( enterWorldPacket.data().host, g_serverLobby.m_pConfig->getValue< std::string >( "Settings.General.ZoneIp" ).c_str() ); - enterWorldPacket.data().port = g_serverLobby.m_pConfig->getValue< uint16_t >( "Settings.General.ZonePort" ); + strcpy( enterWorldPacket.data().host, g_serverLobby.getConfig()->getValue< std::string >( "Settings.General.ZoneIp" ).c_str() ); + enterWorldPacket.data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "Settings.General.ZonePort" ); enterWorldPacket.data().charId = logInCharId; memcpy( enterWorldPacket.data().sid, m_pSession->getSessionId(), 66 ); @@ -256,7 +256,7 @@ bool Core::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW& { LobbySessionPtr pSession = g_serverLobby.getSession( ( char* )&packet.data[0] + 0x20 ); - if( g_serverLobby.m_pConfig->getValue( "Settings.Parameters.AllowNoSessionConnect" ) && pSession == nullptr ) + if( g_serverLobby.getConfig()->getValue( "Settings.Parameters.AllowNoSessionConnect" ) && pSession == nullptr ) { LobbySessionPtr session( new Core::LobbySession() ); session->setAccountID( 0 ); @@ -324,7 +324,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac charCreatePacket.data().content_id = newContentId; strcpy( charCreatePacket.data().name, name.c_str() ); - strcpy( charCreatePacket.data().world, "Sapphire" ); + strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() ); charCreatePacket.data().type = 1; charCreatePacket.data().seq = sequence; charCreatePacket.data().unknown = 1; @@ -348,7 +348,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac charCreatePacket.data().content_id = newContentId; strcpy( charCreatePacket.data().name, name.c_str() ); - strcpy( charCreatePacket.data().world, "Sapphire" ); + strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() ); charCreatePacket.data().type = 2; charCreatePacket.data().seq = sequence; charCreatePacket.data().unknown = 1; @@ -379,7 +379,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac //charCreatePacket.data().content_id = deletePlayer.getContentId(); charCreatePacket.data().content_id = 0; strcpy( charCreatePacket.data().name, name.c_str() ); - strcpy( charCreatePacket.data().world, "Sapphire" ); + strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() ); charCreatePacket.data().type = 4; charCreatePacket.data().seq = sequence; charCreatePacket.data().unknown = 1; diff --git a/src/servers/Server_Lobby/ServerLobby.cpp b/src/servers/Server_Lobby/ServerLobby.cpp index 1e6e22a5..6c151da4 100644 --- a/src/servers/Server_Lobby/ServerLobby.cpp +++ b/src/servers/Server_Lobby/ServerLobby.cpp @@ -46,6 +46,11 @@ namespace Core { return g_restConnector.getSession( sessionId ); } + XMLConfigPtr ServerLobby::getConfig() const + { + return m_pConfig; + } + void ServerLobby::run( int32_t argc, char* argv[] ) { g_log.setLogPath( "log\\SapphireLobby" ); diff --git a/src/servers/Server_Lobby/ServerLobby.h b/src/servers/Server_Lobby/ServerLobby.h index 9b5caeb2..6b3b175f 100644 --- a/src/servers/Server_Lobby/ServerLobby.h +++ b/src/servers/Server_Lobby/ServerLobby.h @@ -30,6 +30,8 @@ namespace Core uint16_t m_port; std::string m_ip; + boost::shared_ptr m_pConfig; + public: ServerLobby( const std::string& configPath ); ~ServerLobby( void ); @@ -42,10 +44,11 @@ namespace Core { m_sessionMap[std::string( sessionId )] = pSession; } + + boost::shared_ptr getConfig() const; LobbySessionPtr getSession( char* sessionId ); uint32_t m_numConnections; - boost::shared_ptr m_pConfig; }; diff --git a/src/servers/Server_Zone/Actor/PlayerEvent.cpp b/src/servers/Server_Zone/Actor/PlayerEvent.cpp index d0a3613f..70817511 100644 --- a/src/servers/Server_Zone/Actor/PlayerEvent.cpp +++ b/src/servers/Server_Zone/Actor/PlayerEvent.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "Player.h" @@ -18,8 +19,10 @@ #include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h" #include "src/servers/Server_Zone/Event/Event.h" +#include "Server_Zone/ServerZone.h" extern Core::Logger g_log; +extern Core::ServerZone g_serverZone; using namespace Core::Common; using namespace Core::Network::Packets; @@ -231,10 +234,9 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer ) void Core::Entity::Player::onLogin() { - + ; // TODO: Replace this with MoTD from config - sendNotice( "<<>>\nCompiled: " __DATE__ " " __TIME__ "\n" - "Mind you, character data is going to be wiped regulary!" ); + sendNotice( g_serverZone.getConfig()->getValue< std::string >( "Settings.Parameters.MotD", " <<>>" ) ); } void Core::Entity::Player::onZoneStart()