31#include <unordered_set>
51#define NUM_CLIENT_OBJECT_TYPES 14
166template<HighGu
id high>
170 using Format = std::integral_constant<ObjectGuidFormatType, ObjectGuidFormatType::Null>;
173#define MAKE_GUID_TRAIT(high, sequence, format) \
174 template<> struct ObjectGuidTraits<high> \
176 static constexpr EnumFlag<ObjectGuidSequenceSource> SequenceSource = sequence; \
177 using Format = std::integral_constant<ObjectGuidFormatType, format>; \
281 std::vector<uint8> GetRawValue()
const;
282 void SetRawValue(std::vector<uint8>
const& guid);
295 case HighGuid::Transport:
296 return (_data[1] >> 38) &
UI64LIT(0xFFFFF);
300 return _data[0] &
UI64LIT(0x000000FFFFFFFFFF);
307 case HighGuid::Transport:
317 bool IsEmpty()
const {
return _data[0] == 0 && _data[1] == 0; }
318 bool IsCreature()
const {
return GetHigh() == HighGuid::Creature; }
319 bool IsPet()
const {
return GetHigh() == HighGuid::Pet; }
320 bool IsVehicle()
const {
return GetHigh() == HighGuid::Vehicle; }
324 bool IsPlayer()
const {
return !IsEmpty() && GetHigh() == HighGuid::Player; }
326 bool IsItem()
const {
return GetHigh() == HighGuid::Item; }
327 bool IsGameObject()
const {
return GetHigh() == HighGuid::GameObject; }
329 bool IsCorpse()
const {
return GetHigh() == HighGuid::Corpse; }
333 bool IsParty()
const {
return GetHigh() == HighGuid::Party; }
334 bool IsGuild()
const {
return GetHigh() == HighGuid::Guild; }
337 bool IsCast()
const {
return GetHigh() == HighGuid::Cast; }
347 return std::strong_ordering::equal;
350 static char const* GetTypeName(
HighGuid high);
352 std::string ToString()
const;
353 std::string ToHexString()
const;
354 static ObjectGuid FromString(std::string
const& guidString);
355 std::size_t GetHash()
const;
362 template<HighGu
id type>
static std::enable_if_t<ObjectGuidTraits<type>::Format::value == ObjectGuidFormatType::WorldObject,
ObjectGuid>
Create(
uint8 subType,
uint16 mapId,
uint32 entry,
ObjectGuid::LowType counter) {
return ObjectGuidFactory::CreateWorldObject(type, subType, 0, mapId, 0, entry, counter); }
365 template<HighGu
id type>
static std::enable_if_t<ObjectGuidTraits<type>::Format::value == ObjectGuidFormatType::ChatChannel,
ObjectGuid>
Create(
bool builtIn,
bool trade,
uint16 zoneId,
uint8 factionGroupMask,
ObjectGuid::LowType counter) {
return ObjectGuidFactory::CreateChatChannel(0, builtIn, trade, zoneId, factionGroupMask, counter); }
370 template<HighGu
id type>
static std::enable_if_t<ObjectGuidTraits<type>::Format::value == ObjectGuidFormatType::LFGObject,
ObjectGuid>
Create(
uint8 arg1,
uint8 arg2,
uint8 arg3,
uint8 arg4,
bool arg5,
uint8 arg6,
ObjectGuid::LowType counter) {
return ObjectGuidFactory::CreateLFGObject(arg1, arg2, arg3, arg4, arg5, arg6, counter); }
385 std::array<uint64, 2> _data = { };
407 void HandleCounterOverflow();
408 void CheckGuidTrigger();
424 return key.GetHash();
451 switch (legacyTypeID)
484 if (legacyTypeMask & (1 <<
uint32(i)))
#define DEFINE_ENUM_FLAG(enumType)
ByteBuffer & operator<<(ByteBuffer &buf, ObjectGuid const &guid)
ByteBuffer & operator>>(ByteBuffer &buf, ObjectGuid &guid)
std::list< ObjectGuid > GuidList
std::unordered_set< ObjectGuid > GuidUnorderedSet
@ TYPEID_AZERITE_EMPOWERED_ITEM
TC_GAME_API ByteBuffer & operator>>(ByteBuffer &buf, ObjectGuid &guid)
std::set< ObjectGuid > GuidSet
#define MAKE_GUID_TRAIT(high, sequence, format)
@ TYPEMASK_AZERITE_EMPOWERED_ITEM
TC_GAME_API ByteBuffer & operator<<(ByteBuffer &buf, ObjectGuid const &guid)
std::vector< ObjectGuid > GuidVector
static ObjectGuid CreateTransport(HighGuid type, uint32 counter)
static ObjectGuid CreateGlobal(HighGuid type, uint64 dbIdHigh, uint64 dbId)
static ObjectGuid CreateItem(uint32 realmId, uint64 dbId)
static ObjectGuid CreateWorldLayer(uint32 arg1, uint16 arg2, uint8 arg3, uint32 arg4)
static ObjectGuid CreateLMMLobby(uint32 realmId, uint32 arg2, uint8 arg3, uint8 arg4, uint64 counter)
static ObjectGuid CreateMobileSession(uint32 realmId, uint16 arg1, uint64 counter)
static ObjectGuid CreateClubFinder(uint32 realmId, uint8 type, uint32 clubFinderId, uint64 dbId)
static ObjectGuid CreateClient(HighGuid type, uint32 realmId, uint32 arg1, uint64 counter)
static ObjectGuid CreateClientActor(uint16 ownerType, uint16 ownerId, uint32 counter)
static ObjectGuid CreateToolsClient(uint16 mapId, uint32 serverId, uint64 counter)
static ObjectGuid CreateGuild(HighGuid type, uint32 realmId, uint64 dbId)
static ObjectGuid CreateUniq(uint64 id)
static ObjectGuid CreateWorldObject(HighGuid type, uint8 subType, uint32 realmId, uint16 mapId, uint32 serverId, uint32 entry, uint64 counter)
static ObjectGuid CreateChatChannel(uint32 realmId, bool builtIn, bool trade, uint16 zoneId, uint8 factionGroupMask, uint64 counter)
static ObjectGuid CreatePlayer(uint32 realmId, uint64 dbId)
static ObjectGuid CreateNull()
static ObjectGuid CreateLFGList(uint8 arg1, uint64 counter)
static ObjectGuid CreateLFGObject(uint8 arg1, uint8 arg2, uint8 arg3, uint8 arg4, bool arg5, uint8 arg6, uint64 counter)
static ObjectGuid CreateWebObj(uint32 realmId, uint8 arg1, uint8 arg2, uint64 counter)
ObjectGuidGenerator(HighGuid high, ObjectGuid::LowType start=UI64LIT(1))
ObjectGuid::LowType _nextGuid
ObjectGuid::LowType GetNextAfterMaxUsed() const
~ObjectGuidGenerator()=default
void Set(ObjectGuid::LowType val)
static LowType GetMaxCounter(HighGuid high)
LowType GetCounter() const
static ObjectGuid const Empty
bool IsAnyTypeGameObject() const
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Client, ObjectGuid > Create(uint32 arg1, ObjectGuid::LowType counter)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldObject, ObjectGuid > Create(uint16 mapId, uint32 entry, ObjectGuid::LowType counter)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Uniq, ObjectGuid > Create(ObjectGuid::LowType id)
ObjectGuid(uint64 high, uint64 low)
bool IsAreaTrigger() const
uint64 GetRawValue(std::size_t i) const
void SetRawValue(uint64 high, uint64 low)
bool operator==(ObjectGuid const &right) const =default
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ChatChannel, ObjectGuid > Create(bool builtIn, bool trade, uint16 zoneId, uint8 factionGroupMask, ObjectGuid::LowType counter)
bool IsSceneObject() const
static ObjectGuid const FromStringFailed
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LFGObject, ObjectGuid > Create(uint8 arg1, uint8 arg2, uint8 arg3, uint8 arg4, bool arg5, uint8 arg6, ObjectGuid::LowType counter)
bool IsMOTransport() const
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldLayer, ObjectGuid > Create(uint32 arg1, uint16 arg2, uint8 arg3, uint32 arg4)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ToolsClient, ObjectGuid > Create(uint16 mapId, uint32 serverId, ObjectGuid::LowType counter)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LFGList, ObjectGuid > Create(uint8 arg1, ObjectGuid::LowType counter)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Transport, ObjectGuid > Create(uint32 counter)
bool IsDynamicObject() const
LowType GetMaxCounter() const
bool IsGameObject() const
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WorldObject, ObjectGuid > Create(uint8 subType, uint16 mapId, uint32 entry, ObjectGuid::LowType counter)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Item, ObjectGuid > Create(ObjectGuid::LowType dbId)
bool IsCreatureOrPet() const
std::strong_ordering operator<=>(ObjectGuid const &right) const
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::MobileSession, ObjectGuid > Create(uint16 arg1, ObjectGuid::LowType counter)
std::array< uint64, 2 > _data
static ObjectGuid const TradeItem
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Player, ObjectGuid > Create(ObjectGuid::LowType dbId)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::LMMLobby, ObjectGuid > Create(uint32 arg2, uint8 arg3, uint8 arg4, ObjectGuid::LowType counter)
uint32 GetSubType() const
char const * GetTypeName() const
bool IsAnyTypeCreature() const
bool IsCreatureOrVehicle() const
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ClientActor, ObjectGuid > Create(uint16 ownerType, uint16 ownerId, uint32 counter)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Guild, ObjectGuid > Create(ObjectGuid::LowType dbId)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::ClubFinder, ObjectGuid > Create(uint8 clubType, uint32 clubFinderId, ObjectGuid::LowType dbId)
uint32 GetRealmId() const
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Null, ObjectGuid > Create()
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::Global, ObjectGuid > Create(ObjectGuid::LowType dbId)
static std::enable_if_t< ObjectGuidTraits< type >::Format::value==ObjectGuidFormatType::WebObj, ObjectGuid > Create(uint8 arg1, uint8 arg2, ObjectGuid::LowType counter)
bool IsConversation() const
constexpr TypeMask ConvertLegacyTypeMask(uint32 legacyTypeMask)
constexpr ::TypeID ConvertLegacyTypeID(TypeID legacyTypeID)
constexpr bool is_neq(std::partial_ordering cmp) noexcept
std::integral_constant< ObjectGuidFormatType, ObjectGuidFormatType::Null > Format
static constexpr EnumFlag< ObjectGuidSequenceSource > SequenceSource
size_t operator()(ObjectGuid const &key) const noexcept