1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-24 05:37:45 +00:00

Changeable World name + MotD

This commit is contained in:
amibu 2017-09-10 02:24:29 +02:00
parent 9739b92c46
commit c6e208ffdf
6 changed files with 31 additions and 14 deletions

View file

@ -29,5 +29,8 @@
<AllowNoSessionConnect>false</AllowNoSessionConnect> <AllowNoSessionConnect>false</AllowNoSessionConnect>
<!-- The ID of the Sapphire world - this is what the game determines your datacenter with, check world.exh --> <!-- The ID of the Sapphire world - this is what the game determines your datacenter with, check world.exh -->
<WorldID>67</WorldID> <WorldID>67</WorldID>
<!-- The name of the world -->
<!-- TODO: Allow multiple world servers -->
<WorldName>Sapphire</WorldName>
</Parameters> </Parameters>
</Settings> </Settings>

View file

@ -17,4 +17,8 @@
</Mysql> </Mysql>
</General> </General>
<Parameters>
<!-- Message players see upon logging in -->
<MotD>&lt;&lt;&lt;Welcome to Sapphire&gt;&gt;&gt;</MotD>
</Parameters>
</Settings> </Settings>

View file

@ -136,10 +136,10 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
serverListPacket.data().seq = 1; serverListPacket.data().seq = 1;
serverListPacket.data().offset = 0; serverListPacket.data().offset = 0;
serverListPacket.data().numServers = 1; serverListPacket.data().numServers = 1;
serverListPacket.data().server[0].id = g_serverLobby.m_pConfig->getValue<uint16_t>( "Settings.Parameters.WorldID", 1 ); serverListPacket.data().server[0].id = g_serverLobby.getConfig()->getValue<uint16_t>( "Settings.Parameters.WorldID", 1 );
serverListPacket.data().server[0].index = 0; serverListPacket.data().server[0].index = 0;
serverListPacket.data().final = 1; 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 ); pRP.addPacket( serverListPacket );
@ -173,11 +173,11 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
auto& charEntry = charList[charIndex]; auto& charEntry = charList[charIndex];
details.uniqueId = get<1>( charEntry ); details.uniqueId = get<1>( charEntry );
details.contentId = get<2>( charEntry ); details.contentId = get<2>( charEntry );
details.serverId = g_serverLobby.m_pConfig->getValue<uint16_t>( "Settings.Parameters.WorldID", 1 ); details.serverId = g_serverLobby.getConfig()->getValue<uint16_t>( "Settings.Parameters.WorldID", 1 );
details.index = charIndex; details.index = charIndex;
strcpy( details.charDetailJson, get<3>( charEntry ).c_str() ); strcpy( details.charDetailJson, get<3>( charEntry ).c_str() );
strcpy( details.nameChara, get<0>( 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; 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().contentId = lookupId;
enterWorldPacket.data().seq = sequence; enterWorldPacket.data().seq = sequence;
strcpy( enterWorldPacket.data().host, g_serverLobby.m_pConfig->getValue< std::string >( "Settings.General.ZoneIp" ).c_str() ); strcpy( enterWorldPacket.data().host, g_serverLobby.getConfig()->getValue< std::string >( "Settings.General.ZoneIp" ).c_str() );
enterWorldPacket.data().port = g_serverLobby.m_pConfig->getValue< uint16_t >( "Settings.General.ZonePort" ); enterWorldPacket.data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "Settings.General.ZonePort" );
enterWorldPacket.data().charId = logInCharId; enterWorldPacket.data().charId = logInCharId;
memcpy( enterWorldPacket.data().sid, m_pSession->getSessionId(), 66 ); 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 ); LobbySessionPtr pSession = g_serverLobby.getSession( ( char* )&packet.data[0] + 0x20 );
if( g_serverLobby.m_pConfig->getValue<bool>( "Settings.Parameters.AllowNoSessionConnect" ) && pSession == nullptr ) if( g_serverLobby.getConfig()->getValue<bool>( "Settings.Parameters.AllowNoSessionConnect" ) && pSession == nullptr )
{ {
LobbySessionPtr session( new Core::LobbySession() ); LobbySessionPtr session( new Core::LobbySession() );
session->setAccountID( 0 ); session->setAccountID( 0 );
@ -324,7 +324,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
charCreatePacket.data().content_id = newContentId; charCreatePacket.data().content_id = newContentId;
strcpy( charCreatePacket.data().name, name.c_str() ); 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().type = 1;
charCreatePacket.data().seq = sequence; charCreatePacket.data().seq = sequence;
charCreatePacket.data().unknown = 1; charCreatePacket.data().unknown = 1;
@ -348,7 +348,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
charCreatePacket.data().content_id = newContentId; charCreatePacket.data().content_id = newContentId;
strcpy( charCreatePacket.data().name, name.c_str() ); 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().type = 2;
charCreatePacket.data().seq = sequence; charCreatePacket.data().seq = sequence;
charCreatePacket.data().unknown = 1; 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 = deletePlayer.getContentId();
charCreatePacket.data().content_id = 0; charCreatePacket.data().content_id = 0;
strcpy( charCreatePacket.data().name, name.c_str() ); 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().type = 4;
charCreatePacket.data().seq = sequence; charCreatePacket.data().seq = sequence;
charCreatePacket.data().unknown = 1; charCreatePacket.data().unknown = 1;

View file

@ -46,6 +46,11 @@ namespace Core {
return g_restConnector.getSession( sessionId ); return g_restConnector.getSession( sessionId );
} }
XMLConfigPtr ServerLobby::getConfig() const
{
return m_pConfig;
}
void ServerLobby::run( int32_t argc, char* argv[] ) void ServerLobby::run( int32_t argc, char* argv[] )
{ {
g_log.setLogPath( "log\\SapphireLobby" ); g_log.setLogPath( "log\\SapphireLobby" );

View file

@ -30,6 +30,8 @@ namespace Core
uint16_t m_port; uint16_t m_port;
std::string m_ip; std::string m_ip;
boost::shared_ptr<XMLConfig> m_pConfig;
public: public:
ServerLobby( const std::string& configPath ); ServerLobby( const std::string& configPath );
~ServerLobby( void ); ~ServerLobby( void );
@ -42,10 +44,11 @@ namespace Core
{ {
m_sessionMap[std::string( sessionId )] = pSession; m_sessionMap[std::string( sessionId )] = pSession;
} }
boost::shared_ptr<XMLConfig> getConfig() const;
LobbySessionPtr getSession( char* sessionId ); LobbySessionPtr getSession( char* sessionId );
uint32_t m_numConnections; uint32_t m_numConnections;
boost::shared_ptr<XMLConfig> m_pConfig;
}; };

View file

@ -2,6 +2,7 @@
#include <src/servers/Server_Common/Network/GamePacket.h> #include <src/servers/Server_Common/Network/GamePacket.h>
#include <src/servers/Server_Common/Logging/Logger.h> #include <src/servers/Server_Common/Logging/Logger.h>
#include <src/servers/Server_Common/Network/PacketContainer.h> #include <src/servers/Server_Common/Network/PacketContainer.h>
#include <src/servers/Server_Common/Config/XMLConfig.h>
#include "Player.h" #include "Player.h"
@ -18,8 +19,10 @@
#include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h" #include "src/servers/Server_Zone/Network/PacketWrappers/EventFinishPacket.h"
#include "src/servers/Server_Zone/Event/Event.h" #include "src/servers/Server_Zone/Event/Event.h"
#include "Server_Zone/ServerZone.h"
extern Core::Logger g_log; extern Core::Logger g_log;
extern Core::ServerZone g_serverZone;
using namespace Core::Common; using namespace Core::Common;
using namespace Core::Network::Packets; 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() void Core::Entity::Player::onLogin()
{ {
;
// TODO: Replace this with MoTD from config // TODO: Replace this with MoTD from config
sendNotice( "<<<Welcome to Sapphire>>>\nCompiled: " __DATE__ " " __TIME__ "\n" sendNotice( g_serverZone.getConfig()->getValue< std::string >( "Settings.Parameters.MotD", " <<<Welcome to Sapphire >>>" ) );
"Mind you, character data is going to be wiped regulary!" );
} }
void Core::Entity::Player::onZoneStart() void Core::Entity::Player::onZoneStart()