mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-24 13:47:46 +00:00
houses now correctly build and send landupdate/show on login
This commit is contained in:
parent
b6f7beb61f
commit
111c2bb08c
5 changed files with 62 additions and 32 deletions
|
@ -1607,7 +1607,7 @@ struct LandStruct
|
||||||
uint32_t fcIcon;// 12
|
uint32_t fcIcon;// 12
|
||||||
uint32_t fcIconColor; // 16
|
uint32_t fcIconColor; // 16
|
||||||
uint16_t housePart[ 8 ]; // 34
|
uint16_t housePart[ 8 ]; // 34
|
||||||
uint8_t color[ 8 ]; // 36
|
uint8_t houseColour[ 8 ]; // 36
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FFXIVIpcLandUpdate : FFXIVIpcBasePacket< LandUpdate >
|
struct FFXIVIpcLandUpdate : FFXIVIpcBasePacket< LandUpdate >
|
||||||
|
|
|
@ -67,20 +67,25 @@ uint32_t Core::House::getHouseId() const
|
||||||
|
|
||||||
uint8_t Core::House::getHousePartColor( Common::HousePartSlot slot ) const
|
uint8_t Core::House::getHousePartColor( Common::HousePartSlot slot ) const
|
||||||
{
|
{
|
||||||
return m_housePartsColor[ slot ];
|
return std::get< 1 >( m_houseParts[ slot ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::House::setHousePart( Common::HousePartSlot slot, uint32_t id )
|
void Core::House::setHousePart( Common::HousePartSlot slot, uint32_t id )
|
||||||
{
|
{
|
||||||
m_houseParts[ slot ] = id;
|
std::get< 0 >( m_houseParts[ slot ] ) = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::House::setHousePartColor( Common::HousePartSlot slot, uint32_t id )
|
void Core::House::setHousePartColor( Common::HousePartSlot slot, uint32_t id )
|
||||||
{
|
{
|
||||||
m_housePartsColor[ slot ] = id;
|
std::get< 1 >( m_houseParts[ slot ] ) = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Core::House::getHousePart( Common::HousePartSlot slot ) const
|
uint32_t Core::House::getHousePart( Common::HousePartSlot slot ) const
|
||||||
{
|
{
|
||||||
return m_houseParts[ slot ];
|
return std::get< 0 >( m_houseParts[ slot ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::House::HousePartsArray const& Core::House::getHouseParts() const
|
||||||
|
{
|
||||||
|
return m_houseParts;
|
||||||
}
|
}
|
|
@ -11,11 +11,13 @@ namespace Core
|
||||||
|
|
||||||
class House
|
class House
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
House( uint32_t houseId, uint32_t landSetId, uint8_t landId, uint8_t wardNum, uint16_t territoryTypeId );
|
House( uint32_t houseId, uint32_t landSetId, uint8_t landId, uint8_t wardNum, uint16_t territoryTypeId );
|
||||||
virtual ~House();
|
virtual ~House();
|
||||||
|
|
||||||
|
using HousePart = std::tuple< uint32_t, uint8_t >;
|
||||||
|
using HousePartsArray = std::array< HousePart, 8 >;
|
||||||
|
|
||||||
//gerneral
|
//gerneral
|
||||||
uint32_t getLandSetId() const;
|
uint32_t getLandSetId() const;
|
||||||
uint8_t getLandId() const;
|
uint8_t getLandId() const;
|
||||||
|
@ -29,6 +31,8 @@ namespace Core
|
||||||
uint32_t getHousePart( Common::HousePartSlot slot ) const;
|
uint32_t getHousePart( Common::HousePartSlot slot ) const;
|
||||||
uint8_t getHousePartColor( Common::HousePartSlot slot ) const;
|
uint8_t getHousePartColor( Common::HousePartSlot slot ) const;
|
||||||
|
|
||||||
|
HousePartsArray const& getHouseParts() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_landSetId;
|
uint32_t m_landSetId;
|
||||||
uint8_t m_landId;
|
uint8_t m_landId;
|
||||||
|
@ -36,8 +40,7 @@ namespace Core
|
||||||
uint16_t m_territoryTypeId;
|
uint16_t m_territoryTypeId;
|
||||||
uint32_t m_houseId;
|
uint32_t m_houseId;
|
||||||
|
|
||||||
uint32_t m_houseParts[ 8 ];
|
HousePartsArray m_houseParts;
|
||||||
uint8_t m_housePartsColor[ 8 ];
|
|
||||||
|
|
||||||
char m_commentMsg[ 193 ];
|
char m_commentMsg[ 193 ];
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,13 +127,30 @@ void Core::HousingZone::sendLandSet( Entity::Player& player )
|
||||||
for( uint8_t i = startIndex, count = 0; i < ( startIndex + 30 ); ++i, ++count )
|
for( uint8_t i = startIndex, count = 0; i < ( startIndex + 30 ); ++i, ++count )
|
||||||
{
|
{
|
||||||
auto pLand = getLand( i );
|
auto pLand = getLand( i );
|
||||||
landsetInitializePacket->data().land[ count ].plotSize = pLand->getSize();
|
|
||||||
landsetInitializePacket->data().land[ count ].houseState = pLand->getState();
|
// todo: move this and sendLandUpdate building logic to its own function
|
||||||
landsetInitializePacket->data().land[ count ].type = static_cast< uint8_t >( pLand->getLandType() );
|
auto& landData = landsetInitializePacket->data().land[ count ];
|
||||||
landsetInitializePacket->data().land[ count ].iconAddIcon = pLand->getSharing();
|
|
||||||
landsetInitializePacket->data().land[ count ].fcId = pLand->getFcId();
|
landData.plotSize = pLand->getSize();
|
||||||
landsetInitializePacket->data().land[ count ].fcIcon = pLand->getFcIcon();
|
landData.houseState = pLand->getState();
|
||||||
landsetInitializePacket->data().land[ count ].fcIconColor = pLand->getFcColor();
|
landData.type = static_cast< uint8_t >( pLand->getLandType() );
|
||||||
|
landData.iconAddIcon = pLand->getSharing();
|
||||||
|
landData.fcId = pLand->getFcId();
|
||||||
|
landData.fcIcon = pLand->getFcIcon();
|
||||||
|
landData.fcIconColor = pLand->getFcColor();
|
||||||
|
|
||||||
|
if( auto house = pLand->getHouse() )
|
||||||
|
{
|
||||||
|
auto& parts = house->getHouseParts();
|
||||||
|
|
||||||
|
for( auto i = 0; i != parts.size(); i++ )
|
||||||
|
{
|
||||||
|
auto [ part, colour ] = parts[ i ];
|
||||||
|
|
||||||
|
landData.housePart[ i ] = part;
|
||||||
|
landData.houseColour[ i ] = colour;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.queuePacket( landsetInitializePacket );
|
player.queuePacket( landsetInitializePacket );
|
||||||
|
@ -148,23 +165,28 @@ void Core::HousingZone::sendLandUpdate( uint8_t landId )
|
||||||
|
|
||||||
auto landUpdatePacket = makeZonePacket< FFXIVIpcLandUpdate >( pPlayer->getId() );
|
auto landUpdatePacket = makeZonePacket< FFXIVIpcLandUpdate >( pPlayer->getId() );
|
||||||
landUpdatePacket->data().landId = landId;
|
landUpdatePacket->data().landId = landId;
|
||||||
landUpdatePacket->data().land.plotSize = pLand->getSize();
|
|
||||||
landUpdatePacket->data().land.houseState = pLand->getState();
|
auto& landData = landUpdatePacket->data().land;
|
||||||
landUpdatePacket->data().land.type = 0;
|
|
||||||
landUpdatePacket->data().land.iconAddIcon = pLand->getSharing();
|
landData.plotSize = pLand->getSize();
|
||||||
landUpdatePacket->data().land.fcId = pLand->getFcId();
|
landData.houseState = pLand->getState();
|
||||||
landUpdatePacket->data().land.fcIcon = pLand->getFcIcon();
|
landData.type = static_cast< uint8_t >( pLand->getLandType() );
|
||||||
landUpdatePacket->data().land.fcIconColor = pLand->getFcColor();
|
landData.iconAddIcon = pLand->getSharing();
|
||||||
|
landData.fcId = pLand->getFcId();
|
||||||
|
landData.fcIcon = pLand->getFcIcon();
|
||||||
|
landData.fcIconColor = pLand->getFcColor();
|
||||||
|
|
||||||
|
|
||||||
if( auto house = pLand->getHouse() )
|
if( auto house = pLand->getHouse() )
|
||||||
{
|
{
|
||||||
// todo: this is retarded, need a getter to the internal array
|
auto& parts = house->getHouseParts();
|
||||||
for( int i = 0; i < 8; i++ )
|
|
||||||
{
|
|
||||||
auto slot = static_cast< Common::HousePartSlot >( i );
|
|
||||||
auto part = pLand->getHouse()->getHousePart( slot );
|
|
||||||
|
|
||||||
landUpdatePacket->data().land.housePart[ slot ] = part;
|
for( auto i = 0; i != parts.size(); i++ )
|
||||||
|
{
|
||||||
|
auto [ part, colour ] = parts[ i ];
|
||||||
|
|
||||||
|
landData.housePart[ i ] = part;
|
||||||
|
landData.houseColour[ i ] = colour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,10 +306,10 @@ bool Core::Land::setPreset( uint32_t itemId )
|
||||||
m_pHouse = make_House( newId, getLandSetId(), getLandId(), getWardNum(), getTerritoryTypeId() );
|
m_pHouse = make_House( newId, getLandSetId(), getLandId(), getWardNum(), getTerritoryTypeId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
getHouse()->setHousePart( Common::HousePartSlot::ExteriorRoof, housingPreset->exteriorRoof );
|
getHouse()->setHousePart( Common::HousePartSlot::ExteriorRoof, convertItemIdToHousingItemId( housingPreset->exteriorRoof ) );
|
||||||
getHouse()->setHousePart( Common::HousePartSlot::ExteriorWall, housingPreset->exteriorWall );
|
getHouse()->setHousePart( Common::HousePartSlot::ExteriorWall, convertItemIdToHousingItemId( housingPreset->exteriorWall ) );
|
||||||
getHouse()->setHousePart( Common::HousePartSlot::ExteriorWindow, housingPreset->exteriorWindow );
|
getHouse()->setHousePart( Common::HousePartSlot::ExteriorWindow, convertItemIdToHousingItemId( housingPreset->exteriorWindow ) );
|
||||||
getHouse()->setHousePart( Common::HousePartSlot::ExteriorDoor, housingPreset->exteriorDoor );
|
getHouse()->setHousePart( Common::HousePartSlot::ExteriorDoor, convertItemIdToHousingItemId( housingPreset->exteriorDoor ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue