TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WorldPackets::Movement::MonsterMove Class Referencefinal

#include <MovementPackets.h>

Public Member Functions

 MonsterMove ()
 
void InitializeSplineData (::Movement::MoveSpline const &moveSpline)
 
WorldPacket constWrite () override
 
- Public Member Functions inherited from WorldPackets::ServerPacket
 ServerPacket (OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
 
void Read () overridefinal
 
void Clear ()
 
WorldPacket && Move ()
 
OpcodeServer GetOpcode () const
 
- Public Member Functions inherited from WorldPackets::Packet
 Packet (WorldPacket &&worldPacket)
 
virtual ~Packet ()=default
 
 Packet (Packet const &right)=delete
 
Packetoperator= (Packet const &right)=delete
 
WorldPacket constGetRawPacket () const
 
size_t GetSize () const
 
ConnectionType GetConnection () const
 

Public Attributes

MovementMonsterSpline SplineData
 
ObjectGuid MoverGUID
 
G3D::Vector3 Pos
 

Additional Inherited Members

- Protected Attributes inherited from WorldPackets::Packet
WorldPacket _worldPacket
 

Constructor & Destructor Documentation

WorldPackets::Movement::MonsterMove::MonsterMove ( )
inline
ServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: Packet.h:49
Definition: Opcodes.h:1314

Member Function Documentation

void WorldPackets::Movement::MonsterMove::InitializeSplineData ( ::Movement::MoveSpline const moveSpline)
349 {
350  SplineData.ID = moveSpline.m_Id;
352 
353  ::Movement::MoveSplineFlag splineFlags = moveSpline.splineflags;
354  splineFlags.enter_cycle = moveSpline.isCyclic();
355  movementSpline.Flags = uint32(splineFlags & uint32(~::Movement::MoveSplineFlag::Mask_No_Monster_Move));
356 
357  switch (moveSpline.splineflags & ::Movement::MoveSplineFlag::Mask_Final_Facing)
358  {
359  case ::Movement::MoveSplineFlag::Final_Point:
361  movementSpline.FaceSpot = moveSpline.facing.f;
362  break;
363  case ::Movement::MoveSplineFlag::Final_Target:
365  movementSpline.FaceGUID = moveSpline.facing.target;
366  break;
367  case ::Movement::MoveSplineFlag::Final_Angle:
369  movementSpline.FaceDirection = moveSpline.facing.angle;
370  break;
371  default:
372  movementSpline.Face = ::Movement::MONSTER_MOVE_NORMAL;
373  break;
374  }
375 
376  if (splineFlags.animation)
377  {
378  movementSpline.AnimTier = splineFlags.getAnimationId();
379  movementSpline.TierTransStartTime = moveSpline.effect_start_time;
380  }
381 
382  movementSpline.MoveTime = moveSpline.Duration();
383 
384  if (splineFlags.parabolic)
385  {
386  movementSpline.JumpGravity = moveSpline.vertical_acceleration;
387  movementSpline.SpecialTime = moveSpline.effect_start_time;
388  }
389 
390  ::Movement::Spline<int32> const& spline = moveSpline.spline;
391  std::vector<G3D::Vector3> const& array = spline.getPoints();
392 
393  if (splineFlags & ::Movement::MoveSplineFlag::UncompressedPath)
394  {
395  if (!splineFlags.cyclic)
396  {
397  uint32 count = spline.getPointCount() - 3;
398  for (uint32 i = 0; i < count; ++i)
399  movementSpline.Points.push_back(array[i + 2]);
400  }
401  else
402  {
403  uint32 count = spline.getPointCount() - 3;
404  movementSpline.Points.push_back(array[1]);
405  for (uint32 i = 0; i < count; ++i)
406  movementSpline.Points.push_back(array[i + 1]);
407  }
408  }
409  else
410  {
411  uint32 lastIdx = spline.getPointCount() - 3;
412  G3D::Vector3 const* realPath = &spline.getPoint(1);
413 
414  movementSpline.Points.push_back(realPath[lastIdx]);
415 
416  if (lastIdx > 1)
417  {
418  G3D::Vector3 middle = (realPath[0] + realPath[lastIdx]) / 2.f;
419 
420  // first and last points already appended
421  for (uint32 i = 1; i < lastIdx; ++i)
422  movementSpline.PackedDeltas.push_back(middle - realPath[i]);
423  }
424  }
425 }
uint8 getAnimationId() const
Definition: MoveSplineFlag.h:88
uint32 SpecialTime
Definition: MovementPackets.h:80
uint8 AnimTier
Definition: MovementPackets.h:75
Definition: MovementTypedefs.h:39
bool cyclic
Definition: MoveSplineFlag.h:121
uint32 Flags
Definition: MovementPackets.h:73
G3D::Vector3 FaceSpot
Definition: MovementPackets.h:90
Definition: MoveSplineFlag.h:66
bool parabolic
Definition: MoveSplineFlag.h:135
bool animation
Definition: MoveSplineFlag.h:134
ObjectGuid FaceGUID
Definition: MovementPackets.h:89
MovementSpline Move
Definition: MovementPackets.h:98
Definition: MovementPackets.h:71
uint8 Face
Definition: MovementPackets.h:74
uint32 ID
Definition: MovementPackets.h:95
float JumpGravity
Definition: MovementPackets.h:79
Definition: Vector3.h:58
float FaceDirection
Definition: MovementPackets.h:88
Definition: MoveSplineFlag.h:54
bool enter_cycle
Definition: MoveSplineFlag.h:122
Definition: MoveSplineFlag.h:70
uint32_t uint32
Definition: Define.h:150
uint32 TierTransStartTime
Definition: MovementPackets.h:76
std::vector< G3D::Vector3 > PackedDeltas
Definition: MovementPackets.h:86
Definition: MoveSplineFlag.h:28
MovementMonsterSpline SplineData
Definition: MovementPackets.h:116
uint32_t uint32
Definition: g3dmath.h:168
Definition: MovementTypedefs.h:37
std::vector< G3D::Vector3 > Points
Definition: MovementPackets.h:81
Definition: MovementTypedefs.h:38
uint32 MoveTime
Definition: MovementPackets.h:78
Definition: MovementTypedefs.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

WorldPacket const * WorldPackets::Movement::MonsterMove::Write ( )
overridevirtual

Implements WorldPackets::Packet.

428 {
430  _worldPacket << Pos;
432  return &_worldPacket;
433 }
ObjectGuid MoverGUID
Definition: MovementPackets.h:117
G3D::Vector3 Pos
Definition: MovementPackets.h:118
WorldPacket _worldPacket
Definition: Packet.h:43
MovementMonsterSpline SplineData
Definition: MovementPackets.h:116

+ Here is the caller graph for this function:

Member Data Documentation

ObjectGuid WorldPackets::Movement::MonsterMove::MoverGUID
G3D::Vector3 WorldPackets::Movement::MonsterMove::Pos
MovementMonsterSpline WorldPackets::Movement::MonsterMove::SplineData

The documentation for this class was generated from the following files: