TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WorldPackets::Query::PlayerGuidLookupData Struct Reference

#include <QueryPackets.h>

Public Member Functions

bool Initialize (ObjectGuid const &guid, Player const *player=nullptr)
 

Public Attributes

bool IsDeleted = false
 
ObjectGuid AccountID
 
ObjectGuid BnetAccountID
 
ObjectGuid GuidActual
 
std::string Name
 
uint32 VirtualRealmAddress = 0
 
uint8 Race = RACE_NONE
 
uint8 Sex = GENDER_NONE
 
uint8 ClassID = CLASS_NONE
 
uint8 Level = 0
 
DeclinedName DeclinedNames
 

Member Function Documentation

bool WorldPackets::Query::PlayerGuidLookupData::Initialize ( ObjectGuid const guid,
Player const player = nullptr 
)
117 {
118  CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(guid);
119  if (!characterInfo)
120  return false;
121 
122  if (player)
123  {
124  ASSERT(player->GetGUID() == guid);
125 
126  AccountID = player->GetSession()->GetAccountGUID();
127  BnetAccountID = player->GetSession()->GetBattlenetAccountGUID();
128  Name = player->GetName();
129  Race = player->getRace();
130  Sex = player->GetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_GENDER);
131  ClassID = player->getClass();
132  Level = player->getLevel();
133 
134  if (DeclinedName const* names = player->GetDeclinedNames())
135  DeclinedNames = *names;
136  }
137  else
138  {
140  uint32 bnetAccountId = ::Battlenet::AccountMgr::GetIdByGameAccount(accountId);
141 
142  AccountID = ObjectGuid::Create<HighGuid::WowAccount>(accountId);
143  BnetAccountID = ObjectGuid::Create<HighGuid::BNetAccount>(bnetAccountId);
144  Name = characterInfo->Name;
145  Race = characterInfo->Race;
146  Sex = characterInfo->Sex;
147  ClassID = characterInfo->Class;
148  Level = characterInfo->Level;
149  }
150 
151  IsDeleted = characterInfo->IsDeleted;
152  GuidActual = guid;
154 
155  return true;
156 }
Definition: Player.h:587
std::string Name
Definition: World.h:534
uint8 Sex
Definition: World.h:538
#define sWorld
Definition: World.h:887
uint8 ClassID
Definition: QueryPackets.h:104
bool IsDeleted
Definition: World.h:540
ObjectGuid AccountID
Definition: QueryPackets.h:97
Definition: UpdateFields.h:198
ObjectGuid GuidActual
Definition: QueryPackets.h:99
uint8 Level
Definition: World.h:539
uint8 Race
Definition: World.h:537
TC_GAME_API uint32 GetIdByGameAccount(uint32 gameAccountId)
Definition: BattlenetAccountMgr.cpp:151
uint8 Sex
Definition: QueryPackets.h:103
Definition: World.h:532
uint8 Race
Definition: QueryPackets.h:102
uint32_t uint32
Definition: Define.h:150
ObjectGuid BnetAccountID
Definition: QueryPackets.h:98
uint32 VirtualRealmAddress
Definition: QueryPackets.h:101
uint8 Level
Definition: QueryPackets.h:105
DeclinedName DeclinedNames
Definition: QueryPackets.h:106
uint32 GetVirtualRealmAddress()
Definition: World.cpp:3487
#define ASSERT
Definition: Errors.h:55
uint8 Class
Definition: World.h:536
static uint32 GetPlayerAccountIdByGUID(ObjectGuid const &guid)
Definition: ObjectMgr.cpp:2302
Definition: Unit.h:1101
std::string Name
Definition: QueryPackets.h:100
bool IsDeleted
Definition: QueryPackets.h:96

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

ObjectGuid WorldPackets::Query::PlayerGuidLookupData::AccountID
ObjectGuid WorldPackets::Query::PlayerGuidLookupData::BnetAccountID
uint8 WorldPackets::Query::PlayerGuidLookupData::ClassID = CLASS_NONE
DeclinedName WorldPackets::Query::PlayerGuidLookupData::DeclinedNames
ObjectGuid WorldPackets::Query::PlayerGuidLookupData::GuidActual
bool WorldPackets::Query::PlayerGuidLookupData::IsDeleted = false
uint8 WorldPackets::Query::PlayerGuidLookupData::Level = 0
std::string WorldPackets::Query::PlayerGuidLookupData::Name
uint8 WorldPackets::Query::PlayerGuidLookupData::Race = RACE_NONE
uint8 WorldPackets::Query::PlayerGuidLookupData::Sex = GENDER_NONE
uint32 WorldPackets::Query::PlayerGuidLookupData::VirtualRealmAddress = 0

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