mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
more refactoring + sql
This commit is contained in:
parent
2c426b5059
commit
24520a8491
6 changed files with 19 additions and 4 deletions
|
@ -193,7 +193,7 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
|
|
||||||
/// HOUSING
|
/// HOUSING
|
||||||
prepareStatement( HOUSING_HOUSE_INS,
|
prepareStatement( HOUSING_HOUSE_INS,
|
||||||
"INSERT INTO house ( LandSetId, HouseId ) VALUES ( ?, ? );",
|
"INSERT INTO house ( LandSetId, HouseId, HouseName ) VALUES ( ?, ?, ? );",
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
prepareStatement( HOUSING_HOUSE_UP,
|
prepareStatement( HOUSING_HOUSE_UP,
|
||||||
|
|
|
@ -521,6 +521,20 @@ bool Sapphire::World::Manager::HousingMgr::initHouseModels( Entity::Player& play
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::World::Manager::HousingMgr::createHouse( Sapphire::HousePtr house ) const
|
||||||
|
{
|
||||||
|
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
|
|
||||||
|
auto stmt = pDb->getPreparedStatement( Db::HOUSING_HOUSE_INS );
|
||||||
|
// LandSetId, HouseId, HouseName
|
||||||
|
|
||||||
|
stmt->setUInt( 1, house->getLandSetId() );
|
||||||
|
stmt->setUInt( 2, house->getId() );
|
||||||
|
stmt->setString( 3, house->getHouseName() );
|
||||||
|
|
||||||
|
pDb->execute( stmt );
|
||||||
|
}
|
||||||
|
|
||||||
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem )
|
void Sapphire::World::Manager::HousingMgr::buildPresetEstate( Entity::Player& player, uint8_t plotNum, uint32_t presetItem )
|
||||||
{
|
{
|
||||||
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
auto hZone = std::dynamic_pointer_cast< HousingZone >( player.getCurrentZone() );
|
||||||
|
|
|
@ -142,6 +142,7 @@ namespace Sapphire::World::Manager
|
||||||
*/
|
*/
|
||||||
bool initHouseModels( Entity::Player& player, LandPtr land, uint32_t presetCatalogId );
|
bool initHouseModels( Entity::Player& player, LandPtr land, uint32_t presetCatalogId );
|
||||||
|
|
||||||
|
void createHouse( HousePtr house ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -53,7 +53,7 @@ Sapphire::Common::LandIdent Sapphire::House::getLandIdent() const
|
||||||
return m_landIdent;
|
return m_landIdent;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Sapphire::House::getHouseId() const
|
uint32_t Sapphire::House::getId() const
|
||||||
{
|
{
|
||||||
return m_houseId;
|
return m_houseId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Sapphire
|
||||||
//gerneral
|
//gerneral
|
||||||
uint32_t getLandSetId() const;
|
uint32_t getLandSetId() const;
|
||||||
Common::LandIdent getLandIdent() const;
|
Common::LandIdent getLandIdent() const;
|
||||||
uint32_t getHouseId() const;
|
uint32_t getId() const;
|
||||||
|
|
||||||
const std::string& getHouseName() const;
|
const std::string& getHouseName() const;
|
||||||
void setHouseName( const std::string& name );
|
void setHouseName( const std::string& name );
|
||||||
|
|
|
@ -232,7 +232,7 @@ void Sapphire::Land::updateLandDb()
|
||||||
uint32_t houseId = 0;
|
uint32_t houseId = 0;
|
||||||
|
|
||||||
if( getHouse() )
|
if( getHouse() )
|
||||||
houseId = getHouse()->getHouseId();
|
houseId = getHouse()->getId();
|
||||||
|
|
||||||
// todo: change to prepared statement
|
// todo: change to prepared statement
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
|
|
Loading…
Add table
Reference in a new issue