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:
commit
a588fc99ee
3 changed files with 6 additions and 5 deletions
|
@ -351,6 +351,7 @@ struct FFXIVIpcFindContent : FFXIVIpcBasePacket< FindContent >
|
||||||
uint16_t territoryType;
|
uint16_t territoryType;
|
||||||
uint8_t acceptHalfway;
|
uint8_t acceptHalfway;
|
||||||
uint8_t language;
|
uint8_t language;
|
||||||
|
uint8_t flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFXIVIpcFind5Contents : FFXIVIpcBasePacket< Find5Contents >
|
struct FFXIVIpcFind5Contents : FFXIVIpcBasePacket< Find5Contents >
|
||||||
|
|
|
@ -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 );
|
||||||
|
@ -1094,4 +1094,4 @@ bool Sapphire::Entity::Player::findFirstItemWithId( uint32_t catalogId,
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue