1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00

Merge pull request #952 from pinapelz/master

Minor ItemAction and Player Title fixes
This commit is contained in:
Mordred 2024-01-12 10:21:01 +01:00 committed by GitHub
commit 48c0127fa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View file

@ -1023,6 +1023,7 @@ namespace Sapphire::Common
ItemActionCompanion = 853, ItemActionCompanion = 853,
ItemActionVFX2 = 944, ItemActionVFX2 = 944,
ItemActionMount = 1322, ItemActionMount = 1322,
ItemActionSong = 5845,
}; };
enum ActionEffectDisplayType : uint8_t enum ActionEffectDisplayType : uint8_t

View file

@ -67,6 +67,13 @@ void ItemAction::execute()
break; break;
} }
case Common::ItemActionType::ItemActionSong:
{
handleSongItem();
break;
}
} }
} }
@ -103,3 +110,11 @@ void ItemAction::handleMountItem()
player->unlockMount( m_itemAction->data().Calcu0Arg[ 0 ] ); player->unlockMount( m_itemAction->data().Calcu0Arg[ 0 ] );
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 ) );
} }
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 ) );
}

View file

@ -31,6 +31,8 @@ namespace Sapphire::World::Action
void handleMountItem(); void handleMountItem();
void handleSongItem();
private: private:
std::shared_ptr< Excel::ExcelStruct< Excel::ItemAction > > m_itemAction; std::shared_ptr< Excel::ExcelStruct< Excel::ItemAction > > m_itemAction;

View file

@ -1183,7 +1183,7 @@ void Player::setTitle( uint16_t titleId )
uint8_t value; uint8_t value;
Util::valueToFlagByteIndexValue( titleId, value, index ); 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; return;
m_activeTitle = titleId; m_activeTitle = titleId;