mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-09 20:27:45 +00:00
Update findFirstItemWithId to take list of bags
This commit is contained in:
parent
dc562bfe61
commit
9644b61ae1
2 changed files with 4 additions and 4 deletions
|
@ -747,7 +747,7 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
uint32_t getNextInventorySequence();
|
uint32_t getNextInventorySequence();
|
||||||
|
|
||||||
bool findFirstItemWithId( uint32_t catalogId, Inventory::InventoryContainerPair& location );
|
bool findFirstItemWithId( uint32_t catalogId, Inventory::InventoryContainerPair& location, std::initializer_list< Common::InventoryType > bags = { Common::Bag0, Common::Bag1, Common::Bag2, Common::Bag3 } );
|
||||||
|
|
||||||
uint16_t getFreeSlotsInBags();
|
uint16_t getFreeSlotsInBags();
|
||||||
|
|
||||||
|
|
|
@ -1076,15 +1076,15 @@ void Sapphire::Entity::Player::insertInventoryItem( Sapphire::Common::InventoryT
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::findFirstItemWithId( uint32_t catalogId,
|
bool Sapphire::Entity::Player::findFirstItemWithId( uint32_t catalogId,
|
||||||
Inventory::InventoryContainerPair& location )
|
Inventory::InventoryContainerPair& location, std::initializer_list< InventoryType > bags )
|
||||||
{
|
{
|
||||||
for( auto bagId : { Bag0, Bag1, Bag2, Bag3 } )
|
for( auto bagId : bags )
|
||||||
{
|
{
|
||||||
auto& container = m_storageMap[ bagId ];
|
auto& container = m_storageMap[ bagId ];
|
||||||
|
|
||||||
for( const auto& item : container->getItemMap() )
|
for( const auto& item : container->getItemMap() )
|
||||||
{
|
{
|
||||||
if( item.second->getId() != catalogId )
|
if(( item.second && item.second->getId() != catalogId ) || !item.second )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
location = std::make_pair( bagId, item.first );
|
location = std::make_pair( bagId, item.first );
|
||||||
|
|
Loading…
Add table
Reference in a new issue