1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 07:37:45 +00:00

Changed sendDebug to use fmt aswell

This commit is contained in:
Mordred 2019-01-05 12:32:10 +01:00
parent 3bbe8f352e
commit b0ab052bd4
17 changed files with 93 additions and 108 deletions

View file

@ -24,48 +24,48 @@ namespace Sapphire
static void error( const std::string& text ); static void error( const std::string& text );
template< typename... Args > template< typename... Args >
static void error( const std::string& fmt, const Args&... args ) static void error( const std::string& text, const Args&... args )
{ {
error( fmt::format( fmt, args... ) ); error( fmt::format( text, args... ) );
} }
static void warn( const std::string& text ); static void warn( const std::string& text );
template< typename... Args > template< typename... Args >
static void warn( const std::string& fmt, const Args&... args ) static void warn( const std::string& text, const Args&... args )
{ {
warn( fmt::format( fmt, args... ) ); warn( fmt::format( text, args... ) );
} }
static void info( const std::string& text ); static void info( const std::string& text );
template< typename... Args > template< typename... Args >
static void info( const std::string& fmt, const Args&... args ) static void info( const std::string& text, const Args&... args )
{ {
info( fmt::format( fmt, args... ) ); info( fmt::format( text, args... ) );
} }
static void debug( const std::string& text ); static void debug( const std::string& text );
template< typename... Args > template< typename... Args >
static void debug( const std::string& fmt, const Args&... args ) static void debug( const std::string& text, const Args&... args )
{ {
debug( fmt::format( fmt, args... ) ); debug( fmt::format( text, args... ) );
} }
static void fatal( const std::string& text ); static void fatal( const std::string& text );
template< typename... Args > template< typename... Args >
static void fatal( const std::string& fmt, const Args&... args ) static void fatal( const std::string& text, const Args&... args )
{ {
fatal( fmt::format( fmt, args... ) ); fatal( fmt::format( text, args... ) );
} }
static void trace( const std::string& text ); static void trace( const std::string& text );
template< typename... Args > template< typename... Args >
static void trace( const std::string& fmt, const Args&... args ) static void trace( const std::string& text, const Args&... args )
{ {
trace( fmt::format( fmt, args... ) ); trace( fmt::format( text, args... ) );
} }

View file

@ -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 );
} ); } );
} }
}; };

View file

@ -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() );
} }
} }
} }

View file

@ -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

View file

@ -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;

View file

@ -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() );
} }
} }
} }
@ -324,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 )
@ -679,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,
@ -716,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" )
{ {
@ -729,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" )
@ -749,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 );
} }
} }
@ -762,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 );
} }
} }
@ -801,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" )
{ {
@ -821,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" )
{ {
@ -831,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;
} }
@ -839,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" )
@ -857,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" )
{ {
@ -865,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" )
{ {

View file

@ -343,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;
} }
@ -353,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 );

View file

@ -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 );

View file

@ -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 );
} }

View file

@ -482,9 +482,8 @@ 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;
} }

View file

@ -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 );

View file

@ -427,7 +427,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();

View file

@ -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 ) );

View file

@ -261,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 )
@ -295,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 );
} }
@ -320,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;
@ -335,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;
@ -350,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;

View file

@ -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( "===========================================================" );
} }

View file

@ -154,7 +154,7 @@ void Sapphire::World::Session::startReplay( const std::string& path )
Logger::info( "Registering {0} for {1}", std::get< 1 >( set ), 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;
} }

View file

@ -375,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