1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-25 11:07:45 +00:00
This commit is contained in:
goaaats 2017-12-24 23:31:06 +00:00 committed by GitHub
commit 1023cfe15b
7 changed files with 84 additions and 36 deletions

View file

@ -678,7 +678,9 @@ namespace Common {
GearSetEquipMsg = 0x321,
ToggleMountUnlock = 0x387,
ToggleOrchestrionUnlock = 0x396,
Dismount = 0x3a0
};

View file

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

View file

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

View file

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

View file

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

View file

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