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

estate greetings can be updated/set

This commit is contained in:
NotAdam 2018-11-28 21:59:28 +11:00
parent ebee5e854a
commit a271ee6d46
9 changed files with 68 additions and 9 deletions

View file

@ -304,7 +304,7 @@ namespace Core::Network::Packets
LinkshellEventHandler1 = 0x1151, // updated 4.1 ??
LandRenameHandler = 0x0171, // updated 4.4
LandChangeEstateMessageHandler = 0x0172, // updated 4.4
HousingUpdateHouseGreeting = 0x0172, // updated 4.4
SetSharedEstateSettings = 0x0177, // updated 4.4

View file

@ -199,14 +199,18 @@ struct FFXIVIpcInventoryModifyHandler :
struct FFXIVIpcRenameLandHandler :
FFXIVIpcBasePacket< LandRenameHandler >
{
/* 0000 */ uint16_t landId;
/* 0002 */ uint16_t wardNum;
/* 0004 */ uint16_t zoneId;
/* 0006 */ uint16_t worldId;
/* 0000 */ Common::LandIdent ident;
/* 0008 */ char houseName[20];
/* 0028 */ uint32_t padding;
};
struct FFXIVIpcHousingUpdateHouseGreeting :
FFXIVIpcBasePacket< HousingUpdateHouseGreeting >
{
/* 0000 */ Common::LandIdent ident;
/* 0008 */ char greeting[200];
};
struct FFXIVIpcBuildPresetHandler :
FFXIVIpcBasePacket< BuildPresetHandler >
{

View file

@ -1290,6 +1290,12 @@ void Core::Entity::Player::sendDebug( const std::string& message ) //Grey Text
queuePacket( std::make_shared< ChatPacket >( *getAsPlayer(), ChatType::ServerDebug, message ) );
}
void Core::Entity::Player::sendLogMessage( uint32_t messageId, uint32_t param2, uint32_t param3,
uint32_t param4, uint32_t param5, uint32_t param6 )
{
queuePacket( makeActorControl144( getId(), ActorControlType::LogMsg, messageId, param2, param3, param4, param5, param6 ) );
}
void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
{
uint8_t index = howToId / 8;

View file

@ -757,6 +757,8 @@ namespace Core::Entity
void sendDebug( const std::string& message );
void sendLogMessage( uint32_t messageId, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, uint32_t param5 = 0, uint32_t param6 = 0 );
bool isDirectorInitialized() const;
void setDirectorInitialized( bool isInitialized );

View file

@ -85,6 +85,9 @@ Core::Network::GameConnection::GameConnection( Core::Network::HivePtr pHive,
setZoneHandler( ClientZoneIpcType::BuildPresetHandler, "BuildPresetHandler", &GameConnection::buildPresetHandler );
setZoneHandler( ClientZoneIpcType::LandRenameHandler, "LandRenameHandler", &GameConnection::landRenameHandler );
setZoneHandler( ClientZoneIpcType::HousingUpdateHouseGreeting, "HousingUpdateHouseGreeting",
&GameConnection::housingUpdateGreetingHandler );
setZoneHandler( ClientZoneIpcType::TalkEventHandler, "EventHandlerTalk", &GameConnection::eventHandlerTalk );
setZoneHandler( ClientZoneIpcType::EmoteEventHandler, "EventHandlerEmote", &GameConnection::eventHandlerEmote );
setZoneHandler( ClientZoneIpcType::WithinRangeEventHandler, "EventHandlerWithinRange",
@ -225,7 +228,7 @@ void Core::Network::GameConnection::handleZonePacket( Core::Network::Packets::FF
else
{
pLog->debug( sessionStr + " Undefined Zone IPC : Unknown ( " +
Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" );
Util::intToHexString( static_cast< uint32_t >( opcode ), 4 ) + " )" );
pLog->debug(
"Dump:\n" + Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[ 0 ] ), pPacket.segHdr.size ) );
}

View file

@ -152,7 +152,7 @@ namespace Core::Network
DECLARE_HANDLER( cfRegisterRoulette );
DECLARE_HANDLER( cfDutyAccepted );
DECLARE_HANDLER( actionHandler );
DECLARE_HANDLER( gm1Handler );
@ -165,6 +165,8 @@ namespace Core::Network
DECLARE_HANDLER( landRenameHandler );
DECLARE_HANDLER( housingUpdateGreetingHandler );
DECLARE_HANDLER( buildPresetHandler );
DECLARE_HANDLER( tellHandler );

View file

@ -658,10 +658,15 @@ void Core::Network::GameConnection::landRenameHandler( const Core::Network::Pack
{
const auto packet = ZoneChannelPacket< Client::FFXIVIpcRenameLandHandler >( inPacket );
uint32_t landSetId = ( static_cast< uint32_t >( packet.data().zoneId ) << 16 ) | packet.data().wardNum;
auto pHousingMgr = g_fw.get< HousingMgr >();
auto pLand = pHousingMgr->getHousingZoneByLandSetId( landSetId )->getLand( packet.data().landId );
auto landSetId = pHousingMgr->toLandSetId( packet.data().ident.territoryTypeId, packet.data().ident.wardNum );
auto pZone = pHousingMgr->getHousingZoneByLandSetId( landSetId );
if( !pZone )
return;
auto pLand = pZone->getLand( packet.data().ident.landId );
if( !pLand )
return;
@ -689,3 +694,13 @@ void Core::Network::GameConnection::buildPresetHandler( const Core::Network::Pac
auto pHousingMgr = g_fw.get< HousingMgr >();
pHousingMgr->buildPresetEstate( player, packet.data().plotNum, packet.data().itemId );
}
void Core::Network::GameConnection::housingUpdateGreetingHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
Entity::Player& player )
{
const auto packet = ZoneChannelPacket< Client::FFXIVIpcHousingUpdateHouseGreeting >( inPacket );
auto pHousingMgr = g_fw.get< HousingMgr >();
pHousingMgr->updateEstateGreeting( player, packet.data().ident, std::string( packet.data().greeting ) );
}

View file

@ -374,3 +374,28 @@ void Core::HousingMgr::requestEstateEditGreeting( Entity::Player& player, uint16
player.queuePacket( estateGreetingPacket );
}
void Core::HousingMgr::updateEstateGreeting( Entity::Player& player, const Common::LandIdent& ident, const std::string& greeting )
{
auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum );
auto zone = getHousingZoneByLandSetId( landSetId );
if( !zone )
return;
auto land = zone->getLand( ident.landId );
if( !land )
return;
// todo: implement proper permissions checks
if( land->getPlayerOwner() != player.getId() )
return;
auto house = land->getHouse();
if( !house )
return;
house->setHouseGreeting( greeting );
player.sendLogMessage( 3381 );
}

View file

@ -37,7 +37,9 @@ namespace Core
void buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem );
void requestEstateRename( Entity::Player& player, uint16_t territoryTypeId, uint16_t worldId, uint8_t wardId, uint8_t plotId );
void requestEstateEditGreeting( Entity::Player& player, uint16_t territoryTypeId, uint16_t worldId, uint8_t wardId, uint8_t plotId );
void updateEstateGreeting( Entity::Player& player, const Common::LandIdent& ident, const std::string& greeting );
private: