mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 22:37:45 +00:00
correctly send inventories when using internal furnishings menu
This commit is contained in:
parent
2dcc6e460c
commit
a0616207a3
3 changed files with 64 additions and 6 deletions
|
@ -1095,4 +1095,55 @@ Sapphire::Common::YardObject Sapphire::World::Manager::HousingMgr::getYardObject
|
|||
obj.itemId = item->getAdditionalData();
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sapphire::Entity::Player& player,
|
||||
bool storeroom )
|
||||
{
|
||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||
if( !zone )
|
||||
return;
|
||||
|
||||
std::vector< uint16_t > containerIds;
|
||||
|
||||
if( !storeroom )
|
||||
{
|
||||
containerIds = {
|
||||
InventoryType::HousingInteriorPlacedItems1,
|
||||
InventoryType::HousingInteriorPlacedItems2,
|
||||
InventoryType::HousingInteriorPlacedItems3,
|
||||
InventoryType::HousingInteriorPlacedItems4,
|
||||
InventoryType::HousingInteriorPlacedItems5,
|
||||
InventoryType::HousingInteriorPlacedItems6,
|
||||
InventoryType::HousingInteriorPlacedItems7,
|
||||
InventoryType::HousingInteriorPlacedItems8,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
containerIds = {
|
||||
InventoryType::HousingInteriorStoreroom1,
|
||||
InventoryType::HousingInteriorStoreroom2,
|
||||
InventoryType::HousingInteriorStoreroom3,
|
||||
InventoryType::HousingInteriorStoreroom4,
|
||||
InventoryType::HousingInteriorStoreroom5,
|
||||
InventoryType::HousingInteriorStoreroom6,
|
||||
InventoryType::HousingInteriorStoreroom7,
|
||||
InventoryType::HousingInteriorStoreroom8,
|
||||
};
|
||||
}
|
||||
|
||||
// todo: perms check
|
||||
|
||||
auto invMgr = g_fw.get< Manager::InventoryMgr >();
|
||||
auto& containers = getEstateInventory( zone->getLandIdent() );
|
||||
|
||||
for( auto containerId : containerIds )
|
||||
{
|
||||
auto container = containers.find( containerId );
|
||||
if( container == containers.end() )
|
||||
break;
|
||||
|
||||
invMgr->sendInventoryContainer( player, container->second );
|
||||
}
|
||||
}
|
|
@ -114,6 +114,13 @@ namespace Sapphire::World::Manager
|
|||
*/
|
||||
void sendEstateInventory( Entity::Player& player, uint16_t inventoryType, uint8_t plotNum );
|
||||
|
||||
/*!
|
||||
* @brief Sends all the available internal inventories in one go. Used to initially populate the menu.
|
||||
* @param player The player to send the containers to
|
||||
* @param storeroom True if we should send the storeroom, false we send the placed items
|
||||
*/
|
||||
void sendInternalEstateInventoryBatch( Entity::Player& player, bool storeroom = false );
|
||||
|
||||
/*!
|
||||
* @brief Get the land & house data that was cached on world startup.
|
||||
* @return
|
||||
|
|
|
@ -440,17 +440,17 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
|
|||
}
|
||||
case ClientTriggerType::RequestEstateInventory:
|
||||
{
|
||||
// only sent if param1 is 1, because the client sends this with 0 when you open the ui for whatever reason
|
||||
if( param1 != 1 )
|
||||
return;
|
||||
|
||||
auto housingMgr = g_fw.get< HousingMgr >();
|
||||
if( !housingMgr )
|
||||
break;
|
||||
|
||||
// param1 = 1 - storeroom
|
||||
// param1 = 0 - placed items
|
||||
|
||||
|
||||
// housingMgr->sendHousingInventory( player, Common::InventoryType::HousingInd, 255 );
|
||||
if( param1 == 1 )
|
||||
housingMgr->sendInternalEstateInventoryBatch( player, true );
|
||||
else
|
||||
housingMgr->sendInternalEstateInventoryBatch( player );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue