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

inventorymodifyhandler packet structure

This commit is contained in:
NotAdam 2018-07-08 21:11:22 +10:00
parent 82b9c72d6f
commit cd3e2f0b52
3 changed files with 35 additions and 22 deletions

View file

@ -27,6 +27,15 @@ namespace Common {
float z;
};
enum InventoryOperation : uint8_t
{
Discard = 0x07,
Move = 0x08,
Swap = 0x09,
Merge = 0x0C,
Split = 0x0A
};
enum ClientLanguage : uint8_t
{
Japanese = 1,

View file

@ -147,6 +147,22 @@ struct FFXIVIpcLinkshellEventHandler : FFXIVIpcBasePacket< LinkshellEventHandler
/* 0007 */ char lsName[21];
};
struct FFXIVIpcInventoryModifyHandler : FFXIVIpcBasePacket< InventoryModifyHandler >
{
/* 0000 */ uint32_t seq;
/* 0004 */ Common::InventoryOperation action;
/* 0005 */ char pad_0005[3];
/* 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;
/* 000E */ char pad_000E[2];
/* 0010 */ uint8_t fromSlot;
/* 0011 */ char pad_0011[15];
/* 0020 */ uint16_t toContainer;
/* 0022 */ char pad_0022[2];
/* 0024 */ uint8_t toSlot;
};
}
}
}

View file

@ -5,6 +5,7 @@
#include <Network/GamePacketNew.h>
#include <Logging/Logger.h>
#include <Network/PacketContainer.h>
#include <Network/PacketDef/Zone/ClientZoneDef.h>
#include "Network/GameConnection.h"
#include "Network/PacketWrappers/ServerNoticePacket.h"
@ -29,39 +30,26 @@ using namespace Core::Common;
using namespace Core::Network::Packets;
using namespace Core::Network::Packets::Server;
enum InventoryOperation
{
Discard = 0x07,
Move = 0x08,
Swap = 0x09,
Merge = 0x0C,
Split = 0x0A
};
void Core::Network::GameConnection::inventoryModifyHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
Entity::Player& player )
{
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
auto seq = *reinterpret_cast< uint32_t* >( &copy.data[0x1] ); //
auto action = *reinterpret_cast< uint8_t* >( &copy.data[0x4] ); //
auto fromSlot = *reinterpret_cast< uint8_t* >( &copy.data[0x10] );
auto toSlot = *reinterpret_cast< uint8_t* >( &copy.data[0x24] );
const auto packet = ZoneChannelPacket< Client::FFXIVIpcInventoryModifyHandler >( inPacket );
auto fromContainer = *reinterpret_cast< uint16_t* >( &copy.data[0xC] ); //
auto toContainer = *reinterpret_cast< uint16_t* >( &copy.data[0x20] );
const auto& action = packet.data().action;
const auto& splitCount = packet.data().splitCount;
// todo: check packet handler in game and see if this is sent as a u16 or u32
auto splitCount = *reinterpret_cast< uint16_t* >( &copy.data[0x28] );
const auto& fromSlot = packet.data().fromSlot;
const auto& fromContainer = packet.data().fromContainer;
const auto& toSlot = packet.data().toSlot;
const auto& toContainer = packet.data().toContainer;
auto ackPacket = makeZonePacket< FFXIVIpcInventoryActionAck >( player.getId() );
ackPacket->data().sequence = seq;
auto ackPacket = makeZonePacket< Server::FFXIVIpcInventoryActionAck >( player.getId() );
ackPacket->data().sequence = packet.data().seq;
ackPacket->data().type = 7;
player.queuePacket( ackPacket );
auto pLog = g_fw.get< Logger >();
//pLog->debug( inPacket.toString() );
pLog->debug( "InventoryAction: " + std::to_string( action ) );
// TODO: other inventory operations need to be implemented