From d6d8edf57c2204acef2d0fc53bc0ccc0d3d11f5a Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sat, 29 Dec 2018 21:51:43 +1100 Subject: [PATCH] fix items being dropped from globalitem when moving to house inv --- src/world/Actor/PlayerInventory.cpp | 2 +- src/world/Inventory/ItemContainer.cpp | 4 ++-- src/world/Inventory/ItemContainer.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/world/Actor/PlayerInventory.cpp b/src/world/Actor/PlayerInventory.cpp index 5a7d18b3..d0b9cf82 100644 --- a/src/world/Actor/PlayerInventory.cpp +++ b/src/world/Actor/PlayerInventory.cpp @@ -876,7 +876,7 @@ Sapphire::ItemPtr Sapphire::Entity::Player::dropInventoryItem( Sapphire::Common: return nullptr; // unlink item - container->removeItem( slotId ); + container->removeItem( slotId, false ); updateContainer( type, slotId, nullptr ); auto seq = getNextInventorySequence(); diff --git a/src/world/Inventory/ItemContainer.cpp b/src/world/Inventory/ItemContainer.cpp index cd821092..490269c7 100644 --- a/src/world/Inventory/ItemContainer.cpp +++ b/src/world/Inventory/ItemContainer.cpp @@ -36,14 +36,14 @@ uint16_t Sapphire::ItemContainer::getEntryCount() const return static_cast< uint16_t >( m_itemMap.size() ); } -void Sapphire::ItemContainer::removeItem( uint16_t slotId ) +void Sapphire::ItemContainer::removeItem( uint16_t slotId, bool removeFromDb ) { auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >(); ItemMap::iterator it = m_itemMap.find( slotId ); if( it != m_itemMap.end() ) { - if( m_isPersistentStorage ) + if( m_isPersistentStorage && removeFromDb ) pDb->execute( "DELETE FROM charaglobalitem WHERE itemId = " + std::to_string( it->second->getUId() ) ); m_itemMap.erase( it ); diff --git a/src/world/Inventory/ItemContainer.h b/src/world/Inventory/ItemContainer.h index a6fdb19b..ea857d82 100644 --- a/src/world/Inventory/ItemContainer.h +++ b/src/world/Inventory/ItemContainer.h @@ -23,7 +23,7 @@ namespace Sapphire uint16_t getEntryCount() const; - void removeItem( uint16_t slotId ); + void removeItem( uint16_t slotId, bool removeFromDb = true ); ItemMap& getItemMap();