mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 22:37:45 +00:00
Merge pull request #460 from NotAdam/housing
merge dependency_injection into housing + some minor housing fixes
This commit is contained in:
commit
bd8fcfc0a8
150 changed files with 1562 additions and 1439 deletions
|
@ -27,13 +27,11 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include <Framework.h>
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "SapphireAPI.h"
|
||||
|
||||
|
||||
Sapphire::Framework g_fw;
|
||||
Sapphire::Logger g_log;
|
||||
Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection > g_charaDb;
|
||||
Sapphire::Data::ExdDataGenerated g_exdDataGen;
|
||||
Sapphire::Network::SapphireAPI g_sapphireAPI;
|
||||
|
@ -41,6 +39,7 @@ Sapphire::Network::SapphireAPI g_sapphireAPI;
|
|||
namespace fs = std::experimental::filesystem;
|
||||
|
||||
using namespace std;
|
||||
using namespace Sapphire;
|
||||
|
||||
using HttpServer = SimpleWeb::Server< SimpleWeb::HTTP >;
|
||||
using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >;
|
||||
|
@ -64,17 +63,17 @@ void reloadConfig()
|
|||
|
||||
void print_request_info( shared_ptr< HttpServer::Request > request )
|
||||
{
|
||||
g_log.info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" );
|
||||
Logger::info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" );
|
||||
}
|
||||
|
||||
bool loadSettings( int32_t argc, char* argv[] )
|
||||
{
|
||||
g_log.info( "Loading config " + configPath );
|
||||
Logger::info( "Loading config " + configPath );
|
||||
|
||||
if( !m_pConfig->loadConfig( configPath ) )
|
||||
{
|
||||
g_log.fatal( "Error loading config " + configPath );
|
||||
g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||
Logger::fatal( "Error loading config " + configPath );
|
||||
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -135,17 +134,17 @@ bool loadSettings( int32_t argc, char* argv[] )
|
|||
}
|
||||
catch( ... )
|
||||
{
|
||||
g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
||||
g_log.error( "Usage: <arg> <val> \n" );
|
||||
Logger::error( "Error parsing argument: " + arg + " " + "value: " + 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", "" );
|
||||
if( !g_exdDataGen.init( dataPath ) )
|
||||
{
|
||||
g_log.fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
|
||||
g_log.fatal( "DataPath: " + dataPath );
|
||||
Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
|
||||
Logger::fatal( "DataPath: " + dataPath );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -168,7 +167,7 @@ bool loadSettings( int32_t argc, char* argv[] )
|
|||
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) );
|
||||
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" );
|
||||
|
||||
g_log.info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
|
||||
Logger::info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -279,7 +278,7 @@ void createAccount( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +312,7 @@ void login( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServer:
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -348,7 +347,7 @@ void deleteCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -396,7 +395,7 @@ void createCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -429,7 +428,7 @@ void insertSession( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,7 +463,7 @@ void checkNameTaken( shared_ptr< HttpServer::Response > response, shared_ptr< Ht
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -506,7 +505,7 @@ void checkSession( shared_ptr< HttpServer::Response > response, shared_ptr< Http
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -536,7 +535,7 @@ void getNextCharId( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -567,7 +566,7 @@ void getNextContentId( shared_ptr< HttpServer::Response > response, shared_ptr<
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -623,7 +622,7 @@ void getCharacterList( shared_ptr< HttpServer::Response > response, shared_ptr<
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -658,7 +657,7 @@ void get_init( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServ
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,7 +691,7 @@ void get_headline_all( shared_ptr< HttpServer::Response > response, shared_ptr<
|
|||
catch( exception& e )
|
||||
{
|
||||
*response << buildHttpResponse( 500 );
|
||||
g_log.error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,16 +734,13 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe
|
|||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
auto pLog = std::shared_ptr< Sapphire::Logger >( new Sapphire::Logger() );
|
||||
g_fw.set< Sapphire::Logger >( pLog );
|
||||
g_log.setLogPath( "log/SapphireAPI" );
|
||||
g_log.init();
|
||||
Logger::init( "log/SapphireAPI" );
|
||||
|
||||
g_log.info( "===========================================================" );
|
||||
g_log.info( "Sapphire API Server " );
|
||||
g_log.info( "Version: 0.0.1" );
|
||||
g_log.info( "Compiled: " __DATE__ " " __TIME__ );
|
||||
g_log.info( "===========================================================" );
|
||||
Logger::info( "===========================================================" );
|
||||
Logger::info( "Sapphire API Server " );
|
||||
Logger::info( "Version: 0.0.1" );
|
||||
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
|
||||
Logger::info( "===========================================================" );
|
||||
|
||||
if( !loadSettings( argc, argv ) )
|
||||
throw std::exception();
|
||||
|
@ -771,8 +767,8 @@ int main( int argc, char* argv[] )
|
|||
server.start();
|
||||
} );
|
||||
|
||||
g_log.info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
||||
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
|
||||
Logger::info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
||||
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
|
||||
|
||||
//Wait for server to start so that the client can connect
|
||||
this_thread::sleep_for( chrono::seconds( 1 ) );
|
||||
|
|
|
@ -785,10 +785,10 @@ namespace Sapphire::Common
|
|||
ExteriorWall,
|
||||
ExteriorWindow,
|
||||
ExteriorDoor,
|
||||
OtherFloorWall,
|
||||
OtherFloorFlooring,
|
||||
BasementWall,
|
||||
YardSign
|
||||
ExteriorRoofDecoration,
|
||||
ExteriorWallDecoration,
|
||||
ExteriorPlacard,
|
||||
ExteriorFence
|
||||
};
|
||||
|
||||
enum HousingInteriorSlot
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#include "PreparedStatement.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
|
||||
m_reconnecting( false ),
|
||||
m_prepareError( false ),
|
||||
|
@ -66,7 +64,7 @@ uint32_t Sapphire::Db::DbConnection::open()
|
|||
}
|
||||
catch( std::runtime_error& e )
|
||||
{
|
||||
g_fw.get< Logger >()->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -118,7 +116,7 @@ bool Sapphire::Db::DbConnection::execute( const std::string& sql )
|
|||
}
|
||||
catch( std::runtime_error& e )
|
||||
{
|
||||
g_fw.get< Logger >()->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +131,7 @@ std::shared_ptr< Mysql::ResultSet > Sapphire::Db::DbConnection::query( const std
|
|||
}
|
||||
catch( std::runtime_error& e )
|
||||
{
|
||||
g_fw.get< Logger >()->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +168,7 @@ Sapphire::Db::DbConnection::query( std::shared_ptr< Sapphire::Db::PreparedStatem
|
|||
}
|
||||
catch( std::runtime_error& e )
|
||||
{
|
||||
g_fw.get< Logger >()->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -196,7 +194,7 @@ bool Sapphire::Db::DbConnection::execute( std::shared_ptr< Sapphire::Db::Prepare
|
|||
}
|
||||
catch( std::runtime_error& e )
|
||||
{
|
||||
g_fw.get< Logger >()->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +230,7 @@ void Sapphire::Db::DbConnection::prepareStatement( uint32_t index, const std::st
|
|||
}
|
||||
catch( std::runtime_error& e )
|
||||
{
|
||||
g_fw.get< Logger >()->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
m_prepareError = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
#include "ZoneDbConnection.h"
|
||||
#include "DbWorkerPool.h"
|
||||
#include "Logging/Logger.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
Sapphire::Db::DbLoader::DbLoader()
|
||||
{
|
||||
|
@ -17,14 +14,12 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
|
|||
|
||||
m_open.push( [ this, info, &pool ]()->bool
|
||||
{
|
||||
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
const uint8_t asyncThreads = info.asyncThreads;
|
||||
const uint8_t synchThreads = info.syncThreads;
|
||||
|
||||
if( asyncThreads < 1 || asyncThreads > 32 )
|
||||
{
|
||||
pLog->error(
|
||||
Logger::error(
|
||||
"database: invalid number of worker threads specified. Please pick a value between 1 and 32." );
|
||||
return false;
|
||||
}
|
||||
|
@ -40,7 +35,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
|
|||
|
||||
if( error )
|
||||
{
|
||||
pLog->error( "DatabasePool failed to open." );
|
||||
Logger::error( "DatabasePool failed to open." );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +50,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
|
|||
{
|
||||
if( !pool.prepareStatements() )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Could not prepare statements of the database, see log for details." );
|
||||
Logger::error( "Could not prepare statements of the database, see log for details." );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#include "Logging/Logger.h"
|
||||
#include <mysql.h>
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
class PingOperation :
|
||||
public Sapphire::Db::Operation
|
||||
{
|
||||
|
@ -23,8 +21,7 @@ class PingOperation :
|
|||
};
|
||||
|
||||
template< class T >
|
||||
Sapphire::Db::DbWorkerPool< T >::DbWorkerPool()
|
||||
:
|
||||
Sapphire::Db::DbWorkerPool< T >::DbWorkerPool() :
|
||||
m_queue( new Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >() ),
|
||||
m_asyncThreads( 0 ),
|
||||
m_synchThreads( 0 )
|
||||
|
@ -39,8 +36,8 @@ Sapphire::Db::DbWorkerPool< T >::~DbWorkerPool()
|
|||
|
||||
template< class T >
|
||||
void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& info,
|
||||
uint8_t asyncThreads,
|
||||
uint8_t synchThreads )
|
||||
uint8_t asyncThreads,
|
||||
uint8_t synchThreads )
|
||||
{
|
||||
m_connectionInfo = info;
|
||||
m_asyncThreads = asyncThreads;
|
||||
|
@ -50,10 +47,9 @@ void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& i
|
|||
template< class T >
|
||||
uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
|
||||
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
|
||||
" Synchronous connections: " + std::to_string( m_synchThreads ) );
|
||||
Logger::info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
|
||||
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
|
||||
" Synchronous connections: " + std::to_string( m_synchThreads ) );
|
||||
|
||||
uint32_t error = openConnections( IDX_ASYNC, m_asyncThreads );
|
||||
|
||||
|
@ -64,9 +60,9 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
|||
|
||||
if( !error )
|
||||
{
|
||||
pLog->info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
|
||||
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
|
||||
" total connections running." );
|
||||
Logger::info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
|
||||
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
|
||||
" total connections running." );
|
||||
}
|
||||
|
||||
return error;
|
||||
|
@ -75,11 +71,10 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
|||
template< class T >
|
||||
void Sapphire::Db::DbWorkerPool< T >::close()
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
|
||||
Logger::info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
|
||||
m_connections[ IDX_ASYNC ].clear();
|
||||
m_connections[ IDX_SYNCH ].clear();
|
||||
pLog->info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." );
|
||||
Logger::info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace Sapphire
|
|||
|
||||
class ConfigMgr;
|
||||
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
|
||||
class Framework;
|
||||
using FrameworkPtr = std::shared_ptr< Framework >;
|
||||
|
||||
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( '/' );
|
||||
|
||||
|
@ -33,15 +33,10 @@ namespace Sapphire
|
|||
fs::create_directories( realPath );
|
||||
}
|
||||
|
||||
m_logFile = logPath;
|
||||
}
|
||||
|
||||
void Logger::init()
|
||||
{
|
||||
spdlog::init_thread_pool( 8192, 1 );
|
||||
|
||||
auto stdout_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >();
|
||||
auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( m_logFile + ".log", 0, 0 );
|
||||
auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( logPath + ".log", 0, 0 );
|
||||
|
||||
std::vector< spdlog::sink_ptr > sinks { stdout_sink, daily_sink };
|
||||
|
||||
|
|
|
@ -11,23 +11,20 @@ namespace Sapphire
|
|||
|
||||
private:
|
||||
std::string m_logFile;
|
||||
|
||||
public:
|
||||
Logger();
|
||||
|
||||
~Logger();
|
||||
|
||||
void init();
|
||||
public:
|
||||
|
||||
void error( const std::string& text );
|
||||
static void init( const std::string& logPath );
|
||||
|
||||
void info( const std::string& text );
|
||||
static void error( const std::string& text );
|
||||
|
||||
void debug( const std::string& text );
|
||||
static void info( const std::string& text );
|
||||
|
||||
void fatal( const std::string& text );
|
||||
static void debug( const std::string& text );
|
||||
|
||||
void setLogPath( const std::string& logPath );
|
||||
static void fatal( const std::string& text );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -346,6 +346,7 @@ enum ActorControlType : uint16_t
|
|||
RequestEstateEditGreeting = 0x45B,
|
||||
RequestEstateGreeting = 0x45C, // sends FFXIVIpcHousingEstateGreeting in return
|
||||
RequestEstateEditGuestAccessSettings = 0x45D,
|
||||
UpdateEstateGuestAccess = 0x45E,
|
||||
RequestEstateTagSettings = 0x45F,
|
||||
RequestEstateInventory = 0x0461,
|
||||
RequestHousingItemUI = 0x463,
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#include "Connection.h"
|
||||
#include "Hive.h"
|
||||
#include <functional>
|
||||
#include "Framework.h"
|
||||
|
||||
namespace Sapphire {
|
||||
namespace Network {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Connection::Connection( HivePtr hive ) :
|
||||
Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
|
||||
m_hive( hive ),
|
||||
m_socket( hive->GetService() ),
|
||||
m_io_strand( hive->GetService() ),
|
||||
m_receive_buffer_size( 32000 ),
|
||||
m_error_state( 0 )
|
||||
m_error_state( 0 ),
|
||||
m_pFw( pFw )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,12 @@
|
|||
#include "Acceptor.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Sapphire
|
||||
{
|
||||
class Framework;
|
||||
using FrameworkPtr = std::shared_ptr< Framework >;
|
||||
}
|
||||
|
||||
namespace Sapphire::Network
|
||||
{
|
||||
|
||||
|
@ -38,9 +44,9 @@ namespace Sapphire::Network
|
|||
std::list< std::vector< uint8_t > > m_pending_sends;
|
||||
int32_t m_receive_buffer_size;
|
||||
std::atomic< uint32_t > m_error_state;
|
||||
Sapphire::FrameworkPtr m_pFw;
|
||||
|
||||
|
||||
Connection( HivePtr hive );
|
||||
Connection( HivePtr hive, FrameworkPtr pFw );
|
||||
|
||||
virtual ~Connection();
|
||||
|
||||
|
@ -144,13 +150,13 @@ namespace Sapphire::Network
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
template< class T >
|
||||
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive )
|
||||
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive, FrameworkPtr pFw )
|
||||
{
|
||||
try
|
||||
{
|
||||
AcceptorPtr acceptor( new Acceptor( pHive ) );
|
||||
acceptor->Listen( listenIp, port );
|
||||
std::shared_ptr< T > connection( new T( pHive, acceptor ) );
|
||||
std::shared_ptr< T > connection( new T( pHive, acceptor, pFw ) );
|
||||
acceptor->Accept( connection );
|
||||
return connection;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace filesys = std::experimental::filesystem;
|
|||
|
||||
#include "DbManager.h"
|
||||
|
||||
Sapphire::Logger g_log;
|
||||
using namespace Sapphire;
|
||||
|
||||
std::vector< std::string > getAllFilesInDir( const std::string& dirPath,
|
||||
const std::vector< std::string > dirSkipList = {} )
|
||||
|
@ -77,20 +77,20 @@ std::string delChar( std::string &str, char del )
|
|||
|
||||
void printUsage()
|
||||
{
|
||||
g_log.info( " Usage: sapphire_dbm " );
|
||||
g_log.info( "\t --mode" );
|
||||
g_log.info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" );
|
||||
g_log.info( "\t\t check -> Checks if Sapphire DB-Version matches your DB-Version" );
|
||||
g_log.info( "\t\t update -> Updates your DB-Version to Sapphire DB-Version" );
|
||||
g_log.info( "\t\t clearchars -> Removes all character data from DB. Accounts will stay untouched" );
|
||||
g_log.info( "\t\t liquidate -> Removes all tables and deletes the DB" );
|
||||
g_log.info( "\t --user <mysqlUserName>" );
|
||||
g_log.info( "\t --pass <mysqlPassword> ( default empty )" );
|
||||
g_log.info( "\t --host <mysqlHost> ( default 127.0.0.1 )" );
|
||||
g_log.info( "\t --port <mysqlPort> ( default 3306 )" );
|
||||
g_log.info( "\t --database <mysqlDatabase>" );
|
||||
g_log.info( "\t --sfile <path/to/schemafile> ( default sql/schema/schema.sql )" );
|
||||
g_log.info( "\t --force ( skips user input / auto Yes )" );
|
||||
Logger::info( " Usage: sapphire_dbm " );
|
||||
Logger::info( "\t --mode" );
|
||||
Logger::info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" );
|
||||
Logger::info( "\t\t check -> Checks if Sapphire DB-Version matches your DB-Version" );
|
||||
Logger::info( "\t\t update -> Updates your DB-Version to Sapphire DB-Version" );
|
||||
Logger::info( "\t\t clearchars -> Removes all character data from DB. Accounts will stay untouched" );
|
||||
Logger::info( "\t\t liquidate -> Removes all tables and deletes the DB" );
|
||||
Logger::info( "\t --user <mysqlUserName>" );
|
||||
Logger::info( "\t --pass <mysqlPassword> ( default empty )" );
|
||||
Logger::info( "\t --host <mysqlHost> ( default 127.0.0.1 )" );
|
||||
Logger::info( "\t --port <mysqlPort> ( default 3306 )" );
|
||||
Logger::info( "\t --database <mysqlDatabase>" );
|
||||
Logger::info( "\t --sfile <path/to/schemafile> ( default sql/schema/schema.sql )" );
|
||||
Logger::info( "\t --force ( skips user input / auto Yes )" );
|
||||
}
|
||||
|
||||
int main( int32_t argc, char* argv[] )
|
||||
|
@ -104,8 +104,7 @@ int main( int32_t argc, char* argv[] )
|
|||
std::string database;
|
||||
std::string pass;
|
||||
|
||||
g_log.setLogPath( "log/SapphireDbm" );
|
||||
g_log.init();
|
||||
Logger::init( "log/SapphireDbm" );
|
||||
|
||||
std::string sFile;
|
||||
std::string iFile;
|
||||
|
@ -181,23 +180,23 @@ int main( int32_t argc, char* argv[] )
|
|||
}
|
||||
else
|
||||
{
|
||||
g_log.fatal( "Not a valid mode: " + mode + " !" );
|
||||
Logger::fatal( "Not a valid mode: " + mode + " !" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_log.info( "Launching in " + mode + " mode..." );
|
||||
Logger::info( "Launching in " + mode + " mode..." );
|
||||
|
||||
if( !dbm.connect() )
|
||||
{
|
||||
g_log.fatal( "Could not connect to server!" );
|
||||
g_log.fatal( dbm.getLastError() );
|
||||
Logger::fatal( "Could not connect to server!" );
|
||||
Logger::fatal( dbm.getLastError() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( !dbm.performAction() )
|
||||
{
|
||||
g_log.fatal( "Could not perform action!" );
|
||||
g_log.fatal( dbm.getLastError() );
|
||||
Logger::fatal( "Could not perform action!" );
|
||||
Logger::fatal( dbm.getLastError() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,11 @@ using namespace Sapphire::Network::Packets;
|
|||
using namespace Sapphire::Network::Packets::Server;
|
||||
|
||||
Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive,
|
||||
Sapphire::Network::AcceptorPtr pAcceptor )
|
||||
:
|
||||
Connection( pHive ), m_pAcceptor( pAcceptor ), m_bEncryptionInitialized( false )
|
||||
Sapphire::Network::AcceptorPtr pAcceptor,
|
||||
FrameworkPtr pFw ) :
|
||||
Connection( pHive, pFw ),
|
||||
m_pAcceptor( pAcceptor ),
|
||||
m_bEncryptionInitialized( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +41,7 @@ Sapphire::Network::GameConnection::~GameConnection()
|
|||
// overwrite the parents onConnect for our game socket needs
|
||||
void Sapphire::Network::GameConnection::OnAccept( const std::string& host, uint16_t port )
|
||||
{
|
||||
auto connection = make_GameConnection( m_hive, m_pAcceptor );
|
||||
auto connection = make_GameConnection( m_hive, m_pAcceptor, m_pFw );
|
||||
m_pAcceptor->Accept( connection );
|
||||
|
||||
g_log.info( "Connect from " + m_socket.remote_endpoint().address().to_string() );
|
||||
|
@ -186,7 +188,7 @@ void Sapphire::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet
|
|||
if( i == 3 )
|
||||
{
|
||||
charListPacket->data().entitledExpansion = 2;
|
||||
charListPacket->data().maxCharOnWorld = 8;
|
||||
charListPacket->data().maxCharOnWorld = 25;
|
||||
charListPacket->data().unknown8 = 8;
|
||||
charListPacket->data().veteranRank = 12;
|
||||
charListPacket->data().counter = ( i * 4 ) + 1;
|
||||
|
@ -473,7 +475,7 @@ void Sapphire::Network::GameConnection::generateEncryptionKey( uint32_t key, con
|
|||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader,
|
||||
const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData )
|
||||
const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData )
|
||||
{
|
||||
|
||||
for( auto inPacket : packetData )
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Sapphire::Network
|
|||
LockedQueue< Packets::GamePacketPtr > m_outQueue;
|
||||
|
||||
public:
|
||||
GameConnection( HivePtr pHive, AcceptorPtr pAcceptor );
|
||||
GameConnection( HivePtr pHive, AcceptorPtr pAcceptor, FrameworkPtr pFw );
|
||||
|
||||
~GameConnection();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <Logging/Logger.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
//#include "LobbySession.h"
|
||||
#include "Framework.h"
|
||||
|
||||
#include "ServerLobby.h"
|
||||
|
||||
|
@ -21,124 +21,124 @@
|
|||
|
||||
#include <thread>
|
||||
|
||||
Sapphire::Logger g_log;
|
||||
Sapphire::Network::RestConnector g_restConnector;
|
||||
|
||||
namespace Sapphire {
|
||||
|
||||
|
||||
ServerLobby::ServerLobby( const std::string& configPath ) :
|
||||
m_configPath( configPath ),
|
||||
m_numConnections( 0 )
|
||||
namespace Sapphire
|
||||
{
|
||||
m_pConfig = std::shared_ptr< ConfigMgr >( new ConfigMgr );
|
||||
}
|
||||
|
||||
ServerLobby::~ServerLobby( void )
|
||||
{
|
||||
}
|
||||
|
||||
LobbySessionPtr ServerLobby::getSession( char* sessionId )
|
||||
{
|
||||
return g_restConnector.getSession( sessionId );
|
||||
}
|
||||
|
||||
ConfigMgrPtr ServerLobby::getConfig() const
|
||||
{
|
||||
return m_pConfig;
|
||||
}
|
||||
|
||||
void ServerLobby::run( int32_t argc, char* argv[] )
|
||||
{
|
||||
g_log.setLogPath( "log/SapphireLobby" );
|
||||
g_log.init();
|
||||
|
||||
g_log.info( "===========================================================" );
|
||||
g_log.info( "Sapphire Server Project " );
|
||||
g_log.info( "Version: " + Version::VERSION );
|
||||
g_log.info( "Git Hash: " + Version::GIT_HASH );
|
||||
g_log.info( "Compiled: " __DATE__ " " __TIME__ );
|
||||
g_log.info( "===========================================================" );
|
||||
|
||||
if( !loadSettings( argc, argv ) )
|
||||
ServerLobby::ServerLobby( const std::string& configPath ) :
|
||||
m_configPath( configPath ),
|
||||
m_numConnections( 0 )
|
||||
{
|
||||
g_log.fatal( "Error loading settings! " );
|
||||
return;
|
||||
m_pConfig = std::shared_ptr< ConfigMgr >( new ConfigMgr );
|
||||
}
|
||||
|
||||
Network::HivePtr hive( new Network::Hive() );
|
||||
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
|
||||
|
||||
g_log.info(
|
||||
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
||||
m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) );
|
||||
|
||||
std::vector< std::thread > threadGroup;
|
||||
|
||||
threadGroup.emplace_back( std::bind( &Network::Hive::Run, hive.get() ) );
|
||||
|
||||
for( auto& thread : threadGroup )
|
||||
if( thread.joinable() )
|
||||
thread.join();
|
||||
|
||||
}
|
||||
|
||||
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
|
||||
{
|
||||
g_log.info( "Loading config " + m_configPath );
|
||||
|
||||
if( !m_pConfig->loadConfig( m_configPath ) )
|
||||
ServerLobby::~ServerLobby( void )
|
||||
{
|
||||
g_log.fatal( "Error loading config " + m_configPath );
|
||||
g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||
return false;
|
||||
}
|
||||
std::vector< std::string > args( argv + 1, argv + argc );
|
||||
for( size_t i = 0; i + 1 < args.size(); i += 2 )
|
||||
{
|
||||
std::string arg( "" );
|
||||
std::string val( "" );
|
||||
|
||||
try
|
||||
LobbySessionPtr ServerLobby::getSession( char* sessionId )
|
||||
{
|
||||
return g_restConnector.getSession( sessionId );
|
||||
}
|
||||
|
||||
ConfigMgrPtr ServerLobby::getConfig() const
|
||||
{
|
||||
return m_pConfig;
|
||||
}
|
||||
|
||||
void ServerLobby::run( int32_t argc, char* argv[] )
|
||||
{
|
||||
Logger::init( "log/SapphireLobby" );
|
||||
|
||||
Logger::info( "===========================================================" );
|
||||
Logger::info( "Sapphire Server Project " );
|
||||
Logger::info( "Version: " + Version::VERSION );
|
||||
Logger::info( "Git Hash: " + Version::GIT_HASH );
|
||||
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
|
||||
Logger::info( "===========================================================" );
|
||||
|
||||
if( !loadSettings( argc, argv ) )
|
||||
{
|
||||
std::transform( arg.begin(), arg.end(), arg.begin(), [](unsigned char c){ return std::tolower( c ); } );
|
||||
val = std::string( args[ i + 1 ] );
|
||||
Logger::fatal( "Error loading settings! " );
|
||||
return;
|
||||
}
|
||||
|
||||
// trim '-' from start of arg
|
||||
arg = arg.erase( 0, arg.find_first_not_of( '-' ) );
|
||||
auto pFw = std::make_shared< Framework >();
|
||||
Network::HivePtr hive( new Network::Hive() );
|
||||
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive, pFw );
|
||||
|
||||
if( arg == "ip" )
|
||||
Logger::info(
|
||||
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
||||
m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) );
|
||||
|
||||
std::vector< std::thread > threadGroup;
|
||||
|
||||
threadGroup.emplace_back( std::bind( &Network::Hive::Run, hive.get() ) );
|
||||
|
||||
for( auto& thread : threadGroup )
|
||||
if( thread.joinable() )
|
||||
thread.join();
|
||||
|
||||
}
|
||||
|
||||
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
|
||||
{
|
||||
Logger::info( "Loading config " + m_configPath );
|
||||
|
||||
if( !m_pConfig->loadConfig( m_configPath ) )
|
||||
{
|
||||
Logger::fatal( "Error loading config " + m_configPath );
|
||||
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||
return false;
|
||||
}
|
||||
std::vector< std::string > args( argv + 1, argv + argc );
|
||||
for( size_t i = 0; i + 1 < args.size(); i += 2 )
|
||||
{
|
||||
std::string arg( "" );
|
||||
std::string val( "" );
|
||||
|
||||
try
|
||||
{
|
||||
// todo: ip addr in config
|
||||
m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val );
|
||||
std::transform( arg.begin(), arg.end(), arg.begin(), [](unsigned char c){ return std::tolower( c ); } );
|
||||
val = std::string( args[ i + 1 ] );
|
||||
|
||||
// trim '-' from start of arg
|
||||
arg = arg.erase( 0, arg.find_first_not_of( '-' ) );
|
||||
|
||||
if( arg == "ip" )
|
||||
{
|
||||
// todo: ip addr in config
|
||||
m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val );
|
||||
}
|
||||
else if( arg == "p" || arg == "port" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val );
|
||||
}
|
||||
else if( arg == "worldip" || arg == "worldip" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.ZoneHost", val );
|
||||
}
|
||||
else if( arg == "worldport" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
|
||||
}
|
||||
}
|
||||
else if( arg == "p" || arg == "port" )
|
||||
catch( ... )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val );
|
||||
}
|
||||
else if( arg == "worldip" || arg == "worldip" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.ZoneHost", val );
|
||||
}
|
||||
else if( arg == "worldport" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
|
||||
Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
||||
Logger::error( "Usage: <arg> <val> \n" );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
||||
g_log.error( "Usage: <arg> <val> \n" );
|
||||
}
|
||||
|
||||
m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork", "ListenPort", 54994 );
|
||||
m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" );
|
||||
|
||||
g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork", "RestHost" ) + ":" +
|
||||
m_pConfig->getValue< std::string >( "GlobalNetwork", "RestPort" );
|
||||
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork", "ListenPort", 54994 );
|
||||
m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" );
|
||||
|
||||
g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork", "RestHost" ) + ":" +
|
||||
m_pConfig->getValue< std::string >( "GlobalNetwork", "RestPort" );
|
||||
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters", "ServerSecret" );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include "Event/EventHandler.h"
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManFst001_00039
|
||||
// Quest Name: Coming to Gridania
|
||||
|
@ -95,7 +96,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Event/EventHandler.h"
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManFst002_00124
|
||||
// Quest Name: Close to Home
|
||||
|
@ -192,7 +193,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManFst003_00123
|
||||
// Quest Name: Close to Home
|
||||
|
@ -81,7 +82,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManFst004_00124
|
||||
// Quest Name: Close to Home
|
||||
|
@ -81,7 +82,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ManFst004::Actor0 )
|
||||
{
|
||||
|
@ -223,10 +225,10 @@ private:
|
|||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
// accepting quest "close to home"
|
||||
player.updateQuest( getId(), 1 );
|
||||
player.updateQuest( getId(), Seq1 );
|
||||
player.setQuestUI8CH( getId(), 1 ); // receive key item
|
||||
// event is done, need to teleport to real zone.
|
||||
player.setZone( 132 );
|
||||
player.forceZoneing( Territorytype0 );
|
||||
//player.setZone(183); back to starting griania for debug purpose
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManSea001_00107
|
||||
// Quest Name: Coming to Limsa Lominsa
|
||||
|
@ -141,7 +142,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManSea002_00108
|
||||
// Quest Name: Close to Home
|
||||
|
@ -47,7 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManSea003_00109
|
||||
// Quest Name: Close to Home
|
||||
|
@ -63,7 +64,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManWil001_00594
|
||||
// Quest Name: Coming to Ul'dah
|
||||
|
@ -173,7 +174,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
// Quest Script: ManWil002_00568
|
||||
// Quest Name: Close to Home
|
||||
|
@ -69,7 +70,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -72,7 +73,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -58,7 +59,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 && !player.hasQuest( getId() ) )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -51,7 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -55,7 +56,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -55,7 +56,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -51,7 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -54,7 +55,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR0 )
|
||||
Scene00000( player );
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -48,7 +49,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -160,7 +161,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
@ -180,7 +182,8 @@ public:
|
|||
|
||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
|
||||
Scene00100( player );
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -55,7 +56,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -53,7 +54,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -48,7 +49,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -50,7 +51,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -46,7 +47,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -64,7 +65,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -56,7 +57,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <Actor/Player.h>
|
||||
#include "Event/EventHelper.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -64,7 +65,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -47,7 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -48,7 +49,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -52,7 +53,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -57,7 +58,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -50,7 +51,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <ctime>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -54,7 +55,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
@ -88,7 +90,8 @@ public:
|
|||
|
||||
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && emoteId == 41 && player.getQuestSeq( getId() ) == Seq1 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -54,7 +55,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 && !player.hasQuest( getId() ) )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -47,7 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -51,7 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -51,7 +52,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -45,7 +46,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -47,7 +48,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <Actor/Player.h>
|
||||
#include <Event/EventHelper.h>
|
||||
#include <Manager/EventMgr.h>
|
||||
#include <ScriptObject.h>
|
||||
#include "Framework.h"
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
@ -50,7 +51,8 @@ public:
|
|||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
|
||||
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
|
||||
if( actor == Actor0 )
|
||||
{
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
|
||||
#include <fstream>
|
||||
|
||||
|
||||
Sapphire::Logger g_log;
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||
const std::string datLocation(
|
||||
|
@ -91,13 +90,13 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s
|
|||
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 ) )
|
||||
{
|
||||
g_log.fatal( "Error setting up EXD data " );
|
||||
Logger::fatal( "Error setting up EXD data " );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -130,6 +129,6 @@ int main()
|
|||
result += generateEnum( "HousingAppeal", 0, "uint8_t" );
|
||||
result += "}\n";
|
||||
result += "}\n#endif\n";
|
||||
g_log.info( result );
|
||||
Logger::info( result );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
#include <regex>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
|
||||
Sapphire::Logger g_log;
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
bool skipUnmapped = true;
|
||||
|
||||
|
@ -324,10 +323,10 @@ std::string generateConstructorsDecl( const std::string& exd )
|
|||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
g_log.init();
|
||||
Logger::init( "struct_gen" );
|
||||
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 ] );
|
||||
}
|
||||
|
||||
|
@ -357,14 +356,14 @@ int main( int argc, char** argv )
|
|||
auto json = nlohmann::json();
|
||||
exJson >> json;
|
||||
|
||||
g_log.info( "Setting up EXD data" );
|
||||
Logger::info( "Setting up EXD data" );
|
||||
if( !g_exdData.init( datLocation ) )
|
||||
{
|
||||
g_log.fatal( "Error setting up EXD data " );
|
||||
Logger::fatal( "Error setting up EXD data " );
|
||||
return 0;
|
||||
}
|
||||
g_log.info( "Generating structs, this may take several minutes..." );
|
||||
g_log.info( "Go grab a coffee..." );
|
||||
Logger::info( "Generating structs, this may take several minutes..." );
|
||||
Logger::info( "Go grab a coffee..." );
|
||||
|
||||
std::string structDefs;
|
||||
std::string idListsDecl;
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
#include <streambuf>
|
||||
#include <regex>
|
||||
|
||||
|
||||
Sapphire::Logger g_log;
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
//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" );
|
||||
|
@ -28,30 +27,30 @@ const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Rebo
|
|||
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 ) )
|
||||
{
|
||||
g_log.fatal( "Error setting up EXD data " );
|
||||
Logger::fatal( "Error setting up EXD data " );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//g_log.info( "getting id list " );
|
||||
//Logger::info( "getting id list " );
|
||||
//auto idList = g_exdData.getGilShopIdList();
|
||||
|
||||
//g_log.info( "getting id list done" );
|
||||
//Logger::info( "getting id list done" );
|
||||
//for( auto id : idList )
|
||||
{
|
||||
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 );
|
||||
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 );
|
||||
g_log.info( "2 -> " + std::to_string( teri3->item ) );
|
||||
Logger::info( "2 -> " + std::to_string( teri3->item ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -22,9 +22,10 @@ namespace filesys = std::experimental::filesystem;
|
|||
#include <regex>
|
||||
#include <map>
|
||||
|
||||
Sapphire::Logger g_log;
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
//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" );
|
||||
|
||||
|
@ -194,12 +195,12 @@ std::string delChar( std::string &str, char del )
|
|||
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 ) )
|
||||
{
|
||||
g_log.fatal( "Error setting up EXD data " );
|
||||
Logger::fatal( "Error setting up EXD data " );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -223,7 +224,7 @@ int dumpSpawns()
|
|||
auto str = file.substr( 0, pos );
|
||||
pos = str.find_last_of( filesys::path::preferred_separator );
|
||||
auto zone = str.substr( pos + 1 );
|
||||
//g_log.info( zone );
|
||||
//Logger::info( zone );
|
||||
|
||||
FFXIVIpcNpcSpawn packet;
|
||||
std::ifstream is;
|
||||
|
@ -258,15 +259,15 @@ int dumpSpawns()
|
|||
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
||||
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
||||
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
||||
g_log.info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
||||
g_log.info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
||||
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
||||
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
||||
|
||||
for( auto mob : entry.second )
|
||||
{
|
||||
nameToPacketList[ mob.bNPCBase ].push_back( mob );
|
||||
|
||||
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;
|
||||
|
@ -282,7 +283,7 @@ int dumpSpawns()
|
|||
for( auto mobName : lvlToPacket )
|
||||
{
|
||||
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++;
|
||||
for( FFXIVIpcNpcSpawn instance : mobName.second )
|
||||
|
@ -314,15 +315,15 @@ int dumpSpawns()
|
|||
std::string name = delChar( nameStruct->singular, ' ' );
|
||||
name = delChar( name, '\'' );
|
||||
|
||||
g_log.info( "|----> " + name + "_" + std::to_string( instance.bNPCBase ) + " " +
|
||||
std::to_string( instance.posX ) + ", " +
|
||||
std::to_string( instance.posY ) + ", " +
|
||||
std::to_string( instance.posZ ) + ", " +
|
||||
std::to_string( instance.modelChara ) + ", " +
|
||||
std::to_string( instance.gimmickId ) + ", " +
|
||||
std::to_string( instance.level ) + ", " +
|
||||
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.posX ) + ", " +
|
||||
std::to_string( instance.posY ) + ", " +
|
||||
std::to_string( instance.posZ ) + ", " +
|
||||
std::to_string( instance.modelChara ) + ", " +
|
||||
std::to_string( instance.gimmickId ) + ", " +
|
||||
std::to_string( instance.level ) + ", " +
|
||||
std::to_string( instance.hPMax ) );
|
||||
//Logger::info( "|----> " + name + " - " + std::to_string( instance.bNPCBase ) + ", " + std::to_string( instance.gimmickId ) );
|
||||
|
||||
|
||||
|
||||
|
@ -340,7 +341,7 @@ int dumpSpawns()
|
|||
+ "UNHEX( '" + cusStr + "'), "
|
||||
+ "UNHEX( '" + modelStr + "') );\n";*/
|
||||
|
||||
//g_log.info( output );
|
||||
//Logger::info( 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;
|
||||
}
|
||||
|
@ -360,12 +361,12 @@ int dumpSpawns()
|
|||
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 ) )
|
||||
{
|
||||
g_log.fatal( "Error setting up EXD data " );
|
||||
Logger::fatal( "Error setting up EXD data " );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -389,7 +390,7 @@ int dumpTemplates()
|
|||
auto str = file.substr( 0, pos );
|
||||
pos = str.find_last_of( filesys::path::preferred_separator );
|
||||
auto zone = str.substr( pos + 1 );
|
||||
//g_log.info( zone );
|
||||
//Logger::info( zone );
|
||||
|
||||
FFXIVIpcNpcSpawn packet;
|
||||
std::ifstream is;
|
||||
|
@ -419,7 +420,7 @@ int dumpTemplates()
|
|||
{
|
||||
auto zoneIdStr = file.substr( pos + 1 );
|
||||
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( std::stoi( zoneIdStr ) );
|
||||
g_log.info( zoneIdStr + " - " + teri1->name );
|
||||
Logger::info( zoneIdStr + " - " + teri1->name );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -434,7 +435,7 @@ int dumpTemplates()
|
|||
nameToPacketList[ packet.bNPCName ].push_back( packet );
|
||||
|
||||
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 teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
||||
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
||||
g_log.info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
||||
g_log.info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
||||
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
||||
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
||||
|
||||
for( auto mob : entry.second )
|
||||
{
|
||||
nameToPacketList[ mob.bNPCBase ].push_back( mob );
|
||||
|
||||
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 )
|
||||
{
|
||||
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);
|
||||
//for( FFXIVIpcNpcSpawn instance : mobName.second )
|
||||
|
@ -494,8 +495,8 @@ int dumpTemplates()
|
|||
|
||||
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 ) );
|
||||
// g_log.info( "|----> " + std::to_string( instance.bNPCBase ) +
|
||||
//Logger::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.mainWeaponModel ) +
|
||||
// ", " + std::to_string( instance.secWeaponModel ) +
|
||||
// ", " + std::to_string( instance.aggressionMode ) +
|
||||
|
@ -522,11 +523,11 @@ int dumpTemplates()
|
|||
+ "UNHEX( '" + cusStr + "'), "
|
||||
+ "UNHEX( '" + modelStr + "') );\n";
|
||||
|
||||
g_log.info( output );
|
||||
Logger::info( 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.u2b ) +
|
||||
", " + std::to_string( instance.u3b ) +
|
||||
|
@ -554,15 +555,15 @@ int dumpTemplates()
|
|||
|
||||
}
|
||||
out.close();
|
||||
/*g_log.info( "getting id list " );
|
||||
/*Logger::info( "getting id list " );
|
||||
auto idList = g_exdData.getTerritoryTypeIdList();
|
||||
|
||||
g_log.info( "getting id list done" );
|
||||
Logger::info( "getting id list done" );
|
||||
for( auto id : idList )
|
||||
{
|
||||
auto teri1 = g_exdData.get<Sapphire::Data::TerritoryType>( id );
|
||||
|
||||
g_log.info( teri1->name );
|
||||
Logger::info( teri1->name );
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -20,10 +20,9 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
Sapphire::Logger g_log;
|
||||
Sapphire::Data::ExdDataGenerated g_exdDataGen;
|
||||
namespace fs = std::experimental::filesystem;
|
||||
using namespace Sapphire;
|
||||
|
||||
const std::string onTalkStr(
|
||||
" 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 )
|
||||
{
|
||||
|
||||
g_log.init();
|
||||
Logger::init( "quest_parser" );
|
||||
|
||||
bool unluac = false;
|
||||
// std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||
|
@ -341,11 +340,11 @@ int main( int argc, char** argv )
|
|||
|
||||
unluac = true;
|
||||
|
||||
g_log.info( "Setting up generated EXD data" );
|
||||
Logger::info( "Setting up generated EXD data" );
|
||||
if( !g_exdDataGen.init( datLocation ) )
|
||||
{
|
||||
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";
|
||||
return 0;
|
||||
}
|
||||
|
@ -357,13 +356,13 @@ int main( int argc, char** argv )
|
|||
if( !fs::exists( "./generated" ) )
|
||||
fs::create_directory( "./generated" );
|
||||
|
||||
g_log.info( "Export in progress" );
|
||||
Logger::info( "Export in progress" );
|
||||
|
||||
uint32_t updateInterval = rows.size() / 20;
|
||||
uint32_t i = 0;
|
||||
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 );
|
||||
|
||||
if( questInfo->name.empty() || questInfo->id.empty() )
|
||||
|
@ -408,7 +407,7 @@ int main( int argc, char** argv )
|
|||
"generated/" + questInfo->id + ".lua";
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ namespace Sapphire::Action
|
|||
|
||||
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::ActorControl;
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
Sapphire::Action::ActionCast::ActionCast()
|
||||
{
|
||||
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_id = actionId;
|
||||
m_handleActionType = HandleActionType::Spell;
|
||||
|
@ -70,7 +70,7 @@ void Sapphire::Action::ActionCast::onFinish()
|
|||
if( !m_pSource )
|
||||
return;
|
||||
|
||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
||||
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
|
||||
|
||||
auto pPlayer = m_pSource->getAsPlayer();
|
||||
pPlayer->sendDebug( "onFinish()" );
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Sapphire::Action
|
|||
|
||||
~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;
|
||||
|
||||
|
|
|
@ -19,16 +19,14 @@ using namespace Sapphire::Network::Packets;
|
|||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
Sapphire::Action::ActionTeleport::ActionTeleport()
|
||||
{
|
||||
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_id = 5;
|
||||
m_handleActionType = HandleActionType::Teleport;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Sapphire::Action
|
|||
|
||||
~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;
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "EventAction.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network;
|
||||
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,
|
||||
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_handleActionType = HandleActionType::Event;
|
||||
m_eventId = eventId;
|
||||
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_onActionFinishClb = finishRef;
|
||||
m_onActionInterruptClb = interruptRef;
|
||||
|
@ -95,8 +94,7 @@ void Sapphire::Action::EventAction::onFinish()
|
|||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -134,8 +132,7 @@ void Sapphire::Action::EventAction::onInterrupt()
|
|||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace 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 );
|
||||
|
||||
void onStart() override;
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "EventItemAction.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
@ -83,8 +81,7 @@ void Sapphire::Action::EventItemAction::onFinish()
|
|||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -112,8 +109,7 @@ void Sapphire::Action::EventItemAction::onInterrupt()
|
|||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( e.what() );
|
||||
Logger::error( e.what() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
|
||||
#include "Math/CalcBattle.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
//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 )
|
||||
{
|
||||
auto pServerZone = g_fw.get< ServerMgr >();
|
||||
if( bToSelf && isPlayer() )
|
||||
{
|
||||
auto pPlayer = getAsPlayer();
|
||||
|
||||
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 );
|
||||
pPlayer->queuePacket( pPacket );
|
||||
}
|
||||
|
||||
if( m_inRangePlayers.empty() )
|
||||
|
|
|
@ -28,21 +28,21 @@
|
|||
#include "BNpc.h"
|
||||
#include "BNpcTemplate.h"
|
||||
#include "Manager/TerritoryMgr.h"
|
||||
#include "Framework.h"
|
||||
#include "Common.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
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_displayFlags = pTemplate->getDisplayFlags();
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace Sapphire::Entity
|
|||
{
|
||||
|
||||
public:
|
||||
BNpc();
|
||||
BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level );
|
||||
BNpc( FrameworkPtr pFw );
|
||||
BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level, FrameworkPtr pFw );
|
||||
|
||||
virtual ~BNpc() override;
|
||||
|
||||
|
|
|
@ -29,17 +29,16 @@
|
|||
#include "Framework.h"
|
||||
#include "Common.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
Sapphire::Entity::Chara::Chara( ObjKind type ) :
|
||||
Sapphire::Entity::Chara::Chara( ObjKind type, FrameworkPtr pFw ) :
|
||||
Actor( type ),
|
||||
m_pose( 0 ),
|
||||
m_targetId( INVALID_GAME_OBJECT_ID )
|
||||
m_targetId( INVALID_GAME_OBJECT_ID ),
|
||||
m_pFw( pFw )
|
||||
{
|
||||
// initialize the free slot queue
|
||||
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,
|
||||
uint64_t param2, Entity::Chara& target )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
if( isPlayer() )
|
||||
{
|
||||
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:
|
||||
{
|
||||
uint32_t calculatedHeal = Math::CalcBattle::calculateHealValue( getAsPlayer(),
|
||||
static_cast< uint32_t >( param1 ) );
|
||||
static_cast< uint32_t >( param1 ),
|
||||
m_pFw );
|
||||
|
||||
Server::EffectEntry effectEntry{};
|
||||
effectEntry.value = calculatedHeal;
|
||||
|
@ -594,7 +594,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
|||
/*! \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 )
|
||||
{
|
||||
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 );
|
||||
addStatusEffect( effect );
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ void Sapphire::Entity::Chara::addStatusEffectByIdIfNotExist( uint32_t id, int32_
|
|||
if( hasStatusEffect( id ) )
|
||||
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 );
|
||||
addStatusEffect( effect );
|
||||
|
||||
|
|
|
@ -109,9 +109,10 @@ namespace Sapphire::Entity
|
|||
std::queue< uint8_t > m_statusEffectFreeSlotQueue;
|
||||
std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList;
|
||||
std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap;
|
||||
FrameworkPtr m_pFw;
|
||||
|
||||
public:
|
||||
Chara( Common::ObjKind type );
|
||||
Chara( Common::ObjKind type, FrameworkPtr pFw );
|
||||
|
||||
virtual ~Chara() override;
|
||||
|
||||
|
|
|
@ -18,10 +18,6 @@ using namespace Sapphire::Network::Packets;
|
|||
using namespace Sapphire::Network::Packets::Server;
|
||||
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,
|
||||
uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
|
||||
float rotation, const std::string& givenName ) :
|
||||
|
@ -123,9 +119,7 @@ void Sapphire::Entity::EventObject::spawn( Sapphire::Entity::PlayerPtr pTarget )
|
|||
if( !pTarget->isObjSpawnIndexValid( spawnIndex ) )
|
||||
return;
|
||||
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
|
||||
pLog->debug( "Spawning EObj: id:" + std::to_string( getId() ) + " name:" + getName() );
|
||||
Logger::debug( "Spawning EObj: id:" + std::to_string( getId() ) + " name:" + getName() );
|
||||
|
||||
auto eobjStatePacket = makeZonePacket< FFXIVIpcObjectSpawn >( getId(), pTarget->getId() );
|
||||
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 )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->debug( "despawn eobj: " + std::to_string( getId() ) );
|
||||
Logger::debug( "despawn eobj: " + std::to_string( getId() ) );
|
||||
|
||||
pTarget->freeObjSpawnIndexForActorId( getId() );
|
||||
}
|
||||
|
|
|
@ -30,15 +30,13 @@
|
|||
#include "Framework.h"
|
||||
#include "Common.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
Sapphire::Entity::Npc::Npc( ObjKind type ) :
|
||||
Chara( type )
|
||||
Sapphire::Entity::Npc::Npc( ObjKind type, FrameworkPtr pFw ) :
|
||||
Chara( type, pFw )
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Sapphire::Entity
|
|||
{
|
||||
|
||||
public:
|
||||
Npc( Common::ObjKind type );
|
||||
Npc( Common::ObjKind type, FrameworkPtr pFw );
|
||||
|
||||
virtual ~Npc() override;
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
#include "ServerMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
|
@ -56,8 +54,8 @@ using InvSlotPair = std::pair< uint16_t, int8_t >;
|
|||
using InvSlotPairVec = std::vector< InvSlotPair >;
|
||||
|
||||
// player constructor
|
||||
Sapphire::Entity::Player::Player() :
|
||||
Chara( ObjKind::Player ),
|
||||
Sapphire::Entity::Player::Player( FrameworkPtr pFw ) :
|
||||
Chara( ObjKind::Player, pFw ),
|
||||
m_lastWrite( 0 ),
|
||||
m_lastPing( 0 ),
|
||||
m_bIsLogin( false ),
|
||||
|
@ -109,7 +107,7 @@ Sapphire::Entity::Player::~Player()
|
|||
|
||||
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() );
|
||||
if( session )
|
||||
session->getZoneConnection()->injectPacket( path, *this );
|
||||
|
@ -195,7 +193,7 @@ bool Sapphire::Entity::Player::isMarkedForRemoval() 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 )
|
||||
return OnlineStatus::Online;
|
||||
|
||||
|
@ -250,7 +248,7 @@ void Sapphire::Entity::Player::calculateStats()
|
|||
uint8_t level = getLevel();
|
||||
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 tribeInfo = pExdData->get< Sapphire::Data::Tribe >( tribe );
|
||||
|
@ -280,9 +278,9 @@ void Sapphire::Entity::Player::calculateStats()
|
|||
m_baseStats.healingPotMagic = 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 )
|
||||
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 )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
|
||||
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 )
|
||||
{
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
m_onEnterEventDone = false;
|
||||
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 )
|
||||
{
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
m_onEnterEventDone = false;
|
||||
auto instance = pTeriMgr->getInstanceZonePtr( instanceContentId );
|
||||
if( !instance )
|
||||
|
@ -440,7 +438,7 @@ bool Sapphire::Entity::Player::setInstance( ZonePtr instance )
|
|||
if( !instance )
|
||||
return false;
|
||||
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
|
||||
auto currentZone = getCurrentZone();
|
||||
|
||||
|
@ -463,7 +461,7 @@ bool Sapphire::Entity::Player::setInstance( ZonePtr instance )
|
|||
|
||||
bool Sapphire::Entity::Player::exitInstance()
|
||||
{
|
||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
|
||||
// check if housing zone
|
||||
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
|
||||
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
|
||||
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 )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
|
||||
uint32_t currentExp = getExp();
|
||||
|
||||
|
@ -721,14 +719,14 @@ void Sapphire::Entity::Player::sendStatusUpdate( bool toSelf )
|
|||
|
||||
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;
|
||||
return static_cast< uint8_t >( m_classArray[ classJobIndex ] );
|
||||
}
|
||||
|
||||
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;
|
||||
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
|
||||
{
|
||||
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;
|
||||
return m_expArray[ classJobIndex ];
|
||||
}
|
||||
|
||||
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;
|
||||
m_expArray[ classJobIndex ] = amount;
|
||||
}
|
||||
|
@ -790,14 +788,14 @@ void Sapphire::Entity::Player::setClassJob( Common::ClassJob classJob )
|
|||
|
||||
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;
|
||||
m_classArray[ classJobIndex ] = level;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if( m_classArray[ classJobIndex ] == 0 )
|
||||
|
@ -866,10 +864,9 @@ void Sapphire::Entity::Player::setLookAt( uint8_t index, uint8_t value )
|
|||
// spawn this player for pTarget
|
||||
void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->debug( "[" + std::to_string( pTarget->getId() ) + "] Spawning " +
|
||||
getName() + " for " +
|
||||
pTarget->getName() );
|
||||
Logger::debug( "[" + std::to_string( pTarget->getId() ) + "] Spawning " +
|
||||
getName() + " for " +
|
||||
pTarget->getName() );
|
||||
|
||||
pTarget->queuePacket( std::make_shared< PlayerSpawnPacket >( *getAsPlayer(), *pTarget ) );
|
||||
}
|
||||
|
@ -878,8 +875,7 @@ void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
|||
void Sapphire::Entity::Player::despawn( Entity::PlayerPtr pTarget )
|
||||
{
|
||||
auto pPlayer = pTarget;
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->debug( "despawning " + getName() + " for " + pTarget->getName() );
|
||||
Logger::debug( "despawning " + getName() + " for " + pTarget->getName() );
|
||||
|
||||
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
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto actionInfoPtr = pExdData->get< Sapphire::Data::Action >( actionId );
|
||||
if( actionInfoPtr->preservesCombo )
|
||||
return false;
|
||||
|
@ -1105,7 +1101,7 @@ void Sapphire::Entity::Player::update( int64_t currTime )
|
|||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -1206,7 +1202,7 @@ const uint8_t* Sapphire::Entity::Player::getGcRankArray() const
|
|||
|
||||
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 );
|
||||
|
||||
if( !pSession )
|
||||
|
@ -1221,7 +1217,7 @@ void Sapphire::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr
|
|||
|
||||
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 );
|
||||
|
||||
if( !pSession )
|
||||
|
@ -1557,7 +1553,7 @@ void Sapphire::Entity::Player::sendZonePackets()
|
|||
if( isLogin() )
|
||||
{
|
||||
//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() );
|
||||
}
|
||||
|
||||
|
@ -1605,7 +1601,7 @@ void Sapphire::Entity::Player::sendZonePackets()
|
|||
sendItemLevel();
|
||||
}
|
||||
|
||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||
auto pHousingMgr = m_pFw->get< HousingMgr >();
|
||||
if( Sapphire::LandPtr pLand = pHousingMgr->getLandByOwnerId( getId() ) )
|
||||
{
|
||||
uint32_t state = 0;
|
||||
|
@ -1733,9 +1729,9 @@ void Sapphire::Entity::Player::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
|
||||
auto targetAetheryte = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId );
|
||||
|
||||
|
@ -1759,7 +1755,7 @@ void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
|||
if( !insufficientGil )
|
||||
{
|
||||
Action::ActionPtr pActionTeleport;
|
||||
pActionTeleport = Action::make_ActionTeleport( getAsPlayer(), aetheryteId, cost );
|
||||
pActionTeleport = Action::make_ActionTeleport( getAsPlayer(), aetheryteId, cost, pFw );
|
||||
setCurrentAction( pActionTeleport );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Sapphire::Entity
|
|||
{
|
||||
public:
|
||||
/*! Contructor */
|
||||
Player();
|
||||
Player( FrameworkPtr pFw );
|
||||
|
||||
/*! Destructor */
|
||||
~Player();
|
||||
|
@ -527,7 +527,7 @@ namespace Sapphire::Entity
|
|||
void teleport( uint16_t aetheryteId, uint8_t type = 1 );
|
||||
|
||||
/*! query teleport of a specified type */
|
||||
void teleportQuery( uint16_t aetheryteId );
|
||||
void teleportQuery( uint16_t aetheryteId, FrameworkPtr pFw );
|
||||
|
||||
/*! prepares zoning / fades out the screen */
|
||||
void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 );
|
||||
|
@ -686,7 +686,7 @@ namespace Sapphire::Entity
|
|||
void updateSql();
|
||||
|
||||
/*! 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 */
|
||||
bool loadClassData();
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#include "ServerMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
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 );
|
||||
if( !pEvent )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -162,8 +159,7 @@ Sapphire::Event::EventHandlerPtr Sapphire::Entity::Player::bootstrapSceneEvent(
|
|||
auto pEvent = getEvent( eventId );
|
||||
if( !pEvent )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -227,8 +223,7 @@ void Sapphire::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlaye
|
|||
|
||||
if( !pEvent )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -290,7 +285,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
|||
uint64_t additional )
|
||||
{
|
||||
auto pEventAction = Action::make_EventAction( getAsChara(), eventId, action,
|
||||
finishCallback, interruptCallback, additional );
|
||||
finishCallback, interruptCallback, additional, m_pFw );
|
||||
|
||||
setCurrentAction( pEventAction );
|
||||
auto pEvent = getEvent( eventId );
|
||||
|
@ -303,8 +298,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
|||
}
|
||||
else if( !pEvent )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -332,7 +326,7 @@ void Sapphire::Entity::Player::eventItemActionStart( uint32_t eventId,
|
|||
|
||||
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", "" );
|
||||
|
||||
std::istringstream ss( motd );
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "Inventory/Item.h"
|
||||
#include "Inventory/ItemContainer.h"
|
||||
#include "Inventory/ItemUtil.h"
|
||||
|
||||
|
||||
#include "Player.h"
|
||||
#include "Framework.h"
|
||||
|
@ -28,12 +28,11 @@
|
|||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
#include "Manager/InventoryMgr.h"
|
||||
#include "Manager/ItemMgr.h"
|
||||
|
||||
#include "Framework.h"
|
||||
#include <Network/CommonActorControl.h>
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
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,
|
||||
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
|
||||
setupContainer( Bag0, 34, "charaiteminventory", true );
|
||||
|
@ -115,7 +114,7 @@ void Sapphire::Entity::Player::sendItemLevel()
|
|||
|
||||
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 )
|
||||
return;
|
||||
|
||||
|
@ -136,7 +135,7 @@ void Sapphire::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass )
|
|||
|
||||
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 )
|
||||
return;
|
||||
|
||||
|
@ -247,7 +246,7 @@ void Sapphire::Entity::Player::unequipItem( Common::GearSetSlot equipSlotId, Ite
|
|||
|
||||
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 )
|
||||
return;
|
||||
|
||||
|
@ -357,7 +356,7 @@ void Sapphire::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t
|
|||
|
||||
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 )
|
||||
{
|
||||
|
@ -425,8 +424,7 @@ uint32_t Sapphire::Entity::Player::getCrystal( CrystalType type )
|
|||
|
||||
void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto storage = m_storageMap[ type ];
|
||||
|
||||
|
@ -450,13 +448,12 @@ void Sapphire::Entity::Player::writeInventory( InventoryType type )
|
|||
if( storage->isMultiStorage() )
|
||||
query += " AND storageId = " + std::to_string( static_cast< uint16_t >( type ) );
|
||||
|
||||
pLog->debug( query );
|
||||
pDb->execute( query );
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
// 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
|
||||
{
|
||||
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 );
|
||||
|
||||
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 )
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||
|
||||
// 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
|
||||
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 );
|
||||
}
|
||||
|
@ -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 )
|
||||
{
|
||||
auto containerType = Items::Util::getContainerType( storageId );
|
||||
auto containerType = World::Manager::ItemMgr::getContainerType( storageId );
|
||||
|
||||
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
|
||||
// the swapped out item will be placed in the matching armory.
|
||||
if( Items::Util::isEquipment( toInventoryId )
|
||||
&& !Items::Util::isEquipment( fromInventoryId )
|
||||
&& !Items::Util::isArmory( fromInventoryId ) )
|
||||
if( World::Manager::ItemMgr::isEquipment( toInventoryId )
|
||||
&& !World::Manager::ItemMgr::isEquipment( fromInventoryId )
|
||||
&& !World::Manager::ItemMgr::isArmory( fromInventoryId ) )
|
||||
{
|
||||
updateContainer( fromInventoryId, fromSlotId, nullptr );
|
||||
fromInventoryId = Items::Util::getCharaEquipSlotCategoryToArmoryId( toSlot );
|
||||
fromInventoryId = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( toSlot );
|
||||
fromSlotId = static_cast < uint8_t >( m_storageMap[ fromInventoryId ]->getFreeSlot() );
|
||||
}
|
||||
|
||||
auto containerTypeFrom = Items::Util::getContainerType( fromInventoryId );
|
||||
auto containerTypeTo = Items::Util::getContainerType( toInventoryId );
|
||||
auto containerTypeFrom = World::Manager::ItemMgr::getContainerType( fromInventoryId );
|
||||
auto containerTypeTo = World::Manager::ItemMgr::getContainerType( toInventoryId );
|
||||
|
||||
updateContainer( toInventoryId, toSlot, fromItem );
|
||||
updateContainer( fromInventoryId, fromSlotId, toItem );
|
||||
|
@ -807,7 +804,7 @@ uint16_t Sapphire::Entity::Player::calculateEquippedGearItemLevel()
|
|||
iLvlResult += currItem->getItemLevel();
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
@ -879,7 +876,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::dropInventoryItem( Sapphire::Common:
|
|||
return nullptr;
|
||||
|
||||
// unlink item
|
||||
container->removeItem( slotId );
|
||||
container->removeItem( slotId, false );
|
||||
updateContainer( type, slotId, nullptr );
|
||||
|
||||
auto seq = getNextInventorySequence();
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
#include "Session.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
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 )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint32_t playerLevel = getLevel();
|
||||
auto questInfo = pExdData->get< Sapphire::Data::Quest >( questId );
|
||||
|
||||
|
|
|
@ -16,24 +16,21 @@
|
|||
#include "Territory/Zone.h"
|
||||
#include "Inventory/Item.h"
|
||||
#include "Inventory/ItemContainer.h"
|
||||
#include "Inventory/ItemUtil.h"
|
||||
#include "Manager/ItemMgr.h"
|
||||
|
||||
#include "ServerMgr.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::World::Manager;
|
||||
|
||||
// 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 pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
|
||||
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
|
||||
if( !pCurrZone )
|
||||
{
|
||||
pLog->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 + "] Zone " + std::to_string( zoneId ) + " not found!" );
|
||||
Logger::error( "[" + char_id_str + "] Setting default zone instead" );
|
||||
|
||||
// default to new gridania
|
||||
// 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;
|
||||
|
||||
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_maxMp = getMaxMp();
|
||||
|
@ -260,7 +257,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, SessionPtr pSession )
|
|||
|
||||
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 );
|
||||
|
||||
stmt->setUInt( 1, m_id );
|
||||
|
@ -296,7 +293,7 @@ bool Sapphire::Entity::Player::loadActiveQuests()
|
|||
|
||||
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
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::CHARA_CLASS_SEL );
|
||||
stmt->setUInt( 1, m_id );
|
||||
|
@ -317,7 +314,7 @@ bool Sapphire::Entity::Player::loadClassData()
|
|||
|
||||
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 );
|
||||
stmt->setUInt( 1, m_id );
|
||||
auto res = pDb->query( stmt );
|
||||
|
@ -339,7 +336,7 @@ bool Sapphire::Entity::Player::loadSearchInfo()
|
|||
|
||||
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, "
|
||||
"Customize 9, ModelMainWeapon 10, ModelSubWeapon 11, ModelSystemWeapon 12, "
|
||||
"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
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
uint8_t classJobIndex = pExdData->get< Sapphire::Data::ClassJob >( static_cast<uint8_t>( getClass() ) )->expArrayIndex;
|
||||
|
||||
//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
|
||||
{
|
||||
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 );
|
||||
stmtClass->setInt( 1, getId() );
|
||||
stmtClass->setInt( 2, classJobIndex );
|
||||
|
@ -507,7 +504,7 @@ void Sapphire::Entity::Player::insertDbClass( const uint8_t classJobIndex ) cons
|
|||
|
||||
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 );
|
||||
stmtS->setInt( 1, m_searchSelectClass );
|
||||
stmtS->setInt( 2, m_id );
|
||||
|
@ -526,7 +523,7 @@ void Sapphire::Entity::Player::updateDbSearchInfo() 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++ )
|
||||
{
|
||||
if( !m_activeQuests[ i ] )
|
||||
|
@ -551,7 +548,7 @@ void Sapphire::Entity::Player::updateDbAllQuests() 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 );
|
||||
stmt->setInt( 1, m_id );
|
||||
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
|
||||
{
|
||||
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 );
|
||||
stmt->setInt( 1, m_id );
|
||||
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 )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||
auto itemMgr = m_pFw->get< World::Manager::ItemMgr >();
|
||||
|
||||
if( !itemInfo )
|
||||
return nullptr;
|
||||
|
@ -591,7 +589,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
|||
|
||||
uint8_t flags = 0;
|
||||
|
||||
ItemPtr pItem = make_Item( Items::Util::getNextUId(), catalogId );
|
||||
ItemPtr pItem = make_Item( itemMgr->getNextUId(), catalogId, m_pFw );
|
||||
|
||||
pItem->setStackSize( quantity );
|
||||
|
||||
|
@ -607,7 +605,8 @@ Sapphire::ItemPtr Sapphire::Entity::Player::createItem( uint32_t catalogId, uint
|
|||
|
||||
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
|
||||
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 )
|
||||
continue;
|
||||
|
||||
ItemPtr pItem = Items::Util::loadItem( uItemId );
|
||||
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
||||
|
||||
if( pItem == nullptr )
|
||||
continue;
|
||||
|
@ -661,7 +660,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
|||
if( uItemId == 0 )
|
||||
continue;
|
||||
|
||||
ItemPtr pItem = Items::Util::loadItem( uItemId );
|
||||
ItemPtr pItem = itemMgr->loadItem( uItemId );
|
||||
|
||||
if( pItem == nullptr )
|
||||
continue;
|
||||
|
|
|
@ -5,16 +5,19 @@
|
|||
|
||||
#include "ForwardsZone.h"
|
||||
|
||||
|
||||
namespace Sapphire
|
||||
{
|
||||
|
||||
class DebugCommandHandler;
|
||||
namespace World::Manager
|
||||
{
|
||||
class DebugCommandMgr;
|
||||
}
|
||||
|
||||
class DebugCommand
|
||||
{
|
||||
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
|
||||
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( Item );
|
||||
TYPE_FORWARD( ItemContainer );
|
||||
TYPE_FORWARD( Session );
|
||||
TYPE_FORWARD( ZonePosition );
|
||||
TYPE_FORWARD( Land )
|
||||
TYPE_FORWARD( Linkshell )
|
||||
TYPE_FORWARD( Land );
|
||||
TYPE_FORWARD( Linkshell );
|
||||
TYPE_FORWARD( Framework );
|
||||
|
||||
namespace World
|
||||
{
|
||||
TYPE_FORWARD( Session );
|
||||
}
|
||||
|
||||
namespace World::Territory::Housing
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "HousingItem.h"
|
||||
|
||||
Sapphire::Inventory::HousingItem::HousingItem( uint64_t uId, uint32_t catalogId ) :
|
||||
Sapphire::Item( uId, catalogId, false )
|
||||
Sapphire::Inventory::HousingItem::HousingItem( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw ) :
|
||||
Sapphire::Item( uId, catalogId, pFw, false )
|
||||
{
|
||||
m_stackSize = 1;
|
||||
m_spiritBond = 1;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace Sapphire::Inventory
|
|||
class HousingItem : public Item
|
||||
{
|
||||
public:
|
||||
HousingItem( uint64_t uId, uint32_t catalogId );
|
||||
HousingItem( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw );
|
||||
virtual ~HousingItem() = default;
|
||||
|
||||
void setRot( uint16_t rot );
|
||||
|
|
|
@ -5,18 +5,17 @@
|
|||
#include "Framework.h"
|
||||
#include "Item.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, bool isHq ) :
|
||||
Sapphire::Item::Item( uint64_t uId, uint32_t catalogId, FrameworkPtr pFw, bool isHq ) :
|
||||
m_id( catalogId ),
|
||||
m_uId( uId ),
|
||||
m_isHq( isHq ),
|
||||
m_stain( 0 ),
|
||||
m_durability( 30000 ),
|
||||
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 );
|
||||
|
||||
m_delayMs = itemInfo->delayms;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _ITEM_H_
|
||||
|
||||
#include <Common.h>
|
||||
#include "ForwardsZone.h"
|
||||
|
||||
namespace Sapphire
|
||||
{
|
||||
|
@ -10,7 +11,7 @@ namespace Sapphire
|
|||
{
|
||||
|
||||
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;
|
||||
|
||||
|
@ -98,8 +99,8 @@ namespace Sapphire
|
|||
uint16_t m_spiritBond;
|
||||
uint32_t m_reservedFlag;
|
||||
|
||||
FrameworkPtr m_pFw;
|
||||
uint32_t m_additionalData;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -9,15 +9,14 @@
|
|||
#include "Forwards.h"
|
||||
#include "ItemContainer.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
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_size( maxSize ),
|
||||
m_tableName( tableName ),
|
||||
m_bMultiStorage( isMultiStorage ),
|
||||
m_removeItemOnContainerRemove( removeItemOnContainerRemoval )
|
||||
m_pFw( pFw ),
|
||||
m_isPersistentStorage( isPersistentStorage )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -37,24 +36,23 @@ uint16_t Sapphire::ItemContainer::getEntryCount() const
|
|||
return static_cast< uint16_t >( m_itemMap.size() );
|
||||
}
|
||||
|
||||
void Sapphire::ItemContainer::removeItem( uint16_t slotId )
|
||||
void Sapphire::ItemContainer::removeItem( uint16_t slotId, bool removeFromDb )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
ItemMap::iterator it = m_itemMap.find( slotId );
|
||||
|
||||
if( it != m_itemMap.end() )
|
||||
{
|
||||
if( m_removeItemOnContainerRemove )
|
||||
if( m_isPersistentStorage && removeFromDb )
|
||||
pDb->execute( "DELETE FROM charaglobalitem WHERE itemId = " + std::to_string( it->second->getUId() ) );
|
||||
|
||||
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
|
||||
{
|
||||
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 ) )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
pLog->error( "Slot out of range " + std::to_string( slotId ) );
|
||||
Logger::error( "Slot out of range " + std::to_string( slotId ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -118,7 +115,7 @@ bool Sapphire::ItemContainer::isMultiStorage() const
|
|||
|
||||
bool Sapphire::ItemContainer::isPersistentStorage() const
|
||||
{
|
||||
return m_removeItemOnContainerRemove;
|
||||
return m_isPersistentStorage;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Sapphire
|
|||
|
||||
public:
|
||||
ItemContainer( uint16_t storageId, uint16_t maxSize, const std::string& tableName, bool isMultiStorage,
|
||||
bool removeItemOnContainerRemoval = true );
|
||||
FrameworkPtr pFw, bool isPersistentStorage = true );
|
||||
|
||||
~ItemContainer();
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace Sapphire
|
|||
|
||||
uint16_t getEntryCount() const;
|
||||
|
||||
void removeItem( uint16_t slotId );
|
||||
void removeItem( uint16_t slotId, bool removeFromDb = true );
|
||||
|
||||
ItemMap& getItemMap();
|
||||
|
||||
|
@ -48,7 +48,8 @@ namespace Sapphire
|
|||
uint16_t m_size;
|
||||
std::string m_tableName;
|
||||
bool m_bMultiStorage;
|
||||
bool m_removeItemOnContainerRemove;
|
||||
FrameworkPtr m_pFw;
|
||||
bool m_isPersistentStorage;
|
||||
ItemMap m_itemMap;
|
||||
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 <cmath>
|
||||
|
||||
#include "DebugCommand.h"
|
||||
#include "DebugCommandHandler.h"
|
||||
#include "DebugCommand/DebugCommand.h"
|
||||
#include "DebugCommandMgr.h"
|
||||
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
|
@ -37,51 +37,50 @@
|
|||
#include "Session.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Network;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::World::Manager;
|
||||
|
||||
// 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 )
|
||||
registerCommand( "set", &DebugCommandHandler::set, "Executes SET commands.", 1 );
|
||||
registerCommand( "get", &DebugCommandHandler::get, "Executes GET commands.", 1 );
|
||||
registerCommand( "add", &DebugCommandHandler::add, "Executes ADD commands.", 1 );
|
||||
registerCommand( "inject", &DebugCommandHandler::injectPacket, "Loads and injects a premade packet.", 1 );
|
||||
registerCommand( "injectc", &DebugCommandHandler::injectChatPacket, "Loads and injects a premade chat packet.", 1 );
|
||||
registerCommand( "replay", &DebugCommandHandler::replay, "Replays a saved capture folder.", 1 );
|
||||
registerCommand( "nudge", &DebugCommandHandler::nudge, "Nudges you forward/up/down.", 1 );
|
||||
registerCommand( "info", &DebugCommandHandler::serverInfo, "Show server info.", 0 );
|
||||
registerCommand( "help", &DebugCommandHandler::help, "Shows registered commands.", 0 );
|
||||
registerCommand( "script", &DebugCommandHandler::script, "Server script utilities.", 1 );
|
||||
registerCommand( "instance", &DebugCommandHandler::instance, "Instance utilities", 1 );
|
||||
registerCommand( "housing", &DebugCommandHandler::housing, "Housing utilities", 1 );
|
||||
registerCommand( "set", &DebugCommandMgr::set, "Executes SET commands.", 1 );
|
||||
registerCommand( "get", &DebugCommandMgr::get, "Executes GET commands.", 1 );
|
||||
registerCommand( "add", &DebugCommandMgr::add, "Executes ADD commands.", 1 );
|
||||
registerCommand( "inject", &DebugCommandMgr::injectPacket, "Loads and injects a premade packet.", 1 );
|
||||
registerCommand( "injectc", &DebugCommandMgr::injectChatPacket, "Loads and injects a premade chat packet.", 1 );
|
||||
registerCommand( "replay", &DebugCommandMgr::replay, "Replays a saved capture folder.", 1 );
|
||||
registerCommand( "nudge", &DebugCommandMgr::nudge, "Nudges you forward/up/down.", 1 );
|
||||
registerCommand( "info", &DebugCommandMgr::serverInfo, "Show server info.", 0 );
|
||||
registerCommand( "help", &DebugCommandMgr::help, "Shows registered commands.", 0 );
|
||||
registerCommand( "script", &DebugCommandMgr::script, "Server script utilities.", 1 );
|
||||
registerCommand( "instance", &DebugCommandMgr::instance, "Instance utilities", 1 );
|
||||
registerCommand( "housing", &DebugCommandMgr::housing, "Housing utilities", 1 );
|
||||
}
|
||||
|
||||
// clear all loaded commands
|
||||
Sapphire::DebugCommandHandler::~DebugCommandHandler()
|
||||
Sapphire::World::Manager::DebugCommandMgr::~DebugCommandMgr()
|
||||
{
|
||||
for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it )
|
||||
( *it ).second.reset();
|
||||
}
|
||||
|
||||
// add a command set to the register map
|
||||
void Sapphire::DebugCommandHandler::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
|
||||
const std::string& hText, uint8_t uLevel )
|
||||
void Sapphire::World::Manager::DebugCommandMgr::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
|
||||
const std::string& hText, uint8_t uLevel )
|
||||
{
|
||||
m_commandMap[ std::string( n ) ] = std::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
|
||||
}
|
||||
|
||||
// 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
|
||||
void ( DebugCommandHandler::*pf )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
||||
void ( DebugCommandMgr::*pf )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
|
||||
|
||||
std::string commandString;
|
||||
|
||||
|
@ -124,7 +123,8 @@ void Sapphire::DebugCommandHandler::execCommand( char* data, Entity::Player& pla
|
|||
// 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:" );
|
||||
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 = g_fw.get< TerritoryMgr >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pTerriMgr = framework()->get< TerritoryMgr >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
std::string subCommand = "";
|
||||
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 ) )
|
||||
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 );
|
||||
|
||||
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 params = "";
|
||||
|
||||
|
@ -396,8 +396,8 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
if( subCommand == "status" )
|
||||
|
@ -408,7 +408,8 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
|||
|
||||
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 );
|
||||
|
||||
player.addStatusEffect( effect );
|
||||
|
@ -423,7 +424,7 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
|||
}
|
||||
else if( subCommand == "bnpc" )
|
||||
{
|
||||
auto serverZone = g_fw.get< ServerMgr >();
|
||||
auto serverZone = framework()->get< World::ServerMgr >();
|
||||
|
||||
auto bNpcTemplate = serverZone->getBNpcTemplate( params );
|
||||
|
||||
|
@ -431,9 +432,10 @@ void Sapphire::DebugCommandHandler::add( char* data, Entity::Player& player, std
|
|||
player.sendNotice( "Template " + params + " not found in cache!" );
|
||||
|
||||
auto pBNpc = std::make_shared< Entity::BNpc >( bNpcTemplate,
|
||||
player.getPos().x,
|
||||
player.getPos().y,
|
||||
player.getPos().z, 1 );
|
||||
player.getPos().x,
|
||||
player.getPos().y,
|
||||
player.getPos().z,
|
||||
1, framework() );
|
||||
|
||||
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 = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||
std::string subCommand;
|
||||
std::string params = "";
|
||||
|
||||
|
@ -531,8 +533,8 @@ void Sapphire::DebugCommandHandler::get( char* data, Entity::Player& player, std
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
if( ( subCommand == "pos" ) )
|
||||
|
@ -556,27 +558,28 @@ void Sapphire::DebugCommandHandler::get( char* data, Entity::Player& player, std
|
|||
}
|
||||
|
||||
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() );
|
||||
if( pSession )
|
||||
pSession->getZoneConnection()->injectPacket( data + 7, player );
|
||||
}
|
||||
|
||||
void Sapphire::DebugCommandHandler::injectChatPacket( char* data, Entity::Player& player,
|
||||
std::shared_ptr< DebugCommand > command )
|
||||
void Sapphire::World::Manager::DebugCommandMgr::injectChatPacket( 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() );
|
||||
if( pSession )
|
||||
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 = g_fw.get< ServerMgr >();
|
||||
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||
std::string subCommand;
|
||||
std::string params = "";
|
||||
|
||||
|
@ -595,8 +598,8 @@ void Sapphire::DebugCommandHandler::replay( char* data, Entity::Player& player,
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
|
||||
if( subCommand == "start" )
|
||||
|
@ -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;
|
||||
|
||||
|
@ -672,18 +676,19 @@ void Sapphire::DebugCommandHandler::nudge( char* data, Entity::Player& player, s
|
|||
}
|
||||
|
||||
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( "Compiled: " __DATE__ " " __TIME__ );
|
||||
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 = g_fw.get< Scripting::ScriptMgr >();
|
||||
auto pScriptMgr = framework()->get< Scripting::ScriptMgr >();
|
||||
std::string subCommand;
|
||||
std::string params = "";
|
||||
|
||||
|
@ -703,8 +708,8 @@ void Sapphire::DebugCommandHandler::script( char* data, Entity::Player& player,
|
|||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||
|
||||
pLog->debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
||||
"subCommand " + subCommand + " params: " + params );
|
||||
|
||||
if( subCommand == "unload" )
|
||||
{
|
||||
|
@ -769,9 +774,10 @@ void Sapphire::DebugCommandHandler::script( char* data, Entity::Player& player,
|
|||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
auto cmdPos = cmd.find_first_of( ' ' );
|
||||
|
|
@ -4,23 +4,24 @@
|
|||
#include <map>
|
||||
#include <Common.h>
|
||||
|
||||
#include "DebugCommand.h"
|
||||
#include "DebugCommand/DebugCommand.h"
|
||||
#include "ForwardsZone.h"
|
||||
#include "BaseManager.h"
|
||||
|
||||
namespace Sapphire
|
||||
namespace Sapphire::World::Manager
|
||||
{
|
||||
|
||||
// handler for in game commands
|
||||
class DebugCommandHandler
|
||||
class DebugCommandMgr : public Manager::BaseManager
|
||||
{
|
||||
private:
|
||||
// container mapping command string to command object
|
||||
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
|
||||
|
||||
public:
|
||||
DebugCommandHandler();
|
||||
DebugCommandMgr( FrameworkPtr pFw );
|
||||
|
||||
~DebugCommandHandler();
|
||||
~DebugCommandMgr();
|
||||
|
||||
// register command to command map
|
||||
void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel );
|
|
@ -3,18 +3,20 @@
|
|||
#include <Util/Util.h>
|
||||
|
||||
#include "Framework.h"
|
||||
#include "EventHelper.h"
|
||||
#include "EventHandler.h"
|
||||
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
#include "EventMgr.h"
|
||||
#include "Event/EventHandler.h"
|
||||
|
||||
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;
|
||||
|
||||
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 );
|
||||
if( levelInfo )
|
||||
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::Server;
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
Sapphire::World::Manager::HousingMgr::HousingMgr()
|
||||
Sapphire::World::Manager::HousingMgr::HousingMgr( FrameworkPtr pFw ) :
|
||||
BaseManager( pFw )
|
||||
{
|
||||
m_containerMap[ 0 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||
m_containerMap[ 1 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems2, InventoryType::HousingInteriorStoreroom2 );
|
||||
|
@ -76,9 +75,7 @@ Sapphire::World::Manager::HousingMgr::~HousingMgr() = default;
|
|||
|
||||
bool Sapphire::World::Manager::HousingMgr::init()
|
||||
{
|
||||
auto log = g_fw.get< Sapphire::Logger >();
|
||||
|
||||
log->info( "HousingMgr: Caching housing land init data" );
|
||||
Logger::info( "HousingMgr: Caching housing land init data" );
|
||||
//LAND_SEL_ALL
|
||||
|
||||
// 18 wards per territory, 4 territories
|
||||
|
@ -86,7 +83,7 @@ bool Sapphire::World::Manager::HousingMgr::init()
|
|||
|
||||
initLandCache();
|
||||
|
||||
log->debug( "HousingMgr: Checking land counts" );
|
||||
Logger::debug( "HousingMgr: Checking land counts" );
|
||||
|
||||
uint32_t houseCount = 0;
|
||||
for( auto& landSet : m_landCache )
|
||||
|
@ -97,12 +94,12 @@ bool Sapphire::World::Manager::HousingMgr::init()
|
|||
|
||||
if( landSet.second.size() != 60 )
|
||||
{
|
||||
log->fatal( "LandSet " + std::to_string( landSet.first ) + " is missing land entries. Only have " + std::to_string( count ) + " land entries." );
|
||||
Logger::fatal( "LandSet " + std::to_string( landSet.first ) + " is missing land entries. Only have " + std::to_string( count ) + " land entries." );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
log->info( "HousingMgr: Cached " + std::to_string( houseCount ) + " houses" );
|
||||
Logger::info( "HousingMgr: Cached " + std::to_string( houseCount ) + " houses" );
|
||||
|
||||
/////
|
||||
|
||||
|
@ -114,11 +111,9 @@ bool Sapphire::World::Manager::HousingMgr::init()
|
|||
|
||||
bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
||||
{
|
||||
auto log = g_fw.get< Sapphire::Logger >();
|
||||
Logger::info( "HousingMgr: Loading inventories for estates" );
|
||||
|
||||
log->info( "HousingMgr: Loading inventories for estates" );
|
||||
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_SEL_ALL );
|
||||
auto res = pDb->query( stmt );
|
||||
|
@ -135,7 +130,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
|||
auto stain = res->getUInt8( "stain" );
|
||||
auto characterId = res->getUInt64( "CharacterId" );
|
||||
|
||||
auto item = Inventory::make_HousingItem( itemId, catalogId );
|
||||
auto item = Inventory::make_HousingItem( itemId, catalogId, framework() );
|
||||
item->setStain( stain );
|
||||
item->setStackSize( 1 );
|
||||
// todo: need to set the owner character id on the item
|
||||
|
@ -163,15 +158,14 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
|||
itemCount++;
|
||||
}
|
||||
|
||||
log->debug( "HousingMgr: Loaded " + std::to_string( itemCount ) + " inventory items" );
|
||||
Logger::debug( "HousingMgr: Loaded " + std::to_string( itemCount ) + " inventory items" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::initLandCache()
|
||||
{
|
||||
auto log = g_fw.get< Sapphire::Logger >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::LAND_SEL_ALL );
|
||||
auto res = pDb->query( stmt );
|
||||
|
@ -199,6 +193,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
|||
entry.m_estateName = res->getString( "HouseName" );
|
||||
entry.m_buildTime = res->getUInt64( "BuildTime" );
|
||||
entry.m_endorsements = res->getUInt64( "Endorsements" );
|
||||
entry.m_hasAetheryte = res->getBoolean( "Aetheryte" );
|
||||
|
||||
m_landCache[ entry.m_landSetId ].push_back( entry );
|
||||
|
||||
|
@ -222,8 +217,8 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
|||
break;
|
||||
default:
|
||||
// this should never ever happen, if it does the db is fucked
|
||||
log->error( "HousingMgr: Plot " + std::to_string( entry.m_landId ) + " in landset " + std::to_string( entry.m_landSetId ) +
|
||||
" has an invalid land size, defaulting to cottage." );
|
||||
Logger::error( "HousingMgr: Plot " + std::to_string( entry.m_landId ) + " in landset " + std::to_string( entry.m_landSetId ) +
|
||||
" has an invalid land size, defaulting to cottage." );
|
||||
entry.m_maxPlacedExternalItems = 20;
|
||||
entry.m_maxPlacedInternalItems = 200;
|
||||
break;
|
||||
|
@ -239,9 +234,9 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
|||
|
||||
auto& containers = getEstateInventory( ident );
|
||||
|
||||
auto makeContainer = [ &containers ]( Common::InventoryType type, uint16_t size )
|
||||
auto makeContainer = [ &containers, this ]( Common::InventoryType type, uint16_t size )
|
||||
{
|
||||
containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, false );
|
||||
containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, framework(), false );
|
||||
};
|
||||
|
||||
uint16_t count = 0;
|
||||
|
@ -271,7 +266,7 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
|||
|
||||
uint64_t Sapphire::World::Manager::HousingMgr::getNextHouseId()
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pQR = pDb->query( "SELECT MAX( HouseId ) FROM house" );
|
||||
|
||||
if( !pQR->next() )
|
||||
|
@ -287,13 +282,13 @@ uint32_t Sapphire::World::Manager::HousingMgr::toLandSetId( uint16_t territoryTy
|
|||
|
||||
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 ) );
|
||||
}
|
||||
|
||||
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 ) );
|
||||
|
||||
if( !res->next() )
|
||||
|
@ -335,7 +330,7 @@ void Sapphire::World::Manager::HousingMgr::sendLandSignOwned( Entity::Player& pl
|
|||
}
|
||||
|
||||
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() );
|
||||
|
||||
|
@ -509,7 +504,7 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
|||
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
|
||||
|
||||
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() );
|
||||
|
||||
break;
|
||||
|
@ -556,15 +551,15 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
|||
auto itemMax = land->getInventoryItemMax();
|
||||
|
||||
// type, maxSize, tableName, isMultiStorage
|
||||
auto intContainer = make_ItemContainer( InventoryType::HousingInteriorAppearance, itemMax.second, "houseiteminventory", true );
|
||||
auto extContainer = make_ItemContainer( InventoryType::HousingExteriorAppearance, itemMax.first, "houseiteminventory", true );
|
||||
auto intContainer = make_ItemContainer( InventoryType::HousingInteriorAppearance, itemMax.second, "houseiteminventory", true, framework() );
|
||||
auto extContainer = make_ItemContainer( InventoryType::HousingExteriorAppearance, itemMax.first, "houseiteminventory", true, framework() );
|
||||
|
||||
// add containers to inv collection
|
||||
auto& houseInventory = getEstateInventory( house->getLandIdent() );
|
||||
houseInventory[ InventoryType::HousingInteriorAppearance ] = intContainer;
|
||||
houseInventory[ InventoryType::HousingExteriorAppearance ] = extContainer;
|
||||
|
||||
auto exdData = g_fw.get< Sapphire::Data::ExdDataGenerated >();
|
||||
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
||||
auto preset = exdData->get< Sapphire::Data::HousingPreset >( getItemAdditionalData( presetCatalogId ) );
|
||||
if( !preset )
|
||||
return false;
|
||||
|
@ -605,12 +600,12 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
|||
}
|
||||
};
|
||||
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
// create and link items
|
||||
for( auto& destContainer : invMap )
|
||||
{
|
||||
auto container = houseInventory[ destContainer.first ];
|
||||
auto& container = houseInventory[ destContainer.first ];
|
||||
|
||||
for( auto& item : destContainer.second )
|
||||
{
|
||||
|
@ -634,7 +629,7 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
|||
|
||||
void Sapphire::World::Manager::HousingMgr::createHouse( Sapphire::HousePtr house ) const
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::HOUSING_HOUSE_INS );
|
||||
// LandSetId, HouseId, HouseName
|
||||
|
@ -666,7 +661,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
|
|||
// create house
|
||||
auto ident = pLand->getLandIdent();
|
||||
auto house = make_House( getNextHouseId(), pLand->getLandSetId(), ident,
|
||||
"Estate #" + std::to_string( ident.landId + 1 ), "" );
|
||||
"Estate #" + std::to_string( ident.landId + 1 ), "", framework() );
|
||||
|
||||
pLand->setHouse( house );
|
||||
|
||||
|
@ -785,7 +780,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity:
|
|||
if( land->getOwnerId() != player.getId() )
|
||||
return;
|
||||
|
||||
auto packet = makeZonePacket< FFXIVIpcHousingShowEstateGuestAccess >( player.getId() );
|
||||
auto packet = makeZonePacket< Server::FFXIVIpcHousingShowEstateGuestAccess >( player.getId() );
|
||||
packet->data().ident = ident;
|
||||
|
||||
player.queuePacket( packet );
|
||||
|
@ -855,7 +850,7 @@ void Sapphire::World::Manager::HousingMgr::sendEstateInventory( Entity::Player&
|
|||
if( needle == containers.end() )
|
||||
return;
|
||||
|
||||
auto invMgr = g_fw.get< Manager::InventoryMgr >();
|
||||
auto invMgr = framework()->get< Manager::InventoryMgr >();
|
||||
invMgr->sendInventoryContainer( player, needle->second );
|
||||
}
|
||||
|
||||
|
@ -910,7 +905,7 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
|
|||
}
|
||||
else
|
||||
{
|
||||
g_fw.get< Logger >()->error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for outdoor appearance." );
|
||||
Logger::error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for outdoor appearance." );
|
||||
}
|
||||
|
||||
auto intContainer = containers.find( static_cast< uint16_t >( InventoryType::HousingInteriorAppearance ) );
|
||||
|
@ -924,13 +919,13 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
|
|||
}
|
||||
else
|
||||
{
|
||||
g_fw.get< Logger >()->error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for indoor appearance." );
|
||||
Logger::error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for indoor appearance." );
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t Sapphire::World::Manager::HousingMgr::getItemAdditionalData( uint32_t catalogId )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||
auto info = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||
return info->additionalData;
|
||||
}
|
||||
|
@ -1002,7 +997,7 @@ void Sapphire::World::Manager::HousingMgr::reqPlaceHousingItem( Sapphire::Entity
|
|||
{
|
||||
auto tmpItem = player.dropInventoryItem( static_cast< Common::InventoryType >( containerId ), slotId );
|
||||
|
||||
item = Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId() );
|
||||
item = Inventory::make_HousingItem( tmpItem->getUId(), tmpItem->getId(), framework() );
|
||||
|
||||
// set params
|
||||
item->setPos( {
|
||||
|
@ -1038,7 +1033,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
|
|||
Inventory::HousingItemPtr item,
|
||||
Common::LandIdent ident )
|
||||
{
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
auto& container = getEstateInventory( ident )[ InventoryType::HousingExteriorPlacedItems ];
|
||||
|
||||
|
@ -1071,7 +1066,7 @@ bool Sapphire::World::Manager::HousingMgr::placeExternalItem( Entity::Player& pl
|
|||
bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& player,
|
||||
Inventory::HousingItemPtr item )
|
||||
{
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||
assert( zone );
|
||||
|
@ -1145,7 +1140,7 @@ void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sap
|
|||
else
|
||||
containerIds = m_internalPlacedItemContainers;
|
||||
|
||||
auto invMgr = g_fw.get< Manager::InventoryMgr >();
|
||||
auto invMgr = framework()->get< Manager::InventoryMgr >();
|
||||
auto& containers = getEstateInventory( zone->getLandIdent() );
|
||||
|
||||
for( auto containerId : containerIds )
|
||||
|
@ -1222,7 +1217,7 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
|
|||
item->setRot( Util::floatToUInt16Rot( rot ) );
|
||||
|
||||
// save
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
invMgr->updateHousingItemPosition( item );
|
||||
|
||||
terri.updateHousingObjectPosition( player, slot, item->getPos(), item->getRot() );
|
||||
|
@ -1232,8 +1227,6 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
|
|||
|
||||
player.queuePacket( Server::makeActorControl143( player.getId(), ActorControl::HousingItemMoveConfirm, param1, slotIdx ) );
|
||||
|
||||
// todo: update it for other players??
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1267,7 +1260,7 @@ bool Sapphire::World::Manager::HousingMgr::moveExternalItem( Entity::Player& pla
|
|||
|
||||
item->setRot( Util::floatToUInt16Rot( rot ) );
|
||||
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
invMgr->updateHousingItemPosition( item );
|
||||
|
||||
terri.updateYardObjectPos( player, slot, ident.landId, *item );
|
||||
|
@ -1356,7 +1349,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
|
|||
if( !player.getFreeInventoryContainerSlot( containerPair ) )
|
||||
return false;
|
||||
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
// remove it from housing inventory
|
||||
container->removeItem( slotId );
|
||||
|
@ -1378,7 +1371,7 @@ bool Sapphire::World::Manager::HousingMgr::removeInternalItem( Entity::Player& p
|
|||
if( !freeContainer )
|
||||
return false;
|
||||
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
container->removeItem( slotId );
|
||||
invMgr->sendInventoryContainer( player, container );
|
||||
|
@ -1413,7 +1406,7 @@ bool Sapphire::World::Manager::HousingMgr::removeExternalItem( Entity::Player& p
|
|||
if( !item )
|
||||
return false;
|
||||
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
if( sendToStoreroom )
|
||||
{
|
||||
|
@ -1498,7 +1491,7 @@ void Sapphire::World::Manager::HousingMgr::reqEstateExteriorRemodel( Sapphire::E
|
|||
if( needle == inv.end() )
|
||||
return;
|
||||
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
invMgr->sendInventoryContainer( player, needle->second );
|
||||
|
||||
|
@ -1529,7 +1522,7 @@ void Sapphire::World::Manager::HousingMgr::reqEstateInteriorRemodel( Sapphire::E
|
|||
if( needle == inv.end() )
|
||||
return;
|
||||
|
||||
auto invMgr = g_fw.get< InventoryMgr >();
|
||||
auto invMgr = framework()->get< InventoryMgr >();
|
||||
|
||||
invMgr->sendInventoryContainer( player, needle->second );
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define SAPPHIRE_HOUSINGMGR_H
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "BaseManager.h"
|
||||
#include "Territory/HousingZone.h"
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
@ -14,7 +15,7 @@ namespace Sapphire::Data
|
|||
|
||||
namespace Sapphire::World::Manager
|
||||
{
|
||||
class HousingMgr
|
||||
class HousingMgr : public BaseManager
|
||||
{
|
||||
|
||||
public:
|
||||
|
@ -45,6 +46,8 @@ namespace Sapphire::World::Manager
|
|||
std::string m_estateComment;
|
||||
std::string m_estateName;
|
||||
|
||||
bool m_hasAetheryte;
|
||||
|
||||
uint64_t m_buildTime;
|
||||
uint64_t m_endorsements;
|
||||
|
||||
|
@ -66,7 +69,7 @@ namespace Sapphire::World::Manager
|
|||
*/
|
||||
using LandIdentToInventoryContainerMap = std::unordered_map< uint64_t, ContainerIdToContainerMap >;
|
||||
|
||||
HousingMgr();
|
||||
HousingMgr( FrameworkPtr pFw );
|
||||
virtual ~HousingMgr();
|
||||
|
||||
bool init();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "Actor/Player.h"
|
||||
#include "Inventory/ItemContainer.h"
|
||||
#include "Inventory/HousingItem.h"
|
||||
#include "Inventory/ItemUtil.h"
|
||||
#include "Manager/ItemMgr.h"
|
||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Network/GamePacketNew.h>
|
||||
|
||||
|
@ -13,10 +13,12 @@
|
|||
|
||||
#include "Framework.h"
|
||||
|
||||
extern Sapphire::Framework g_fw;
|
||||
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
||||
Sapphire::World::Manager::InventoryMgr::InventoryMgr( Sapphire::FrameworkPtr pFw ) :
|
||||
BaseManager( pFw )
|
||||
{ }
|
||||
|
||||
void Sapphire::World::Manager::InventoryMgr::sendInventoryContainer( Sapphire::Entity::Player& player,
|
||||
Sapphire::ItemContainerPtr container )
|
||||
{
|
||||
|
@ -69,14 +71,15 @@ void Sapphire::World::Manager::InventoryMgr::sendInventoryContainer( Sapphire::E
|
|||
Sapphire::ItemPtr Sapphire::World::Manager::InventoryMgr::createItem( Entity::Player& player,
|
||||
uint32_t catalogId, uint32_t quantity )
|
||||
{
|
||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto itemMgr = framework()->get< Manager::ItemMgr >();
|
||||
auto itemInfo = pExdData->get< Sapphire::Data::Item >( catalogId );
|
||||
|
||||
if( !itemInfo )
|
||||
return nullptr;
|
||||
|
||||
auto item = make_Item( Items::Util::getNextUId(), catalogId );
|
||||
auto item = make_Item( itemMgr->getNextUId(), catalogId, framework() );
|
||||
|
||||
item->setStackSize( std::max< uint32_t >( 1, quantity ) );
|
||||
|
||||
|
@ -100,7 +103,7 @@ void Sapphire::World::Manager::InventoryMgr::removeItemFromHousingContainer( Sap
|
|||
uint16_t containerId,
|
||||
uint16_t slotId )
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_DEL );
|
||||
|
||||
|
@ -117,7 +120,7 @@ void Sapphire::World::Manager::InventoryMgr::saveHousingContainerItem( uint64_t
|
|||
uint16_t containerId, uint16_t slotId,
|
||||
uint64_t itemId )
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_UP );
|
||||
// LandIdent, ContainerId, SlotId, ItemId, ItemId
|
||||
|
@ -131,12 +134,12 @@ void Sapphire::World::Manager::InventoryMgr::saveHousingContainerItem( uint64_t
|
|||
// the second time is for the ON DUPLICATE KEY UPDATE condition
|
||||
stmt->setUInt64( 5, itemId );
|
||||
|
||||
pDb->execute( stmt );
|
||||
pDb->directExecute( stmt );
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::InventoryMgr::updateHousingItemPosition( Sapphire::Inventory::HousingItemPtr item )
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_UP_ITEMPOS );
|
||||
// ItemId, PosX, PosY, PosZ, Rotation, PosX, PosY, PosZ, Rotation
|
||||
|
@ -161,7 +164,7 @@ void Sapphire::World::Manager::InventoryMgr::updateHousingItemPosition( Sapphire
|
|||
|
||||
void Sapphire::World::Manager::InventoryMgr::removeHousingItemPosition( Sapphire::Inventory::HousingItem& item )
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
||||
auto stmt = pDb->getPreparedStatement( Db::LAND_INV_DEL_ITEMPOS );
|
||||
|
||||
|
@ -172,7 +175,7 @@ void Sapphire::World::Manager::InventoryMgr::removeHousingItemPosition( Sapphire
|
|||
|
||||
void Sapphire::World::Manager::InventoryMgr::saveItem( Sapphire::Entity::Player& player, Sapphire::ItemPtr item )
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pDb = framework()->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto stmt = pDb->getPreparedStatement( Db::CHARA_ITEMGLOBAL_INS );
|
||||
|
||||
stmt->setUInt( 1, player.getId() );
|
||||
|
|
|
@ -2,13 +2,16 @@
|
|||
#define SAPPHIRE_INVENTORYMGR_H
|
||||
|
||||
#include "ForwardsZone.h"
|
||||
#include "BaseManager.h"
|
||||
|
||||
namespace Sapphire::World::Manager
|
||||
{
|
||||
|
||||
class InventoryMgr
|
||||
class InventoryMgr : public Sapphire::World::Manager::BaseManager
|
||||
{
|
||||
public:
|
||||
explicit InventoryMgr( Sapphire::FrameworkPtr pFw );
|
||||
|
||||
/*!
|
||||
* @brief Sends an item container to a player
|
||||
*
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue