diff --git a/src/api/main.cpp b/src/api/main.cpp index 7b2dff21..81aa0024 100644 --- a/src/api/main.cpp +++ b/src/api/main.cpp @@ -27,13 +27,11 @@ #include #include +#include #include "Forwards.h" #include "SapphireAPI.h" - -Sapphire::Framework g_fw; -Sapphire::Logger g_log; Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection > g_charaDb; Sapphire::Data::ExdDataGenerated g_exdDataGen; Sapphire::Network::SapphireAPI g_sapphireAPI; @@ -41,6 +39,7 @@ Sapphire::Network::SapphireAPI g_sapphireAPI; namespace fs = std::experimental::filesystem; using namespace std; +using namespace Sapphire; using HttpServer = SimpleWeb::Server< SimpleWeb::HTTP >; using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >; @@ -64,17 +63,17 @@ void reloadConfig() void print_request_info( shared_ptr< HttpServer::Request > request ) { - g_log.info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" ); + Logger::info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" ); } bool loadSettings( int32_t argc, char* argv[] ) { - g_log.info( "Loading config " + configPath ); + Logger::info( "Loading config " + configPath ); if( !m_pConfig->loadConfig( configPath ) ) { - g_log.fatal( "Error loading config " + configPath ); - g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." ); + Logger::fatal( "Error loading config " + configPath ); + Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." ); return false; } @@ -135,17 +134,17 @@ bool loadSettings( int32_t argc, char* argv[] ) } catch( ... ) { - g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" ); - g_log.error( "Usage: \n" ); + Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" ); + Logger::error( "Usage: \n" ); } } - g_log.info( "Setting up generated EXD data" ); + Logger::info( "Setting up generated EXD data" ); auto dataPath = m_pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" ); if( !g_exdDataGen.init( dataPath ) ) { - g_log.fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" ); - g_log.fatal( "DataPath: " + dataPath ); + Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" ); + Logger::fatal( "DataPath: " + dataPath ); return false; } @@ -168,7 +167,7 @@ bool loadSettings( int32_t argc, char* argv[] ) 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 ) ); + Logger::info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) ); return true; } @@ -279,7 +278,7 @@ void createAccount( shared_ptr< HttpServer::Response > response, shared_ptr< Htt catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -313,7 +312,7 @@ void login( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServer: catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -348,7 +347,7 @@ void deleteCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -396,7 +395,7 @@ void createCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -429,7 +428,7 @@ void insertSession( shared_ptr< HttpServer::Response > response, shared_ptr< Htt catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -464,7 +463,7 @@ void checkNameTaken( shared_ptr< HttpServer::Response > response, shared_ptr< Ht catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -506,7 +505,7 @@ void checkSession( shared_ptr< HttpServer::Response > response, shared_ptr< Http catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -536,7 +535,7 @@ void getNextCharId( shared_ptr< HttpServer::Response > response, shared_ptr< Htt catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -567,7 +566,7 @@ void getNextContentId( shared_ptr< HttpServer::Response > response, shared_ptr< catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -623,7 +622,7 @@ void getCharacterList( shared_ptr< HttpServer::Response > response, shared_ptr< catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -658,7 +657,7 @@ void get_init( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServ catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -692,7 +691,7 @@ void get_headline_all( shared_ptr< HttpServer::Response > response, shared_ptr< catch( exception& e ) { *response << buildHttpResponse( 500 ); - g_log.error( e.what() ); + Logger::error( e.what() ); } } @@ -735,16 +734,13 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe int main( int argc, char* argv[] ) { - auto pLog = std::shared_ptr< Sapphire::Logger >( new Sapphire::Logger() ); - g_fw.set< Sapphire::Logger >( pLog ); - g_log.setLogPath( "log/SapphireAPI" ); - g_log.init(); + Logger::init( "log/SapphireAPI" ); - g_log.info( "===========================================================" ); - g_log.info( "Sapphire API Server " ); - g_log.info( "Version: 0.0.1" ); - g_log.info( "Compiled: " __DATE__ " " __TIME__ ); - g_log.info( "===========================================================" ); + Logger::info( "===========================================================" ); + Logger::info( "Sapphire API Server " ); + Logger::info( "Version: 0.0.1" ); + Logger::info( "Compiled: " __DATE__ " " __TIME__ ); + Logger::info( "===========================================================" ); if( !loadSettings( argc, argv ) ) throw std::exception(); @@ -771,8 +767,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" ) ); + Logger::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 ) ); diff --git a/src/common/Common.h b/src/common/Common.h index fdb52426..29296509 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -785,10 +785,10 @@ namespace Sapphire::Common ExteriorWall, ExteriorWindow, ExteriorDoor, - OtherFloorWall, - OtherFloorFlooring, - BasementWall, - YardSign + ExteriorRoofDecoration, + ExteriorWallDecoration, + ExteriorPlacard, + ExteriorFence }; enum HousingInteriorSlot diff --git a/src/common/Database/DbConnection.cpp b/src/common/Database/DbConnection.cpp index eb9c920e..eeb301a0 100644 --- a/src/common/Database/DbConnection.cpp +++ b/src/common/Database/DbConnection.cpp @@ -6,8 +6,6 @@ #include "PreparedStatement.h" #include "Framework.h" -extern Sapphire::Framework g_fw; - Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) : m_reconnecting( false ), m_prepareError( false ), @@ -66,7 +64,7 @@ uint32_t Sapphire::Db::DbConnection::open() } catch( std::runtime_error& e ) { - g_fw.get< Logger >()->error( e.what() ); + Logger::error( e.what() ); return 1; } @@ -118,7 +116,7 @@ bool Sapphire::Db::DbConnection::execute( const std::string& sql ) } catch( std::runtime_error& e ) { - g_fw.get< Logger >()->error( e.what() ); + Logger::error( e.what() ); return false; } } @@ -133,7 +131,7 @@ std::shared_ptr< Mysql::ResultSet > Sapphire::Db::DbConnection::query( const std } catch( std::runtime_error& e ) { - g_fw.get< Logger >()->error( e.what() ); + Logger::error( e.what() ); return nullptr; } } @@ -170,7 +168,7 @@ Sapphire::Db::DbConnection::query( std::shared_ptr< Sapphire::Db::PreparedStatem } catch( std::runtime_error& e ) { - g_fw.get< Logger >()->error( e.what() ); + Logger::error( e.what() ); return nullptr; } @@ -196,7 +194,7 @@ bool Sapphire::Db::DbConnection::execute( std::shared_ptr< Sapphire::Db::Prepare } catch( std::runtime_error& e ) { - g_fw.get< Logger >()->error( e.what() ); + Logger::error( e.what() ); return false; } } @@ -232,7 +230,7 @@ void Sapphire::Db::DbConnection::prepareStatement( uint32_t index, const std::st } catch( std::runtime_error& e ) { - g_fw.get< Logger >()->error( e.what() ); + Logger::error( e.what() ); m_prepareError = true; } diff --git a/src/common/Database/DbLoader.cpp b/src/common/Database/DbLoader.cpp index 5479874e..1d6b52be 100644 --- a/src/common/Database/DbLoader.cpp +++ b/src/common/Database/DbLoader.cpp @@ -3,9 +3,6 @@ #include "ZoneDbConnection.h" #include "DbWorkerPool.h" #include "Logging/Logger.h" -#include "Framework.h" - -extern Sapphire::Framework g_fw; Sapphire::Db::DbLoader::DbLoader() { @@ -17,14 +14,12 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo m_open.push( [ this, info, &pool ]()->bool { - - auto pLog = g_fw.get< Logger >(); const uint8_t asyncThreads = info.asyncThreads; const uint8_t synchThreads = info.syncThreads; if( asyncThreads < 1 || asyncThreads > 32 ) { - pLog->error( + Logger::error( "database: invalid number of worker threads specified. Please pick a value between 1 and 32." ); return false; } @@ -40,7 +35,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo if( error ) { - pLog->error( "DatabasePool failed to open." ); + Logger::error( "DatabasePool failed to open." ); return false; } } @@ -55,8 +50,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo { if( !pool.prepareStatements() ) { - auto pLog = g_fw.get< Logger >(); - pLog->error( "Could not prepare statements of the database, see log for details." ); + Logger::error( "Could not prepare statements of the database, see log for details." ); return false; } return true; diff --git a/src/common/Database/DbWorkerPool.cpp b/src/common/Database/DbWorkerPool.cpp index 9d154967..2b07acca 100644 --- a/src/common/Database/DbWorkerPool.cpp +++ b/src/common/Database/DbWorkerPool.cpp @@ -10,8 +10,6 @@ #include "Logging/Logger.h" #include -extern Sapphire::Framework g_fw; - class PingOperation : public Sapphire::Db::Operation { @@ -23,8 +21,7 @@ class PingOperation : }; template< class T > -Sapphire::Db::DbWorkerPool< T >::DbWorkerPool() - : +Sapphire::Db::DbWorkerPool< T >::DbWorkerPool() : m_queue( new Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >() ), m_asyncThreads( 0 ), m_synchThreads( 0 ) @@ -39,8 +36,8 @@ Sapphire::Db::DbWorkerPool< T >::~DbWorkerPool() template< class T > void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& info, - uint8_t asyncThreads, - uint8_t synchThreads ) + uint8_t asyncThreads, + uint8_t synchThreads ) { m_connectionInfo = info; m_asyncThreads = asyncThreads; @@ -50,10 +47,9 @@ void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& i template< class T > uint32_t Sapphire::Db::DbWorkerPool< T >::open() { - auto pLog = g_fw.get< Logger >(); - pLog->info( "[DbPool] Opening DatabasePool " + getDatabaseName() + - " Asynchronous connections: " + std::to_string( m_asyncThreads ) + - " Synchronous connections: " + std::to_string( m_synchThreads ) ); + Logger::info( "[DbPool] Opening DatabasePool " + getDatabaseName() + + " Asynchronous connections: " + std::to_string( m_asyncThreads ) + + " Synchronous connections: " + std::to_string( m_synchThreads ) ); uint32_t error = openConnections( IDX_ASYNC, m_asyncThreads ); @@ -64,9 +60,9 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open() if( !error ) { - pLog->info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " + - std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) + - " total connections running." ); + Logger::info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " + + std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) + + " total connections running." ); } return error; @@ -75,11 +71,10 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open() template< class T > void Sapphire::Db::DbWorkerPool< T >::close() { - auto pLog = g_fw.get< Logger >(); - pLog->info( "[DbPool] Closing down DatabasePool " + getDatabaseName() ); + Logger::info( "[DbPool] Closing down DatabasePool " + getDatabaseName() ); m_connections[ IDX_ASYNC ].clear(); m_connections[ IDX_SYNCH ].clear(); - pLog->info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." ); + Logger::info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." ); } template< class T > diff --git a/src/common/Forwards.h b/src/common/Forwards.h index 797b70fe..1746b883 100644 --- a/src/common/Forwards.h +++ b/src/common/Forwards.h @@ -8,6 +8,8 @@ namespace Sapphire class ConfigMgr; using ConfigMgrPtr = std::shared_ptr< ConfigMgr >; + class Framework; + using FrameworkPtr = std::shared_ptr< Framework >; namespace Network { diff --git a/src/common/Logging/Logger.cpp b/src/common/Logging/Logger.cpp index 2282641f..1a599551 100644 --- a/src/common/Logging/Logger.cpp +++ b/src/common/Logging/Logger.cpp @@ -23,7 +23,7 @@ namespace Sapphire } - void Logger::setLogPath( const std::string& logPath ) + void Logger::init( const std::string& logPath ) { auto pos = logPath.find_last_of( '/' ); @@ -33,15 +33,10 @@ namespace Sapphire fs::create_directories( realPath ); } - m_logFile = logPath; - } - - void Logger::init() - { spdlog::init_thread_pool( 8192, 1 ); auto stdout_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >(); - auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( m_logFile + ".log", 0, 0 ); + auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( logPath + ".log", 0, 0 ); std::vector< spdlog::sink_ptr > sinks { stdout_sink, daily_sink }; diff --git a/src/common/Logging/Logger.h b/src/common/Logging/Logger.h index 8c48aa69..876fadc3 100644 --- a/src/common/Logging/Logger.h +++ b/src/common/Logging/Logger.h @@ -11,23 +11,20 @@ namespace Sapphire private: std::string m_logFile; - - public: Logger(); - ~Logger(); - void init(); + public: - void error( const std::string& text ); + static void init( const std::string& logPath ); - void info( const std::string& text ); + static void error( const std::string& text ); - void debug( const std::string& text ); + static void info( const std::string& text ); - void fatal( const std::string& text ); + static void debug( const std::string& text ); - void setLogPath( const std::string& logPath ); + static void fatal( const std::string& text ); }; diff --git a/src/common/Network/CommonActorControl.h b/src/common/Network/CommonActorControl.h index 9c03d685..6438bc49 100644 --- a/src/common/Network/CommonActorControl.h +++ b/src/common/Network/CommonActorControl.h @@ -346,6 +346,7 @@ enum ActorControlType : uint16_t RequestEstateEditGreeting = 0x45B, RequestEstateGreeting = 0x45C, // sends FFXIVIpcHousingEstateGreeting in return RequestEstateEditGuestAccessSettings = 0x45D, + UpdateEstateGuestAccess = 0x45E, RequestEstateTagSettings = 0x45F, RequestEstateInventory = 0x0461, RequestHousingItemUI = 0x463, diff --git a/src/common/Network/Connection.cpp b/src/common/Network/Connection.cpp index 357155b6..c23165df 100644 --- a/src/common/Network/Connection.cpp +++ b/src/common/Network/Connection.cpp @@ -1,17 +1,19 @@ #include "Connection.h" #include "Hive.h" #include +#include "Framework.h" namespace Sapphire { namespace Network { //----------------------------------------------------------------------------- -Connection::Connection( HivePtr hive ) : +Connection::Connection( HivePtr hive, FrameworkPtr pFw ) : m_hive( hive ), m_socket( hive->GetService() ), m_io_strand( hive->GetService() ), m_receive_buffer_size( 32000 ), - m_error_state( 0 ) + m_error_state( 0 ), + m_pFw( pFw ) { } diff --git a/src/common/Network/Connection.h b/src/common/Network/Connection.h index 84aa76c7..72f23a0d 100644 --- a/src/common/Network/Connection.h +++ b/src/common/Network/Connection.h @@ -12,6 +12,12 @@ #include "Acceptor.h" #include +namespace Sapphire +{ + class Framework; + using FrameworkPtr = std::shared_ptr< Framework >; +} + namespace Sapphire::Network { @@ -38,9 +44,9 @@ namespace Sapphire::Network std::list< std::vector< uint8_t > > m_pending_sends; int32_t m_receive_buffer_size; std::atomic< uint32_t > m_error_state; + Sapphire::FrameworkPtr m_pFw; - - Connection( HivePtr hive ); + Connection( HivePtr hive, FrameworkPtr pFw ); virtual ~Connection(); @@ -144,13 +150,13 @@ namespace Sapphire::Network //----------------------------------------------------------------------------- template< class T > - std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive ) + std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive, FrameworkPtr pFw ) { try { AcceptorPtr acceptor( new Acceptor( pHive ) ); acceptor->Listen( listenIp, port ); - std::shared_ptr< T > connection( new T( pHive, acceptor ) ); + std::shared_ptr< T > connection( new T( pHive, acceptor, pFw ) ); acceptor->Accept( connection ); return connection; } diff --git a/src/dbm/main.cpp b/src/dbm/main.cpp index 378103c8..6cce2ac4 100644 --- a/src/dbm/main.cpp +++ b/src/dbm/main.cpp @@ -16,7 +16,7 @@ namespace filesys = std::experimental::filesystem; #include "DbManager.h" -Sapphire::Logger g_log; +using namespace Sapphire; std::vector< std::string > getAllFilesInDir( const std::string& dirPath, const std::vector< std::string > dirSkipList = {} ) @@ -77,20 +77,20 @@ std::string delChar( std::string &str, char del ) void printUsage() { - g_log.info( " Usage: sapphire_dbm " ); - g_log.info( "\t --mode" ); - g_log.info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" ); - g_log.info( "\t\t check -> Checks if Sapphire DB-Version matches your DB-Version" ); - g_log.info( "\t\t update -> Updates your DB-Version to Sapphire DB-Version" ); - g_log.info( "\t\t clearchars -> Removes all character data from DB. Accounts will stay untouched" ); - g_log.info( "\t\t liquidate -> Removes all tables and deletes the DB" ); - g_log.info( "\t --user " ); - g_log.info( "\t --pass ( default empty )" ); - g_log.info( "\t --host ( default 127.0.0.1 )" ); - g_log.info( "\t --port ( default 3306 )" ); - g_log.info( "\t --database " ); - g_log.info( "\t --sfile ( default sql/schema/schema.sql )" ); - g_log.info( "\t --force ( skips user input / auto Yes )" ); + Logger::info( " Usage: sapphire_dbm " ); + Logger::info( "\t --mode" ); + Logger::info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" ); + Logger::info( "\t\t check -> Checks if Sapphire DB-Version matches your DB-Version" ); + Logger::info( "\t\t update -> Updates your DB-Version to Sapphire DB-Version" ); + Logger::info( "\t\t clearchars -> Removes all character data from DB. Accounts will stay untouched" ); + Logger::info( "\t\t liquidate -> Removes all tables and deletes the DB" ); + Logger::info( "\t --user " ); + Logger::info( "\t --pass ( default empty )" ); + Logger::info( "\t --host ( default 127.0.0.1 )" ); + Logger::info( "\t --port ( default 3306 )" ); + Logger::info( "\t --database " ); + Logger::info( "\t --sfile ( default sql/schema/schema.sql )" ); + Logger::info( "\t --force ( skips user input / auto Yes )" ); } int main( int32_t argc, char* argv[] ) @@ -104,8 +104,7 @@ int main( int32_t argc, char* argv[] ) std::string database; std::string pass; - g_log.setLogPath( "log/SapphireDbm" ); - g_log.init(); + Logger::init( "log/SapphireDbm" ); std::string sFile; std::string iFile; @@ -181,23 +180,23 @@ int main( int32_t argc, char* argv[] ) } else { - g_log.fatal( "Not a valid mode: " + mode + " !" ); + Logger::fatal( "Not a valid mode: " + mode + " !" ); return 1; } - g_log.info( "Launching in " + mode + " mode..." ); + Logger::info( "Launching in " + mode + " mode..." ); if( !dbm.connect() ) { - g_log.fatal( "Could not connect to server!" ); - g_log.fatal( dbm.getLastError() ); + Logger::fatal( "Could not connect to server!" ); + Logger::fatal( dbm.getLastError() ); return 1; } if( !dbm.performAction() ) { - g_log.fatal( "Could not perform action!" ); - g_log.fatal( dbm.getLastError() ); + Logger::fatal( "Could not perform action!" ); + Logger::fatal( dbm.getLastError() ); return 1; } diff --git a/src/lobby/GameConnection.cpp b/src/lobby/GameConnection.cpp index 3f5e861e..206c06a9 100644 --- a/src/lobby/GameConnection.cpp +++ b/src/lobby/GameConnection.cpp @@ -24,9 +24,11 @@ using namespace Sapphire::Network::Packets; using namespace Sapphire::Network::Packets::Server; Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive, - Sapphire::Network::AcceptorPtr pAcceptor ) - : - Connection( pHive ), m_pAcceptor( pAcceptor ), m_bEncryptionInitialized( false ) + Sapphire::Network::AcceptorPtr pAcceptor, + FrameworkPtr pFw ) : + Connection( pHive, pFw ), + m_pAcceptor( pAcceptor ), + m_bEncryptionInitialized( false ) { } @@ -39,7 +41,7 @@ Sapphire::Network::GameConnection::~GameConnection() // overwrite the parents onConnect for our game socket needs void Sapphire::Network::GameConnection::OnAccept( const std::string& host, uint16_t port ) { - auto connection = make_GameConnection( m_hive, m_pAcceptor ); + auto connection = make_GameConnection( m_hive, m_pAcceptor, m_pFw ); m_pAcceptor->Accept( connection ); g_log.info( "Connect from " + m_socket.remote_endpoint().address().to_string() ); @@ -186,7 +188,7 @@ void Sapphire::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet if( i == 3 ) { charListPacket->data().entitledExpansion = 2; - charListPacket->data().maxCharOnWorld = 8; + charListPacket->data().maxCharOnWorld = 25; charListPacket->data().unknown8 = 8; charListPacket->data().veteranRank = 12; charListPacket->data().counter = ( i * 4 ) + 1; @@ -473,7 +475,7 @@ void Sapphire::Network::GameConnection::generateEncryptionKey( uint32_t key, con } void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader, - const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData ) + const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData ) { for( auto inPacket : packetData ) diff --git a/src/lobby/GameConnection.h b/src/lobby/GameConnection.h index d4626407..20945c7f 100644 --- a/src/lobby/GameConnection.h +++ b/src/lobby/GameConnection.h @@ -40,7 +40,7 @@ namespace Sapphire::Network LockedQueue< Packets::GamePacketPtr > m_outQueue; public: - GameConnection( HivePtr pHive, AcceptorPtr pAcceptor ); + GameConnection( HivePtr pHive, AcceptorPtr pAcceptor, FrameworkPtr pFw ); ~GameConnection(); diff --git a/src/lobby/ServerLobby.cpp b/src/lobby/ServerLobby.cpp index e084889a..dcdacee1 100644 --- a/src/lobby/ServerLobby.cpp +++ b/src/lobby/ServerLobby.cpp @@ -10,7 +10,7 @@ #include #include -//#include "LobbySession.h" +#include "Framework.h" #include "ServerLobby.h" @@ -21,124 +21,124 @@ #include -Sapphire::Logger g_log; Sapphire::Network::RestConnector g_restConnector; -namespace Sapphire { - - -ServerLobby::ServerLobby( const std::string& configPath ) : - m_configPath( configPath ), - m_numConnections( 0 ) +namespace Sapphire { - m_pConfig = std::shared_ptr< ConfigMgr >( new ConfigMgr ); -} -ServerLobby::~ServerLobby( void ) -{ -} -LobbySessionPtr ServerLobby::getSession( char* sessionId ) -{ - return g_restConnector.getSession( sessionId ); -} - -ConfigMgrPtr ServerLobby::getConfig() const -{ - return m_pConfig; -} - -void ServerLobby::run( int32_t argc, char* argv[] ) -{ - g_log.setLogPath( "log/SapphireLobby" ); - g_log.init(); - - g_log.info( "===========================================================" ); - g_log.info( "Sapphire Server Project " ); - g_log.info( "Version: " + Version::VERSION ); - g_log.info( "Git Hash: " + Version::GIT_HASH ); - g_log.info( "Compiled: " __DATE__ " " __TIME__ ); - g_log.info( "===========================================================" ); - - if( !loadSettings( argc, argv ) ) + ServerLobby::ServerLobby( const std::string& configPath ) : + m_configPath( configPath ), + m_numConnections( 0 ) { - g_log.fatal( "Error loading settings! " ); - return; + m_pConfig = std::shared_ptr< ConfigMgr >( new ConfigMgr ); } - Network::HivePtr hive( new Network::Hive() ); - 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" ) ); - - std::vector< std::thread > threadGroup; - - threadGroup.emplace_back( std::bind( &Network::Hive::Run, hive.get() ) ); - - for( auto& thread : threadGroup ) - if( thread.joinable() ) - thread.join(); - -} - -bool ServerLobby::loadSettings( int32_t argc, char* argv[] ) -{ - g_log.info( "Loading config " + m_configPath ); - - if( !m_pConfig->loadConfig( m_configPath ) ) + ServerLobby::~ServerLobby( void ) { - g_log.fatal( "Error loading config " + m_configPath ); - g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." ); - return false; } - std::vector< std::string > args( argv + 1, argv + argc ); - for( size_t i = 0; i + 1 < args.size(); i += 2 ) - { - std::string arg( "" ); - std::string val( "" ); - try + LobbySessionPtr ServerLobby::getSession( char* sessionId ) + { + return g_restConnector.getSession( sessionId ); + } + + ConfigMgrPtr ServerLobby::getConfig() const + { + return m_pConfig; + } + + void ServerLobby::run( int32_t argc, char* argv[] ) + { + Logger::init( "log/SapphireLobby" ); + + Logger::info( "===========================================================" ); + Logger::info( "Sapphire Server Project " ); + Logger::info( "Version: " + Version::VERSION ); + Logger::info( "Git Hash: " + Version::GIT_HASH ); + Logger::info( "Compiled: " __DATE__ " " __TIME__ ); + Logger::info( "===========================================================" ); + + if( !loadSettings( argc, argv ) ) { - std::transform( arg.begin(), arg.end(), arg.begin(), [](unsigned char c){ return std::tolower( c ); } ); - val = std::string( args[ i + 1 ] ); + Logger::fatal( "Error loading settings! " ); + return; + } - // trim '-' from start of arg - arg = arg.erase( 0, arg.find_first_not_of( '-' ) ); + auto pFw = std::make_shared< Framework >(); + Network::HivePtr hive( new Network::Hive() ); + Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive, pFw ); - if( arg == "ip" ) + Logger::info( + "Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" + + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) ); + + std::vector< std::thread > threadGroup; + + threadGroup.emplace_back( std::bind( &Network::Hive::Run, hive.get() ) ); + + for( auto& thread : threadGroup ) + if( thread.joinable() ) + thread.join(); + + } + + bool ServerLobby::loadSettings( int32_t argc, char* argv[] ) + { + Logger::info( "Loading config " + m_configPath ); + + if( !m_pConfig->loadConfig( m_configPath ) ) + { + Logger::fatal( "Error loading config " + m_configPath ); + Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." ); + return false; + } + std::vector< std::string > args( argv + 1, argv + argc ); + for( size_t i = 0; i + 1 < args.size(); i += 2 ) + { + std::string arg( "" ); + std::string val( "" ); + + try { - // todo: ip addr in config - m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val ); + std::transform( arg.begin(), arg.end(), arg.begin(), [](unsigned char c){ return std::tolower( c ); } ); + val = std::string( args[ i + 1 ] ); + + // trim '-' from start of arg + arg = arg.erase( 0, arg.find_first_not_of( '-' ) ); + + if( arg == "ip" ) + { + // todo: ip addr in config + m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val ); + } + else if( arg == "p" || arg == "port" ) + { + m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val ); + } + else if( arg == "worldip" || arg == "worldip" ) + { + m_pConfig->setValue< std::string >( "GlobalNetwork.ZoneHost", val ); + } + else if( arg == "worldport" ) + { + m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val ); + } } - else if( arg == "p" || arg == "port" ) + catch( ... ) { - m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val ); - } - else if( arg == "worldip" || arg == "worldip" ) - { - m_pConfig->setValue< std::string >( "GlobalNetwork.ZoneHost", val ); - } - else if( arg == "worldport" ) - { - m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val ); + Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" ); + Logger::error( "Usage: \n" ); } } - catch( ... ) - { - g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" ); - g_log.error( "Usage: \n" ); - } + + 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" ); + + return true; } - - 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" ); - - return true; -} } diff --git a/src/scripts/quest/ManFst001.cpp b/src/scripts/quest/ManFst001.cpp index a6a1fc7f..3998ae38 100644 --- a/src/scripts/quest/ManFst001.cpp +++ b/src/scripts/quest/ManFst001.cpp @@ -1,7 +1,8 @@ #include #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include "Event/EventHandler.h" +#include "Framework.h" // Quest Script: ManFst001_00039 // Quest Name: Coming to Gridania @@ -95,7 +96,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 ) Scene00000( player ); diff --git a/src/scripts/quest/ManFst002.cpp b/src/scripts/quest/ManFst002.cpp index 7f892de4..7d3fdc53 100644 --- a/src/scripts/quest/ManFst002.cpp +++ b/src/scripts/quest/ManFst002.cpp @@ -1,7 +1,8 @@ #include #include #include "Event/EventHandler.h" -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" +#include "Framework.h" // Quest Script: ManFst002_00124 // Quest Name: Close to Home @@ -192,7 +193,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 ) Scene00000( player ); diff --git a/src/scripts/quest/ManFst003.cpp b/src/scripts/quest/ManFst003.cpp index 640b6107..4fd91806 100644 --- a/src/scripts/quest/ManFst003.cpp +++ b/src/scripts/quest/ManFst003.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" // Quest Script: ManFst003_00123 // Quest Name: Close to Home @@ -81,7 +82,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/ManFst004.cpp b/src/scripts/quest/ManFst004.cpp index 6d64b301..f3738813 100644 --- a/src/scripts/quest/ManFst004.cpp +++ b/src/scripts/quest/ManFst004.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" // Quest Script: ManFst004_00124 // Quest Name: Close to Home @@ -81,7 +82,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ManFst004::Actor0 ) { @@ -223,10 +225,10 @@ private: [ & ]( Entity::Player& player, const Event::SceneResult& result ) { // accepting quest "close to home" - player.updateQuest( getId(), 1 ); + player.updateQuest( getId(), Seq1 ); player.setQuestUI8CH( getId(), 1 ); // receive key item // event is done, need to teleport to real zone. - player.setZone( 132 ); + player.forceZoneing( Territorytype0 ); //player.setZone(183); back to starting griania for debug purpose } ); } diff --git a/src/scripts/quest/ManSea001.cpp b/src/scripts/quest/ManSea001.cpp index db0e5628..c22ff0f7 100644 --- a/src/scripts/quest/ManSea001.cpp +++ b/src/scripts/quest/ManSea001.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" // Quest Script: ManSea001_00107 // Quest Name: Coming to Limsa Lominsa @@ -141,7 +142,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 ) Scene00000( player ); diff --git a/src/scripts/quest/ManSea002.cpp b/src/scripts/quest/ManSea002.cpp index c2fd2f37..692e4d25 100644 --- a/src/scripts/quest/ManSea002.cpp +++ b/src/scripts/quest/ManSea002.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" // Quest Script: ManSea002_00108 // Quest Name: Close to Home @@ -47,7 +48,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 ) { diff --git a/src/scripts/quest/ManSea003.cpp b/src/scripts/quest/ManSea003.cpp index f340937c..0f213e3f 100644 --- a/src/scripts/quest/ManSea003.cpp +++ b/src/scripts/quest/ManSea003.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" // Quest Script: ManSea003_00109 // Quest Name: Close to Home @@ -63,7 +64,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/ManWil001.cpp b/src/scripts/quest/ManWil001.cpp index cd9e3974..5c0de2b6 100644 --- a/src/scripts/quest/ManWil001.cpp +++ b/src/scripts/quest/ManWil001.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" // Quest Script: ManWil001_00594 // Quest Name: Coming to Ul'dah @@ -173,7 +174,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 ) { diff --git a/src/scripts/quest/ManWil002.cpp b/src/scripts/quest/ManWil002.cpp index b2dd4db6..ddf46067 100644 --- a/src/scripts/quest/ManWil002.cpp +++ b/src/scripts/quest/ManWil002.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" // Quest Script: ManWil002_00568 // Quest Name: Close to Home @@ -69,7 +70,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst001.cpp b/src/scripts/quest/subquest/gridania/SubFst001.cpp index 45c2bbf6..ee0a9c48 100644 --- a/src/scripts/quest/subquest/gridania/SubFst001.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst001.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" using namespace Sapphire; @@ -72,7 +73,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst002.cpp b/src/scripts/quest/subquest/gridania/SubFst002.cpp index 85722cde..d539d591 100644 --- a/src/scripts/quest/subquest/gridania/SubFst002.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst002.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" using namespace Sapphire; @@ -58,7 +59,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 && !player.hasQuest( getId() ) ) Scene00000( player ); diff --git a/src/scripts/quest/subquest/gridania/SubFst003.cpp b/src/scripts/quest/subquest/gridania/SubFst003.cpp index e5d0aca7..d32ca94f 100644 --- a/src/scripts/quest/subquest/gridania/SubFst003.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst003.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -51,7 +52,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst004.cpp b/src/scripts/quest/subquest/gridania/SubFst004.cpp index 7cf1a84d..53923c3f 100644 --- a/src/scripts/quest/subquest/gridania/SubFst004.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst004.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -55,7 +56,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst008.cpp b/src/scripts/quest/subquest/gridania/SubFst008.cpp index c0193abc..d5828c7c 100644 --- a/src/scripts/quest/subquest/gridania/SubFst008.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst008.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -55,7 +56,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst009.cpp b/src/scripts/quest/subquest/gridania/SubFst009.cpp index 0542f689..4d536487 100644 --- a/src/scripts/quest/subquest/gridania/SubFst009.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst009.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -51,7 +52,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst010.cpp b/src/scripts/quest/subquest/gridania/SubFst010.cpp index a8a2defe..c6fd5854 100644 --- a/src/scripts/quest/subquest/gridania/SubFst010.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst010.cpp @@ -1,6 +1,7 @@ #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" #include +#include "Framework.h" using namespace Sapphire; @@ -54,7 +55,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR0 ) Scene00000( player ); diff --git a/src/scripts/quest/subquest/gridania/SubFst011.cpp b/src/scripts/quest/subquest/gridania/SubFst011.cpp index ceadb3d4..a452c161 100644 --- a/src/scripts/quest/subquest/gridania/SubFst011.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst011.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -48,7 +49,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 && !player.hasQuest( getId() ) ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst013.cpp b/src/scripts/quest/subquest/gridania/SubFst013.cpp index e813acab..5f485542 100644 --- a/src/scripts/quest/subquest/gridania/SubFst013.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst013.cpp @@ -1,6 +1,7 @@ #include #include -#include "Event/EventHelper.h" +#include "Manager/EventMgr.h" +#include "Framework.h" using namespace Sapphire; @@ -160,7 +161,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( !player.hasQuest( getId() ) ) { @@ -180,7 +182,8 @@ public: void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 ) Scene00100( player ); diff --git a/src/scripts/quest/subquest/gridania/SubFst014.cpp b/src/scripts/quest/subquest/gridania/SubFst014.cpp index 735f54a0..640f0f9d 100644 --- a/src/scripts/quest/subquest/gridania/SubFst014.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst014.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -55,7 +56,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 && !player.hasQuest( getId() ) ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst015.cpp b/src/scripts/quest/subquest/gridania/SubFst015.cpp index bd0aa913..43edea60 100644 --- a/src/scripts/quest/subquest/gridania/SubFst015.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst015.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -53,7 +54,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 && !player.hasQuest( getId() ) ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst019.cpp b/src/scripts/quest/subquest/gridania/SubFst019.cpp index 51701057..dff3948e 100644 --- a/src/scripts/quest/subquest/gridania/SubFst019.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst019.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -48,7 +49,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst026.cpp b/src/scripts/quest/subquest/gridania/SubFst026.cpp index e5136621..a9733538 100644 --- a/src/scripts/quest/subquest/gridania/SubFst026.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst026.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -50,7 +51,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == Actor0 && !player.hasQuest( getId() ) ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst029.cpp b/src/scripts/quest/subquest/gridania/SubFst029.cpp index d2d6d65a..7f765458 100644 --- a/src/scripts/quest/subquest/gridania/SubFst029.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst029.cpp @@ -1,6 +1,7 @@ #include -#include +#include #include +#include "Framework.h" using namespace Sapphire; @@ -46,7 +47,8 @@ public: void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override { - auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); + auto pEventMgr = m_framework->get< World::Manager::EventMgr >(); + auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ); if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) ) { diff --git a/src/scripts/quest/subquest/gridania/SubFst030.cpp b/src/scripts/quest/subquest/gridania/SubFst030.cpp index 9f7dedfe..4f789edf 100644 --- a/src/scripts/quest/subquest/gridania/SubFst030.cpp +++ b/src/scripts/quest/subquest/gridania/SubFst030.cpp @@ -1,7 +1,8 @@ #include