1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 15:47:46 +00:00

WiP Fix house inventory not working

This commit is contained in:
Mordred 2023-01-26 10:15:36 +01:00
parent 8565ad1cd5
commit a280f9c3b8
7 changed files with 22 additions and 27 deletions

View file

@ -578,13 +578,13 @@ bool HousingMgr::initHouseModels( Entity::Player& player, LandPtr land, uint32_t
auto itemMax = land->getInventoryItemMax(); auto itemMax = land->getInventoryItemMax();
// type, maxSize, tableName, isMultiStorage // type, maxSize, tableName, isMultiStorage
auto intContainer = make_ItemContainer( Common::InventoryType::HousingInteriorAppearance, itemMax.second, "houseiteminventory", true ); // auto intContainer = make_ItemContainer( Common::InventoryType::HousingInteriorAppearance, itemMax.second, "houseiteminventory", true );
auto extContainer = make_ItemContainer( Common::InventoryType::HousingExteriorAppearance, itemMax.first, "houseiteminventory", true ); // auto extContainer = make_ItemContainer( Common::InventoryType::HousingExteriorAppearance, itemMax.first, "houseiteminventory", true );
// add containers to inv collection // add containers to inv collection
auto& houseInventory = getEstateInventory( house->getLandIdent() ); auto& houseInventory = getEstateInventory( house->getLandIdent() );
houseInventory[ Common::InventoryType::HousingInteriorAppearance ] = intContainer; houseInventory[ Common::InventoryType::HousingInteriorAppearance ];// = intContainer;
houseInventory[ Common::InventoryType::HousingExteriorAppearance ] = extContainer; houseInventory[ Common::InventoryType::HousingExteriorAppearance ];// = extContainer;
auto& exdData = Common::Service< Sapphire::Data::ExdData >::ref(); auto& exdData = Common::Service< Sapphire::Data::ExdData >::ref();
auto preset = exdData.getRow< Excel::HousingPreset >( getItemAdditionalData( presetCatalogId ) ); auto preset = exdData.getRow< Excel::HousingPreset >( getItemAdditionalData( presetCatalogId ) );
@ -728,7 +728,7 @@ void HousingMgr::buildPresetEstate( Entity::Player& player, HousingZone& zone, u
player.setLandFlags( Common::LandFlagsSlot::Private, Common::HOUSING_LAND_STATUS::HOUSING_LAND_STATUS_BUILDHOUSE, ident ); player.setLandFlags( Common::LandFlagsSlot::Private, Common::HOUSING_LAND_STATUS::HOUSING_LAND_STATUS_BUILDHOUSE, ident );
player.sendLandFlagsSlot( Common::LandFlagsSlot::Private ); player.sendLandFlagsSlot( Common::LandFlagsSlot::Private );
//zone.registerEstateEntranceEObj( plotNum ); zone.registerEstateEntranceEObj( plotNum );
} }
void HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident ) void HousingMgr::requestEstateRename( Entity::Player& player, const Common::LandIdent ident )

View file

@ -25,8 +25,7 @@ using namespace Sapphire;
using namespace Sapphire::World::Manager; using namespace Sapphire::World::Manager;
TerritoryMgr::TerritoryMgr() : TerritoryMgr::TerritoryMgr() :
m_lastInstanceId( 10000 ), m_lastInstanceId( 10000 )
m_inRangeDistance( 0 )
{ {
} }
@ -66,11 +65,6 @@ bool TerritoryMgr::init()
return false; return false;
} }
auto& server = Common::Service< World::WorldServer >::ref();
auto& cfg = server.getConfig();
m_inRangeDistance = cfg.network.inRangeDistance;
return true; return true;
} }
@ -657,11 +651,6 @@ void TerritoryMgr::disableCurrentFestival()
setCurrentFestival( 0 ); setCurrentFestival( 0 );
} }
float TerritoryMgr::getInRangeDistance() const
{
return m_inRangeDistance;
}
void TerritoryMgr::createAndJoinQuestBattle( Entity::Player& player, uint16_t questBattleId ) void TerritoryMgr::createAndJoinQuestBattle( Entity::Player& player, uint16_t questBattleId )
{ {
auto qb = createQuestBattle( questBattleId ); auto qb = createQuestBattle( questBattleId );

View file

@ -155,8 +155,6 @@ namespace Sapphire::World::Manager
*/ */
const std::pair< uint16_t, uint16_t >& getCurrentFestival() const; const std::pair< uint16_t, uint16_t >& getCurrentFestival() const;
float getInRangeDistance() const;
private: private:
using TerritoryTypeDetailCache = std::unordered_map< uint16_t, std::shared_ptr< Excel::ExcelStruct< Excel::TerritoryType > > >; using TerritoryTypeDetailCache = std::unordered_map< uint16_t, std::shared_ptr< Excel::ExcelStruct< Excel::TerritoryType > > >;
using InstanceIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >; using InstanceIdToTerritoryPtrMap = std::unordered_map< uint32_t, TerritoryPtr >;
@ -201,9 +199,6 @@ namespace Sapphire::World::Manager
/*! current festival(s) to set for public zones from festival.exd */ /*! current festival(s) to set for public zones from festival.exd */
std::pair< uint16_t, uint16_t > m_currentFestival; std::pair< uint16_t, uint16_t > m_currentFestival;
/*! Max distance at which actors in range of a player are sent */
float m_inRangeDistance;
/*! Map used to find a contentFinderConditionID to a questBattle */ /*! Map used to find a contentFinderConditionID to a questBattle */
QuestBattleIdToContentFinderCondMap m_questBattleToContentFinderMap; QuestBattleIdToContentFinderCondMap m_questBattleToContentFinderMap;

View file

@ -34,7 +34,7 @@ Sapphire::HousingZone::HousingZone( uint8_t wardNum, uint16_t territoryTypeId,
m_wardNum( wardNum ), m_wardNum( wardNum ),
m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum ) m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum )
{ {
m_inRangeDistance = 3000;
} }
bool Sapphire::HousingZone::init() bool Sapphire::HousingZone::init()
@ -298,8 +298,9 @@ Sapphire::Entity::EventObjectPtr Sapphire::HousingZone::registerEstateEntranceEO
auto land = getLand( landId ); auto land = getLand( landId );
assert( land ); assert( land );
auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 0, 4, land->getMapMarkerPosition(), 0.f, "entrance", 0 ); auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 0, 4, FFXIVARR_POSITION3{ 0, 10, 0 }, 0.f, "entrance", 0 );
eObj->setHousingLink( static_cast< uint32_t >( landId ) << 8 ); eObj->setHousingLink( static_cast< uint32_t >( landId ) << 8 );
eObj->setGimmickId( static_cast< uint32_t >( landId ) << 8 );
eObj->setScale( 1.f ); eObj->setScale( 1.f );
addEObj( eObj ); addEObj( eObj );

View file

@ -76,7 +76,7 @@ namespace Sapphire
*/ */
using YardObjectArrayBoundsArray = std::array< YardObjectArrayBoundsPair, 60 >; using YardObjectArrayBoundsArray = std::array< YardObjectArrayBoundsPair, 60 >;
const uint32_t m_landSetMax = 18; const uint32_t m_landSetMax = 12;
LandPtrMap m_landPtrMap; LandPtrMap m_landPtrMap;
uint8_t m_wardNum; uint8_t m_wardNum;
uint32_t m_landSetId; uint32_t m_landSetId;

View file

@ -69,7 +69,8 @@ Territory::Territory( uint16_t territoryTypeId, uint32_t guId, const std::string
m_nextEObjId( START_EOBJ_ID ), m_nextEObjId( START_EOBJ_ID ),
m_nextActorId( START_GAMEOBJECT_ID ), m_nextActorId( START_GAMEOBJECT_ID ),
m_lastUpdate( 0 ), m_lastUpdate( 0 ),
m_lastActivityTime( Common::Util::getTimeMs() ) m_lastActivityTime( Common::Util::getTimeMs() ),
m_inRangeDistance( 80.f )
{ {
auto& exdData = Common::Service< Data::ExdData >::ref(); auto& exdData = Common::Service< Data::ExdData >::ref();
auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto& teriMgr = Common::Service< TerritoryMgr >::ref();
@ -656,6 +657,11 @@ void Territory::updateActorPosition( Entity::GameObject& actor )
} }
} }
float Territory::getInRangeDistance()
{
return m_inRangeDistance;
}
void Territory::updateInRangeSet( Entity::GameObjectPtr pActor, CellPtr pCell ) void Territory::updateInRangeSet( Entity::GameObjectPtr pActor, CellPtr pCell )
{ {
@ -669,7 +675,7 @@ void Territory::updateInRangeSet( Entity::GameObjectPtr pActor, CellPtr pCell )
auto iter = pCell->m_actors.begin(); auto iter = pCell->m_actors.begin();
float fRange = teriMgr.getInRangeDistance(); float fRange = getInRangeDistance();
int32_t count = 0; int32_t count = 0;
while( iter != pCell->m_actors.end() ) while( iter != pCell->m_actors.end() )
{ {

View file

@ -76,6 +76,8 @@ namespace Sapphire
Common::TerritoryIdent m_ident; Common::TerritoryIdent m_ident;
float m_inRangeDistance;
public: public:
Territory(); Territory();
@ -123,6 +125,8 @@ namespace Sapphire
virtual void onEventHandlerOrder( Entity::Player& player, uint32_t arg0, uint32_t arg1, uint32_t arg2, virtual void onEventHandlerOrder( Entity::Player& player, uint32_t arg0, uint32_t arg1, uint32_t arg2,
uint32_t arg3, uint32_t arg4 ); uint32_t arg3, uint32_t arg4 );
virtual float getInRangeDistance();
Common::Weather getNextWeather(); Common::Weather getNextWeather();
void pushActor( const Entity::GameObjectPtr& pActor ); void pushActor( const Entity::GameObjectPtr& pActor );