2018-03-06 22:22:19 +01:00
|
|
|
#include <Common.h>
|
|
|
|
#include <Exd/ExdDataGenerated.h>
|
|
|
|
#include <Network/GamePacketNew.h>
|
2018-07-06 22:43:49 +10:00
|
|
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
2018-03-06 22:22:19 +01:00
|
|
|
#include <Logging/Logger.h>
|
2017-08-17 00:00:41 +02:00
|
|
|
|
2019-02-09 14:45:22 +11:00
|
|
|
#include <Actor/Player.h>
|
2017-08-17 00:00:41 +02:00
|
|
|
|
2019-02-09 14:45:22 +11:00
|
|
|
#include "Network/GameConnection.h"
|
|
|
|
#include "Framework.h"
|
2017-08-17 00:00:41 +02:00
|
|
|
|
2019-02-03 19:57:04 +11:00
|
|
|
#include "Manager/ActionMgr.h"
|
2017-08-17 00:00:41 +02:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire::Common;
|
|
|
|
using namespace Sapphire::Network::Packets;
|
2017-08-17 00:00:41 +02:00
|
|
|
|
2018-12-23 03:53:08 +01:00
|
|
|
void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
|
|
|
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
2018-11-29 16:55:48 +01:00
|
|
|
Entity::Player& player )
|
2017-08-17 00:00:41 +02:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcSkillHandler >( inPacket );
|
2018-06-28 00:07:07 +02:00
|
|
|
|
2018-10-14 23:31:52 +11:00
|
|
|
const auto type = packet.data().type;
|
2019-02-09 14:45:22 +11:00
|
|
|
const auto actionId = packet.data().actionId;
|
2019-02-03 19:57:04 +11:00
|
|
|
const auto sequence = packet.data().sequence;
|
2018-10-14 23:31:52 +11:00
|
|
|
const auto targetId = packet.data().targetId;
|
2019-02-10 19:50:28 +11:00
|
|
|
const auto itemSourceSlot = packet.data().itemSourceSlot;
|
|
|
|
const auto itemSourceContainer = packet.data().itemSourceContainer;
|
2018-06-18 23:03:39 +02:00
|
|
|
|
2019-02-11 14:51:56 +11:00
|
|
|
// player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}, targetId: {3}", type, sequence, actionId, targetId );
|
2019-02-09 19:26:31 +11:00
|
|
|
|
2019-02-09 14:45:22 +11:00
|
|
|
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
|
|
|
assert( exdData );
|
|
|
|
|
2019-02-09 21:48:42 +11:00
|
|
|
auto actionMgr = pFw->get< World::Manager::ActionMgr >();
|
|
|
|
|
2019-02-09 19:26:31 +11:00
|
|
|
switch( type )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
player.sendDebug( "Skill type {0} not supported. Defaulting to normal action", type );
|
|
|
|
}
|
|
|
|
case Common::SkillType::Normal:
|
|
|
|
{
|
|
|
|
auto action = exdData->get< Data::Action >( actionId );
|
|
|
|
|
|
|
|
// ignore invalid actions
|
|
|
|
if( !action )
|
|
|
|
return;
|
|
|
|
|
|
|
|
actionMgr->handleTargetedPlayerAction( player, actionId, action, targetId );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case Common::SkillType::ItemAction:
|
|
|
|
{
|
|
|
|
auto item = exdData->get< Data::Item >( actionId );
|
|
|
|
if( !item )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( item->itemAction == 0 )
|
|
|
|
return;
|
|
|
|
|
2019-02-09 21:48:42 +11:00
|
|
|
auto itemAction = exdData->get< Data::ItemAction >( item->itemAction );
|
|
|
|
if( !itemAction )
|
|
|
|
return;
|
|
|
|
|
2019-02-10 19:50:28 +11:00
|
|
|
actionMgr->handleItemAction( player, actionId, itemAction, itemSourceSlot, itemSourceContainer );
|
2019-02-09 19:26:31 +11:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case Common::SkillType::MountSkill:
|
|
|
|
{
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-02-09 14:45:22 +11:00
|
|
|
|
2018-06-18 23:03:39 +02:00
|
|
|
|
2019-02-09 14:45:22 +11:00
|
|
|
|
2019-02-03 19:57:04 +11:00
|
|
|
}
|
2018-06-18 23:03:39 +02:00
|
|
|
|
2019-02-03 19:57:04 +11:00
|
|
|
void Sapphire::Network::GameConnection::aoeActionHandler( FrameworkPtr pFw,
|
|
|
|
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
|
|
|
Entity::Player& player )
|
|
|
|
{
|
|
|
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcAoESkillHandler >( inPacket );
|
2018-06-18 23:03:39 +02:00
|
|
|
|
2019-02-03 19:57:04 +11:00
|
|
|
const auto type = packet.data().type;
|
2019-02-09 14:45:22 +11:00
|
|
|
const auto actionId = packet.data().actionId;
|
2019-02-03 19:57:04 +11:00
|
|
|
const auto sequence = packet.data().sequence;
|
|
|
|
const auto pos = packet.data().pos;
|
2018-06-18 23:03:39 +02:00
|
|
|
|
2019-02-09 19:26:31 +11:00
|
|
|
// todo: find out if there are any other action types which actually use this handler
|
|
|
|
if( type != Common::SkillType::Normal )
|
|
|
|
{
|
|
|
|
player.sendDebug( "Skill type {0} not supported by aoe action handler!", type );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-02-11 14:51:56 +11:00
|
|
|
// player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}, x:{3}, y:{4}, z:{5}",
|
|
|
|
// type, sequence, actionId, pos.x, pos.y, pos.z );
|
2019-02-09 19:26:31 +11:00
|
|
|
|
2019-02-09 14:45:22 +11:00
|
|
|
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
|
|
|
assert( exdData );
|
|
|
|
|
|
|
|
auto action = exdData->get< Data::Action >( actionId );
|
|
|
|
|
|
|
|
// ignore invalid actions
|
|
|
|
if( !action )
|
|
|
|
return;
|
|
|
|
|
2019-02-03 19:57:04 +11:00
|
|
|
auto actionMgr = pFw->get< World::Manager::ActionMgr >();
|
2019-02-09 19:26:31 +11:00
|
|
|
actionMgr->handleAoEPlayerAction( player, actionId, action, pos );
|
2017-12-08 11:46:47 +01:00
|
|
|
}
|