mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-24 18:47:45 +00:00
refactor: fix coding style inconsistencies in loading
This commit is contained in:
parent
4cf82723bc
commit
b2bd202ed7
2 changed files with 12 additions and 12 deletions
|
@ -301,7 +301,7 @@ void Sapphire::Entity::Player::addCurrency( CurrencyType type, uint32_t amount )
|
|||
|
||||
uint32_t currentAmount = currItem->getStackSize();
|
||||
currItem->setStackSize( currentAmount + amount );
|
||||
writeMoney( type );
|
||||
writeCurrencyItem( type );
|
||||
|
||||
updateContainer( Currency, slot, currItem );
|
||||
|
||||
|
@ -339,7 +339,7 @@ void Sapphire::Entity::Player::removeCurrency( Common::CurrencyType type, uint32
|
|||
currItem->setStackSize( 0 );
|
||||
else
|
||||
currItem->setStackSize( currentAmount - amount );
|
||||
writeItem( currItem );
|
||||
writeCurrencyItem(type);
|
||||
|
||||
auto seq = getNextInventorySequence();
|
||||
|
||||
|
|
|
@ -696,7 +696,7 @@ bool Sapphire::Entity::Player::loadInventory()
|
|||
}
|
||||
}
|
||||
|
||||
auto moneyRes = db.query("SELECT storageId, "
|
||||
auto currencyRes = db.query("SELECT storageId, "
|
||||
"container_0, container_1, container_2, container_3, container_4, "
|
||||
"container_5, container_6, container_7, container_8, container_9, "
|
||||
"container_10, container_11 "
|
||||
|
@ -704,22 +704,22 @@ bool Sapphire::Entity::Player::loadInventory()
|
|||
"WHERE CharacterId = " + std::to_string(m_characterId) + " " \
|
||||
"ORDER BY storageId ASC;");
|
||||
|
||||
while ( moneyRes->next() )
|
||||
while ( currencyRes->next() )
|
||||
{
|
||||
uint16_t storageId = moneyRes->getUInt16( 1 );
|
||||
uint32_t money = moneyRes->getUInt64(2);
|
||||
uint16_t storageId = currencyRes->getUInt16( 1 );
|
||||
uint32_t money = currencyRes->getUInt64( 2 );
|
||||
|
||||
auto slot = static_cast<uint8_t>(static_cast<uint8_t>(CurrencyType::Gil) - 1);
|
||||
auto currItem = m_storageMap[Currency]->getItem(slot);
|
||||
auto slot = static_cast< uint8_t >( static_cast<uint8_t>( CurrencyType::Gil ) - 1 );
|
||||
auto currItem = m_storageMap[ Currency ]->getItem( slot );
|
||||
|
||||
if (!currItem)
|
||||
if ( !currItem )
|
||||
{
|
||||
// TODO: map currency type to itemid
|
||||
currItem = createItem(1);
|
||||
m_storageMap[Currency]->setItem(slot, currItem);
|
||||
currItem = createItem( 1 );
|
||||
m_storageMap[ Currency ]->setItem( slot, currItem );
|
||||
}
|
||||
|
||||
m_storageMap[Currency]->getItem(slot)->setStackSize(money);
|
||||
m_storageMap[ Currency ]->getItem( slot )->setStackSize( money );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue