mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
ignore invalid actions and pass action data into manager
This commit is contained in:
parent
6f5591220b
commit
2cf1b5aaf7
3 changed files with 46 additions and 32 deletions
|
@ -1,5 +1,12 @@
|
|||
#include "ActionMgr.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
World::Manager::ActionMgr::ActionMgr( Sapphire::FrameworkPtr pFw ) :
|
||||
|
@ -9,13 +16,13 @@ World::Manager::ActionMgr::ActionMgr( Sapphire::FrameworkPtr pFw ) :
|
|||
}
|
||||
|
||||
void World::Manager::ActionMgr::handleAoEPlayerAction( Entity::Player& player, uint8_t type,
|
||||
uint32_t actionId, Common::FFXIVARR_POSITION3 pos )
|
||||
Data::ActionPtr action, Common::FFXIVARR_POSITION3 pos )
|
||||
{
|
||||
|
||||
player.sendDebug( "got aoe act: {0}", action->name );
|
||||
}
|
||||
|
||||
void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& player, uint8_t type,
|
||||
uint32_t actionId, uint64_t targetId )
|
||||
Data::ActionPtr action, uint64_t targetId )
|
||||
{
|
||||
|
||||
player.sendDebug( "got act: {0}", action->name );
|
||||
}
|
|
@ -4,6 +4,12 @@
|
|||
#include "BaseManager.h"
|
||||
#include "ForwardsZone.h"
|
||||
|
||||
namespace Sapphire::Data
|
||||
{
|
||||
class Action;
|
||||
using ActionPtr = std::shared_ptr< Action >;
|
||||
}
|
||||
|
||||
namespace Sapphire::World::Manager
|
||||
{
|
||||
class ActionMgr : public Manager::BaseManager
|
||||
|
@ -12,8 +18,8 @@ namespace Sapphire::World::Manager
|
|||
explicit ActionMgr( FrameworkPtr pFw );
|
||||
~ActionMgr() = default;
|
||||
|
||||
void handleTargetedPlayerAction( Entity::Player& player, uint8_t type, uint32_t actionId, uint64_t targetId );
|
||||
void handleAoEPlayerAction( Entity::Player& player, uint8_t type, uint32_t actionId, Common::FFXIVARR_POSITION3 pos );
|
||||
void handleTargetedPlayerAction( Entity::Player& player, uint8_t type, Data::ActionPtr action, uint64_t targetId );
|
||||
void handleAoEPlayerAction( Entity::Player& player, uint8_t type, Data::ActionPtr action, Common::FFXIVARR_POSITION3 pos );
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,35 +1,18 @@
|
|||
#include <Common.h>
|
||||
#include <Network/CommonNetwork.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Network/GamePacketNew.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Network/CommonActorControl.h>
|
||||
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Util/Util.h>
|
||||
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/MoveActorPacket.h"
|
||||
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
|
||||
#include "Manager/DebugCommandMgr.h"
|
||||
#include "Manager/ActionMgr.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "Framework.h"
|
||||
|
||||
#include "Manager/ActionMgr.h"
|
||||
|
||||
using namespace Sapphire::Common;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
using namespace Sapphire::Network::Packets::Server;
|
||||
using namespace Sapphire::Network::ActorControl;
|
||||
|
||||
void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
||||
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||
|
@ -38,14 +21,23 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
|||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcSkillHandler >( inPacket );
|
||||
|
||||
const auto type = packet.data().type;
|
||||
const auto action = packet.data().actionId;
|
||||
const auto actionId = packet.data().actionId;
|
||||
const auto sequence = packet.data().sequence;
|
||||
const auto targetId = packet.data().targetId;
|
||||
|
||||
player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}, targetId: {3}", type, sequence, action, targetId );
|
||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
assert( exdData );
|
||||
|
||||
auto action = exdData->get< Data::Action >( actionId );
|
||||
|
||||
// ignore invalid actions
|
||||
if( !action )
|
||||
return;
|
||||
|
||||
auto actionMgr = pFw->get< World::Manager::ActionMgr >();
|
||||
actionMgr->handleTargetedPlayerAction( player, type, action, targetId );
|
||||
|
||||
player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}, targetId: {3}", type, sequence, actionId, targetId );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::aoeActionHandler( FrameworkPtr pFw,
|
||||
|
@ -55,13 +47,22 @@ void Sapphire::Network::GameConnection::aoeActionHandler( FrameworkPtr pFw,
|
|||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcAoESkillHandler >( inPacket );
|
||||
|
||||
const auto type = packet.data().type;
|
||||
const auto action = packet.data().actionId;
|
||||
const auto actionId = packet.data().actionId;
|
||||
const auto sequence = packet.data().sequence;
|
||||
const auto pos = packet.data().pos;
|
||||
|
||||
auto exdData = m_pFw->get< Data::ExdDataGenerated >();
|
||||
assert( exdData );
|
||||
|
||||
auto action = exdData->get< Data::Action >( actionId );
|
||||
|
||||
// ignore invalid actions
|
||||
if( !action )
|
||||
return;
|
||||
|
||||
auto actionMgr = pFw->get< World::Manager::ActionMgr >();
|
||||
actionMgr->handleAoEPlayerAction( player, type, action, pos );
|
||||
|
||||
player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}\nx:{3}, y:{4}, z:{5}",
|
||||
type, sequence, action, pos.x, pos.y, pos.z );
|
||||
player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}, x:{3}, y:{4}, z:{5}",
|
||||
type, sequence, actionId, pos.x, pos.y, pos.z );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue