mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
container db fix
This commit is contained in:
parent
1689b3fd1a
commit
413c69aa41
2 changed files with 9 additions and 7 deletions
|
@ -948,7 +948,7 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
ItemPtr getItemAt( uint16_t containerId, uint8_t slotId );
|
ItemPtr getItemAt( uint16_t containerId, uint8_t slotId );
|
||||||
|
|
||||||
bool updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem );
|
bool updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem, bool writeToDb = true );
|
||||||
|
|
||||||
/*! calculate and return player ilvl based off equipped gear */
|
/*! calculate and return player ilvl based off equipped gear */
|
||||||
uint16_t calculateEquippedGearItemLevel();
|
uint16_t calculateEquippedGearItemLevel();
|
||||||
|
|
|
@ -739,7 +739,7 @@ Sapphire::Entity::Player::moveItem( uint16_t fromInventoryId, uint8_t fromSlotId
|
||||||
sendStatusEffectUpdate(); // send if any equip is changed
|
sendStatusEffectUpdate(); // send if any equip is changed
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem )
|
bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem, bool writeToDb )
|
||||||
{
|
{
|
||||||
auto containerType = World::Manager::ItemMgr::getContainerType( storageId );
|
auto containerType = World::Manager::ItemMgr::getContainerType( storageId );
|
||||||
|
|
||||||
|
@ -752,7 +752,8 @@ bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slot
|
||||||
case Bag:
|
case Bag:
|
||||||
case CurrencyCrystal:
|
case CurrencyCrystal:
|
||||||
{
|
{
|
||||||
writeInventory( static_cast< InventoryType >( storageId ) );
|
if( writeToDb )
|
||||||
|
writeInventory( static_cast< InventoryType >( storageId ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,7 +768,8 @@ bool Sapphire::Entity::Player::updateContainer( uint16_t storageId, uint8_t slot
|
||||||
else
|
else
|
||||||
unequipItem( static_cast< GearSetSlot >( slotId ), pItem, true );
|
unequipItem( static_cast< GearSetSlot >( slotId ), pItem, true );
|
||||||
|
|
||||||
writeInventory( static_cast< InventoryType >( storageId ) );
|
if( writeToDb )
|
||||||
|
writeInventory( static_cast< InventoryType >( storageId ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -804,7 +806,7 @@ void Sapphire::Entity::Player::splitItem( uint16_t fromInventoryId, uint8_t from
|
||||||
|
|
||||||
fromItem->setStackSize( fromItem->getStackSize() - itemCount );
|
fromItem->setStackSize( fromItem->getStackSize() - itemCount );
|
||||||
|
|
||||||
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
updateContainer( fromInventoryId, fromSlotId, fromItem, fromInventoryId != toInventoryId );
|
||||||
updateContainer( toInventoryId, toSlot, newItem );
|
updateContainer( toInventoryId, toSlot, newItem );
|
||||||
|
|
||||||
updateItemDb( fromItem );
|
updateItemDb( fromItem );
|
||||||
|
@ -835,7 +837,7 @@ void Sapphire::Entity::Player::mergeItem( uint16_t fromInventoryId, uint8_t from
|
||||||
{
|
{
|
||||||
fromItem->setStackSize( stackOverflow );
|
fromItem->setStackSize( stackOverflow );
|
||||||
updateItemDb( fromItem );
|
updateItemDb( fromItem );
|
||||||
updateContainer( fromInventoryId, fromSlotId, fromItem );
|
updateContainer( fromInventoryId, fromSlotId, fromItem, fromInventoryId != toInventoryId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -871,7 +873,7 @@ void Sapphire::Entity::Player::swapItem( uint16_t fromInventoryId, uint8_t fromS
|
||||||
auto containerTypeFrom = World::Manager::ItemMgr::getContainerType( fromInventoryId );
|
auto containerTypeFrom = World::Manager::ItemMgr::getContainerType( fromInventoryId );
|
||||||
auto containerTypeTo = World::Manager::ItemMgr::getContainerType( toInventoryId );
|
auto containerTypeTo = World::Manager::ItemMgr::getContainerType( toInventoryId );
|
||||||
|
|
||||||
updateContainer( toInventoryId, toSlot, fromItem );
|
updateContainer( toInventoryId, toSlot, fromItem, fromInventoryId != toInventoryId );
|
||||||
updateContainer( fromInventoryId, fromSlotId, toItem );
|
updateContainer( fromInventoryId, fromSlotId, toItem );
|
||||||
|
|
||||||
if( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
|
if( static_cast< InventoryType >( toInventoryId ) == GearSet0 ||
|
||||||
|
|
Loading…
Add table
Reference in a new issue