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:
parent
23d3542088
commit
0f86374264
3 changed files with 22 additions and 9 deletions
|
@ -326,6 +326,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
|
|
||||||
auto land = hZone->getLand( plot );
|
auto land = hZone->getLand( plot );
|
||||||
plotPricePacket->data().price = land->getCurrentPrice();
|
plotPricePacket->data().price = land->getCurrentPrice();
|
||||||
|
plotPricePacket->data().timeLeft = land->getDevaluationTime();
|
||||||
|
|
||||||
player.queuePacket( plotPricePacket );
|
player.queuePacket( plotPricePacket );
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,11 @@ uint32_t Core::Land::getMaxItems()
|
||||||
return m_maxItems;
|
return m_maxItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Core::Land::getDevaluationTime()
|
||||||
|
{
|
||||||
|
return m_devaluationTime;
|
||||||
|
}
|
||||||
|
|
||||||
void Core::Land::init()
|
void Core::Land::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -269,18 +274,23 @@ void Core::Land::UpdateDatabase()
|
||||||
|
|
||||||
void Core::Land::Update( uint32_t currTime )
|
void Core::Land::Update( uint32_t currTime )
|
||||||
{
|
{
|
||||||
if( m_currentPrice == 0 && getState() == HouseState::forSale )
|
if( getState() == HouseState::forSale )
|
||||||
{
|
{
|
||||||
m_currentPrice = m_initPrice;
|
if( m_nextDrop < currTime )
|
||||||
m_nextDrop = 0;
|
{
|
||||||
UpdateDatabase();
|
m_nextDrop = currTime + 21600; // +6 hours
|
||||||
}
|
if( m_currentPrice == 0 )
|
||||||
if( m_nextDrop < currTime && getState() == HouseState::forSale )
|
{
|
||||||
{
|
m_currentPrice = m_initPrice;
|
||||||
m_currentPrice = ( m_currentPrice / 100 ) * 90;
|
}
|
||||||
m_nextDrop = currTime + 86400;
|
else
|
||||||
|
{
|
||||||
|
m_currentPrice = ( m_currentPrice / 100 ) * 99.58;
|
||||||
|
}
|
||||||
|
}
|
||||||
UpdateDatabase();
|
UpdateDatabase();
|
||||||
}
|
}
|
||||||
|
m_devaluationTime = m_nextDrop - currTime;
|
||||||
onUpdate();
|
onUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ namespace Core
|
||||||
uint32_t getMaxItems();
|
uint32_t getMaxItems();
|
||||||
|
|
||||||
uint32_t getCurrentPrice() const;
|
uint32_t getCurrentPrice() const;
|
||||||
|
uint32_t getDevaluationTime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t convertItemIdToHousingItemId( uint16_t itemId );
|
uint16_t convertItemIdToHousingItemId( uint16_t itemId );
|
||||||
|
@ -79,6 +80,7 @@ namespace Core
|
||||||
//price
|
//price
|
||||||
uint32_t m_initPrice;
|
uint32_t m_initPrice;
|
||||||
uint32_t m_nextDrop;
|
uint32_t m_nextDrop;
|
||||||
|
uint32_t m_devaluationTime;
|
||||||
uint32_t m_currentPrice;
|
uint32_t m_currentPrice;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue