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_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/Player.cpp b/src/servers/Server_Zone/Actor/Player.cpp index 0d12b440..4059a455 100644 --- a/src/servers/Server_Zone/Actor/Player.cpp +++ b/src/servers/Server_Zone/Actor/Player.cpp @@ -621,6 +621,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_mountGuide[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 a7b7400b..4c85bf89 100644 --- a/src/servers/Server_Zone/Actor/Player.h +++ b/src/servers/Server_Zone/Actor/Player.h @@ -385,6 +385,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/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 7cd06a50..aff5c527 100644 --- a/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/Server_Zone/DebugCommand/DebugCommandHandler.cpp @@ -127,11 +127,12 @@ void Core::DebugCommandHandler::scriptReload( char * data, Entity::Player& playe void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command ) { player.sendDebug( "Registered debug commands:" ); - for ( auto cmd : m_commandMap ) + for( auto cmd : m_commandMap ) { - if ( player.getGmRank( ) >= cmd.second->m_gmLevel ) + if( player.getGmRank() >= cmd.second->m_gmLevel ) { - player.sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText( ) ); + player.sendDebug( " - " + cmd.first + " - " + cmd.second->getHelpText() ); + } } } @@ -236,26 +237,26 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost: } else if( subCommand == "classjob" ) { - int32_t id; + int32_t id; - sscanf( params.c_str(), "%d", &id ); + sscanf( params.c_str(), "%d", &id ); - if( player.getLevelForClass( static_cast< Common::ClassJob > ( id ) ) == 0 ) - { - player.setLevelForClass( 1, static_cast< Common::ClassJob > ( id ) ); - player.setClassJob( static_cast< Common::ClassJob > ( id ) ); - } - else - player.setClassJob( static_cast< Common::ClassJob > ( id ) ); + if( player.getLevelForClass( static_cast< Common::ClassJob > ( id ) ) == 0 ) + { + player.setLevelForClass( 1, static_cast< Common::ClassJob > ( id ) ); + player.setClassJob( static_cast< Common::ClassJob > ( id ) ); + } + else + player.setClassJob( static_cast< Common::ClassJob > ( id ) ); } - else if ( subCommand == "cfpenalty" ) + else if( subCommand == "cfpenalty" ) { int32_t minutes; sscanf( params.c_str(), "%d", &minutes ); player.setCFPenaltyMinutes( minutes ); } - else if ( subCommand == "eorzeatime" ) + else if( subCommand == "eorzeatime" ) { uint64_t timestamp; sscanf( params.c_str(), "%" SCNu64, ×tamp ); @@ -263,7 +264,7 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost: player.setEorzeaTimeOffset( timestamp ); player.sendNotice( "Eorzea time offset: " + std::to_string( timestamp ) ); } - else if ( subCommand == "model" ) + else if( subCommand == "model" ) { uint32_t slot; uint32_t val; @@ -273,7 +274,7 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost: player.sendModel(); player.sendDebug( "Model updated" ); } - else if ( subCommand == "mount" ) + else if( subCommand == "mount" ) { int32_t id; sscanf( params.c_str(), "%d", &id ); @@ -394,6 +395,17 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost: player.queuePacket( controlPacket );*/ } + else if( subCommand == "unlock" ) + { + int32_t id; + sscanf( params.c_str(), "%d", &id ); + + player.learnAction( id ); + } + else if( subCommand == "enablecompanion" ) + { + player.learnAction( 17 ); + } else { player.sendUrgent( subCommand + " is not a valid ADD command." ); @@ -426,7 +438,7 @@ void Core::DebugCommandHandler::get( char * data, Entity::Player& player, boost: "subCommand " + subCommand + " params: " + params ); - if( ( subCommand == "pos" ) ) + if( subCommand == "pos" ) { int16_t map_id = g_exdData.m_zoneInfoMap[player.getCurrentZone()->getId()].map_id; @@ -516,5 +528,5 @@ void Core::DebugCommandHandler::serverInfo( char * data, Entity::Player& player, void Core::DebugCommandHandler::unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command ) { - player.unlock( ); + player.unlock(); } diff --git a/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/Server_Zone/Network/Handlers/GMCommandHandlers.cpp index 923b37b9..0f2380fd 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, @@ -141,7 +142,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac player.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 +155,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac player.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 +168,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac player.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 +190,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac } case GmCommand::Call: { - if ( targetPlayer->getZoneId() != player.getZoneId() ) + if( targetPlayer->getZoneId() != player.getZoneId() ) targetPlayer->setZone( player.getZoneId() ); targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, @@ -268,7 +269,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 +280,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 ); player.sendNotice( "All Songs for " + targetPlayer->getName() + @@ -299,6 +300,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 ); + + player.sendNotice( "All mounts for " + targetPlayer->getName() + + " were turned on." ); + } + else + { + targetActor->getAsPlayer()->learnMount( param1 ); + player.sendNotice( "Mount " + std::to_string( param1 ) + " for " + targetPlayer->getName() + + " was turned on." ); + } + + break; + } case GmCommand::Item: { if( param2 < 1 || param2 > 99 ) @@ -306,7 +326,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac param2 = 1; } - if( ( param1 == 0xcccccccc ) ) + if( param1 == 0xcccccccc ) { player.sendUrgent( "Syntaxerror." ); return; @@ -326,7 +346,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac { uint32_t gil = targetPlayer->getCurrency( 1 ); - if ( gil < param1 ) + if( gil < param1 ) { player.sendUrgent( "Player does not have enough Gil(" + std::to_string( gil ) + ")" ); } @@ -381,11 +401,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 ); player.sendNotice( "All Aetherytes for " + targetPlayer->getName() + @@ -404,7 +424,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac case GmCommand::Teri: { auto zoneInfo = g_zoneMgr.getZone( param1 ); - if ( !zoneInfo ) + if( !zoneInfo ) { player.sendUrgent( "Invalid zone " + std::to_string( param1 ) ); } @@ -412,7 +432,8 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac { targetPlayer->setPosition( targetPlayer->getPos() ); targetPlayer->performZoning( param1, targetPlayer->getPos(), 0 ); - player.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; } @@ -438,7 +459,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::GamePacket& inPac player.sendNotice( "Jumping to " + targetPlayer->getName() + " in range." ); break; } - + default: player.sendUrgent( "GM1 Command not implemented: " + std::to_string( commandId ) ); break;