mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Basic land relinquishing added
This commit is contained in:
parent
4915b62d7b
commit
7164ca3ddd
6 changed files with 45 additions and 5 deletions
|
@ -73,7 +73,6 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case LandPurchaseResult::ERR_INTERNAL:
|
case LandPurchaseResult::ERR_INTERNAL:
|
||||||
{
|
{
|
||||||
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 1995 );
|
auto errorMsg = makeActorControl143( player.getId(), ActorControl::LogMsg, 1995 );
|
||||||
|
|
|
@ -346,12 +346,10 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
}
|
}
|
||||||
case ClientTriggerType::RequestLandRelinquish:
|
case ClientTriggerType::RequestLandRelinquish:
|
||||||
{
|
{
|
||||||
auto ward = static_cast< uint8_t >( ( param12 & 0xFF00 ) >> 8 );
|
|
||||||
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
auto plot = static_cast< uint8_t >( param12 & 0xFF );
|
||||||
auto pHousingMgr = g_fw.get< HousingMgr >();
|
auto pHousingMgr = g_fw.get< HousingMgr >();
|
||||||
|
pHousingMgr->relinquishLand( player, plot );
|
||||||
|
|
||||||
pLog->debug( "Request to relinquish plot " + std::to_string( plot ) );
|
|
||||||
// TODO: do stuff!
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ClientTriggerType::RequestEstateRename:
|
case ClientTriggerType::RequestEstateRename:
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ namespace Core
|
||||||
void sendLandSignFree( Entity::Player& player, uint8_t wardId, uint8_t plotId, uint16_t territoryTypeId );
|
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 );
|
LandPurchaseResult purchseLand( Entity::Player& player, uint8_t plot, uint8_t state );
|
||||||
|
|
||||||
|
bool relinquishLand( Entity::Player& player, uint8_t plot );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using HousingZonePtrMap = std::unordered_map< uint16_t, Core::Data::HousingZonePtr >;
|
using HousingZonePtrMap = std::unordered_map< uint16_t, Core::Data::HousingZonePtr >;
|
||||||
uint16_t m_lastLandId;
|
uint16_t m_lastLandId;
|
||||||
|
|
|
@ -74,6 +74,7 @@ void Core::Land::load()
|
||||||
m_currentPrice = res->getUInt( "LandPrice" );
|
m_currentPrice = res->getUInt( "LandPrice" );
|
||||||
m_ownerPlayerId = res->getUInt( "OwnerId" );
|
m_ownerPlayerId = res->getUInt( "OwnerId" );
|
||||||
m_minPrice = m_landInfo->minPrices[ m_landId ];
|
m_minPrice = m_landInfo->minPrices[ m_landId ];
|
||||||
|
m_maxPrice = m_landInfo->prices[ m_landId ];
|
||||||
}
|
}
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -90,6 +91,11 @@ uint32_t Core::Land::getCurrentPrice() const
|
||||||
return m_currentPrice;
|
return m_currentPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Core::Land::getMaxPrice() const
|
||||||
|
{
|
||||||
|
return m_maxPrice;
|
||||||
|
}
|
||||||
|
|
||||||
//Primary State
|
//Primary State
|
||||||
void Core::Land::setSize( uint8_t size )
|
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() );
|
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 )
|
void Core::Land::setLandTag( uint8_t slot, uint8_t tag )
|
||||||
{
|
{
|
||||||
m_tag[ slot ] = tag;
|
m_tag[ slot ] = tag;
|
||||||
|
|
|
@ -46,12 +46,14 @@ namespace Core
|
||||||
void setPlayerOwner( uint32_t id );
|
void setPlayerOwner( uint32_t id );
|
||||||
uint32_t getPlayerOwner();
|
uint32_t getPlayerOwner();
|
||||||
//Housing Functions
|
//Housing Functions
|
||||||
|
void setCurrentPrice( uint32_t currentPrice );
|
||||||
void setPreset( uint32_t itemId );
|
void setPreset( uint32_t itemId );
|
||||||
void updateLandDb();
|
void updateLandDb();
|
||||||
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 getMaxPrice() const;
|
||||||
uint32_t getDevaluationTime();
|
uint32_t getDevaluationTime();
|
||||||
|
|
||||||
//House tags
|
//House tags
|
||||||
|
@ -86,6 +88,7 @@ namespace Core
|
||||||
uint32_t m_nextDrop;
|
uint32_t m_nextDrop;
|
||||||
uint32_t m_currentPrice;
|
uint32_t m_currentPrice;
|
||||||
uint32_t m_minPrice;
|
uint32_t m_minPrice;
|
||||||
|
uint32_t m_maxPrice;
|
||||||
|
|
||||||
//information
|
//information
|
||||||
char fcTag[7];
|
char fcTag[7];
|
||||||
|
|
Loading…
Add table
Reference in a new issue