1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 15:47:46 +00:00

Fixed sign structure and lookup of owner name

This commit is contained in:
Mordred 2018-11-13 00:03:09 +01:00
parent c7c586d3fb
commit abc0960e03
7 changed files with 40 additions and 29 deletions

View file

@ -761,7 +761,7 @@ namespace Core::Common
//Structs //Structs
struct LandStruct struct LandStruct
{ {
uint8_t houseSize; //0 uint8_t plotSize; //0
uint8_t houseState; // 2 uint8_t houseState; // 2
uint8_t iconColor; // 4 uint8_t iconColor; // 4
uint8_t iconAddIcon; // 6 uint8_t iconAddIcon; // 6

View file

@ -1617,16 +1617,13 @@ struct FFXIVIpcLandInfoSign : FFXIVIpcBasePacket< LandInfoSign >
uint16_t wardNum; uint16_t wardNum;
uint16_t zoneId; uint16_t zoneId;
uint16_t worldId; uint16_t worldId;
uint32_t ownerId; uint64_t ownerId; // ither contentId or fcId
uint16_t someState1;//private 0x0 : fc 0x17 uint32_t unknow1;
uint8_t someState2;//private 0x21 : fc 0x40
uint8_t someState3; //private 0x80 : fc 0
uint32_t unknow1; //seems like not always 0 (6 of 5 times 0, one time it was 0x14)
uint8_t houseIconAdd; uint8_t houseIconAdd;
uint8_t houseState;
uint8_t houseSize; uint8_t houseSize;
char landName[23]; uint8_t houseType;
char landMsg[193]; char estateName[23];
char estateGreeting[193];
char ownerName[31]; char ownerName[31];
char fcTag[7]; char fcTag[7];
uint8_t tag[3]; uint8_t tag[3];

View file

@ -356,7 +356,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
case ClientTriggerType::RequestHousingInfoSign: case ClientTriggerType::RequestHousingInfoSign:
{ {
auto LandInfoSignPacket = makeZonePacket< Server::FFXIVIpcLandInfoSign >( player.getId() ); auto landInfoSignPacket = makeZonePacket< Server::FFXIVIpcLandInfoSign >( player.getId() );
uint8_t ward = ( param12 & 0xFF00 ) >> 8; uint8_t ward = ( param12 & 0xFF00 ) >> 8;
uint8_t plot = ( param12 & 0xFF ); uint8_t plot = ( param12 & 0xFF );
@ -375,18 +375,19 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
land = pHousingMgr->getLandByOwnerId( player.getId() ); land = pHousingMgr->getLandByOwnerId( player.getId() );
} }
memcpy( &LandInfoSignPacket->data().landMsg, "Hello World", 11 ); uint32_t playerId = land->getPlayerOwner();
memcpy( &LandInfoSignPacket->data().landName, land->getLandName().c_str(), 20 ); std::string playerName = g_fw.get< Core::ServerZone >()->getPlayerNameFromDb( playerId );
LandInfoSignPacket->data().houseSize = land->getHouseSize(); //memcpy( &landInfoSignPacket->data().estateGreeting, "Hello World", 11 );
LandInfoSignPacket->data().houseState = land->getState(); //memcpy( &landInfoSignPacket->data().estateName, land->getLandName().c_str(), land->getLandName().size() );
LandInfoSignPacket->data().landId = land->getLandId(); //landInfoSignPacket->data().houseSize = land->getPlotSize();
LandInfoSignPacket->data().ownerId = land->getPlayerOwner(); landInfoSignPacket->data().houseType = 2; // we really need to save this in the plot
memcpy( &LandInfoSignPacket->data().ownerName, "Hello World", 11 ); landInfoSignPacket->data().landId = land->getLandId();
LandInfoSignPacket->data().wardNum = land->getWardNum(); landInfoSignPacket->data().ownerId = player.getContentId(); // should be real owner contentId, not player.contentId()
LandInfoSignPacket->data().worldId = 67; memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
LandInfoSignPacket->data().zoneId = land->getZoneId(); landInfoSignPacket->data().wardNum = land->getWardNum();
landInfoSignPacket->data().worldId = 67;
player.queuePacket( LandInfoSignPacket ); landInfoSignPacket->data().zoneId = land->getZoneId();
player.queuePacket( landInfoSignPacket );
break; break;
} }

View file

@ -354,6 +354,17 @@ bool Core::ServerZone::isRunning() const
return m_bRunning; return m_bRunning;
} }
std::string Core::ServerZone::getPlayerNameFromDb( uint32_t playerId )
{
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
auto res = pDb->query( "SELECT name FROM charainfo WHERE characterid = " + std::to_string( playerId ) );
if( !res->next() )
return "Unknown";
return res->getString( 1 );
}
void Core::ServerZone::loadBNpcTemplates() void Core::ServerZone::loadBNpcTemplates()
{ {
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >(); auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();

View file

@ -41,6 +41,8 @@ public:
Entity::BNpcTemplatePtr getBNpcTemplate( const std::string& key ); Entity::BNpcTemplatePtr getBNpcTemplate( const std::string& key );
Entity::BNpcTemplatePtr getBNpcTemplate( uint32_t id ); Entity::BNpcTemplatePtr getBNpcTemplate( uint32_t id );
std::string getPlayerNameFromDb( uint32_t playerId );
private: private:
uint16_t m_port; uint16_t m_port;
std::string m_ip; std::string m_ip;

View file

@ -64,12 +64,12 @@ void Core::Land::load()
m_currentPrice = m_landInfo->prices[ m_landId ]; m_currentPrice = m_landInfo->prices[ m_landId ];
m_minPrice = m_landInfo->minPrices[ m_landId ]; m_minPrice = m_landInfo->minPrices[ m_landId ];
m_land.houseSize = m_landInfo->sizes[ m_landId ]; m_land.plotSize = m_landInfo->sizes[ m_landId ];
m_land.houseState = HouseState::forSale; m_land.houseState = HouseState::forSale;
} }
else else
{ {
m_land.houseSize = res->getUInt( "Size" ); m_land.plotSize = res->getUInt( "Size" );
m_land.houseState = res->getUInt( "Status" ); m_land.houseState = res->getUInt( "Status" );
m_currentPrice = res->getUInt( "LandPrice" ); m_currentPrice = res->getUInt( "LandPrice" );
m_ownerPlayerId = res->getUInt( "OwnerId" ); m_ownerPlayerId = res->getUInt( "OwnerId" );
@ -138,7 +138,7 @@ void Core::Land::setPreset( uint32_t id )
//Primary State //Primary State
void Core::Land::setHouseSize( uint8_t size ) void Core::Land::setHouseSize( uint8_t size )
{ {
m_land.houseSize = size; m_land.plotSize = size;
} }
void Core::Land::setState( uint8_t state ) void Core::Land::setState( uint8_t state )
@ -161,9 +161,9 @@ void Core::Land::setLandName( const std::string& name )
memcpy( &m_landName, name.c_str(), 20 ); memcpy( &m_landName, name.c_str(), 20 );
} }
uint8_t Core::Land::getHouseSize() uint8_t Core::Land::getPlotSize()
{ {
return m_land.houseSize; return m_land.plotSize;
} }
uint8_t Core::Land::getState() uint8_t Core::Land::getState()
@ -290,7 +290,7 @@ uint8_t Core::Land::getLandTag( uint8_t slot )
void Core::Land::init() void Core::Land::init()
{ {
switch( getHouseSize() ) switch( getPlotSize() )
{ {
case HouseSize::small: case HouseSize::small:
m_maxItems = 20; m_maxItems = 20;

View file

@ -28,7 +28,7 @@ namespace Core
void setLandName( const std::string& name ); void setLandName( const std::string& name );
//Gerneral //Gerneral
uint8_t getHouseSize(); uint8_t getPlotSize();
uint8_t getState(); uint8_t getState();
uint8_t getOwnership(); uint8_t getOwnership();
uint8_t getSharing(); uint8_t getSharing();