1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 06:47:45 +00:00

house renaming works 🎉

This commit is contained in:
NotAdam 2018-11-28 00:05:57 +11:00
parent e24837629c
commit fee7ed381e
7 changed files with 54 additions and 13 deletions

View file

@ -204,6 +204,8 @@ namespace Core::Network::Packets
SharedEstateSettingsResponse = 0x023C, // updated 4.4 SharedEstateSettingsResponse = 0x023C, // updated 4.4
LandUpdateHouseName = 0x024D, // updated 4.4
LandSetMap = 0x0251, // updated 4.4 LandSetMap = 0x0251, // updated 4.4
////////////////////////////////////////////////// //////////////////////////////////////////////////

View file

@ -203,7 +203,7 @@ struct FFXIVIpcRenameLandHandler :
/* 0002 */ uint16_t wardNum; /* 0002 */ uint16_t wardNum;
/* 0004 */ uint16_t zoneId; /* 0004 */ uint16_t zoneId;
/* 0006 */ uint16_t worldId; /* 0006 */ uint16_t worldId;
/* 0008 */ char landName[20]; /* 0008 */ char houseName[20];
/* 0028 */ uint32_t padding; /* 0028 */ uint32_t padding;
}; };

View file

@ -1640,10 +1640,17 @@ struct FFXIVIpcLandInfoSign : FFXIVIpcBasePacket< LandInfoSign >
struct FFXIVIpcLandRename : FFXIVIpcBasePacket< LandRename > struct FFXIVIpcLandRename : FFXIVIpcBasePacket< LandRename >
{ {
Common::LandIdent landIdent; Common::LandIdent landIdent;
char landName[20]; char houseName[20];
uint32_t padding; uint32_t padding;
}; };
struct FFXIVIpcLandUpdateHouseName : FFXIVIpcBasePacket< LandUpdateHouseName >
{
uint32_t unknown[3];
char houseName[20];
uint32_t unknown2[2];
};
struct FFXIVIpcLandSetMap : FFXIVIpcBasePacket< LandSetMap > struct FFXIVIpcLandSetMap : FFXIVIpcBasePacket< LandSetMap >
{ {
uint8_t u1; uint8_t u1;

View file

@ -13,6 +13,7 @@
#include "Zone/HousingZone.h" #include "Zone/HousingZone.h"
#include "Zone/HousingMgr.h" #include "Zone/HousingMgr.h"
#include "Zone/Land.h" #include "Zone/Land.h"
#include "Zone/House.h"
#include "Network/GameConnection.h" #include "Network/GameConnection.h"
@ -365,7 +366,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
case ClientTriggerType::RequestEstateRename: case ClientTriggerType::RequestEstateRename:
{ {
// removed temporarly, there is no such thing as a LandName // removed temporarly, there is no such thing as a LandName
/* auto landRenamePacket = makeZonePacket< Server::FFXIVIpcLandRename >( player.getId() ); auto landRenamePacket = makeZonePacket< Server::FFXIVIpcLandRename >( player.getId() );
uint8_t ward = ( param12 & 0xFF00 ) >> 8; uint8_t ward = ( param12 & 0xFF00 ) >> 8;
uint8_t plot = ( param12 & 0xFF ); uint8_t plot = ( param12 & 0xFF );
@ -382,13 +383,17 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
land = pHousingMgr->getLandByOwnerId( player.getId() ); land = pHousingMgr->getLandByOwnerId( player.getId() );
} }
landRenamePacket->data().landId = land->getLandId(); auto house = land->getHouse();
landRenamePacket->data().wardNum = land->getWardNum(); if( !house )
landRenamePacket->data().worldId = 67; break;
landRenamePacket->data().zoneId = land->getZoneId();
memcpy( &landRenamePacket->data().landName, land->getLandName().c_str(), 20 );
player.queuePacket( landRenamePacket ); */ landRenamePacket->data().landIdent.landId = land->getLandId();
landRenamePacket->data().landIdent.wardNum = land->getWardNum();
landRenamePacket->data().landIdent.worldId = 67;
landRenamePacket->data().landIdent.territoryTypeId = land->getTerritoryTypeId();
memcpy( &landRenamePacket->data().houseName, house->getHouseName().c_str(), 20 );
player.queuePacket( landRenamePacket );
break; break;
} }

View file

@ -20,6 +20,7 @@
#include "Zone/HousingMgr.h" #include "Zone/HousingMgr.h"
#include "Zone/Land.h" #include "Zone/Land.h"
#include "Zone/ZonePosition.h" #include "Zone/ZonePosition.h"
#include "Zone/House.h"
#include "Network/PacketWrappers/InitUIPacket.h" #include "Network/PacketWrappers/InitUIPacket.h"
#include "Network/PacketWrappers/PingPacket.h" #include "Network/PacketWrappers/PingPacket.h"
@ -664,8 +665,20 @@ void Core::Network::GameConnection::landRenameHandler( const Core::Network::Pack
if( !pLand ) if( !pLand )
return; return;
// TODO set estate name // todo: check perms for fc houses and shit
//pLand->setLandName( packet.data().landName ); if( pLand->getPlayerOwner() != player.getId() )
return;
auto pHouse = pLand->getHouse();
if( pHouse )
pHouse->setHouseName( packet.data().houseName );
// todo: this packet is weird, retail sends it with some unknown shit at the start but it doesn't seem to do anything
auto nameUpdatePacket = makeZonePacket< Server::FFXIVIpcLandUpdateHouseName >( player.getId() );
memcpy( &nameUpdatePacket->data().houseName, &packet.data().houseName, sizeof( packet.data().houseName ) );
// todo: who does this get sent to? just the person who renamed it?
player.queuePacket( nameUpdatePacket );
} }
void Core::Network::GameConnection::buildPresetHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket, void Core::Network::GameConnection::buildPresetHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,

View file

@ -155,4 +155,18 @@ const std::string& Core::House::getHouseName() const
const std::string& Core::House::getHouseGreeting() const const std::string& Core::House::getHouseGreeting() const
{ {
return m_estateMessage; return m_estateMessage;
}
void Core::House::setHouseGreeting( const std::string& greeting )
{
m_estateMessage = greeting;
updateHouseDb();
}
void Core::House::setHouseName( const std::string& name )
{
m_houseName = name;
updateHouseDb();
} }

View file

@ -26,10 +26,10 @@ namespace Core
uint32_t getHouseId() const; uint32_t getHouseId() const;
const std::string& getHouseName() const; const std::string& getHouseName() const;
void setHouseName( std::string& name ); void setHouseName( const std::string& name );
const std::string& getHouseGreeting() const; const std::string& getHouseGreeting() const;
void setHouseGreeting( std::string& greeting ); void setHouseGreeting( const std::string& greeting );
//functions //functions
void setHousePart( Common::HousePartSlot slot, uint32_t id ); void setHousePart( Common::HousePartSlot slot, uint32_t id );