mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 15:17:46 +00:00
added min prices
This commit is contained in:
parent
6525a8e4f1
commit
0ad312aed9
4 changed files with 11 additions and 5 deletions
|
@ -2745,6 +2745,8 @@ Core::Data::HousingLandSet::HousingLandSet( uint32_t row_id, Core::Data::ExdData
|
||||||
auto row = exdData->m_HousingLandSetDat.get_row( row_id );
|
auto row = exdData->m_HousingLandSetDat.get_row( row_id );
|
||||||
for ( int i = 0; i < 60; i++ )
|
for ( int i = 0; i < 60; i++ )
|
||||||
sizes.push_back( exdData->getField< uint8_t >( row, 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++ )
|
for ( int i = 300; i < 300 + 60; i++ )
|
||||||
prices.push_back( exdData->getField< uint32_t >( row, i ) );
|
prices.push_back( exdData->getField< uint32_t >( row, i ) );
|
||||||
|
|
||||||
|
|
|
@ -2853,6 +2853,7 @@ struct HousingPlacement
|
||||||
struct HousingLandSet
|
struct HousingLandSet
|
||||||
{
|
{
|
||||||
std::vector< uint8_t > sizes;
|
std::vector< uint8_t > sizes;
|
||||||
|
std::vector< uint32_t > minPrices;
|
||||||
std::vector< uint32_t > prices;
|
std::vector< uint32_t > prices;
|
||||||
|
|
||||||
HousingLandSet( uint32_t row_id, Core::Data::ExdDataGenerated* exdData );
|
HousingLandSet( uint32_t row_id, Core::Data::ExdDataGenerated* exdData );
|
||||||
|
|
|
@ -47,7 +47,6 @@ Core::Land::~Land()
|
||||||
|
|
||||||
void Core::Land::load()
|
void Core::Land::load()
|
||||||
{
|
{
|
||||||
|
|
||||||
m_land.houseState = HouseState::forSale;
|
m_land.houseState = HouseState::forSale;
|
||||||
|
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
|
@ -55,14 +54,13 @@ void Core::Land::load()
|
||||||
"AND landid = " + std::to_string( m_landId ) );
|
"AND landid = " + std::to_string( m_landId ) );
|
||||||
if( !res->next() )
|
if( !res->next() )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
pDb->directExecute( "INSERT INTO land ( landsetid, landid, size, status, landprice ) "
|
pDb->directExecute( "INSERT INTO land ( landsetid, landid, size, status, landprice ) "
|
||||||
"VALUES ( " + std::to_string( m_landSetId ) + "," + std::to_string( m_landId ) + ","
|
"VALUES ( " + std::to_string( m_landSetId ) + "," + std::to_string( m_landId ) + ","
|
||||||
+ std::to_string( m_landInfo->sizes[ m_landId ] ) + ","
|
+ std::to_string( m_landInfo->sizes[ m_landId ] ) + ","
|
||||||
+ " 1, " + std::to_string( m_landInfo->prices[ m_landId ] ) + " );" );
|
+ " 1, " + std::to_string( m_landInfo->prices[ m_landId ] ) + " );" );
|
||||||
|
|
||||||
m_currentPrice = 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 ];
|
m_land.houseSize = m_landInfo->sizes[ m_landId ];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -284,12 +282,16 @@ void Core::Land::Update( uint32_t currTime )
|
||||||
{
|
{
|
||||||
m_currentPrice = m_initPrice;
|
m_currentPrice = m_initPrice;
|
||||||
}
|
}
|
||||||
else
|
else if( m_minPrice < m_currentPrice )
|
||||||
{
|
{
|
||||||
m_currentPrice = ( m_currentPrice / 100 ) * 99.58;
|
m_currentPrice = ( m_currentPrice / 100 ) * 99.58;
|
||||||
}
|
|
||||||
}
|
|
||||||
m_devaluationTime = m_nextDrop - currTime;
|
m_devaluationTime = m_nextDrop - currTime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_devaluationTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
UpdateDatabase();
|
UpdateDatabase();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -81,6 +81,7 @@ namespace Core
|
||||||
uint32_t m_nextDrop;
|
uint32_t m_nextDrop;
|
||||||
uint32_t m_devaluationTime;
|
uint32_t m_devaluationTime;
|
||||||
uint32_t m_currentPrice;
|
uint32_t m_currentPrice;
|
||||||
|
uint32_t m_minPrice;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue