1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 23:27:45 +00:00

Allow setting or target and source effects in single target effect packet

This commit is contained in:
Mordred 2022-01-06 20:50:00 +01:00
parent 4fccaef569
commit beca9ccb3b
4 changed files with 13 additions and 5 deletions

View file

@ -179,7 +179,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
for( int i = 0; i < resultList->size(); i++ )
{
auto result = resultList->data()[ i ];
effectPacket->addEffect( result->buildEffectEntry(), static_cast< uint64_t >( firstResult->getTarget()->getId() ) );
effectPacket->addTargetEffect( result->buildEffectEntry(), static_cast< uint64_t >( firstResult->getTarget()->getId() ) );
m_sourceChara->getCurrentTerritory()->addEffectResult( std::move( result ) );
}

View file

@ -919,7 +919,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
effectEntry.Arg1 = 7;
//effectEntry.Arg2 = 0x71;
effectPacket->setSequence( getCurrentTerritory()->getNextEffectSequence() );
effectPacket->addEffect( effectEntry, static_cast< uint64_t >( pTarget->getId() ) );
effectPacket->addTargetEffect( effectEntry, static_cast< uint64_t >( pTarget->getId() ) );
sendToInRangeSet( effectPacket );

View file

@ -1525,7 +1525,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
effectPacket->setSequence( getCurrentTerritory()->getNextEffectSequence() );
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
effectPacket->addEffect( entry, static_cast< uint64_t >( pTarget->getId() ) );
effectPacket->addTargetEffect( entry, static_cast< uint64_t >( pTarget->getId() ) );
sendToInRangeSet( effectPacket, true );

View file

@ -12,6 +12,9 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
class EffectPacket1 : public ZoneChannelPacket< FFXIVIpcActionResult1 >
{
private:
uint8_t m_targetEffectCount{0};
uint8_t m_sourceEffectCount{0};
public:
EffectPacket1( uint64_t sourceId, uint32_t targetId, uint32_t actionId ) :
ZoneChannelPacket< FFXIVIpcActionResult1 >( static_cast< uint32_t >( sourceId ), targetId )
@ -31,9 +34,14 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
std::memset( &m_data.CalcResult, 0, sizeof( Common::CalcResult ) );
}
void addEffect( const Common::CalcResultParam& effect, uint64_t targetId = Common::INVALID_GAME_OBJECT_ID64 )
void addTargetEffect( const Common::CalcResultParam& effect, uint64_t targetId = Common::INVALID_GAME_OBJECT_ID64 )
{
std::memcpy( &m_data.CalcResult.CalcResultTg, &effect, sizeof( Common::CalcResultParam ) );
std::memcpy( &m_data.CalcResult.CalcResultTg[ m_targetEffectCount++ ], &effect, sizeof( Common::CalcResultParam ) );
}
void addSourceEffect( const Common::CalcResultParam& effect, uint64_t targetId = Common::INVALID_GAME_OBJECT_ID64 )
{
std::memcpy( &m_data.CalcResult.CalcResultCt[ m_sourceEffectCount++ ], &effect, sizeof( Common::CalcResultParam ) );
}
void setAnimationId( uint16_t animationId )