mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
Merge branch 'develop' into crashes_fix
This commit is contained in:
commit
dbb93a3d94
42 changed files with 287 additions and 329 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -25,6 +25,7 @@ src/tools/bin/generated/*
|
||||||
|
|
||||||
# Build Directory
|
# Build Directory
|
||||||
build/
|
build/
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|
|
@ -19,7 +19,7 @@ add_custom_target( copy_runtime_files ALL
|
||||||
# Dependencies and compiler settings #
|
# Dependencies and compiler settings #
|
||||||
######################################
|
######################################
|
||||||
include( "cmake/paths.cmake" )
|
include( "cmake/paths.cmake" )
|
||||||
include( "cmake/mysql.cmake" )
|
#include( "cmake/mysql.cmake" )
|
||||||
include( "cmake/compiler.cmake" )
|
include( "cmake/compiler.cmake" )
|
||||||
include( "cmake/cotire.cmake" )
|
include( "cmake/cotire.cmake" )
|
||||||
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
find_path(MYSQL_INCLUDE_DIR mysql.h
|
|
||||||
/usr/include/mysql
|
|
||||||
/usr/local/include/mysql
|
|
||||||
/opt/mysql/mysql/include
|
|
||||||
/opt/mysql/mysql/include/mysql
|
|
||||||
/opt/mysql/include
|
|
||||||
/opt/local/include/mysql5
|
|
||||||
/usr/local/mysql/include
|
|
||||||
/usr/local/mysql/include/mysql
|
|
||||||
$ENV{ProgramFiles}/MySQL/*/include
|
|
||||||
$ENV{SystemDrive}/MySQL/*/include
|
|
||||||
${LIBRARY_DIR}/external/MySQL/
|
|
||||||
)
|
|
||||||
|
|
||||||
if(MYSQL_INCLUDE_DIR)
|
|
||||||
set(MYSQL_FOUND TRUE)
|
|
||||||
|
|
||||||
include_directories(${MYSQL_INCLUDE_DIR})
|
|
||||||
endif(MYSQL_INCLUDE_DIR)
|
|
||||||
|
|
||||||
if(MYSQL_FOUND)
|
|
||||||
message(STATUS "MySQL include dir: ${MYSQL_INCLUDE_DIR}")
|
|
||||||
else(MYSQL_FOUND)
|
|
||||||
message(FATAL_ERROR "Could not find MySQL headers.")
|
|
||||||
endif(MYSQL_FOUND)
|
|
||||||
else()
|
|
||||||
include_directories("${LIBRARY_DIR}/external/MySQL/")
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
||||||
# 32 bit link
|
|
||||||
link_directories(${LIBRARY_DIR}/external/MySQL/x86)
|
|
||||||
link_directories(${LIBRARY_DIR}/external/zlib/x86)
|
|
||||||
else()
|
|
||||||
# 64 bit link
|
|
||||||
link_directories(${LIBRARY_DIR}/external/MySQL/x64)
|
|
||||||
link_directories(${LIBRARY_DIR}/external/zlib/x64)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
|
@ -63,7 +63,7 @@ void reloadConfig()
|
||||||
|
|
||||||
void print_request_info( shared_ptr< HttpServer::Request > request )
|
void print_request_info( shared_ptr< HttpServer::Request > request )
|
||||||
{
|
{
|
||||||
Logger::info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" );
|
Logger::info( "Request from {0} ({1})", request->remote_endpoint_address, request->path );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loadSettings( int32_t argc, char* argv[] )
|
bool loadSettings( int32_t argc, char* argv[] )
|
||||||
|
@ -72,7 +72,7 @@ bool loadSettings( int32_t argc, char* argv[] )
|
||||||
|
|
||||||
if( !m_pConfig->loadConfig( configPath ) )
|
if( !m_pConfig->loadConfig( configPath ) )
|
||||||
{
|
{
|
||||||
Logger::fatal( "Error loading config " + configPath );
|
Logger::fatal( "Error loading config {0}", configPath );
|
||||||
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ bool loadSettings( int32_t argc, char* argv[] )
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
{
|
{
|
||||||
Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
Logger::error( "Error parsing argument: {0} value: {1}\n", arg, val );
|
||||||
Logger::error( "Usage: <arg> <val> \n" );
|
Logger::error( "Usage: <arg> <val> \n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ bool loadSettings( int32_t argc, char* argv[] )
|
||||||
if( !g_exdDataGen.init( dataPath ) )
|
if( !g_exdDataGen.init( dataPath ) )
|
||||||
{
|
{
|
||||||
Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
|
Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
|
||||||
Logger::fatal( "DataPath: " + dataPath );
|
Logger::fatal( "DataPath: {0}", dataPath );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ bool loadSettings( int32_t argc, char* argv[] )
|
||||||
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) );
|
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) );
|
||||||
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" );
|
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" );
|
||||||
|
|
||||||
Logger::info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
|
Logger::info( "Database: Connected to {0}:{1}", info.host, info.port );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -767,7 +767,7 @@ int main( int argc, char* argv[] )
|
||||||
server.start();
|
server.start();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
Logger::info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" +
|
Logger::info( "API server running on {0}:{1}", m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ),
|
||||||
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
|
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
|
||||||
|
|
||||||
//Wait for server to start so that the client can connect
|
//Wait for server to start so that the client can connect
|
||||||
|
|
|
@ -47,9 +47,8 @@ void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& i
|
||||||
template< class T >
|
template< class T >
|
||||||
uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
||||||
{
|
{
|
||||||
Logger::info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
|
Logger::info( "[DbPool] Opening DatabasePool {0} Asynchronous connections: {1} Synchronous connections: {2}",
|
||||||
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
|
getDatabaseName(), m_asyncThreads, m_synchThreads );
|
||||||
" Synchronous connections: " + std::to_string( m_synchThreads ) );
|
|
||||||
|
|
||||||
uint32_t error = openConnections( IDX_ASYNC, m_asyncThreads );
|
uint32_t error = openConnections( IDX_ASYNC, m_asyncThreads );
|
||||||
|
|
||||||
|
@ -60,9 +59,8 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
||||||
|
|
||||||
if( !error )
|
if( !error )
|
||||||
{
|
{
|
||||||
Logger::info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
|
Logger::info( "[DbPool] DatabasePool '{0}' opened successfully. {1} total connections running.",
|
||||||
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
|
getDatabaseName(), ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) );
|
||||||
" total connections running." );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
@ -71,10 +69,10 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
|
||||||
template< class T >
|
template< class T >
|
||||||
void Sapphire::Db::DbWorkerPool< T >::close()
|
void Sapphire::Db::DbWorkerPool< T >::close()
|
||||||
{
|
{
|
||||||
Logger::info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
|
Logger::info( "[DbPool] Closing down DatabasePool {0}", getDatabaseName() );
|
||||||
m_connections[ IDX_ASYNC ].clear();
|
m_connections[ IDX_ASYNC ].clear();
|
||||||
m_connections[ IDX_SYNCH ].clear();
|
m_connections[ IDX_SYNCH ].clear();
|
||||||
Logger::info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." );
|
Logger::info( "[DbPool] All connections on DatabasePool {0} closed.", getDatabaseName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
|
|
|
@ -175,7 +175,7 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );",
|
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );",
|
||||||
CONNECTION_SYNC );
|
CONNECTION_SYNC );
|
||||||
|
|
||||||
/// BNPC TEMPLATES
|
/// ZONE QUERIES
|
||||||
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
|
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
|
||||||
"SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, "
|
"SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, "
|
||||||
"secWeaponModel, aggressionMode, enemyType, pose, "
|
"secWeaponModel, aggressionMode, enemyType, pose, "
|
||||||
|
@ -183,6 +183,18 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
"FROM bnpctemplate WHERE 1;",
|
"FROM bnpctemplate WHERE 1;",
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
|
prepareStatement( ZONE_SEL_SPAWNGROUPS,
|
||||||
|
"SELECT id, bNpcTemplateId, level, maxHp "
|
||||||
|
"FROM spawngroup "
|
||||||
|
"WHERE territoryTypeId = ?",
|
||||||
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
|
prepareStatement( ZONE_SEL_SPAWNPOINTS,
|
||||||
|
"SELECT id, x, y, z, r "
|
||||||
|
"FROM spawnpoint "
|
||||||
|
"WHERE spawnGroupId = ?",
|
||||||
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
prepareStatement( CHARA_ITEMGLOBAL_UP,
|
prepareStatement( CHARA_ITEMGLOBAL_UP,
|
||||||
"UPDATE charaglobalitem SET stack = ?, durability = ?, stain = ? WHERE ItemId = ?;",
|
"UPDATE charaglobalitem SET stack = ?, durability = ?, stain = ? WHERE ItemId = ?;",
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
|
@ -77,6 +77,8 @@ namespace Sapphire::Db
|
||||||
CHARA_ITEMGLOBAL_DELETE,
|
CHARA_ITEMGLOBAL_DELETE,
|
||||||
|
|
||||||
ZONE_SEL_BNPCTEMPLATES,
|
ZONE_SEL_BNPCTEMPLATES,
|
||||||
|
ZONE_SEL_SPAWNGROUPS,
|
||||||
|
ZONE_SEL_SPAWNPOINTS,
|
||||||
|
|
||||||
LAND_INS,
|
LAND_INS,
|
||||||
LAND_SEL,
|
LAND_SEL,
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <spdlog/fmt/fmt.h>
|
||||||
|
|
||||||
namespace Sapphire
|
namespace Sapphire
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -18,17 +20,54 @@ namespace Sapphire
|
||||||
|
|
||||||
static void init( const std::string& logPath );
|
static void init( const std::string& logPath );
|
||||||
|
|
||||||
|
// todo: this is a minor increase in build time because of fmtlib, but much less than including spdlog directly
|
||||||
|
|
||||||
static void error( const std::string& text );
|
static void error( const std::string& text );
|
||||||
|
template< typename... Args >
|
||||||
|
static void error( const std::string& text, const Args&... args )
|
||||||
|
{
|
||||||
|
error( fmt::format( text, args... ) );
|
||||||
|
}
|
||||||
|
|
||||||
static void warn( const std::string& text );
|
static void warn( const std::string& text );
|
||||||
|
template< typename... Args >
|
||||||
|
static void warn( const std::string& text, const Args&... args )
|
||||||
|
{
|
||||||
|
warn( fmt::format( text, args... ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void info( const std::string& text );
|
static void info( const std::string& text );
|
||||||
|
template< typename... Args >
|
||||||
|
static void info( const std::string& text, const Args&... args )
|
||||||
|
{
|
||||||
|
info( fmt::format( text, args... ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void debug( const std::string& text );
|
static void debug( const std::string& text );
|
||||||
|
template< typename... Args >
|
||||||
|
static void debug( const std::string& text, const Args&... args )
|
||||||
|
{
|
||||||
|
debug( fmt::format( text, args... ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fatal( const std::string& text );
|
static void fatal( const std::string& text );
|
||||||
|
template< typename... Args >
|
||||||
|
static void fatal( const std::string& text, const Args&... args )
|
||||||
|
{
|
||||||
|
fatal( fmt::format( text, args... ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void trace( const std::string& text );
|
static void trace( const std::string& text );
|
||||||
|
template< typename... Args >
|
||||||
|
static void trace( const std::string& text, const Args&... args )
|
||||||
|
{
|
||||||
|
trace( fmt::format( text, args... ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -180,11 +180,11 @@ int main( int32_t argc, char* argv[] )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::fatal( "Not a valid mode: " + mode + " !" );
|
Logger::fatal( "Not a valid mode: {0} !", mode );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info( "Launching in " + mode + " mode..." );
|
Logger::info( "Launching in {0} mode...", mode );
|
||||||
|
|
||||||
if( !dbm.connect() )
|
if( !dbm.connect() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,11 +83,11 @@ namespace Sapphire
|
||||||
|
|
||||||
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
|
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
Logger::info( "Loading config " + m_configPath );
|
Logger::info( "Loading config {0}", m_configPath );
|
||||||
|
|
||||||
if( !m_pConfig->loadConfig( m_configPath ) )
|
if( !m_pConfig->loadConfig( m_configPath ) )
|
||||||
{
|
{
|
||||||
Logger::fatal( "Error loading config " + m_configPath );
|
Logger::fatal( "Error loading config {0}", m_configPath );
|
||||||
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ namespace Sapphire
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
{
|
{
|
||||||
Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
|
Logger::error( "Error parsing argument: {0} value: {1}\n", arg, val );
|
||||||
Logger::error( "Usage: <arg> <val> \n" );
|
Logger::error( "Usage: <arg> <val> \n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,10 @@ set(LIBRARY_OUTPUT_PATH "${SCRIPT_LIB_DIR}")
|
||||||
set(RUNTIME_OUTPUT_DIRECTORY "${SCRIPT_LIB_DIR}")
|
set(RUNTIME_OUTPUT_DIRECTORY "${SCRIPT_LIB_DIR}")
|
||||||
|
|
||||||
if( WIN32 )
|
if( WIN32 )
|
||||||
set( LIBRARY_OUTPUT_DIRECTORY_DEBUG "${SCRIPT_LIB_DIR}" )
|
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${SCRIPT_LIB_DIR}" )
|
||||||
set( LIBRARY_OUTPUT_DIRECTORY_RELEASE "${SCRIPT_LIB_DIR}" )
|
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${SCRIPT_LIB_DIR}" )
|
||||||
set( LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${SCRIPT_LIB_DIR}" )
|
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${SCRIPT_LIB_DIR}" )
|
||||||
set( LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${SCRIPT_LIB_DIR}" )
|
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL "${SCRIPT_LIB_DIR}" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB children "${CMAKE_CURRENT_SOURCE_DIR}/*" )
|
file(GLOB children "${CMAKE_CURRENT_SOURCE_DIR}/*" )
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
if( player.getCurrentZone()->getTerritoryTypeId() != pHousingAethernet->territoryType )
|
if( player.getCurrentZone()->getTerritoryTypeId() != pHousingAethernet->territoryType )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendDebug( "got level entry: " + std::to_string( pHousingAethernet->level ) );
|
player.sendDebug( "got level entry: {0}", pHousingAethernet->level );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
};
|
};
|
|
@ -326,7 +326,7 @@ int main( int argc, char** argv )
|
||||||
Logger::init( "struct_gen" );
|
Logger::init( "struct_gen" );
|
||||||
if( argc > 1 )
|
if( argc > 1 )
|
||||||
{
|
{
|
||||||
Logger::info( "using dat path: " + std::string( argv[ 1 ] ) );
|
Logger::info( "using dat path: {0}", std::string( argv[ 1 ] ) );
|
||||||
datLocation = std::string( argv[ 1 ] );
|
datLocation = std::string( argv[ 1 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,13 @@ int main()
|
||||||
//for( auto id : idList )
|
//for( auto id : idList )
|
||||||
{
|
{
|
||||||
auto teri1 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 0 );
|
auto teri1 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 0 );
|
||||||
Logger::info( "0 -> " + std::to_string( teri1->item ) );
|
Logger::info( "0 -> {0}", teri1->item );
|
||||||
|
|
||||||
auto teri2 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 1 );
|
auto teri2 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 1 );
|
||||||
Logger::info( "1 -> " + std::to_string( teri2->item ) );
|
Logger::info( "1 -> {0} ", teri2->item );
|
||||||
|
|
||||||
auto teri3 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 2 );
|
auto teri3 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 2 );
|
||||||
Logger::info( "2 -> " + std::to_string( teri3->item ) );
|
Logger::info( "2 -> {0}", teri3->item );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -259,8 +259,8 @@ int dumpSpawns()
|
||||||
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
||||||
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
||||||
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
||||||
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
Logger::info( "{0} - {1} - {2}", entry.first, teri1->name, teriPlaceName->name );
|
||||||
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
Logger::info( "Mob Count: {0}", entry.second.size() );
|
||||||
|
|
||||||
for( auto mob : entry.second )
|
for( auto mob : entry.second )
|
||||||
{
|
{
|
||||||
|
@ -283,9 +283,8 @@ int dumpSpawns()
|
||||||
for( auto mobName : lvlToPacket )
|
for( auto mobName : lvlToPacket )
|
||||||
{
|
{
|
||||||
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
|
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
|
||||||
Logger::info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
|
Logger::info( "|--> {0}, ({1})", nameStruct->singular, mobName.second.size() );
|
||||||
|
Logger::info( "|-> {0}", entry.first );
|
||||||
Logger::info( "|-> " + std::to_string( entry.first ) );
|
|
||||||
|
|
||||||
std::string name1 = delChar( nameStruct->singular, ' ' );
|
std::string name1 = delChar( nameStruct->singular, ' ' );
|
||||||
name1 = delChar( name1, '\'' );
|
name1 = delChar( name1, '\'' );
|
||||||
|
@ -331,15 +330,10 @@ int dumpSpawns()
|
||||||
std::string name = delChar( nameStruct->singular, ' ' );
|
std::string name = delChar( nameStruct->singular, ' ' );
|
||||||
name = delChar( name, '\'' );
|
name = delChar( name, '\'' );
|
||||||
|
|
||||||
Logger::info( "|----> " + name + "_" +
|
Logger::info( "|----> {0}_{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}",
|
||||||
std::to_string( instance.bNPCBase ) + " " +
|
name, instance.bNPCBase, instance.posX, instance.posY,
|
||||||
std::to_string( instance.posX ) + ", " +
|
instance.posZ, instance.modelChara, instance.gimmickId,
|
||||||
std::to_string( instance.posY ) + ", " +
|
instance.level, instance.hPMax );
|
||||||
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 ) );
|
//Logger::info( "|----> " + name + " - " + std::to_string( instance.bNPCBase ) + ", " + std::to_string( instance.gimmickId ) );
|
||||||
|
|
||||||
output += "INSERT INTO `spawnpoint` ( `spawngroupid`, `x`, `y`, `z`, `r` ) "
|
output += "INSERT INTO `spawnpoint` ( `spawngroupid`, `x`, `y`, `z`, `r` ) "
|
||||||
|
@ -378,7 +372,7 @@ int dumpSpawns()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info( "|--> Total SpawnGroups: " + std::to_string( spawngroups ) );
|
Logger::info( "|--> Total SpawnGroups: {0}", spawngroups );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -475,8 +469,8 @@ int dumpTemplates()
|
||||||
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
|
||||||
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
|
||||||
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
|
||||||
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
|
Logger::info( "{0} - {1} - {2}", entry.first, teri1->name, teriPlaceName->name );
|
||||||
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
|
Logger::info( "Mob Count: {0}", entry.second.size() );
|
||||||
|
|
||||||
for( auto mob : entry.second )
|
for( auto mob : entry.second )
|
||||||
{
|
{
|
||||||
|
@ -486,12 +480,12 @@ int dumpTemplates()
|
||||||
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info( "Unique Mobs: " + std::to_string( nameToPacketList.size() ) );
|
Logger::info( "Unique Mobs: {0}", nameToPacketList.size() );
|
||||||
|
|
||||||
for( auto mobName : nameToPacketList )
|
for( auto mobName : nameToPacketList )
|
||||||
{
|
{
|
||||||
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at( 0 ).bNPCName );
|
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at( 0 ).bNPCName );
|
||||||
Logger::info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
|
Logger::info( "|--> {0} ({1})", nameStruct->singular, mobName.second.size() );
|
||||||
|
|
||||||
auto instance = mobName.second.at(0);
|
auto instance = mobName.second.at(0);
|
||||||
//for( FFXIVIpcNpcSpawn instance : mobName.second )
|
//for( FFXIVIpcNpcSpawn instance : mobName.second )
|
||||||
|
|
|
@ -362,7 +362,7 @@ int main( int argc, char** argv )
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
for( const auto& row : rows )
|
for( const auto& row : rows )
|
||||||
{
|
{
|
||||||
Logger::info( "Generating " + std::to_string( row ) );
|
Logger::info( "Generating {0}", row );
|
||||||
auto questInfo = g_exdDataGen.get< Sapphire::Data::Quest >( row );
|
auto questInfo = g_exdDataGen.get< Sapphire::Data::Quest >( row );
|
||||||
|
|
||||||
if( questInfo->name.empty() || questInfo->id.empty() )
|
if( questInfo->name.empty() || questInfo->id.empty() )
|
||||||
|
@ -407,7 +407,7 @@ int main( int argc, char** argv )
|
||||||
"generated/" + questInfo->id + ".lua";
|
"generated/" + questInfo->id + ".lua";
|
||||||
if( system( command.c_str() ) == -1 )
|
if( system( command.c_str() ) == -1 )
|
||||||
{
|
{
|
||||||
Logger::error( "Error executing java command:\n" + command + "\nerrno: " + std::strerror( errno ) );
|
Logger::error( "Error executing java command:\n {0}\nerrno: {1}", command, std::strerror( errno ) );
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,8 +432,8 @@ void Sapphire::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionI
|
||||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||||
if( isPlayer() )
|
if( isPlayer() )
|
||||||
{
|
{
|
||||||
getAsPlayer()->sendDebug( std::to_string( target.getId() ) );
|
getAsPlayer()->sendDebug( "{0}", target.getId() );
|
||||||
getAsPlayer()->sendDebug( "Handle script skill type: " + std::to_string( type ) );
|
getAsPlayer()->sendDebug( "Handle script skill type: {0}", type );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto actionInfoPtr = pExdData->get< Sapphire::Data::Action >( actionId );
|
auto actionInfoPtr = pExdData->get< Sapphire::Data::Action >( actionId );
|
||||||
|
@ -495,10 +495,9 @@ void Sapphire::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionI
|
||||||
if( isPlayer() )
|
if( isPlayer() )
|
||||||
{
|
{
|
||||||
if( pHitActor->isPlayer() )
|
if( pHitActor->isPlayer() )
|
||||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) +
|
getAsPlayer()->sendDebug( "AoE hit actor#{0} ({1})", pHitActor->getId(), pHitActor->getAsChara()->getName() );
|
||||||
" (" + pHitActor->getAsChara()->getName() + ")" );
|
|
||||||
else
|
else
|
||||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) );
|
getAsPlayer()->sendDebug( "AoE hit actor#{0}", pHitActor->getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -546,10 +545,9 @@ void Sapphire::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionI
|
||||||
if( isPlayer() )
|
if( isPlayer() )
|
||||||
{
|
{
|
||||||
if( pHitActor->isPlayer() )
|
if( pHitActor->isPlayer() )
|
||||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) +
|
getAsPlayer()->sendDebug( "AoE hit actor#{0} ({1})", pHitActor->getId(), pHitActor->getAsChara()->getName() );
|
||||||
" (" + pHitActor->getAsChara()->getName() + ")" );
|
|
||||||
else
|
else
|
||||||
getAsPlayer()->sendDebug( "AoE hit actor " + std::to_string( pHitActor->getId() ) );
|
getAsPlayer()->sendDebug( "AoE hit actor#{0}", pHitActor->getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ void Sapphire::Entity::EventObject::spawn( Sapphire::Entity::PlayerPtr pTarget )
|
||||||
if( !pTarget->isObjSpawnIndexValid( spawnIndex ) )
|
if( !pTarget->isObjSpawnIndexValid( spawnIndex ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Logger::debug( "Spawning EObj: id:" + std::to_string( getId() ) + " name:" + getName() );
|
Logger::debug( "Spawning EObj: id#{0} name={1}", getId(), getName() );
|
||||||
|
|
||||||
auto eobjStatePacket = makeZonePacket< FFXIVIpcObjectSpawn >( getId(), pTarget->getId() );
|
auto eobjStatePacket = makeZonePacket< FFXIVIpcObjectSpawn >( getId(), pTarget->getId() );
|
||||||
eobjStatePacket->data().spawnIndex = spawnIndex;
|
eobjStatePacket->data().spawnIndex = spawnIndex;
|
||||||
|
@ -138,7 +138,7 @@ void Sapphire::Entity::EventObject::spawn( Sapphire::Entity::PlayerPtr pTarget )
|
||||||
|
|
||||||
void Sapphire::Entity::EventObject::despawn( Sapphire::Entity::PlayerPtr pTarget )
|
void Sapphire::Entity::EventObject::despawn( Sapphire::Entity::PlayerPtr pTarget )
|
||||||
{
|
{
|
||||||
Logger::debug( "despawn eobj: " + std::to_string( getId() ) );
|
Logger::debug( "despawn eobj#{0}", getId() );
|
||||||
|
|
||||||
pTarget->freeObjSpawnIndexForActorId( getId() );
|
pTarget->freeObjSpawnIndexForActorId( getId() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,9 +362,10 @@ void Sapphire::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||||
rot = targetPos->getTargetRotation();
|
rot = targetPos->getTargetRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendDebug( "Teleport: " + pExdData->get< Sapphire::Data::PlaceName >( data->placeName )->name + " " +
|
sendDebug( "Teleport: {0} {1} ({2})",
|
||||||
pExdData->get< Sapphire::Data::PlaceName >( data->aethernetName )->name +
|
pExdData->get< Sapphire::Data::PlaceName >( data->placeName )->name,
|
||||||
"(" + std::to_string( data->territory ) + ")" );
|
pExdData->get< Sapphire::Data::PlaceName >( data->aethernetName )->name,
|
||||||
|
data->territory );
|
||||||
|
|
||||||
// TODO: this should be simplified and a type created in server_common/common.h.
|
// TODO: this should be simplified and a type created in server_common/common.h.
|
||||||
if( type == 1 ) // teleport
|
if( type == 1 ) // teleport
|
||||||
|
@ -891,9 +892,7 @@ void Sapphire::Entity::Player::setLookAt( uint8_t index, uint8_t value )
|
||||||
// spawn this player for pTarget
|
// spawn this player for pTarget
|
||||||
void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
||||||
{
|
{
|
||||||
Logger::debug( "[" + std::to_string( pTarget->getId() ) + "] Spawning " +
|
Logger::debug( "[{0}] Spawning {1} for {2}", pTarget->getId(), getName(), pTarget->getName() );
|
||||||
getName() + " for " +
|
|
||||||
pTarget->getName() );
|
|
||||||
|
|
||||||
pTarget->queuePacket( std::make_shared< PlayerSpawnPacket >( *getAsPlayer(), *pTarget ) );
|
pTarget->queuePacket( std::make_shared< PlayerSpawnPacket >( *getAsPlayer(), *pTarget ) );
|
||||||
}
|
}
|
||||||
|
@ -902,7 +901,7 @@ void Sapphire::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
||||||
void Sapphire::Entity::Player::despawn( Entity::PlayerPtr pTarget )
|
void Sapphire::Entity::Player::despawn( Entity::PlayerPtr pTarget )
|
||||||
{
|
{
|
||||||
auto pPlayer = pTarget;
|
auto pPlayer = pTarget;
|
||||||
Logger::debug( "despawning " + getName() + " for " + pTarget->getName() );
|
Logger::debug( "Despawning {0} for {1}", getName(), pTarget->getName() );
|
||||||
|
|
||||||
pPlayer->freePlayerSpawnId( getId() );
|
pPlayer->freePlayerSpawnId( getId() );
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
#include <Util/SpawnIndexAllocator.h>
|
#include <Util/SpawnIndexAllocator.h>
|
||||||
|
#include <spdlog/fmt/fmt.h>
|
||||||
|
|
||||||
#include "Chara.h"
|
#include "Chara.h"
|
||||||
#include "Event/EventHandler.h"
|
#include "Event/EventHandler.h"
|
||||||
|
@ -764,6 +765,12 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
void sendDebug( const std::string& message );
|
void sendDebug( const std::string& message );
|
||||||
|
|
||||||
|
template< typename... Args >
|
||||||
|
void sendDebug( const std::string& message, const Args&... args )
|
||||||
|
{
|
||||||
|
sendDebug( fmt::format( message, args... ) );
|
||||||
|
}
|
||||||
|
|
||||||
void sendLogMessage( uint32_t messageId, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, uint32_t param5 = 0, uint32_t param6 = 0 );
|
void sendLogMessage( uint32_t messageId, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, uint32_t param5 = 0, uint32_t param6 = 0 );
|
||||||
|
|
||||||
bool isDirectorInitialized() const;
|
bool isDirectorInitialized() const;
|
||||||
|
|
|
@ -75,7 +75,7 @@ void Sapphire::Entity::Player::directorPlayScene( uint32_t eventId, uint32_t sce
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = getEvent( eventId );
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
{
|
{
|
||||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
Logger::error( "Could not find event #{0}, event has not been started!", eventId );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ Sapphire::Event::EventHandlerPtr Sapphire::Entity::Player::bootstrapSceneEvent(
|
||||||
auto pEvent = getEvent( eventId );
|
auto pEvent = getEvent( eventId );
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
{
|
{
|
||||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
Logger::error( "Could not find event #{0}, event has not been started!", eventId );
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ void Sapphire::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlaye
|
||||||
|
|
||||||
if( !pEvent )
|
if( !pEvent )
|
||||||
{
|
{
|
||||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
Logger::error( "Could not find event #{0}, event has not been started!", eventId );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ void Sapphire::Entity::Player::eventActionStart( uint32_t eventId,
|
||||||
}
|
}
|
||||||
else if( !pEvent )
|
else if( !pEvent )
|
||||||
{
|
{
|
||||||
Logger::error( "Could not find event " + std::to_string( eventId ) + ", event has not been started!" );
|
Logger::error( "Could not find event #{0}, event has not been started!", eventId );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,8 +107,8 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
||||||
// see if a valid zone could be found for the character
|
// see if a valid zone could be found for the character
|
||||||
if( !pCurrZone )
|
if( !pCurrZone )
|
||||||
{
|
{
|
||||||
Logger::error( "[" + char_id_str + "] Zone " + std::to_string( zoneId ) + " not found!" );
|
Logger::error( "[{0}] Zone #{1} not found!", char_id_str, zoneId );
|
||||||
Logger::error( "[" + char_id_str + "] Setting default zone instead" );
|
Logger::error( "[{0}] Setting default zone instead", char_id_str );
|
||||||
|
|
||||||
// default to new gridania
|
// default to new gridania
|
||||||
// TODO: should probably just abort and mark character as corrupt
|
// TODO: should probably just abort and mark character as corrupt
|
||||||
|
@ -206,7 +206,7 @@ bool Sapphire::Entity::Player::load( uint32_t charId, World::SessionPtr pSession
|
||||||
m_pCell = nullptr;
|
m_pCell = nullptr;
|
||||||
|
|
||||||
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
if( !loadActiveQuests() || !loadClassData() || !loadSearchInfo() )
|
||||||
Logger::error( "Player id " + char_id_str + " data corrupt!" );
|
Logger::error( "Player #{0} data corrupt!", char_id_str );
|
||||||
|
|
||||||
m_maxHp = getMaxHp();
|
m_maxHp = getMaxHp();
|
||||||
m_maxMp = getMaxMp();
|
m_maxMp = getMaxMp();
|
||||||
|
|
|
@ -48,11 +48,11 @@ void Sapphire::ItemContainer::removeItem( uint16_t slotId, bool removeFromDb )
|
||||||
|
|
||||||
m_itemMap.erase( it );
|
m_itemMap.erase( it );
|
||||||
|
|
||||||
Logger::debug( "Dropped item from slot " + std::to_string( slotId ) );
|
Logger::debug( "Dropped item from slot {0}", slotId );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::debug( "Item could not be dropped from slot " + std::to_string( slotId ) );
|
Logger::debug( "Item could not be dropped from slot {0}", slotId );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ Sapphire::ItemPtr Sapphire::ItemContainer::getItem( uint16_t slotId )
|
||||||
|
|
||||||
if( ( slotId > m_size ) )
|
if( ( slotId > m_size ) )
|
||||||
{
|
{
|
||||||
Logger::error( "Slot out of range " + std::to_string( slotId ) );
|
Logger::error( "Slot out of range {0}", slotId );
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ void Sapphire::World::Manager::DebugCommandMgr::help( char* data, Entity::Player
|
||||||
{
|
{
|
||||||
if( player.getGmRank() >= cmd.second->m_gmLevel )
|
if( player.getGmRank() >= cmd.second->m_gmLevel )
|
||||||
{
|
{
|
||||||
player.sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText() );
|
player.sendDebug( " - {0} - {1}", cmd.first, cmd.second->getHelpText() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,8 +159,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[{0}] subCommand: {1} params: {1}", player.getId(), subCommand, params );
|
||||||
"subCommand " + subCommand + " params: " + params );
|
|
||||||
|
|
||||||
if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) )
|
if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) )
|
||||||
{
|
{
|
||||||
|
@ -325,7 +324,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
|
||||||
|
|
||||||
if( !player.hasQuest( questId ) )
|
if( !player.hasQuest( questId ) )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Player doesn't have the quest with ID: " + std::to_string( questId ) );
|
player.sendDebug( "Player doesn't have the quest with ID#: {0}", questId );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( questBit == 0 || questId == 0 )
|
if( questBit == 0 || questId == 0 )
|
||||||
|
@ -535,9 +534,7 @@ void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player&
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[{0}] subCommand: {1} params: {2}", player.getId(), subCommand, params );
|
||||||
"subCommand " + subCommand + " params: " + params );
|
|
||||||
|
|
||||||
|
|
||||||
if( ( subCommand == "pos" ) )
|
if( ( subCommand == "pos" ) )
|
||||||
{
|
{
|
||||||
|
@ -682,9 +679,9 @@ Sapphire::World::Manager::DebugCommandMgr::serverInfo( char* data, Entity::Playe
|
||||||
std::shared_ptr< DebugCommand > command )
|
std::shared_ptr< DebugCommand > command )
|
||||||
{
|
{
|
||||||
auto pServerZone = framework()->get< World::ServerMgr >();
|
auto pServerZone = framework()->get< World::ServerMgr >();
|
||||||
player.sendDebug( "SapphireZone " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
|
player.sendDebug( "SapphireZone {0} \nRev: {1}", Version::VERSION, Version::GIT_HASH );
|
||||||
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
player.sendDebug( "Compiled: " __DATE__ " " __TIME__ );
|
||||||
player.sendDebug( "Sessions: " + std::to_string( pServerZone->getSessionCount() ) );
|
player.sendDebug( "Sessions: {0}", pServerZone->getSessionCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Player& player,
|
void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Player& player,
|
||||||
|
@ -710,8 +707,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
if( command->getName().length() + 1 + pos + 1 < strlen( data ) )
|
||||||
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
params = std::string( data + command->getName().length() + 1 + pos + 1 );
|
||||||
|
|
||||||
Logger::debug( "[" + std::to_string( player.getId() ) + "] " +
|
Logger::debug( "[{0}] subCommand: {1} params: {2}", player.getId(), subCommand, params );
|
||||||
"subCommand " + subCommand + " params: " + params );
|
|
||||||
|
|
||||||
if( subCommand == "unload" )
|
if( subCommand == "unload" )
|
||||||
{
|
{
|
||||||
|
@ -720,7 +716,7 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
else if( pScriptMgr->getNativeScriptHandler().unloadScript( params ) )
|
else if( pScriptMgr->getNativeScriptHandler().unloadScript( params ) )
|
||||||
player.sendDebug( "Unloaded script successfully." );
|
player.sendDebug( "Unloaded script successfully." );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to unload script: " + params );
|
player.sendDebug( "Failed to unload script: {0}", params );
|
||||||
}
|
}
|
||||||
else if( subCommand == "find" || subCommand == "f" )
|
else if( subCommand == "find" || subCommand == "f" )
|
||||||
{
|
{
|
||||||
|
@ -733,17 +729,16 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
|
|
||||||
if( !scripts.empty() )
|
if( !scripts.empty() )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Found " + std::to_string( scripts.size() ) + " scripts" );
|
player.sendDebug( "Found {0} scripts", scripts.size() );
|
||||||
|
|
||||||
for( auto it = scripts.begin(); it != scripts.end(); ++it )
|
for( auto it = scripts.begin(); it != scripts.end(); ++it )
|
||||||
{
|
{
|
||||||
auto script = *it;
|
auto script = *it;
|
||||||
player.sendDebug( " - '" + script->library_name +
|
player.sendDebug( " - '{0}', num scripts: {1}", script->library_name, script->scripts.size() );
|
||||||
", num scripts: " + std::to_string( script->scripts.size() ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player.sendDebug( "No scripts found with search term: " + params );
|
player.sendDebug( "No scripts found with search term: {0}", params );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( subCommand == "load" || subCommand == "l" )
|
else if( subCommand == "load" || subCommand == "l" )
|
||||||
|
@ -753,9 +748,9 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pScriptMgr->getNativeScriptHandler().loadScript( params ) )
|
if( pScriptMgr->getNativeScriptHandler().loadScript( params ) )
|
||||||
player.sendDebug( "Loaded '" + params + "' successfully" );
|
player.sendDebug( "Loaded '{0}' successfully", params );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to load '" + params + "'" );
|
player.sendDebug( "Failed to load '{0}'", params );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -766,12 +761,12 @@ void Sapphire::World::Manager::DebugCommandMgr::script( char* data, Entity::Play
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pScriptMgr->getNativeScriptHandler().queueScriptReload( params );
|
pScriptMgr->getNativeScriptHandler().queueScriptReload( params );
|
||||||
player.sendDebug( "Queued script reload for script: " + params );
|
player.sendDebug( "Queued script reload for script: {0}", params );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendDebug( "Unknown script subcommand: " + subCommand );
|
player.sendDebug( "Unknown script subcommand: {0}", subCommand );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,10 +800,9 @@ Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player&
|
||||||
|
|
||||||
auto instance = pTeriMgr->createInstanceContent( instanceContentId );
|
auto instance = pTeriMgr->createInstanceContent( instanceContentId );
|
||||||
if( instance )
|
if( instance )
|
||||||
player.sendDebug(
|
player.sendDebug( "Created instance with id#{0} -> {1}", instance->getGuId(), instance->getName() );
|
||||||
"Created instance with id: " + std::to_string( instance->getGuId() ) + " -> " + instance->getName() );
|
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to create instance with id: " + std::to_string( instanceContentId ) );
|
player.sendDebug( "Failed to create instance with id#{0}", instanceContentId );
|
||||||
}
|
}
|
||||||
else if( subCommand == "bind" )
|
else if( subCommand == "bind" )
|
||||||
{
|
{
|
||||||
|
@ -825,7 +819,7 @@ Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player&
|
||||||
" -> " + pInstanceContent->getName() );
|
" -> " + pInstanceContent->getName() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player.sendDebug( "Unknown instance with id: " + std::to_string( instanceId ) );
|
player.sendDebug( "Unknown instance with id#{0}", instanceId );
|
||||||
}
|
}
|
||||||
else if( subCommand == "unbind" )
|
else if( subCommand == "unbind" )
|
||||||
{
|
{
|
||||||
|
@ -835,7 +829,7 @@ Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player&
|
||||||
auto instance = pTeriMgr->getInstanceZonePtr( instanceId );
|
auto instance = pTeriMgr->getInstanceZonePtr( instanceId );
|
||||||
if( !instance )
|
if( !instance )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Unknown instance with id: " + std::to_string( instanceId ) );
|
player.sendDebug( "Unknown instance with id#{0} ", instanceId );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,12 +837,10 @@ Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player&
|
||||||
if( pInstanceContent->isPlayerBound( player.getId() ) )
|
if( pInstanceContent->isPlayerBound( player.getId() ) )
|
||||||
{
|
{
|
||||||
pInstanceContent->unbindPlayer( player.getId() );
|
pInstanceContent->unbindPlayer( player.getId() );
|
||||||
player.sendDebug(
|
player.sendDebug( "Now unbound from instance with id#{0} -> {1}", pInstanceContent->getGuId(), pInstanceContent->getName() );
|
||||||
"Now unbound from instance with id: " + std::to_string( pInstanceContent->getGuId() ) +
|
|
||||||
" -> " + pInstanceContent->getName() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player.sendDebug( "Player not bound to instance with id: " + std::to_string( instanceId ) );
|
player.sendDebug( "Player not bound to instance with id#{0}", instanceId );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( subCommand == "createzone" || subCommand == "crz" )
|
else if( subCommand == "createzone" || subCommand == "crz" )
|
||||||
|
@ -861,7 +853,7 @@ Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player&
|
||||||
player.sendDebug(
|
player.sendDebug(
|
||||||
"Created instance with id: " + std::to_string( instance->getGuId() ) + " -> " + instance->getName() );
|
"Created instance with id: " + std::to_string( instance->getGuId() ) + " -> " + instance->getName() );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to create instance with id: " + std::to_string( zoneId ) );
|
player.sendDebug( "Failed to create instance with id#{0}", zoneId );
|
||||||
}
|
}
|
||||||
else if( subCommand == "remove" || subCommand == "rm" )
|
else if( subCommand == "remove" || subCommand == "rm" )
|
||||||
{
|
{
|
||||||
|
@ -869,9 +861,9 @@ Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player&
|
||||||
sscanf( params.c_str(), "%d", &terriId );
|
sscanf( params.c_str(), "%d", &terriId );
|
||||||
|
|
||||||
if( pTeriMgr->removeTerritoryInstance( terriId ) )
|
if( pTeriMgr->removeTerritoryInstance( terriId ) )
|
||||||
player.sendDebug( "Removed instance with id: " + std::to_string( terriId ) );
|
player.sendDebug( "Removed instance with id#{0}", terriId );
|
||||||
else
|
else
|
||||||
player.sendDebug( "Failed to remove instance with id: " + std::to_string( terriId ) );
|
player.sendDebug( "Failed to remove instance with id#{0}", terriId );
|
||||||
}
|
}
|
||||||
else if( subCommand == "return" || subCommand == "ret" )
|
else if( subCommand == "return" || subCommand == "ret" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,12 +94,12 @@ bool Sapphire::World::Manager::HousingMgr::init()
|
||||||
|
|
||||||
if( landSet.second.size() != 60 )
|
if( landSet.second.size() != 60 )
|
||||||
{
|
{
|
||||||
Logger::fatal( "LandSet " + std::to_string( landSet.first ) + " is missing land entries. Only have " + std::to_string( count ) + " land entries." );
|
Logger::fatal( "LandSet {0} is missing land entries. Only have {1} land entries.", landSet.first, count );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info( "HousingMgr: Cached " + std::to_string( houseCount ) + " houses" );
|
Logger::info( "HousingMgr: Cached {0} houses", houseCount );
|
||||||
|
|
||||||
/////
|
/////
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
||||||
itemCount++;
|
itemCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::debug( "HousingMgr: Loaded " + std::to_string( itemCount ) + " inventory items" );
|
Logger::debug( "HousingMgr: Loaded {0} inventory items", itemCount );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -217,8 +217,8 @@ void Sapphire::World::Manager::HousingMgr::initLandCache()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// this should never ever happen, if it does the db is fucked
|
// this should never ever happen, if it does the db is fucked
|
||||||
Logger::error( "HousingMgr: Plot " + std::to_string( entry.m_landId ) + " in landset " + std::to_string( entry.m_landSetId ) +
|
Logger::error( "HousingMgr: Plot {0} in landset {1} has an invalid land size, defaulting to cottage.",
|
||||||
" has an invalid land size, defaulting to cottage." );
|
entry.m_landId, entry.m_landSetId );
|
||||||
entry.m_maxPlacedExternalItems = 20;
|
entry.m_maxPlacedExternalItems = 20;
|
||||||
entry.m_maxPlacedInternalItems = 200;
|
entry.m_maxPlacedInternalItems = 200;
|
||||||
break;
|
break;
|
||||||
|
@ -913,7 +913,7 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for outdoor appearance." );
|
Logger::error( "Plot {0} has an invalid inventory configuration for outdoor appearance.", house->getLandIdent().landId );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto intContainer = containers.find( static_cast< uint16_t >( InventoryType::HousingInteriorAppearance ) );
|
auto intContainer = containers.find( static_cast< uint16_t >( InventoryType::HousingInteriorAppearance ) );
|
||||||
|
@ -927,7 +927,7 @@ void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::error( "Plot " + std::to_string( house->getLandIdent().landId ) + " has an invalid inventory configuration for indoor appearance." );
|
Logger::error( "Plot {0} has an invalid inventory configuration for indoor appearance.", house->getLandIdent().landId );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,12 +162,14 @@ bool Sapphire::World::Manager::TerritoryMgr::createDefaultTerritories()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32_t guid = getNextInstanceId();
|
uint32_t guid = getNextInstanceId();
|
||||||
Logger::info( std::to_string( territoryTypeId ) +
|
|
||||||
"\t" + std::to_string( guid ) +
|
Logger::info( "{0}\t{1}\t{2}\t{3:<10}\t{4}\t{5}",
|
||||||
"\t" + std::to_string( territoryInfo->territoryIntendedUse ) +
|
territoryTypeId,
|
||||||
"\t" + ( territoryInfo->name.length() <= 4 ? territoryInfo->name + "\t" : territoryInfo->name ) +
|
guid,
|
||||||
"\t" + ( isPrivateTerritory( territoryTypeId ) ? "PRIVATE" : "PUBLIC" ) +
|
territoryInfo->territoryIntendedUse,
|
||||||
"\t" + pPlaceName->name );
|
territoryInfo->name,
|
||||||
|
( isPrivateTerritory( territoryTypeId ) ? "PRIVATE" : "PUBLIC" ),
|
||||||
|
pPlaceName->name );
|
||||||
|
|
||||||
auto pZone = make_Zone( territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() );
|
auto pZone = make_Zone( territoryTypeId, guid, territoryInfo->name, pPlaceName->name, framework() );
|
||||||
pZone->init();
|
pZone->init();
|
||||||
|
@ -205,13 +207,14 @@ bool Sapphire::World::Manager::TerritoryMgr::createHousingTerritories()
|
||||||
for( wardNum = 0; wardNum < wardMaxNum; wardNum++ )
|
for( wardNum = 0; wardNum < wardMaxNum; wardNum++ )
|
||||||
{
|
{
|
||||||
uint32_t guid = getNextInstanceId();
|
uint32_t guid = getNextInstanceId();
|
||||||
Logger::info( std::to_string( territoryTypeId ) +
|
|
||||||
"\t" + std::to_string( guid ) +
|
Logger::info( "{0}\t{1}\t{2}\t{3:<10}\tHOUSING\t{4}#{5}",
|
||||||
"\t" + std::to_string( territoryInfo->territoryIntendedUse ) +
|
territoryTypeId,
|
||||||
"\t" + ( territoryInfo->name.length() <= 4 ? territoryInfo->name + "\t" : territoryInfo->name ) +
|
guid,
|
||||||
"\t" + "HOUSING" +
|
territoryInfo->territoryIntendedUse,
|
||||||
"\t" + pPlaceName->name +
|
territoryInfo->name,
|
||||||
"#" + std::to_string( wardNum ) );
|
pPlaceName->name,
|
||||||
|
wardNum );
|
||||||
|
|
||||||
auto pHousingZone = make_HousingZone( wardNum, territoryTypeId, guid, territoryInfo->name,
|
auto pHousingZone = make_HousingZone( wardNum, territoryTypeId, guid, territoryInfo->name,
|
||||||
pPlaceName->name, framework() );
|
pPlaceName->name, framework() );
|
||||||
|
@ -246,8 +249,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc
|
||||||
if( !pTeri || !pPlaceName )
|
if( !pTeri || !pPlaceName )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
Logger::debug(
|
Logger::debug( "Starting instance for territory: {0} ({1})", territoryTypeId, pPlaceName->name );
|
||||||
"Starting instance for territory: " + std::to_string( territoryTypeId ) + " (" + pPlaceName->name + ")" );
|
|
||||||
|
|
||||||
auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, framework() );
|
auto pZone = make_Zone( territoryTypeId, getNextInstanceId(), pTeri->name, pPlaceName->name, framework() );
|
||||||
pZone->init();
|
pZone->init();
|
||||||
|
@ -280,8 +282,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createInstanceContent(
|
||||||
if( !pTeri || pInstanceContent->name.empty() )
|
if( !pTeri || pInstanceContent->name.empty() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
Logger::debug( "Starting instance for InstanceContent id: " + std::to_string( instanceContentId ) +
|
Logger::debug( "Starting instance for InstanceContent id: {0} ({1})", instanceContentId, pInstanceContent->name );
|
||||||
" (" + pInstanceContent->name + ")" );
|
|
||||||
|
|
||||||
auto pZone = make_InstanceContent( pInstanceContent, pContentFinderCondition->territoryType, getNextInstanceId(),
|
auto pZone = make_InstanceContent( pInstanceContent, pContentFinderCondition->territoryType, getNextInstanceId(),
|
||||||
pTeri->name, pInstanceContent->name, instanceContentId, framework() );
|
pTeri->name, pInstanceContent->name, instanceContentId, framework() );
|
||||||
|
@ -471,8 +472,7 @@ void Sapphire::World::Manager::TerritoryMgr::updateTerritoryInstances( uint32_t
|
||||||
// todo: make this timeout configurable, though should be pretty relaxed in any case
|
// todo: make this timeout configurable, though should be pretty relaxed in any case
|
||||||
if( diff > 60 )
|
if( diff > 60 )
|
||||||
{
|
{
|
||||||
Logger::info( "Removing HousingInteriorTerritory#" +
|
Logger::info( "Removing HousingInteriorTerritory#{0} - has been inactive for 60 seconds", zone->getGuId() );
|
||||||
std::to_string( zone->getGuId() ) + " - has been inactive for 60 seconds" );
|
|
||||||
|
|
||||||
// remove zone from maps
|
// remove zone from maps
|
||||||
m_zoneSet.erase( zone );
|
m_zoneSet.erase( zone );
|
||||||
|
|
|
@ -141,7 +141,7 @@ void Sapphire::Network::GameConnection::OnAccept( const std::string& host, uint1
|
||||||
{
|
{
|
||||||
GameConnectionPtr connection( new GameConnection( m_hive, m_pAcceptor, m_pFw ) );
|
GameConnectionPtr connection( new GameConnection( m_hive, m_pAcceptor, m_pFw ) );
|
||||||
m_pAcceptor->Accept( connection );
|
m_pAcceptor->Accept( connection );
|
||||||
Logger::info( "Connect from " + m_socket.remote_endpoint().address().to_string() );
|
Logger::info( "Connect from {0}", m_socket.remote_endpoint().address().to_string() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ void Sapphire::Network::GameConnection::OnRecv( std::vector< uint8_t >& buffer )
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::OnError( const asio::error_code& error )
|
void Sapphire::Network::GameConnection::OnError( const asio::error_code& error )
|
||||||
{
|
{
|
||||||
Logger::debug( "GameConnection ERROR: " + error.message() );
|
Logger::debug( "GameConnection ERROR: {0}", error.message() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::queueInPacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW inPacket )
|
void Sapphire::Network::GameConnection::queueInPacket( Sapphire::Network::Packets::FFXIVARR_PACKET_RAW inPacket )
|
||||||
|
@ -214,24 +214,20 @@ void Sapphire::Network::GameConnection::handleZonePacket( Sapphire::Network::Pac
|
||||||
uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] );
|
uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] );
|
||||||
auto it = m_zoneHandlerMap.find( opcode );
|
auto it = m_zoneHandlerMap.find( opcode );
|
||||||
|
|
||||||
std::string sessionStr = "[" + std::to_string( m_pSession->getId() ) + "]";
|
|
||||||
|
|
||||||
if( it != m_zoneHandlerMap.end() )
|
if( it != m_zoneHandlerMap.end() )
|
||||||
{
|
{
|
||||||
auto itStr = m_zoneHandlerStrMap.find( opcode );
|
auto itStr = m_zoneHandlerStrMap.find( opcode );
|
||||||
std::string name = itStr != m_zoneHandlerStrMap.end() ? itStr->second : "unknown";
|
std::string name = itStr != m_zoneHandlerStrMap.end() ? itStr->second : "unknown";
|
||||||
// dont display packet notification if it is a ping or pos update, don't want the spam
|
// dont display packet notification if it is a ping or pos update, don't want the spam
|
||||||
if( opcode != PingHandler && opcode != UpdatePositionHandler )
|
if( opcode != PingHandler && opcode != UpdatePositionHandler )
|
||||||
Logger::debug( sessionStr + " Handling Zone IPC : " + name + "( " +
|
Logger::debug( "[{0}] Handling Zone IPC : {1} ( {2:04X} )", m_pSession->getId(), name, opcode );
|
||||||
Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" );
|
|
||||||
|
|
||||||
( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() );
|
( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::debug( sessionStr + " Undefined Zone IPC : Unknown ( " +
|
Logger::debug( "[{0}] Undefined Zone IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode );
|
||||||
Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" );
|
Logger::debug( "Dump:\n{0}", Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ),
|
||||||
Logger::debug( "Dump:\n" + Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ),
|
|
||||||
pPacket.segHdr.size ) );
|
pPacket.segHdr.size ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,23 +237,19 @@ void Sapphire::Network::GameConnection::handleChatPacket( Sapphire::Network::Pac
|
||||||
uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] );
|
uint16_t opcode = *reinterpret_cast< uint16_t* >( &pPacket.data[ 0x02 ] );
|
||||||
auto it = m_chatHandlerMap.find( opcode );
|
auto it = m_chatHandlerMap.find( opcode );
|
||||||
|
|
||||||
std::string sessionStr = "[" + std::to_string( m_pSession->getId() ) + "]";
|
|
||||||
|
|
||||||
if( it != m_chatHandlerMap.end() )
|
if( it != m_chatHandlerMap.end() )
|
||||||
{
|
{
|
||||||
auto itStr = m_chatHandlerStrMap.find( opcode );
|
auto itStr = m_chatHandlerStrMap.find( opcode );
|
||||||
std::string name = itStr != m_chatHandlerStrMap.end() ? itStr->second : "unknown";
|
std::string name = itStr != m_chatHandlerStrMap.end() ? itStr->second : "unknown";
|
||||||
// dont display packet notification if it is a ping or pos update, don't want the spam
|
// dont display packet notification if it is a ping or pos update, don't want the spam
|
||||||
|
|
||||||
Logger::debug( sessionStr + " Handling Chat IPC : " + name + "( " +
|
Logger::debug( "[{0}] Handling Chat IPC : {1} ( {2:04X} )", m_pSession->getId(), name, opcode );
|
||||||
Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" );
|
|
||||||
|
|
||||||
( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() );
|
( this->*( it->second ) )( m_pFw, pPacket, *m_pSession->getPlayer() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::debug( sessionStr + " Undefined Chat IPC : Unknown ( " +
|
Logger::debug( "[{0}] Undefined Chat IPC : Unknown ( {1:04X} )", m_pSession->getId(), opcode );
|
||||||
Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +343,7 @@ void Sapphire::Network::GameConnection::injectPacket( const std::string& packetp
|
||||||
fp = fopen( packetpath.c_str(), "rb" );
|
fp = fopen( packetpath.c_str(), "rb" );
|
||||||
if( fp == nullptr )
|
if( fp == nullptr )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Packet " + packetpath + " not found!" );
|
player.sendDebug( "Packet {0} not found!", packetpath );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +353,7 @@ void Sapphire::Network::GameConnection::injectPacket( const std::string& packetp
|
||||||
rewind( fp );
|
rewind( fp );
|
||||||
if( fread( packet, sizeof( char ), size, fp ) != size )
|
if( fread( packet, sizeof( char ), size, fp ) != size )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Packet " + packetpath + " did not read full size: " + std::to_string( size ) );
|
player.sendDebug( "Packet {0} did not read full size: {1}", packetpath, size );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
|
@ -413,7 +405,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
|
||||||
|
|
||||||
if( !session )
|
if( !session )
|
||||||
{
|
{
|
||||||
Logger::info( "[" + std::string( id ) + "] Session not registered, creating" );
|
Logger::info( "[{0}] Session not registered, creating", id );
|
||||||
// return;
|
// return;
|
||||||
if( !pServerZone->createSession( playerId ) )
|
if( !pServerZone->createSession( playerId ) )
|
||||||
{
|
{
|
||||||
|
@ -425,7 +417,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
|
||||||
//TODO: Catch more things in lobby and send real errors
|
//TODO: Catch more things in lobby and send real errors
|
||||||
else if( !session->isValid() || ( session->getPlayer() && session->getPlayer()->getLastPing() != 0 ) )
|
else if( !session->isValid() || ( session->getPlayer() && session->getPlayer()->getLastPing() != 0 ) )
|
||||||
{
|
{
|
||||||
Logger::error( "[" + std::string( id ) + "] Session INVALID, disconnecting" );
|
Logger::error( "[{0}] Session INVALID, disconnecting", id );
|
||||||
Disconnect();
|
Disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +437,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
|
||||||
auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
|
auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
|
||||||
*( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId;
|
*( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId;
|
||||||
sendSinglePacket( pe1 );
|
sendSinglePacket( pe1 );
|
||||||
Logger::info( "[" + std::string( id ) + "] Setting session for zone connection" );
|
Logger::info( "[{0}] Setting session for zone connection", id );
|
||||||
session->setZoneConnection( pCon );
|
session->setZoneConnection( pCon );
|
||||||
}
|
}
|
||||||
// chat connection, assinging it to the session
|
// chat connection, assinging it to the session
|
||||||
|
@ -459,7 +451,7 @@ void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::
|
||||||
*( unsigned short* ) ( &pe3->data()[ 2 ] ) = 0x02;
|
*( unsigned short* ) ( &pe3->data()[ 2 ] ) = 0x02;
|
||||||
sendSinglePacket( pe3 );
|
sendSinglePacket( pe3 );
|
||||||
|
|
||||||
Logger::info( "[" + std::string( id ) + "] Setting session for chat connection" );
|
Logger::info( "[{0}] Setting session for chat connection", id );
|
||||||
session->setChatConnection( pCon );
|
session->setChatConnection( pCon );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
||||||
const auto useCount = packet.data().useCount;
|
const auto useCount = packet.data().useCount;
|
||||||
const auto targetId = packet.data().targetId;
|
const auto targetId = packet.data().targetId;
|
||||||
|
|
||||||
player.sendDebug( "Skill type:" + std::to_string( type ) );
|
player.sendDebug( "Skill type: {0}", type );
|
||||||
|
|
||||||
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
||||||
auto pScriptMgr = pFw->get< Scripting::ScriptMgr >();
|
auto pScriptMgr = pFw->get< Scripting::ScriptMgr >();
|
||||||
|
@ -57,9 +57,8 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
||||||
{
|
{
|
||||||
std::string actionIdStr = Util::intToHexString( action, 4 );
|
std::string actionIdStr = Util::intToHexString( action, 4 );
|
||||||
player.sendDebug( "---------------------------------------" );
|
player.sendDebug( "---------------------------------------" );
|
||||||
player.sendDebug( "ActionHandler ( " + actionIdStr + " | " +
|
player.sendDebug( "ActionHandler ( {0} | {1} | {2} )",
|
||||||
pExdData->get< Sapphire::Data::Action >( action )->name +
|
actionIdStr, pExdData->get< Sapphire::Data::Action >( action )->name, targetId );
|
||||||
" | " + std::to_string( targetId ) + " )" );
|
|
||||||
|
|
||||||
player.queuePacket( makeActorControl142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
|
player.queuePacket( makeActorControl142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||||
|
|
||||||
|
@ -122,7 +121,7 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
||||||
|
|
||||||
case Common::SkillType::MountSkill:
|
case Common::SkillType::MountSkill:
|
||||||
|
|
||||||
player.sendDebug( "Request mount " + std::to_string( action ) );
|
player.sendDebug( "Request mount {0}", action );
|
||||||
|
|
||||||
auto pActionMount = Action::make_ActionMount( player.getAsPlayer(), action );
|
auto pActionMount = Action::make_ActionMount( player.getAsPlayer(), action );
|
||||||
player.setCurrentAction( pActionMount );
|
player.setCurrentAction( pActionMount );
|
||||||
|
|
|
@ -56,7 +56,7 @@ void Sapphire::Network::GameConnection::cfRegisterDuty( FrameworkPtr pFw,
|
||||||
if( id == 0 )
|
if( id == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
player.sendDebug( "got contentId: " + std::to_string( id ) );
|
player.sendDebug( "got contentId#{0}", id );
|
||||||
|
|
||||||
selectedContent.push_back( id );
|
selectedContent.push_back( id );
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ void Sapphire::Network::GameConnection::cfRegisterDuty( FrameworkPtr pFw,
|
||||||
auto index = std::rand() % selectedContent.size();
|
auto index = std::rand() % selectedContent.size();
|
||||||
auto contentId = selectedContent.at( index );
|
auto contentId = selectedContent.at( index );
|
||||||
|
|
||||||
player.sendDebug( "Duty register request for contentid: " + std::to_string( contentId ) );
|
player.sendDebug( "Duty register request for contentid#{0}", contentId );
|
||||||
|
|
||||||
// let's cancel it because otherwise you can't register it again
|
// let's cancel it because otherwise you can't register it again
|
||||||
auto cfCancelPacket = makeZonePacket< FFXIVIpcCFNotify >( player.getId() );
|
auto cfCancelPacket = makeZonePacket< FFXIVIpcCFNotify >( player.getId() );
|
||||||
|
@ -84,7 +84,7 @@ void Sapphire::Network::GameConnection::cfRegisterDuty( FrameworkPtr pFw,
|
||||||
auto pInstance = instance->getAsInstanceContent();
|
auto pInstance = instance->getAsInstanceContent();
|
||||||
pInstance->bindPlayer( player.getId() );
|
pInstance->bindPlayer( player.getId() );
|
||||||
|
|
||||||
player.sendDebug( "Created instance with id: " + std::to_string( instance->getGuId() ) );
|
player.sendDebug( "Created instance with id#", instance->getGuId() );
|
||||||
|
|
||||||
player.setInstance( instance );
|
player.setInstance( instance );
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,12 +79,8 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
|
||||||
const auto param4 = packet.data().param4;
|
const auto param4 = packet.data().param4;
|
||||||
const auto param5 = packet.data().param5;
|
const auto param5 = packet.data().param5;
|
||||||
|
|
||||||
Logger::debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
|
Logger::debug( "[{0}] Incoming action: {1:04X}\nparam1: {2:016X}\nparam2: {3:08X}\nparam3: {4:016x}",
|
||||||
Util::intToHexString( static_cast< uint32_t >( commandId & 0xFFFF ), 4 ) +
|
m_pSession->getId(), commandId, param1, param2, param3 );
|
||||||
"\nparam1: " + Util::intToHexString( static_cast< uint64_t >( param1 & 0xFFFFFFFFFFFFFFF ), 16 ) +
|
|
||||||
"\nparam2: " + Util::intToHexString( static_cast< uint32_t >( param2 & 0xFFFFFFFF ), 8 ) +
|
|
||||||
"\nparam3: " + Util::intToHexString( static_cast< uint64_t >( param3 & 0xFFFFFFFFFFFFFFF ), 16 )
|
|
||||||
);
|
|
||||||
|
|
||||||
//g_log.Log(LoggingSeverity::debug, "[" + std::to_string(m_pSession->getId()) + "] " + pInPacket->toString());
|
//g_log.Log(LoggingSeverity::debug, "[" + std::to_string(m_pSession->getId()) + "] " + pInPacket->toString());
|
||||||
|
|
||||||
|
@ -486,16 +482,14 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw,
|
||||||
auto privateEstateAccess = ( param2 >> 16 & 0xFF ) == 1;
|
auto privateEstateAccess = ( param2 >> 16 & 0xFF ) == 1;
|
||||||
auto unk = ( param2 >> 24 & 0xFF ) == 1; // todo: related to fc? or unused?
|
auto unk = ( param2 >> 24 & 0xFF ) == 1; // todo: related to fc? or unused?
|
||||||
|
|
||||||
player.sendDebug( "can teleport: " + std::to_string( canTeleport ) + ", unk: " + std::to_string( unk1 ) +
|
player.sendDebug( "can teleport: {0}, unk: {1}, privateEstateAccess: {2}, unk: {3}",
|
||||||
", privateEstateAccess: " + std::to_string( privateEstateAccess ) +
|
canTeleport, unk1, privateEstateAccess, unk );
|
||||||
", unk: " + std::to_string( unk ) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Logger::debug( "[" + std::to_string( m_pSession->getId() ) + "] Unhandled action: " +
|
Logger::debug( "[{0}] Unhandled action: {1:04X}", m_pSession->getId(), commandId );
|
||||||
Util::intToHexString( static_cast< uint32_t >( commandId & 0xFFFF ), 4 ) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,15 +48,12 @@ void Sapphire::Network::GameConnection::eventHandlerTalk( FrameworkPtr pFw,
|
||||||
std::string eventName = "onTalk";
|
std::string eventName = "onTalk";
|
||||||
std::string objName = pEventMgr->getEventName( eventId );
|
std::string objName = pEventMgr->getEventName( eventId );
|
||||||
|
|
||||||
player.sendDebug( "Chara: " +
|
player.sendDebug( "Chara: {0} -> {1} \neventId: {2} ({3:08X}",
|
||||||
std::to_string( actorId ) + " -> " +
|
actorId, pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ),
|
||||||
std::to_string( pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
|
eventId, eventId );
|
||||||
" \neventId: " +
|
|
||||||
std::to_string( eventId ) +
|
|
||||||
" (0x" + Util::intToHexString( static_cast< uint64_t >( eventId & 0xFFFFFFF ), 8 ) + ")" );
|
|
||||||
|
|
||||||
|
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.sendDebug( "Calling: {0}.{1}", objName, eventName );
|
||||||
player.eventStart( actorId, eventId, Event::EventHandler::Talk, 0, 0 );
|
player.eventStart( actorId, eventId, Event::EventHandler::Talk, 0, 0 );
|
||||||
|
|
||||||
if( auto instance = player.getCurrentInstance() )
|
if( auto instance = player.getCurrentInstance() )
|
||||||
|
@ -93,14 +90,11 @@ void Sapphire::Network::GameConnection::eventHandlerEmote( FrameworkPtr pFw,
|
||||||
std::string eventName = "onEmote";
|
std::string eventName = "onEmote";
|
||||||
std::string objName = pEventMgr->getEventName( eventId );
|
std::string objName = pEventMgr->getEventName( eventId );
|
||||||
|
|
||||||
player.sendDebug( "Chara: " +
|
player.sendDebug( "Chara: {0} -> {1} \neventId: {2} ({3:08X}",
|
||||||
std::to_string( actorId ) + " -> " +
|
actorId, pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ),
|
||||||
std::to_string( pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
|
eventId, eventId );
|
||||||
" \neventId: " +
|
|
||||||
std::to_string( eventId ) +
|
|
||||||
" (0x" + Util::intToHexString( static_cast< uint64_t >( eventId & 0xFFFFFFF ), 8 ) + ")" );
|
|
||||||
|
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.sendDebug( "Calling: {0}.{1}", objName, eventName );
|
||||||
|
|
||||||
player.eventStart( actorId, eventId, Event::EventHandler::Emote, 0, emoteId );
|
player.eventStart( actorId, eventId, Event::EventHandler::Emote, 0, emoteId );
|
||||||
|
|
||||||
|
@ -130,8 +124,7 @@ void Sapphire::Network::GameConnection::eventHandlerWithinRange( FrameworkPtr pF
|
||||||
|
|
||||||
std::string eventName = "onWithinRange";
|
std::string eventName = "onWithinRange";
|
||||||
std::string objName = pEventMgr->getEventName( eventId );
|
std::string objName = pEventMgr->getEventName( eventId );
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) +
|
player.sendDebug( "Calling: {0}.{1} - {2} p1: {3}", objName, eventName, eventId, param1 );
|
||||||
" p1: " + std::to_string( param1 ) );
|
|
||||||
|
|
||||||
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
||||||
|
|
||||||
|
@ -154,8 +147,7 @@ void Sapphire::Network::GameConnection::eventHandlerOutsideRange( FrameworkPtr p
|
||||||
|
|
||||||
std::string eventName = "onOutsideRange";
|
std::string eventName = "onOutsideRange";
|
||||||
std::string objName = pEventMgr->getEventName( eventId );
|
std::string objName = pEventMgr->getEventName( eventId );
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) +
|
player.sendDebug( "Calling: {0}.{1} - {2} p1: {3}", objName, eventName, eventId, param1 );
|
||||||
" p1: " + std::to_string( param1 ) );
|
|
||||||
|
|
||||||
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
||||||
|
|
||||||
|
@ -181,7 +173,7 @@ void Sapphire::Network::GameConnection::eventHandlerEnterTerritory( FrameworkPtr
|
||||||
|
|
||||||
std::string objName = pEventMgr->getEventName( eventId );
|
std::string objName = pEventMgr->getEventName( eventId );
|
||||||
|
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) );
|
player.sendDebug( "Calling: {0}.{1} - {2}", objName, eventName, eventId );
|
||||||
|
|
||||||
if( auto instance = player.getCurrentInstance() )
|
if( auto instance = player.getCurrentInstance() )
|
||||||
{
|
{
|
||||||
|
@ -213,13 +205,8 @@ void Sapphire::Network::GameConnection::eventHandlerReturn( FrameworkPtr pFw,
|
||||||
|
|
||||||
std::string eventName = pEventMgr->getEventName( eventId );
|
std::string eventName = pEventMgr->getEventName( eventId );
|
||||||
|
|
||||||
player.sendDebug( "eventId: " +
|
player.sendDebug( "eventId: {0} ({0:08X}) scene: {1}, p1: {2}, p2: {3}, p3: {4}",
|
||||||
std::to_string( eventId ) +
|
eventId, scene, param1, param2, param3 );
|
||||||
" ( 0x" + Util::intToHexString( static_cast< uint64_t >( eventId & 0xFFFFFFF ), 8 ) + " ) " +
|
|
||||||
" scene: " + std::to_string( scene ) +
|
|
||||||
" p1: " + std::to_string( param1 ) +
|
|
||||||
" p2: " + std::to_string( param2 ) +
|
|
||||||
" p3: " + std::to_string( param3 ) );
|
|
||||||
|
|
||||||
auto pEvent = player.getEvent( eventId );
|
auto pEvent = player.getEvent( eventId );
|
||||||
if( pEvent )
|
if( pEvent )
|
||||||
|
@ -282,11 +269,9 @@ void Sapphire::Network::GameConnection::eventHandlerShop( FrameworkPtr pFw,
|
||||||
std::string eventName = "onOpen";
|
std::string eventName = "onOpen";
|
||||||
std::string objName = pEventMgr->getEventName( eventId );
|
std::string objName = pEventMgr->getEventName( eventId );
|
||||||
|
|
||||||
player.sendDebug( "EventId: " +
|
player.sendDebug( "EventId: {0} ({0:08X}", eventId );
|
||||||
std::to_string( eventId ) +
|
|
||||||
" (0x" + Util::intToHexString( static_cast< uint64_t >( eventId & 0xFFFFFFF ), 8 ) + ")" );
|
|
||||||
|
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.sendDebug( "Calling: {0}.{1}", objName, eventName );
|
||||||
player.eventStart( player.getId(), eventId, Event::EventHandler::UI, 0, packet.data().param );
|
player.eventStart( player.getId(), eventId, Event::EventHandler::UI, 0, packet.data().param );
|
||||||
|
|
||||||
pScriptMgr->onTalk( player, player.getId(), eventId );
|
pScriptMgr->onTalk( player, player.getId(), eventId );
|
||||||
|
|
|
@ -101,10 +101,9 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
||||||
const auto param4 = packet.data().param4;
|
const auto param4 = packet.data().param4;
|
||||||
const auto target = packet.data().target;
|
const auto target = packet.data().target;
|
||||||
|
|
||||||
Logger::debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
Logger::info( "{0} used GM1 commandId: {1}, params: {2}, {3}, {4}, {5}, target: {6}",
|
||||||
", params: " + std::to_string( param1 ) + ", " +
|
player.getName(), commandId,
|
||||||
std::to_string( param2 ) + ", " + std::to_string( param3 ) + ", " + std::to_string( param4 ) +
|
param1, param2, param3, param4, target );
|
||||||
", target: " + std::to_string( target ) );
|
|
||||||
|
|
||||||
Sapphire::Entity::ActorPtr targetActor;
|
Sapphire::Entity::ActorPtr targetActor;
|
||||||
|
|
||||||
|
@ -440,7 +439,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
||||||
auto pTeriMgr = pFw->get< TerritoryMgr >();
|
auto pTeriMgr = pFw->get< TerritoryMgr >();
|
||||||
if( auto instance = pTeriMgr->getInstanceZonePtr( param1 ) )
|
if( auto instance = pTeriMgr->getInstanceZonePtr( param1 ) )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Found instance: " + instance->getName() + ", id: " + std::to_string( param1 ) );
|
player.sendDebug( "Found instance: {0}, id#{1}", instance->getName(), param1 );
|
||||||
|
|
||||||
// if the zone is an instanceContent instance, make sure the player is actually bound to it
|
// if the zone is an instanceContent instance, make sure the player is actually bound to it
|
||||||
auto pInstance = instance->getAsInstanceContent();
|
auto pInstance = instance->getAsInstanceContent();
|
||||||
|
@ -575,10 +574,8 @@ void Sapphire::Network::GameConnection::gm2Handler( FrameworkPtr pFw,
|
||||||
const auto param4 = packet.data().param4;
|
const auto param4 = packet.data().param4;
|
||||||
const auto target = std::string( packet.data().target );
|
const auto target = std::string( packet.data().target );
|
||||||
|
|
||||||
Logger::debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) +
|
Logger::debug( "{0} used GM2 commandId: {1}, params: {2}, {3}, {4}, {5}, target: {6}",
|
||||||
", params: " + std::to_string( param1 ) + ", " +
|
player.getName(), commandId, param1, param2, param3, param4, target );
|
||||||
std::to_string( param2 ) + ", " + std::to_string( param3 ) + ", " + std::to_string( param4 ) +
|
|
||||||
", target: " + target );
|
|
||||||
|
|
||||||
auto targetSession = pServerZone->getSession( target );
|
auto targetSession = pServerZone->getSession( target );
|
||||||
Sapphire::Entity::CharaPtr targetActor;
|
Sapphire::Entity::CharaPtr targetActor;
|
||||||
|
|
|
@ -42,7 +42,7 @@ void Sapphire::Network::GameConnection::inventoryModifyHandler( FrameworkPtr pFw
|
||||||
ackPacket->data().type = 7;
|
ackPacket->data().type = 7;
|
||||||
player.queuePacket( ackPacket );
|
player.queuePacket( ackPacket );
|
||||||
|
|
||||||
Logger::debug( "InventoryAction: " + std::to_string( action ) );
|
Logger::debug( "InventoryAction: {0}", action );
|
||||||
|
|
||||||
// TODO: other inventory operations need to be implemented
|
// TODO: other inventory operations need to be implemented
|
||||||
switch( action )
|
switch( action )
|
||||||
|
|
|
@ -117,7 +117,7 @@ void Sapphire::Network::GameConnection::reqExamineSearchCommentHandler( Framewor
|
||||||
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x10 ] );
|
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x10 ] );
|
||||||
auto pSession = pFw->get< World::ServerMgr >()->getSession( targetId );
|
auto pSession = pFw->get< World::ServerMgr >()->getSession( targetId );
|
||||||
|
|
||||||
Logger::debug( std::to_string( targetId ) );
|
Logger::debug( "reqExamineSearchCommentHandler: {0}", targetId );
|
||||||
|
|
||||||
if( pSession )
|
if( pSession )
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ void Sapphire::Network::GameConnection::reqExamineFcInfo( FrameworkPtr pFw,
|
||||||
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x18 ] );
|
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x18 ] );
|
||||||
auto pSession = pFw->get< World::ServerMgr >()->getSession( targetId );
|
auto pSession = pFw->get< World::ServerMgr >()->getSession( targetId );
|
||||||
|
|
||||||
Logger::debug( std::to_string( targetId ) );
|
Logger::debug( "reqExamineFcInfo: {0}", targetId );
|
||||||
|
|
||||||
if( pSession )
|
if( pSession )
|
||||||
{
|
{
|
||||||
|
@ -314,7 +314,7 @@ Sapphire::Network::GameConnection::reqEquipDisplayFlagsHandler( FrameworkPtr pFw
|
||||||
{
|
{
|
||||||
player.setEquipDisplayFlags( inPacket.data[ 0x10 ] );
|
player.setEquipDisplayFlags( inPacket.data[ 0x10 ] );
|
||||||
|
|
||||||
player.sendDebug( "EquipDisplayFlag CHANGE: " + std::to_string( player.getEquipDisplayFlags() ) );
|
player.sendDebug( "EquipDisplayFlag CHANGE: {0}", player.getEquipDisplayFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Network::GameConnection::zoneLineHandler( FrameworkPtr pFw,
|
void Sapphire::Network::GameConnection::zoneLineHandler( FrameworkPtr pFw,
|
||||||
|
@ -326,7 +326,7 @@ void Sapphire::Network::GameConnection::zoneLineHandler( FrameworkPtr pFw,
|
||||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcZoneLineHandler >( inPacket );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcZoneLineHandler >( inPacket );
|
||||||
const auto zoneLineId = packet.data().zoneLineId;
|
const auto zoneLineId = packet.data().zoneLineId;
|
||||||
|
|
||||||
player.sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
|
player.sendDebug( "Walking ZoneLine#{0}", zoneLineId );
|
||||||
|
|
||||||
auto pZone = player.getCurrentZone();
|
auto pZone = player.getCurrentZone();
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ void Sapphire::Network::GameConnection::zoneLineHandler( FrameworkPtr pFw,
|
||||||
|
|
||||||
if( pLine != nullptr )
|
if( pLine != nullptr )
|
||||||
{
|
{
|
||||||
player.sendDebug( "ZoneLine " + std::to_string( zoneLineId ) + " found." );
|
player.sendDebug( "ZoneLine #{0} found.", zoneLineId );
|
||||||
targetPos = pLine->getTargetPosition();
|
targetPos = pLine->getTargetPosition();
|
||||||
targetZone = pLine->getTargetZoneId();
|
targetZone = pLine->getTargetZoneId();
|
||||||
rotation = pLine->getTargetRotation();
|
rotation = pLine->getTargetRotation();
|
||||||
|
@ -379,7 +379,7 @@ void Sapphire::Network::GameConnection::discoveryHandler( FrameworkPtr pFw,
|
||||||
|
|
||||||
if( !pQR->next() )
|
if( !pQR->next() )
|
||||||
{
|
{
|
||||||
player.sendDebug( "Discovery ref pos ID: " + std::to_string( positionRef ) + " not found. " );
|
player.sendDebug( "Discovery ref pos id#{0} not found!", positionRef );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ void Sapphire::Network::GameConnection::discoveryHandler( FrameworkPtr pFw,
|
||||||
discoveryPacket->data().map_part_id = pQR->getUInt( 3 );
|
discoveryPacket->data().map_part_id = pQR->getUInt( 3 );
|
||||||
|
|
||||||
player.queuePacket( discoveryPacket );
|
player.queuePacket( discoveryPacket );
|
||||||
player.sendDebug( "Discovery ref pos ID: " + std::to_string( positionRef ) );
|
player.sendDebug( "Discovery ref pos id#{0}", positionRef );
|
||||||
|
|
||||||
player.discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
player.discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Sapphire::Scripting::ScriptInfo* Sapphire::Scripting::ScriptLoader::loadModule(
|
||||||
|
|
||||||
if( isModuleLoaded( f.stem().string() ) )
|
if( isModuleLoaded( f.stem().string() ) )
|
||||||
{
|
{
|
||||||
Logger::error( "Unable to load module '" + f.stem().string() + "' as it is already loaded" );
|
Logger::error( "Unable to load module '{0}' as it is already loaded", f.stem().string() );
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ Sapphire::Scripting::ScriptInfo* Sapphire::Scripting::ScriptLoader::loadModule(
|
||||||
}
|
}
|
||||||
catch( const fs::filesystem_error& err )
|
catch( const fs::filesystem_error& err )
|
||||||
{
|
{
|
||||||
Logger::error( "Error copying file to cache: " + err.code().message() );
|
Logger::error( "Error copying file to cache: {0}", err.code().message() );
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -77,12 +77,12 @@ Sapphire::Scripting::ScriptInfo* Sapphire::Scripting::ScriptLoader::loadModule(
|
||||||
|
|
||||||
if( !handle )
|
if( !handle )
|
||||||
{
|
{
|
||||||
Logger::error( "Failed to load module from: " + path );
|
Logger::error( "Failed to load module from: {0}", path );
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::debug( "Loaded module '" + f.filename().string() );
|
Logger::debug( "Loaded module: {0}", f.filename().string() );
|
||||||
|
|
||||||
auto info = new ScriptInfo;
|
auto info = new ScriptInfo;
|
||||||
info->handle = handle;
|
info->handle = handle;
|
||||||
|
@ -140,7 +140,7 @@ bool Sapphire::Scripting::ScriptLoader::unloadScript( ModuleHandle handle )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::error( "failed to unload module: " + info->library_name );
|
Logger::error( "failed to unload module: {0}", info->library_name );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,7 @@ bool Sapphire::Scripting::ScriptMgr::init()
|
||||||
|
|
||||||
if( !status )
|
if( !status )
|
||||||
{
|
{
|
||||||
Logger::error( std::string( __func__ ) +
|
Logger::error( "ScriptMgr: failed to load scripts, the server will not function correctly without scripts loaded." );
|
||||||
": failed to load scripts, the server will not function correctly without scripts loaded." );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +72,7 @@ bool Sapphire::Scripting::ScriptMgr::init()
|
||||||
scriptsLoaded++;
|
scriptsLoaded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info(
|
Logger::info( "ScriptMgr: Loaded {0}/{1} modules", scriptsLoaded, scriptsFound );
|
||||||
"ScriptMgr: Loaded " + std::to_string( scriptsLoaded ) + "/" + std::to_string( scriptsFound ) + " modules" );
|
|
||||||
|
|
||||||
watchDirectories();
|
watchDirectories();
|
||||||
|
|
||||||
|
@ -104,13 +102,13 @@ void Sapphire::Scripting::ScriptMgr::watchDirectories()
|
||||||
{
|
{
|
||||||
if( m_nativeScriptMgr->isModuleLoaded( path.stem().string() ) )
|
if( m_nativeScriptMgr->isModuleLoaded( path.stem().string() ) )
|
||||||
{
|
{
|
||||||
Logger::debug( "Reloading changed script: " + path.stem().string() );
|
Logger::debug( "Reloading changed script: {0}", path.stem().string() );
|
||||||
|
|
||||||
m_nativeScriptMgr->queueScriptReload( path.stem().string() );
|
m_nativeScriptMgr->queueScriptReload( path.stem().string() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::debug( "Loading new script: " + path.stem().string() );
|
Logger::debug( "Loading new script: {0}", path.stem().string() );
|
||||||
|
|
||||||
m_nativeScriptMgr->loadScript( path.string() );
|
m_nativeScriptMgr->loadScript( path.string() );
|
||||||
}
|
}
|
||||||
|
@ -121,7 +119,7 @@ void Sapphire::Scripting::ScriptMgr::watchDirectories()
|
||||||
bool Sapphire::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set< std::string >& files,
|
bool Sapphire::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set< std::string >& files,
|
||||||
const std::string& ext )
|
const std::string& ext )
|
||||||
{
|
{
|
||||||
Logger::info( "ScriptMgr: loading scripts from " + dirname );
|
Logger::info( "ScriptMgr: loading scripts from: {0}", dirname );
|
||||||
|
|
||||||
if( !fs::exists( dirname ) )
|
if( !fs::exists( dirname ) )
|
||||||
{
|
{
|
||||||
|
@ -263,7 +261,7 @@ bool Sapphire::Scripting::ScriptMgr::onEventItem( Entity::Player& player, uint32
|
||||||
|
|
||||||
std::string eventName = "onEventItem";
|
std::string eventName = "onEventItem";
|
||||||
std::string objName = pEventMgr->getEventName( eventId );
|
std::string objName = pEventMgr->getEventName( eventId );
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName + " - " + std::to_string( eventId ) );
|
player.sendDebug( "Calling: {0}.{1} - {2}", objName, eventName, eventId );
|
||||||
|
|
||||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||||
if( script )
|
if( script )
|
||||||
|
@ -297,7 +295,7 @@ bool Sapphire::Scripting::ScriptMgr::onMobKill( Entity::Player& player, uint16_t
|
||||||
{
|
{
|
||||||
std::string objName = pEventMgr->getEventName( 0x00010000 | questId );
|
std::string objName = pEventMgr->getEventName( 0x00010000 | questId );
|
||||||
|
|
||||||
player.sendDebug( "Calling: " + objName + "." + eventName );
|
player.sendDebug( "Calling: {0}.{1}", objName, eventName );
|
||||||
|
|
||||||
script->onNpcKill( nameId, player );
|
script->onNpcKill( nameId, player );
|
||||||
}
|
}
|
||||||
|
@ -322,7 +320,7 @@ bool Sapphire::Scripting::ScriptMgr::onStatusReceive( Entity::CharaPtr pActor, u
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
if( pActor->isPlayer() )
|
if( pActor->isPlayer() )
|
||||||
pActor->getAsPlayer()->sendDebug( "Calling status receive for statusid: " + std::to_string( effectId ) );
|
pActor->getAsPlayer()->sendDebug( "Calling status receive for statusid#{0}", effectId );
|
||||||
|
|
||||||
script->onApply( *pActor );
|
script->onApply( *pActor );
|
||||||
return true;
|
return true;
|
||||||
|
@ -337,7 +335,7 @@ bool Sapphire::Scripting::ScriptMgr::onStatusTick( Entity::CharaPtr pChara, Sapp
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
if( pChara->isPlayer() )
|
if( pChara->isPlayer() )
|
||||||
pChara->getAsPlayer()->sendDebug( "Calling status tick for statusid: " + std::to_string( effect.getId() ) );
|
pChara->getAsPlayer()->sendDebug( "Calling status tick for statusid#{0}", effect.getId() );
|
||||||
|
|
||||||
script->onTick( *pChara );
|
script->onTick( *pChara );
|
||||||
return true;
|
return true;
|
||||||
|
@ -352,7 +350,7 @@ bool Sapphire::Scripting::ScriptMgr::onStatusTimeOut( Entity::CharaPtr pChara, u
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
if( pChara->isPlayer() )
|
if( pChara->isPlayer() )
|
||||||
pChara->getAsPlayer()->sendDebug( "Calling status timeout for statusid: " + std::to_string( effectId ) );
|
pChara->getAsPlayer()->sendDebug( "Calling status timeout for statusid#{0}", effectId );
|
||||||
|
|
||||||
script->onExpire( *pChara );
|
script->onExpire( *pChara );
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -65,11 +65,11 @@ bool Sapphire::World::ServerMgr::loadSettings( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
auto pConfig = framework()->get< Sapphire::ConfigMgr >();
|
auto pConfig = framework()->get< Sapphire::ConfigMgr >();
|
||||||
|
|
||||||
Logger::info( "Loading config " + m_configName );
|
Logger::info( "Loading config {0}", m_configName );
|
||||||
|
|
||||||
if( !pConfig->loadConfig( m_configName ) )
|
if( !pConfig->loadConfig( m_configName ) )
|
||||||
{
|
{
|
||||||
Logger::fatal( "Error loading config " + m_configName );
|
Logger::fatal( "Error loading config {0}", m_configName );
|
||||||
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ void Sapphire::World::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
if( !pExdData->init( dataPath ) )
|
if( !pExdData->init( dataPath ) )
|
||||||
{
|
{
|
||||||
Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
|
Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
|
||||||
Logger::fatal( "DataPath: " + dataPath );
|
Logger::fatal( "DataPath: {0}", dataPath );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
framework()->set< Data::ExdDataGenerated >( pExdData );
|
framework()->set< Data::ExdDataGenerated >( pExdData );
|
||||||
|
@ -192,7 +192,7 @@ void Sapphire::World::ServerMgr::run( int32_t argc, char* argv[] )
|
||||||
framework()->set< Manager::EventMgr >( pEventMgr );
|
framework()->set< Manager::EventMgr >( pEventMgr );
|
||||||
framework()->set< Manager::ItemMgr >( pItemMgr );
|
framework()->set< Manager::ItemMgr >( pItemMgr );
|
||||||
|
|
||||||
Logger::info( "World server running on " + m_ip + ":" + std::to_string( m_port ) );
|
Logger::info( "World server running on {0}:{1}", m_ip, m_port );
|
||||||
|
|
||||||
mainLoop();
|
mainLoop();
|
||||||
|
|
||||||
|
@ -217,8 +217,8 @@ void Sapphire::World::ServerMgr::printBanner() const
|
||||||
{
|
{
|
||||||
Logger::info( "===========================================================" );
|
Logger::info( "===========================================================" );
|
||||||
Logger::info( "Sapphire Server Project " );
|
Logger::info( "Sapphire Server Project " );
|
||||||
Logger::info( "Version: " + Version::VERSION );
|
Logger::info( "Version: {0}", Version::VERSION );
|
||||||
Logger::info( "Git Hash: " + Version::GIT_HASH );
|
Logger::info( "Git Hash: {0}", Version::GIT_HASH );
|
||||||
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
|
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
|
||||||
Logger::info( "===========================================================" );
|
Logger::info( "===========================================================" );
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ void Sapphire::World::ServerMgr::mainLoop()
|
||||||
it->second->close();
|
it->second->close();
|
||||||
// if( it->second.unique() )
|
// if( it->second.unique() )
|
||||||
{
|
{
|
||||||
Logger::info( "[" + std::to_string( it->second->getId() ) + "] Session removal" );
|
Logger::info( "[{0}] Session removal", it->second->getId() );
|
||||||
it = m_sessionMapById.erase( it );
|
it = m_sessionMapById.erase( it );
|
||||||
removeSession( pPlayer->getName() );
|
removeSession( pPlayer->getName() );
|
||||||
continue;
|
continue;
|
||||||
|
@ -283,7 +283,7 @@ void Sapphire::World::ServerMgr::mainLoop()
|
||||||
// remove sessions that simply timed out
|
// remove sessions that simply timed out
|
||||||
if( diff > 20 )
|
if( diff > 20 )
|
||||||
{
|
{
|
||||||
Logger::info( "[" + std::to_string( it->second->getId() ) + "] Session time out" );
|
Logger::info( "[{0}] Session time out", it->second->getId() );
|
||||||
|
|
||||||
it->second->close();
|
it->second->close();
|
||||||
// if( it->second.unique() )
|
// if( it->second.unique() )
|
||||||
|
@ -312,18 +312,18 @@ bool Sapphire::World::ServerMgr::createSession( uint32_t sessionId )
|
||||||
|
|
||||||
if( it != m_sessionMapById.end() )
|
if( it != m_sessionMapById.end() )
|
||||||
{
|
{
|
||||||
Logger::error( "[" + session_id_str + "] Error creating session" );
|
Logger::error( "[{0}] Error creating session", session_id_str );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info( "[" + session_id_str + "] Creating new session" );
|
Logger::info( "[{0}] Creating new session", session_id_str );
|
||||||
|
|
||||||
std::shared_ptr< Session > newSession( new Session( sessionId, framework() ) );
|
std::shared_ptr< Session > newSession( new Session( sessionId, framework() ) );
|
||||||
m_sessionMapById[ sessionId ] = newSession;
|
m_sessionMapById[ sessionId ] = newSession;
|
||||||
|
|
||||||
if( !newSession->loadPlayer() )
|
if( !newSession->loadPlayer() )
|
||||||
{
|
{
|
||||||
Logger::error( "[" + session_id_str + "] Error loading player " + session_id_str );
|
Logger::error( "[{0}] Error loading player {0}", session_id_str );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ void Sapphire::World::ServerMgr::loadBNpcTemplates()
|
||||||
m_bNpcTemplateMap[ name ] = bnpcTemplate;
|
m_bNpcTemplateMap[ name ] = bnpcTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::debug( "BNpc Templates loaded: " + std::to_string( m_bNpcTemplateMap.size() ) );
|
Logger::debug( "BNpc Templates loaded: {0}", m_bNpcTemplateMap.size() );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,10 +151,10 @@ void Sapphire::World::Session::startReplay( const std::string& path )
|
||||||
m_replayCache.push_back( std::tuple< uint64_t, std::string >(
|
m_replayCache.push_back( std::tuple< uint64_t, std::string >(
|
||||||
Util::getTimeMs() + ( std::get< 0 >( set ) - startTime ), std::get< 1 >( set ) ) );
|
Util::getTimeMs() + ( std::get< 0 >( set ) - startTime ), std::get< 1 >( set ) ) );
|
||||||
|
|
||||||
Logger::info( "Registering " + std::get< 1 >( set ) + " for " + std::to_string( std::get< 0 >( set ) - startTime ) );
|
Logger::info( "Registering {0} for {1}", std::get< 1 >( set ), std::get< 0 >( set ) - startTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayer()->sendDebug( "Registered " + std::to_string( m_replayCache.size() ) + " sets for replay" );
|
getPlayer()->sendDebug( "Registered {0} sets for replay" ), m_replayCache.size();
|
||||||
m_isReplaying = true;
|
m_isReplaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,9 +54,9 @@ bool Sapphire::World::Territory::Housing::HousingInteriorTerritory::init()
|
||||||
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZoneIn( Entity::Player& player )
|
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZoneIn( Entity::Player& player )
|
||||||
{
|
{
|
||||||
auto pHousingMgr = m_pFw->get< HousingMgr >();
|
auto pHousingMgr = m_pFw->get< HousingMgr >();
|
||||||
Logger::debug(
|
|
||||||
"HousingInteriorTerritory::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) +
|
Logger::debug( "HousingInteriorTerritory::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}",
|
||||||
", Entity#" + std::to_string( player.getId() ) );
|
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||||
|
|
||||||
auto indoorInitPacket = makeZonePacket< Server::FFXIVIpcHousingIndoorInitialize >( player.getId() );
|
auto indoorInitPacket = makeZonePacket< Server::FFXIVIpcHousingIndoorInitialize >( player.getId() );
|
||||||
indoorInitPacket->data().u1 = 0;
|
indoorInitPacket->data().u1 = 0;
|
||||||
|
|
|
@ -121,7 +121,7 @@ bool Sapphire::HousingZone::init()
|
||||||
auto landSetCache = landCache.find( m_landSetId );
|
auto landSetCache = landCache.find( m_landSetId );
|
||||||
if( landSetCache == landCache.end() )
|
if( landSetCache == landCache.end() )
|
||||||
{
|
{
|
||||||
Logger::fatal( "LandSet " + std::to_string( m_landSetId ) + " is missing from the land cache." );
|
Logger::fatal( "LandSet {0} is missing from the land cache.", m_landSetId );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,9 +157,8 @@ Sapphire::HousingZone::~HousingZone() = default;
|
||||||
|
|
||||||
void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
|
||||||
{
|
{
|
||||||
Logger::debug(
|
Logger::debug( "HousingZone::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}",
|
||||||
"HousingZone::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) +
|
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||||
", Entity#" + std::to_string( player.getId() ) );
|
|
||||||
|
|
||||||
auto isInSubdivision = isPlayerSubInstance( player ) ? true : false;
|
auto isInSubdivision = isPlayerSubInstance( player ) ? true : false;
|
||||||
|
|
||||||
|
|
|
@ -72,9 +72,8 @@ Sapphire::Data::ExdDataGenerated::InstanceContentPtr Sapphire::InstanceContent::
|
||||||
|
|
||||||
void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
|
void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
|
||||||
{
|
{
|
||||||
Logger::debug( "InstanceContent::onPlayerZoneIn: Zone#" + std::to_string( getGuId() ) + "|"
|
Logger::debug( "InstanceContent::onPlayerZoneIn: Zone#{0}|{1}, Entity#{2}",
|
||||||
+ std::to_string( getInstanceContentId() ) +
|
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||||
+", Entity#" + std::to_string( player.getId() ) );
|
|
||||||
|
|
||||||
// mark player as "bound by duty"
|
// mark player as "bound by duty"
|
||||||
player.setStateFlag( PlayerStateFlag::BoundByDuty );
|
player.setStateFlag( PlayerStateFlag::BoundByDuty );
|
||||||
|
@ -88,9 +87,8 @@ void Sapphire::InstanceContent::onPlayerZoneIn( Entity::Player& player )
|
||||||
|
|
||||||
void Sapphire::InstanceContent::onLeaveTerritory( Entity::Player& player )
|
void Sapphire::InstanceContent::onLeaveTerritory( Entity::Player& player )
|
||||||
{
|
{
|
||||||
Logger::debug( "InstanceContent::onLeaveTerritory: Zone#" + std::to_string( getGuId() ) + "|"
|
Logger::debug( "InstanceContent::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}",
|
||||||
+ std::to_string( getInstanceContentId() ) +
|
getGuId(), getTerritoryTypeId(), player.getId() );
|
||||||
+", Entity#" + std::to_string( player.getId() ) );
|
|
||||||
sendDirectorClear( player );
|
sendDirectorClear( player );
|
||||||
|
|
||||||
player.setDirectorInitialized( false );
|
player.setDirectorInitialized( false );
|
||||||
|
@ -377,8 +375,8 @@ void Sapphire::InstanceContent::onTalk( Sapphire::Entity::Player& player, uint32
|
||||||
if( auto onTalk = it->second->getOnTalkHandler() )
|
if( auto onTalk = it->second->getOnTalkHandler() )
|
||||||
onTalk( player, it->second, getAsInstanceContent(), actorId );
|
onTalk( player, it->second, getAsInstanceContent(), actorId );
|
||||||
else
|
else
|
||||||
player.sendDebug( "No onTalk handler found for interactable eobj with EObjID: " +
|
player.sendDebug( "No onTalk handler found for interactable eobj with EObjID#{0}, eventId#{1} ",
|
||||||
std::to_string( it->second->getObjectId() ) + ", eventId: " + std::to_string( eventId ) );
|
it->second->getObjectId(), eventId );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -679,16 +679,12 @@ void Sapphire::Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell )
|
||||||
|
|
||||||
void Sapphire::Zone::onPlayerZoneIn( Entity::Player& player )
|
void Sapphire::Zone::onPlayerZoneIn( Entity::Player& player )
|
||||||
{
|
{
|
||||||
Logger::debug(
|
Logger::debug( "Zone::onEnterTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
|
||||||
"Zone::onEnterTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) +
|
|
||||||
+ ", Entity#" + std::to_string( player.getId() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Zone::onLeaveTerritory( Entity::Player& player )
|
void Sapphire::Zone::onLeaveTerritory( Entity::Player& player )
|
||||||
{
|
{
|
||||||
Logger::debug(
|
Logger::debug( "Zone::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() );
|
||||||
"Zone::onLeaveTerritory: Zone#" + std::to_string( getGuId() ) + "|" + std::to_string( getTerritoryTypeId() ) +
|
|
||||||
+ ", Entity#" + std::to_string( player.getId() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Zone::onUpdate( uint32_t currTime )
|
void Sapphire::Zone::onUpdate( uint32_t currTime )
|
||||||
|
@ -763,10 +759,9 @@ Sapphire::Data::TerritoryTypePtr Sapphire::Zone::getTerritoryTypeInfo() const
|
||||||
bool Sapphire::Zone::loadSpawnGroups()
|
bool Sapphire::Zone::loadSpawnGroups()
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT id, bNpcTemplateId, "
|
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_SPAWNGROUPS );
|
||||||
"level, maxHp "
|
stmt->setUInt( 1, getTerritoryTypeId() );
|
||||||
"FROM spawnGroup "
|
auto res = pDb->query( stmt );
|
||||||
"WHERE territoryTypeId = " + std::to_string( getTerritoryTypeId() ) + ";" );
|
|
||||||
|
|
||||||
while( res->next() )
|
while( res->next() )
|
||||||
{
|
{
|
||||||
|
@ -777,10 +772,8 @@ bool Sapphire::Zone::loadSpawnGroups()
|
||||||
|
|
||||||
//Entity::SpawnGroup group;
|
//Entity::SpawnGroup group;
|
||||||
|
|
||||||
Logger::debug( std::to_string( id ) + " " +
|
|
||||||
std::to_string( templateId ) + " " +
|
Logger::debug( "id: {0}, template: {1}, level: {2}, maxHp: {3}", id, templateId, level, maxHp );
|
||||||
std::to_string( level ) + " " +
|
|
||||||
std::to_string( maxHp ) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue