1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 07:07:45 +00:00
sapphire/src/world/Network/PacketWrappers/MoveActorPacket.h

47 lines
1.5 KiB
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef _MOVEACTORPACKET_H
#define _MOVEACTORPACKET_H
2019-03-08 15:34:38 +01:00
#include <Network/GamePacket.h>
2018-03-06 22:22:19 +01:00
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include <Util/UtilMath.h>
#include "Actor/Player.h"
#include "Forwards.h"
2017-08-08 13:53:47 +02:00
namespace Sapphire::Network::Packets::Server
2017-08-08 13:53:47 +02:00
{
2018-10-28 21:53:21 +01:00
/**
* @brief The Client UI Initialization packet. This must be sent to the client
* once upon connection to configure the UI.
*/
class MoveActorPacket : public WorldChannelPacket< FFXIVIpcActorMove >
{
2018-10-28 21:53:21 +01:00
public:
2019-02-06 09:27:30 +01:00
MoveActorPacket( Entity::Chara& actor, uint8_t headRotation, uint8_t animationType, uint8_t state, uint16_t animationSpeed, uint8_t unknownRotation = 0 ) :
WorldChannelPacket< FFXIVIpcActorMove >( actor.getId(), actor.getId() )
2018-10-28 21:53:21 +01:00
{
2019-02-06 09:27:30 +01:00
initialize( actor, headRotation, animationType, state, animationSpeed, unknownRotation );
2018-10-28 21:53:21 +01:00
};
private:
2019-02-06 09:27:30 +01:00
void initialize( Entity::Chara& actor, uint8_t headRotation, uint8_t animationType, uint8_t state, uint16_t animationSpeed, uint8_t unknownRotation )
2018-10-28 21:53:21 +01:00
{
m_data.rotation = Common::Util::floatToUInt8Rot( actor.getRot() );
2019-02-06 08:49:57 +01:00
m_data.headRotation = headRotation;
m_data.animationType = animationType;
2019-02-06 08:49:57 +01:00
m_data.animationState = state;
2019-02-06 09:27:30 +01:00
m_data.animationSpeed = animationSpeed;
m_data.unknownRotation = unknownRotation;
m_data.posX = Common::Util::floatToUInt16( actor.getPos().x );
m_data.posY = Common::Util::floatToUInt16( actor.getPos().y );
m_data.posZ = Common::Util::floatToUInt16( actor.getPos().z );
2018-10-28 21:53:21 +01:00
};
};
2017-08-08 13:53:47 +02:00
}
#endif /*_MOVEACTORPACKET_H*/