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

added min prices

This commit is contained in:
AriAvery 2018-11-09 09:49:43 +01:00
parent 6525a8e4f1
commit 0ad312aed9
4 changed files with 11 additions and 5 deletions

View file

@ -2745,6 +2745,8 @@ Core::Data::HousingLandSet::HousingLandSet( uint32_t row_id, Core::Data::ExdData
auto row = exdData->m_HousingLandSetDat.get_row( row_id );
for ( int i = 0; i < 60; i++ )
sizes.push_back( exdData->getField< uint8_t >( row, i ) );
for ( int i = 60; i < 60 + 60; i++ )
minPrices.push_back( exdData->getField< uint8_t >( row, i ) );
for ( int i = 300; i < 300 + 60; i++ )
prices.push_back( exdData->getField< uint32_t >( row, i ) );

View file

@ -2853,6 +2853,7 @@ struct HousingPlacement
struct HousingLandSet
{
std::vector< uint8_t > sizes;
std::vector< uint32_t > minPrices;
std::vector< uint32_t > prices;
HousingLandSet( uint32_t row_id, Core::Data::ExdDataGenerated* exdData );

View file

@ -47,7 +47,6 @@ Core::Land::~Land()
void Core::Land::load()
{
m_land.houseState = HouseState::forSale;
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
@ -55,14 +54,13 @@ void Core::Land::load()
"AND landid = " + std::to_string( m_landId ) );
if( !res->next() )
{
pDb->directExecute( "INSERT INTO land ( landsetid, landid, size, status, landprice ) "
"VALUES ( " + std::to_string( m_landSetId ) + "," + std::to_string( m_landId ) + ","
+ std::to_string( m_landInfo->sizes[ m_landId ] ) + ","
+ " 1, " + std::to_string( m_landInfo->prices[ m_landId ] ) + " );" );
m_currentPrice = m_landInfo->prices[ m_landId ];
m_minPrice = m_landInfo->minPrices[ m_landId ];
m_land.houseSize = m_landInfo->sizes[ m_landId ];
}
else
@ -284,12 +282,16 @@ void Core::Land::Update( uint32_t currTime )
{
m_currentPrice = m_initPrice;
}
else
else if( m_minPrice < m_currentPrice )
{
m_currentPrice = ( m_currentPrice / 100 ) * 99.58;
m_devaluationTime = m_nextDrop - currTime;
}
else
{
m_devaluationTime = 0;
}
}
m_devaluationTime = m_nextDrop - currTime;
UpdateDatabase();
}
}

View file

@ -81,6 +81,7 @@ namespace Core
uint32_t m_nextDrop;
uint32_t m_devaluationTime;
uint32_t m_currentPrice;
uint32_t m_minPrice;
};
}