Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor ItemAction and Player Title fixes #952

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ namespace Sapphire::Common
ItemActionCompanion = 853,
ItemActionVFX2 = 944,
ItemActionMount = 1322,
ItemActionSong = 5845,
};

enum ActionEffectDisplayType : uint8_t
Expand Down
15 changes: 15 additions & 0 deletions src/world/Action/ItemAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ void ItemAction::execute()

break;
}

case Common::ItemActionType::ItemActionSong:
{
handleSongItem();

break;
}
}
}

Expand Down Expand Up @@ -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 ) );
}
2 changes: 2 additions & 0 deletions src/world/Action/ItemAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ namespace Sapphire::World::Action

void handleMountItem();

void handleSongItem();

private:
std::shared_ptr< Excel::ExcelStruct< Excel::ItemAction > > m_itemAction;

Expand Down
2 changes: 1 addition & 1 deletion src/world/Actor/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading