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

Basic land relinquishing added

This commit is contained in:
Mordred 2018-11-17 01:16:44 +01:00
parent 4915b62d7b
commit 7164ca3ddd
6 changed files with 45 additions and 5 deletions

View file

@ -38,7 +38,7 @@ public:
auto pHouMgr = pFw->get< Core::HousingMgr >();
LandPurchaseResult res = pHouMgr->purchseLand( player, activeLand.plot,
static_cast< uint8_t >( result.param2 ) );
static_cast< uint8_t >( result.param2 ) );
switch( res )
{
@ -73,7 +73,6 @@ public:
break;
}
case LandPurchaseResult::ERR_INTERNAL:
{
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 1995 );

View file

@ -346,12 +346,10 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
}
case ClientTriggerType::RequestLandRelinquish:
{
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
auto plot = static_cast< uint8_t >( param12 & 0xFF );
auto pHousingMgr = g_fw.get< HousingMgr >();
pHousingMgr->relinquishLand( player, plot );
pLog->debug( "Request to relinquish plot " + std::to_string( plot ) );
// TODO: do stuff!
break;
}
case ClientTriggerType::RequestEstateRename:

View file

@ -205,3 +205,30 @@ Core::LandPurchaseResult Core::HousingMgr::purchseLand( Entity::Player& player,
}
bool Core::HousingMgr::relinquishLand( Entity::Player& player, uint8_t plot )
{
// TODO: Fix "permissions" being sent incorrectly
// TODO: Add checks for land state before relinquishing
auto pHousing = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
auto pLand = pHousing->getLand( plot );
auto plotMaxPrice = pLand->getCurrentPrice();
pLand->setCurrentPrice( pLand->getMaxPrice() );
pLand->setPlayerOwner( 0 );
pLand->setState( HouseState::forSale );
pLand->setLandType( Common::LandType::none );
pLand->updateLandDb();
player.setLandPermissions( LandPermissionSlot::Private, 0x00, 0xFF, 0xFF, 0xFF );
player.sendLandPermissionSlot( static_cast< uint8_t >( LandType::Private ), 0xFF, 0xFF, 0xFF );
auto screenMsgPkt2 = makeActorControl143( player.getId(), ActorControl::LogMsg, 3351, 0x1AA,
pLand->getWardNum() + 1, plot + 1 );
player.queuePacket( screenMsgPkt2 );
pHousing->sendLandUpdate( plot );
return true;
}

View file

@ -33,6 +33,8 @@ namespace Core
void sendLandSignFree( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId );
LandPurchaseResult purchseLand( Entity::Player& player, uint8_t plot, uint8_t state );
bool relinquishLand( Entity::Player& player, uint8_t plot );
private:
using HousingZonePtrMap = std::unordered_map< uint16_t, Core::Data::HousingZonePtr >;
uint16_t m_lastLandId;

View file

@ -74,6 +74,7 @@ void Core::Land::load()
m_currentPrice = res->getUInt( "LandPrice" );
m_ownerPlayerId = res->getUInt( "OwnerId" );
m_minPrice = m_landInfo->minPrices[ m_landId ];
m_maxPrice = m_landInfo->prices[ m_landId ];
}
init();
}
@ -90,6 +91,11 @@ uint32_t Core::Land::getCurrentPrice() const
return m_currentPrice;
}
uint32_t Core::Land::getMaxPrice() const
{
return m_maxPrice;
}
//Primary State
void Core::Land::setSize( uint8_t size )
{
@ -195,6 +201,11 @@ uint32_t Core::Land::getDevaluationTime()
return m_nextDrop - static_cast< uint32_t >( Util::getTimeSeconds() );
}
void Core::Land::setCurrentPrice( uint32_t currentPrice )
{
m_currentPrice = currentPrice;
}
void Core::Land::setLandTag( uint8_t slot, uint8_t tag )
{
m_tag[ slot ] = tag;

View file

@ -46,12 +46,14 @@ namespace Core
void setPlayerOwner( uint32_t id );
uint32_t getPlayerOwner();
//Housing Functions
void setCurrentPrice( uint32_t currentPrice );
void setPreset( uint32_t itemId );
void updateLandDb();
void update( uint32_t currTime );
uint32_t getMaxItems();
uint32_t getCurrentPrice() const;
uint32_t getMaxPrice() const;
uint32_t getDevaluationTime();
//House tags
@ -86,6 +88,7 @@ namespace Core
uint32_t m_nextDrop;
uint32_t m_currentPrice;
uint32_t m_minPrice;
uint32_t m_maxPrice;
//information
char fcTag[7];