mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-04 17:57:47 +00:00
skeleton action handling inside actionmgr, packet fixes
This commit is contained in:
parent
76172595a4
commit
497cc1f028
6 changed files with 44 additions and 92 deletions
|
@ -67,8 +67,8 @@ struct FFXIVIpcSkillHandler :
|
|||
/* 0001 */ uint8_t type;
|
||||
/* 0002 */ char pad_0002[2];
|
||||
/* 0004 */ uint32_t actionId;
|
||||
/* 0008 */ uint32_t useCount;
|
||||
/* 000C */ char pad_000C[4];
|
||||
/* 0008 */ uint16_t sequence;
|
||||
/* 000A */ char pad_000C[6];
|
||||
/* 0010 */ uint64_t targetId;
|
||||
/* 0018 */ uint64_t unknown;
|
||||
};
|
||||
|
@ -80,7 +80,7 @@ struct FFXIVIpcAoESkillHandler :
|
|||
/* 0001 */ uint8_t type;
|
||||
/* 0002 */ char pad_0002[2];
|
||||
/* 0004 */ uint32_t actionId;
|
||||
/* 0008 */ uint16_t useCount;
|
||||
/* 0008 */ uint16_t sequence;
|
||||
/* 000A */ char pad_000C[6];
|
||||
/* 0010 */ Common::FFXIVARR_POSITION3 pos;
|
||||
/* 001C */ uint32_t unknown; // could almost be rotation + 16 bits more padding?
|
||||
|
|
|
@ -6,4 +6,16 @@ World::Manager::ActionMgr::ActionMgr( Sapphire::FrameworkPtr pFw ) :
|
|||
BaseManager( pFw )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void World::Manager::ActionMgr::handleAoEPlayerAction( Entity::Player& player, uint8_t type,
|
||||
uint32_t actionId, Common::FFXIVARR_POSITION3 pos )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& player, uint8_t type,
|
||||
uint32_t actionId, uint64_t targetId )
|
||||
{
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
#define SAPPHIRE_ACTIONMGR_H
|
||||
|
||||
#include "BaseManager.h"
|
||||
#include "ForwardsZone.h"
|
||||
|
||||
namespace Sapphire::World::Manager
|
||||
{
|
||||
|
@ -11,7 +12,8 @@ namespace Sapphire::World::Manager
|
|||
explicit ActionMgr( FrameworkPtr pFw );
|
||||
~ActionMgr() = default;
|
||||
|
||||
// void handlePlayerCast( Entity::Player& player)
|
||||
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 );
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pH
|
|||
setZoneHandler( ClientZoneIpcType::DiscoveryHandler, "DiscoveryHandler", &GameConnection::discoveryHandler );
|
||||
|
||||
setZoneHandler( ClientZoneIpcType::SkillHandler, "ActionHandler", &GameConnection::actionHandler );
|
||||
setZoneHandler( ClientZoneIpcType::AoESkillHandler, "AoESkillHandler", &GameConnection::aoeActionHandler );
|
||||
|
||||
setZoneHandler( ClientZoneIpcType::GMCommand1, "GMCommand1", &GameConnection::gm1Handler );
|
||||
setZoneHandler( ClientZoneIpcType::GMCommand2, "GMCommand2", &GameConnection::gm2Handler );
|
||||
|
|
|
@ -155,6 +155,8 @@ namespace Sapphire::Network
|
|||
DECLARE_HANDLER( cfDutyAccepted );
|
||||
|
||||
DECLARE_HANDLER( actionHandler );
|
||||
|
||||
DECLARE_HANDLER( aoeActionHandler );
|
||||
|
||||
DECLARE_HANDLER( gm1Handler );
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
|
||||
#include "Manager/DebugCommandMgr.h"
|
||||
#include "Manager/ActionMgr.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionCast.h"
|
||||
|
@ -41,95 +42,29 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
|||
|
||||
const auto type = packet.data().type;
|
||||
const auto action = packet.data().actionId;
|
||||
const auto useCount = packet.data().useCount;
|
||||
const auto sequence = packet.data().sequence;
|
||||
const auto targetId = packet.data().targetId;
|
||||
|
||||
player.sendDebug( "Skill type: {0}", type );
|
||||
|
||||
auto pExdData = pFw->get< Data::ExdDataGenerated >();
|
||||
auto pScriptMgr = pFw->get< Scripting::ScriptMgr >();
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case Common::SkillType::Normal:
|
||||
|
||||
if( action < 1000000 ) // normal action
|
||||
{
|
||||
std::string actionIdStr = Util::intToHexString( action, 4 );
|
||||
player.sendDebug( "---------------------------------------" );
|
||||
player.sendDebug( "ActionHandler ( {0} | {1} | {2} )",
|
||||
actionIdStr, pExdData->get< Sapphire::Data::Action >( action )->name, targetId );
|
||||
|
||||
player.queuePacket( makeActorControl142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||
|
||||
if( action == 5 )
|
||||
{
|
||||
auto currentAction = player.getCurrentAction();
|
||||
|
||||
// we should always have an action here, if not there is a bug
|
||||
assert( currentAction );
|
||||
currentAction->onStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
Sapphire::Entity::ActorPtr targetActor = player.getAsPlayer();
|
||||
|
||||
if( targetId != player.getId() )
|
||||
{
|
||||
targetActor = player.lookupTargetById( targetId );
|
||||
}
|
||||
|
||||
// Check if we actually have an actor
|
||||
if( !targetActor )
|
||||
{
|
||||
// todo: interrupt a cast.
|
||||
player.sendDebug( "Invalid target." );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !player.actionHasCastTime( action ) )
|
||||
{
|
||||
pScriptMgr->onCastFinish( player, targetActor->getAsChara(), action );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto pActionCast = Action::make_ActionCast( player.getAsPlayer(), targetActor->getAsChara(), action, m_pFw );
|
||||
player.setCurrentAction( pActionCast );
|
||||
player.sendDebug( "setCurrentAction()" );
|
||||
player.getCurrentAction()->onStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( action < 2000000 ) // craft action
|
||||
{
|
||||
|
||||
}
|
||||
else if( action < 3000000 ) // item action
|
||||
{
|
||||
auto info = pExdData->get< Sapphire::Data::EventItem >( action );
|
||||
if( info )
|
||||
{
|
||||
pScriptMgr->onEventItem( player, action, info->quest, info->castTime, targetId );
|
||||
}
|
||||
}
|
||||
else if( action > 3000000 ) // unknown
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Common::SkillType::MountSkill:
|
||||
|
||||
player.sendDebug( "Request mount {0}", action );
|
||||
|
||||
auto pActionMount = Action::make_ActionMount( player.getAsPlayer(), action );
|
||||
player.setCurrentAction( pActionMount );
|
||||
player.sendDebug( "setCurrentAction()" );
|
||||
player.getCurrentAction()->onStart();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}, targetId: {3}", type, sequence, action, targetId );
|
||||
|
||||
auto actionMgr = pFw->get< World::Manager::ActionMgr >();
|
||||
actionMgr->handleTargetedPlayerAction( player, type, action, targetId );
|
||||
}
|
||||
|
||||
void Sapphire::Network::GameConnection::aoeActionHandler( FrameworkPtr pFw,
|
||||
const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||
Entity::Player& player )
|
||||
{
|
||||
const auto packet = ZoneChannelPacket< Client::FFXIVIpcAoESkillHandler >( inPacket );
|
||||
|
||||
const auto type = packet.data().type;
|
||||
const auto action = packet.data().actionId;
|
||||
const auto sequence = packet.data().sequence;
|
||||
const auto pos = packet.data().pos;
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue