OregonCore  revision fb2a440-git
Your Favourite TBC server
ObjectGuid.h File Reference
#include "Common.h"
#include "ByteBuffer.h"

Go to the source code of this file.

Classes

struct  PackedGuidReader
 
class  ObjectGuid
 
class  PackedGuid
 

Macros

#define MAX_TYPE_ID   8
 
#define IS_CREATURE_GUID(Guid)    (GUID_HIPART(Guid) == HIGHGUID_UNIT)
 
#define IS_PET_GUID(Guid)    (GUID_HIPART(Guid) == HIGHGUID_PET)
 
#define IS_CREATURE_OR_PET_GUID(Guid)   (IS_CREATURE_GUID(Guid) || IS_PET_GUID(Guid))
 
#define IS_PLAYER_GUID(Guid)    (GUID_HIPART(Guid) == HIGHGUID_PLAYER && Guid != 0)
 
#define IS_UNIT_GUID(Guid)    (IS_CREATURE_OR_PET_GUID(Guid) || IS_PLAYER_GUID(Guid))
 
#define IS_ITEM_GUID(Guid)    (GUID_HIPART(Guid) == HIGHGUID_ITEM)
 
#define IS_GAMEOBJECT_GUID(Guid)    (GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT)
 
#define IS_CORPSE_GUID(Guid)    (GUID_HIPART(Guid) == HIGHGUID_CORPSE)
 
#define IS_MO_TRANSPORT(Guid)    (GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT)
 
#define MAKE_NEW_GUID(l, e, h)    uint64(uint64(l) | (uint64(e) << 24) | (uint64(h) << 48))
 
#define GUID_HIPART(x)    (uint32)((uint64(x) >> 48) & 0x0000FFFF)
 
#define _GUID_ENPART_2(x)   0
 
#define _GUID_ENPART_3(x)   (uint32)((uint64(x) >> 24) & UI64LIT(0x0000000000FFFFFF))
 
#define _GUID_LOPART_2(x)   (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF))
 
#define _GUID_LOPART_3(x)   (uint32)(uint64(x) & UI64LIT(0x0000000000FFFFFF))
 
#define GUID_ENPART(x)   (IsGuidHaveEnPart(x) ? _GUID_ENPART_3(x) : _GUID_ENPART_2(x))
 
#define GUID_LOPART(x)   (IsGuidHaveEnPart(x) ? _GUID_LOPART_3(x) : _GUID_LOPART_2(x))
 

Typedefs

typedef std::list< ObjectGuidGuidList
 

Enumerations

enum  TypeID {
  TYPEID_OBJECT = 0, TYPEID_ITEM = 1, TYPEID_CONTAINER = 2, TYPEID_UNIT = 3,
  TYPEID_PLAYER = 4, TYPEID_GAMEOBJECT = 5, TYPEID_DYNAMICOBJECT = 6, TYPEID_CORPSE = 7
}
 
enum  TypeMask {
  TYPEMASK_OBJECT = 0x0001, TYPEMASK_ITEM = 0x0002, TYPEMASK_CONTAINER = 0x0006, TYPEMASK_UNIT = 0x0008,
  TYPEMASK_PLAYER = 0x0010 | TYPEMASK_UNIT, TYPEMASK_GAMEOBJECT = 0x0020, TYPEMASK_DYNAMICOBJECT = 0x0040, TYPEMASK_CORPSE = 0x0080,
  TYPEMASK_SEER = TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT
}
 
enum  HighGuid {
  HIGHGUID_ITEM = 0x4000, HIGHGUID_CONTAINER = 0x4000, HIGHGUID_PLAYER = 0x0000, HIGHGUID_GAMEOBJECT = 0xF110,
  HIGHGUID_TRANSPORT = 0xF120, HIGHGUID_UNIT = 0xF130, HIGHGUID_PET = 0xF140, HIGHGUID_DYNAMICOBJECT = 0xF100,
  HIGHGUID_CORPSE = 0xF101, HIGHGUID_MO_TRANSPORT = 0x1FC0
}
 

Functions

bool IsGuidHaveEnPart (uint64 const &guid)
 
ByteBufferoperator<< (ByteBuffer &buf, ObjectGuid const &guid)
 
ByteBufferoperator>> (ByteBuffer &buf, ObjectGuid &guid)
 
ByteBufferoperator<< (ByteBuffer &buf, PackedGuid const &guid)
 
ByteBufferoperator>> (ByteBuffer &buf, PackedGuidReader const &guid)
 

Macro Definition Documentation

#define _GUID_ENPART_2 (   x)    0

Definition at line 85 of file ObjectGuid.h.

#define _GUID_ENPART_3 (   x)    (uint32)((uint64(x) >> 24) & UI64LIT(0x0000000000FFFFFF))

Definition at line 86 of file ObjectGuid.h.

#define _GUID_LOPART_2 (   x)    (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF))

Definition at line 87 of file ObjectGuid.h.

#define _GUID_LOPART_3 (   x)    (uint32)(uint64(x) & UI64LIT(0x0000000000FFFFFF))

Definition at line 88 of file ObjectGuid.h.

#define GUID_ENPART (   x)    (IsGuidHaveEnPart(x) ? _GUID_ENPART_3(x) : _GUID_ENPART_2(x))

Definition at line 109 of file ObjectGuid.h.

Referenced by Object::GetGUIDMid(), and WorldSession::HandlePageQuerySkippedOpcode().

#define GUID_LOPART (   x)    (IsGuidHaveEnPart(x) ? _GUID_LOPART_3(x) : _GUID_LOPART_2(x))

Definition at line 110 of file ObjectGuid.h.

Referenced by Group::_addMember(), Player::_LoadBoundInstances(), Group::_removeMember(), Group::_setAssistantFlag(), Group::_setLeader(), Group::_setMainAssistant(), Group::_setMainTank(), Group::_setMembersGroup(), ObjectAccessor::AddCorpse(), ArenaTeam::AddMember(), Guild::AddMember(), InstanceMap::AddPlayerToMap(), Map::AddToMap(), Item::AddToUpdateQueueOf(), Group::BindToInstance(), Player::BuyItemFromVendor(), Battleground::CastSpellOnTeam(), Guild::ChangeRank(), BattlegroundEY::CheckSomeoneLeftPoint(), GameObject::CleanupsBeforeDelete(), Player::ConvertInstancesToGroup(), Group::ConvertToRaid(), ArenaTeam::Create(), Group::Create(), Guild::Create(), Battleground::DelCreature(), Corpse::DeleteFromDB(), Player::DeleteFromDB(), ArenaTeam::DelMember(), Guild::DelMember(), Battleground::DelObject(), Group::Disband(), Spell::EffectOpenLock(), Battleground::EndBattleground(), Guild::FillPlayerData(), Player::GetArenaTeamIdFromDB(), Unit::GetCharm(), Unit::GetFirstMinion(), Unit::GetGuardianPet(), Object::GetGUIDLow(), Player::GetLevelFromDB(), ObjectMgr::GetPlayerAccountIdByGUID(), ObjectMgr::GetPlayerNameByGUID(), ObjectMgr::GetPlayerTeamByGUID(), Player::GetZoneIdFromDB(), WorldSession::HandleActivateTaxiFarOpcode(), WorldSession::HandleActivateTaxiOpcode(), WorldSession::HandleAddFriendOpcodeCallBack(), WorldSession::HandleAddIgnoreOpcodeCallBack(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItems(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBattlegroundHelloOpcode(), WorldSession::HandleBattlegroundJoinOpcode(), WorldSession::HandleBattlegroundPlayerPortOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleChangePlayerNameOpcode(), ChatHandler::HandleCharacterEraseCommand(), ChatHandler::HandleCharacterRenameCommand(), WorldSession::HandleCharDeleteOpcode(), WorldSession::HandleCreatureQueryOpcode(), WorldSession::HandleDeclinedPlayerNameOpcode(), WorldSession::HandleDelFriendOpcode(), WorldSession::HandleDelIgnoreOpcode(), ChatHandler::HandleDelObjectCommand(), WorldSession::HandleGameObjectQueryOpcode(), WorldSession::HandleGameObjectUseOpcode(), ChatHandler::HandleGetItemState(), ChatHandler::HandleGetValue(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleGossipSelectOptionOpcode(), ChatHandler::HandleGUIDCommand(), WorldSession::HandleGuildDemoteOpcode(), WorldSession::HandleGuildPromoteOpcode(), WorldSession::HandleGuildRemoveOpcode(), WorldSession::HandleGuildSaveEmblemOpcode(), WorldSession::HandleInspectArenaStatsOpcode(), WorldSession::HandleInspectOpcode(), ChatHandler::HandleListAurasCommand(), WorldSession::HandleListStabledPetsOpcode(), WorldSession::HandleOfferPetitionOpcode(), WorldSession::HandlePageQuerySkippedOpcode(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetAction(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandlePetitionDeclineOpcode(), WorldSession::HandlePetitionQueryOpcode(), WorldSession::HandlePetitionRenameOpcode(), WorldSession::HandlePetitionShowSignOpcode(), WorldSession::HandlePetitionSignOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), WorldSession::HandlePetUnlearnOpcode(), ChatHandler::HandlePInfoCommand(), WorldSession::HandlePlayerLogin(), WorldSession::HandlePlayerLoginOpcode(), WorldSession::HandleQuestComplete(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), WorldSession::HandleQuestgiverChooseRewardOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleQuestgiverQuestQueryOpcode(), WorldSession::HandleQuestgiverRequestRewardOpcode(), WorldSession::HandleQuestgiverStatusQueryOpcode(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleReportSpamOpcode(), ChatHandler::HandleResetSpellsCommand(), ChatHandler::HandleResetTalentsCommand(), WorldSession::HandleSellItemOpcode(), ChatHandler::HandleSendItemsCommand(), WorldSession::HandleSendMail(), ChatHandler::HandleSendMailCommand(), ChatHandler::HandleSendMoneyCommand(), ChatHandler::HandleSetValue(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeOpcode(), WorldSession::HandleTaxiQueryAvailableNodesOpcode(), WorldSession::HandleTrainerBuySpellOpcode(), Battleground::HandleTriggerBuff(), WorldSession::HandleTurnInPetitionOpcode(), WorldSession::HandleUnstablePet(), WorldSession::HandleWrapItemOpcode(), LoginQueryHolder::Initialize(), Channel::Invite(), Corpse::LoadCorpseFromDB(), Player::LoadFromDB(), Group::LoadGroupFromDB(), ArenaTeam::LoadMembersFromDB(), Guild::LoadMembersFromDB(), Guild::LoadPlayerStatsByGuid(), Player::LoadPositionFromDB(), Player::LoadValuesArrayFromDB(), Aura::PeriodicTick(), Battleground::PlayerRelogin(), Battleground::PlaySoundToTeam(), ObjectAccessor::RemoveCorpse(), Item::RemoveFromUpdateQueueOf(), GameObject::RemoveFromWorld(), Player::RemovePetitionsAndSigns(), BattlegroundQueue::RemovePlayer(), BattlegroundWS::RespawnFlagAfterDrop(), BattlegroundEY::RespawnFlagAfterDrop(), Battleground::RewardHonorToTeam(), Battleground::RewardReputationToTeam(), Player::SaveDataFieldToDB(), Pet::SavePetToDB(), Player::SavePositionInDB(), Corpse::SaveToDB(), Item::SaveToDB(), ArenaTeam::SaveToDB(), Player::SaveValuesArrayInDB(), WorldSession::SendListInventory(), WorldSession::SendNameQueryOpcodeFromDB(), Battleground::SendPacketToAll(), Battleground::SendPacketToTeam(), WorldSession::SendPetitionQueryOpcode(), WorldSession::SendPetitionShowList(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestGiverQuestList(), PlayerMenu::SendQuestGiverRequestItems(), PlayerMenu::SendQuestGiverStatus(), WorldSession::SendTaxiStatus(), Channel::SendToAll(), WorldSession::SendTrainerList(), ArenaTeam::SetCaptain(), Group::SetDifficulty(), Guild::SetLeader(), Guild::SetOFFNOTE(), Guild::SetPNOTE(), Group::UnbindInstance(), ArenaTeam::UpdateArenaPointsHelper(), Guild::UpdateLogoutTime(), and Battleground::YellToAll().

#define IS_CORPSE_GUID (   Guid)    (GUID_HIPART(Guid) == HIGHGUID_CORPSE)
#define IS_CREATURE_OR_PET_GUID (   Guid)    (IS_CREATURE_GUID(Guid) || IS_PET_GUID(Guid))

Definition at line 68 of file ObjectGuid.h.

#define IS_ITEM_GUID (   Guid)    (GUID_HIPART(Guid) == HIGHGUID_ITEM)
#define IS_MO_TRANSPORT (   Guid)    (GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT)

Definition at line 75 of file ObjectGuid.h.

Referenced by GameObject::Update().

#define IS_PET_GUID (   Guid)    (GUID_HIPART(Guid) == HIGHGUID_PET)
#define IS_UNIT_GUID (   Guid)    (IS_CREATURE_OR_PET_GUID(Guid) || IS_PLAYER_GUID(Guid))

Definition at line 70 of file ObjectGuid.h.

#define MAKE_NEW_GUID (   l,
  e,
 
)    uint64(uint64(l) | (uint64(e) << 24) | (uint64(h) << 48))

Definition at line 80 of file ObjectGuid.h.

Referenced by Object::_Create(), Player::_LoadGroup(), OPvPCapturePoint::AddCre(), OPvPCapturePoint::AddGO(), Guild::BroadcastPacket(), Guild::BroadcastPacketToRank(), SocialMgr::BroadcastToFriendListers(), Guild::BroadcastToGuild(), Guild::BroadcastToOfficers(), Battleground::BroadcastWorker(), Player::BuildEnumData(), GameEventMgr::ChangeEquipOrModel(), Unit::ClearComboPointHolders(), AccountMgr::DeleteAccount(), Player::DeleteFromDB(), PoolGroup< GameObject >::Despawn1Object(), PoolGroup< Creature >::Despawn1Object(), Guild::Disband(), Guild::DisplayGuildBankContentUpdate(), Guild::DisplayGuildBankLogs(), GameEventMgr::GameEventUnspawn(), ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(), ObjectMgr::GetPlayerGUIDByName(), Group::GroupLoot(), WorldSession::HandleAddFriendOpcodeCallBack(), WorldSession::HandleAddIgnoreOpcodeCallBack(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleChangePlayerNameOpcodeCallBack(), WorldSession::HandleGetMail(), WorldSession::HandleLootMasterGiveOpcode(), ChatHandler::HandleNpcDeleteCommand(), WorldSession::HandlePetitionDeclineOpcode(), WorldSession::HandlePetitionSignOpcode(), WorldSession::HandleTakeItem(), ChatHandler::HandleTargetObjectCommand(), ChatHandler::HandleWpModifyCommand(), ChatHandler::HandleWpShowCommand(), ArenaTeam::LoadArenaTeamFromDB(), Corpse::LoadCorpseFromDB(), Item::LoadFromDB(), Player::LoadFromDB(), Group::LoadGroupFromDB(), ObjectMgr::LoadGroups(), Guild::LoadGuildFromDB(), Group::LoadMemberFromDB(), ArenaTeam::LoadMembersFromDB(), Guild::LoadMembersFromDB(), Group::NeedBeforeGreed(), Player::RemovePetitionsAndSigns(), Guild::Roster(), Map::ScriptsProcess(), WorldSession::SendAuctionCancelledToBidderMail(), AuctionHouseMgr::SendAuctionExpiredMail(), WorldSession::SendAuctionOutbiddedMail(), AuctionHouseMgr::SendAuctionSalePendingMail(), AuctionHouseMgr::SendAuctionSuccessfulMail(), AuctionHouseMgr::SendAuctionWonMail(), WorldSession::SendNameQueryOpcodeFromDBCallBack(), WorldSession::SendPetitionQueryOpcode(), MailDraft::SendReturnToSender(), and GameEventMgr::UpdateEventNPCFlags().

#define MAX_TYPE_ID   8

Definition at line 36 of file ObjectGuid.h.

Typedef Documentation

typedef std::list<ObjectGuid> GuidList

Definition at line 281 of file ObjectGuid.h.

Enumeration Type Documentation

enum HighGuid
Enumerator
HIGHGUID_ITEM 
HIGHGUID_CONTAINER 
HIGHGUID_PLAYER 
HIGHGUID_GAMEOBJECT 
HIGHGUID_TRANSPORT 
HIGHGUID_UNIT 
HIGHGUID_PET 
HIGHGUID_DYNAMICOBJECT 
HIGHGUID_CORPSE 
HIGHGUID_MO_TRANSPORT 

Definition at line 51 of file ObjectGuid.h.

52 {
53  HIGHGUID_ITEM = 0x4000, // blizz 4000
54  HIGHGUID_CONTAINER = 0x4000, // blizz 4000
55  HIGHGUID_PLAYER = 0x0000, // blizz 0000
56  HIGHGUID_GAMEOBJECT = 0xF110, // blizz F110
57  HIGHGUID_TRANSPORT = 0xF120, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT)
58  HIGHGUID_UNIT = 0xF130, // blizz F130
59  HIGHGUID_PET = 0xF140, // blizz F140
60  HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100
61  HIGHGUID_CORPSE = 0xF101, // blizz F100
62  HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
63 };
enum TypeID
Enumerator
TYPEID_OBJECT 
TYPEID_ITEM 
TYPEID_CONTAINER 
TYPEID_UNIT 
TYPEID_PLAYER 
TYPEID_GAMEOBJECT 
TYPEID_DYNAMICOBJECT 
TYPEID_CORPSE 

Definition at line 24 of file ObjectGuid.h.

enum TypeMask
Enumerator
TYPEMASK_OBJECT 
TYPEMASK_ITEM 
TYPEMASK_CONTAINER 
TYPEMASK_UNIT 
TYPEMASK_PLAYER 
TYPEMASK_GAMEOBJECT 
TYPEMASK_DYNAMICOBJECT 
TYPEMASK_CORPSE 
TYPEMASK_SEER 

Definition at line 38 of file ObjectGuid.h.

39 {
40  TYPEMASK_OBJECT = 0x0001,
41  TYPEMASK_ITEM = 0x0002,
42  TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004
43  TYPEMASK_UNIT = 0x0008, // players also have it
44  TYPEMASK_PLAYER = 0x0010 | TYPEMASK_UNIT,
45  TYPEMASK_GAMEOBJECT = 0x0020,
46  TYPEMASK_DYNAMICOBJECT = 0x0040,
47  TYPEMASK_CORPSE = 0x0080,
49 };

Function Documentation

bool IsGuidHaveEnPart ( uint64 const &  guid)
inline

Definition at line 90 of file ObjectGuid.h.

References GUID_HIPART, HIGHGUID_CORPSE, HIGHGUID_DYNAMICOBJECT, HIGHGUID_GAMEOBJECT, HIGHGUID_ITEM, HIGHGUID_MO_TRANSPORT, HIGHGUID_PET, HIGHGUID_PLAYER, HIGHGUID_TRANSPORT, and HIGHGUID_UNIT.

91 {
92  switch (GUID_HIPART(guid))
93  {
94  case HIGHGUID_ITEM:
95  case HIGHGUID_PLAYER:
97  case HIGHGUID_CORPSE:
99  return false;
100  case HIGHGUID_GAMEOBJECT:
101  case HIGHGUID_TRANSPORT:
102  case HIGHGUID_UNIT:
103  case HIGHGUID_PET:
104  default:
105  return true;
106  }
107 }
#define GUID_HIPART(x)
Definition: ObjectGuid.h:82
ByteBuffer& operator<< ( ByteBuffer buf,
ObjectGuid const &  guid 
)

Definition at line 58 of file ObjectGuid.cpp.

References ObjectGuid::GetRawValue().

59 {
60  buf << uint64(guid.GetRawValue());
61  return buf;
62 }
ACE_UINT64 uint64
Definition: Define.h:70
ByteBuffer& operator<< ( ByteBuffer buf,
PackedGuid const &  guid 
)

Definition at line 70 of file ObjectGuid.cpp.

References ByteBuffer::append(), and PackedGuid::m_packedGuid.

71 {
72  buf.append(guid.m_packedGuid);
73  return buf;
74 }
void append(const std::string &str)
Definition: ByteBuffer.h:358
ByteBuffer& operator>> ( ByteBuffer buf,
ObjectGuid guid 
)

Definition at line 64 of file ObjectGuid.cpp.

References ByteBuffer::read(), and ObjectGuid::Set().

65 {
66  guid.Set(buf.read<uint64>());
67  return buf;
68 }
void Set(uint64 const &guid)
Definition: ObjectGuid.h:137
ACE_UINT64 uint64
Definition: Define.h:70
ByteBuffer& operator>> ( ByteBuffer buf,
PackedGuidReader const &  guid 
)

Definition at line 76 of file ObjectGuid.cpp.

References PackedGuidReader::m_guidPtr, ByteBuffer::readPackGUID(), and ObjectGuid::Set().

77 {
78  guid.m_guidPtr->Set(buf.readPackGUID());
79  return buf;
80 }
uint64 readPackGUID()
Definition: ByteBuffer.h:312