1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

handle fc doors properly

This commit is contained in:
NotAdam 2018-12-31 22:02:34 +11:00
parent a04d01be90
commit 1c890a43bf
4 changed files with 20 additions and 15 deletions

View file

@ -869,10 +869,10 @@ namespace Sapphire::Common
enum HouseStatus : uint8_t
{
none,
HouseForSale,
HouseSold,
HousePrivateEstate,
HouseFreeCompanyEstate,
ForSale,
Sold,
PrivateEstate,
FreeCompanyEstate,
};
enum HouseIconAdd : uint8_t

View file

@ -365,7 +365,7 @@ Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand(
if( !pLand )
return LandPurchaseResult::ERR_INTERNAL;
if( pLand->getStatus() != HouseStatus::HouseForSale )
if( pLand->getStatus() != HouseStatus::ForSale )
return LandPurchaseResult::ERR_NOT_AVAILABLE;
if( gilAvailable < plotPrice )
@ -388,7 +388,7 @@ Sapphire::LandPurchaseResult Sapphire::World::Manager::HousingMgr::purchaseLand(
player.removeCurrency( CurrencyType::Gil, plotPrice );
pLand->setOwnerId( player.getId() );
pLand->setStatus( HouseStatus::HouseSold );
pLand->setStatus( HouseStatus::Sold );
pLand->setLandType( Common::LandType::Private );
player.setLandFlags( LandFlagsSlot::Private, 0x00, pLand->getLandIdent() );
@ -437,7 +437,7 @@ bool Sapphire::World::Manager::HousingMgr::relinquishLand( Entity::Player& playe
pLand->setCurrentPrice( pLand->getMaxPrice() );
pLand->setOwnerId( 0 );
pLand->setStatus( HouseStatus::HouseForSale );
pLand->setStatus( HouseStatus::ForSale );
pLand->setLandType( Common::LandType::none );
pLand->updateLandDb();
@ -477,11 +477,11 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
auto& entry = wardInfoPacket->data().houseInfoEntry[ i ];
// retail always sends the house price in this packet, even after the house has been HouseSold
// retail always sends the house price in this packet, even after the house has been Sold
// so I guess we do the same
entry.housePrice = land->getCurrentPrice();
if( land->getStatus() == Common::HouseStatus::HouseForSale )
if( land->getStatus() == Common::HouseStatus::ForSale )
continue;
if( auto house = land->getHouse() )
@ -682,7 +682,7 @@ void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& pl
createHouse( house );
pLand->setStatus( HouseStatus::HousePrivateEstate );
pLand->setStatus( HouseStatus::PrivateEstate );
pLand->setLandType( LandType::Private );
hZone->sendLandUpdate( plotNum );

View file

@ -76,14 +76,19 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone
player.queuePacket( indoorInitPacket );
bool isFcHouse = pLand->getStatus() == Common::HouseStatus::PrivateEstate;
auto yardPacketTotal = static_cast< uint8_t >( 2 + pLand->getSize() );
for( uint8_t yardPacketNum = 0; yardPacketNum < yardPacketTotal; yardPacketNum++ )
{
auto objectInitPacket = makeZonePacket< Server::FFXIVIpcHousingObjectInitialize >( player.getId() );
memcpy( &objectInitPacket->data().landIdent, &m_landIdent, sizeof( Common::LandIdent ) );
// todo: change this when FC houses become a thing
objectInitPacket->data().u1 = 2; // 2 = actrl 0x400 will hide the fc door, otherwise it will stay there
if( isFcHouse )
objectInitPacket->data().u1 = 2; // 2 = actrl 0x400 will hide the fc door, otherwise it will stay there
else
objectInitPacket->data().u1 = 0;
objectInitPacket->data().u2 = 100;
objectInitPacket->data().packetNum = yardPacketNum;
objectInitPacket->data().packetTotal = yardPacketTotal;
@ -94,8 +99,8 @@ void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onPlayerZone
player.queuePacket( objectInitPacket );
}
// todo: if in fc house, don't send this
player.queuePacket( Server::makeActorControl143( player.getId(), Network::ActorControl::HideAdditionalChambersDoor ) );
if( isFcHouse )
player.queuePacket( Server::makeActorControl143( player.getId(), Network::ActorControl::HideAdditionalChambersDoor ) );
}
void Sapphire::World::Territory::Housing::HousingInteriorTerritory::onUpdate( uint32_t currTime )

View file

@ -227,7 +227,7 @@ void Sapphire::Land::updateLandDb()
void Sapphire::Land::update( uint32_t currTime )
{
if( getStatus() == HouseStatus::HouseForSale )
if( getStatus() == HouseStatus::ForSale )
{
if( m_nextDrop < currTime && m_minPrice < m_currentPrice )
{