diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index f8e2d538..1fbcbb4e 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -1676,7 +1676,7 @@ void Player::setLandFlags( uint8_t flagSlot, uint32_t landFlags, Common::LandIde auto& server = Common::Service< World::WorldServer >::ref(); m_charaLandData[ flagSlot ].landId = ident; - m_charaLandData[ flagSlot ].landId.worldId = server.getWorldId(); + m_charaLandData[ flagSlot ].landId.worldId = static_cast< int16_t >( server.getWorldId() ); m_charaLandData[ flagSlot ].landFlags = landFlags; } diff --git a/src/world/Territory/HousingZone.cpp b/src/world/Territory/HousingZone.cpp index 3f60b6ff..3c5f72e0 100644 --- a/src/world/Territory/HousingZone.cpp +++ b/src/world/Territory/HousingZone.cpp @@ -19,9 +19,13 @@ #include "Inventory/ItemContainer.h" #include "WorldServer.h" +#include +#include + #include "Forwards.h" #include "HousingZone.h" #include "Manager/HousingMgr.h" +#include "InstanceObjectCache.h" using namespace Sapphire::Common; using namespace Sapphire::Network::Packets; @@ -34,7 +38,6 @@ Sapphire::HousingZone::HousingZone( uint8_t wardNum, uint16_t territoryTypeId, m_wardNum( wardNum ), m_landSetId( ( static_cast< uint32_t >( territoryTypeId ) << 16 ) | wardNum ) { - m_inRangeDistance = 3000; } bool Sapphire::HousingZone::init() @@ -57,8 +60,6 @@ bool Sapphire::HousingZone::init() housingIndex = 1; else if( m_territoryTypeId == 341 ) housingIndex = 2; - else if( m_territoryTypeId == 641 ) - housingIndex = 3; auto& exdData = Common::Service< Data::ExdData >::ref(); auto info = exdData.getRow< Excel::HousingLandSet >( housingIndex ); @@ -298,7 +299,34 @@ Sapphire::Entity::EventObjectPtr Sapphire::HousingZone::registerEstateEntranceEO auto land = getLand( landId ); assert( land ); - auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 0, 0, FFXIVARR_POSITION3{ 0, 10, 0 }, 0.f, "entrance", 0 ); + int housingIndex; + if( m_territoryTypeId == 339 ) + housingIndex = 0; + else if( m_territoryTypeId == 340 ) + housingIndex = 1; + else if( m_territoryTypeId == 341 ) + housingIndex = 2; + + auto& exdData = Common::Service< Data::ExdData >::ref(); + auto info = exdData.getRow< Excel::HousingLandSet >( housingIndex ); + + auto landInfo = info->_data.Lands[ landId ]; + auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref(); + + FFXIVARR_POSITION3 pos{ 0, 10, 0 }; + auto eObjInfo = instanceObjectCache.getEObj( landInfo.SignboardEObj ); + if( eObjInfo ) + { + pos.x = eObjInfo->data.transform.translation.x; + pos.y = eObjInfo->data.transform.translation.y; + pos.z = eObjInfo->data.transform.translation.z; + } + else + { + Logger::error( "No position could be determined for housing entrance!" ); + } + + auto eObj = Entity::make_EventObject( getNextEObjId(), 2002737, 0, 0, 0, pos, 0.f, "entrance", 0 ); eObj->setHousingLink( static_cast< uint32_t >( landId ) ); eObj->setScale( 1.f ); diff --git a/src/world/Territory/InstanceObjectCache.cpp b/src/world/Territory/InstanceObjectCache.cpp index a61f9da4..71d418bc 100644 --- a/src/world/Territory/InstanceObjectCache.cpp +++ b/src/world/Territory/InstanceObjectCache.cpp @@ -97,6 +97,7 @@ Sapphire::InstanceObjectCache::InstanceObjectCache() } else if( pEntry->getType() == LgbEntryType::PopRange ) { + auto pPopRange = std::reinterpret_pointer_cast< LGB_POP_RANGE_ENTRY >( pEntry ); m_popRangeCache.insert( id, pPopRange ); }