1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 22:17:45 +00:00

merge config files and update config calls

This commit is contained in:
NotAdam 2018-10-25 17:48:22 +11:00
parent dc46fea1b0
commit d3872ef095
17 changed files with 219 additions and 157 deletions

58
bin/config/config.ini Normal file
View file

@ -0,0 +1,58 @@
[Database]
Host = 127.0.0.1
Port = 3306
Database = sapphire
Username = root
Password =
SyncThreads = 2
AsyncThreads = 2
[GlobalParameters]
ServerSecret = default
DataPath = /mnt/c/Program Files (x86)/Steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack
[GlobalNetwork]
; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server
ZoneHost = 127.0.0.1
ZonePort = 54992
LobbyHost = 127.0.0.1
LobbyPort = 54994
RestHost = 127.0.0.1
RestPort = 80
[Lobby]
WorldID = 67
AllowNoSessionConnect = false
WorldName = Sapphire
[LobbyNetwork]
ListenIp = 0.0.0.0
ListenPort = 54994
[CharacterCreation]
DefaultGMRank = 255
[RestNetwork]
ListenIp = 0.0.0.0
ListenPort = 80
[Scripts]
; where compiled script modules are located
Path = ./compiledscripts/
; relative to Path, where we copy and load modules from
CachePath = ./cache/
; whether we should detect changes to script modules and reload them
HotSwap = true
[Network]
DisconnectTimeout = 20
[ZoneNetwork]
ListenIp = 0.0.0.0
ListenPort = 54992
[General]
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/zone.ini

View file

@ -0,0 +1,58 @@
[Database]
Host = 127.0.0.1
Port = 3306
Database = sapphire
Username = sapphire
Password =
SyncThreads = 2
AsyncThreads = 2
[GlobalParameters]
ServerSecret = default
DataPath = C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
[GlobalNetwork]
; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server
ZoneHost = 127.0.0.1
ZonePort = 54992
LobbyHost = 127.0.0.1
LobbyPort = 54994
RestHost = 127.0.0.1
RestPort = 80
[Lobby]
WorldID = 67
AllowNoSessionConnect = false
WorldName = Sapphire
[LobbyNetwork]
ListenIp = 0.0.0.0
ListenPort = 54994
[CharacterCreation]
DefaultGMRank = 255
[RestNetwork]
ListenIp = 0.0.0.0
ListenPort = 80
[Scripts]
; where compiled script modules are located
Path = ./compiledscripts/
; relative to Path, where we copy and load modules from
CachePath = ./cache/
; whether we should detect changes to script modules and reload them
HotSwap = true
[Network]
DisconnectTimeout = 20
[ZoneNetwork]
ListenIp = 0.0.0.0
ListenPort = 54992
[General]
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/zone.ini

View file

@ -1,23 +0,0 @@
[Database]
Host = 127.0.0.1
Port = 3306
Database = sapphire
Username = root
Password =
SyncThreads = 2
AsyncThreads = 2
[GlobalParameters]
ServerSecret = default
DataPath = C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
[GlobalNetwork]
; Values definining how Users and other servers will access - these have to be set to your public IP when running a public server
ZoneHost = 127.0.0.1
ZonePort = 54992
LobbyHost = 127.0.0.1
LobbyPort = 54994
RestHost = 127.0.0.1
RestPort = 80

View file

@ -1,8 +0,0 @@
[Lobby]
WorldID = 67
AllowNoSessionConnect = false
WorldName = Sapphire
[LobbyNetwork]
ListenIp = 0.0.0.0
ListenPort = 54994

View file

@ -1,6 +0,0 @@
[CharacterCreation]
DefaultGMRank = 255
[RestNetwork]
ListenIp = 0.0.0.0
ListenPort = 80

View file

@ -1,18 +0,0 @@
[Scripts]
; where compiled script modules are located
Path = ./compiledscripts/
; relative to Path, where we copy and load modules from
CachePath = ./cache/
; whether we should detect changes to script modules and reload them
HotSwap = true
[Network]
DisconnectTimeout = 20
[ZoneNetwork]
ListenIp = 0.0.0.0
ListenPort = 54992
[General]
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/zone.ini

View file

@ -10,43 +10,44 @@
*/
bool Core::ConfigMgr::loadConfig( const std::string& configName )
{
std::stringstream configStream;
// std::stringstream configStream;
// get global config
auto configDir = std::experimental::filesystem::path( m_configFolderRoot );
if( !std::experimental::filesystem::exists( configDir ) )
{
return false;
}
// if( !std::experimental::filesystem::exists( configDir ) )
// {
// return false;
// }
auto globalConfig = std::experimental::filesystem::path( configDir / m_globalConfigFile );
if( !std::experimental::filesystem::exists( globalConfig ) )
{
if( !copyDefaultConfig( globalConfig.filename().string() ) )
return false;
}
// auto globalConfig = std::experimental::filesystem::path( configDir / m_globalConfigFile );
// if( !std::experimental::filesystem::exists( globalConfig ) )
// {
// if( !copyDefaultConfig( globalConfig.filename().string() ) )
// return false;
// }
std::ifstream globalConfigFile( globalConfig.c_str() );
configStream << globalConfigFile.rdbuf();
// std::ifstream globalConfigFile( globalConfig.c_str() );
// configStream << globalConfigFile.rdbuf();
// add some newlines just in case there's no newline at the end of the global file
configStream << "\n\n";
// // add some newlines just in case there's no newline at the end of the global file
// configStream << "\n\n";
// get local config
auto localConfig = std::experimental::filesystem::path( configDir / configName );
if( !std::experimental::filesystem::exists( localConfig ) )
{
if( !copyDefaultConfig( localConfig.filename().string() ) )
return false;
}
std::ifstream configFile( localConfig.c_str() );
configStream << configFile.rdbuf();
// // get local config
// auto localConfig = ;
// if( !std::experimental::filesystem::exists( localConfig ) )
// {
// if( !copyDefaultConfig( localConfig.filename().string() ) )
// return false;
// }
// std::ifstream configFile( localConfig.c_str() );
// configStream << configFile.rdbuf();
// parse the trxee and we're fuckin done
//boost::property_tree::read_ini( configStream, m_propTree );
// // parse the trxee and we're fuckin done
// //boost::property_tree::read_ini( configStream, m_propTree );
m_pInih = std::unique_ptr< INIReader >( new INIReader( localConfig ) );
m_pInih = std::unique_ptr< INIReader >( new INIReader(
std::experimental::filesystem::path( configDir / configName ) ) );
if( m_pInih->ParseError() < 0 )
return false;

View file

@ -20,30 +20,30 @@ public:
template<class T> struct always_false : std::false_type {};
template< class T >
T getValue( const std::string& name, T defaultValue = T() )
T getValue( const std::string& section, const std::string& name, T defaultValue = T() )
{
if constexpr (std::is_same_v<T, uint32_t>)
return m_pInih->GetInteger( "", name, defaultValue );
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr (std::is_same_v<T, int32_t>)
return m_pInih->GetInteger( "", name, defaultValue );
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr (std::is_same_v<T, uint16_t>)
return m_pInih->GetInteger( "", name, defaultValue );
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr (std::is_same_v<T, int16_t>)
return m_pInih->GetInteger( "", name, defaultValue );
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr (std::is_same_v<T, uint8_t>)
return m_pInih->GetInteger( "", name, defaultValue );
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr (std::is_same_v<T, int8_t>)
return m_pInih->GetInteger( "", name, defaultValue );
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr (std::is_same_v<T, long>)
return m_pInih->GetInteger( "", name, defaultValue );
return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr (std::is_same_v<T, double>)
return m_pInih->GetReal( "", name, defaultValue );
return m_pInih->GetReal( section, name, defaultValue );
else if constexpr (std::is_same_v<T, float>)
return m_pInih->GetReal( "", name, defaultValue );
return m_pInih->GetReal( section, name, defaultValue );
else if constexpr (std::is_same_v<T, std::string>)
return m_pInih->Get( "", name, defaultValue );
return m_pInih->Get( section, name, defaultValue );
else if constexpr (std::is_same_v<T, bool>)
return m_pInih->GetBoolean( "", name, defaultValue );
return m_pInih->GetBoolean( section, name, defaultValue );
else
static_assert(always_false<T>::value, "non-exhaustive getter!");
}

View file

@ -55,7 +55,7 @@ void default_resource_send( const HttpServer& server, const shared_ptr< HttpServ
auto m_pConfig = std::make_shared< Core::ConfigMgr >();
HttpServer server;
std::string configPath( "rest.ini" );
std::string configPath( "config.ini" );
void reloadConfig()
{
@ -143,7 +143,7 @@ bool loadSettings( int32_t argc, char* argv[] )
}
g_log.info( "Setting up generated EXD data" );
if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "GlobalParameters.DataPath", "" ) ) )
if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" ) ) )
{
g_log.fatal( "Error setting up generated EXD data " );
return false;
@ -152,21 +152,21 @@ bool loadSettings( int32_t argc, char* argv[] )
Core::Db::DbLoader loader;
Core::Db::ConnectionInfo info;
info.password = m_pConfig->getValue< std::string >( "Database.Password", "" );
info.host = m_pConfig->getValue< std::string >( "Database.Host", "127.0.0.1" );
info.database = m_pConfig->getValue< std::string >( "Database.Database", "sapphire" );
info.port = m_pConfig->getValue< uint16_t >( "Database.Port", 3306 );
info.user = m_pConfig->getValue< std::string >( "Database.Username", "root" );
info.syncThreads = m_pConfig->getValue< uint8_t >( "Database.SyncThreads", 2 );
info.asyncThreads = m_pConfig->getValue< uint8_t >( "Database.AsyncThreads", 2 );
info.password = m_pConfig->getValue< std::string >( "Database", "Password", "" );
info.host = m_pConfig->getValue< std::string >( "Database", "Host", "127.0.0.1" );
info.database = m_pConfig->getValue< std::string >( "Database", "Database", "sapphire" );
info.port = m_pConfig->getValue< uint16_t >( "Database", "Port", 3306 );
info.user = m_pConfig->getValue< std::string >( "Database", "Username", "root" );
info.syncThreads = m_pConfig->getValue< uint8_t >( "Database", "SyncThreads", 2 );
info.asyncThreads = m_pConfig->getValue< uint8_t >( "Database", "AsyncThreads", 2 );
loader.addDb( g_charaDb, info );
if( !loader.initDbs() )
return false;
server.config.port = static_cast< uint16_t >( std::stoul(
m_pConfig->getValue< std::string >( "RestNetwork.ListenPort", "80" ) ) );
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork.ListenIp", "0.0.0.0" );
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) );
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" );
g_log.info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
@ -270,9 +270,9 @@ void createAccount( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
{
std::string json_string = "{\"sId\":\"" + sId +
"\", \"lobbyHost\":\"" +
m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost" ) +
m_pConfig->getValue< std::string >( "GlobalNetwork", "LobbyHost" ) +
"\", \"frontierHost\":\"" +
m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + "\"}";
m_pConfig->getValue< std::string >( "GlobalNetwork", "RestHost" ) + "\"}";
*response << buildHttpResponse( 200, json_string, JSON );
}
else
@ -304,9 +304,9 @@ void login( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServer:
{
std::string json_string = "{\"sId\":\"" + sId +
"\", \"lobbyHost\":\"" +
m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost" ) +
m_pConfig->getValue< std::string >( "GlobalNetwork", "LobbyHost" ) +
"\", \"frontierHost\":\"" +
m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + "\"}";
m_pConfig->getValue< std::string >( "GlobalNetwork", "RestHost" ) + "\"}";
*response << buildHttpResponse( 200, json_string, JSON );
}
else
@ -337,7 +337,7 @@ void deleteCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
int32_t accountId = g_sapphireAPI.checkSession( sId );
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -378,7 +378,7 @@ void createCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
if( result != -1 )
{
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -386,7 +386,7 @@ void createCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
else
{
int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson, m_pConfig->getValue< uint8_t >(
"CharacterCreation.DefaultGMRank", 255 ) );
"CharacterCreation", "DefaultGMRank", 255 ) );
std::string json_string = "{\"result\":\"" + std::to_string( charId ) + "\"}";
*response << buildHttpResponse( 200, json_string, JSON );
@ -419,7 +419,7 @@ void insertSession( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
uint32_t accountId = pt.get< uint32_t >( "accountId" );
std::string secret = pt.get< string >( "secret" );
// reloadConfig();
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -453,7 +453,7 @@ void checkNameTaken( shared_ptr< HttpServer::Response > response, shared_ptr< Ht
// reloadConfig();
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -491,7 +491,7 @@ void checkSession( shared_ptr< HttpServer::Response > response, shared_ptr< Http
if( result != -1 )
{
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -528,7 +528,7 @@ void getNextCharId( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
// reloadConfig();
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -560,7 +560,7 @@ void getNextContentId( shared_ptr< HttpServer::Response > response, shared_ptr<
// reloadConfig();
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -596,7 +596,7 @@ void getCharacterList( shared_ptr< HttpServer::Response > response, shared_ptr<
if( result != -1 )
{
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
if( m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" ) != secret )
{
std::string json_string = "{\"result\":\"invalid_secret\"}";
*response << buildHttpResponse( 403, json_string, JSON );
@ -783,8 +783,8 @@ int main( int argc, char* argv[] )
server.start();
} );
g_log.info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork.ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "RestNetwork.ListenPort", "80" ) );
g_log.info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
//Wait for server to start so that the client can connect
this_thread::sleep_for( chrono::seconds( 1 ) );

View file

@ -126,11 +126,11 @@ 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.getConfig()->getValue< uint16_t >( "Lobby.WorldID", 1 );
serverListPacket->data().server[ 0 ].id = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby", "WorldID", 1 );
serverListPacket->data().server[ 0 ].index = 0;
serverListPacket->data().final = 1;
strcpy( serverListPacket->data().server[ 0 ].name,
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
g_serverLobby.getConfig()->getValue< std::string >( "Lobby", "WorldName", "Sapphire" ).c_str() );
pRP.addPacket( serverListPacket );
auto retainerListPacket = makeLobbyPacket< FFXIVIpcRetainerList >( tmpId );
@ -160,15 +160,15 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
auto& charEntry = charList[ charIndex ];
details.uniqueId = std::get< 1 >( charEntry );
details.contentId = std::get< 2 >( charEntry );
details.serverId = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby.WorldID", 1 );
details.serverId1 = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby.WorldID", 1 );
details.serverId = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby", "WorldID", 1 );
details.serverId1 = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby", "WorldID", 1 );
details.index = charIndex;
strcpy( details.charDetailJson, std::get< 3 >( charEntry ).c_str() );
strcpy( details.nameChara, std::get< 0 >( charEntry ).c_str() );
strcpy( details.nameServer,
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
g_serverLobby.getConfig()->getValue< std::string >( "Lobby", "WorldName", "Sapphire" ).c_str() );
strcpy( details.nameServer1,
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
g_serverLobby.getConfig()->getValue< std::string >( "Lobby", "WorldName", "Sapphire" ).c_str() );
charListPacket->data().charaDetails[ j ] = details;
@ -235,8 +235,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.getConfig()->getValue< std::string >( "GlobalNetwork.ZoneHost" ).c_str() );
enterWorldPacket->data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "GlobalNetwork.ZonePort" );
g_serverLobby.getConfig()->getValue< std::string >( "GlobalNetwork", "ZoneHost" ).c_str() );
enterWorldPacket->data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "GlobalNetwork", "ZonePort" );
enterWorldPacket->data().charId = logInCharId;
memcpy( enterWorldPacket->data().sid, m_pSession->getSessionId(), 66 );
pRP.addPacket( enterWorldPacket );
@ -247,7 +247,7 @@ bool Core::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW&
{
LobbySessionPtr pSession = g_serverLobby.getSession( ( char* ) &packet.data[ 0 ] + 0x20 );
if( g_serverLobby.getConfig()->getValue< bool >( "Lobby.AllowNoSessionConnect" ) && pSession == nullptr )
if( g_serverLobby.getConfig()->getValue< bool >( "Lobby", "AllowNoSessionConnect" ) && pSession == nullptr )
{
auto session = make_LobbySession();
session->setAccountID( 0 );
@ -318,7 +318,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,
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
g_serverLobby.getConfig()->getValue< std::string >( "Lobby", "WorldName", "Sapphire" ).c_str() );
charCreatePacket->data().type = 1;
charCreatePacket->data().seq = sequence;
charCreatePacket->data().unknown = 1;
@ -342,9 +342,9 @@ 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,
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
g_serverLobby.getConfig()->getValue< std::string >( "Lobby", "WorldName", "Sapphire" ).c_str() );
strcpy( charCreatePacket->data().world2,
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
g_serverLobby.getConfig()->getValue< std::string >( "Lobby", "WorldName", "Sapphire" ).c_str() );
charCreatePacket->data().type = 2;
charCreatePacket->data().seq = sequence;
charCreatePacket->data().unknown = 1;
@ -373,7 +373,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
charCreatePacket->data().content_id = 0;
strcpy( charCreatePacket->data().name, name.c_str() );
strcpy( charCreatePacket->data().world,
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
g_serverLobby.getConfig()->getValue< std::string >( "Lobby", "WorldName", "Sapphire" ).c_str() );
charCreatePacket->data().type = 4;
charCreatePacket->data().seq = sequence;
charCreatePacket->data().unknown = 1;

View file

@ -73,8 +73,8 @@ void ServerLobby::run( int32_t argc, char* argv[] )
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
g_log.info(
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork.ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "LobbyNetwork.ListenPort", "80" ) );
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) );
boost::thread_group worker_threads;
worker_threads.create_thread( boost::bind( &Network::Hive::Run, hive.get() ) );
@ -130,12 +130,12 @@ bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
}
}
m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork.ListenPort", 54994 );
m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork.ListenIp", "0.0.0.0" );
m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork", "ListenPort", 54994 );
m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" );
g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + ":" +
m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort" );
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" );
g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork", "RestHost" ) + ":" +
m_pConfig->getValue< std::string >( "GlobalNetwork", "RestPort" );
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" );
return true;
}

View file

@ -1,6 +1,6 @@
#include "ServerLobby.h"
Core::ServerLobby g_serverLobby( "lobby.ini" );
Core::ServerLobby g_serverLobby( "config.ini" );
int main( int32_t argc, char* argv[] )
{

View file

@ -333,7 +333,7 @@ void Core::Entity::Player::eventItemActionStart( uint32_t eventId,
void Core::Entity::Player::onLogin()
{
auto pConfig = g_fw.get< ConfigMgr >();
auto motd = pConfig->getValue< std::string >( "General.MotD", "" );
auto motd = pConfig->getValue< std::string >( "General", "MotD", "" );
std::istringstream ss( motd );
std::string msg;

View file

@ -61,7 +61,7 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st
}
// copy to temp dir
fs::path cacheDir( f.parent_path() /= pConfig->getValue< std::string >( "Scripts.CachePath", "./cache/" ) );
fs::path cacheDir( f.parent_path() /= pConfig->getValue< std::string >( "Scripts", "CachePath", "./cache/" ) );
fs::create_directories( cacheDir );
fs::path dest( cacheDir /= f.filename().string() );

View file

@ -56,7 +56,7 @@ bool Core::Scripting::ScriptMgr::init()
auto pConfig = g_fw.get< ConfigMgr >();
auto pLog = g_fw.get< Logger >();
auto status = loadDir( pConfig->getValue< std::string >( "Scripts.Path", "./compiledscripts/" ),
auto status = loadDir( pConfig->getValue< std::string >( "Scripts", "Path", "./compiledscripts/" ),
files, m_nativeScriptMgr->getModuleExtension() );
if( !status )
@ -90,11 +90,11 @@ bool Core::Scripting::ScriptMgr::init()
void Core::Scripting::ScriptMgr::watchDirectories()
{
auto pConfig = g_fw.get< ConfigMgr >();
auto shouldWatch = pConfig->getValue< bool >( "Scripts.HotSwap", true );
auto shouldWatch = pConfig->getValue< bool >( "Scripts", "HotSwap", true );
if( !shouldWatch )
return;
Watchdog::watchMany( pConfig->getValue< std::string >( "Scripts.Path", "./compiledscripts/" ) + "*" +
Watchdog::watchMany( pConfig->getValue< std::string >( "Scripts", "Path", "./compiledscripts/" ) + "*" +
m_nativeScriptMgr->getModuleExtension(),
[ this ]( const std::vector< ci::fs::path >& paths )
{

View file

@ -124,7 +124,7 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
}
pLog->info( "Setting up generated EXD data" );
if( !pExd->init( pConfig->getValue< std::string >( "GlobalParameters.DataPath", "" ) ) )
if( !pExd->init( pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" ) ) )
{
pLog->fatal( "Error setting up generated EXD data " );
return false;
@ -133,20 +133,20 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
Core::Db::DbLoader loader;
Core::Db::ConnectionInfo info;
info.password = pConfig->getValue< std::string >( "Database.Password", "" );
info.host = pConfig->getValue< std::string >( "Database.Host", "127.0.0.1" );
info.database = pConfig->getValue< std::string >( "Database.Database", "sapphire" );
info.port = pConfig->getValue< uint16_t >( "Database.Port", 3306 );
info.user = pConfig->getValue< std::string >( "Database.Username", "root" );
info.syncThreads = pConfig->getValue< uint8_t >( "Database.SyncThreads", 2 );
info.asyncThreads = pConfig->getValue< uint8_t >( "Database.AsyncThreads", 2 );
info.password = pConfig->getValue< std::string >( "Database", "Password", "" );
info.host = pConfig->getValue< std::string >( "Database", "Host", "127.0.0.1" );
info.database = pConfig->getValue< std::string >( "Database", "Database", "sapphire" );
info.port = pConfig->getValue< uint16_t >( "Database", "Port", 3306 );
info.user = pConfig->getValue< std::string >( "Database", "Username", "root" );
info.syncThreads = pConfig->getValue< uint8_t >( "Database", "SyncThreads", 2 );
info.asyncThreads = pConfig->getValue< uint8_t >( "Database", "AsyncThreads", 2 );
loader.addDb( *pDb, info );
if( !loader.initDbs() )
return false;
m_port = pConfig->getValue< uint16_t >( "ZoneNetwork.ListenPort", 54992 );
m_ip = pConfig->getValue< std::string >( "ZoneNetwork.ListenIp", "0.0.0.0" );
m_port = pConfig->getValue< uint16_t >( "ZoneNetwork", "ListenPort", 54992 );
m_ip = pConfig->getValue< std::string >( "ZoneNetwork", "ListenIp", "0.0.0.0" );
return true;
}

View file

@ -19,7 +19,7 @@ using namespace Core;
bool setupFramework()
{
auto pServer = std::make_shared< ServerZone >( "zone.ini" );
auto pServer = std::make_shared< ServerZone >( "config.ini" );
auto pLogger = std::make_shared< Logger >();
auto pExdData = std::make_shared< Data::ExdDataGenerated >();
auto pScript = std::make_shared< Scripting::ScriptMgr >();