diff --git a/src/servers/sapphire_zone/Actor/Player.h b/src/servers/sapphire_zone/Actor/Player.h index cce73edb..6b204d3e 100644 --- a/src/servers/sapphire_zone/Actor/Player.h +++ b/src/servers/sapphire_zone/Actor/Player.h @@ -605,7 +605,7 @@ public: using InvSlotPair = std::pair< uint16_t, int8_t >; using InvSlotPairVec = std::vector< InvSlotPair >; - ItemPtr createItem( uint32_t catalogId, uint16_t quantity = 1 ); + ItemPtr createItem( uint32_t catalogId, uint32_t quantity = 1 ); bool loadInventory(); InvSlotPairVec getSlotsOfItemsInInventory( uint32_t catalogId ); InvSlotPair getFreeBagSlot(); @@ -625,7 +625,6 @@ public: /*! return the current amount of currency of type */ uint32_t getCurrency( Common::CurrencyType type ); - void updateCurrencyDb(); void updateBagDb( Common::InventoryType type ); void updateMannequinDb( Common::InventoryType type ); void updateItemDb( ItemPtr pItem ) const; @@ -639,8 +638,6 @@ public: void removeCrystal( Common::CrystalType type, uint32_t amount ); bool isObtainable( uint32_t catalogId, uint8_t quantity ); - void updateCrystalDb(); - void send(); uint8_t getFreeSlotsInBags(); diff --git a/src/servers/sapphire_zone/Actor/PlayerSql.cpp b/src/servers/sapphire_zone/Actor/PlayerSql.cpp index 04a3d900..e72c0b7f 100644 --- a/src/servers/sapphire_zone/Actor/PlayerSql.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerSql.cpp @@ -557,7 +557,7 @@ void Core::Entity::Player::insertQuest( uint16_t questId, uint8_t index, uint8_t pDb->execute( stmt ); } -Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint16_t quantity ) +Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint32_t quantity ) { auto pExdData = g_fw.get< Data::ExdDataGenerated >(); auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >(); @@ -566,8 +566,6 @@ Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint16_t qua if( !itemInfo ) return nullptr; - auto itemAmount = std::min< uint16_t >( quantity, static_cast< uint16_t >( itemInfo->stackSize ) ); - if( !itemInfo ) return nullptr; @@ -578,13 +576,13 @@ Core::ItemPtr Core::Entity::Player::createItem( uint32_t catalogId, uint16_t qua itemInfo->modelMain, itemInfo->modelSub ); - pItem->setStackSize( itemAmount ); + pItem->setStackSize( quantity ); pDb->execute( "INSERT INTO charaglobalitem ( CharacterId, itemId, catalogId, stack, flags ) VALUES ( " + std::to_string( getId() ) + ", " + std::to_string( pItem->getUId() ) + ", " + std::to_string( pItem->getId() ) + ", " + - std::to_string( itemAmount ) + ", " + + std::to_string( quantity ) + ", " + std::to_string( flags ) + ");" ); return pItem; diff --git a/src/servers/sapphire_zone/Inventory/Item.cpp b/src/servers/sapphire_zone/Inventory/Item.cpp index e16a294a..cf959296 100644 --- a/src/servers/sapphire_zone/Inventory/Item.cpp +++ b/src/servers/sapphire_zone/Inventory/Item.cpp @@ -84,7 +84,7 @@ void Core::Item::setUId( uint64_t id ) void Core::Item::setStackSize( uint32_t size ) { - m_stackSize = size; + m_stackSize = std::min< uint32_t >( size, m_maxStackSize ); } uint32_t Core::Item::getStackSize() const