mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
set IS_DELETE flag on discarded/deleted items
This commit is contained in:
parent
3ac70352d1
commit
12dcee8b8a
3 changed files with 16 additions and 5 deletions
|
@ -404,6 +404,12 @@ void Core::Inventory::updateItemDb( Core::ItemPtr pItem ) const
|
||||||
" WHERE itemId = " + std::to_string( pItem->getUId() ) );
|
" WHERE itemId = " + std::to_string( pItem->getUId() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Core::Inventory::deleteItemDb( Core::ItemPtr item ) const
|
||||||
|
{
|
||||||
|
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||||
|
pDb->execute( "UPDATE charaglobalitem SET IS_DELETE = 1 WHERE itemId = " + std::to_string( item->getUId() ) );
|
||||||
|
}
|
||||||
|
|
||||||
bool Core::Inventory::removeCurrency( CurrencyType type, uint32_t amount )
|
bool Core::Inventory::removeCurrency( CurrencyType type, uint32_t amount )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -649,19 +655,20 @@ void Core::Inventory::mergeItem( uint16_t fromInventoryId, uint8_t fromSlotId, u
|
||||||
if( stackOverflow == 0 )
|
if( stackOverflow == 0 )
|
||||||
{
|
{
|
||||||
m_inventoryMap[fromInventoryId]->removeItem( fromSlotId );
|
m_inventoryMap[fromInventoryId]->removeItem( fromSlotId );
|
||||||
fromItem = nullptr;
|
deleteItemDb( fromItem );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fromItem->setStackSize( stackOverflow );
|
fromItem->setStackSize( stackOverflow );
|
||||||
|
updateItemDb( fromItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
toItem->setStackSize( stackSize );
|
toItem->setStackSize( stackSize );
|
||||||
|
updateItemDb( toItem );
|
||||||
|
|
||||||
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
||||||
updateContainer( toInventoryId, toSlot, toItem );
|
updateContainer( toInventoryId, toSlot, toItem );
|
||||||
|
|
||||||
updateItemDb( toItem );
|
|
||||||
if( fromItem )
|
|
||||||
updateItemDb( fromItem );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Inventory::swapItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot )
|
void Core::Inventory::swapItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot )
|
||||||
|
@ -697,6 +704,8 @@ void Core::Inventory::discardItem( uint16_t fromInventoryId, uint8_t fromSlotId
|
||||||
uint32_t transactionId = 1;
|
uint32_t transactionId = 1;
|
||||||
|
|
||||||
auto fromItem = m_inventoryMap[fromInventoryId]->getItem( fromSlotId );
|
auto fromItem = m_inventoryMap[fromInventoryId]->getItem( fromSlotId );
|
||||||
|
|
||||||
|
deleteItemDb( fromItem );
|
||||||
|
|
||||||
m_inventoryMap[fromInventoryId]->removeItem( fromSlotId );
|
m_inventoryMap[fromInventoryId]->removeItem( fromSlotId );
|
||||||
updateContainer( fromInventoryId, fromSlotId, nullptr );
|
updateContainer( fromInventoryId, fromSlotId, nullptr );
|
||||||
|
|
|
@ -170,6 +170,7 @@ public:
|
||||||
void updateBagDb( InventoryType type );
|
void updateBagDb( InventoryType type );
|
||||||
void updateMannequinDb( InventoryType type );
|
void updateMannequinDb( InventoryType type );
|
||||||
void updateItemDb( ItemPtr pItem ) const;
|
void updateItemDb( ItemPtr pItem ) const;
|
||||||
|
void deleteItemDb( ItemPtr pItem ) const;
|
||||||
|
|
||||||
bool isArmory( uint16_t containerId );
|
bool isArmory( uint16_t containerId );
|
||||||
bool isEquipment( uint16_t containerId );
|
bool isEquipment( uint16_t containerId );
|
||||||
|
|
|
@ -47,6 +47,7 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::GameP
|
||||||
uint8_t toSlot = inPacket.getValAt< uint8_t >( 0x44 );
|
uint8_t toSlot = inPacket.getValAt< uint8_t >( 0x44 );
|
||||||
uint16_t fromContainer = inPacket.getValAt< uint16_t >( 0x2C );
|
uint16_t fromContainer = inPacket.getValAt< uint16_t >( 0x2C );
|
||||||
uint16_t toContainer = inPacket.getValAt< uint16_t >( 0x40 );
|
uint16_t toContainer = inPacket.getValAt< uint16_t >( 0x40 );
|
||||||
|
// todo: check packet handler in game and see if this is sent as a u16 or u32
|
||||||
uint16_t splitCount = inPacket.getValAt< uint16_t >( 0x48 );
|
uint16_t splitCount = inPacket.getValAt< uint16_t >( 0x48 );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( player.getId() );
|
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( player.getId() );
|
||||||
|
|
Loading…
Add table
Reference in a new issue