1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-07 19:27:45 +00:00

Merge pull request #771 from Skyliegirl33/feature-impl

[3.x] Add flags to FindContent and improve findFirstItemWithId
This commit is contained in:
Mordred 2022-02-12 20:27:44 +01:00 committed by GitHub
commit a588fc99ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View file

@ -351,6 +351,7 @@ struct FFXIVIpcFindContent : FFXIVIpcBasePacket< FindContent >
uint16_t territoryType;
uint8_t acceptHalfway;
uint8_t language;
uint8_t flags;
};
struct FFXIVIpcFind5Contents : FFXIVIpcBasePacket< Find5Contents >

View file

@ -747,7 +747,7 @@ namespace Sapphire::Entity
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();

View file

@ -1076,15 +1076,15 @@ void Sapphire::Entity::Player::insertInventoryItem( Sapphire::Common::InventoryT
}
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 ];
for( const auto& item : container->getItemMap() )
{
if( item.second->getId() != catalogId )
if( ( item.second && item.second->getId() != catalogId ) || !item.second )
continue;
location = std::make_pair( bagId, item.first );
@ -1094,4 +1094,4 @@ bool Sapphire::Entity::Player::findFirstItemWithId( uint32_t catalogId,
}
return false;
}
}