mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 00:27:44 +00:00
show house greetings on ward selection ui
This commit is contained in:
parent
2c89d7923d
commit
ed3ada4020
4 changed files with 63 additions and 4 deletions
|
@ -864,7 +864,7 @@ namespace Sapphire::Common
|
|||
{
|
||||
IsEstateOwned = 1,
|
||||
IsPublicEstate = 2,
|
||||
HasEstateMessage = 4,
|
||||
HasEstateGreeting = 4,
|
||||
EstateFlagUnknown = 8,
|
||||
IsFreeCompanyEstate = 16,
|
||||
};
|
||||
|
|
|
@ -244,6 +244,9 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
|||
wardInfoPacket->data().landIdent.wardNum = wardId;
|
||||
wardInfoPacket->data().landIdent.territoryTypeId = territoryTypeId;
|
||||
|
||||
// todo: properly get worldId
|
||||
wardInfoPacket->data().landIdent.worldId = 67;
|
||||
|
||||
for( int i = 0; i < 60; i++ )
|
||||
{
|
||||
auto land = hZone->getLand( i );
|
||||
|
@ -258,20 +261,26 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
|||
if( land->getState() == Common::HouseState::forSale )
|
||||
continue;
|
||||
|
||||
if( auto house = land->getHouse() )
|
||||
{
|
||||
if( !house->getHouseGreeting().empty() )
|
||||
entry.infoFlags |= WardlandFlags::HasEstateGreeting;
|
||||
}
|
||||
|
||||
switch( land->getLandType() )
|
||||
{
|
||||
case LandType::FreeCompany:
|
||||
entry.infoFlags = Common::WardlandFlags::IsEstateOwned | Common::WardlandFlags::IsFreeCompanyEstate;
|
||||
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned | Common::WardlandFlags::IsFreeCompanyEstate;
|
||||
|
||||
// todo: send FC name
|
||||
|
||||
break;
|
||||
|
||||
case LandType::Private:
|
||||
entry.infoFlags = Common::WardlandFlags::IsEstateOwned;
|
||||
entry.infoFlags |= Common::WardlandFlags::IsEstateOwned;
|
||||
|
||||
auto owner = land->getPlayerOwner();
|
||||
std::string playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( owner );
|
||||
auto playerName = g_fw.get< Sapphire::ServerMgr >()->getPlayerNameFromDb( owner );
|
||||
memcpy( &entry.estateOwnerName, playerName.c_str(), playerName.size() );
|
||||
|
||||
break;
|
||||
|
@ -284,6 +293,32 @@ void Sapphire::World::Manager::HousingMgr::sendWardLandInfo( Entity::Player& pla
|
|||
player.queuePacket( wardInfoPacket );
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident )
|
||||
{
|
||||
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum );
|
||||
auto hZone = getHousingZoneByLandSetId( landSetId );
|
||||
|
||||
if( !hZone )
|
||||
return;
|
||||
|
||||
auto land = hZone->getLand( ident.landId );
|
||||
if( !land )
|
||||
return;
|
||||
|
||||
auto house = land->getHouse();
|
||||
if( !house )
|
||||
return;
|
||||
|
||||
auto greetingPacket = makeZonePacket< FFXIVIpcHousingEstateGreeting >( player.getId() );
|
||||
|
||||
greetingPacket->data().landIdent = ident;
|
||||
|
||||
auto greeting = house->getHouseGreeting();
|
||||
memcpy( &greetingPacket->data().message, greeting.c_str(), greeting.size() );
|
||||
|
||||
player.queuePacket( greetingPacket );
|
||||
}
|
||||
|
||||
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem )
|
||||
{
|
||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace Sapphire::World::Manager
|
|||
|
||||
void requestEstateEditGuestAccess( Entity::Player& player, uint16_t territoryTypeId, uint16_t worldId, uint8_t wardId, uint8_t plotId );
|
||||
|
||||
void sendEstateGreeting( Entity::Player& player, const Common::LandIdent ident );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -427,6 +427,28 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
|
|||
|
||||
break;
|
||||
}
|
||||
case ClientTriggerType::RequestEstateGreeting:
|
||||
{
|
||||
uint16_t territoryTypeId = param11 & 0xFFFF;
|
||||
uint16_t worldId = param11 >> 16;
|
||||
|
||||
uint8_t ward = ( param12 >> 16 ) & 0xFF;
|
||||
uint8_t plot = ( param12 & 0xFF );
|
||||
|
||||
auto housingMgr = g_fw.get< HousingMgr >();
|
||||
if( !housingMgr )
|
||||
break;
|
||||
|
||||
Common::LandIdent ident;
|
||||
ident.territoryTypeId = territoryTypeId;
|
||||
ident.worldId = worldId;
|
||||
ident.wardNum = ward;
|
||||
ident.landId = plot;
|
||||
|
||||
housingMgr->sendEstateGreeting( player, ident );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue