diff --git a/src/common/Exd/ExdDataGenerated.cpp b/src/common/Exd/ExdDataGenerated.cpp index 5359bbc7..83cd85e0 100644 --- a/src/common/Exd/ExdDataGenerated.cpp +++ b/src/common/Exd/ExdDataGenerated.cpp @@ -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 ) ); diff --git a/src/common/Exd/ExdDataGenerated.h b/src/common/Exd/ExdDataGenerated.h index d77e606e..b4da203b 100644 --- a/src/common/Exd/ExdDataGenerated.h +++ b/src/common/Exd/ExdDataGenerated.h @@ -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 ); diff --git a/src/servers/sapphire_zone/Zone/Land.cpp b/src/servers/sapphire_zone/Zone/Land.cpp index a9c93b67..97d4b3b2 100644 --- a/src/servers/sapphire_zone/Zone/Land.cpp +++ b/src/servers/sapphire_zone/Zone/Land.cpp @@ -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(); } } \ No newline at end of file diff --git a/src/servers/sapphire_zone/Zone/Land.h b/src/servers/sapphire_zone/Zone/Land.h index 891e00b4..3add13d1 100644 --- a/src/servers/sapphire_zone/Zone/Land.h +++ b/src/servers/sapphire_zone/Zone/Land.h @@ -81,6 +81,7 @@ namespace Core uint32_t m_nextDrop; uint32_t m_devaluationTime; uint32_t m_currentPrice; + uint32_t m_minPrice; }; }