Skip to content

Commit 952391a

Browse files
Song learn functions moved
1 parent 495f651 commit 952391a

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/world/Action/ItemAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ void ItemAction::handleSongItem()
115115
{
116116
auto player = getSourceChara()->getAsPlayer();
117117

118-
player->learnSong( m_itemAction->data().Calcu0Arg[ 0 ], m_id );
118+
playerMgr().onSongLearned( *player, m_itemAction->data().Calcu0Arg[ 0 ], m_id );
119119
player->dropInventoryItem( static_cast< Common::InventoryType >( m_itemSourceContainer ), static_cast< uint8_t >( m_itemSourceSlot ) );
120120
}

src/world/Actor/Player.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,6 @@ void Player::learnSong( uint8_t songId, uint32_t itemId )
525525
Util::valueToFlagByteIndexValue( songId, value, index );
526526

527527
m_orchestrion[ index ] |= value;
528-
529-
Network::Util::Packet::sendActorControlSelf( *this, getId(), ToggleOrchestrionUnlock, songId, 1, itemId );
530528
}
531529

532530
bool Player::hasReward( Common::UnlockEntry unlockId ) const

src/world/Manager/PlayerMgr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,5 +579,11 @@ void PlayerMgr::onLevelChanged( Entity::Player& player, uint8_t level )
579579
Common::Service< World::Manager::MapMgr >::ref().updateQuests( player );
580580
}
581581

582+
void PlayerMgr::onSongLearned( Entity::Player& player, uint8_t songId, uint32_t itemId )
583+
{
584+
player.learnSong( songId, itemId );
585+
Network::Util::Packet::sendActorControlSelf( player, player.getId(), ToggleOrchestrionUnlock, songId, 1, itemId );
586+
}
587+
582588

583589

src/world/Manager/PlayerMgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ namespace Sapphire::World::Manager
4646

4747
void onLevelChanged( Sapphire::Entity::Player& player, uint8_t level );
4848

49+
void onSongLearned( Sapphire::Entity::Player& player, uint8_t songId, uint32_t itemId );
50+
4951
//////////// Helpers
5052

5153
static void sendServerNotice( Sapphire::Entity::Player& player, const std::string& message );

src/world/Network/Handlers/GMCommandHandlers.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
328328
if( param2 == 0 )
329329
{
330330
for( uint8_t i = 0; i < 255; i++ )
331-
targetPlayer->learnSong( i, 0 );
331+
{
332+
playerMgr().onSongLearned( *targetPlayer, i, 0 );
333+
}
332334

333335
PlayerMgr::sendServerNotice( player, "All Songs for {0} were turned on.", targetPlayer->getName() );
334336
}

0 commit comments

Comments
 (0)