1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-25 11:07:45 +00:00

more style

This commit is contained in:
goaaats 2017-12-04 23:21:15 +01:00
parent 1b09369505
commit c8c4baefb1
2 changed files with 53 additions and 53 deletions

View file

@ -64,7 +64,7 @@ Core::DebugCommandHandler::~DebugCommandHandler()
// add a command set to the register map // add a command set to the register map
void Core::DebugCommandHandler::registerCommand( const std::string& n, Core::DebugCommand::pFunc functionPtr, void Core::DebugCommandHandler::registerCommand( const std::string& n, Core::DebugCommand::pFunc functionPtr,
const std::string& hText, uint8_t uLevel ) const std::string& hText, uint8_t uLevel )
{ {
m_commandMap[std::string( n )] = boost::make_shared<DebugCommand>( n, functionPtr, hText, uLevel ); m_commandMap[std::string( n )] = boost::make_shared<DebugCommand>( n, functionPtr, hText, uLevel );
} }
@ -118,7 +118,7 @@ void Core::DebugCommandHandler::execCommand( char * data, Core::Entity::PlayerPt
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::PlayerPtr pPlayer, void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::PlayerPtr pPlayer,
boost::shared_ptr<Core::DebugCommand> command ) boost::shared_ptr<Core::DebugCommand> command )
{ {
g_scriptMgr.reload(); g_scriptMgr.reload();
pPlayer->sendDebug( "Scripts reloaded." ); pPlayer->sendDebug( "Scripts reloaded." );
@ -127,11 +127,11 @@ void Core::DebugCommandHandler::scriptReload( char * data, Core::Entity::PlayerP
void Core::DebugCommandHandler::help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command ) void Core::DebugCommandHandler::help( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
{ {
pPlayer->sendDebug( "Registered debug commands:" ); pPlayer->sendDebug( "Registered debug commands:" );
for ( auto cmd : m_commandMap ) for( auto cmd : m_commandMap )
{ {
if ( pPlayer->getGmRank( ) >= cmd.second->m_gmLevel ) if( pPlayer->getGmRank() >= cmd.second->m_gmLevel )
{ {
pPlayer->sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText( ) ); pPlayer->sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText() );
} }
} }
} }
@ -157,7 +157,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
params = std::string( data + command->getName().length() + 1 + pos + 1 ); params = std::string( data + command->getName().length() + 1 + pos + 1 );
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
"subCommand " + subCommand + " params: " + params ); "subCommand " + subCommand + " params: " + params );
if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) )
@ -176,12 +176,12 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
if( subCommand == "pos" ) if( subCommand == "pos" )
pPlayer->setPosition( static_cast< float >( posX ), pPlayer->setPosition( static_cast< float >( posX ),
static_cast< float >( posY ), static_cast< float >( posY ),
static_cast< float >( posZ ) ); static_cast< float >( posZ ) );
else else
pPlayer->setPosition( pPlayer->getPos().x + static_cast< float >( posX ), pPlayer->setPosition( pPlayer->getPos().x + static_cast< float >( posX ),
pPlayer->getPos().y + static_cast< float >( posY ), pPlayer->getPos().y + static_cast< float >( posY ),
pPlayer->getPos().z + static_cast< float >( posZ ) ); pPlayer->getPos().z + static_cast< float >( posZ ) );
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos > Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
setActorPosPacket( pPlayer->getId() ); setActorPosPacket( pPlayer->getId() );
@ -236,26 +236,26 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
} }
else if( subCommand == "classjob" ) else if( subCommand == "classjob" )
{ {
int32_t id; int32_t id;
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
if( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) == 0 ) if( pPlayer->getLevelForClass( static_cast<Core::Common::ClassJob> ( id ) ) == 0 )
{ {
pPlayer->setLevelForClass( 1, static_cast<Core::Common::ClassJob> ( id ) ); pPlayer->setLevelForClass( 1, static_cast<Core::Common::ClassJob> ( id ) );
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) ); pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
} }
else else
pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) ); pPlayer->setClassJob( static_cast<Core::Common::ClassJob> ( id ) );
} }
else if ( subCommand == "cfpenalty" ) else if( subCommand == "cfpenalty" )
{ {
int32_t minutes; int32_t minutes;
sscanf( params.c_str(), "%d", &minutes ); sscanf( params.c_str(), "%d", &minutes );
pPlayer->setCFPenaltyMinutes( minutes ); pPlayer->setCFPenaltyMinutes( minutes );
} }
else if ( subCommand == "eorzeatime" ) else if( subCommand == "eorzeatime" )
{ {
uint64_t timestamp; uint64_t timestamp;
sscanf( params.c_str(), "%" SCNu64, &timestamp ); sscanf( params.c_str(), "%" SCNu64, &timestamp );
@ -263,7 +263,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->setEorzeaTimeOffset( timestamp ); pPlayer->setEorzeaTimeOffset( timestamp );
pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) ); pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) );
} }
else if ( subCommand == "model" ) else if( subCommand == "model" )
{ {
uint32_t slot; uint32_t slot;
uint32_t val; uint32_t val;
@ -273,7 +273,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->sendModel(); pPlayer->sendModel();
pPlayer->sendDebug( "Model updated" ); pPlayer->sendDebug( "Model updated" );
} }
else if ( subCommand == "mount" ) else if( subCommand == "mount" )
{ {
int32_t id; int32_t id;
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
@ -312,7 +312,7 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
params = std::string( data + command->getName().length() + 1 + pos + 1 ); params = std::string( data + command->getName().length() + 1 + pos + 1 );
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
"subCommand " + subCommand + " params: " + params ); "subCommand " + subCommand + " params: " + params );
if( subCommand == "status" ) if( subCommand == "status" )
@ -328,7 +328,7 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->addStatusEffect( effect ); pPlayer->addStatusEffect( effect );
} }
else if ( subCommand == "title" ) else if( subCommand == "title" )
{ {
uint32_t titleId; uint32_t titleId;
sscanf( params.c_str(), "%u", &titleId ); sscanf( params.c_str(), "%u", &titleId );
@ -397,14 +397,14 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye
pPlayer->queuePacket(controlPacket);*/ pPlayer->queuePacket(controlPacket);*/
} }
else if ( subCommand == "unlock" ) else if( subCommand == "unlock" )
{ {
int32_t id; int32_t id;
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
pPlayer->learnAction( id ); pPlayer->learnAction( id );
} }
else if ( subCommand == "enablecompanion" ) else if( subCommand == "enablecompanion" )
{ {
pPlayer->learnAction( 17 ); pPlayer->learnAction( 17 );
} }
@ -437,7 +437,7 @@ void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlaye
params = std::string( data + command->getName().length() + 1 + pos + 1 ); params = std::string( data + command->getName().length() + 1 + pos + 1 );
g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " +
"subCommand " + subCommand + " params: " + params ); "subCommand " + subCommand + " params: " + params );
if( subCommand == "pos" ) if( subCommand == "pos" )
@ -446,12 +446,12 @@ void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlaye
int16_t map_id = g_exdData.m_zoneInfoMap[pPlayer->getCurrentZone()->getId()].map_id; int16_t map_id = g_exdData.m_zoneInfoMap[pPlayer->getCurrentZone()->getId()].map_id;
pPlayer->sendNotice( "Pos:\n" + pPlayer->sendNotice( "Pos:\n" +
std::to_string( pPlayer->getPos().x ) + "\n" + std::to_string( pPlayer->getPos().x ) + "\n" +
std::to_string( pPlayer->getPos().y ) + "\n" + std::to_string( pPlayer->getPos().y ) + "\n" +
std::to_string( pPlayer->getPos().z ) + "\n" + std::to_string( pPlayer->getPos().z ) + "\n" +
std::to_string( pPlayer->getRotation() ) + "\nMapId: " + std::to_string( pPlayer->getRotation() ) + "\nMapId: " +
std::to_string( map_id ) + "\nZoneID: " + std::to_string( map_id ) + "\nZoneID: " +
std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" ); std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" );
} }
else else
{ {
@ -531,5 +531,5 @@ void Core::DebugCommandHandler::serverInfo( char * data, Core::Entity::PlayerPtr
void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command ) void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::PlayerPtr pPlayer, boost::shared_ptr< Core::DebugCommand > command )
{ {
pPlayer->unlock( ); pPlayer->unlock();
} }

View file

@ -141,7 +141,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) ); pPlayer->sendNotice( "Race for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
for ( auto actor : inRange ) for( auto actor : inRange )
{ {
targetPlayer->despawn( actor->getAsPlayer() ); targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() ); targetPlayer->spawn( actor->getAsPlayer() );
@ -154,7 +154,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) ); pPlayer->sendNotice( "Tribe for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetPlayer->getInRangeActors(); auto inRange = targetPlayer->getInRangeActors();
for ( auto actor : inRange ) for( auto actor : inRange )
{ {
targetPlayer->despawn( actor->getAsPlayer() ); targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() ); targetPlayer->spawn( actor->getAsPlayer() );
@ -167,7 +167,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) ); pPlayer->sendNotice( "Sex for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
targetPlayer->spawn( targetPlayer ); targetPlayer->spawn( targetPlayer );
auto inRange = targetActor->getInRangeActors(); auto inRange = targetActor->getInRangeActors();
for ( auto actor : inRange ) for( auto actor : inRange )
{ {
targetPlayer->despawn( actor->getAsPlayer() ); targetPlayer->despawn( actor->getAsPlayer() );
targetPlayer->spawn( actor->getAsPlayer() ); targetPlayer->spawn( actor->getAsPlayer() );
@ -189,7 +189,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
} }
case GmCommand::Call: case GmCommand::Call:
{ {
if ( targetPlayer->getZoneId() != pPlayer->getZoneId() ) if( targetPlayer->getZoneId() != pPlayer->getZoneId() )
targetPlayer->setZone( pPlayer->getZoneId() ); targetPlayer->setZone( pPlayer->getZoneId() );
targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z, targetPlayer->changePosition( pPlayer->getPos().x, pPlayer->getPos().y, pPlayer->getPos().z,
@ -268,7 +268,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
} }
case GmCommand::Inv: case GmCommand::Inv:
{ {
if ( targetActor->getInvincibilityType() == Common::InvincibilityType::InvincibilityRefill ) if( targetActor->getInvincibilityType() == Common::InvincibilityType::InvincibilityRefill )
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityNone ); targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityNone );
else else
targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityRefill ); targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityRefill );
@ -279,11 +279,11 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
} }
case GmCommand::Orchestrion: case GmCommand::Orchestrion:
{ {
if ( param1 == 1 ) if( param1 == 1 )
{ {
if ( param2 == 0 ) if( param2 == 0 )
{ {
for ( uint8_t i = 0; i < 255; i++ ) for( uint8_t i = 0; i < 255; i++ )
targetActor->getAsPlayer()->learnSong( i, 0 ); targetActor->getAsPlayer()->learnSong( i, 0 );
pPlayer->sendNotice( "All Songs for " + targetPlayer->getName() + pPlayer->sendNotice( "All Songs for " + targetPlayer->getName() +
@ -301,9 +301,9 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
} }
case GmCommand::Mount: case GmCommand::Mount:
{ {
if ( param2 == 0 ) if( param2 == 0 )
{ {
for (uint8_t i = 0; i < 255; i++) for( uint8_t i = 0; i < 255; i++ )
targetActor->getAsPlayer()->learnMount( i ); targetActor->getAsPlayer()->learnMount( i );
pPlayer->sendNotice( "All mounts for " + targetPlayer->getName() + pPlayer->sendNotice( "All mounts for " + targetPlayer->getName() +
@ -325,7 +325,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
param2 = 1; param2 = 1;
} }
if( ( param1 == 0xcccccccc ) ) if( param1 == 0xcccccccc )
{ {
pPlayer->sendUrgent( "Syntaxerror." ); pPlayer->sendUrgent( "Syntaxerror." );
return; return;
@ -345,7 +345,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
{ {
uint32_t gil = targetPlayer->getCurrency( 1 ); uint32_t gil = targetPlayer->getCurrency( 1 );
if ( gil < param1 ) if( gil < param1 )
{ {
pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" ); pPlayer->sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" );
} }
@ -400,11 +400,11 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
} }
case GmCommand::Aetheryte: case GmCommand::Aetheryte:
{ {
if ( param1 == 0 ) if( param1 == 0 )
{ {
if ( param2 == 0 ) if( param2 == 0 )
{ {
for ( uint8_t i = 0; i < 255; i++ ) for( uint8_t i = 0; i < 255; i++ )
targetActor->getAsPlayer()->registerAetheryte( i ); targetActor->getAsPlayer()->registerAetheryte( i );
pPlayer->sendNotice( "All Aetherytes for " + targetPlayer->getName() + pPlayer->sendNotice( "All Aetherytes for " + targetPlayer->getName() +
@ -423,7 +423,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
case GmCommand::Teri: case GmCommand::Teri:
{ {
auto zoneInfo = g_zoneMgr.getZone( param1 ); auto zoneInfo = g_zoneMgr.getZone( param1 );
if ( !zoneInfo ) if( !zoneInfo )
{ {
pPlayer->sendUrgent( "Invalid zone " + std::to_string( param1 ) ); pPlayer->sendUrgent( "Invalid zone " + std::to_string( param1 ) );
} }
@ -431,7 +431,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac
{ {
targetPlayer->setPosition( targetPlayer->getPos() ); targetPlayer->setPosition( targetPlayer->getPos() );
targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 ); targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 );
pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName( ) + ")" ); pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName() + ")" );
} }
break; break;
} }