mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
Fixed sign structure and lookup of owner name
This commit is contained in:
parent
c7c586d3fb
commit
abc0960e03
7 changed files with 40 additions and 29 deletions
|
@ -761,7 +761,7 @@ namespace Core::Common
|
|||
//Structs
|
||||
struct LandStruct
|
||||
{
|
||||
uint8_t houseSize; //0
|
||||
uint8_t plotSize; //0
|
||||
uint8_t houseState; // 2
|
||||
uint8_t iconColor; // 4
|
||||
uint8_t iconAddIcon; // 6
|
||||
|
|
|
@ -1617,16 +1617,13 @@ struct FFXIVIpcLandInfoSign : FFXIVIpcBasePacket< LandInfoSign >
|
|||
uint16_t wardNum;
|
||||
uint16_t zoneId;
|
||||
uint16_t worldId;
|
||||
uint32_t ownerId;
|
||||
uint16_t someState1;//private 0x0 : fc 0x17
|
||||
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)
|
||||
uint64_t ownerId; // ither contentId or fcId
|
||||
uint32_t unknow1;
|
||||
uint8_t houseIconAdd;
|
||||
uint8_t houseState;
|
||||
uint8_t houseSize;
|
||||
char landName[23];
|
||||
char landMsg[193];
|
||||
uint8_t houseType;
|
||||
char estateName[23];
|
||||
char estateGreeting[193];
|
||||
char ownerName[31];
|
||||
char fcTag[7];
|
||||
uint8_t tag[3];
|
||||
|
|
|
@ -356,7 +356,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
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 plot = ( param12 & 0xFF );
|
||||
|
@ -375,18 +375,19 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
|||
land = pHousingMgr->getLandByOwnerId( player.getId() );
|
||||
}
|
||||
|
||||
memcpy( &LandInfoSignPacket->data().landMsg, "Hello World", 11 );
|
||||
memcpy( &LandInfoSignPacket->data().landName, land->getLandName().c_str(), 20 );
|
||||
LandInfoSignPacket->data().houseSize = land->getHouseSize();
|
||||
LandInfoSignPacket->data().houseState = land->getState();
|
||||
LandInfoSignPacket->data().landId = land->getLandId();
|
||||
LandInfoSignPacket->data().ownerId = land->getPlayerOwner();
|
||||
memcpy( &LandInfoSignPacket->data().ownerName, "Hello World", 11 );
|
||||
LandInfoSignPacket->data().wardNum = land->getWardNum();
|
||||
LandInfoSignPacket->data().worldId = 67;
|
||||
LandInfoSignPacket->data().zoneId = land->getZoneId();
|
||||
|
||||
player.queuePacket( LandInfoSignPacket );
|
||||
uint32_t playerId = land->getPlayerOwner();
|
||||
std::string playerName = g_fw.get< Core::ServerZone >()->getPlayerNameFromDb( playerId );
|
||||
//memcpy( &landInfoSignPacket->data().estateGreeting, "Hello World", 11 );
|
||||
//memcpy( &landInfoSignPacket->data().estateName, land->getLandName().c_str(), land->getLandName().size() );
|
||||
//landInfoSignPacket->data().houseSize = land->getPlotSize();
|
||||
landInfoSignPacket->data().houseType = 2; // we really need to save this in the plot
|
||||
landInfoSignPacket->data().landId = land->getLandId();
|
||||
landInfoSignPacket->data().ownerId = player.getContentId(); // should be real owner contentId, not player.contentId()
|
||||
memcpy( &landInfoSignPacket->data().ownerName, playerName.c_str(), playerName.size() );
|
||||
landInfoSignPacket->data().wardNum = land->getWardNum();
|
||||
landInfoSignPacket->data().worldId = 67;
|
||||
landInfoSignPacket->data().zoneId = land->getZoneId();
|
||||
player.queuePacket( landInfoSignPacket );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -354,6 +354,17 @@ bool Core::ServerZone::isRunning() const
|
|||
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()
|
||||
{
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
Entity::BNpcTemplatePtr getBNpcTemplate( const std::string& key );
|
||||
Entity::BNpcTemplatePtr getBNpcTemplate( uint32_t id );
|
||||
|
||||
std::string getPlayerNameFromDb( uint32_t playerId );
|
||||
|
||||
private:
|
||||
uint16_t m_port;
|
||||
std::string m_ip;
|
||||
|
|
|
@ -64,12 +64,12 @@ void Core::Land::load()
|
|||
|
||||
m_currentPrice = m_landInfo->prices[ 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;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_land.houseSize = res->getUInt( "Size" );
|
||||
m_land.plotSize = res->getUInt( "Size" );
|
||||
m_land.houseState = res->getUInt( "Status" );
|
||||
m_currentPrice = res->getUInt( "LandPrice" );
|
||||
m_ownerPlayerId = res->getUInt( "OwnerId" );
|
||||
|
@ -138,7 +138,7 @@ void Core::Land::setPreset( uint32_t id )
|
|||
//Primary State
|
||||
void Core::Land::setHouseSize( uint8_t size )
|
||||
{
|
||||
m_land.houseSize = size;
|
||||
m_land.plotSize = size;
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
uint8_t Core::Land::getHouseSize()
|
||||
uint8_t Core::Land::getPlotSize()
|
||||
{
|
||||
return m_land.houseSize;
|
||||
return m_land.plotSize;
|
||||
}
|
||||
|
||||
uint8_t Core::Land::getState()
|
||||
|
@ -290,7 +290,7 @@ uint8_t Core::Land::getLandTag( uint8_t slot )
|
|||
void Core::Land::init()
|
||||
{
|
||||
|
||||
switch( getHouseSize() )
|
||||
switch( getPlotSize() )
|
||||
{
|
||||
case HouseSize::small:
|
||||
m_maxItems = 20;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Core
|
|||
void setLandName( const std::string& name );
|
||||
|
||||
//Gerneral
|
||||
uint8_t getHouseSize();
|
||||
uint8_t getPlotSize();
|
||||
uint8_t getState();
|
||||
uint8_t getOwnership();
|
||||
uint8_t getSharing();
|
||||
|
|
Loading…
Add table
Reference in a new issue