1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

Merge pull request #639 from collett8192/5.2_fix_part_3

Inventory fix and more opcode update.
This commit is contained in:
Adam 2020-02-24 21:13:38 +11:00 committed by GitHub
commit ad45d41b8f
6 changed files with 22 additions and 20 deletions

View file

@ -49,13 +49,13 @@ namespace Sapphire::Common
uint8_t plot; uint8_t plot;
}; };
enum InventoryOperation : uint8_t enum InventoryOperation : uint16_t
{ {
Discard = 0x07, Discard = 0x2EB,
Move = 0x08, Move = 0x2EC,
Swap = 0x09, Swap = 0x2ED,
Merge = 0x0C, Merge = 0x2F0,
Split = 0x0A Split = 0x2EE
}; };
enum ClientLanguage : uint8_t enum ClientLanguage : uint8_t

View file

@ -158,7 +158,7 @@ namespace Sapphire::Network::Packets
PlayerStateFlags = 0x032B, // updated 5.2 PlayerStateFlags = 0x032B, // updated 5.2
PlayerClassInfo = 0x039A, // updated 5.2 PlayerClassInfo = 0x039A, // updated 5.2
ModelEquip = 0x02E6, // updated 5.18 ModelEquip = 0x03C9, // updated 5.2
Examine = 0x038B, // updated 5.2 Examine = 0x038B, // updated 5.2
CharaNameReq = 0x0116, // updated 5.18 CharaNameReq = 0x0116, // updated 5.18
@ -194,10 +194,10 @@ namespace Sapphire::Network::Packets
EventLinkshell = 0x1169, EventLinkshell = 0x1169,
QuestActiveList = 0x017B, // updated 5.2 QuestActiveList = 0x017B, // updated 5.2
QuestUpdate = 0x0066, // updated 5.18 QuestUpdate = 0x02CE, // updated 5.2
QuestCompleteList = 0x0255, // updated 5.2 QuestCompleteList = 0x0255, // updated 5.2
QuestFinish = 0x013A, // updated 5.18 QuestFinish = 0x006F, // updated 5.2
MSQTrackerComplete = 0x01D6, // updated 5.0 MSQTrackerComplete = 0x01D6, // updated 5.0
MSQTrackerProgress = 0xF1CD, // updated 4.5 ? this actually looks like the two opcodes have been combined, see #474 MSQTrackerProgress = 0xF1CD, // updated 4.5 ? this actually looks like the two opcodes have been combined, see #474
@ -353,9 +353,9 @@ namespace Sapphire::Network::Packets
TalkEventHandler = 0x0340, // updated 5.2 TalkEventHandler = 0x0340, // updated 5.2
EmoteEventHandler = 0x0183, // updated 5.18 EmoteEventHandler = 0x0183, // updated 5.18
WithinRangeEventHandler = 0x0167, // updated 5.18 WithinRangeEventHandler = 0x010E, // updated 5.2
OutOfRangeEventHandler = 0x02B5, // updated 5.18 OutOfRangeEventHandler = 0x00AE, // updated 5.2
EnterTeriEventHandler = 0x0267, // updated 5.18 EnterTeriEventHandler = 0x00C1, // updated 5.2
ShopEventHandler = 0x0156, // updated 5.0 ShopEventHandler = 0x0156, // updated 5.0
ReturnEventHandler = 0x027F, // updated 5.2 ReturnEventHandler = 0x027F, // updated 5.2

View file

@ -217,7 +217,7 @@ struct FFXIVIpcInventoryModifyHandler :
{ {
/* 0000 */ uint32_t seq; /* 0000 */ uint32_t seq;
/* 0004 */ Common::InventoryOperation action; /* 0004 */ Common::InventoryOperation action;
/* 0005 */ uint8_t pad_0005[7]; /* 0006 */ uint8_t pad_0006[6];
/* 000C */ uint16_t fromContainer; /* 000C */ uint16_t fromContainer;
/* 000E */ uint8_t pad_000E[2]; /* 000E */ uint8_t pad_000E[2];
/* 0010 */ uint8_t fromSlot; /* 0010 */ uint8_t fromSlot;

View file

@ -1295,8 +1295,7 @@ namespace Sapphire::Network::Packets::Server
struct FFXIVIpcInventoryTransaction : FFXIVIpcBasePacket< InventoryTransaction > struct FFXIVIpcInventoryTransaction : FFXIVIpcBasePacket< InventoryTransaction >
{ {
uint32_t sequence; uint32_t sequence;
uint8_t type; uint16_t type;
uint8_t padding;
uint16_t padding1; uint16_t padding1;
uint32_t ownerId; uint32_t ownerId;
uint32_t storageId; uint32_t storageId;

View file

@ -918,7 +918,7 @@ namespace Sapphire::Entity
InvSlotPair getFreeBagSlot(); 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 ); void moveItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot );

View file

@ -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 pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
auto pExdData = m_pFw->get< Data::ExdDataGenerated >(); 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++ ) for( uint8_t slot = 0; slot < storage->getMaxSize(); slot++ )
{ {
if( !canMerge && foundFreeSlot )
break;
auto item = storage->getItem( slot ); auto item = storage->getItem( slot );
// add any items that are stackable // 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 count = item->getStackSize();
uint32_t maxStack = item->getMaxStackSize(); 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 // todo: correct invalid move? again, not sure what retail does here
return; return;
auto newItem = addItem( fromItem->getId(), itemCount, fromItem->isHq(), true ); auto newItem = addItem( fromItem->getId(), itemCount, fromItem->isHq(), true, false );
if( !newItem ) if( !newItem )
return; return;
@ -840,7 +843,7 @@ void Sapphire::Entity::Player::discardItem( uint16_t fromInventoryId, uint8_t fr
invTransPacket->data().catalogId = fromItem->getId(); invTransPacket->data().catalogId = fromItem->getId();
invTransPacket->data().stackSize = fromItem->getStackSize(); invTransPacket->data().stackSize = fromItem->getStackSize();
invTransPacket->data().slotId = fromSlotId; invTransPacket->data().slotId = fromSlotId;
invTransPacket->data().type = 7; invTransPacket->data().type = Common::InventoryOperation::Discard;
queuePacket( invTransPacket ); queuePacket( invTransPacket );
auto invTransFinPacket = makeZonePacket< FFXIVIpcInventoryTransactionFinish >( getId() ); auto invTransFinPacket = makeZonePacket< FFXIVIpcInventoryTransactionFinish >( getId() );