1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-24 18:47:45 +00:00

refactor: fix coding system inconsistencies

This commit is contained in:
Matthe815 2023-01-06 09:59:23 -05:00
parent b9aee98a7c
commit 4cf82723bc
No known key found for this signature in database
GPG key ID: 6B963FE816B1DC39
3 changed files with 8 additions and 5 deletions

View file

@ -736,7 +736,7 @@ namespace Sapphire::Entity
void writeItem( ItemPtr pItem ) const;
void writeMoney(Common::CurrencyType type);
void writeCurrencyItem( Common::CurrencyType type );
void deleteItemDb( ItemPtr pItem ) const;

View file

@ -531,7 +531,7 @@ void Sapphire::Entity::Player::writeInventory( InventoryType type )
if( i > 0 )
query += ", ";
query += "container_" + std::to_string( i ) + " = " + std::to_string( currItem ? currItem->getUId() : 0 );
query += "container_" + std::to_string( i ) + " = " + std::to_string( currItem ? currItem->getUId() : 0 );
}
query += " WHERE CharacterId = " + std::to_string( getCharacterId() );
@ -557,13 +557,16 @@ void Sapphire::Entity::Player::writeItem( Sapphire::ItemPtr pItem ) const
db.directExecute( stmt );
}
void Sapphire::Entity::Player::writeMoney(CurrencyType type)
void Sapphire::Entity::Player::writeCurrencyItem( CurrencyType type )
{
auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref();
std::string query = "UPDATE charaitemcurrency SET ";
auto money = m_storageMap[Currency]->getItem(static_cast<uint16_t>(type) - 1)->getStackSize();
std::string query = "UPDATE charaitemcurrency SET ";
query += "container_" + std::to_string(static_cast<int16_t>(type) - 1) + " = " + std::to_string(money);
query += " WHERE CharacterId = " + std::to_string(getCharacterId()) + ";";
db.execute(query);

View file

@ -323,7 +323,7 @@ void Sapphire::Entity::Player::updateDbChara() const
stmt->setInt( 1, getHp() );
stmt->setInt( 2, getMp() );
stmt->setInt( 3, 0 ); // TP
stmt->setInt( 3, getTp() ); // TP
stmt->setInt( 4, 0 ); // GP
stmt->setInt( 5, 0 ); // Mode
stmt->setUInt( 6, m_mount ); // Mount