2018-03-06 22:22:19 +01:00
|
|
|
#include <Common.h>
|
|
|
|
#include <Network/CommonNetwork.h>
|
|
|
|
#include <Network/GamePacketNew.h>
|
|
|
|
#include <Logging/Logger.h>
|
|
|
|
#include <Network/PacketContainer.h>
|
2018-07-08 21:11:22 +10:00
|
|
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2017-12-08 15:38:25 +01:00
|
|
|
#include "Network/GameConnection.h"
|
|
|
|
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-12-01 00:27:16 +11:00
|
|
|
#include "Territory/Zone.h"
|
|
|
|
#include "Territory/ZonePosition.h"
|
2018-03-02 07:22:25 -03:00
|
|
|
|
2018-12-22 22:25:03 +01:00
|
|
|
#include "Manager/DebugCommandMgr.h"
|
2017-12-08 15:38:25 +01:00
|
|
|
#include "Actor/Player.h"
|
2018-03-02 07:22:25 -03:00
|
|
|
|
|
|
|
#include "Session.h"
|
2018-11-20 21:32:13 +01:00
|
|
|
#include "ServerMgr.h"
|
2018-06-02 15:52:35 +02:00
|
|
|
|
2018-03-02 07:22:25 -03:00
|
|
|
#include "Framework.h"
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire::Common;
|
|
|
|
using namespace Sapphire::Network::Packets;
|
|
|
|
using namespace Sapphire::Network::Packets::Server;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-12-23 03:53:08 +01:00
|
|
|
void Sapphire::Network::GameConnection::inventoryModifyHandler( FrameworkPtr pFw,
|
|
|
|
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
2018-11-29 16:55:48 +01:00
|
|
|
Entity::Player& player )
|
2017-08-17 16:17:25 +02:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcInventoryModifyHandler >( inPacket );
|
2018-06-18 23:03:39 +02:00
|
|
|
|
2018-10-14 23:31:52 +11:00
|
|
|
const auto action = packet.data().action;
|
|
|
|
const auto splitCount = packet.data().splitCount;
|
2018-06-18 23:03:39 +02:00
|
|
|
|
2018-10-14 23:31:52 +11:00
|
|
|
const auto fromSlot = packet.data().fromSlot;
|
|
|
|
const auto fromContainer = packet.data().fromContainer;
|
|
|
|
const auto toSlot = packet.data().toSlot;
|
|
|
|
const auto toContainer = packet.data().toContainer;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
auto ackPacket = makeZonePacket< Server::FFXIVIpcInventoryActionAck >( player.getId() );
|
|
|
|
ackPacket->data().sequence = packet.data().seq;
|
|
|
|
ackPacket->data().type = 7;
|
|
|
|
player.queuePacket( ackPacket );
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2019-01-04 22:37:01 +11:00
|
|
|
Logger::debug( "InventoryAction: {0}", action );
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
// TODO: other inventory operations need to be implemented
|
|
|
|
switch( action )
|
|
|
|
{
|
|
|
|
|
|
|
|
case InventoryOperation::Discard: // discard item action
|
|
|
|
{
|
|
|
|
player.discardItem( fromContainer, fromSlot );
|
|
|
|
}
|
2017-11-28 00:09:36 +01:00
|
|
|
break;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
case InventoryOperation::Move: // move item action
|
|
|
|
{
|
|
|
|
player.moveItem( fromContainer, fromSlot, toContainer, toSlot );
|
|
|
|
}
|
2017-11-28 00:09:36 +01:00
|
|
|
break;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
case InventoryOperation::Swap: // swap item action
|
|
|
|
{
|
|
|
|
player.swapItem( fromContainer, fromSlot, toContainer, toSlot );
|
|
|
|
}
|
2017-11-28 00:09:36 +01:00
|
|
|
break;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
case InventoryOperation::Merge: // merge stack action
|
|
|
|
{
|
|
|
|
player.mergeItem( fromContainer, fromSlot, toContainer, toSlot );
|
|
|
|
}
|
2017-11-28 00:09:36 +01:00
|
|
|
break;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
case InventoryOperation::Split: // split stack action
|
|
|
|
{
|
|
|
|
player.splitItem( fromContainer, fromSlot, toContainer, toSlot, splitCount );
|
|
|
|
}
|
2017-11-28 00:09:36 +01:00
|
|
|
break;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
default:
|
|
|
|
break;
|
2017-08-17 16:17:25 +02:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
2017-08-17 16:17:25 +02:00
|
|
|
}
|
|
|
|
|