From 9b096c72ff8c0734030a51df0445b63db7c80127 Mon Sep 17 00:00:00 2001 From: goaaats Date: Mon, 4 Dec 2017 16:53:37 +0100 Subject: [PATCH 1/7] * Add more commands/ability to unlock for mounts --- src/servers/Server_Common/Common.h | 2 ++ src/servers/Server_Zone/Actor/Player.cpp | 11 ++++++++++ src/servers/Server_Zone/Actor/Player.h | 2 ++ .../DebugCommand/DebugCommandHandler.cpp | 11 ++++++++++ .../Network/Handlers/GMCommandHandlers.cpp | 20 +++++++++++++++++++ 5 files changed, 46 insertions(+) diff --git a/src/servers/Server_Common/Common.h b/src/servers/Server_Common/Common.h index e16f5035..e6030611 100644 --- a/src/servers/Server_Common/Common.h +++ b/src/servers/Server_Common/Common.h @@ -678,7 +678,9 @@ namespace Common { GearSetEquipMsg = 0x321, + ToggleMountUnlock = 0x387, ToggleOrchestrionUnlock = 0x396, + Dismount = 0x3a0 }; diff --git a/src/servers/Server_Zone/Actor/Player.cpp b/src/servers/Server_Zone/Actor/Player.cpp index 2caab4b3..c202f1ed 100644 --- a/src/servers/Server_Zone/Actor/Player.cpp +++ b/src/servers/Server_Zone/Actor/Player.cpp @@ -619,6 +619,17 @@ void Core::Entity::Player::learnSong( uint8_t songId, uint32_t itemId ) queuePacket( ActorControlPacket143( getId(), ToggleOrchestrionUnlock, songId, 1, itemId ) ); } +void Core::Entity::Player::learnMount( uint8_t mountId ) +{ + uint16_t index; + uint8_t value; + Util::valueToFlagByteIndexValue( mountId, value, index ); + + m_orchestrion[index] |= value; + + queuePacket( ActorControlPacket143( getId(), ToggleMountUnlock, mountId, 1 ) ); +} + bool Core::Entity::Player::isActionLearned( uint8_t actionId ) const { uint16_t index; diff --git a/src/servers/Server_Zone/Actor/Player.h b/src/servers/Server_Zone/Actor/Player.h index 4688e5a5..63726297 100644 --- a/src/servers/Server_Zone/Actor/Player.h +++ b/src/servers/Server_Zone/Actor/Player.h @@ -381,6 +381,8 @@ public: void learnAction( uint8_t actionId ); /*! learn a song / update the unlock bitmask. */ void learnSong( uint8_t songId, uint32_t itemId ); + /*! get a mount / update the unlock bitmask. */ + void learnMount( uint8_t mountId ); /*! check if an action is already unlocked in the bitmask. */ bool isActionLearned( uint8_t actionId ) const; /*! return a const pointer to the unlock bitmask array */ diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp index f769166b..2940e456 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -397,6 +397,17 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye pPlayer->queuePacket(controlPacket);*/ } + else if (subCommand == "unlock") + { + int32_t id; + sscanf( params.c_str(), "%d", &id ); + + pPlayer->learnAction( id ); + } + else if (subCommand == "enablecompanion") + { + pPlayer->learnAction( 17 ); + } else { pPlayer->sendUrgent( subCommand + " is not a valid ADD command." ); diff --git a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp index e9a49c16..6cfd80a2 100644 --- a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp @@ -70,6 +70,7 @@ enum GmCommand Exp = 0x0068, Inv = 0x006A, + Mount = 0x0071, Orchestrion = 0x0074, Item = 0x00C8, @@ -298,6 +299,25 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac break; } + case GmCommand::Mount: + { + if (param2 == 0) + { + for (uint8_t i = 0; i < 255; i++) + targetActor->getAsPlayer()->learnMount( i ); + + pPlayer->sendNotice( "All mounts for " + targetPlayer->getName() + + " were turned on." ); + } + else + { + targetActor->getAsPlayer()->learnMount( param1 ); + pPlayer->sendNotice( "Mount " + std::to_string( param1 ) + " for " + targetPlayer->getName() + + " was turned on." ); + } + + break; + } case GmCommand::Item: { if( param2 < 1 || param2 > 99 ) From a35b9349397560d7c0c78c9f68344659d07b013b Mon Sep 17 00:00:00 2001 From: goaaats Date: Mon, 4 Dec 2017 16:57:47 +0100 Subject: [PATCH 2/7] * Use the right array this time --- src/servers/Server_Zone/Actor/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/servers/Server_Zone/Actor/Player.cpp b/src/servers/Server_Zone/Actor/Player.cpp index c202f1ed..0c49773f 100644 --- a/src/servers/Server_Zone/Actor/Player.cpp +++ b/src/servers/Server_Zone/Actor/Player.cpp @@ -625,7 +625,7 @@ void Core::Entity::Player::learnMount( uint8_t mountId ) uint8_t value; Util::valueToFlagByteIndexValue( mountId, value, index ); - m_orchestrion[index] |= value; + m_mountGuide[index] |= value; queuePacket( ActorControlPacket143( getId(), ToggleMountUnlock, mountId, 1 ) ); } From 1b09369505bfb105272441dfd2b07ee73a0250a3 Mon Sep 17 00:00:00 2001 From: goaaats Date: Mon, 4 Dec 2017 17:13:17 +0100 Subject: [PATCH 3/7] style --- .../Server_Zone/DebugCommand/DebugCommandHandler.cpp | 6 +++--- .../Server_Zone/Network/Handlers/GMCommandHandlers.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp index 2940e456..2a3f5273 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -397,14 +397,14 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye pPlayer->queuePacket(controlPacket);*/ } - else if (subCommand == "unlock") + else if ( subCommand == "unlock" ) { int32_t id; sscanf( params.c_str(), "%d", &id ); pPlayer->learnAction( id ); } - else if (subCommand == "enablecompanion") + else if ( subCommand == "enablecompanion" ) { pPlayer->learnAction( 17 ); } @@ -440,7 +440,7 @@ void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlaye "subCommand " + subCommand + " params: " + params ); - if( ( subCommand == "pos" ) ) + if( subCommand == "pos" ) { int16_t map_id = g_exdData.m_zoneInfoMap[pPlayer->getCurrentZone()->getId()].map_id; diff --git a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp index 6cfd80a2..1a8a5e80 100644 --- a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp @@ -301,7 +301,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac } case GmCommand::Mount: { - if (param2 == 0) + if ( param2 == 0 ) { for (uint8_t i = 0; i < 255; i++) targetActor->getAsPlayer()->learnMount( i ); From c8c4baefb1ecd4785905066b492e60490182ba61 Mon Sep 17 00:00:00 2001 From: goaaats Date: Mon, 4 Dec 2017 23:21:15 +0100 Subject: [PATCH 4/7] more style --- .../DebugCommand/DebugCommandHandler.cpp | 70 +++++++++---------- .../Network/Handlers/GMCommandHandlers.cpp | 36 +++++----- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp index 2a3f5273..342b73e6 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -64,7 +64,7 @@ Core::DebugCommandHandler::~DebugCommandHandler() // add a command set to the register map 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( 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, - boost::shared_ptr command ) + boost::shared_ptr command ) { g_scriptMgr.reload(); 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 ) { 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 ); g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + "subCommand " + subCommand + " params: " + params ); if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) @@ -176,12 +176,12 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye if( subCommand == "pos" ) pPlayer->setPosition( static_cast< float >( posX ), - static_cast< float >( posY ), - static_cast< float >( posZ ) ); + static_cast< float >( posY ), + static_cast< float >( posZ ) ); else pPlayer->setPosition( pPlayer->getPos().x + static_cast< float >( posX ), - pPlayer->getPos().y + static_cast< float >( posY ), - pPlayer->getPos().z + static_cast< float >( posZ ) ); + pPlayer->getPos().y + static_cast< float >( posY ), + pPlayer->getPos().z + static_cast< float >( posZ ) ); Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos > setActorPosPacket( pPlayer->getId() ); @@ -236,26 +236,26 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye } 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 ( id ) ) == 0 ) - { - pPlayer->setLevelForClass( 1, static_cast ( id ) ); - pPlayer->setClassJob( static_cast ( id ) ); - } - else - pPlayer->setClassJob( static_cast ( id ) ); + if( pPlayer->getLevelForClass( static_cast ( id ) ) == 0 ) + { + pPlayer->setLevelForClass( 1, static_cast ( id ) ); + pPlayer->setClassJob( static_cast ( id ) ); + } + else + pPlayer->setClassJob( static_cast ( id ) ); } - else if ( subCommand == "cfpenalty" ) + else if( subCommand == "cfpenalty" ) { int32_t minutes; sscanf( params.c_str(), "%d", &minutes ); pPlayer->setCFPenaltyMinutes( minutes ); } - else if ( subCommand == "eorzeatime" ) + else if( subCommand == "eorzeatime" ) { uint64_t timestamp; sscanf( params.c_str(), "%" SCNu64, ×tamp ); @@ -263,7 +263,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye pPlayer->setEorzeaTimeOffset( timestamp ); pPlayer->sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) ); } - else if ( subCommand == "model" ) + else if( subCommand == "model" ) { uint32_t slot; uint32_t val; @@ -273,7 +273,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye pPlayer->sendModel(); pPlayer->sendDebug( "Model updated" ); } - else if ( subCommand == "mount" ) + else if( subCommand == "mount" ) { int32_t 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 ); g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + "subCommand " + subCommand + " params: " + params ); if( subCommand == "status" ) @@ -328,7 +328,7 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye pPlayer->addStatusEffect( effect ); } - else if ( subCommand == "title" ) + else if( subCommand == "title" ) { uint32_t titleId; sscanf( params.c_str(), "%u", &titleId ); @@ -397,14 +397,14 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye pPlayer->queuePacket(controlPacket);*/ } - else if ( subCommand == "unlock" ) + else if( subCommand == "unlock" ) { int32_t id; sscanf( params.c_str(), "%d", &id ); pPlayer->learnAction( id ); } - else if ( subCommand == "enablecompanion" ) + else if( subCommand == "enablecompanion" ) { 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 ); g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + "subCommand " + subCommand + " params: " + params ); 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; pPlayer->sendNotice( "Pos:\n" + - std::to_string( pPlayer->getPos().x ) + "\n" + - std::to_string( pPlayer->getPos().y ) + "\n" + - std::to_string( pPlayer->getPos().z ) + "\n" + - std::to_string( pPlayer->getRotation() ) + "\nMapId: " + - std::to_string( map_id ) + "\nZoneID: " + - std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" ); + std::to_string( pPlayer->getPos().x ) + "\n" + + std::to_string( pPlayer->getPos().y ) + "\n" + + std::to_string( pPlayer->getPos().z ) + "\n" + + std::to_string( pPlayer->getRotation() ) + "\nMapId: " + + std::to_string( map_id ) + "\nZoneID: " + + std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" ); } 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 ) { - pPlayer->unlock( ); + pPlayer->unlock(); } diff --git a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp index 1a8a5e80..e6784c03 100644 --- a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp @@ -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 ) ); targetPlayer->spawn( targetPlayer ); auto inRange = targetPlayer->getInRangeActors(); - for ( auto actor : inRange ) + for( auto actor : inRange ) { targetPlayer->despawn( 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 ) ); targetPlayer->spawn( targetPlayer ); auto inRange = targetPlayer->getInRangeActors(); - for ( auto actor : inRange ) + for( auto actor : inRange ) { targetPlayer->despawn( 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 ) ); targetPlayer->spawn( targetPlayer ); auto inRange = targetActor->getInRangeActors(); - for ( auto actor : inRange ) + for( auto actor : inRange ) { targetPlayer->despawn( actor->getAsPlayer() ); targetPlayer->spawn( actor->getAsPlayer() ); @@ -189,7 +189,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac } case GmCommand::Call: { - if ( targetPlayer->getZoneId() != pPlayer->getZoneId() ) + if( targetPlayer->getZoneId() != pPlayer->getZoneId() ) targetPlayer->setZone( pPlayer->getZoneId() ); 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: { - if ( targetActor->getInvincibilityType() == Common::InvincibilityType::InvincibilityRefill ) + if( targetActor->getInvincibilityType() == Common::InvincibilityType::InvincibilityRefill ) targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityNone ); else targetActor->setInvincibilityType( Common::InvincibilityType::InvincibilityRefill ); @@ -279,11 +279,11 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac } 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 ); pPlayer->sendNotice( "All Songs for " + targetPlayer->getName() + @@ -301,9 +301,9 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac } 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 ); pPlayer->sendNotice( "All mounts for " + targetPlayer->getName() + @@ -325,7 +325,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac param2 = 1; } - if( ( param1 == 0xcccccccc ) ) + if( param1 == 0xcccccccc ) { pPlayer->sendUrgent( "Syntaxerror." ); return; @@ -345,7 +345,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac { uint32_t gil = targetPlayer->getCurrency( 1 ); - if ( gil < param1 ) + if( gil < param1 ) { 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: { - 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 ); pPlayer->sendNotice( "All Aetherytes for " + targetPlayer->getName() + @@ -423,7 +423,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac case GmCommand::Teri: { auto zoneInfo = g_zoneMgr.getZone( param1 ); - if ( !zoneInfo ) + if( !zoneInfo ) { 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->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; } @@ -457,7 +457,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac pPlayer->sendNotice( "Jumping to " + targetPlayer->getName() + " in range." ); break; } - + default: pPlayer->sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) ); break; From e64fe0d105ffe82b51a76e9aeb2d76623e7ffb96 Mon Sep 17 00:00:00 2001 From: goaaats Date: Mon, 4 Dec 2017 23:25:20 +0100 Subject: [PATCH 5/7] styles --- .../DebugCommand/DebugCommandHandler.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp index 342b73e6..75e7f818 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -64,7 +64,7 @@ Core::DebugCommandHandler::~DebugCommandHandler() // add a command set to the register map 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( 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, - boost::shared_ptr command ) + boost::shared_ptr command ) { g_scriptMgr.reload(); pPlayer->sendDebug( "Scripts reloaded." ); @@ -157,7 +157,7 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye params = std::string( data + command->getName().length() + 1 + pos + 1 ); g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + "subCommand " + subCommand + " params: " + params ); if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) @@ -176,12 +176,12 @@ void Core::DebugCommandHandler::set( char * data, Core::Entity::PlayerPtr pPlaye if( subCommand == "pos" ) pPlayer->setPosition( static_cast< float >( posX ), - static_cast< float >( posY ), - static_cast< float >( posZ ) ); + static_cast< float >( posY ), + static_cast< float >( posZ ) ); else pPlayer->setPosition( pPlayer->getPos().x + static_cast< float >( posX ), - pPlayer->getPos().y + static_cast< float >( posY ), - pPlayer->getPos().z + static_cast< float >( posZ ) ); + pPlayer->getPos().y + static_cast< float >( posY ), + pPlayer->getPos().z + static_cast< float >( posZ ) ); Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos > setActorPosPacket( pPlayer->getId() ); @@ -312,7 +312,7 @@ void Core::DebugCommandHandler::add( char * data, Core::Entity::PlayerPtr pPlaye params = std::string( data + command->getName().length() + 1 + pos + 1 ); g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + "subCommand " + subCommand + " params: " + params ); if( subCommand == "status" ) @@ -437,7 +437,7 @@ void Core::DebugCommandHandler::get( char * data, Core::Entity::PlayerPtr pPlaye params = std::string( data + command->getName().length() + 1 + pos + 1 ); g_log.debug( "[" + std::to_string( pPlayer->getId() ) + "] " + - "subCommand " + subCommand + " params: " + params ); + "subCommand " + subCommand + " params: " + params ); 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; pPlayer->sendNotice( "Pos:\n" + - std::to_string( pPlayer->getPos().x ) + "\n" + - std::to_string( pPlayer->getPos().y ) + "\n" + - std::to_string( pPlayer->getPos().z ) + "\n" + - std::to_string( pPlayer->getRotation() ) + "\nMapId: " + - std::to_string( map_id ) + "\nZoneID: " + - std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" ); + std::to_string( pPlayer->getPos().x ) + "\n" + + std::to_string( pPlayer->getPos().y ) + "\n" + + std::to_string( pPlayer->getPos().z ) + "\n" + + std::to_string( pPlayer->getRotation() ) + "\nMapId: " + + std::to_string( map_id ) + "\nZoneID: " + + std::to_string( pPlayer->getCurrentZone()->getId() ) + "\n" ); } else { From 055a6655161949d5c1a5d2f370dc400b47e9a828 Mon Sep 17 00:00:00 2001 From: goaaats Date: Tue, 19 Dec 2017 16:29:22 +0100 Subject: [PATCH 6/7] fix build --- .../Server_Zone/DebugCommand/DebugCommandHandler.cpp | 12 ++++++------ .../Network/Handlers/GMCommandHandlers.cpp | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp index 08c494be..4a37137b 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -126,12 +126,12 @@ void Core::DebugCommandHandler::scriptReload( char * data, Entity::Player& playe void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command ) { - pPlayer->sendDebug( "Registered debug commands:" ); + player.sendDebug( "Registered debug commands:" ); for( auto cmd : m_commandMap ) { - if( pPlayer->getGmRank() >= cmd.second->m_gmLevel ) + if( player.getGmRank() >= cmd.second->m_gmLevel ) { - pPlayer->sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText() ); + player.sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText() ); } } @@ -403,11 +403,11 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost: int32_t id; sscanf( params.c_str(), "%d", &id ); - pPlayer->learnAction( id ); + player.learnAction( id ); } else if( subCommand == "enablecompanion" ) { - pPlayer->learnAction( 17 ); + player.learnAction( 17 ); } else { @@ -531,5 +531,5 @@ void Core::DebugCommandHandler::serverInfo( char * data, Entity::Player& player, void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command ) { - pPlayer->unlock(); + player.unlock(); } diff --git a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp index 1c1211b9..0f2380fd 100644 --- a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp @@ -190,8 +190,8 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac } case GmCommand::Call: { - if( targetPlayer->getZoneId() != pPlayer->getZoneId() ) - targetPlayer->setZone( pPlayer->getZoneId() ); + if( targetPlayer->getZoneId() != player.getZoneId() ) + targetPlayer->setZone( player.getZoneId() ); targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRotation() ); @@ -307,13 +307,13 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac for( uint8_t i = 0; i < 255; i++ ) targetActor->getAsPlayer()->learnMount( i ); - pPlayer->sendNotice( "All mounts for " + targetPlayer->getName() + + player.sendNotice( "All mounts for " + targetPlayer->getName() + " were turned on." ); } else { targetActor->getAsPlayer()->learnMount( param1 ); - pPlayer->sendNotice( "Mount " + std::to_string( param1 ) + " for " + targetPlayer->getName() + + player.sendNotice( "Mount " + std::to_string( param1 ) + " for " + targetPlayer->getName() + " was turned on." ); } @@ -433,7 +433,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac targetPlayer->setPosition( targetPlayer->getPos() ); targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 ); - pPlayer->sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName() + ")" ); + player.sendNotice( targetPlayer->getName() + " was warped to zone " + std::to_string( param1 ) + " (" + zoneInfo->getName() + ")" ); } break; } From 47bd8cfdea99a3999c06e294839af39d33d7e6b9 Mon Sep 17 00:00:00 2001 From: goaaats Date: Tue, 19 Dec 2017 18:13:12 +0100 Subject: [PATCH 7/7] more fixes --- .../Server_Common/Network/PacketDef/Zone/ServerZoneDef.h | 2 +- src/servers/Server_Zone/Actor/PlayerSql.cpp | 2 +- src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h b/src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h index 6df1e762..7c8fe4b8 100644 --- a/src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/servers/Server_Common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1338,4 +1338,4 @@ struct FFXIVIpcPerformNote : FFXIVIpcBasePacket -#endif /*_CORE_NETWORK_PACKETS_SERVER_IPC_H*/ +#endif /*_CORE_NETWORK_PACKETS_SERVER_IPC_H*/ \ No newline at end of file diff --git a/src/servers/Server_Zone/Actor/PlayerSql.cpp b/src/servers/Server_Zone/Actor/PlayerSql.cpp index d0c23880..242da679 100644 --- a/src/servers/Server_Zone/Actor/PlayerSql.cpp +++ b/src/servers/Server_Zone/Actor/PlayerSql.cpp @@ -378,7 +378,7 @@ void Core::Entity::Player::updateSql() std::vector< uint8_t > orchestrionVec( sizeof( m_orchestrion ) ); memcpy( orchestrionVec.data(), m_orchestrion, sizeof( m_orchestrion ) ); - stmt->setBinary( 42, mountsVec ); + stmt->setBinary( 43, orchestrionVec ); stmt->setInt( 44, 0 ); // EquippedMannequin diff --git a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp index 4a37137b..aff5c527 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -303,11 +303,8 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost: // command has parameters, grab the first part subCommand = tmpCommand.substr( 0, pos ); else - { // no subcommand given subCommand = tmpCommand; - return; - } if( command->getName().length() + 1 + pos + 1 < strlen( data ) ) params = std::string( data + command->getName().length() + 1 + pos + 1 );