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

#include <PartyPackets.h>

Public Member Functions

 PartyMemberStats ()
 
WorldPacket constWrite () override
 
void Initialize (Player const *player)
 
- 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

GroupMemberStats MemberStats
 
bool ForEnemy = false
 

Additional Inherited Members

- Protected Attributes inherited from WorldPackets::Packet
WorldPacket _worldPacket
 

Constructor & Destructor Documentation

WorldPackets::Party::PartyMemberStats::PartyMemberStats ( )
inline
Definition: Opcodes.h:1324
ServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: Packet.h:49

Member Function Documentation

void WorldPackets::Party::PartyMemberStats::Initialize ( Player const player)
413 {
414  ForEnemy = false;
415 
416  MemberStats.GUID = player->GetGUID();
417 
418  // Status
420 
421  if (player->IsPvP())
423 
424  if (!player->IsAlive())
425  {
426  if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
428  else
430  }
431 
432  if (player->IsFFAPvP())
434 
435  if (player->isAFK())
437 
438  if (player->isDND())
440 
441  // Level
442  MemberStats.Level = player->getLevel();
443 
444  // Health
445  MemberStats.CurrentHealth = player->GetHealth();
446  MemberStats.MaxHealth = player->GetMaxHealth();
447 
448  // Power
449  MemberStats.PowerType = player->getPowerType();
450  MemberStats.CurrentPower = player->GetPower(player->getPowerType());
451  MemberStats.MaxPower = player->GetMaxPower(player->getPowerType());
452 
453  // Position
454  MemberStats.ZoneID = player->GetZoneId();
455  MemberStats.PositionX = int16(player->GetPositionX());
456  MemberStats.PositionY = int16(player->GetPositionY());
457  MemberStats.PositionZ = int16(player->GetPositionZ());
458 
459  // Unk
460  MemberStats.Unk322 = 0; // Always 0
461  MemberStats.Unk704[0] = 1; // Always 1
462  MemberStats.Unk704[1] = 0; // Always 0
463  MemberStats.Unk200000 = 0; // Always 0
464 
467 
468  // Vehicle
469  if (player->GetVehicle() && player->GetVehicle()->GetVehicleInfo())
470  MemberStats.VehicleSeat = player->GetVehicle()->GetVehicleInfo()->SeatID[player->m_movementInfo.transport.seat];
471 
472  // Auras
473  for (uint8 i = 0; i < MAX_AURAS; ++i)
474  {
475  if (AuraApplication const* aurApp = player->GetVisibleAura(i))
476  {
478 
479  aura.SpellId = aurApp->GetBase()->GetId();
480  aura.EffectMask = aurApp->GetEffectMask();
481  aura.Scalings = aurApp->GetFlags(); // ??
482 
483  if (aurApp->GetFlags() & AFLAG_SCALABLE)
484  {
485  for (uint32 e = 0; e < MAX_SPELL_EFFECTS; ++e)
486  {
487  float scale = 0.0f;
488  if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(e))
489  scale = float(eff->GetAmount());
490  aura.EffectScales.push_back(scale);
491  }
492  }
493 
494  MemberStats.AuraList.push_back(aura);
495  }
496  }
497 
498  // Phases
499  std::set<uint32> const& phases = player->GetPhases();
500  MemberStats.Phases.PhaseShiftFlags = 0x08 | (phases.size() ? 0x10 : 0);
502  for (uint32 phaseId : phases)
503  {
505  phase.Id = phaseId;
506  phase.Flags = 1;
507  MemberStats.Phases.List.push_back(phase);
508  }
509 
510  // Pet
511  if (player->GetPet())
512  {
513  ::Pet* pet = player->GetPet();
514 
515  MemberStats.PetStats = boost::in_place();
516 
517  MemberStats.PetStats->GUID = pet->GetGUID();
518  MemberStats.PetStats->Name = pet->GetName();
519  MemberStats.PetStats->ModelId = pet->GetDisplayId();
520 
521  MemberStats.PetStats->CurrentHealth = pet->GetHealth();
522  MemberStats.PetStats->MaxHealth = pet->GetMaxHealth();
523 
524  for (uint8 i = 0; i < MAX_AURAS; ++i)
525  {
526  if (AuraApplication const* aurApp = pet->GetVisibleAura(i))
527  {
529 
530  aura.SpellId = aurApp->GetBase()->GetId();
531  aura.EffectMask = aurApp->GetEffectMask();
532  aura.Scalings = aurApp->GetFlags(); // ??
533 
534  if (aurApp->GetFlags() & AFLAG_SCALABLE)
535  {
536  for (uint32 e = 0; e < MAX_SPELL_EFFECTS; ++e)
537  {
538  float scale = 0.0f;
539  if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(e))
540  scale = float(eff->GetAmount());
541  aura.EffectScales.push_back(scale);
542  }
543  }
544 
545  MemberStats.PetStats->AuraList.push_back(aura);
546  }
547  }
548  }
549 }
int32 PhaseShiftFlags
Definition: PartyPackets.h:145
Definition: SpellAuraEffects.h:30
std::vector< GroupAura > AuraList
Definition: PartyPackets.h:191
std::vector< GroupPhase > List
Definition: PartyPackets.h:147
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
int32 MaxHealth
Definition: PartyPackets.h:177
uint32 GetMaxHealth() const
Definition: Unit.h:1427
int16 CurrentPower
Definition: PartyPackets.h:180
std::vector< float > EffectScales
Definition: PartyPackets.h:155
int16_t int16
Definition: g3dmath.h:165
uint32 GetDisplayId() const
Definition: Unit.h:2012
Definition: Player.h:521
int16 Unk322
Definition: PartyPackets.h:194
GroupMemberStats MemberStats
Definition: PartyPackets.h:209
Definition: PartyPackets.h:150
std::string const & GetName() const
Definition: Object.h:479
int32 VehicleSeat
Definition: PartyPackets.h:188
Definition: SpellAuras.h:50
Definition: PartyPackets.h:137
int16 PositionZ
Definition: PartyPackets.h:186
Definition: Group.h:71
Aura * GetBase() const
Definition: SpellAuraEffects.h:41
Optional< GroupPetStats > PetStats
Definition: PartyPackets.h:192
int16 Unk200000
Definition: PartyPackets.h:195
int16 PositionX
Definition: PartyPackets.h:184
Definition: Group.h:68
ObjectGuid GUID
Definition: PartyPackets.h:172
uint32 EffectMask
Definition: PartyPackets.h:154
int32 Unk4000000
Definition: PartyPackets.h:197
int16 Level
Definition: PartyPackets.h:173
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448
Definition: SpellAuraDefines.h:29
int16 MaxPower
Definition: PartyPackets.h:181
AuraApplication * GetVisibleAura(uint8 slot) const
Definition: Unit.cpp:537
Definition: Group.h:67
uint16 Flags
Definition: PartyPackets.h:139
GroupPhases Phases
Definition: PartyPackets.h:190
uint8 PowerType
Definition: PartyPackets.h:179
uint32_t uint32
Definition: Define.h:150
int16 Status
Definition: PartyPackets.h:174
Definition: Group.h:66
int8 Unk704[2]
Definition: PartyPackets.h:198
int16 Unk2000000
Definition: PartyPackets.h:196
ObjectGuid const & GetGUID() const
Definition: Object.h:105
int32 CurrentHealth
Definition: PartyPackets.h:176
uint8 Scalings
Definition: PartyPackets.h:153
ObjectGuid PersonalGUID
Definition: PartyPackets.h:146
int16 PositionY
Definition: PartyPackets.h:185
uint8_t uint8
Definition: Define.h:152
bool ForEnemy
Definition: PartyPackets.h:210
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
int16 ZoneID
Definition: PartyPackets.h:183
Definition: UpdateFields.h:191
#define MAX_AURAS
Definition: SpellAuraDefines.h:21
uint32 SpellId
Definition: PartyPackets.h:152
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: Group.h:65
Definition: Pet.h:46
Definition: Group.h:64
uint16 Id
Definition: PartyPackets.h:140
Definition: Group.h:70

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

WorldPacket const * WorldPackets::Party::PartyMemberStats::Write ( )
overridevirtual

Implements WorldPackets::Packet.

150 {
152 
154 
155  return &_worldPacket;
156 }
GroupMemberStats MemberStats
Definition: PartyPackets.h:209
WorldPacket _worldPacket
Definition: Packet.h:43
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
bool ForEnemy
Definition: PartyPackets.h:210

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

bool WorldPackets::Party::PartyMemberStats::ForEnemy = false
GroupMemberStats WorldPackets::Party::PartyMemberStats::MemberStats

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