TrinityCore
Loading...
Searching...
No Matches
ObjectGuid Class Reference

#include <ObjectGuid.h>

Public Types

using LowType = uint64
 

Public Member Functions

 ObjectGuid ()=default
 
uint64 GetRawValue (std::size_t i) const
 
std::vector< uint8GetRawValue () const
 
void SetRawValue (std::vector< uint8 > const &guid)
 
void SetRawValue (uint64 high, uint64 low)
 
void Clear ()
 
HighGuid GetHigh () const
 
uint32 GetRealmId () const
 
uint32 GetMapId () const
 
uint32 GetEntry () const
 
uint32 GetSubType () const
 
LowType GetCounter () const
 
LowType GetMaxCounter () const
 
bool IsEmpty () const
 
bool IsCreature () const
 
bool IsPet () const
 
bool IsVehicle () const
 
bool IsCreatureOrPet () const
 
bool IsCreatureOrVehicle () const
 
bool IsAnyTypeCreature () const
 
bool IsPlayer () const
 
bool IsUnit () const
 
bool IsItem () const
 
bool IsGameObject () const
 
bool IsDynamicObject () const
 
bool IsCorpse () const
 
bool IsAreaTrigger () const
 
bool IsMOTransport () const
 
bool IsAnyTypeGameObject () const
 
bool IsParty () const
 
bool IsGuild () const
 
bool IsSceneObject () const
 
bool IsConversation () const
 
bool IsCast () const
 
bool operator! () const
 
bool operator== (ObjectGuid const &right) const =default
 
std::strong_ordering operator<=> (ObjectGuid const &right) const
 
char const * GetTypeName () const
 
std::string ToString () const
 
std::string ToHexString () const
 
std::size_t GetHash () const
 

Static Public Member Functions

static LowType GetMaxCounter (HighGuid high)
 
static char const * GetTypeName (HighGuid high)
 
static ObjectGuid FromString (std::string const &guidString)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Null, ObjectGuidCreate ()
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Uniq, ObjectGuidCreate (ObjectGuid::LowType id)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Player, ObjectGuidCreate (ObjectGuid::LowType dbId)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Item, ObjectGuidCreate (ObjectGuid::LowType dbId)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldObject, ObjectGuidCreate (uint16 mapId, uint32 entry, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldObject, ObjectGuidCreate (uint8 subType, uint16 mapId, uint32 entry, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Transport, ObjectGuidCreate (uint32 counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ClientActor, ObjectGuidCreate (uint16 ownerType, uint16 ownerId, uint32 counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ChatChannel, ObjectGuidCreate (bool builtIn, bool trade, uint16 zoneId, uint8 factionGroupMask, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Global, ObjectGuidCreate (ObjectGuid::LowType dbId)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Guild, ObjectGuidCreate (ObjectGuid::LowType dbId)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::MobileSession, ObjectGuidCreate (uint16 arg1, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WebObj, ObjectGuidCreate (uint8 arg1, uint8 arg2, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LFGObject, ObjectGuidCreate (uint8 arg1, uint8 arg2, uint8 arg3, uint8 arg4, bool arg5, uint8 arg6, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LFGList, ObjectGuidCreate (uint8 arg1, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Client, ObjectGuidCreate (uint32 arg1, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ClubFinder, ObjectGuidCreate (uint8 clubType, uint32 clubFinderId, ObjectGuid::LowType dbId)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ToolsClient, ObjectGuidCreate (uint16 mapId, uint32 serverId, ObjectGuid::LowType counter)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldLayer, ObjectGuidCreate (uint32 arg1, uint16 arg2, uint8 arg3, uint32 arg4)
 
template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LMMLobby, ObjectGuidCreate (uint32 arg2, uint8 arg3, uint8 arg4, ObjectGuid::LowType counter)
 

Static Public Attributes

static ObjectGuid const Empty = ObjectGuid()
 
static ObjectGuid const FromStringFailed = ObjectGuid::Create<HighGuid::Uniq>(UI64LIT(4))
 
static ObjectGuid const TradeItem = ObjectGuid::Create<HighGuid::Uniq>(UI64LIT(10))
 

Protected Member Functions

 ObjectGuid (uint64 high, uint64 low)
 

Protected Attributes

std::array< uint64, 2 > _data = { }
 

Friends

class ObjectGuidFactory
 
TC_GAME_API ByteBufferoperator<< (ByteBuffer &buf, ObjectGuid const &guid)
 
TC_GAME_API ByteBufferoperator>> (ByteBuffer &buf, ObjectGuid &guid)
 

Detailed Description

Definition at line 265 of file ObjectGuid.h.

Member Typedef Documentation

◆ LowType

Definition at line 276 of file ObjectGuid.h.

Constructor & Destructor Documentation

◆ ObjectGuid() [1/2]

ObjectGuid::ObjectGuid ( )
default

◆ ObjectGuid() [2/2]

ObjectGuid::ObjectGuid ( uint64  high,
uint64  low 
)
inlineprotected

Definition at line 379 of file ObjectGuid.h.

380 {
381 _data[0] = low;
382 _data[1] = high;
383 }
std::array< uint64, 2 > _data
Definition: ObjectGuid.h:385

Member Function Documentation

◆ Clear()

void ObjectGuid::Clear ( )
inline

Definition at line 284 of file ObjectGuid.h.

284{ _data = { }; }

◆ Create() [1/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Null, ObjectGuid > ObjectGuid::Create ( )
inlinestatic

Definition at line 357 of file ObjectGuid.h.

static ObjectGuid CreateNull()
Definition: ObjectGuid.cpp:598
+ Here is the call graph for this function:

◆ Create() [2/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ChatChannel, ObjectGuid > ObjectGuid::Create ( bool  builtIn,
bool  trade,
uint16  zoneId,
uint8  factionGroupMask,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 365 of file ObjectGuid.h.

365{ return ObjectGuidFactory::CreateChatChannel(0, builtIn, trade, zoneId, factionGroupMask, counter); }
static ObjectGuid CreateChatChannel(uint32 realmId, bool builtIn, bool trade, uint16 zoneId, uint8 factionGroupMask, uint64 counter)
Definition: ObjectGuid.cpp:649
+ Here is the call graph for this function:

◆ Create() [3/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Player, ObjectGuid > ObjectGuid::Create ( ObjectGuid::LowType  dbId)
inlinestatic

Definition at line 359 of file ObjectGuid.h.

359{ return ObjectGuidFactory::CreatePlayer(0, dbId); }
static ObjectGuid CreatePlayer(uint32 realmId, uint64 dbId)
Definition: ObjectGuid.cpp:609
+ Here is the call graph for this function:

◆ Create() [4/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Item, ObjectGuid > ObjectGuid::Create ( ObjectGuid::LowType  dbId)
inlinestatic

Definition at line 360 of file ObjectGuid.h.

360{ return ObjectGuidFactory::CreateItem(0, dbId); }
static ObjectGuid CreateItem(uint32 realmId, uint64 dbId)
Definition: ObjectGuid.cpp:616
+ Here is the call graph for this function:

◆ Create() [5/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Global, ObjectGuid > ObjectGuid::Create ( ObjectGuid::LowType  dbId)
inlinestatic

Definition at line 366 of file ObjectGuid.h.

366{ return ObjectGuidFactory::CreateGlobal(type, UI64LIT(0), dbId); }
#define UI64LIT(N)
Definition: Define.h:128
static ObjectGuid CreateGlobal(HighGuid type, uint64 dbIdHigh, uint64 dbId)
Definition: ObjectGuid.cpp:660
+ Here is the call graph for this function:

◆ Create() [6/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Guild, ObjectGuid > ObjectGuid::Create ( ObjectGuid::LowType  dbId)
inlinestatic

Definition at line 367 of file ObjectGuid.h.

367{ return ObjectGuidFactory::CreateGuild(type, 0, dbId); }
static ObjectGuid CreateGuild(HighGuid type, uint32 realmId, uint64 dbId)
Definition: ObjectGuid.cpp:667
+ Here is the call graph for this function:

◆ Create() [7/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Uniq, ObjectGuid > ObjectGuid::Create ( ObjectGuid::LowType  id)
inlinestatic

Definition at line 358 of file ObjectGuid.h.

358{ return ObjectGuidFactory::CreateUniq(id); }
static ObjectGuid CreateUniq(uint64 id)
Definition: ObjectGuid.cpp:603
+ Here is the call graph for this function:

◆ Create() [8/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::MobileSession, ObjectGuid > ObjectGuid::Create ( uint16  arg1,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 368 of file ObjectGuid.h.

368{ return ObjectGuidFactory::CreateMobileSession(0, arg1, counter); }
static ObjectGuid CreateMobileSession(uint32 realmId, uint16 arg1, uint64 counter)
Definition: ObjectGuid.cpp:674
+ Here is the call graph for this function:

◆ Create() [9/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldObject, ObjectGuid > ObjectGuid::Create ( uint16  mapId,
uint32  entry,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 361 of file ObjectGuid.h.

361{ return ObjectGuidFactory::CreateWorldObject(type, 0, 0, mapId, 0, entry, counter); }
static ObjectGuid CreateWorldObject(HighGuid type, uint8 subType, uint32 realmId, uint16 mapId, uint32 serverId, uint32 entry, uint64 counter)
Definition: ObjectGuid.cpp:623
+ Here is the call graph for this function:

◆ Create() [10/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ToolsClient, ObjectGuid > ObjectGuid::Create ( uint16  mapId,
uint32  serverId,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 374 of file ObjectGuid.h.

374{ return ObjectGuidFactory::CreateToolsClient(mapId, serverId, counter); }
static ObjectGuid CreateToolsClient(uint16 mapId, uint32 serverId, uint64 counter)
Definition: ObjectGuid.cpp:727
+ Here is the call graph for this function:

◆ Create() [11/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ClientActor, ObjectGuid > ObjectGuid::Create ( uint16  ownerType,
uint16  ownerId,
uint32  counter 
)
inlinestatic

Definition at line 364 of file ObjectGuid.h.

364{ return ObjectGuidFactory::CreateClientActor(ownerType, ownerId, counter); }
static ObjectGuid CreateClientActor(uint16 ownerType, uint16 ownerId, uint32 counter)
Definition: ObjectGuid.cpp:641
+ Here is the call graph for this function:

◆ Create() [12/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Client, ObjectGuid > ObjectGuid::Create ( uint32  arg1,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 372 of file ObjectGuid.h.

372{ return ObjectGuidFactory::CreateClient(type, 0, arg1, counter); }
static ObjectGuid CreateClient(HighGuid type, uint32 realmId, uint32 arg1, uint64 counter)
Definition: ObjectGuid.cpp:710
+ Here is the call graph for this function:

◆ Create() [13/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldLayer, ObjectGuid > ObjectGuid::Create ( uint32  arg1,
uint16  arg2,
uint8  arg3,
uint32  arg4 
)
inlinestatic

Definition at line 375 of file ObjectGuid.h.

375{ return ObjectGuidFactory::CreateWorldLayer(arg1, arg2, arg3, arg4); }
static ObjectGuid CreateWorldLayer(uint32 arg1, uint16 arg2, uint8 arg3, uint32 arg4)
Definition: ObjectGuid.cpp:735
+ Here is the call graph for this function:

◆ Create() [14/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LMMLobby, ObjectGuid > ObjectGuid::Create ( uint32  arg2,
uint8  arg3,
uint8  arg4,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 376 of file ObjectGuid.h.

376{ return ObjectGuidFactory::CreateLMMLobby(0, arg2, arg3, arg4, counter); }
static ObjectGuid CreateLMMLobby(uint32 realmId, uint32 arg2, uint8 arg3, uint8 arg4, uint64 counter)
Definition: ObjectGuid.cpp:744
+ Here is the call graph for this function:

◆ Create() [15/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Transport, ObjectGuid > ObjectGuid::Create ( uint32  counter)
inlinestatic

Definition at line 363 of file ObjectGuid.h.

363{ return ObjectGuidFactory::CreateTransport(type, counter); }
static ObjectGuid CreateTransport(HighGuid type, uint32 counter)
Definition: ObjectGuid.cpp:634
+ Here is the call graph for this function:

◆ Create() [16/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LFGList, ObjectGuid > ObjectGuid::Create ( uint8  arg1,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 371 of file ObjectGuid.h.

371{ return ObjectGuidFactory::CreateLFGList(arg1, counter); }
static ObjectGuid CreateLFGList(uint8 arg1, uint64 counter)
Definition: ObjectGuid.cpp:703
+ Here is the call graph for this function:

◆ Create() [17/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WebObj, ObjectGuid > ObjectGuid::Create ( uint8  arg1,
uint8  arg2,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 369 of file ObjectGuid.h.

369{ return ObjectGuidFactory::CreateWebObj(0, arg1, arg2, counter); }
static ObjectGuid CreateWebObj(uint32 realmId, uint8 arg1, uint8 arg2, uint64 counter)
Definition: ObjectGuid.cpp:682
+ Here is the call graph for this function:

◆ Create() [18/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LFGObject, ObjectGuid > ObjectGuid::Create ( uint8  arg1,
uint8  arg2,
uint8  arg3,
uint8  arg4,
bool  arg5,
uint8  arg6,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 370 of file ObjectGuid.h.

370{ return ObjectGuidFactory::CreateLFGObject(arg1, arg2, arg3, arg4, arg5, arg6, counter); }
static ObjectGuid CreateLFGObject(uint8 arg1, uint8 arg2, uint8 arg3, uint8 arg4, bool arg5, uint8 arg6, uint64 counter)
Definition: ObjectGuid.cpp:691
+ Here is the call graph for this function:

◆ Create() [19/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ClubFinder, ObjectGuid > ObjectGuid::Create ( uint8  clubType,
uint32  clubFinderId,
ObjectGuid::LowType  dbId 
)
inlinestatic

Definition at line 373 of file ObjectGuid.h.

373{ return ObjectGuidFactory::CreateClubFinder(0, clubType, clubFinderId, dbId); }
static ObjectGuid CreateClubFinder(uint32 realmId, uint8 type, uint32 clubFinderId, uint64 dbId)
Definition: ObjectGuid.cpp:718
+ Here is the call graph for this function:

◆ Create() [20/20]

template<HighGuid type>
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldObject, ObjectGuid > ObjectGuid::Create ( uint8  subType,
uint16  mapId,
uint32  entry,
ObjectGuid::LowType  counter 
)
inlinestatic

Definition at line 362 of file ObjectGuid.h.

362{ return ObjectGuidFactory::CreateWorldObject(type, subType, 0, mapId, 0, entry, counter); }
+ Here is the call graph for this function:

◆ FromString()

ObjectGuid ObjectGuid::FromString ( std::string const &  guidString)
static

Definition at line 564 of file ObjectGuid.cpp.

565{
566 return Info.Parse(guidString);
567}
+ Here is the caller graph for this function:

◆ GetCounter()

LowType ObjectGuid::GetCounter ( ) const
inline

Definition at line 291 of file ObjectGuid.h.

292 {
293 switch (GetHigh())
294 {
295 case HighGuid::Transport:
296 return (_data[1] >> 38) & UI64LIT(0xFFFFF);
297 default:
298 break;
299 }
300 return _data[0] & UI64LIT(0x000000FFFFFFFFFF);
301 }
HighGuid GetHigh() const
Definition: ObjectGuid.h:286

◆ GetEntry()

uint32 ObjectGuid::GetEntry ( ) const
inline

Definition at line 289 of file ObjectGuid.h.

289{ return uint32((_data[1] >> 6) & 0x7FFFFF); }
uint32_t uint32
Definition: Define.h:143
+ Here is the caller graph for this function:

◆ GetHash()

std::size_t ObjectGuid::GetHash ( ) const

Definition at line 569 of file ObjectGuid.cpp.

570{
571 std::size_t hashVal = 0;
572 Trinity::hash_combine(hashVal, _data[0]);
573 Trinity::hash_combine(hashVal, _data[1]);
574 return hashVal;
575}
void hash_combine(std::size_t &seed, T const &val)
Definition: Hash.h:28
+ Here is the call graph for this function:

◆ GetHigh()

HighGuid ObjectGuid::GetHigh ( ) const
inline

Definition at line 286 of file ObjectGuid.h.

286{ return HighGuid((_data[1] >> 58) & 0x3F); }
HighGuid
Definition: ObjectGuid.h:73
+ Here is the caller graph for this function:

◆ GetMapId()

uint32 ObjectGuid::GetMapId ( ) const
inline

Definition at line 288 of file ObjectGuid.h.

288{ return uint32((_data[1] >> 29) & 0x1FFF); }

◆ GetMaxCounter() [1/2]

LowType ObjectGuid::GetMaxCounter ( ) const
inline

Definition at line 315 of file ObjectGuid.h.

315{ return GetMaxCounter(GetHigh()); }
LowType GetMaxCounter() const
Definition: ObjectGuid.h:315
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMaxCounter() [2/2]

static LowType ObjectGuid::GetMaxCounter ( HighGuid  high)
inlinestatic

Definition at line 303 of file ObjectGuid.h.

304 {
305 switch (high)
306 {
307 case HighGuid::Transport:
308 return UI64LIT(0xFFFFF);
309 default:
310 break;
311 }
312 return UI64LIT(0xFFFFFFFFFF);
313 }

◆ GetRawValue() [1/2]

std::vector< uint8 > ObjectGuid::GetRawValue ( ) const

Definition at line 577 of file ObjectGuid.cpp.

578{
579 std::vector<uint8> raw(16);
580 memcpy(raw.data(), this, sizeof(*this));
581 return raw;
582}

◆ GetRawValue() [2/2]

uint64 ObjectGuid::GetRawValue ( std::size_t  i) const
inline

Definition at line 280 of file ObjectGuid.h.

280{ return _data[i]; }
+ Here is the caller graph for this function:

◆ GetRealmId()

uint32 ObjectGuid::GetRealmId ( ) const
inline

Definition at line 287 of file ObjectGuid.h.

287{ return uint32((_data[1] >> 42) & 0xFFFF); }

◆ GetSubType()

uint32 ObjectGuid::GetSubType ( ) const
inline

Definition at line 290 of file ObjectGuid.h.

290{ return uint32(_data[1] & 0x3F); }

◆ GetTypeName() [1/2]

char const * ObjectGuid::GetTypeName ( ) const
inline

Definition at line 351 of file ObjectGuid.h.

351{ return !IsEmpty() ? GetTypeName(GetHigh()) : "None"; }
bool IsEmpty() const
Definition: ObjectGuid.h:317
char const * GetTypeName() const
Definition: ObjectGuid.h:351
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTypeName() [2/2]

char const * ObjectGuid::GetTypeName ( HighGuid  high)
static

Definition at line 546 of file ObjectGuid.cpp.

547{
548 if (high >= HighGuid::Count)
549 return "<unknown>";
550
551 return Info.Names[uint32(high)].c_str();
552}
+ Here is the caller graph for this function:

◆ IsAnyTypeCreature()

bool ObjectGuid::IsAnyTypeCreature ( ) const
inline

Definition at line 323 of file ObjectGuid.h.

323{ return IsCreature() || IsPet() || IsVehicle(); }
bool IsVehicle() const
Definition: ObjectGuid.h:320
bool IsCreature() const
Definition: ObjectGuid.h:318
bool IsPet() const
Definition: ObjectGuid.h:319
+ Here is the caller graph for this function:

◆ IsAnyTypeGameObject()

bool ObjectGuid::IsAnyTypeGameObject ( ) const
inline

Definition at line 332 of file ObjectGuid.h.

332{ return IsGameObject() || IsMOTransport(); }
bool IsMOTransport() const
Definition: ObjectGuid.h:331
bool IsGameObject() const
Definition: ObjectGuid.h:327
+ Here is the caller graph for this function:

◆ IsAreaTrigger()

bool ObjectGuid::IsAreaTrigger ( ) const
inline

Definition at line 330 of file ObjectGuid.h.

330{ return GetHigh() == HighGuid::AreaTrigger; }

◆ IsCast()

bool ObjectGuid::IsCast ( ) const
inline

Definition at line 337 of file ObjectGuid.h.

337{ return GetHigh() == HighGuid::Cast; }

◆ IsConversation()

bool ObjectGuid::IsConversation ( ) const
inline

Definition at line 336 of file ObjectGuid.h.

336{ return GetHigh() == HighGuid::Conversation; }

◆ IsCorpse()

bool ObjectGuid::IsCorpse ( ) const
inline

Definition at line 329 of file ObjectGuid.h.

329{ return GetHigh() == HighGuid::Corpse; }
+ Here is the caller graph for this function:

◆ IsCreature()

bool ObjectGuid::IsCreature ( ) const
inline

Definition at line 318 of file ObjectGuid.h.

318{ return GetHigh() == HighGuid::Creature; }
+ Here is the caller graph for this function:

◆ IsCreatureOrPet()

bool ObjectGuid::IsCreatureOrPet ( ) const
inline

Definition at line 321 of file ObjectGuid.h.

321{ return IsCreature() || IsPet(); }

◆ IsCreatureOrVehicle()

bool ObjectGuid::IsCreatureOrVehicle ( ) const
inline

Definition at line 322 of file ObjectGuid.h.

322{ return IsCreature() || IsVehicle(); }
+ Here is the caller graph for this function:

◆ IsDynamicObject()

bool ObjectGuid::IsDynamicObject ( ) const
inline

Definition at line 328 of file ObjectGuid.h.

328{ return GetHigh() == HighGuid::DynamicObject; }

◆ IsEmpty()

bool ObjectGuid::IsEmpty ( ) const
inline

Definition at line 317 of file ObjectGuid.h.

317{ return _data[0] == 0 && _data[1] == 0; }

◆ IsGameObject()

bool ObjectGuid::IsGameObject ( ) const
inline

Definition at line 327 of file ObjectGuid.h.

327{ return GetHigh() == HighGuid::GameObject; }
+ Here is the caller graph for this function:

◆ IsGuild()

bool ObjectGuid::IsGuild ( ) const
inline

Definition at line 334 of file ObjectGuid.h.

334{ return GetHigh() == HighGuid::Guild; }
+ Here is the caller graph for this function:

◆ IsItem()

bool ObjectGuid::IsItem ( ) const
inline

Definition at line 326 of file ObjectGuid.h.

326{ return GetHigh() == HighGuid::Item; }
+ Here is the caller graph for this function:

◆ IsMOTransport()

bool ObjectGuid::IsMOTransport ( ) const
inline

Definition at line 331 of file ObjectGuid.h.

331{ return GetHigh() == HighGuid::Transport; }
+ Here is the caller graph for this function:

◆ IsParty()

bool ObjectGuid::IsParty ( ) const
inline

Definition at line 333 of file ObjectGuid.h.

333{ return GetHigh() == HighGuid::Party; }
+ Here is the caller graph for this function:

◆ IsPet()

bool ObjectGuid::IsPet ( ) const
inline

Definition at line 319 of file ObjectGuid.h.

319{ return GetHigh() == HighGuid::Pet; }
+ Here is the caller graph for this function:

◆ IsPlayer()

bool ObjectGuid::IsPlayer ( ) const
inline

Definition at line 324 of file ObjectGuid.h.

324{ return !IsEmpty() && GetHigh() == HighGuid::Player; }
+ Here is the caller graph for this function:

◆ IsSceneObject()

bool ObjectGuid::IsSceneObject ( ) const
inline

Definition at line 335 of file ObjectGuid.h.

335{ return GetHigh() == HighGuid::SceneObject; }

◆ IsUnit()

bool ObjectGuid::IsUnit ( ) const
inline

Definition at line 325 of file ObjectGuid.h.

325{ return IsAnyTypeCreature() || IsPlayer(); }
bool IsPlayer() const
Definition: ObjectGuid.h:324
bool IsAnyTypeCreature() const
Definition: ObjectGuid.h:323
+ Here is the caller graph for this function:

◆ IsVehicle()

bool ObjectGuid::IsVehicle ( ) const
inline

Definition at line 320 of file ObjectGuid.h.

320{ return GetHigh() == HighGuid::Vehicle; }
+ Here is the caller graph for this function:

◆ operator!()

bool ObjectGuid::operator! ( ) const
inline

Definition at line 339 of file ObjectGuid.h.

339{ return IsEmpty(); }

◆ operator<=>()

std::strong_ordering ObjectGuid::operator<=> ( ObjectGuid const &  right) const
inline

Definition at line 341 of file ObjectGuid.h.

342 {
343 if (std::strong_ordering cmp = _data[1] <=> right._data[1]; advstd::is_neq(cmp))
344 return cmp;
345 if (std::strong_ordering cmp = _data[0] <=> right._data[0]; advstd::is_neq(cmp))
346 return cmp;
347 return std::strong_ordering::equal;
348 }
constexpr bool is_neq(std::partial_ordering cmp) noexcept
Definition: advstd.h:35
+ Here is the call graph for this function:

◆ operator==()

bool ObjectGuid::operator== ( ObjectGuid const &  right) const
default

◆ SetRawValue() [1/2]

void ObjectGuid::SetRawValue ( std::vector< uint8 > const &  guid)

Definition at line 584 of file ObjectGuid.cpp.

585{
586 ASSERT(guid.size() == sizeof(*this));
587 memcpy(this, guid.data(), sizeof(*this));
588}
#define ASSERT
Definition: Errors.h:68
+ Here is the caller graph for this function:

◆ SetRawValue() [2/2]

void ObjectGuid::SetRawValue ( uint64  high,
uint64  low 
)
inline

Definition at line 283 of file ObjectGuid.h.

283{ _data[0] = low; _data[1] = high; }

◆ ToHexString()

std::string ObjectGuid::ToHexString ( ) const

Definition at line 559 of file ObjectGuid.cpp.

560{
561 return Trinity::StringFormat("0x{:016X}{:016X}", _data[1], _data[0]);
562}
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
Definition: StringFormat.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToString()

std::string ObjectGuid::ToString ( ) const

Definition at line 554 of file ObjectGuid.cpp.

555{
556 return Info.Format(*this);
557}

Friends And Related Function Documentation

◆ ObjectGuidFactory

friend class ObjectGuidFactory
friend

Definition at line 267 of file ObjectGuid.h.

◆ operator<<

TC_GAME_API ByteBuffer & operator<< ( ByteBuffer buf,
ObjectGuid const &  guid 
)
friend

Definition at line 758 of file ObjectGuid.cpp.

759{
760 uint8 lowMask = 0;
761 uint8 highMask = 0;
762 buf.FlushBits(); // flush any unwritten bits to make wpos return a meaningful value
763 std::size_t pos = buf.wpos();
764 buf << uint8(lowMask);
765 buf << uint8(highMask);
766
767 uint8 packed[8];
768 if (size_t packedSize = ByteBuffer::PackUInt64(guid._data[0], &lowMask, packed))
769 buf.append(packed, packedSize);
770 if (size_t packedSize = ByteBuffer::PackUInt64(guid._data[1], &highMask, packed))
771 buf.append(packed, packedSize);
772
773 buf.put(pos, lowMask);
774 buf.put(pos + 1, highMask);
775
776 return buf;
777}
uint8_t uint8
Definition: Define.h:145
static size_t PackUInt64(uint64 value, uint8 *mask, uint8 *result)
Definition: ByteBuffer.h:605
void append(T value)
Definition: ByteBuffer.h:143
size_t wpos() const
Definition: ByteBuffer.h:412
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
void FlushBits()
Definition: ByteBuffer.h:155

◆ operator>>

TC_GAME_API ByteBuffer & operator>> ( ByteBuffer buf,
ObjectGuid guid 
)
friend

Definition at line 779 of file ObjectGuid.cpp.

780{
781 uint8 lowMask, highMask;
782 buf >> lowMask >> highMask;
783 buf.ReadPackedUInt64(lowMask, guid._data[0]);
784 buf.ReadPackedUInt64(highMask, guid._data[1]);
785 return buf;
786}
void ReadPackedUInt64(uint64 &guid)
Definition: ByteBuffer.h:485

Member Data Documentation

◆ _data

std::array<uint64, 2> ObjectGuid::_data = { }
protected

Definition at line 385 of file ObjectGuid.h.

◆ Empty

ObjectGuid const ObjectGuid::Empty = ObjectGuid()
static

Definition at line 272 of file ObjectGuid.h.

◆ FromStringFailed

ObjectGuid const ObjectGuid::FromStringFailed = ObjectGuid::Create<HighGuid::Uniq>(UI64LIT(4))
static

Definition at line 273 of file ObjectGuid.h.

◆ TradeItem

ObjectGuid const ObjectGuid::TradeItem = ObjectGuid::Create<HighGuid::Uniq>(UI64LIT(10))
static

Definition at line 274 of file ObjectGuid.h.


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