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

Song learn functions moved

This commit is contained in:
Mordred 2025-01-02 16:06:47 +01:00
parent 495f651bce
commit 952391ae4f
5 changed files with 12 additions and 4 deletions

View file

@ -115,6 +115,6 @@ void ItemAction::handleSongItem()
{ {
auto player = getSourceChara()->getAsPlayer(); auto player = getSourceChara()->getAsPlayer();
player->learnSong( m_itemAction->data().Calcu0Arg[ 0 ], m_id ); playerMgr().onSongLearned( *player, m_itemAction->data().Calcu0Arg[ 0 ], m_id );
player->dropInventoryItem( static_cast< Common::InventoryType >( m_itemSourceContainer ), static_cast< uint8_t >( m_itemSourceSlot ) ); player->dropInventoryItem( static_cast< Common::InventoryType >( m_itemSourceContainer ), static_cast< uint8_t >( m_itemSourceSlot ) );
} }

View file

@ -525,8 +525,6 @@ void Player::learnSong( uint8_t songId, uint32_t itemId )
Util::valueToFlagByteIndexValue( songId, value, index ); Util::valueToFlagByteIndexValue( songId, value, index );
m_orchestrion[ index ] |= value; m_orchestrion[ index ] |= value;
Network::Util::Packet::sendActorControlSelf( *this, getId(), ToggleOrchestrionUnlock, songId, 1, itemId );
} }
bool Player::hasReward( Common::UnlockEntry unlockId ) const bool Player::hasReward( Common::UnlockEntry unlockId ) const

View file

@ -579,5 +579,11 @@ void PlayerMgr::onLevelChanged( Entity::Player& player, uint8_t level )
Common::Service< World::Manager::MapMgr >::ref().updateQuests( player ); Common::Service< World::Manager::MapMgr >::ref().updateQuests( player );
} }
void PlayerMgr::onSongLearned( Entity::Player& player, uint8_t songId, uint32_t itemId )
{
player.learnSong( songId, itemId );
Network::Util::Packet::sendActorControlSelf( player, player.getId(), ToggleOrchestrionUnlock, songId, 1, itemId );
}

View file

@ -46,6 +46,8 @@ namespace Sapphire::World::Manager
void onLevelChanged( Sapphire::Entity::Player& player, uint8_t level ); void onLevelChanged( Sapphire::Entity::Player& player, uint8_t level );
void onSongLearned( Sapphire::Entity::Player& player, uint8_t songId, uint32_t itemId );
//////////// Helpers //////////// Helpers
static void sendServerNotice( Sapphire::Entity::Player& player, const std::string& message ); static void sendServerNotice( Sapphire::Entity::Player& player, const std::string& message );

View file

@ -328,7 +328,9 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
if( param2 == 0 ) if( param2 == 0 )
{ {
for( uint8_t i = 0; i < 255; i++ ) for( uint8_t i = 0; i < 255; i++ )
targetPlayer->learnSong( i, 0 ); {
playerMgr().onSongLearned( *targetPlayer, i, 0 );
}
PlayerMgr::sendServerNotice( player, "All Songs for {0} were turned on.", targetPlayer->getName() ); PlayerMgr::sendServerNotice( player, "All Songs for {0} were turned on.", targetPlayer->getName() );
} }