mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17:45 +00:00
Inventory fix.
This commit is contained in:
parent
28b2d1558c
commit
6dc03653cf
5 changed files with 16 additions and 14 deletions
|
@ -49,13 +49,13 @@ namespace Sapphire::Common
|
|||
uint8_t plot;
|
||||
};
|
||||
|
||||
enum InventoryOperation : uint8_t
|
||||
enum InventoryOperation : uint16_t
|
||||
{
|
||||
Discard = 0x07,
|
||||
Move = 0x08,
|
||||
Swap = 0x09,
|
||||
Merge = 0x0C,
|
||||
Split = 0x0A
|
||||
Discard = 0x2EB,
|
||||
Move = 0x2EC,
|
||||
Swap = 0x2ED,
|
||||
Merge = 0x2F0,
|
||||
Split = 0x2EE
|
||||
};
|
||||
|
||||
enum ClientLanguage : uint8_t
|
||||
|
|
|
@ -217,7 +217,7 @@ struct FFXIVIpcInventoryModifyHandler :
|
|||
{
|
||||
/* 0000 */ uint32_t seq;
|
||||
/* 0004 */ Common::InventoryOperation action;
|
||||
/* 0005 */ uint8_t pad_0005[7];
|
||||
/* 0005 */ uint8_t pad_0005[6];
|
||||
/* 000C */ uint16_t fromContainer;
|
||||
/* 000E */ uint8_t pad_000E[2];
|
||||
/* 0010 */ uint8_t fromSlot;
|
||||
|
|
|
@ -1295,8 +1295,7 @@ namespace Sapphire::Network::Packets::Server
|
|||
struct FFXIVIpcInventoryTransaction : FFXIVIpcBasePacket< InventoryTransaction >
|
||||
{
|
||||
uint32_t sequence;
|
||||
uint8_t type;
|
||||
uint8_t padding;
|
||||
uint16_t type;
|
||||
uint16_t padding1;
|
||||
uint32_t ownerId;
|
||||
uint32_t storageId;
|
||||
|
|
|
@ -918,7 +918,7 @@ namespace Sapphire::Entity
|
|||
|
||||
InvSlotPair getFreeBagSlot();
|
||||
|
||||
Sapphire::ItemPtr addItem( uint32_t catalogId, uint32_t quantity = 1, bool isHq = false, bool slient = false );
|
||||
Sapphire::ItemPtr addItem( uint32_t catalogId, uint32_t quantity = 1, bool isHq = false, bool slient = false, bool canMerge = true );
|
||||
|
||||
void moveItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot );
|
||||
|
||||
|
|
|
@ -534,7 +534,7 @@ bool Sapphire::Entity::Player::isObtainable( uint32_t catalogId, uint8_t quantit
|
|||
}
|
||||
|
||||
|
||||
Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_t quantity, bool isHq, bool silent )
|
||||
Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_t quantity, bool isHq, bool silent, bool canMerge )
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
|
@ -570,10 +570,13 @@ Sapphire::ItemPtr Sapphire::Entity::Player::addItem( uint32_t catalogId, uint32_
|
|||
|
||||
for( uint8_t slot = 0; slot < storage->getMaxSize(); slot++ )
|
||||
{
|
||||
if ( !canMerge && foundFreeSlot )
|
||||
break;
|
||||
|
||||
auto item = storage->getItem( slot );
|
||||
|
||||
// add any items that are stackable
|
||||
if( item && !itemInfo->isEquippable && item->getId() == catalogId )
|
||||
if( canMerge && item && !itemInfo->isEquippable && item->getId() == catalogId )
|
||||
{
|
||||
uint32_t count = item->getStackSize();
|
||||
uint32_t maxStack = item->getMaxStackSize();
|
||||
|
@ -742,7 +745,7 @@ void Sapphire::Entity::Player::splitItem( uint16_t fromInventoryId, uint8_t from
|
|||
// todo: correct invalid move? again, not sure what retail does here
|
||||
return;
|
||||
|
||||
auto newItem = addItem( fromItem->getId(), itemCount, fromItem->isHq(), true );
|
||||
auto newItem = addItem( fromItem->getId(), itemCount, fromItem->isHq(), true, false );
|
||||
if( !newItem )
|
||||
return;
|
||||
|
||||
|
@ -840,7 +843,7 @@ void Sapphire::Entity::Player::discardItem( uint16_t fromInventoryId, uint8_t fr
|
|||
invTransPacket->data().catalogId = fromItem->getId();
|
||||
invTransPacket->data().stackSize = fromItem->getStackSize();
|
||||
invTransPacket->data().slotId = fromSlotId;
|
||||
invTransPacket->data().type = 7;
|
||||
invTransPacket->data().type = Common::InventoryOperation::Discard;
|
||||
queuePacket( invTransPacket );
|
||||
|
||||
auto invTransFinPacket = makeZonePacket< FFXIVIpcInventoryTransactionFinish >( getId() );
|
||||
|
|
Loading…
Add table
Reference in a new issue