From 1eb202faa851aed5e47ea2833799606619944110 Mon Sep 17 00:00:00 2001 From: Mordred Date: Mon, 6 Jan 2025 15:35:17 +0100 Subject: [PATCH] Always send AOE effects as AOE packet, regardless of targetcount. Also allow setting position of aoe effect --- data/actions/player.json | 122 +----------------- src/world/Action/ActionResultBuilder.cpp | 13 +- src/world/Encounter/Timepoint.cpp | 1 + .../Network/PacketWrappers/EffectPacket.h | 8 ++ 4 files changed, 22 insertions(+), 122 deletions(-) diff --git a/data/actions/player.json b/data/actions/player.json index c266e805..c3e41628 100644 --- a/data/actions/player.json +++ b/data/actions/player.json @@ -5373,66 +5373,8 @@ "target": [] } }, - "453": { - "name": "Incinerate", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, - "454": { - "name": "Vulcan Burst", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, - "455": { - "name": "Eruption", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, - "456": { - "name": "Radiant Plume", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, + + "457": { "name": "Crimson Cyclone", "potency": 0, @@ -5448,21 +5390,6 @@ "target": [] } }, - "458": { - "name": "Hellfire", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, "462": { "name": "イフリート:角復活", "potency": 0, @@ -8928,36 +8855,6 @@ "target": [] } }, - "733": { - "name": "Eruption", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, - "734": { - "name": "Radiant Plume", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, "735": { "name": "Miasma Breath", "potency": 0, @@ -10518,21 +10415,6 @@ "target": [] } }, - "872": { - "name": "attack", - "potency": 0, - "comboPotency": 0, - "flankPotency": 0, - "frontPotency": 0, - "rearPotency": 0, - "curePotency": 0, - "restorePercentage": 0, - "nextCombo": [], - "statuses": { - "caster": [], - "target": [] - } - }, "873": { "name": "attack", "potency": 0, diff --git a/src/world/Action/ActionResultBuilder.cpp b/src/world/Action/ActionResultBuilder.cpp index db0da0cb..a2a27572 100644 --- a/src/world/Action/ActionResultBuilder.cpp +++ b/src/world/Action/ActionResultBuilder.cpp @@ -143,12 +143,21 @@ std::shared_ptr< FFXIVPacketBase > ActionResultBuilder::createActionResultPacket auto& teriMgr = Common::Service< Sapphire::World::Manager::TerritoryMgr >::ref(); auto zone = teriMgr.getTerritoryByGuId( m_sourceChara->getTerritoryId() ); - if( targetCount > 1 ) // use AoeEffect packets + // need to get actionData + auto& exdData = Common::Service< Data::ExdData >::ref(); + + auto actionData = exdData.getRow< Excel::Action >( m_actionId ); + if( !actionData ) + throw std::runtime_error( "No actiondata found!" ); + + if( targetCount > 1 || actionData->data().EffectType != Common::CastType::SingleTarget ) // use AoeEffect packets { - auto actionResult = makeEffectPacket( m_sourceChara->getId(), targetList[ 0 ]->getId(), m_actionId ); + auto actionResult = makeEffectPacket( m_sourceChara->getId(), 0, m_actionId ); actionResult->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) ); actionResult->setRequestId( m_requestId ); actionResult->setResultId( m_resultId ); + actionResult->setTargetPosition( m_sourceChara->getPos() ); + uint8_t targetIndex = 0; for( auto& [ actor, actorResultList ] : m_actorResultsMap ) diff --git a/src/world/Encounter/Timepoint.cpp b/src/world/Encounter/Timepoint.cpp index b9e1a47e..ff2308b1 100644 --- a/src/world/Encounter/Timepoint.cpp +++ b/src/world/Encounter/Timepoint.cpp @@ -417,6 +417,7 @@ namespace Sapphire::Encounter if( !pAction || pAction->isInterrupted() ) { actionMgr.handleTargetedAction( *pBNpc, pActionData->m_actionId, targetId, pTeri->getNextActionResultId() ); + //actionMgr.handlePlacedAction( *pBNpc, pActionData->m_actionId, pBNpc->getPos(), pTeri->getNextActionResultId() ); } // todo: this really shouldnt exist, but need to figure out why actions interrupt else if( pAction->getId() == pActionData->m_actionId ) diff --git a/src/world/Network/PacketWrappers/EffectPacket.h b/src/world/Network/PacketWrappers/EffectPacket.h index 9e190a34..c91b2de8 100644 --- a/src/world/Network/PacketWrappers/EffectPacket.h +++ b/src/world/Network/PacketWrappers/EffectPacket.h @@ -2,6 +2,7 @@ #include #include +#include #include "Forwards.h" #include #include @@ -87,6 +88,13 @@ namespace Sapphire::Network::Packets::WorldPackets::Server { m_data.ResultId = static_cast< uint32_t >( resultId ); } + + void setTargetPosition( Common::FFXIVARR_POSITION3& pos ) + { + m_data.TargetPos[ 0 ] = Common::Util::floatToUInt16( pos.x ); + m_data.TargetPos[ 1 ] = Common::Util::floatToUInt16( pos.y ); + m_data.TargetPos[ 2 ] = Common::Util::floatToUInt16( pos.z ); + } private: uint8_t m_targetEffectCount{ 0 }; uint8_t m_sourceEffectCount{ 0 };