1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 08:57:44 +00:00

added devaluation timer

This commit is contained in:
AriAvery 2018-11-07 11:08:07 +01:00
parent 23d3542088
commit 0f86374264
3 changed files with 22 additions and 9 deletions

View file

@ -326,6 +326,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
auto land = hZone->getLand( plot );
plotPricePacket->data().price = land->getCurrentPrice();
plotPricePacket->data().timeLeft = land->getDevaluationTime();
player.queuePacket( plotPricePacket );

View file

@ -237,6 +237,11 @@ uint32_t Core::Land::getMaxItems()
return m_maxItems;
}
uint32_t Core::Land::getDevaluationTime()
{
return m_devaluationTime;
}
void Core::Land::init()
{
@ -269,18 +274,23 @@ void Core::Land::UpdateDatabase()
void Core::Land::Update( uint32_t currTime )
{
if( m_currentPrice == 0 && getState() == HouseState::forSale )
if( getState() == HouseState::forSale )
{
if( m_nextDrop < currTime )
{
m_nextDrop = currTime + 21600; // +6 hours
if( m_currentPrice == 0 )
{
m_currentPrice = m_initPrice;
m_nextDrop = 0;
UpdateDatabase();
}
if( m_nextDrop < currTime && getState() == HouseState::forSale )
else
{
m_currentPrice = ( m_currentPrice / 100 ) * 90;
m_nextDrop = currTime + 86400;
m_currentPrice = ( m_currentPrice / 100 ) * 99.58;
}
}
UpdateDatabase();
}
m_devaluationTime = m_nextDrop - currTime;
onUpdate();
}

View file

@ -58,6 +58,7 @@ namespace Core
uint32_t getMaxItems();
uint32_t getCurrentPrice() const;
uint32_t getDevaluationTime();
private:
uint16_t convertItemIdToHousingItemId( uint16_t itemId );
@ -79,6 +80,7 @@ namespace Core
//price
uint32_t m_initPrice;
uint32_t m_nextDrop;
uint32_t m_devaluationTime;
uint32_t m_currentPrice;
};