From 6f7198bd5a763f3345302f2c2afdd4922e2ab8da Mon Sep 17 00:00:00 2001 From: Tahir Date: Sat, 15 Jun 2024 23:50:58 +0100 Subject: [PATCH] add debug command for actor move --- src/world/Manager/DebugCommandMgr.cpp | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 2442c679..990a67e7 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -19,6 +19,7 @@ #include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ActorControlPacket.h" #include "Network/PacketWrappers/ActorControlSelfPacket.h" +#include "Network/PacketWrappers/MoveActorPacket.h" #include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/PlayerSpawnPacket.h" #include "Network/GameConnection.h" @@ -52,6 +53,8 @@ #include "Session.h" +#include "Util/UtilMath.h" + using namespace Sapphire::Network; using namespace Sapphire::Network::Packets; @@ -542,6 +545,37 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr< server().queueForPlayer( player.getCharacterId(), effectPacket ); } + else if( subCommand == "actorMove" ) + { + uint8_t animationType{ 0 }; + uint8_t animationState{ 0 }; + uint8_t speed{ 20 }; + float x{ 0 }, y{ 0 }, z{ 0 }; + + sscanf( params.c_str(), "%u %u %u %d %d %d", &animationType, &animationState, &speed, &x, &y, &z ); + auto targetId = static_cast< uint32_t >( player.getTargetId() ); + auto actorMovePacket = makeZonePacket< FFXIVIpcActorMove >( targetId, player.getId() ); + + Entity::GameObjectPtr pTarget = nullptr; + auto inRange = player.getInRangeActors(); + for( auto pChara : inRange ) + if( pChara->getId() == targetId ) + pTarget = pChara; + + if( pTarget ) + { + actorMovePacket->data().dir = Common::Util::floatToUInt8Rot( pTarget->getRot() ); + actorMovePacket->data().dirBeforeSlip = Common::Util::floatToUInt8Rot( pTarget->getRot() ); + actorMovePacket->data().flag = animationType; + actorMovePacket->data().flag2 = animationState; + actorMovePacket->data().speed = speed; + actorMovePacket->data().pos[ 0 ] = Common::Util::floatToUInt16( x ); + actorMovePacket->data().pos[ 1 ] = Common::Util::floatToUInt16( y ); + actorMovePacket->data().pos[ 2 ] = Common::Util::floatToUInt16( z ); + + server().queueForPlayer( player.getCharacterId(), actorMovePacket ); + } + } else if( subCommand == "achvGeneral" ) { uint32_t achvSubtype;