mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-29 07:37:45 +00:00
partially fix inventory loading fuckery
This commit is contained in:
parent
66156a97ca
commit
1b097e4181
3 changed files with 42 additions and 1 deletions
|
@ -103,7 +103,7 @@ bool Sapphire::World::Manager::HousingMgr::loadEstateInventories()
|
||||||
item->setStain( stain );
|
item->setStain( stain );
|
||||||
// todo: need to set the owner character id on the item
|
// todo: need to set the owner character id on the item
|
||||||
|
|
||||||
ContainerIdToContainerMap estateInv = m_estateInventories[ ident ];
|
ContainerIdToContainerMap& estateInv = m_estateInventories[ ident ];
|
||||||
|
|
||||||
// check if containerId exists
|
// check if containerId exists
|
||||||
auto container = estateInv.find( containerId );
|
auto container = estateInv.find( containerId );
|
||||||
|
@ -661,3 +661,35 @@ Sapphire::World::Manager::HousingMgr::ContainerIdToContainerMap
|
||||||
|
|
||||||
getEstateInventory( u64ident );
|
getEstateInventory( u64ident );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::World::Manager::HousingMgr::updateHouseModels( Sapphire::HousePtr house )
|
||||||
|
{
|
||||||
|
assert( house );
|
||||||
|
|
||||||
|
auto getItemData = []( uint32_t itemId )
|
||||||
|
{
|
||||||
|
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||||
|
auto info = pExdData->get< Sapphire::Data::Item >( itemId );
|
||||||
|
return info->additionalData;
|
||||||
|
};
|
||||||
|
|
||||||
|
auto containers = getEstateInventory( house->getLandIdent() );
|
||||||
|
|
||||||
|
auto extContainer = containers.find( static_cast< uint16_t >( InventoryType::HousingOutdoorAppearance ) );
|
||||||
|
if( extContainer != containers.end() )
|
||||||
|
{
|
||||||
|
for( auto& item : extContainer->second->getItemMap() )
|
||||||
|
{
|
||||||
|
house->setHousePart( static_cast< Common::HousePartSlot >( item.first ), getItemData( item.second->getId() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto intContainer = containers.find( static_cast< uint16_t >( InventoryType::HousingInteriorAppearance ) );
|
||||||
|
if( intContainer != containers.end() )
|
||||||
|
{
|
||||||
|
for( auto& item : intContainer->second->getItemMap() )
|
||||||
|
{
|
||||||
|
house->setHouseInteriorPart( static_cast< Common::HousingInteriorSlot >( item.first ), getItemData( item.second->getId() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -91,6 +91,14 @@ namespace Sapphire::World::Manager
|
||||||
|
|
||||||
void sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident );
|
void sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Updates the cached models on a house from the relevant apperance inventories.
|
||||||
|
* Does not send the subsequent update to clients.
|
||||||
|
*
|
||||||
|
* @param house The house to update the models for
|
||||||
|
*/
|
||||||
|
void updateHouseModels( HousePtr house );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Sends the house inventory for the specified type to a player.
|
* @brief Sends the house inventory for the specified type to a player.
|
||||||
*
|
*
|
||||||
|
|
|
@ -85,6 +85,7 @@ bool Sapphire::HousingZone::init()
|
||||||
{
|
{
|
||||||
auto house = make_House( entry.m_houseId, m_landSetId, land->getLandIdent(), entry.m_estateName, entry.m_estateComment );
|
auto house = make_House( entry.m_houseId, m_landSetId, land->getLandIdent(), entry.m_estateName, entry.m_estateComment );
|
||||||
|
|
||||||
|
housingMgr->updateHouseModels( house );
|
||||||
land->setHouse( house );
|
land->setHouse( house );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue