1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-05 02:07:46 +00:00

fix item splitting

This commit is contained in:
NotAdam 2018-08-12 22:30:18 +10:00
parent 1a95399a7e
commit 0a0dcf59ae
3 changed files with 16 additions and 10 deletions

View file

@ -153,9 +153,7 @@ struct FFXIVIpcInventoryModifyHandler : FFXIVIpcBasePacket< InventoryModifyHandl
{ {
/* 0000 */ uint32_t seq; /* 0000 */ uint32_t seq;
/* 0004 */ Common::InventoryOperation action; /* 0004 */ Common::InventoryOperation action;
/* 0005 */ char pad_0005[3]; /* 0005 */ char pad_0005[7];
/* 0008 */ uint16_t splitCount; // todo: check packet handler in game and see if this is sent as a u16 or u32
/* 000A */ char pad_000A[2];
/* 000C */ uint16_t fromContainer; /* 000C */ uint16_t fromContainer;
/* 000E */ char pad_000E[2]; /* 000E */ char pad_000E[2];
/* 0010 */ uint8_t fromSlot; /* 0010 */ uint8_t fromSlot;
@ -163,6 +161,8 @@ struct FFXIVIpcInventoryModifyHandler : FFXIVIpcBasePacket< InventoryModifyHandl
/* 0020 */ uint16_t toContainer; /* 0020 */ uint16_t toContainer;
/* 0022 */ char pad_0022[2]; /* 0022 */ char pad_0022[2];
/* 0024 */ uint8_t toSlot; /* 0024 */ uint8_t toSlot;
/* 0025 */ uint8_t pad_0025[3];
/* 0028 */ uint32_t splitCount;
}; };
} }

View file

@ -533,16 +533,19 @@ int16_t Core::Entity::Player::addItem( uint16_t inventoryId, int8_t slotId, uint
" WHERE storageId = " + std::to_string( inventoryId ) + " WHERE storageId = " + std::to_string( inventoryId ) +
" AND CharacterId = " + std::to_string( getId() ) ); " AND CharacterId = " + std::to_string( getId() ) );
if( !slient )
{
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(),
rSlotId, rSlotId,
inventoryId, inventoryId,
*item ); *item );
queuePacket( invUpdate ); queuePacket( invUpdate );
if( !silent )
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ItemObtainIcon, queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ItemObtainIcon,
catalogId, item->getStackSize() ) ); catalogId, item->getStackSize() ) );
}
} }
@ -613,6 +616,9 @@ bool Core::Entity::Player::updateContainer( uint16_t storageId, uint8_t slotId,
void Core::Entity::Player::splitItem( uint16_t fromInventoryId, uint8_t fromSlotId, void Core::Entity::Player::splitItem( uint16_t fromInventoryId, uint8_t fromSlotId,
uint16_t toInventoryId, uint8_t toSlot, uint16_t itemCount ) uint16_t toInventoryId, uint8_t toSlot, uint16_t itemCount )
{ {
if( itemCount == 0 )
return;
auto fromItem = m_storageMap[fromInventoryId]->getItem( fromSlotId ); auto fromItem = m_storageMap[fromInventoryId]->getItem( fromSlotId );
if( !fromItem ) if( !fromItem )
return; return;

View file

@ -4,7 +4,7 @@
#include <string> #include <string>
#include <typeinfo> #include <typeinfo>
#include <typeindex> #include <typeindex>
#include <sapphire_zone/Event/EventHandler.h> #include <Event/EventHandler.h>
#include "Forwards.h" #include "Forwards.h"
#ifdef _MSC_VER #ifdef _MSC_VER