mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
cleanup container lists in housingmgr
This commit is contained in:
parent
a0616207a3
commit
6fb1f90b46
2 changed files with 34 additions and 38 deletions
|
@ -46,6 +46,30 @@ Sapphire::World::Manager::HousingMgr::HousingMgr()
|
||||||
m_containerMap[ 5 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
m_containerMap[ 5 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||||
m_containerMap[ 6 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
m_containerMap[ 6 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||||
m_containerMap[ 7 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
m_containerMap[ 7 ] = std::make_pair( InventoryType::HousingInteriorPlacedItems1, InventoryType::HousingInteriorStoreroom1 );
|
||||||
|
|
||||||
|
m_internalPlacedItemContainers =
|
||||||
|
{
|
||||||
|
InventoryType::HousingInteriorPlacedItems1,
|
||||||
|
InventoryType::HousingInteriorPlacedItems2,
|
||||||
|
InventoryType::HousingInteriorPlacedItems3,
|
||||||
|
InventoryType::HousingInteriorPlacedItems4,
|
||||||
|
InventoryType::HousingInteriorPlacedItems5,
|
||||||
|
InventoryType::HousingInteriorPlacedItems6,
|
||||||
|
InventoryType::HousingInteriorPlacedItems7,
|
||||||
|
InventoryType::HousingInteriorPlacedItems8,
|
||||||
|
};
|
||||||
|
|
||||||
|
m_internalStoreroomContainers =
|
||||||
|
{
|
||||||
|
InventoryType::HousingInteriorStoreroom1,
|
||||||
|
InventoryType::HousingInteriorStoreroom2,
|
||||||
|
InventoryType::HousingInteriorStoreroom3,
|
||||||
|
InventoryType::HousingInteriorStoreroom4,
|
||||||
|
InventoryType::HousingInteriorStoreroom5,
|
||||||
|
InventoryType::HousingInteriorStoreroom6,
|
||||||
|
InventoryType::HousingInteriorStoreroom7,
|
||||||
|
InventoryType::HousingInteriorStoreroom8,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::World::Manager::HousingMgr::~HousingMgr() = default;
|
Sapphire::World::Manager::HousingMgr::~HousingMgr() = default;
|
||||||
|
@ -1034,17 +1058,6 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
||||||
{
|
{
|
||||||
auto invMgr = g_fw.get< InventoryMgr >();
|
auto invMgr = g_fw.get< InventoryMgr >();
|
||||||
|
|
||||||
auto containerIds = {
|
|
||||||
InventoryType::HousingInteriorPlacedItems1,
|
|
||||||
InventoryType::HousingInteriorPlacedItems2,
|
|
||||||
InventoryType::HousingInteriorPlacedItems3,
|
|
||||||
InventoryType::HousingInteriorPlacedItems4,
|
|
||||||
InventoryType::HousingInteriorPlacedItems5,
|
|
||||||
InventoryType::HousingInteriorPlacedItems6,
|
|
||||||
InventoryType::HousingInteriorPlacedItems7,
|
|
||||||
InventoryType::HousingInteriorPlacedItems8,
|
|
||||||
};
|
|
||||||
|
|
||||||
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( player.getCurrentZone() );
|
||||||
assert( zone );
|
assert( zone );
|
||||||
|
|
||||||
|
@ -1052,7 +1065,7 @@ bool Sapphire::World::Manager::HousingMgr::placeInteriorItem( Entity::Player& pl
|
||||||
|
|
||||||
// find first free container
|
// find first free container
|
||||||
uint8_t containerIdx = 0;
|
uint8_t containerIdx = 0;
|
||||||
for( auto containerId : containerIds )
|
for( auto containerId : m_internalPlacedItemContainers )
|
||||||
{
|
{
|
||||||
auto& container = getEstateInventory( ident )[ containerId ];
|
auto& container = getEstateInventory( ident )[ containerId ];
|
||||||
|
|
||||||
|
@ -1104,34 +1117,12 @@ void Sapphire::World::Manager::HousingMgr::sendInternalEstateInventoryBatch( Sap
|
||||||
if( !zone )
|
if( !zone )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::vector< uint16_t > containerIds;
|
InventoryTypeList containerIds;
|
||||||
|
|
||||||
if( !storeroom )
|
if( storeroom )
|
||||||
{
|
containerIds = m_internalStoreroomContainers;
|
||||||
containerIds = {
|
|
||||||
InventoryType::HousingInteriorPlacedItems1,
|
|
||||||
InventoryType::HousingInteriorPlacedItems2,
|
|
||||||
InventoryType::HousingInteriorPlacedItems3,
|
|
||||||
InventoryType::HousingInteriorPlacedItems4,
|
|
||||||
InventoryType::HousingInteriorPlacedItems5,
|
|
||||||
InventoryType::HousingInteriorPlacedItems6,
|
|
||||||
InventoryType::HousingInteriorPlacedItems7,
|
|
||||||
InventoryType::HousingInteriorPlacedItems8,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
containerIds = m_internalPlacedItemContainers;
|
||||||
containerIds = {
|
|
||||||
InventoryType::HousingInteriorStoreroom1,
|
|
||||||
InventoryType::HousingInteriorStoreroom2,
|
|
||||||
InventoryType::HousingInteriorStoreroom3,
|
|
||||||
InventoryType::HousingInteriorStoreroom4,
|
|
||||||
InventoryType::HousingInteriorStoreroom5,
|
|
||||||
InventoryType::HousingInteriorStoreroom6,
|
|
||||||
InventoryType::HousingInteriorStoreroom7,
|
|
||||||
InventoryType::HousingInteriorStoreroom8,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo: perms check
|
// todo: perms check
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ namespace Sapphire::World::Manager
|
||||||
*/
|
*/
|
||||||
using LandIdentToInventoryContainerMap = std::unordered_map< uint64_t, ContainerIdToContainerMap >;
|
using LandIdentToInventoryContainerMap = std::unordered_map< uint64_t, ContainerIdToContainerMap >;
|
||||||
|
|
||||||
|
using InventoryTypeList = std::vector< Common::InventoryType >;
|
||||||
|
|
||||||
HousingMgr();
|
HousingMgr();
|
||||||
virtual ~HousingMgr();
|
virtual ~HousingMgr();
|
||||||
|
|
||||||
|
@ -228,6 +230,9 @@ namespace Sapphire::World::Manager
|
||||||
LandSetLandCacheMap m_landCache;
|
LandSetLandCacheMap m_landCache;
|
||||||
LandIdentToInventoryContainerMap m_estateInventories;
|
LandIdentToInventoryContainerMap m_estateInventories;
|
||||||
|
|
||||||
|
InventoryTypeList m_internalPlacedItemContainers;
|
||||||
|
InventoryTypeList m_internalStoreroomContainers;
|
||||||
|
|
||||||
std::array< std::pair< Common::InventoryType, Common::InventoryType >, 8 > m_containerMap;
|
std::array< std::pair< Common::InventoryType, Common::InventoryType >, 8 > m_containerMap;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue