1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00
sapphire/src/world/Network/PacketWrappers/EffectPacket.h

78 lines
1.9 KiB
C
Raw Normal View History

#ifndef SAPPHIRE_EFFECTPACKET_H
#define SAPPHIRE_EFFECTPACKET_H
2019-03-08 15:34:38 +01:00
#include <Network/GamePacket.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include "Forwards.h"
2018-10-26 14:11:02 +02:00
#include <string>
#include <cstring>
#include <cassert>
namespace Sapphire::Network::Packets::Server
{
2019-07-29 22:22:45 +10:00
class EffectPacket : public ZoneChannelPacket< FFXIVIpcEffect >
{
2018-10-28 21:53:21 +01:00
public:
EffectPacket( uint64_t sourceId, uint32_t targetId, uint32_t actionId ) :
2019-07-29 22:22:45 +10:00
ZoneChannelPacket< FFXIVIpcEffect >( static_cast< uint32_t >( sourceId ), targetId )
2018-10-28 21:53:21 +01:00
{
m_data.effectCount = 0;
m_data.actionId = actionId;
m_data.actionAnimationId = static_cast< uint16_t >( actionId );
2018-10-28 21:53:21 +01:00
m_data.animationTargetId = targetId;
2018-10-28 21:53:21 +01:00
m_data.effectTargetId = targetId;
m_data.effectDisplayType = Common::ActionEffectDisplayType::ShowActionName;
2020-01-05 17:09:27 +09:00
2020-01-05 20:49:50 +09:00
std::memset( m_data.effects, 0, sizeof( Common::EffectEntry ) * 8 );
2018-10-28 21:53:21 +01:00
}
void addEffect( const Common::EffectEntry& effect )
2018-10-28 21:53:21 +01:00
{
assert( m_data.effectCount <= 8 );
2018-10-28 21:53:21 +01:00
std::memcpy( &m_data.effects[ m_data.effectCount * 8 ], &effect, sizeof( Common::EffectEntry ) );
m_data.effectCount++;
2018-10-28 21:53:21 +01:00
}
void setAnimationId( uint16_t animationId )
{
m_data.actionAnimationId = animationId;
2018-10-28 21:53:21 +01:00
}
2019-02-09 21:48:42 +11:00
void setDisplayType( Common::ActionEffectDisplayType displayType )
{
m_data.effectDisplayType = displayType;
}
2018-10-28 21:53:21 +01:00
void setEffectFlags( uint32_t effectFlags )
{
m_data.effectFlags = effectFlags;
}
void setRotation( uint16_t rotation )
{
m_data.rotation = rotation;
2018-10-28 21:53:21 +01:00
}
void setTargetActor( const uint32_t targetId )
{
m_data.animationTargetId = targetId;
2018-10-28 21:53:21 +01:00
m_data.effectTargetId = targetId;
FFXIVPacketBase::setTargetActor( targetId );
}
2019-07-26 21:58:13 +10:00
void setSequence( uint32_t sequence, uint16_t sourceSequence = 0 )
{
m_data.sequence = sequence;
2019-07-26 21:58:13 +10:00
m_data.sourceSequence = sourceSequence;
}
2018-10-28 21:53:21 +01:00
};
}
#endif //SAPPHIRE_EFFECTPACKET_H