From 9644b61ae1a6ade606dd8da998e3954712455074 Mon Sep 17 00:00:00 2001 From: Rushi <44952533+Skyliegirl33@users.noreply.github.com> Date: Sat, 12 Feb 2022 00:58:52 +0100 Subject: [PATCH 1/3] Update findFirstItemWithId to take list of bags --- src/world/Actor/Player.h | 2 +- src/world/Actor/PlayerInventory.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 10dfe28c..df7fea04 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -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(); diff --git a/src/world/Actor/PlayerInventory.cpp b/src/world/Actor/PlayerInventory.cpp index 44335086..4915c279 100644 --- a/src/world/Actor/PlayerInventory.cpp +++ b/src/world/Actor/PlayerInventory.cpp @@ -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 ); From eee3df5bbd7041e8d444664859011ae47fcc71b4 Mon Sep 17 00:00:00 2001 From: Rushi <44952533+Skyliegirl33@users.noreply.github.com> Date: Sat, 12 Feb 2022 00:59:29 +0100 Subject: [PATCH 2/3] Add flags to FindContent struct --- src/common/Network/PacketDef/Zone/ClientZoneDef.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/Network/PacketDef/Zone/ClientZoneDef.h b/src/common/Network/PacketDef/Zone/ClientZoneDef.h index 066261e3..8826e50c 100644 --- a/src/common/Network/PacketDef/Zone/ClientZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ClientZoneDef.h @@ -351,6 +351,7 @@ struct FFXIVIpcFindContent : FFXIVIpcBasePacket< FindContent > uint16_t territoryType; uint8_t acceptHalfway; uint8_t language; + uint8_t flags; }; struct FFXIVIpcFind5Contents : FFXIVIpcBasePacket< Find5Contents > From 699b6d31a2b83f2dddf275e1fdfc52c31424dfe8 Mon Sep 17 00:00:00 2001 From: Rushi <44952533+Skyliegirl33@users.noreply.github.com> Date: Sat, 12 Feb 2022 19:20:13 +0000 Subject: [PATCH 3/3] Fix spacing --- src/world/Actor/PlayerInventory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/world/Actor/PlayerInventory.cpp b/src/world/Actor/PlayerInventory.cpp index 4915c279..b1112d47 100644 --- a/src/world/Actor/PlayerInventory.cpp +++ b/src/world/Actor/PlayerInventory.cpp @@ -1084,7 +1084,7 @@ bool Sapphire::Entity::Player::findFirstItemWithId( uint32_t catalogId, for( const auto& item : container->getItemMap() ) { - if(( item.second && item.second->getId() != catalogId ) || !item.second ) + 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; -} \ No newline at end of file +}