From 90354e82f495fc53d5bf4eae74390021cd257c98 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 10 Jan 2024 20:35:02 -0800 Subject: [PATCH 1/2] implement unlocking orchestrion roll --- src/common/Common.h | 1 + src/world/Action/ItemAction.cpp | 15 +++++++++++++++ src/world/Action/ItemAction.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/common/Common.h b/src/common/Common.h index 8aa5836c58..06883139ec 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -1023,6 +1023,7 @@ namespace Sapphire::Common ItemActionCompanion = 853, ItemActionVFX2 = 944, ItemActionMount = 1322, + ItemActionSong = 5845, }; enum ActionEffectDisplayType : uint8_t diff --git a/src/world/Action/ItemAction.cpp b/src/world/Action/ItemAction.cpp index ed096782d1..6c20f290d9 100644 --- a/src/world/Action/ItemAction.cpp +++ b/src/world/Action/ItemAction.cpp @@ -67,6 +67,13 @@ void ItemAction::execute() break; } + + case Common::ItemActionType::ItemActionSong: + { + handleSongItem(); + + break; + } } } @@ -102,4 +109,12 @@ void ItemAction::handleMountItem() player->unlockMount( m_itemAction->data().Calcu0Arg[ 0 ] ); player->dropInventoryItem( static_cast< Common::InventoryType >( m_itemSourceContainer ), static_cast< uint8_t >( m_itemSourceSlot ) ); +} + +void ItemAction::handleSongItem() +{ + auto player = getSourceChara()->getAsPlayer(); + + player->learnSong( m_itemAction->data().Calcu0Arg[ 0 ], m_id ); + player->dropInventoryItem( static_cast< Common::InventoryType >( m_itemSourceContainer ), static_cast< uint8_t >( m_itemSourceSlot ) ); } \ No newline at end of file diff --git a/src/world/Action/ItemAction.h b/src/world/Action/ItemAction.h index d1078bd98f..9836ca34db 100644 --- a/src/world/Action/ItemAction.h +++ b/src/world/Action/ItemAction.h @@ -31,6 +31,8 @@ namespace Sapphire::World::Action void handleMountItem(); + void handleSongItem(); + private: std::shared_ptr< Excel::ExcelStruct< Excel::ItemAction > > m_itemAction; From 22b4ed3c5a19fe168f84b90e16125909556494fa Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 10 Jan 2024 20:36:08 -0800 Subject: [PATCH 2/2] fix: allow player to remove title after being set - index 0 is None in-game removing the currently equipped title --- src/world/Actor/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 3bbb74ef75..08cac924b3 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -1183,7 +1183,7 @@ void Player::setTitle( uint16_t titleId ) uint8_t value; Util::valueToFlagByteIndexValue( titleId, value, index ); - if( ( m_titleList[ index ] & value ) == 0 ) // Player doesn't have title - bail + if( ( m_titleList[ index ] & value ) == 0 && titleId != 0 ) // Player doesn't have title and is not "no title" - bail return; m_activeTitle = titleId;