mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Merge remote-tracking branch 'upstream/dependency_injection' into housing
This commit is contained in:
commit
ceebb27c1c
144 changed files with 1448 additions and 1342 deletions
|
@ -27,13 +27,11 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <Framework.h>
|
#include <Framework.h>
|
||||||
|
#include <Logging/Logger.h>
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
#include "SapphireAPI.h"
|
#include "SapphireAPI.h"
|
||||||
|
|
||||||
|
|
||||||
Sapphire::Framework g_fw;
|
|
||||||
Sapphire::Logger g_log;
|
|
||||||
Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection > g_charaDb;
|
Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection > g_charaDb;
|
||||||
Sapphire::Data::ExdDataGenerated g_exdDataGen;
|
Sapphire::Data::ExdDataGenerated g_exdDataGen;
|
||||||
Sapphire::Network::SapphireAPI g_sapphireAPI;
|
Sapphire::Network::SapphireAPI g_sapphireAPI;
|
||||||
|
@ -41,6 +39,7 @@ Sapphire::Network::SapphireAPI g_sapphireAPI;
|
||||||
namespace fs = std::experimental::filesystem;
|
namespace fs = std::experimental::filesystem;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
using HttpServer = SimpleWeb::Server< SimpleWeb::HTTP >;
|
using HttpServer = SimpleWeb::Server< SimpleWeb::HTTP >;
|
||||||
using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >;
|
using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >;
|
||||||
|
@ -64,17 +63,17 @@ void reloadConfig()
|
||||||
|
|
||||||
void print_request_info( shared_ptr< HttpServer::Request > request )
|
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[] )
|
bool loadSettings( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
g_log.info( "Loading config " + configPath );
|
Logger::info( "Loading config " + configPath );
|
||||||
|
|
||||||
if( !m_pConfig->loadConfig( configPath ) )
|
if( !m_pConfig->loadConfig( configPath ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error loading config " + configPath );
|
Logger::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( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,17 +134,17 @@ bool loadSettings( int32_t argc, char* argv[] )
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
{
|
{
|
||||||
g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
||||||
g_log.error( "Usage: <arg> <val> \n" );
|
Logger::error( "Usage: <arg> <val> \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", "" );
|
auto dataPath = m_pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" );
|
||||||
if( !g_exdDataGen.init( 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" );
|
Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
|
||||||
g_log.fatal( "DataPath: " + dataPath );
|
Logger::fatal( "DataPath: " + dataPath );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +167,7 @@ bool loadSettings( int32_t argc, char* argv[] )
|
||||||
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) );
|
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) );
|
||||||
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" );
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +278,7 @@ void createAccount( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
|
||||||
catch( exception& e )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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 )
|
catch( exception& e )
|
||||||
{
|
{
|
||||||
*response << buildHttpResponse( 500 );
|
*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[] )
|
int main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
auto pLog = std::shared_ptr< Sapphire::Logger >( new Sapphire::Logger() );
|
Logger::init( "log/SapphireAPI" );
|
||||||
g_fw.set< Sapphire::Logger >( pLog );
|
|
||||||
g_log.setLogPath( "log/SapphireAPI" );
|
|
||||||
g_log.init();
|
|
||||||
|
|
||||||
g_log.info( "===========================================================" );
|
Logger::info( "===========================================================" );
|
||||||
g_log.info( "Sapphire API Server " );
|
Logger::info( "Sapphire API Server " );
|
||||||
g_log.info( "Version: 0.0.1" );
|
Logger::info( "Version: 0.0.1" );
|
||||||
g_log.info( "Compiled: " __DATE__ " " __TIME__ );
|
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
|
||||||
g_log.info( "===========================================================" );
|
Logger::info( "===========================================================" );
|
||||||
|
|
||||||
if( !loadSettings( argc, argv ) )
|
if( !loadSettings( argc, argv ) )
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
|
@ -771,7 +767,7 @@ int main( int argc, char* argv[] )
|
||||||
server.start();
|
server.start();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
g_log.info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
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" ) );
|
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
|
||||||
|
|
||||||
//Wait for server to start so that the client can connect
|
//Wait for server to start so that the client can connect
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include "PreparedStatement.h"
|
#include "PreparedStatement.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
|
Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
|
||||||
m_reconnecting( false ),
|
m_reconnecting( false ),
|
||||||
m_prepareError( false ),
|
m_prepareError( false ),
|
||||||
|
@ -66,7 +64,7 @@ uint32_t Sapphire::Db::DbConnection::open()
|
||||||
}
|
}
|
||||||
catch( std::runtime_error& e )
|
catch( std::runtime_error& e )
|
||||||
{
|
{
|
||||||
g_fw.get< Logger >()->error( e.what() );
|
Logger::error( e.what() );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +116,7 @@ bool Sapphire::Db::DbConnection::execute( const std::string& sql )
|
||||||
}
|
}
|
||||||
catch( std::runtime_error& e )
|
catch( std::runtime_error& e )
|
||||||
{
|
{
|
||||||
g_fw.get< Logger >()->error( e.what() );
|
Logger::error( e.what() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,7 +131,7 @@ std::shared_ptr< Mysql::ResultSet > Sapphire::Db::DbConnection::query( const std
|
||||||
}
|
}
|
||||||
catch( std::runtime_error& e )
|
catch( std::runtime_error& e )
|
||||||
{
|
{
|
||||||
g_fw.get< Logger >()->error( e.what() );
|
Logger::error( e.what() );
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +168,7 @@ Sapphire::Db::DbConnection::query( std::shared_ptr< Sapphire::Db::PreparedStatem
|
||||||
}
|
}
|
||||||
catch( std::runtime_error& e )
|
catch( std::runtime_error& e )
|
||||||
{
|
{
|
||||||
g_fw.get< Logger >()->error( e.what() );
|
Logger::error( e.what() );
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +194,7 @@ bool Sapphire::Db::DbConnection::execute( std::shared_ptr< Sapphire::Db::Prepare
|
||||||
}
|
}
|
||||||
catch( std::runtime_error& e )
|
catch( std::runtime_error& e )
|
||||||
{
|
{
|
||||||
g_fw.get< Logger >()->error( e.what() );
|
Logger::error( e.what() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +230,7 @@ void Sapphire::Db::DbConnection::prepareStatement( uint32_t index, const std::st
|
||||||
}
|
}
|
||||||
catch( std::runtime_error& e )
|
catch( std::runtime_error& e )
|
||||||
{
|
{
|
||||||
g_fw.get< Logger >()->error( e.what() );
|
Logger::error( e.what() );
|
||||||
m_prepareError = true;
|
m_prepareError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
#include "ZoneDbConnection.h"
|
#include "ZoneDbConnection.h"
|
||||||
#include "DbWorkerPool.h"
|
#include "DbWorkerPool.h"
|
||||||
#include "Logging/Logger.h"
|
#include "Logging/Logger.h"
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
Sapphire::Db::DbLoader::DbLoader()
|
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
|
m_open.push( [ this, info, &pool ]()->bool
|
||||||
{
|
{
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
|
||||||
const uint8_t asyncThreads = info.asyncThreads;
|
const uint8_t asyncThreads = info.asyncThreads;
|
||||||
const uint8_t synchThreads = info.syncThreads;
|
const uint8_t synchThreads = info.syncThreads;
|
||||||
|
|
||||||
if( asyncThreads < 1 || asyncThreads > 32 )
|
if( asyncThreads < 1 || asyncThreads > 32 )
|
||||||
{
|
{
|
||||||
pLog->error(
|
Logger::error(
|
||||||
"database: invalid number of worker threads specified. Please pick a value between 1 and 32." );
|
"database: invalid number of worker threads specified. Please pick a value between 1 and 32." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +35,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
|
||||||
|
|
||||||
if( error )
|
if( error )
|
||||||
{
|
{
|
||||||
pLog->error( "DatabasePool failed to open." );
|
Logger::error( "DatabasePool failed to open." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,8 +50,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
|
||||||
{
|
{
|
||||||
if( !pool.prepareStatements() )
|
if( !pool.prepareStatements() )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( "Could not prepare statements of the database, see log for details." );
|
||||||
pLog->error( "Could not prepare statements of the database, see log for details." );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
#include "Logging/Logger.h"
|
#include "Logging/Logger.h"
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
class PingOperation :
|
class PingOperation :
|
||||||
public Sapphire::Db::Operation
|
public Sapphire::Db::Operation
|
||||||
{
|
{
|
||||||
|
@ -23,8 +21,7 @@ class PingOperation :
|
||||||
};
|
};
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
Sapphire::Db::DbWorkerPool< T >::DbWorkerPool()
|
Sapphire::Db::DbWorkerPool< T >::DbWorkerPool() :
|
||||||
:
|
|
||||||
m_queue( new Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >() ),
|
m_queue( new Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >() ),
|
||||||
m_asyncThreads( 0 ),
|
m_asyncThreads( 0 ),
|
||||||
m_synchThreads( 0 )
|
m_synchThreads( 0 )
|
||||||
|
@ -50,8 +47,7 @@ void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& i
|
||||||
template< class T >
|
template< class T >
|
||||||
uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
|
||||||
pLog->info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
|
|
||||||
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
|
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
|
||||||
" Synchronous connections: " + std::to_string( m_synchThreads ) );
|
" Synchronous connections: " + std::to_string( m_synchThreads ) );
|
||||||
|
|
||||||
|
@ -64,7 +60,7 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
||||||
|
|
||||||
if( !error )
|
if( !error )
|
||||||
{
|
{
|
||||||
pLog->info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
|
Logger::info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
|
||||||
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
|
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
|
||||||
" total connections running." );
|
" total connections running." );
|
||||||
}
|
}
|
||||||
|
@ -75,11 +71,10 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
||||||
template< class T >
|
template< class T >
|
||||||
void Sapphire::Db::DbWorkerPool< T >::close()
|
void Sapphire::Db::DbWorkerPool< T >::close()
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
|
||||||
pLog->info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
|
|
||||||
m_connections[ IDX_ASYNC ].clear();
|
m_connections[ IDX_ASYNC ].clear();
|
||||||
m_connections[ IDX_SYNCH ].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 >
|
template< class T >
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace Sapphire
|
||||||
|
|
||||||
class ConfigMgr;
|
class ConfigMgr;
|
||||||
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
|
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
|
||||||
|
class Framework;
|
||||||
|
using FrameworkPtr = std::shared_ptr< Framework >;
|
||||||
|
|
||||||
namespace Network
|
namespace Network
|
||||||
{
|
{
|
||||||
|
|
|
@ -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( '/' );
|
auto pos = logPath.find_last_of( '/' );
|
||||||
|
|
||||||
|
@ -33,15 +33,10 @@ namespace Sapphire
|
||||||
fs::create_directories( realPath );
|
fs::create_directories( realPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_logFile = logPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Logger::init()
|
|
||||||
{
|
|
||||||
spdlog::init_thread_pool( 8192, 1 );
|
spdlog::init_thread_pool( 8192, 1 );
|
||||||
|
|
||||||
auto stdout_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >();
|
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 };
|
std::vector< spdlog::sink_ptr > sinks { stdout_sink, daily_sink };
|
||||||
|
|
||||||
|
|
|
@ -11,23 +11,20 @@ namespace Sapphire
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_logFile;
|
std::string m_logFile;
|
||||||
|
|
||||||
public:
|
|
||||||
Logger();
|
Logger();
|
||||||
|
|
||||||
~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 );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
#include "Connection.h"
|
#include "Connection.h"
|
||||||
#include "Hive.h"
|
#include "Hive.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
namespace Sapphire {
|
namespace Sapphire {
|
||||||
namespace Network {
|
namespace Network {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Connection::Connection( HivePtr hive ) :
|
Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
|
||||||
m_hive( hive ),
|
m_hive( hive ),
|
||||||
m_socket( hive->GetService() ),
|
m_socket( hive->GetService() ),
|
||||||
m_io_strand( hive->GetService() ),
|
m_io_strand( hive->GetService() ),
|
||||||
m_receive_buffer_size( 32000 ),
|
m_receive_buffer_size( 32000 ),
|
||||||
m_error_state( 0 )
|
m_error_state( 0 ),
|
||||||
|
m_pFw( pFw )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,12 @@
|
||||||
#include "Acceptor.h"
|
#include "Acceptor.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
namespace Sapphire
|
||||||
|
{
|
||||||
|
class Framework;
|
||||||
|
using FrameworkPtr = std::shared_ptr< Framework >;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Sapphire::Network
|
namespace Sapphire::Network
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -38,9 +44,9 @@ namespace Sapphire::Network
|
||||||
std::list< std::vector< uint8_t > > m_pending_sends;
|
std::list< std::vector< uint8_t > > m_pending_sends;
|
||||||
int32_t m_receive_buffer_size;
|
int32_t m_receive_buffer_size;
|
||||||
std::atomic< uint32_t > m_error_state;
|
std::atomic< uint32_t > m_error_state;
|
||||||
|
Sapphire::FrameworkPtr m_pFw;
|
||||||
|
|
||||||
|
Connection( HivePtr hive, FrameworkPtr pFw );
|
||||||
Connection( HivePtr hive );
|
|
||||||
|
|
||||||
virtual ~Connection();
|
virtual ~Connection();
|
||||||
|
|
||||||
|
@ -144,13 +150,13 @@ namespace Sapphire::Network
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
template< class T >
|
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
|
try
|
||||||
{
|
{
|
||||||
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
||||||
acceptor->Listen( listenIp, port );
|
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 );
|
acceptor->Accept( connection );
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace filesys = std::experimental::filesystem;
|
||||||
|
|
||||||
#include "DbManager.h"
|
#include "DbManager.h"
|
||||||
|
|
||||||
Sapphire::Logger g_log;
|
using namespace Sapphire;
|
||||||
|
|
||||||
std::vector< std::string > getAllFilesInDir( const std::string& dirPath,
|
std::vector< std::string > getAllFilesInDir( const std::string& dirPath,
|
||||||
const std::vector< std::string > dirSkipList = {} )
|
const std::vector< std::string > dirSkipList = {} )
|
||||||
|
@ -77,20 +77,20 @@ std::string delChar( std::string &str, char del )
|
||||||
|
|
||||||
void printUsage()
|
void printUsage()
|
||||||
{
|
{
|
||||||
g_log.info( " Usage: sapphire_dbm " );
|
Logger::info( " Usage: sapphire_dbm " );
|
||||||
g_log.info( "\t --mode" );
|
Logger::info( "\t --mode" );
|
||||||
g_log.info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" );
|
Logger::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" );
|
Logger::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" );
|
Logger::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" );
|
Logger::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" );
|
Logger::info( "\t\t liquidate -> Removes all tables and deletes the DB" );
|
||||||
g_log.info( "\t --user <mysqlUserName>" );
|
Logger::info( "\t --user <mysqlUserName>" );
|
||||||
g_log.info( "\t --pass <mysqlPassword> ( default empty )" );
|
Logger::info( "\t --pass <mysqlPassword> ( default empty )" );
|
||||||
g_log.info( "\t --host <mysqlHost> ( default 127.0.0.1 )" );
|
Logger::info( "\t --host <mysqlHost> ( default 127.0.0.1 )" );
|
||||||
g_log.info( "\t --port <mysqlPort> ( default 3306 )" );
|
Logger::info( "\t --port <mysqlPort> ( default 3306 )" );
|
||||||
g_log.info( "\t --database <mysqlDatabase>" );
|
Logger::info( "\t --database <mysqlDatabase>" );
|
||||||
g_log.info( "\t --sfile <path/to/schemafile> ( default sql/schema/schema.sql )" );
|
Logger::info( "\t --sfile <path/to/schemafile> ( default sql/schema/schema.sql )" );
|
||||||
g_log.info( "\t --force ( skips user input / auto Yes )" );
|
Logger::info( "\t --force ( skips user input / auto Yes )" );
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int32_t argc, char* argv[] )
|
int main( int32_t argc, char* argv[] )
|
||||||
|
@ -104,8 +104,7 @@ int main( int32_t argc, char* argv[] )
|
||||||
std::string database;
|
std::string database;
|
||||||
std::string pass;
|
std::string pass;
|
||||||
|
|
||||||
g_log.setLogPath( "log/SapphireDbm" );
|
Logger::init( "log/SapphireDbm" );
|
||||||
g_log.init();
|
|
||||||
|
|
||||||
std::string sFile;
|
std::string sFile;
|
||||||
std::string iFile;
|
std::string iFile;
|
||||||
|
@ -181,23 +180,23 @@ int main( int32_t argc, char* argv[] )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_log.fatal( "Not a valid mode: " + mode + " !" );
|
Logger::fatal( "Not a valid mode: " + mode + " !" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_log.info( "Launching in " + mode + " mode..." );
|
Logger::info( "Launching in " + mode + " mode..." );
|
||||||
|
|
||||||
if( !dbm.connect() )
|
if( !dbm.connect() )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Could not connect to server!" );
|
Logger::fatal( "Could not connect to server!" );
|
||||||
g_log.fatal( dbm.getLastError() );
|
Logger::fatal( dbm.getLastError() );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !dbm.performAction() )
|
if( !dbm.performAction() )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Could not perform action!" );
|
Logger::fatal( "Could not perform action!" );
|
||||||
g_log.fatal( dbm.getLastError() );
|
Logger::fatal( dbm.getLastError() );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,11 @@ using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
|
||||||
Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive,
|
Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive,
|
||||||
Sapphire::Network::AcceptorPtr pAcceptor )
|
Sapphire::Network::AcceptorPtr pAcceptor,
|
||||||
:
|
FrameworkPtr pFw ) :
|
||||||
Connection( pHive ), m_pAcceptor( pAcceptor ), m_bEncryptionInitialized( false )
|
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
|
// overwrite the parents onConnect for our game socket needs
|
||||||
void Sapphire::Network::GameConnection::OnAccept( const std::string& host, uint16_t port )
|
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 );
|
m_pAcceptor->Accept( connection );
|
||||||
|
|
||||||
g_log.info( "Connect from " + m_socket.remote_endpoint().address().to_string() );
|
g_log.info( "Connect from " + m_socket.remote_endpoint().address().to_string() );
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace Sapphire::Network
|
||||||
LockedQueue< Packets::GamePacketPtr > m_outQueue;
|
LockedQueue< Packets::GamePacketPtr > m_outQueue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameConnection( HivePtr pHive, AcceptorPtr pAcceptor );
|
GameConnection( HivePtr pHive, AcceptorPtr pAcceptor, FrameworkPtr pFw );
|
||||||
|
|
||||||
~GameConnection();
|
~GameConnection();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Config/ConfigMgr.h>
|
#include <Config/ConfigMgr.h>
|
||||||
|
|
||||||
//#include "LobbySession.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
#include "ServerLobby.h"
|
#include "ServerLobby.h"
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
Sapphire::Logger g_log;
|
|
||||||
Sapphire::Network::RestConnector g_restConnector;
|
Sapphire::Network::RestConnector g_restConnector;
|
||||||
|
|
||||||
namespace Sapphire {
|
namespace Sapphire
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
ServerLobby::ServerLobby( const std::string& configPath ) :
|
ServerLobby::ServerLobby( const std::string& configPath ) :
|
||||||
|
@ -50,26 +50,26 @@ ConfigMgrPtr ServerLobby::getConfig() const
|
||||||
|
|
||||||
void ServerLobby::run( int32_t argc, char* argv[] )
|
void ServerLobby::run( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
g_log.setLogPath( "log/SapphireLobby" );
|
Logger::init( "log/SapphireLobby" );
|
||||||
g_log.init();
|
|
||||||
|
|
||||||
g_log.info( "===========================================================" );
|
Logger::info( "===========================================================" );
|
||||||
g_log.info( "Sapphire Server Project " );
|
Logger::info( "Sapphire Server Project " );
|
||||||
g_log.info( "Version: " + Version::VERSION );
|
Logger::info( "Version: " + Version::VERSION );
|
||||||
g_log.info( "Git Hash: " + Version::GIT_HASH );
|
Logger::info( "Git Hash: " + Version::GIT_HASH );
|
||||||
g_log.info( "Compiled: " __DATE__ " " __TIME__ );
|
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
|
||||||
g_log.info( "===========================================================" );
|
Logger::info( "===========================================================" );
|
||||||
|
|
||||||
if( !loadSettings( argc, argv ) )
|
if( !loadSettings( argc, argv ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error loading settings! " );
|
Logger::fatal( "Error loading settings! " );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto pFw = std::make_shared< Framework >();
|
||||||
Network::HivePtr hive( new Network::Hive() );
|
Network::HivePtr hive( new Network::Hive() );
|
||||||
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
|
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive, pFw );
|
||||||
|
|
||||||
g_log.info(
|
Logger::info(
|
||||||
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
||||||
m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) );
|
m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) );
|
||||||
|
|
||||||
|
@ -85,12 +85,12 @@ void ServerLobby::run( int32_t argc, char* argv[] )
|
||||||
|
|
||||||
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
|
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
g_log.info( "Loading config " + m_configPath );
|
Logger::info( "Loading config " + m_configPath );
|
||||||
|
|
||||||
if( !m_pConfig->loadConfig( m_configPath ) )
|
if( !m_pConfig->loadConfig( m_configPath ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error loading config " + m_configPath );
|
Logger::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." );
|
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::vector< std::string > args( argv + 1, argv + argc );
|
std::vector< std::string > args( argv + 1, argv + argc );
|
||||||
|
@ -127,8 +127,8 @@ bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
{
|
{
|
||||||
g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
||||||
g_log.error( "Usage: <arg> <val> \n" );
|
Logger::error( "Usage: <arg> <val> \n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManFst001_00039
|
// Quest Script: ManFst001_00039
|
||||||
// Quest Name: Coming to Gridania
|
// Quest Name: Coming to Gridania
|
||||||
|
@ -95,7 +96,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManFst002_00124
|
// Quest Script: ManFst002_00124
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -192,7 +193,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManFst003_00123
|
// Quest Script: ManFst003_00123
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -81,7 +82,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManFst004_00124
|
// Quest Script: ManFst004_00124
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -81,7 +82,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ManFst004::Actor0 )
|
||||||
{
|
{
|
||||||
|
@ -223,10 +225,10 @@ private:
|
||||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||||
{
|
{
|
||||||
// accepting quest "close to home"
|
// accepting quest "close to home"
|
||||||
player.updateQuest( getId(), 1 );
|
player.updateQuest( getId(), Seq1 );
|
||||||
player.setQuestUI8CH( getId(), 1 ); // receive key item
|
player.setQuestUI8CH( getId(), 1 ); // receive key item
|
||||||
// event is done, need to teleport to real zone.
|
// 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
|
//player.setZone(183); back to starting griania for debug purpose
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManSea001_00107
|
// Quest Script: ManSea001_00107
|
||||||
// Quest Name: Coming to Limsa Lominsa
|
// Quest Name: Coming to Limsa Lominsa
|
||||||
|
@ -141,7 +142,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManSea002_00108
|
// Quest Script: ManSea002_00108
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -47,7 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ACTOR0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManSea003_00109
|
// Quest Script: ManSea003_00109
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -63,7 +64,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManWil001_00594
|
// Quest Script: ManWil001_00594
|
||||||
// Quest Name: Coming to Ul'dah
|
// Quest Name: Coming to Ul'dah
|
||||||
|
@ -173,7 +174,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ACTOR0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
// Quest Script: ManWil002_00568
|
// Quest Script: ManWil002_00568
|
||||||
// Quest Name: Close to Home
|
// Quest Name: Close to Home
|
||||||
|
@ -69,7 +70,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -72,7 +73,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ACTOR0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -58,7 +59,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == ACTOR0 && !player.hasQuest( getId() ) )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -55,7 +56,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -55,7 +56,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -54,7 +55,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == ACTOR0 )
|
||||||
Scene00000( player );
|
Scene00000( player );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -48,7 +49,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -160,7 +161,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
@ -180,7 +182,8 @@ public:
|
||||||
|
|
||||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
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 )
|
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
|
||||||
Scene00100( player );
|
Scene00100( player );
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -55,7 +56,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -53,7 +54,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -48,7 +49,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -50,7 +51,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -46,7 +47,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <Script/NativeScriptApi.h>
|
#include <Script/NativeScriptApi.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -64,7 +65,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -56,7 +57,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <Script/NativeScriptApi.h>
|
#include <Script/NativeScriptApi.h>
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include "Event/EventHelper.h"
|
#include "Manager/EventMgr.h"
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -64,7 +65,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -47,7 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -48,7 +49,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -52,7 +53,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -57,7 +58,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -50,7 +51,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -54,7 +55,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
@ -88,7 +90,8 @@ public:
|
||||||
|
|
||||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
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 == Actor0 && emoteId == 41 && player.getQuestSeq( getId() ) == Seq1 )
|
if( actor == Actor0 && emoteId == 41 && player.getQuestSeq( getId() ) == Seq1 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -54,7 +55,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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() ) )
|
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -47,7 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -45,7 +46,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -47,7 +48,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
#include <Event/EventHelper.h>
|
#include <Manager/EventMgr.h>
|
||||||
#include <ScriptObject.h>
|
#include <ScriptObject.h>
|
||||||
|
#include "Framework.h"
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
@ -50,7 +51,8 @@ public:
|
||||||
|
|
||||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
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 )
|
if( actor == Actor0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
|
||||||
Sapphire::Logger g_log;
|
|
||||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||||
const std::string datLocation(
|
const std::string datLocation(
|
||||||
|
@ -91,13 +90,13 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
g_log.init();
|
Logger::init( "commongen" );
|
||||||
|
|
||||||
|
|
||||||
g_log.info( "Setting up EXD data" );
|
Logger::info( "Setting up EXD data" );
|
||||||
if( !g_exdData.init( datLocation ) )
|
if( !g_exdData.init( datLocation ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error setting up EXD data " );
|
Logger::fatal( "Error setting up EXD data " );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +129,6 @@ int main()
|
||||||
result += generateEnum( "HousingAppeal", 0, "uint8_t" );
|
result += generateEnum( "HousingAppeal", 0, "uint8_t" );
|
||||||
result += "}\n";
|
result += "}\n";
|
||||||
result += "}\n#endif\n";
|
result += "}\n#endif\n";
|
||||||
g_log.info( result );
|
Logger::info( result );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,8 @@
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
|
|
||||||
Sapphire::Logger g_log;
|
|
||||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||||
bool skipUnmapped = true;
|
bool skipUnmapped = true;
|
||||||
|
|
||||||
|
@ -324,10 +323,10 @@ std::string generateConstructorsDecl( const std::string& exd )
|
||||||
|
|
||||||
int main( int argc, char** argv )
|
int main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
g_log.init();
|
Logger::init( "struct_gen" );
|
||||||
if( argc > 1 )
|
if( argc > 1 )
|
||||||
{
|
{
|
||||||
g_log.info( "using dat path: " + std::string( argv[ 1 ] ) );
|
Logger::info( "using dat path: " + std::string( argv[ 1 ] ) );
|
||||||
datLocation = std::string( argv[ 1 ] );
|
datLocation = std::string( argv[ 1 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,14 +356,14 @@ int main( int argc, char** argv )
|
||||||
auto json = nlohmann::json();
|
auto json = nlohmann::json();
|
||||||
exJson >> json;
|
exJson >> json;
|
||||||
|
|
||||||
g_log.info( "Setting up EXD data" );
|
Logger::info( "Setting up EXD data" );
|
||||||
if( !g_exdData.init( datLocation ) )
|
if( !g_exdData.init( datLocation ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error setting up EXD data " );
|
Logger::fatal( "Error setting up EXD data " );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
g_log.info( "Generating structs, this may take several minutes..." );
|
Logger::info( "Generating structs, this may take several minutes..." );
|
||||||
g_log.info( "Go grab a coffee..." );
|
Logger::info( "Go grab a coffee..." );
|
||||||
|
|
||||||
std::string structDefs;
|
std::string structDefs;
|
||||||
std::string idListsDecl;
|
std::string idListsDecl;
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
|
|
||||||
Sapphire::Logger g_log;
|
|
||||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||||
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
||||||
|
@ -28,30 +27,30 @@ const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Rebo
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
g_log.init();
|
Logger::init( "struct_test" );
|
||||||
|
|
||||||
g_log.info( "Setting up EXD data" );
|
Logger::info( "Setting up EXD data" );
|
||||||
if( !g_exdData.init( datLocation ) )
|
if( !g_exdData.init( datLocation ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error setting up EXD data " );
|
Logger::fatal( "Error setting up EXD data " );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//g_log.info( "getting id list " );
|
//Logger::info( "getting id list " );
|
||||||
//auto idList = g_exdData.getGilShopIdList();
|
//auto idList = g_exdData.getGilShopIdList();
|
||||||
|
|
||||||
//g_log.info( "getting id list done" );
|
//Logger::info( "getting id list done" );
|
||||||
//for( auto id : idList )
|
//for( auto id : idList )
|
||||||
{
|
{
|
||||||
auto teri1 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 0 );
|
auto teri1 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 0 );
|
||||||
g_log.info( "0 -> " + std::to_string( teri1->item ) );
|
Logger::info( "0 -> " + std::to_string( teri1->item ) );
|
||||||
|
|
||||||
auto teri2 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 1 );
|
auto teri2 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 1 );
|
||||||
g_log.info( "1 -> " + std::to_string( teri2->item ) );
|
Logger::info( "1 -> " + std::to_string( teri2->item ) );
|
||||||
|
|
||||||
auto teri3 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 2 );
|
auto teri3 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 2 );
|
||||||
g_log.info( "2 -> " + std::to_string( teri3->item ) );
|
Logger::info( "2 -> " + std::to_string( teri3->item ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -22,9 +22,10 @@ namespace filesys = std::experimental::filesystem;
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
Sapphire::Logger g_log;
|
|
||||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||||
|
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||||
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
||||||
|
|
||||||
|
@ -194,12 +195,12 @@ std::string delChar( std::string &str, char del )
|
||||||
int dumpSpawns()
|
int dumpSpawns()
|
||||||
{
|
{
|
||||||
|
|
||||||
g_log.init();
|
Logger::init( "mob_parse" );
|
||||||
|
|
||||||
g_log.info( "Setting up EXD data" );
|
Logger::info( "Setting up EXD data" );
|
||||||
if( !g_exdData.init( datLocation ) )
|
if( !g_exdData.init( datLocation ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error setting up EXD data " );
|
Logger::fatal( "Error setting up EXD data " );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +224,7 @@ int dumpSpawns()
|
||||||
auto str = file.substr( 0, pos );
|
auto str = file.substr( 0, pos );
|
||||||
pos = str.find_last_of( filesys::path::preferred_separator );
|
pos = str.find_last_of( filesys::path::preferred_separator );
|
||||||
auto zone = str.substr( pos + 1 );
|
auto zone = str.substr( pos + 1 );
|
||||||
//g_log.info( zone );
|
//Logger::info( zone );
|
||||||
|
|
||||||
FFXIVIpcNpcSpawn packet;
|
FFXIVIpcNpcSpawn packet;
|
||||||
std::ifstream is;
|
std::ifstream is;
|
||||||
|
@ -258,15 +259,15 @@ int dumpSpawns()
|
||||||
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
||||||
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
||||||
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
||||||
g_log.info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
||||||
g_log.info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
||||||
|
|
||||||
for( auto mob : entry.second )
|
for( auto mob : entry.second )
|
||||||
{
|
{
|
||||||
nameToPacketList[ mob.bNPCBase ].push_back( mob );
|
nameToPacketList[ mob.bNPCBase ].push_back( mob );
|
||||||
|
|
||||||
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mob.bNPCName );
|
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mob.bNPCName );
|
||||||
//g_log.info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map< std::string, std::vector< FFXIVIpcNpcSpawn > > lvlToPacket;
|
std::map< std::string, std::vector< FFXIVIpcNpcSpawn > > lvlToPacket;
|
||||||
|
@ -282,7 +283,7 @@ int dumpSpawns()
|
||||||
for( auto mobName : lvlToPacket )
|
for( auto mobName : lvlToPacket )
|
||||||
{
|
{
|
||||||
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
|
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
|
||||||
g_log.info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
|
Logger::info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
|
||||||
|
|
||||||
spawngroups++;
|
spawngroups++;
|
||||||
for( FFXIVIpcNpcSpawn instance : mobName.second )
|
for( FFXIVIpcNpcSpawn instance : mobName.second )
|
||||||
|
@ -314,7 +315,7 @@ int dumpSpawns()
|
||||||
std::string name = delChar( nameStruct->singular, ' ' );
|
std::string name = delChar( nameStruct->singular, ' ' );
|
||||||
name = delChar( name, '\'' );
|
name = delChar( name, '\'' );
|
||||||
|
|
||||||
g_log.info( "|----> " + name + "_" + std::to_string( instance.bNPCBase ) + " " +
|
Logger::info( "|----> " + name + "_" + std::to_string( instance.bNPCBase ) + " " +
|
||||||
std::to_string( instance.posX ) + ", " +
|
std::to_string( instance.posX ) + ", " +
|
||||||
std::to_string( instance.posY ) + ", " +
|
std::to_string( instance.posY ) + ", " +
|
||||||
std::to_string( instance.posZ ) + ", " +
|
std::to_string( instance.posZ ) + ", " +
|
||||||
|
@ -322,7 +323,7 @@ int dumpSpawns()
|
||||||
std::to_string( instance.gimmickId ) + ", " +
|
std::to_string( instance.gimmickId ) + ", " +
|
||||||
std::to_string( instance.level ) + ", " +
|
std::to_string( instance.level ) + ", " +
|
||||||
std::to_string( instance.hPMax ) );
|
std::to_string( instance.hPMax ) );
|
||||||
//g_log.info( "|----> " + name + " - " + std::to_string( instance.bNPCBase ) + ", " + std::to_string( instance.gimmickId ) );
|
//Logger::info( "|----> " + name + " - " + std::to_string( instance.bNPCBase ) + ", " + std::to_string( instance.gimmickId ) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -340,7 +341,7 @@ int dumpSpawns()
|
||||||
+ "UNHEX( '" + cusStr + "'), "
|
+ "UNHEX( '" + cusStr + "'), "
|
||||||
+ "UNHEX( '" + modelStr + "') );\n";*/
|
+ "UNHEX( '" + modelStr + "') );\n";*/
|
||||||
|
|
||||||
//g_log.info( output );
|
//Logger::info( output );
|
||||||
|
|
||||||
//out << output;
|
//out << output;
|
||||||
|
|
||||||
|
@ -351,7 +352,7 @@ int dumpSpawns()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_log.info( "|--> Total SpawnGroups: " + std::to_string( spawngroups ) );
|
Logger::info( "|--> Total SpawnGroups: " + std::to_string( spawngroups ) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -360,12 +361,12 @@ int dumpSpawns()
|
||||||
int dumpTemplates()
|
int dumpTemplates()
|
||||||
{
|
{
|
||||||
|
|
||||||
g_log.init();
|
Logger::init( "mob_parse" );
|
||||||
|
|
||||||
g_log.info( "Setting up EXD data" );
|
Logger::info( "Setting up EXD data" );
|
||||||
if( !g_exdData.init( datLocation ) )
|
if( !g_exdData.init( datLocation ) )
|
||||||
{
|
{
|
||||||
g_log.fatal( "Error setting up EXD data " );
|
Logger::fatal( "Error setting up EXD data " );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,7 +390,7 @@ int dumpTemplates()
|
||||||
auto str = file.substr( 0, pos );
|
auto str = file.substr( 0, pos );
|
||||||
pos = str.find_last_of( filesys::path::preferred_separator );
|
pos = str.find_last_of( filesys::path::preferred_separator );
|
||||||
auto zone = str.substr( pos + 1 );
|
auto zone = str.substr( pos + 1 );
|
||||||
//g_log.info( zone );
|
//Logger::info( zone );
|
||||||
|
|
||||||
FFXIVIpcNpcSpawn packet;
|
FFXIVIpcNpcSpawn packet;
|
||||||
std::ifstream is;
|
std::ifstream is;
|
||||||
|
@ -419,7 +420,7 @@ int dumpTemplates()
|
||||||
{
|
{
|
||||||
auto zoneIdStr = file.substr( pos + 1 );
|
auto zoneIdStr = file.substr( pos + 1 );
|
||||||
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( std::stoi( zoneIdStr ) );
|
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( std::stoi( zoneIdStr ) );
|
||||||
g_log.info( zoneIdStr + " - " + teri1->name );
|
Logger::info( zoneIdStr + " - " + teri1->name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -434,7 +435,7 @@ int dumpTemplates()
|
||||||
nameToPacketList[ packet.bNPCName ].push_back( packet );
|
nameToPacketList[ packet.bNPCName ].push_back( packet );
|
||||||
|
|
||||||
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( packet.bNPCName );
|
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( packet.bNPCName );
|
||||||
//g_log.info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -448,23 +449,23 @@ int dumpTemplates()
|
||||||
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
||||||
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
||||||
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
||||||
g_log.info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
||||||
g_log.info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
||||||
|
|
||||||
for( auto mob : entry.second )
|
for( auto mob : entry.second )
|
||||||
{
|
{
|
||||||
nameToPacketList[ mob.bNPCBase ].push_back( mob );
|
nameToPacketList[ mob.bNPCBase ].push_back( mob );
|
||||||
|
|
||||||
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mob.bNPCName );
|
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mob.bNPCName );
|
||||||
//g_log.info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
g_log.info( "Unique Mobs: " + std::to_string( nameToPacketList.size() ) );
|
Logger::info( "Unique Mobs: " + std::to_string( nameToPacketList.size() ) );
|
||||||
|
|
||||||
for( auto mobName : nameToPacketList )
|
for( auto mobName : nameToPacketList )
|
||||||
{
|
{
|
||||||
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
|
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
|
||||||
g_log.info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
|
Logger::info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
|
||||||
|
|
||||||
auto instance = mobName.second.at(0);
|
auto instance = mobName.second.at(0);
|
||||||
//for( FFXIVIpcNpcSpawn instance : mobName.second )
|
//for( FFXIVIpcNpcSpawn instance : mobName.second )
|
||||||
|
@ -494,8 +495,8 @@ int dumpTemplates()
|
||||||
|
|
||||||
cusStr = binaryToHexString( (uint8_t*)instance.look, 26 );
|
cusStr = binaryToHexString( (uint8_t*)instance.look, 26 );
|
||||||
|
|
||||||
//g_log.info( "|----> " + std::to_string( instance.bNPCBase ) + " " + std::to_string( instance.posX ) + ", " + std::to_string( instance.posY ) + ", " + std::to_string( instance.posZ ) );
|
//Logger::info( "|----> " + std::to_string( instance.bNPCBase ) + " " + std::to_string( instance.posX ) + ", " + std::to_string( instance.posY ) + ", " + std::to_string( instance.posZ ) );
|
||||||
// g_log.info( "|----> " + std::to_string( instance.bNPCBase ) +
|
// Logger::info( "|----> " + std::to_string( instance.bNPCBase ) +
|
||||||
// " " + std::to_string( instance.mainWeaponModel ) +
|
// " " + std::to_string( instance.mainWeaponModel ) +
|
||||||
// ", " + std::to_string( instance.secWeaponModel ) +
|
// ", " + std::to_string( instance.secWeaponModel ) +
|
||||||
// ", " + std::to_string( instance.aggressionMode ) +
|
// ", " + std::to_string( instance.aggressionMode ) +
|
||||||
|
@ -522,11 +523,11 @@ int dumpTemplates()
|
||||||
+ "UNHEX( '" + cusStr + "'), "
|
+ "UNHEX( '" + cusStr + "'), "
|
||||||
+ "UNHEX( '" + modelStr + "') );\n";
|
+ "UNHEX( '" + modelStr + "') );\n";
|
||||||
|
|
||||||
g_log.info( output );
|
Logger::info( output );
|
||||||
|
|
||||||
out << output;
|
out << output;
|
||||||
|
|
||||||
/* g_log.info( "|----> " + std::to_string( instance.bNPCBase ) +
|
/* Logger::info( "|----> " + std::to_string( instance.bNPCBase ) +
|
||||||
" " + std::to_string( instance.u2ab ) +
|
" " + std::to_string( instance.u2ab ) +
|
||||||
", " + std::to_string( instance.u2b ) +
|
", " + std::to_string( instance.u2b ) +
|
||||||
", " + std::to_string( instance.u3b ) +
|
", " + std::to_string( instance.u3b ) +
|
||||||
|
@ -554,15 +555,15 @@ int dumpTemplates()
|
||||||
|
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
/*g_log.info( "getting id list " );
|
/*Logger::info( "getting id list " );
|
||||||
auto idList = g_exdData.getTerritoryTypeIdList();
|
auto idList = g_exdData.getTerritoryTypeIdList();
|
||||||
|
|
||||||
g_log.info( "getting id list done" );
|
Logger::info( "getting id list done" );
|
||||||
for( auto id : idList )
|
for( auto id : idList )
|
||||||
{
|
{
|
||||||
auto teri1 = g_exdData.get<Sapphire::Data::TerritoryType>( id );
|
auto teri1 = g_exdData.get<Sapphire::Data::TerritoryType>( id );
|
||||||
|
|
||||||
g_log.info( teri1->name );
|
Logger::info( teri1->name );
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -20,10 +20,9 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
Sapphire::Logger g_log;
|
|
||||||
Sapphire::Data::ExdDataGenerated g_exdDataGen;
|
Sapphire::Data::ExdDataGenerated g_exdDataGen;
|
||||||
namespace fs = std::experimental::filesystem;
|
namespace fs = std::experimental::filesystem;
|
||||||
|
using namespace Sapphire;
|
||||||
|
|
||||||
const std::string onTalkStr(
|
const std::string onTalkStr(
|
||||||
" void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n"
|
" void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n"
|
||||||
|
@ -328,7 +327,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
|
||||||
int main( int argc, char** argv )
|
int main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
|
|
||||||
g_log.init();
|
Logger::init( "quest_parser" );
|
||||||
|
|
||||||
bool unluac = false;
|
bool unluac = false;
|
||||||
// std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
// std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||||
|
@ -341,11 +340,11 @@ int main( int argc, char** argv )
|
||||||
|
|
||||||
unluac = true;
|
unluac = true;
|
||||||
|
|
||||||
g_log.info( "Setting up generated EXD data" );
|
Logger::info( "Setting up generated EXD data" );
|
||||||
if( !g_exdDataGen.init( datLocation ) )
|
if( !g_exdDataGen.init( datLocation ) )
|
||||||
{
|
{
|
||||||
std::cout << datLocation << "\n";
|
std::cout << datLocation << "\n";
|
||||||
g_log.fatal( "Error setting up EXD data " );
|
Logger::fatal( "Error setting up EXD data " );
|
||||||
std::cout << "Usage: quest_parser \"path/to/ffxiv/game/sqpack\" <1/0 unluac export toggle>\n";
|
std::cout << "Usage: quest_parser \"path/to/ffxiv/game/sqpack\" <1/0 unluac export toggle>\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -357,13 +356,13 @@ int main( int argc, char** argv )
|
||||||
if( !fs::exists( "./generated" ) )
|
if( !fs::exists( "./generated" ) )
|
||||||
fs::create_directory( "./generated" );
|
fs::create_directory( "./generated" );
|
||||||
|
|
||||||
g_log.info( "Export in progress" );
|
Logger::info( "Export in progress" );
|
||||||
|
|
||||||
uint32_t updateInterval = rows.size() / 20;
|
uint32_t updateInterval = rows.size() / 20;
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
for( const auto& row : rows )
|
for( const auto& row : rows )
|
||||||
{
|
{
|
||||||
g_log.info( "Generating " + std::to_string( row ) );
|
Logger::info( "Generating " + std::to_string( row ) );
|
||||||
auto questInfo = g_exdDataGen.get< Sapphire::Data::Quest >( row );
|
auto questInfo = g_exdDataGen.get< Sapphire::Data::Quest >( row );
|
||||||
|
|
||||||
if( questInfo->name.empty() || questInfo->id.empty() )
|
if( questInfo->name.empty() || questInfo->id.empty() )
|
||||||
|
@ -408,7 +407,7 @@ int main( int argc, char** argv )
|
||||||
"generated/" + questInfo->id + ".lua";
|
"generated/" + questInfo->id + ".lua";
|
||||||
if( system( command.c_str() ) == -1 )
|
if( system( command.c_str() ) == -1 )
|
||||||
{
|
{
|
||||||
g_log.error( "Error executing java command:\n" + command + "\nerrno: " + std::strerror( errno ) );
|
Logger::error( "Error executing java command:\n" + command + "\nerrno: " + std::strerror( errno ) );
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,8 @@ namespace Sapphire::Action
|
||||||
|
|
||||||
bool m_bInterrupt;
|
bool m_bInterrupt;
|
||||||
|
|
||||||
|
FrameworkPtr m_pFw;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,16 @@ using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
Sapphire::Action::ActionCast::ActionCast()
|
Sapphire::Action::ActionCast::ActionCast()
|
||||||
{
|
{
|
||||||
m_handleActionType = Common::HandleActionType::Event;
|
m_handleActionType = Common::HandleActionType::Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Action::ActionCast::ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId )
|
Sapphire::Action::ActionCast::ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget,
|
||||||
|
uint16_t actionId, FrameworkPtr pFw )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
m_pFw = pFw;
|
||||||
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
m_startTime = 0;
|
m_startTime = 0;
|
||||||
m_id = actionId;
|
m_id = actionId;
|
||||||
m_handleActionType = HandleActionType::Spell;
|
m_handleActionType = HandleActionType::Spell;
|
||||||
|
@ -70,7 +70,7 @@ void Sapphire::Action::ActionCast::onFinish()
|
||||||
if( !m_pSource )
|
if( !m_pSource )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||||
|
|
||||||
auto pPlayer = m_pSource->getAsPlayer();
|
auto pPlayer = m_pSource->getAsPlayer();
|
||||||
pPlayer->sendDebug( "onFinish()" );
|
pPlayer->sendDebug( "onFinish()" );
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Sapphire::Action
|
||||||
|
|
||||||
~ActionCast();
|
~ActionCast();
|
||||||
|
|
||||||
ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId );
|
ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId, FrameworkPtr pFw );
|
||||||
|
|
||||||
void onStart() override;
|
void onStart() override;
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,14 @@ using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
Sapphire::Action::ActionTeleport::ActionTeleport()
|
Sapphire::Action::ActionTeleport::ActionTeleport()
|
||||||
{
|
{
|
||||||
m_handleActionType = HandleActionType::Event;
|
m_handleActionType = HandleActionType::Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Action::ActionTeleport::ActionTeleport( Entity::CharaPtr pActor, uint16_t targetZone, uint16_t cost )
|
Sapphire::Action::ActionTeleport::ActionTeleport( Entity::CharaPtr pActor, uint16_t targetZone, uint16_t cost, FrameworkPtr pFw )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
||||||
m_startTime = 0;
|
m_startTime = 0;
|
||||||
m_id = 5;
|
m_id = 5;
|
||||||
m_handleActionType = HandleActionType::Teleport;
|
m_handleActionType = HandleActionType::Teleport;
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Sapphire::Action
|
||||||
|
|
||||||
~ActionTeleport();
|
~ActionTeleport();
|
||||||
|
|
||||||
ActionTeleport( Entity::CharaPtr pActor, uint16_t action, uint16_t cost );
|
ActionTeleport( Entity::CharaPtr pActor, uint16_t action, uint16_t cost, FrameworkPtr pFw );
|
||||||
|
|
||||||
void onStart() override;
|
void onStart() override;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
#include "EventAction.h"
|
#include "EventAction.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network;
|
using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
@ -25,14 +23,15 @@ Sapphire::Action::EventAction::EventAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Action::EventAction::EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
Sapphire::Action::EventAction::EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
||||||
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional )
|
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional,
|
||||||
|
FrameworkPtr pFw )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
|
||||||
|
|
||||||
m_additional = additional;
|
m_additional = additional;
|
||||||
m_handleActionType = HandleActionType::Event;
|
m_handleActionType = HandleActionType::Event;
|
||||||
m_eventId = eventId;
|
m_eventId = eventId;
|
||||||
m_id = action;
|
m_id = action;
|
||||||
|
m_pFw = pFw;
|
||||||
|
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
||||||
m_castTime = pExdData->get< Sapphire::Data::EventAction >( action )->castTime * 1000; // TODO: Add security checks.
|
m_castTime = pExdData->get< Sapphire::Data::EventAction >( action )->castTime * 1000; // TODO: Add security checks.
|
||||||
m_onActionFinishClb = finishRef;
|
m_onActionFinishClb = finishRef;
|
||||||
m_onActionInterruptClb = interruptRef;
|
m_onActionInterruptClb = interruptRef;
|
||||||
|
@ -95,8 +94,7 @@ void Sapphire::Action::EventAction::onFinish()
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( e.what() );
|
||||||
pLog->error( e.what() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,8 +132,7 @@ void Sapphire::Action::EventAction::onInterrupt()
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( e.what() );
|
||||||
pLog->error( e.what() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Sapphire::Action
|
||||||
~EventAction();
|
~EventAction();
|
||||||
|
|
||||||
EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
|
||||||
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional );
|
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional, FrameworkPtr pFw );
|
||||||
|
|
||||||
void onStart() override;
|
void onStart() override;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
#include "EventItemAction.h"
|
#include "EventItemAction.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network;
|
using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
|
@ -83,8 +81,7 @@ void Sapphire::Action::EventItemAction::onFinish()
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( e.what() );
|
||||||
pLog->error( e.what() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -112,8 +109,7 @@ void Sapphire::Action::EventItemAction::onInterrupt()
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( e.what() );
|
||||||
pLog->error( e.what() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
|
|
||||||
#include "Math/CalcBattle.h"
|
#include "Math/CalcBattle.h"
|
||||||
|
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
//using namespace Sapphire::Network::Packets::Server;
|
//using namespace Sapphire::Network::Packets::Server;
|
||||||
|
@ -297,16 +293,10 @@ Send a packet to all players in range, potentially to self if set and is player
|
||||||
*/
|
*/
|
||||||
void Sapphire::Entity::Actor::sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf )
|
void Sapphire::Entity::Actor::sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
|
||||||
if( bToSelf && isPlayer() )
|
if( bToSelf && isPlayer() )
|
||||||
{
|
{
|
||||||
auto pPlayer = getAsPlayer();
|
auto pPlayer = getAsPlayer();
|
||||||
|
pPlayer->queuePacket( pPacket );
|
||||||
auto pSession = pServerZone->getSession( pPlayer->getId() );
|
|
||||||
|
|
||||||
// it might be that the player DC'd in which case the session would be invalid
|
|
||||||
if( pSession )
|
|
||||||
pSession->getZoneConnection()->queueOutPacket( pPacket );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_inRangePlayers.empty() )
|
if( m_inRangePlayers.empty() )
|
||||||
|
|
|
@ -28,21 +28,21 @@
|
||||||
#include "BNpc.h"
|
#include "BNpc.h"
|
||||||
#include "BNpcTemplate.h"
|
#include "BNpcTemplate.h"
|
||||||
#include "Manager/TerritoryMgr.h"
|
#include "Manager/TerritoryMgr.h"
|
||||||
#include "Framework.h"
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
Sapphire::Entity::BNpc::BNpc() : Npc( ObjKind::BattleNpc )
|
Sapphire::Entity::BNpc::BNpc( FrameworkPtr pFw ) :
|
||||||
|
Npc( ObjKind::BattleNpc, pFw )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Entity::BNpc::BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level ) : Npc( ObjKind::BattleNpc )
|
Sapphire::Entity::BNpc::BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ,
|
||||||
|
uint8_t level, FrameworkPtr pFw ) :
|
||||||
|
Npc( ObjKind::BattleNpc, pFw )
|
||||||
{
|
{
|
||||||
m_modelChara = pTemplate->getModelChara();
|
m_modelChara = pTemplate->getModelChara();
|
||||||
m_displayFlags = pTemplate->getDisplayFlags();
|
m_displayFlags = pTemplate->getDisplayFlags();
|
||||||
|
|
|
@ -22,8 +22,8 @@ namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BNpc();
|
BNpc( FrameworkPtr pFw );
|
||||||
BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level );
|
BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level, FrameworkPtr pFw );
|
||||||
|
|
||||||
virtual ~BNpc() override;
|
virtual ~BNpc() override;
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,16 @@
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
Sapphire::Entity::Chara::Chara( ObjKind type ) :
|
Sapphire::Entity::Chara::Chara( ObjKind type, FrameworkPtr pFw ) :
|
||||||
Actor( type ),
|
Actor( type ),
|
||||||
m_pose( 0 ),
|
m_pose( 0 ),
|
||||||
m_targetId( INVALID_GAME_OBJECT_ID )
|
m_targetId( INVALID_GAME_OBJECT_ID ),
|
||||||
|
m_pFw( pFw )
|
||||||
{
|
{
|
||||||
// initialize the free slot queue
|
// initialize the free slot queue
|
||||||
for( uint8_t i = 0; i < MAX_STATUS_EFFECTS; i++ )
|
for( uint8_t i = 0; i < MAX_STATUS_EFFECTS; i++ )
|
||||||
|
@ -430,7 +429,7 @@ ChaiScript Skill Handler.
|
||||||
void Sapphire::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, uint64_t param1,
|
void Sapphire::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, uint64_t param1,
|
||||||
uint64_t param2, Entity::Chara& target )
|
uint64_t param2, Entity::Chara& target )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
if( isPlayer() )
|
if( isPlayer() )
|
||||||
{
|
{
|
||||||
getAsPlayer()->sendDebug( std::to_string( target.getId() ) );
|
getAsPlayer()->sendDebug( std::to_string( target.getId() ) );
|
||||||
|
@ -510,7 +509,8 @@ void Sapphire::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionI
|
||||||
case ActionEffectType::Heal:
|
case ActionEffectType::Heal:
|
||||||
{
|
{
|
||||||
uint32_t calculatedHeal = Math::CalcBattle::calculateHealValue( getAsPlayer(),
|
uint32_t calculatedHeal = Math::CalcBattle::calculateHealValue( getAsPlayer(),
|
||||||
static_cast< uint32_t >( param1 ) );
|
static_cast< uint32_t >( param1 ),
|
||||||
|
m_pFw );
|
||||||
|
|
||||||
Server::EffectEntry effectEntry{};
|
Server::EffectEntry effectEntry{};
|
||||||
effectEntry.value = calculatedHeal;
|
effectEntry.value = calculatedHeal;
|
||||||
|
@ -594,7 +594,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
||||||
/*! \param StatusEffectPtr to be applied to the actor */
|
/*! \param StatusEffectPtr to be applied to the actor */
|
||||||
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
|
void Sapphire::Entity::Chara::addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param )
|
||||||
{
|
{
|
||||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000 );
|
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
||||||
effect->setParam( param );
|
effect->setParam( param );
|
||||||
addStatusEffect( effect );
|
addStatusEffect( effect );
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_
|
||||||
if( hasStatusEffect( id ) )
|
if( hasStatusEffect( id ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000 );
|
auto effect = StatusEffect::make_StatusEffect( id, source.getAsChara(), getAsChara(), duration, 3000, m_pFw );
|
||||||
effect->setParam( param );
|
effect->setParam( param );
|
||||||
addStatusEffect( effect );
|
addStatusEffect( effect );
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,10 @@ namespace Sapphire::Entity
|
||||||
std::queue< uint8_t > m_statusEffectFreeSlotQueue;
|
std::queue< uint8_t > m_statusEffectFreeSlotQueue;
|
||||||
std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList;
|
std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList;
|
||||||
std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap;
|
std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap;
|
||||||
|
FrameworkPtr m_pFw;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Chara( Common::ObjKind type );
|
Chara( Common::ObjKind type, FrameworkPtr pFw );
|
||||||
|
|
||||||
virtual ~Chara() override;
|
virtual ~Chara() override;
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,6 @@ using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
#include "Framework.h"
|
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
Sapphire::Entity::EventObject::EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId,
|
Sapphire::Entity::EventObject::EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId,
|
||||||
uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
|
uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
|
||||||
float rotation, const std::string& givenName ) :
|
float rotation, const std::string& givenName ) :
|
||||||
|
@ -123,9 +119,7 @@ void Sapphire::Entity::EventObject::spawn( Sapphire::Entity::PlayerPtr pTarget )
|
||||||
if( !pTarget->isObjSpawnIndexValid( spawnIndex ) )
|
if( !pTarget->isObjSpawnIndexValid( spawnIndex ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::debug( "Spawning EObj: id:" + std::to_string( getId() ) + " name:" + getName() );
|
||||||
|
|
||||||
pLog->debug( "Spawning EObj: id:" + std::to_string( getId() ) + " name:" + getName() );
|
|
||||||
|
|
||||||
auto eobjStatePacket = makeZonePacket< FFXIVIpcObjectSpawn >( getId(), pTarget->getId() );
|
auto eobjStatePacket = makeZonePacket< FFXIVIpcObjectSpawn >( getId(), pTarget->getId() );
|
||||||
eobjStatePacket->data().spawnIndex = spawnIndex;
|
eobjStatePacket->data().spawnIndex = spawnIndex;
|
||||||
|
@ -144,8 +138,7 @@ void Sapphire::Entity::EventObject::spawn( Sapphire::Entity::PlayerPtr pTarget )
|
||||||
|
|
||||||
void Sapphire::Entity::EventObject::despawn( Sapphire::Entity::PlayerPtr pTarget )
|
void Sapphire::Entity::EventObject::despawn( Sapphire::Entity::PlayerPtr pTarget )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::debug( "despawn eobj: " + std::to_string( getId() ) );
|
||||||
pLog->debug( "despawn eobj: " + std::to_string( getId() ) );
|
|
||||||
|
|
||||||
pTarget->freeObjSpawnIndexForActorId( getId() );
|
pTarget->freeObjSpawnIndexForActorId( getId() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,15 +30,13 @@
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::Network::ActorControl;
|
using namespace Sapphire::Network::ActorControl;
|
||||||
|
|
||||||
Sapphire::Entity::Npc::Npc( ObjKind type ) :
|
Sapphire::Entity::Npc::Npc( ObjKind type, FrameworkPtr pFw ) :
|
||||||
Chara( type )
|
Chara( type, pFw )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Npc( Common::ObjKind type );
|
Npc( Common::ObjKind type, FrameworkPtr pFw );
|
||||||
|
|
||||||
virtual ~Npc() override;
|
virtual ~Npc() override;
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
@ -56,8 +54,8 @@ using InvSlotPair = std::pair< uint16_t, int8_t >;
|
||||||
using InvSlotPairVec = std::vector< InvSlotPair >;
|
using InvSlotPairVec = std::vector< InvSlotPair >;
|
||||||
|
|
||||||
// player constructor
|
// player constructor
|
||||||
Sapphire::Entity::Player::Player() :
|
Sapphire::Entity::Player::Player( FrameworkPtr pFw ) :
|
||||||
Chara( ObjKind::Player ),
|
Chara( ObjKind::Player, pFw ),
|
||||||
m_lastWrite( 0 ),
|
m_lastWrite( 0 ),
|
||||||
m_lastPing( 0 ),
|
m_lastPing( 0 ),
|
||||||
m_bIsLogin( false ),
|
m_bIsLogin( false ),
|
||||||
|
@ -109,7 +107,7 @@ Sapphire::Entity::Player::~Player()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::injectPacket( const std::string& path )
|
void Sapphire::Entity::Player::injectPacket( const std::string& path )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = m_pFw->get< World::ServerMgr >();
|
||||||
auto session = pServerZone->getSession( getId() );
|
auto session = pServerZone->getSession( getId() );
|
||||||
if( session )
|
if( session )
|
||||||
session->getZoneConnection()->injectPacket( path, *this );
|
session->getZoneConnection()->injectPacket( path, *this );
|
||||||
|
@ -195,7 +193,7 @@ bool Sapphire::Entity::Player::isMarkedForRemoval() const
|
||||||
|
|
||||||
Sapphire::Common::OnlineStatus Sapphire::Entity::Player::getOnlineStatus() const
|
Sapphire::Common::OnlineStatus Sapphire::Entity::Player::getOnlineStatus() const
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
if( !pExdData )
|
if( !pExdData )
|
||||||
return OnlineStatus::Online;
|
return OnlineStatus::Online;
|
||||||
|
|
||||||
|
@ -250,7 +248,7 @@ void Sapphire::Entity::Player::calculateStats()
|
||||||
uint8_t level = getLevel();
|
uint8_t level = getLevel();
|
||||||
uint8_t job = static_cast< uint8_t >( getClass() );
|
uint8_t job = static_cast< uint8_t >( getClass() );
|
||||||
|
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
|
|
||||||
auto classInfo = pExdData->get< Sapphire::Data::ClassJob >( job );
|
auto classInfo = pExdData->get< Sapphire::Data::ClassJob >( job );
|
||||||
auto tribeInfo = pExdData->get< Sapphire::Data::Tribe >( tribe );
|
auto tribeInfo = pExdData->get< Sapphire::Data::Tribe >( tribe );
|
||||||
|
@ -280,9 +278,9 @@ void Sapphire::Entity::Player::calculateStats()
|
||||||
m_baseStats.healingPotMagic = paramGrowthInfo->baseSpeed;
|
m_baseStats.healingPotMagic = paramGrowthInfo->baseSpeed;
|
||||||
m_baseStats.tenacity = paramGrowthInfo->baseSpeed;
|
m_baseStats.tenacity = paramGrowthInfo->baseSpeed;
|
||||||
|
|
||||||
m_baseStats.max_mp = Math::CalcStats::calculateMaxMp( getAsPlayer() );
|
m_baseStats.max_mp = Math::CalcStats::calculateMaxMp( getAsPlayer(), m_pFw );
|
||||||
|
|
||||||
m_baseStats.max_hp = Math::CalcStats::calculateMaxHp( getAsPlayer() );
|
m_baseStats.max_hp = Math::CalcStats::calculateMaxHp( getAsPlayer(), m_pFw );
|
||||||
|
|
||||||
if( m_mp > m_baseStats.max_mp )
|
if( m_mp > m_baseStats.max_mp )
|
||||||
m_mp = m_baseStats.max_mp;
|
m_mp = m_baseStats.max_mp;
|
||||||
|
@ -339,8 +337,8 @@ void Sapphire::Entity::Player::sendStats()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||||
|
|
||||||
auto data = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId );
|
auto data = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId );
|
||||||
|
|
||||||
|
@ -407,7 +405,7 @@ void Sapphire::Entity::Player::returnToHomepoint()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||||
m_onEnterEventDone = false;
|
m_onEnterEventDone = false;
|
||||||
if( !pTeriMgr->movePlayer( zoneId, getAsPlayer() ) )
|
if( !pTeriMgr->movePlayer( zoneId, getAsPlayer() ) )
|
||||||
{
|
{
|
||||||
|
@ -425,7 +423,7 @@ void Sapphire::Entity::Player::setZone( uint32_t zoneId )
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
|
bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||||
m_onEnterEventDone = false;
|
m_onEnterEventDone = false;
|
||||||
auto instance = pTeriMgr->getInstanceZonePtr( instanceContentId );
|
auto instance = pTeriMgr->getInstanceZonePtr( instanceContentId );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
|
@ -440,7 +438,7 @@ bool Sapphire::Entity::Player::setInstance( ZonePtr instance )
|
||||||
if( !instance )
|
if( !instance )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||||
|
|
||||||
auto currentZone = getCurrentZone();
|
auto currentZone = getCurrentZone();
|
||||||
|
|
||||||
|
@ -463,7 +461,7 @@ bool Sapphire::Entity::Player::setInstance( ZonePtr instance )
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::exitInstance()
|
bool Sapphire::Entity::Player::exitInstance()
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||||
|
|
||||||
// check if housing zone
|
// check if housing zone
|
||||||
if( pTeriMgr->isHousingTerritory( m_prevTerritoryTypeId ) )
|
if( pTeriMgr->isHousingTerritory( m_prevTerritoryTypeId ) )
|
||||||
|
@ -548,7 +546,7 @@ void Sapphire::Entity::Player::discover( int16_t map_id, int16_t sub_id )
|
||||||
|
|
||||||
// section to starts at 320 - 4 bytes long
|
// section to starts at 320 - 4 bytes long
|
||||||
|
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
|
|
||||||
int32_t offset = 4;
|
int32_t offset = 4;
|
||||||
|
|
||||||
|
@ -640,7 +638,7 @@ bool Sapphire::Entity::Player::isActionLearned( uint8_t actionId ) const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::gainExp( uint32_t amount )
|
void Sapphire::Entity::Player::gainExp( uint32_t amount )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
|
|
||||||
uint32_t currentExp = getExp();
|
uint32_t currentExp = getExp();
|
||||||
|
|
||||||
|
@ -721,14 +719,14 @@ void Sapphire::Entity::Player::sendStatusUpdate( bool toSelf )
|
||||||
|
|
||||||
uint8_t Sapphire::Entity::Player::getLevel() const
|
uint8_t Sapphire::Entity::Player::getLevel() const
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Sapphire::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
|
uint8_t Sapphire::Entity::Player::getLevelForClass( Common::ClassJob pClass ) const
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( pClass ) )->expArrayIndex;
|
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( pClass ) )->expArrayIndex;
|
||||||
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
||||||
}
|
}
|
||||||
|
@ -741,14 +739,14 @@ bool Sapphire::Entity::Player::isClassJobUnlocked( Common::ClassJob classJob ) c
|
||||||
|
|
||||||
uint32_t Sapphire::Entity::Player::getExp() const
|
uint32_t Sapphire::Entity::Player::getExp() const
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
return m_expArray[ classJobIndex ];
|
return m_expArray[ classJobIndex ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setExp( uint32_t amount )
|
void Sapphire::Entity::Player::setExp( uint32_t amount )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
m_expArray[ classJobIndex ] = amount;
|
m_expArray[ classJobIndex ] = amount;
|
||||||
}
|
}
|
||||||
|
@ -790,14 +788,14 @@ void Sapphire::Entity::Player::setClassJob( Common::ClassJob classJob )
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setLevel( uint8_t level )
|
void Sapphire::Entity::Player::setLevel( uint8_t level )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( getClass() ) )->expArrayIndex;
|
||||||
m_classArray[ classJobIndex ] = level;
|
m_classArray[ classJobIndex ] = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob classjob )
|
void Sapphire::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob classjob )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( classjob ) )->expArrayIndex;
|
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast< uint8_t >( classjob ) )->expArrayIndex;
|
||||||
|
|
||||||
if( m_classArray[ classJobIndex ] == 0 )
|
if( m_classArray[ classJobIndex ] == 0 )
|
||||||
|
@ -866,8 +864,7 @@ void Sapphire::Entity::Player::setLookAt( uint8_t index, uint8_t value )
|
||||||
// spawn this player for pTarget
|
// spawn this player for pTarget
|
||||||
void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::debug( "[" + std::to_string( pTarget->getId() ) + "] Spawning " +
|
||||||
pLog->debug( "[" + std::to_string( pTarget->getId() ) + "] Spawning " +
|
|
||||||
getName() + " for " +
|
getName() + " for " +
|
||||||
pTarget->getName() );
|
pTarget->getName() );
|
||||||
|
|
||||||
|
@ -878,8 +875,7 @@ void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
||||||
void Sapphire::Entity::Player::despawn( Entity::PlayerPtr pTarget )
|
void Sapphire::Entity::Player::despawn( Entity::PlayerPtr pTarget )
|
||||||
{
|
{
|
||||||
auto pPlayer = pTarget;
|
auto pPlayer = pTarget;
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::debug( "despawning " + getName() + " for " + pTarget->getName() );
|
||||||
pLog->debug( "despawning " + getName() + " for " + pTarget->getName() );
|
|
||||||
|
|
||||||
pPlayer->freePlayerSpawnId( getId() );
|
pPlayer->freePlayerSpawnId( getId() );
|
||||||
|
|
||||||
|
@ -944,7 +940,7 @@ const uint8_t* Sapphire::Entity::Player::getStateFlags() const
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::actionHasCastTime( uint32_t actionId ) //TODO: Add logic for special cases
|
bool Sapphire::Entity::Player::actionHasCastTime( uint32_t actionId ) //TODO: Add logic for special cases
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
auto actionInfoPtr = pExdData->get< Sapphire::Data::Action >( actionId );
|
auto actionInfoPtr = pExdData->get< Sapphire::Data::Action >( actionId );
|
||||||
if( actionInfoPtr->preservesCombo )
|
if( actionInfoPtr->preservesCombo )
|
||||||
return false;
|
return false;
|
||||||
|
@ -1105,7 +1101,7 @@ void Sapphire::Entity::Player::update( int64_t currTime )
|
||||||
|
|
||||||
void Sapphire::Entity::Player::onMobKill( uint16_t nameId )
|
void Sapphire::Entity::Player::onMobKill( uint16_t nameId )
|
||||||
{
|
{
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||||
pScriptMgr->onMobKill( *getAsPlayer(), nameId );
|
pScriptMgr->onMobKill( *getAsPlayer(), nameId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1206,7 +1202,7 @@ const uint8_t* Sapphire::Entity::Player::getGcRankArray() const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = m_pFw->get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( m_id );
|
auto pSession = pServerZone->getSession( m_id );
|
||||||
|
|
||||||
if( !pSession )
|
if( !pSession )
|
||||||
|
@ -1221,7 +1217,7 @@ void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr
|
||||||
|
|
||||||
void Sapphire::Entity::Player::queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
void Sapphire::Entity::Player::queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = m_pFw->get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( m_id );
|
auto pSession = pServerZone->getSession( m_id );
|
||||||
|
|
||||||
if( !pSession )
|
if( !pSession )
|
||||||
|
@ -1557,7 +1553,7 @@ void Sapphire::Entity::Player::sendZonePackets()
|
||||||
if( isLogin() )
|
if( isLogin() )
|
||||||
{
|
{
|
||||||
//Update player map in servermgr - in case player name has been changed
|
//Update player map in servermgr - in case player name has been changed
|
||||||
auto pServerMgr = g_fw.get< Sapphire::ServerMgr >();
|
auto pServerMgr = m_pFw->get< World::ServerMgr >();
|
||||||
pServerMgr->updatePlayerName( getId(), getName() );
|
pServerMgr->updatePlayerName( getId(), getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1605,7 +1601,7 @@ void Sapphire::Entity::Player::sendZonePackets()
|
||||||
sendItemLevel();
|
sendItemLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
auto pHousingMgr = m_pFw->get< HousingMgr >();
|
||||||
if( Sapphire::LandPtr pLand = pHousingMgr->getLandByOwnerId( getId() ) )
|
if( Sapphire::LandPtr pLand = pHousingMgr->getLandByOwnerId( getId() ) )
|
||||||
{
|
{
|
||||||
uint32_t state = 0;
|
uint32_t state = 0;
|
||||||
|
@ -1733,9 +1729,9 @@ void Sapphire::Entity::Player::emoteInterrupt()
|
||||||
sendToInRangeSet( makeActorControl142( getId(), ActorControlType::EmoteInterrupt ) );
|
sendToInRangeSet( makeActorControl142( getId(), ActorControlType::EmoteInterrupt ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId, FrameworkPtr pFw )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
||||||
// TODO: only register this action if enough gil is in possession
|
// TODO: only register this action if enough gil is in possession
|
||||||
auto targetAetheryte = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId );
|
auto targetAetheryte = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId );
|
||||||
|
|
||||||
|
@ -1759,7 +1755,7 @@ void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
||||||
if( !insufficientGil )
|
if( !insufficientGil )
|
||||||
{
|
{
|
||||||
Action::ActionPtr pActionTeleport;
|
Action::ActionPtr pActionTeleport;
|
||||||
pActionTeleport = Action::make_ActionTeleport( getAsPlayer(), aetheryteId, cost );
|
pActionTeleport = Action::make_ActionTeleport( getAsPlayer(), aetheryteId, cost, pFw );
|
||||||
setCurrentAction( pActionTeleport );
|
setCurrentAction( pActionTeleport );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Sapphire::Entity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*! Contructor */
|
/*! Contructor */
|
||||||
Player();
|
Player( FrameworkPtr pFw );
|
||||||
|
|
||||||
/*! Destructor */
|
/*! Destructor */
|
||||||
~Player();
|
~Player();
|
||||||
|
@ -527,7 +527,7 @@ namespace Sapphire::Entity
|
||||||
void teleport( uint16_t aetheryteId, uint8_t type = 1 );
|
void teleport( uint16_t aetheryteId, uint8_t type = 1 );
|
||||||
|
|
||||||
/*! query teleport of a specified type */
|
/*! query teleport of a specified type */
|
||||||
void teleportQuery( uint16_t aetheryteId );
|
void teleportQuery( uint16_t aetheryteId, FrameworkPtr pFw );
|
||||||
|
|
||||||
/*! prepares zoning / fades out the screen */
|
/*! prepares zoning / fades out the screen */
|
||||||
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 );
|
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 );
|
||||||
|
@ -686,7 +686,7 @@ namespace Sapphire::Entity
|
||||||
void updateSql();
|
void updateSql();
|
||||||
|
|
||||||
/*! load player from db, by id */
|
/*! load player from db, by id */
|
||||||
bool load( uint32_t charId, SessionPtr pSession );
|
bool load( uint32_t charId, World::SessionPtr pSession );
|
||||||
|
|
||||||
/*! load active class data */
|
/*! load active class data */
|
||||||
bool loadClassData();
|
bool loadClassData();
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
@ -77,8 +75,7 @@ void Sapphire::Entity::Player::directorPlayScene( uint32_t eventId, uint32_t sce
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = getEvent( eventId );
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,8 +159,7 @@ Sapphire::Event::EventHandlerPtr Sapphire::Entity::Player::bootstrapSceneEvent(
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = getEvent( eventId );
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +223,7 @@ void Sapphire::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlaye
|
||||||
|
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +285,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
||||||
uint64_t additional )
|
uint64_t additional )
|
||||||
{
|
{
|
||||||
auto pEventAction = Action::make_EventAction( getAsChara(), eventId, action,
|
auto pEventAction = Action::make_EventAction( getAsChara(), eventId, action,
|
||||||
finishCallback, interruptCallback, additional );
|
finishCallback, interruptCallback, additional, m_pFw );
|
||||||
|
|
||||||
setCurrentAction( pEventAction );
|
setCurrentAction( pEventAction );
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = getEvent( eventId );
|
||||||
|
@ -303,8 +298,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
||||||
}
|
}
|
||||||
else if( !pEvent )
|
else if( !pEvent )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +326,7 @@ void Sapphire::Entity::Player::eventItemActionStart( uint32_t eventId,
|
||||||
|
|
||||||
void Sapphire::Entity::Player::onLogin()
|
void Sapphire::Entity::Player::onLogin()
|
||||||
{
|
{
|
||||||
auto pConfig = g_fw.get< ConfigMgr >();
|
auto pConfig = m_pFw->get< ConfigMgr >();
|
||||||
auto motd = pConfig->getValue< std::string >( "General", "MotD", "" );
|
auto motd = pConfig->getValue< std::string >( "General", "MotD", "" );
|
||||||
|
|
||||||
std::istringstream ss( motd );
|
std::istringstream ss( motd );
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "Inventory/Item.h"
|
#include "Inventory/Item.h"
|
||||||
#include "Inventory/ItemContainer.h"
|
#include "Inventory/ItemContainer.h"
|
||||||
#include "Inventory/ItemUtil.h"
|
|
||||||
|
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
@ -28,12 +28,11 @@
|
||||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||||
|
|
||||||
#include "Manager/InventoryMgr.h"
|
#include "Manager/InventoryMgr.h"
|
||||||
|
#include "Manager/ItemMgr.h"
|
||||||
|
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
@ -44,7 +43,7 @@ void Sapphire::Entity::Player::initInventory()
|
||||||
{
|
{
|
||||||
auto setupContainer = [ this ]( InventoryType type, uint8_t maxSize, const std::string& tableName,
|
auto setupContainer = [ this ]( InventoryType type, uint8_t maxSize, const std::string& tableName,
|
||||||
bool isMultiStorage, bool isPersistentStorage = true )
|
bool isMultiStorage, bool isPersistentStorage = true )
|
||||||
{ m_storageMap[ type ] = make_ItemContainer( type, maxSize, tableName, isMultiStorage, isPersistentStorage ); };
|
{ m_storageMap[ type ] = make_ItemContainer( type, maxSize, tableName, isMultiStorage, m_pFw, isPersistentStorage ); };
|
||||||
|
|
||||||
// main bags
|
// main bags
|
||||||
setupContainer( Bag0, 34, "charaiteminventory", true );
|
setupContainer( Bag0, 34, "charaiteminventory", true );
|
||||||
|
@ -115,7 +114,7 @@ void Sapphire::Entity::Player::sendItemLevel()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
||||||
{
|
{
|
||||||
auto exdData = g_fw.get< Sapphire::Data::ExdDataGenerated >();
|
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
||||||
if( !exdData )
|
if( !exdData )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -136,7 +135,7 @@ void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
||||||
|
|
||||||
void Sapphire::Entity::Player::equipSoulCrystal( ItemPtr pItem, bool updateJob )
|
void Sapphire::Entity::Player::equipSoulCrystal( ItemPtr pItem, bool updateJob )
|
||||||
{
|
{
|
||||||
auto exdData = g_fw.get< Sapphire::Data::ExdDataGenerated >();
|
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
||||||
if ( !exdData )
|
if ( !exdData )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -247,7 +246,7 @@ void Sapphire::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, Ite
|
||||||
|
|
||||||
void Sapphire::Entity::Player::unequipSoulCrystal( ItemPtr pItem )
|
void Sapphire::Entity::Player::unequipSoulCrystal( ItemPtr pItem )
|
||||||
{
|
{
|
||||||
auto exdData = g_fw.get< Sapphire::Data::ExdDataGenerated >();
|
auto exdData = m_pFw->get< Sapphire::Data::ExdDataGenerated >();
|
||||||
if ( !exdData )
|
if ( !exdData )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -357,7 +356,7 @@ void Sapphire::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t
|
||||||
|
|
||||||
void Sapphire::Entity::Player::sendInventory()
|
void Sapphire::Entity::Player::sendInventory()
|
||||||
{
|
{
|
||||||
auto pInvMgr = g_fw.get< World::Manager::InventoryMgr >();
|
auto pInvMgr = m_pFw->get< World::Manager::InventoryMgr >();
|
||||||
|
|
||||||
for( auto it = m_storageMap.begin(); it != m_storageMap.end(); ++it )
|
for( auto it = m_storageMap.begin(); it != m_storageMap.end(); ++it )
|
||||||
{
|
{
|
||||||
|
@ -425,8 +424,7 @@ uint32_t Sapphire::Entity::Player::getCrystal( CrystalType type )
|
||||||
|
|
||||||
void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
|
||||||
|
|
||||||
auto storage = m_storageMap[ type ];
|
auto storage = m_storageMap[ type ];
|
||||||
|
|
||||||
|
@ -450,13 +448,12 @@ void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
||||||
if( storage->isMultiStorage() )
|
if( storage->isMultiStorage() )
|
||||||
query += " AND storageId = " + std::to_string( static_cast< uint16_t >( type ) );
|
query += " AND storageId = " + std::to_string( static_cast< uint16_t >( type ) );
|
||||||
|
|
||||||
pLog->debug( query );
|
|
||||||
pDb->execute( query );
|
pDb->execute( query );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_UP );
|
||||||
|
|
||||||
// todo: add more fields
|
// todo: add more fields
|
||||||
|
@ -471,7 +468,7 @@ void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::deleteItemDb( Sapphire::ItemPtr item ) const
|
void Sapphire::Entity::Player::deleteItemDb( Sapphire::ItemPtr item ) const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_DELETE );
|
||||||
|
|
||||||
stmt->setInt64( 1, item->getUId() );
|
stmt->setInt64( 1, item->getUId() );
|
||||||
|
@ -489,8 +486,8 @@ bool Sapphire::Entity::Player::isObtainable( uint32_t catalogId, uint8_t quantit
|
||||||
|
|
||||||
Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_t quantity, bool isHq, bool silent )
|
Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_t quantity, bool isHq, bool silent )
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||||
|
|
||||||
// if item data doesn't exist or it's a blank field
|
// if item data doesn't exist or it's a blank field
|
||||||
|
@ -512,7 +509,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_
|
||||||
// add the related armoury bag to the applicable bags and try and fill a free slot there before falling back to regular inventory
|
// add the related armoury bag to the applicable bags and try and fill a free slot there before falling back to regular inventory
|
||||||
if( itemInfo->isEquippable && getEquipDisplayFlags() & StoreNewItemsInArmouryChest )
|
if( itemInfo->isEquippable && getEquipDisplayFlags() & StoreNewItemsInArmouryChest )
|
||||||
{
|
{
|
||||||
auto bag = Items::Util::getCharaEquipSlotCategoryToArmoryId( itemInfo->equipSlotCategory );
|
auto bag = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( itemInfo->equipSlotCategory );
|
||||||
|
|
||||||
bags.insert( bags.begin(), bag );
|
bags.insert( bags.begin(), bag );
|
||||||
}
|
}
|
||||||
|
@ -624,7 +621,7 @@ Sapphire::Entity::Player::moveItem( uint16_t fromInventoryId, uint8_t fromSlotId
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem )
|
bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem )
|
||||||
{
|
{
|
||||||
auto containerType = Items::Util::getContainerType( storageId );
|
auto containerType = World::Manager::ItemMgr::getContainerType( storageId );
|
||||||
|
|
||||||
m_storageMap[ storageId ]->setItem( slotId, pItem );
|
m_storageMap[ storageId ]->setItem( slotId, pItem );
|
||||||
|
|
||||||
|
@ -735,17 +732,17 @@ void Sapphire::Entity::Player::swapItem( uint16_t fromInventoryId, uint8_t fromS
|
||||||
|
|
||||||
// An item is being moved from bag0-3 to equippment, meaning
|
// An item is being moved from bag0-3 to equippment, meaning
|
||||||
// the swapped out item will be placed in the matching armory.
|
// the swapped out item will be placed in the matching armory.
|
||||||
if( Items::Util::isEquipment( toInventoryId )
|
if( World::Manager::ItemMgr::isEquipment( toInventoryId )
|
||||||
&& !Items::Util::isEquipment( fromInventoryId )
|
&& !World::Manager::ItemMgr::isEquipment( fromInventoryId )
|
||||||
&& !Items::Util::isArmory( fromInventoryId ) )
|
&& !World::Manager::ItemMgr::isArmory( fromInventoryId ) )
|
||||||
{
|
{
|
||||||
updateContainer( fromInventoryId, fromSlotId, nullptr );
|
updateContainer( fromInventoryId, fromSlotId, nullptr );
|
||||||
fromInventoryId = Items::Util::getCharaEquipSlotCategoryToArmoryId( toSlot );
|
fromInventoryId = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( toSlot );
|
||||||
fromSlotId = static_cast < uint8_t >( m_storageMap[ fromInventoryId ]->getFreeSlot() );
|
fromSlotId = static_cast < uint8_t >( m_storageMap[ fromInventoryId ]->getFreeSlot() );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto containerTypeFrom = Items::Util::getContainerType( fromInventoryId );
|
auto containerTypeFrom = World::Manager::ItemMgr::getContainerType( fromInventoryId );
|
||||||
auto containerTypeTo = Items::Util::getContainerType( toInventoryId );
|
auto containerTypeTo = World::Manager::ItemMgr::getContainerType( toInventoryId );
|
||||||
|
|
||||||
updateContainer( toInventoryId, toSlot, fromItem );
|
updateContainer( toInventoryId, toSlot, fromItem );
|
||||||
updateContainer( fromInventoryId, fromSlotId, toItem );
|
updateContainer( fromInventoryId, fromSlotId, toItem );
|
||||||
|
@ -807,7 +804,7 @@ uint16_t Sapphire::Entity::Player::calculateEquippedGearItemLevel()
|
||||||
iLvlResult += currItem->getItemLevel();
|
iLvlResult += currItem->getItemLevel();
|
||||||
|
|
||||||
// If item is weapon and isn't one-handed
|
// If item is weapon and isn't one-handed
|
||||||
if( currItem->isWeapon() && !Items::Util::isOneHandedWeapon( currItem->getCategory() ) )
|
if( currItem->isWeapon() && !World::Manager::ItemMgr::isOneHandedWeapon( currItem->getCategory() ) )
|
||||||
{
|
{
|
||||||
iLvlResult += currItem->getItemLevel();
|
iLvlResult += currItem->getItemLevel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
@ -1030,7 +1028,7 @@ void Sapphire::Entity::Player::removeQuestsCompleted( uint32_t questId )
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optionalChoice )
|
bool Sapphire::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optionalChoice )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint32_t playerLevel = getLevel();
|
uint32_t playerLevel = getLevel();
|
||||||
auto questInfo = pExdData->get< Sapphire::Data::Quest >( questId );
|
auto questInfo = pExdData->get< Sapphire::Data::Quest >( questId );
|
||||||
|
|
||||||
|
|
|
@ -16,24 +16,21 @@
|
||||||
#include "Territory/Zone.h"
|
#include "Territory/Zone.h"
|
||||||
#include "Inventory/Item.h"
|
#include "Inventory/Item.h"
|
||||||
#include "Inventory/ItemContainer.h"
|
#include "Inventory/ItemContainer.h"
|
||||||
#include "Inventory/ItemUtil.h"
|
#include "Manager/ItemMgr.h"
|
||||||
|
|
||||||
#include "ServerMgr.h"
|
#include "ServerMgr.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
// load player from the db
|
// load player from the db
|
||||||
bool Sapphire::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession )
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||||
auto pLog = g_fw.get< Logger >();
|
|
||||||
|
|
||||||
const std::string char_id_str = std::to_string( charId );
|
const std::string char_id_str = std::to_string( charId );
|
||||||
|
|
||||||
|
@ -110,8 +107,8 @@ bool Sapphire::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
||||||
// see if a valid zone could be found for the character
|
// see if a valid zone could be found for the character
|
||||||
if( !pCurrZone )
|
if( !pCurrZone )
|
||||||
{
|
{
|
||||||
pLog->error( "[" + char_id_str + "] Zone " + std::to_string( zoneId ) + " not found!" );
|
Logger::error( "[" + char_id_str + "] Zone " + std::to_string( zoneId ) + " not found!" );
|
||||||
pLog->error( "[" + char_id_str + "] Setting default zone instead" );
|
Logger::error( "[" + char_id_str + "] Setting default zone instead" );
|
||||||
|
|
||||||
// default to new gridania
|
// default to new gridania
|
||||||
// TODO: should probably just abort and mark character as corrupt
|
// TODO: should probably just abort and mark character as corrupt
|
||||||
|
@ -209,7 +206,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
||||||
m_pCell = nullptr;
|
m_pCell = nullptr;
|
||||||
|
|
||||||
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
||||||
pLog->error( "Player id " + char_id_str + " data corrupt!" );
|
Logger::error( "Player id " + char_id_str + " data corrupt!" );
|
||||||
|
|
||||||
m_maxHp = getMaxHp();
|
m_maxHp = getMaxHp();
|
||||||
m_maxMp = getMaxMp();
|
m_maxMp = getMaxMp();
|
||||||
|
@ -260,7 +257,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadActiveQuests()
|
bool Sapphire::Entity::Player::loadActiveQuests()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_QUEST );
|
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_QUEST );
|
||||||
|
|
||||||
stmt->setUInt( 1, m_id );
|
stmt->setUInt( 1, m_id );
|
||||||
|
@ -296,7 +293,7 @@ bool Sapphire::Entity::Player::loadActiveQuests()
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadClassData()
|
bool Sapphire::Entity::Player::loadClassData()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
// ClassIdx, Exp, Lvl
|
// ClassIdx, Exp, Lvl
|
||||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL );
|
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL );
|
||||||
stmt->setUInt( 1, m_id );
|
stmt->setUInt( 1, m_id );
|
||||||
|
@ -317,7 +314,7 @@ bool Sapphire::Entity::Player::loadClassData()
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadSearchInfo()
|
bool Sapphire::Entity::Player::loadSearchInfo()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_SEARCHINFO );
|
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_SEL_SEARCHINFO );
|
||||||
stmt->setUInt( 1, m_id );
|
stmt->setUInt( 1, m_id );
|
||||||
auto res = pDb->query( stmt );
|
auto res = pDb->query( stmt );
|
||||||
|
@ -339,7 +336,7 @@ bool Sapphire::Entity::Player::loadSearchInfo()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateSql()
|
void Sapphire::Entity::Player::updateSql()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
/*"Hp 1, Mp 2, Tp 3, Gp 4, Mode 5, Mount 6, InvincibleGM 7, Voice 8, "
|
/*"Hp 1, Mp 2, Tp 3, Gp 4, Mode 5, Mount 6, InvincibleGM 7, Voice 8, "
|
||||||
"Customize 9, ModelMainWeapon 10, ModelSubWeapon 11, ModelSystemWeapon 12, "
|
"Customize 9, ModelMainWeapon 10, ModelSubWeapon 11, ModelSystemWeapon 12, "
|
||||||
"ModelEquip 13, EmoteModeType 14, Language 15, IsNewGame 16, IsNewAdventurer 17, "
|
"ModelEquip 13, EmoteModeType 14, Language 15, IsNewGame 16, IsNewAdventurer 17, "
|
||||||
|
@ -481,8 +478,8 @@ void Sapphire::Entity::Player::updateSql()
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateDbClass() const
|
void Sapphire::Entity::Player::updateDbClass() const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
|
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
|
||||||
|
|
||||||
//Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?
|
//Exp = ?, Lvl = ? WHERE CharacterId = ? AND ClassIdx = ?
|
||||||
|
@ -496,7 +493,7 @@ void Sapphire::Entity::Player::updateDbClass() const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::insertDbClass( const uint8_t classJobIndex ) const
|
void Sapphire::Entity::Player::insertDbClass( const uint8_t classJobIndex ) const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmtClass = pDb->getPreparedStatement( Db::CHARA_CLASS_INS );
|
auto stmtClass = pDb->getPreparedStatement( Db::CHARA_CLASS_INS );
|
||||||
stmtClass->setInt( 1, getId() );
|
stmtClass->setInt( 1, getId() );
|
||||||
stmtClass->setInt( 2, classJobIndex );
|
stmtClass->setInt( 2, classJobIndex );
|
||||||
|
@ -507,7 +504,7 @@ void Sapphire::Entity::Player::insertDbClass( const uint8_t classJobIndex ) cons
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateDbSearchInfo() const
|
void Sapphire::Entity::Player::updateDbSearchInfo() const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmtS = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
auto stmtS = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTCLASS );
|
||||||
stmtS->setInt( 1, m_searchSelectClass );
|
stmtS->setInt( 1, m_searchSelectClass );
|
||||||
stmtS->setInt( 2, m_id );
|
stmtS->setInt( 2, m_id );
|
||||||
|
@ -526,7 +523,7 @@ void Sapphire::Entity::Player::updateDbSearchInfo() const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::updateDbAllQuests() const
|
void Sapphire::Entity::Player::updateDbAllQuests() const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
for( int32_t i = 0; i < 30; i++ )
|
for( int32_t i = 0; i < 30; i++ )
|
||||||
{
|
{
|
||||||
if( !m_activeQuests[ i ] )
|
if( !m_activeQuests[ i ] )
|
||||||
|
@ -551,7 +548,7 @@ void Sapphire::Entity::Player::updateDbAllQuests() const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::deleteQuest( uint16_t questId ) const
|
void Sapphire::Entity::Player::deleteQuest( uint16_t questId ) const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_DEL );
|
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_DEL );
|
||||||
stmt->setInt( 1, m_id );
|
stmt->setInt( 1, m_id );
|
||||||
stmt->setInt( 2, questId );
|
stmt->setInt( 2, questId );
|
||||||
|
@ -560,7 +557,7 @@ void Sapphire::Entity::Player::deleteQuest( uint16_t questId ) const
|
||||||
|
|
||||||
void Sapphire::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const
|
void Sapphire::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_INS );
|
auto stmt = pDb->getPreparedStatement( Db::CHARA_QUEST_INS );
|
||||||
stmt->setInt( 1, m_id );
|
stmt->setInt( 1, m_id );
|
||||||
stmt->setInt( 2, index );
|
stmt->setInt( 2, index );
|
||||||
|
@ -579,9 +576,10 @@ void Sapphire::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uin
|
||||||
|
|
||||||
Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity )
|
Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||||
|
auto itemMgr = m_pFw->get< World::Manager::ItemMgr >();
|
||||||
|
|
||||||
if( !itemInfo )
|
if( !itemInfo )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -591,7 +589,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
||||||
|
|
||||||
uint8_t flags = 0;
|
uint8_t flags = 0;
|
||||||
|
|
||||||
ItemPtr pItem = make_Item( Items::Util::getNextUId(), catalogId );
|
ItemPtr pItem = make_Item( Items::Util::getNextUId(), catalogId, m_pFw );
|
||||||
|
|
||||||
pItem->setStackSize( quantity );
|
pItem->setStackSize( quantity );
|
||||||
|
|
||||||
|
@ -607,7 +605,8 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::loadInventory()
|
bool Sapphire::Entity::Player::loadInventory()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto itemMgr = m_pFw->get< World::Manager::ItemMgr >();
|
||||||
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// load active gearset
|
// load active gearset
|
||||||
auto res = pDb->query( "SELECT storageId, container_0, container_1, container_2, container_3, "
|
auto res = pDb->query( "SELECT storageId, container_0, container_1, container_2, container_3, "
|
||||||
|
@ -628,7 +627,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
||||||
if( uItemId == 0 )
|
if( uItemId == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ItemPtr pItem = Items::Util::loadItem( uItemId );
|
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
||||||
|
|
||||||
if( pItem == nullptr )
|
if( pItem == nullptr )
|
||||||
continue;
|
continue;
|
||||||
|
@ -661,7 +660,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
||||||
if( uItemId == 0 )
|
if( uItemId == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ItemPtr pItem = Items::Util::loadItem( uItemId );
|
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
||||||
|
|
||||||
if( pItem == nullptr )
|
if( pItem == nullptr )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -5,16 +5,19 @@
|
||||||
|
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire
|
||||||
{
|
{
|
||||||
|
namespace World::Manager
|
||||||
class DebugCommandHandler;
|
{
|
||||||
|
class DebugCommandMgr;
|
||||||
|
}
|
||||||
|
|
||||||
class DebugCommand
|
class DebugCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using pFunc = void ( DebugCommandHandler::* )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
using pFunc = void ( World::Manager::DebugCommandMgr::* )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
||||||
|
|
||||||
// String for the command
|
// String for the command
|
||||||
std::string m_commandName;
|
std::string m_commandName;
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef _EVENTHELPER_H
|
|
||||||
#define _EVENTHELPER_H
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace Sapphire::Event
|
|
||||||
{
|
|
||||||
|
|
||||||
std::string getEventName( uint32_t eventId );
|
|
||||||
uint32_t mapEventActorToRealActor( uint32_t eventActorId );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -25,10 +25,15 @@ TYPE_FORWARD( House );
|
||||||
TYPE_FORWARD( InstanceContent );
|
TYPE_FORWARD( InstanceContent );
|
||||||
TYPE_FORWARD( Item );
|
TYPE_FORWARD( Item );
|
||||||
TYPE_FORWARD( ItemContainer );
|
TYPE_FORWARD( ItemContainer );
|
||||||
TYPE_FORWARD( Session );
|
|
||||||
TYPE_FORWARD( ZonePosition );
|
TYPE_FORWARD( ZonePosition );
|
||||||
TYPE_FORWARD( Land )
|
TYPE_FORWARD( Land );
|
||||||
TYPE_FORWARD( Linkshell )
|
TYPE_FORWARD( Linkshell );
|
||||||
|
TYPE_FORWARD( Framework );
|
||||||
|
|
||||||
|
namespace World
|
||||||
|
{
|
||||||
|
TYPE_FORWARD( Session );
|
||||||
|
}
|
||||||
|
|
||||||
namespace World::Territory::Housing
|
namespace World::Territory::Housing
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,18 +5,17 @@
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw, bool isHq ) :
|
||||||
|
|
||||||
Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, bool isHq ) :
|
|
||||||
m_id( catalogId ),
|
m_id( catalogId ),
|
||||||
m_uId( uId ),
|
m_uId( uId ),
|
||||||
m_isHq( isHq ),
|
m_isHq( isHq ),
|
||||||
m_stain( 0 ),
|
m_stain( 0 ),
|
||||||
m_durability( 30000 ),
|
m_durability( 30000 ),
|
||||||
m_spiritBond( 0 ),
|
m_spiritBond( 0 ),
|
||||||
m_reservedFlag( 0 )
|
m_reservedFlag( 0 ),
|
||||||
|
m_pFw( pFw )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||||
|
|
||||||
m_delayMs = itemInfo->delayms;
|
m_delayMs = itemInfo->delayms;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _ITEM_H_
|
#define _ITEM_H_
|
||||||
|
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire
|
||||||
{
|
{
|
||||||
|
@ -10,7 +11,7 @@ namespace Sapphire
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Item( uint64_t uId, uint32_t catalogId, bool isHq = false );
|
Item( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw, bool isHq = false );
|
||||||
|
|
||||||
virtual ~Item() = default;
|
virtual ~Item() = default;
|
||||||
|
|
||||||
|
@ -98,8 +99,8 @@ namespace Sapphire
|
||||||
uint16_t m_spiritBond;
|
uint16_t m_spiritBond;
|
||||||
uint32_t m_reservedFlag;
|
uint32_t m_reservedFlag;
|
||||||
|
|
||||||
|
FrameworkPtr m_pFw;
|
||||||
uint32_t m_additionalData;
|
uint32_t m_additionalData;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,14 @@
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
#include "ItemContainer.h"
|
#include "ItemContainer.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
Sapphire::ItemContainer::ItemContainer( uint16_t storageId, uint16_t maxSize, const std::string& tableName,
|
Sapphire::ItemContainer::ItemContainer( uint16_t storageId, uint16_t maxSize, const std::string& tableName,
|
||||||
bool isMultiStorage, bool removeItemOnContainerRemoval ) :
|
bool isMultiStorage, FrameworkPtr pFw, bool isPersistentStorage ) :
|
||||||
m_id( storageId ),
|
m_id( storageId ),
|
||||||
m_size( maxSize ),
|
m_size( maxSize ),
|
||||||
m_tableName( tableName ),
|
m_tableName( tableName ),
|
||||||
m_bMultiStorage( isMultiStorage ),
|
m_bMultiStorage( isMultiStorage ),
|
||||||
m_removeItemOnContainerRemove( removeItemOnContainerRemoval )
|
m_pFw( pFw ),
|
||||||
|
m_isPersistentStorage( isPersistentStorage )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,8 +38,7 @@ uint16_t Sapphire::ItemContainer::getEntryCount() const
|
||||||
|
|
||||||
void Sapphire::ItemContainer::removeItem( uint16_t slotId )
|
void Sapphire::ItemContainer::removeItem( uint16_t slotId )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
|
||||||
ItemMap::iterator it = m_itemMap.find( slotId );
|
ItemMap::iterator it = m_itemMap.find( slotId );
|
||||||
|
|
||||||
if( it != m_itemMap.end() )
|
if( it != m_itemMap.end() )
|
||||||
|
@ -50,11 +48,11 @@ void Sapphire::ItemContainer::removeItem( uint16_t slotId )
|
||||||
|
|
||||||
m_itemMap.erase( it );
|
m_itemMap.erase( it );
|
||||||
|
|
||||||
pLog->debug( "Dropped item from slot " + std::to_string( slotId ) );
|
Logger::debug( "Dropped item from slot " + std::to_string( slotId ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pLog->debug( "Item could not be dropped from slot " + std::to_string( slotId ) );
|
Logger::debug( "Item could not be dropped from slot " + std::to_string( slotId ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,8 +83,7 @@ Sapphire::ItemPtr Sapphire::ItemContainer::getItem( uint16_t slotId )
|
||||||
|
|
||||||
if( ( slotId > m_size ) )
|
if( ( slotId > m_size ) )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
Logger::error( "Slot out of range " + std::to_string( slotId ) );
|
||||||
pLog->error( "Slot out of range " + std::to_string( slotId ) );
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Sapphire
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ItemContainer( uint16_t storageId, uint16_t maxSize, const std::string& tableName, bool isMultiStorage,
|
ItemContainer( uint16_t storageId, uint16_t maxSize, const std::string& tableName, bool isMultiStorage,
|
||||||
bool removeItemOnContainerRemoval = true );
|
FrameworkPtr pFw, bool isPersistentStorage = true );
|
||||||
|
|
||||||
~ItemContainer();
|
~ItemContainer();
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ namespace Sapphire
|
||||||
uint16_t m_size;
|
uint16_t m_size;
|
||||||
std::string m_tableName;
|
std::string m_tableName;
|
||||||
bool m_bMultiStorage;
|
bool m_bMultiStorage;
|
||||||
bool m_removeItemOnContainerRemove;
|
FrameworkPtr m_pFw;
|
||||||
|
bool m_isPersistentStorage;
|
||||||
ItemMap m_itemMap;
|
ItemMap m_itemMap;
|
||||||
Entity::PlayerPtr m_pOwner;
|
Entity::PlayerPtr m_pOwner;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#ifndef SAPPHIRE_ITEMUTIL_H
|
|
||||||
#define SAPPHIRE_ITEMUTIL_H
|
|
||||||
|
|
||||||
#include <Common.h>
|
|
||||||
#include "ForwardsZone.h"
|
|
||||||
|
|
||||||
namespace Sapphire::Items::Util
|
|
||||||
{
|
|
||||||
|
|
||||||
ItemPtr loadItem( uint64_t uId );
|
|
||||||
|
|
||||||
/*! check if weapon category qualifies the weapon as onehanded */
|
|
||||||
bool isOneHandedWeapon( Common::ItemUICategory weaponCategory );
|
|
||||||
|
|
||||||
bool isArmory( uint16_t containerId );
|
|
||||||
|
|
||||||
bool isEquipment( uint16_t containerId );
|
|
||||||
|
|
||||||
uint16_t getCharaEquipSlotCategoryToArmoryId( uint8_t slotId );
|
|
||||||
|
|
||||||
Common::ContainerType getContainerType( uint32_t containerId );
|
|
||||||
|
|
||||||
uint32_t getNextUId();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //SAPPHIRE_ITEMMGR_H
|
|
27
src/world/Manager/BaseManager.h
Normal file
27
src/world/Manager/BaseManager.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef SAPPHIRE_MANAGER_H
|
||||||
|
#define SAPPHIRE_MANAGER_H
|
||||||
|
|
||||||
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
|
namespace Sapphire::World::Manager
|
||||||
|
{
|
||||||
|
|
||||||
|
class BaseManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit BaseManager( FrameworkPtr pFw ) : m_pFw( pFw ) {};
|
||||||
|
virtual ~BaseManager() = default;
|
||||||
|
|
||||||
|
FrameworkPtr framework() const
|
||||||
|
{ return m_pFw; }
|
||||||
|
void setFw( FrameworkPtr pFw )
|
||||||
|
{ m_pFw = pFw; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
FrameworkPtr m_pFw;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //SAPPHIRE_MANAGER_H
|
|
@ -11,8 +11,8 @@
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "DebugCommand.h"
|
#include "DebugCommand/DebugCommand.h"
|
||||||
#include "DebugCommandHandler.h"
|
#include "DebugCommandMgr.h"
|
||||||
|
|
||||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||||
|
@ -37,51 +37,50 @@
|
||||||
#include "Session.h"
|
#include "Session.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
using namespace Sapphire::Network;
|
using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
// instanciate and initialize commands
|
// instanciate and initialize commands
|
||||||
Sapphire::DebugCommandHandler::DebugCommandHandler()
|
Sapphire::World::Manager::DebugCommandMgr::DebugCommandMgr( FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
{
|
{
|
||||||
// Push all commands onto the register map ( command name - function - description - required GM level )
|
// Push all commands onto the register map ( command name - function - description - required GM level )
|
||||||
registerCommand( "set", &DebugCommandHandler::set, "Executes SET commands.", 1 );
|
registerCommand( "set", &DebugCommandMgr::set, "Executes SET commands.", 1 );
|
||||||
registerCommand( "get", &DebugCommandHandler::get, "Executes GET commands.", 1 );
|
registerCommand( "get", &DebugCommandMgr::get, "Executes GET commands.", 1 );
|
||||||
registerCommand( "add", &DebugCommandHandler::add, "Executes ADD commands.", 1 );
|
registerCommand( "add", &DebugCommandMgr::add, "Executes ADD commands.", 1 );
|
||||||
registerCommand( "inject", &DebugCommandHandler::injectPacket, "Loads and injects a premade packet.", 1 );
|
registerCommand( "inject", &DebugCommandMgr::injectPacket, "Loads and injects a premade packet.", 1 );
|
||||||
registerCommand( "injectc", &DebugCommandHandler::injectChatPacket, "Loads and injects a premade chat packet.", 1 );
|
registerCommand( "injectc", &DebugCommandMgr::injectChatPacket, "Loads and injects a premade chat packet.", 1 );
|
||||||
registerCommand( "replay", &DebugCommandHandler::replay, "Replays a saved capture folder.", 1 );
|
registerCommand( "replay", &DebugCommandMgr::replay, "Replays a saved capture folder.", 1 );
|
||||||
registerCommand( "nudge", &DebugCommandHandler::nudge, "Nudges you forward/up/down.", 1 );
|
registerCommand( "nudge", &DebugCommandMgr::nudge, "Nudges you forward/up/down.", 1 );
|
||||||
registerCommand( "info", &DebugCommandHandler::serverInfo, "Show server info.", 0 );
|
registerCommand( "info", &DebugCommandMgr::serverInfo, "Show server info.", 0 );
|
||||||
registerCommand( "help", &DebugCommandHandler::help, "Shows registered commands.", 0 );
|
registerCommand( "help", &DebugCommandMgr::help, "Shows registered commands.", 0 );
|
||||||
registerCommand( "script", &DebugCommandHandler::script, "Server script utilities.", 1 );
|
registerCommand( "script", &DebugCommandMgr::script, "Server script utilities.", 1 );
|
||||||
registerCommand( "instance", &DebugCommandHandler::instance, "Instance utilities", 1 );
|
registerCommand( "instance", &DebugCommandMgr::instance, "Instance utilities", 1 );
|
||||||
registerCommand( "housing", &DebugCommandHandler::housing, "Housing utilities", 1 );
|
registerCommand( "housing", &DebugCommandMgr::housing, "Housing utilities", 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear all loaded commands
|
// clear all loaded commands
|
||||||
Sapphire::DebugCommandHandler::~DebugCommandHandler()
|
Sapphire::World::Manager::DebugCommandMgr::~DebugCommandMgr()
|
||||||
{
|
{
|
||||||
for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it )
|
for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it )
|
||||||
( *it ).second.reset();
|
( *it ).second.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a command set to the register map
|
// add a command set to the register map
|
||||||
void Sapphire::DebugCommandHandler::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
|
void Sapphire::World::Manager::DebugCommandMgr::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
|
||||||
const std::string& hText, uint8_t uLevel )
|
const std::string& hText, uint8_t uLevel )
|
||||||
{
|
{
|
||||||
m_commandMap[ std::string( n ) ] = std::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
|
m_commandMap[ std::string( n ) ] = std::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to retrieve the command in question, execute if found
|
// try to retrieve the command in question, execute if found
|
||||||
void Sapphire::DebugCommandHandler::execCommand( char* data, Entity::Player& player )
|
void Sapphire::World::Manager::DebugCommandMgr::execCommand( char* data, Entity::Player& player )
|
||||||
{
|
{
|
||||||
|
|
||||||
// define callback pointer
|
// define callback pointer
|
||||||
void ( DebugCommandHandler::*pf )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
void ( DebugCommandMgr::*pf )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
||||||
|
|
||||||
std::string commandString;
|
std::string commandString;
|
||||||
|
|
||||||
|
@ -124,7 +123,8 @@ void Sapphire::DebugCommandHandler::execCommand( char* data, Entity::Player& pla
|
||||||
// Definition of the commands
|
// Definition of the commands
|
||||||
///////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::help( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Registered debug commands:" );
|
player.sendDebug( "Registered debug commands:" );
|
||||||
for( auto cmd : m_commandMap )
|
for( auto cmd : m_commandMap )
|
||||||
|
@ -136,11 +136,11 @@ void Sapphire::DebugCommandHandler::help( char* data, Entity::Player& player, st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::set( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pTerriMgr = framework()->get< TerritoryMgr >();
|
||||||
auto pTerriMgr = g_fw.get< TerritoryMgr >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
|
||||||
std::string subCommand = "";
|
std::string subCommand = "";
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ void Sapphire::DebugCommandHandler::set( char* data, Entity::Player& player, std
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||||
"subCommand " + subCommand + " params: " + params );
|
"subCommand " + subCommand + " params: " + params );
|
||||||
|
|
||||||
if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) )
|
if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) )
|
||||||
|
@ -375,9 +375,9 @@ void Sapphire::DebugCommandHandler::set( char* data, Entity::Player& player, std
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::add( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||||
"subCommand " + subCommand + " params: " + params );
|
"subCommand " + subCommand + " params: " + params );
|
||||||
|
|
||||||
|
|
||||||
|
@ -408,7 +408,8 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
||||||
|
|
||||||
sscanf( params.c_str(), "%d %d %hu", &id, &duration, ¶m );
|
sscanf( params.c_str(), "%d %d %hu", &id, &duration, ¶m );
|
||||||
|
|
||||||
auto effect = StatusEffect::make_StatusEffect( id, player.getAsPlayer(), player.getAsPlayer(), duration, 3000 );
|
auto effect = StatusEffect::make_StatusEffect( id, player.getAsPlayer(), player.getAsPlayer(),
|
||||||
|
duration, 3000, framework() );
|
||||||
effect->setParam( param );
|
effect->setParam( param );
|
||||||
|
|
||||||
player.addStatusEffect( effect );
|
player.addStatusEffect( effect );
|
||||||
|
@ -423,7 +424,7 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
||||||
}
|
}
|
||||||
else if( subCommand == "bnpc" )
|
else if( subCommand == "bnpc" )
|
||||||
{
|
{
|
||||||
auto serverZone = g_fw.get< ServerMgr >();
|
auto serverZone = framework()->get< World::ServerMgr >();
|
||||||
|
|
||||||
auto bNpcTemplate = serverZone->getBNpcTemplate( params );
|
auto bNpcTemplate = serverZone->getBNpcTemplate( params );
|
||||||
|
|
||||||
|
@ -433,7 +434,8 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
||||||
auto pBNpc = std::make_shared< Entity::BNpc >( bNpcTemplate,
|
auto pBNpc = std::make_shared< Entity::BNpc >( bNpcTemplate,
|
||||||
player.getPos().x,
|
player.getPos().x,
|
||||||
player.getPos().y,
|
player.getPos().y,
|
||||||
player.getPos().z, 1 );
|
player.getPos().z,
|
||||||
|
1, framework() );
|
||||||
|
|
||||||
auto playerZone = player.getCurrentZone();
|
auto playerZone = player.getCurrentZone();
|
||||||
|
|
||||||
|
@ -509,10 +511,10 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::get( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -531,7 +533,7 @@ void Sapphire::DebugCommandHandler::get( char* data, Entity::Player& player, std
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||||
"subCommand " + subCommand + " params: " + params );
|
"subCommand " + subCommand + " params: " + params );
|
||||||
|
|
||||||
|
|
||||||
|
@ -556,27 +558,28 @@ void Sapphire::DebugCommandHandler::get( char* data, Entity::Player& player, std
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sapphire::DebugCommandHandler::injectPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
Sapphire::World::Manager::DebugCommandMgr::injectPacket( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( player.getId() );
|
auto pSession = pServerZone->getSession( player.getId() );
|
||||||
if( pSession )
|
if( pSession )
|
||||||
pSession->getZoneConnection()->injectPacket( data + 7, player );
|
pSession->getZoneConnection()->injectPacket( data + 7, player );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::injectChatPacket( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::injectChatPacket( char* data, Entity::Player& player,
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
auto pSession = pServerZone->getSession( player.getId() );
|
auto pSession = pServerZone->getSession( player.getId() );
|
||||||
if( pSession )
|
if( pSession )
|
||||||
pSession->getChatConnection()->injectPacket( data + 8, player );
|
pSession->getChatConnection()->injectPacket( data + 8, player );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::replay( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::replay( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -595,7 +598,7 @@ void Sapphire::DebugCommandHandler::replay( char* data, Entity::Player& player,
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||||
"subCommand " + subCommand + " params: " + params );
|
"subCommand " + subCommand + " params: " + params );
|
||||||
|
|
||||||
|
|
||||||
|
@ -625,7 +628,8 @@ void Sapphire::DebugCommandHandler::replay( char* data, Entity::Player& player,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::nudge( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::nudge( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
|
|
||||||
|
@ -672,18 +676,19 @@ void Sapphire::DebugCommandHandler::nudge( char* data, Entity::Player& player, s
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sapphire::DebugCommandHandler::serverInfo( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
Sapphire::World::Manager::DebugCommandMgr::serverInfo( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
player.sendDebug( "SapphireZone " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
player.sendDebug( "SapphireZone " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
||||||
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
||||||
player.sendDebug( "Sessions: " + std::to_string( pServerZone->getSessionCount() ) );
|
player.sendDebug( "Sessions: " + std::to_string( pServerZone->getSessionCount() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::script( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pScriptMgr = framework()->get< Scripting::ScriptMgr >();
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
|
||||||
std::string subCommand;
|
std::string subCommand;
|
||||||
std::string params = "";
|
std::string params = "";
|
||||||
|
|
||||||
|
@ -703,7 +708,7 @@ void Sapphire::DebugCommandHandler::script( char* data, Entity::Player& player,
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||||
"subCommand " + subCommand + " params: " + params );
|
"subCommand " + subCommand + " params: " + params );
|
||||||
|
|
||||||
if( subCommand == "unload" )
|
if( subCommand == "unload" )
|
||||||
|
@ -769,9 +774,10 @@ void Sapphire::DebugCommandHandler::script( char* data, Entity::Player& player,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sapphire::DebugCommandHandler::instance( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
||||||
|
@ -985,9 +991,10 @@ Sapphire::DebugCommandHandler::instance( char* data, Entity::Player& player, std
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::DebugCommandHandler::housing( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
|
void Sapphire::World::Manager::DebugCommandMgr::housing( char* data, Entity::Player& player,
|
||||||
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
std::string cmd( data ), params, subCommand;
|
std::string cmd( data ), params, subCommand;
|
||||||
auto cmdPos = cmd.find_first_of( ' ' );
|
auto cmdPos = cmd.find_first_of( ' ' );
|
||||||
|
|
|
@ -4,23 +4,24 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
|
|
||||||
#include "DebugCommand.h"
|
#include "DebugCommand/DebugCommand.h"
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
|
|
||||||
// handler for in game commands
|
// handler for in game commands
|
||||||
class DebugCommandHandler
|
class DebugCommandMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// container mapping command string to command object
|
// container mapping command string to command object
|
||||||
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
|
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebugCommandHandler();
|
DebugCommandMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
~DebugCommandHandler();
|
~DebugCommandMgr();
|
||||||
|
|
||||||
// register command to command map
|
// register command to command map
|
||||||
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel );
|
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel );
|
|
@ -3,18 +3,20 @@
|
||||||
#include <Util/Util.h>
|
#include <Util/Util.h>
|
||||||
|
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "EventHelper.h"
|
#include "EventMgr.h"
|
||||||
#include "EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
|
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
|
|
||||||
|
|
||||||
using namespace Sapphire::Common;
|
using namespace Sapphire::Common;
|
||||||
|
|
||||||
std::string Sapphire::Event::getEventName( uint32_t eventId )
|
Sapphire::World::Manager::EventMgr::EventMgr( Sapphire::FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Sapphire::World::Manager::EventMgr::getEventName( uint32_t eventId )
|
||||||
|
{
|
||||||
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
uint16_t eventType = eventId >> 16;
|
uint16_t eventType = eventId >> 16;
|
||||||
|
|
||||||
auto unknown = std::string{ "unknown" };
|
auto unknown = std::string{ "unknown" };
|
||||||
|
@ -95,9 +97,9 @@ std::string Sapphire::Event::getEventName( uint32_t eventId )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Sapphire::Event::mapEventActorToRealActor( uint32_t eventActorId )
|
uint32_t Sapphire::World::Manager::EventMgr::mapEventActorToRealActor( uint32_t eventActorId )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto levelInfo = pExdData->get< Sapphire::Data::Level >( eventActorId );
|
auto levelInfo = pExdData->get< Sapphire::Data::Level >( eventActorId );
|
||||||
if( levelInfo )
|
if( levelInfo )
|
||||||
return levelInfo->object;
|
return levelInfo->object;
|
23
src/world/Manager/EventMgr.h
Normal file
23
src/world/Manager/EventMgr.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _EVENTHELPER_H
|
||||||
|
#define _EVENTHELPER_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include "Manager/BaseManager.h"
|
||||||
|
|
||||||
|
namespace Sapphire::World::Manager
|
||||||
|
{
|
||||||
|
|
||||||
|
class EventMgr : public BaseManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EventMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
|
std::string getEventName( uint32_t eventId );
|
||||||
|
|
||||||
|
uint32_t mapEventActorToRealActor( uint32_t eventActorId );
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -34,9 +34,8 @@ using namespace Sapphire::Network;
|
||||||
using namespace Sapphire::Network::Packets;
|
using namespace Sapphire::Network::Packets;
|
||||||
using namespace Sapphire::Network::Packets::Server;
|
using namespace Sapphire::Network::Packets::Server;
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
Sapphire::World::Manager::HousingMgr::HousingMgr( FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
Sapphire::World::Manager::HousingMgr::HousingMgr()
|
|
||||||
{
|
{
|
||||||
m_containerMap[ 0 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
m_containerMap[ 0 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||||
m_containerMap[ 1 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems2, InventoryType::HousingInteriorStoreroom2 );
|
m_containerMap[ 1 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems2, InventoryType::HousingInteriorStoreroom2 );
|
||||||
|
@ -287,13 +286,13 @@ uint32_t Sapphire::World::Manager::HousingMgr::toLandSetId( uint16_t territoryTy
|
||||||
|
|
||||||
Sapphire::Data::HousingZonePtr Sapphire::World::Manager::HousingMgr::getHousingZoneByLandSetId( uint32_t id )
|
Sapphire::Data::HousingZonePtr Sapphire::World::Manager::HousingMgr::getHousingZoneByLandSetId( uint32_t id )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = framework()->get< TerritoryMgr >();
|
||||||
return std::dynamic_pointer_cast< HousingZone >( pTeriMgr->getZoneByLandSetId( id ) );
|
return std::dynamic_pointer_cast< HousingZone >( pTeriMgr->getZoneByLandSetId( id ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32_t id )
|
Sapphire::LandPtr Sapphire::World::Manager::HousingMgr::getLandByOwnerId( uint32_t id )
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT LandSetId, LandId FROM land WHERE OwnerId = " + std::to_string( id ) );
|
auto res = pDb->query( "SELECT LandSetId, LandId FROM land WHERE OwnerId = " + std::to_string( id ) );
|
||||||
|
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
|
@ -335,7 +334,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t playerId = land->getOwnerId();
|
uint32_t playerId = land->getOwnerId();
|
||||||
std::string playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( playerId );
|
std::string playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( playerId );
|
||||||
|
|
||||||
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
|
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
|
||||||
|
|
||||||
|
@ -509,7 +508,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
||||||
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
|
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
|
||||||
|
|
||||||
auto owner = land->getOwnerId();
|
auto owner = land->getOwnerId();
|
||||||
auto playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( owner );
|
auto playerName = framework()->get< World::ServerMgr >()->getPlayerNameFromDb( owner );
|
||||||
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
|
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define SAPPHIRE_HOUSINGMGR_H
|
#define SAPPHIRE_HOUSINGMGR_H
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
#include "Territory/HousingZone.h"
|
#include "Territory/HousingZone.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -14,7 +15,7 @@ namespace Sapphire::Data
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class HousingMgr
|
class HousingMgr : public BaseManager
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -66,7 +67,7 @@ namespace Sapphire::World::Manager
|
||||||
*/
|
*/
|
||||||
using LandIdentToInventoryContainerMap = std::unordered_map< uint64_t, ContainerIdToContainerMap >;
|
using LandIdentToInventoryContainerMap = std::unordered_map< uint64_t, ContainerIdToContainerMap >;
|
||||||
|
|
||||||
HousingMgr();
|
HousingMgr( FrameworkPtr pFw );
|
||||||
virtual ~HousingMgr();
|
virtual ~HousingMgr();
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "ItemUtil.h"
|
#include "ItemMgr.h"
|
||||||
|
|
||||||
#include "ItemContainer.h"
|
#include "Inventory/ItemContainer.h"
|
||||||
#include "Item.h"
|
#include "Inventory/Item.h"
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
|
|
||||||
|
@ -9,10 +9,13 @@
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Database/DatabaseDef.h>
|
#include <Database/DatabaseDef.h>
|
||||||
|
|
||||||
|
Sapphire::World::Manager::ItemMgr::ItemMgr( Sapphire::FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
|
{
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
}
|
||||||
|
|
||||||
bool Sapphire::Items::Util::isArmory( uint16_t containerId )
|
bool Sapphire::World::Manager::ItemMgr::isArmory( uint16_t containerId )
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
containerId == Common::ArmoryBody ||
|
containerId == Common::ArmoryBody ||
|
||||||
|
@ -29,7 +32,8 @@ bool Sapphire::Items::Util::isArmory( uint16_t containerId )
|
||||||
containerId == Common::ArmorySoulCrystal;
|
containerId == Common::ArmorySoulCrystal;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Sapphire::Items::Util::getCharaEquipSlotCategoryToArmoryId( uint8_t slotId )
|
|
||||||
|
uint16_t Sapphire::World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( uint8_t slotId )
|
||||||
{
|
{
|
||||||
|
|
||||||
switch( slotId )
|
switch( slotId )
|
||||||
|
@ -87,13 +91,12 @@ uint16_t Sapphire::Items::Util::getCharaEquipSlotCategoryToArmoryId( uint8_t slo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Sapphire::Items::Util::isEquipment( uint16_t containerId )
|
bool Sapphire::World::Manager::ItemMgr::isEquipment( uint16_t containerId )
|
||||||
{
|
{
|
||||||
return containerId == Common::GearSet0;
|
return containerId == Common::GearSet0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Sapphire::World::Manager::ItemMgr::isOneHandedWeapon( Common::ItemUICategory weaponCategory )
|
||||||
bool Sapphire::Items::Util::isOneHandedWeapon( Common::ItemUICategory weaponCategory )
|
|
||||||
{
|
{
|
||||||
switch( weaponCategory )
|
switch( weaponCategory )
|
||||||
{
|
{
|
||||||
|
@ -117,10 +120,10 @@ bool Sapphire::Items::Util::isOneHandedWeapon( Common::ItemUICategory weaponCate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::ItemPtr Sapphire::Items::Util::loadItem( uint64_t uId )
|
Sapphire::ItemPtr Sapphire::World::Manager::ItemMgr::loadItem( uint64_t uId )
|
||||||
{
|
{
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
// load actual item
|
// load actual item
|
||||||
auto itemRes = pDb->query(
|
auto itemRes = pDb->query(
|
||||||
"SELECT catalogId, stack, flags FROM charaglobalitem WHERE itemId = " + std::to_string( uId ) + ";" );
|
"SELECT catalogId, stack, flags FROM charaglobalitem WHERE itemId = " + std::to_string( uId ) + ";" );
|
||||||
|
@ -132,7 +135,12 @@ Sapphire::ItemPtr Sapphire::Items::Util::loadItem( uint64_t uId )
|
||||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( itemRes->getUInt( 1 ) );
|
auto itemInfo = pExdData->get< Sapphire::Data::Item >( itemRes->getUInt( 1 ) );
|
||||||
bool isHq = itemRes->getUInt( 3 ) == 1;
|
bool isHq = itemRes->getUInt( 3 ) == 1;
|
||||||
|
|
||||||
ItemPtr pItem = make_Item( uId, itemRes->getUInt( 1 ), isHq );
|
ItemPtr pItem = make_Item( uId,
|
||||||
|
itemRes->getUInt( 1 ),
|
||||||
|
itemInfo->modelMain,
|
||||||
|
itemInfo->modelSub,
|
||||||
|
framework(),
|
||||||
|
isHq );
|
||||||
|
|
||||||
pItem->setStackSize( itemRes->getUInt( 2 ) );
|
pItem->setStackSize( itemRes->getUInt( 2 ) );
|
||||||
|
|
||||||
|
@ -144,7 +152,8 @@ Sapphire::ItemPtr Sapphire::Items::Util::loadItem( uint64_t uId )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Common::ContainerType Sapphire::Items::Util::getContainerType( uint32_t containerId )
|
|
||||||
|
Sapphire::Common::ContainerType Sapphire::World::Manager::ItemMgr::getContainerType( uint32_t containerId )
|
||||||
{
|
{
|
||||||
if( containerId < 5 )
|
if( containerId < 5 )
|
||||||
{
|
{
|
||||||
|
@ -168,11 +177,10 @@ Sapphire::Common::ContainerType Sapphire::Items::Util::getContainerType( uint32_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Sapphire::World::Manager::ItemMgr::getNextUId()
|
||||||
uint32_t Sapphire::Items::Util::getNextUId()
|
|
||||||
{
|
{
|
||||||
uint32_t charId = 0;
|
uint32_t charId = 0;
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto pQR = pDb->query( "SELECT MAX(ItemId) FROM charaglobalitem" );
|
auto pQR = pDb->query( "SELECT MAX(ItemId) FROM charaglobalitem" );
|
||||||
|
|
||||||
if( !pQR->next() )
|
if( !pQR->next() )
|
30
src/world/Manager/ItemMgr.h
Normal file
30
src/world/Manager/ItemMgr.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef SAPPHIRE_ITEMMGR_H
|
||||||
|
#define SAPPHIRE_ITEMMGR_H
|
||||||
|
|
||||||
|
#include <Common.h>
|
||||||
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
|
namespace Sapphire::World::Manager
|
||||||
|
{
|
||||||
|
|
||||||
|
class ItemMgr : public BaseManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ItemMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
|
ItemPtr loadItem( uint64_t uId );
|
||||||
|
|
||||||
|
uint32_t getNextUId();
|
||||||
|
|
||||||
|
/*! check if weapon category qualifies the weapon as onehanded */
|
||||||
|
static bool isOneHandedWeapon( Common::ItemUICategory weaponCategory );
|
||||||
|
static bool isArmory( uint16_t containerId );
|
||||||
|
static bool isEquipment( uint16_t containerId );
|
||||||
|
static uint16_t getCharaEquipSlotCategoryToArmoryId( uint8_t slotId );
|
||||||
|
static Common::ContainerType getContainerType( uint32_t containerId );
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //SAPPHIRE_ITEMMGR_H
|
|
@ -5,15 +5,14 @@
|
||||||
#include "Framework.h"
|
#include "Framework.h"
|
||||||
#include "LinkshellMgr.h"
|
#include "LinkshellMgr.h"
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
Sapphire::World::Manager::LinkshellMgr::LinkshellMgr( FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
Sapphire::World::Manager::LinkshellMgr::LinkshellMgr()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Manager::LinkshellMgr::loadLinkshells()
|
bool Sapphire::World::Manager::LinkshellMgr::loadLinkshells()
|
||||||
{
|
{
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT LinkshellId, MasterCharacterId, CharacterIdList, "
|
auto res = pDb->query( "SELECT LinkshellId, MasterCharacterId, CharacterIdList, "
|
||||||
"LinkshellName, LeaderIdList, InviteIdList "
|
"LinkshellName, LeaderIdList, InviteIdList "
|
||||||
"FROM infolinkshell "
|
"FROM infolinkshell "
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
|
|
||||||
class LinkshellMgr
|
class LinkshellMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::map< uint64_t, LinkshellPtr > m_linkshellIdMap;
|
std::map< uint64_t, LinkshellPtr > m_linkshellIdMap;
|
||||||
|
@ -19,7 +20,7 @@ namespace Sapphire::World::Manager
|
||||||
LinkshellPtr getLinkshellById( uint64_t lsId );
|
LinkshellPtr getLinkshellById( uint64_t lsId );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LinkshellMgr();
|
LinkshellMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
bool loadLinkshells();
|
bool loadLinkshells();
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,13 +10,18 @@
|
||||||
|
|
||||||
#include <Actor/Player.h>
|
#include <Actor/Player.h>
|
||||||
|
|
||||||
extern Sapphire::Framework g_fw;
|
|
||||||
using namespace Sapphire::World::Manager;
|
using namespace Sapphire::World::Manager;
|
||||||
|
|
||||||
|
Sapphire::World::Manager::PlayerMgr::PlayerMgr( Sapphire::FrameworkPtr pFw ) :
|
||||||
|
BaseManager( pFw )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param )
|
void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param )
|
||||||
{
|
{
|
||||||
// check if we have one in the db first
|
// check if we have one in the db first
|
||||||
auto terriMgr = g_fw.get< TerritoryMgr >();
|
auto terriMgr = framework()->get< TerritoryMgr >();
|
||||||
if( !terriMgr )
|
if( !terriMgr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -28,7 +33,7 @@ void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire:
|
||||||
// check if its a housing zone, zoning is different here
|
// check if its a housing zone, zoning is different here
|
||||||
if( terriMgr->isHousingTerritory( terriPos->getTargetZoneId() ) )
|
if( terriMgr->isHousingTerritory( terriPos->getTargetZoneId() ) )
|
||||||
{
|
{
|
||||||
auto housingMgr = g_fw.get< HousingMgr >();
|
auto housingMgr = framework()->get< HousingMgr >();
|
||||||
auto landSetId = housingMgr->toLandSetId( terriPos->getTargetZoneId(), param );
|
auto landSetId = housingMgr->toLandSetId( terriPos->getTargetZoneId(), param );
|
||||||
|
|
||||||
auto housingZone = housingMgr->getHousingZoneByLandSetId( landSetId );
|
auto housingZone = housingMgr->getHousingZoneByLandSetId( landSetId );
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
#include "BaseManager.h"
|
||||||
|
|
||||||
namespace Sapphire::World::Manager
|
namespace Sapphire::World::Manager
|
||||||
{
|
{
|
||||||
class PlayerMgr
|
class PlayerMgr : public Manager::BaseManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
PlayerMgr( FrameworkPtr pFw );
|
||||||
|
|
||||||
void movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param = 0 );
|
void movePlayerToLandDestination( Sapphire::Entity::Player& player, uint32_t landId, uint16_t param = 0 );
|
||||||
};
|
};
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue