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

Cleanup of housing definitions

This commit is contained in:
mordred 2018-11-14 10:00:16 +01:00
parent 64aef089b1
commit a7bc521ebc
8 changed files with 40 additions and 78 deletions

View file

@ -758,20 +758,6 @@ namespace Core::Common
SubTag2 SubTag2
}; };
//Structs
struct LandStruct
{
uint8_t plotSize; //0
uint8_t houseState; // 2
uint8_t iconColor; // 4
uint8_t iconAddIcon; // 6
uint32_t fcId; //8
uint32_t fcIcon;// 12
uint32_t fcIconColor; // 16
uint16_t housePart[ 8 ]; // 34
uint8_t color[ 8 ]; // 36
};
enum LandPermissionSlot enum LandPermissionSlot
{ {
FreeCompany, FreeCompany,

View file

@ -1596,13 +1596,27 @@ struct FFXIVIpcLandPermission : FFXIVIpcBasePacket< LandPermission >
uint64_t unkown5; uint64_t unkown5;
}; };
//Structs
struct LandStruct
{
uint8_t plotSize; //0
uint8_t houseState; // 2
uint8_t type; // 4 1 == FC, 2 == Private
uint8_t iconAddIcon; // 6
uint32_t fcId; //8
uint32_t fcIcon;// 12
uint32_t fcIconColor; // 16
uint16_t housePart[ 8 ]; // 34
uint8_t color[ 8 ]; // 36
};
struct FFXIVIpcLandUpdate : FFXIVIpcBasePacket< LandUpdate > struct FFXIVIpcLandUpdate : FFXIVIpcBasePacket< LandUpdate >
{ {
uint16_t landId; uint16_t landId;
uint16_t unknow0; uint16_t unknow0;
uint16_t unknow1; uint16_t unknow1;
uint16_t unknow2; uint16_t unknow2;
Common::LandStruct land; LandStruct land;
}; };
struct FFXIVIpcLandPriceUpdate : FFXIVIpcBasePacket< LandPriceUpdate > struct FFXIVIpcLandPriceUpdate : FFXIVIpcBasePacket< LandPriceUpdate >
@ -1667,7 +1681,7 @@ struct FFXIVIpcLandSetInitialize : FFXIVIpcBasePacket< LandSetInitialize >
uint8_t unknown6; uint8_t unknown6;
uint8_t unknown7; uint8_t unknown7;
uint8_t unknown8; uint8_t unknown8;
Common::LandStruct land[30]; LandStruct land[ 30 ];
}; };
struct FFXIVIpcYardObjectSpawn : FFXIVIpcBasePacket<YardObjectSpawn> struct FFXIVIpcYardObjectSpawn : FFXIVIpcBasePacket<YardObjectSpawn>

View file

@ -345,7 +345,8 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
} }
case ClientTriggerType::RequestEstateRename: case ClientTriggerType::RequestEstateRename:
{ {
auto landRenamePacket = makeZonePacket< Server::FFXIVIpcLandRename >( player.getId() ); // removed temporarly, there is no such thing as a LandName
/* 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 );
@ -368,7 +369,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
landRenamePacket->data().zoneId = land->getZoneId(); landRenamePacket->data().zoneId = land->getZoneId();
memcpy( &landRenamePacket->data().landName, land->getLandName().c_str(), 20 ); memcpy( &landRenamePacket->data().landName, land->getLandName().c_str(), 20 );
player.queuePacket( landRenamePacket ); player.queuePacket( landRenamePacket ); */
break; break;
} }

View file

@ -664,7 +664,8 @@ void Core::Network::GameConnection::landRenameHandler( const Core::Network::Pack
if( !pLand ) if( !pLand )
return; return;
pLand->setLandName( packet.data().landName ); // TODO set estate name
//pLand->setLandName( packet.data().landName );
} }
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

@ -118,7 +118,7 @@ void Core::HousingMgr::sendLandSignOwned( Entity::Player& player, uint8_t ward,
std::string playerName = g_fw.get< Core::ServerZone >()->getPlayerNameFromDb( playerId ); std::string playerName = g_fw.get< Core::ServerZone >()->getPlayerNameFromDb( playerId );
//memcpy( &landInfoSignPacket->data().estateGreeting, "Hello World", 11 ); //memcpy( &landInfoSignPacket->data().estateGreeting, "Hello World", 11 );
//memcpy( &landInfoSignPacket->data().estateName, land->getLandName().c_str(), land->getLandName().size() ); //memcpy( &landInfoSignPacket->data().estateName, land->getLandName().c_str(), land->getLandName().size() );
landInfoSignPacket->data().houseSize = land->getPlotSize(); landInfoSignPacket->data().houseSize = land->getSize();
landInfoSignPacket->data().houseType = static_cast< uint8_t >( land->getLandType() ); landInfoSignPacket->data().houseType = static_cast< uint8_t >( land->getLandType() );
landInfoSignPacket->data().landId = land->getLandId(); landInfoSignPacket->data().landId = land->getLandId();
landInfoSignPacket->data().ownerId = player.getContentId(); // should be real owner contentId, not player.contentId() landInfoSignPacket->data().ownerId = player.getContentId(); // should be real owner contentId, not player.contentId()

View file

@ -129,13 +129,13 @@ void Core::HousingZone::sendLandSet( Entity::Player& player )
for( uint8_t i = startIndex, count = 0; i < ( startIndex + 30 ); ++i, ++count ) for( uint8_t i = startIndex, count = 0; i < ( startIndex + 30 ); ++i, ++count )
{ {
landsetInitializePacket->data().land[ count ].plotSize = getLand( i )->getPlotSize(); landsetInitializePacket->data().land[ count ].plotSize = getLand( i )->getSize();
landsetInitializePacket->data().land[ count ].houseState = getLand( i )->getState(); landsetInitializePacket->data().land[ count ].houseState = getLand( i )->getState();
landsetInitializePacket->data().land[ count ].iconColor = getLand( i )->getOwnership(); landsetInitializePacket->data().land[ count ].type = static_cast< uint8_t >( getLand( i )->getLandType() );
landsetInitializePacket->data().land[ count ].iconAddIcon = getLand( i )->getPlotSize(); landsetInitializePacket->data().land[ count ].iconAddIcon = getLand( i )->getSharing();
landsetInitializePacket->data().land[ count ].fcId = getLand( i )->getFcId(); landsetInitializePacket->data().land[ count ].fcId = getLand( i )->getFcId();
landsetInitializePacket->data().land[ count ].fcIcon = getLand( i )->getFcIcon(); landsetInitializePacket->data().land[ count ].fcIcon = getLand( i )->getFcIcon();
landsetInitializePacket->data().land[ count ].fcIconColor = getLand( i )->getFcColor(); landsetInitializePacket->data().land[ count ].fcIconColor = getLand( i )->getFcColor();
} }
player.queuePacket( landsetInitializePacket ); player.queuePacket( landsetInitializePacket );
@ -150,10 +150,10 @@ void Core::HousingZone::sendLandUpdate( uint8_t landId )
auto landUpdatePacket = makeZonePacket< FFXIVIpcLandUpdate >( pPlayer->getId() ); auto landUpdatePacket = makeZonePacket< FFXIVIpcLandUpdate >( pPlayer->getId() );
landUpdatePacket->data().landId = landId; landUpdatePacket->data().landId = landId;
landUpdatePacket->data().land.plotSize = pLand->getPlotSize(); landUpdatePacket->data().land.plotSize = pLand->getSize();
landUpdatePacket->data().land.houseState = pLand->getState(); landUpdatePacket->data().land.houseState = pLand->getState();
landUpdatePacket->data().land.iconColor = pLand->getOwnership(); landUpdatePacket->data().land.type = static_cast< uint8_t >( pLand->getLandType() );
landUpdatePacket->data().land.iconAddIcon = pLand->getPlotSize(); landUpdatePacket->data().land.iconAddIcon = pLand->getSharing();
landUpdatePacket->data().land.fcId = pLand->getFcId(); landUpdatePacket->data().land.fcId = pLand->getFcId();
landUpdatePacket->data().land.fcIcon = pLand->getFcIcon(); landUpdatePacket->data().land.fcIcon = pLand->getFcIcon();
landUpdatePacket->data().land.fcIconColor = pLand->getFcColor(); landUpdatePacket->data().land.fcIconColor = pLand->getFcColor();
@ -207,7 +207,7 @@ Core::LandPurchaseResult Core::HousingZone::purchseLand( Entity::Player& player,
player.setLandPermissions( LandPermissionSlot::Private, 0x00, plot, player.setLandPermissions( LandPermissionSlot::Private, 0x00, plot,
pHousing->getWardNum(), pHousing->getTerritoryTypeId() ); pHousing->getWardNum(), pHousing->getTerritoryTypeId() );
player.sendLandPermissions(); player.sendLandPermissions();
pLand->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) ); //pLand->setLandName( "Private Estate" + std::to_string( pHousing->getWardNum() ) + "-" + std::to_string( plot ) );
pLand->UpdateLandDb(); pLand->UpdateLandDb();
sendLandUpdate( plot ); sendLandUpdate( plot );
return LandPurchaseResult::SUCCESS; return LandPurchaseResult::SUCCESS;

View file

@ -39,8 +39,6 @@ Core::Land::Land( uint16_t zoneId, uint8_t wardNum, uint8_t landId, uint32_t lan
m_type( Common::LandType::Private ) m_type( Common::LandType::Private )
{ {
memset( &m_tag, 0x00, 3 ); memset( &m_tag, 0x00, 3 );
memset( &m_landMsg, 0x00, 193 );
memset( &m_landName, 0x00, 23 );
load(); load();
} }
@ -93,7 +91,7 @@ uint32_t Core::Land::getCurrentPrice() const
} }
//Primary State //Primary State
void Core::Land::setHouseSize( uint8_t size ) void Core::Land::setSize( uint8_t size )
{ {
m_size = size; m_size = size;
} }
@ -103,27 +101,17 @@ void Core::Land::setState( uint8_t state )
m_state = state; m_state = state;
} }
void Core::Land::setOwnership( uint8_t state )
{
m_iconColor = state;
}
void Core::Land::setSharing( uint8_t state ) void Core::Land::setSharing( uint8_t state )
{ {
m_iconAddIcon = state; m_iconAddIcon = state;
} }
void Core::Land::setLandName( const std::string& name )
{
memcpy( &m_landName, name.c_str(), 20 );
}
void Core::Land::setLandType( Common::LandType type ) void Core::Land::setLandType( Common::LandType type )
{ {
m_type = type; m_type = type;
} }
uint8_t Core::Land::getPlotSize() const uint8_t Core::Land::getSize() const
{ {
return m_size; return m_size;
} }
@ -133,11 +121,6 @@ uint8_t Core::Land::getState() const
return m_state; return m_state;
} }
uint8_t Core::Land::getOwnership() const
{
return m_iconColor;
}
uint8_t Core::Land::getSharing() const uint8_t Core::Land::getSharing() const
{ {
return m_iconAddIcon; return m_iconAddIcon;
@ -163,11 +146,6 @@ uint16_t Core::Land::getZoneId() const
return m_zoneId; return m_zoneId;
} }
std::string Core::Land::getLandName() const
{
return std::string( m_landName );
}
Core::Common::LandType Core::Land::getLandType() const Core::Common::LandType Core::Land::getLandType() const
{ {
return m_type; return m_type;
@ -230,7 +208,7 @@ uint8_t Core::Land::getLandTag( uint8_t slot )
void Core::Land::init() void Core::Land::init()
{ {
switch( getPlotSize() ) switch( m_size )
{ {
case HouseSize::small: case HouseSize::small:
m_maxItems = 20; m_maxItems = 20;

View file

@ -21,23 +21,19 @@ namespace Core
void load(); void load();
//Primary state //Primary state
void setHouseSize( uint8_t size ); void setSize( uint8_t size );
void setState( uint8_t state ); void setState( uint8_t state );
void setOwnership( uint8_t state );
void setSharing( uint8_t state ); void setSharing( uint8_t state );
void setLandName( const std::string& name );
void setLandType( Common::LandType type ); void setLandType( Common::LandType type );
//Gerneral //Gerneral
uint8_t getPlotSize() const; uint8_t getSize() const;
uint8_t getState() const; uint8_t getState() const;
uint8_t getOwnership() const;
uint8_t getSharing() const; uint8_t getSharing() const;
uint32_t getLandSetId() const; uint32_t getLandSetId() const;
uint8_t getWardNum() const; uint8_t getWardNum() const;
uint8_t getLandId() const; uint8_t getLandId() const;
uint16_t getZoneId() const; uint16_t getZoneId() const;
std::string getLandName() const;
Common::LandType getLandType() const; Common::LandType getLandType() const;
//Free Comapny //Free Comapny
@ -46,14 +42,6 @@ namespace Core
uint32_t getFcIcon(); uint32_t getFcIcon();
uint32_t getFcColor(); uint32_t getFcColor();
//House data
void setHousePart( Common::HousePartSlot slot, uint16_t itemId );
uint16_t getHousePart( Common::HousePartSlot slot );
//Color
void setColor( uint8_t slot, uint8_t color );
uint8_t getColor( uint8_t slot );
//Player //Player
void setPlayerOwner( uint32_t id ); void setPlayerOwner( uint32_t id );
uint32_t getPlayerOwner(); uint32_t getPlayerOwner();
@ -63,7 +51,6 @@ namespace Core
void Update( uint32_t currTime ); void Update( uint32_t currTime );
uint32_t getMaxItems(); uint32_t getMaxItems();
uint32_t getCurrentPrice() const; uint32_t getCurrentPrice() const;
uint32_t getDevaluationTime(); uint32_t getDevaluationTime();
@ -81,17 +68,15 @@ namespace Core
uint16_t m_zoneId; uint16_t m_zoneId;
uint8_t m_size; uint8_t m_size;
uint8_t m_state; uint8_t m_state;
uint8_t m_iconColor; Common::LandType m_type;
uint8_t m_iconAddIcon; uint8_t m_iconAddIcon;
uint32_t m_fcId; uint32_t m_fcId; // unclear, may be wrong
uint32_t m_fcIcon; uint32_t m_fcIcon;
uint32_t m_fcIconColor; uint32_t m_fcIconColor;
Common::LandType m_type;
uint32_t m_ownerPlayerId; uint32_t m_ownerPlayerId;
Core::Data::HousingLandSetPtr m_landInfo; Core::Data::HousingLandSetPtr m_landInfo;
//item storage //item storage
Core::ItemContainerPtr ItemsOutdoorContainer; Core::ItemContainerPtr ItemsOutdoorContainer;
uint32_t m_maxItems; uint32_t m_maxItems;
@ -103,9 +88,6 @@ namespace Core
uint32_t m_minPrice; uint32_t m_minPrice;
//information //information
char m_landName[23];
char m_landMsg[193];
char m_ownerName[31];
char fcTag[7]; char fcTag[7];
uint8_t m_tag[3]; uint8_t m_tag[3];
}; };