Skip to content

Commit 15fbb6f

Browse files
committed
Core/Entites: Updated GUID format
1 parent 13281fe commit 15fbb6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+360
-254
lines changed

sql/updates/world/2014_10_26_00_world.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ ALTER TABLE `game_event_npc_vendor` CHANGE `guid` `guid` BIGINT(20) UNSIGNED NOT
2323
ALTER TABLE `game_event_npcflag` CHANGE `guid` `guid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';
2424
ALTER TABLE `gameobject` CHANGE `guid` `guid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';
2525
ALTER TABLE `linked_respawn` CHANGE `guid` `guid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';
26-
ALTER TABLE `linked_respawn` CHANGE `guid` `guid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';
2726
ALTER TABLE `pool_creature` CHANGE `guid` `guid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';
2827
ALTER TABLE `pool_gameobject` CHANGE `guid` `guid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';
2928
ALTER TABLE `smart_scripts` CHANGE `entryorguid` `entryorguid` BIGINT(20) NOT NULL DEFAULT '0';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `linked_respawn` CHANGE `linkedGuid` `linkedGuid` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';

src/server/game/Accounts/AccountMgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId)
8181
{
8282
do
8383
{
84-
ObjectGuid guid(HighGuid::Player, (*result)[0].GetUInt64());
84+
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt64());
8585

8686
// Kick if player is online
8787
if (Player* p = ObjectAccessor::FindConnectedPlayer(guid))

src/server/game/Achievements/AchievementMgr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ void AchievementMgr<Guild>::LoadFromDB(PreparedQueryResult achievementResult, Pr
735735
ca.date = time_t(fields[1].GetUInt32());
736736
Tokenizer guids(fields[2].GetString(), ' ');
737737
for (uint32 i = 0; i < guids.size(); ++i)
738-
ca.guids.insert(ObjectGuid(HighGuid::Player, uint64(strtoull(guids[i], nullptr, 10))));
738+
ca.guids.insert(ObjectGuid::Create<HighGuid::Player>(uint64(strtoull(guids[i], nullptr, 10))));
739739

740740
ca.changed = false;
741741

@@ -773,7 +773,7 @@ void AchievementMgr<Guild>::LoadFromDB(PreparedQueryResult achievementResult, Pr
773773
CriteriaProgress& progress = m_criteriaProgress[id];
774774
progress.counter = counter;
775775
progress.date = date;
776-
progress.CompletedGUID = ObjectGuid(HighGuid::Player, guid);
776+
progress.CompletedGUID = ObjectGuid::Create<HighGuid::Player>(guid);
777777
progress.changed = false;
778778
} while (criteriaResult->NextRow());
779779
}

src/server/game/AuctionHouse/AuctionHouseMgr.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
9292
return;
9393

9494
uint32 bidderAccId = 0;
95-
ObjectGuid bidderGuid(HighGuid::Player, auction->bidder);
95+
ObjectGuid bidderGuid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
9696
Player* bidder = ObjectAccessor::FindConnectedPlayer(bidderGuid);
9797
// data for gm.log
9898
std::string bidderName;
@@ -115,7 +115,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
115115

116116
if (logGmTrade)
117117
{
118-
ObjectGuid ownerGuid = ObjectGuid(HighGuid::Player, auction->owner);
118+
ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
119119
std::string ownerName;
120120
if (!sObjectMgr->GetPlayerNameByGUID(ownerGuid, ownerName))
121121
ownerName = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN);
@@ -156,7 +156,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
156156

157157
void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans)
158158
{
159-
ObjectGuid owner_guid(HighGuid::Player, auction->owner);
159+
ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
160160
Player* owner = ObjectAccessor::FindConnectedPlayer(owner_guid);
161161
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
162162
// owner exist (online or offline)
@@ -168,7 +168,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans
168168
//call this method to send mail to auction owner, when auction is successful, it does not clear ram
169169
void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans)
170170
{
171-
ObjectGuid owner_guid(HighGuid::Player, auction->owner);
171+
ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
172172
Player* owner = ObjectAccessor::FindConnectedPlayer(owner_guid);
173173
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
174174
// owner exist
@@ -199,7 +199,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
199199
if (!pItem)
200200
return;
201201

202-
ObjectGuid owner_guid(HighGuid::Player, auction->owner);
202+
ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
203203
Player* owner = ObjectAccessor::FindConnectedPlayer(owner_guid);
204204
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
205205
// owner exist
@@ -222,7 +222,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
222222
//this function sends mail to old bidder
223223
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans)
224224
{
225-
ObjectGuid oldBidder_guid(HighGuid::Player, auction->bidder);
225+
ObjectGuid oldBidder_guid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
226226
Player* oldBidder = ObjectAccessor::FindConnectedPlayer(oldBidder_guid);
227227

228228
uint32 oldBidder_accId = 0;
@@ -244,7 +244,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
244244
//this function sends mail, when auction is cancelled to old bidder
245245
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans, Item* item)
246246
{
247-
ObjectGuid bidder_guid = ObjectGuid(HighGuid::Player, auction->bidder);
247+
ObjectGuid bidder_guid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
248248
Player* bidder = ObjectAccessor::FindConnectedPlayer(bidder_guid);
249249

250250
uint32 bidder_accId = 0;
@@ -761,7 +761,7 @@ std::string AuctionEntry::BuildAuctionMailBody(uint64 lowGuid, uint32 bid, uint3
761761
{
762762
std::ostringstream strm;
763763
strm.width(16);
764-
strm << std::right << std::hex << ObjectGuid(HighGuid::Player, lowGuid); // HIGHGUID_PLAYER always present, even for empty guids
764+
strm << std::right << std::hex << ObjectGuid::Create<HighGuid::Player>(lowGuid); // HIGHGUID_PLAYER always present, even for empty guids
765765
strm << std::dec << ':' << bid << ':' << buyout;
766766
strm << ':' << deposit << ':' << cut;
767767
return strm.str();

src/server/game/Battlegrounds/ArenaTeam.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result)
193193

194194
TeamId = fields[0].GetUInt32();
195195
TeamName = fields[1].GetString();
196-
CaptainGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt64());
196+
CaptainGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt64());
197197
Type = fields[3].GetUInt8();
198198
BackgroundColor = fields[4].GetUInt32();
199199
EmblemStyle = fields[5].GetUInt8();
@@ -232,7 +232,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
232232
break;
233233

234234
ArenaTeamMember newMember;
235-
newMember.Guid = ObjectGuid(HighGuid::Player, fields[1].GetUInt64());
235+
newMember.Guid = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt64());
236236
newMember.WeekGames = fields[2].GetUInt16();
237237
newMember.WeekWins = fields[3].GetUInt16();
238238
newMember.SeasonGames = fields[4].GetUInt16();

src/server/game/Battlegrounds/Battleground.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class Battleground
241241
/* Battleground */
242242
// Get methods:
243243
std::string const& GetName() const { return m_Name; }
244-
ObjectGuid GetGUID() { return m_Guid; }
244+
uint64 GetGUID() { return m_Guid; }
245245
BattlegroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
246246
BattlegroundBracketId GetBracketId() const { return m_BracketId; }
247247
uint32 GetInstanceID() const { return m_InstanceID; }
@@ -267,7 +267,7 @@ class Battleground
267267
bool IsRandom() const { return m_IsRandom; }
268268

269269
// Set methods:
270-
void SetGuid(ObjectGuid newGuid) { m_Guid = newGuid; }
270+
void SetGuid(uint64 newGuid) { m_Guid = newGuid; }
271271
void SetName(std::string const& name) { m_Name = name; }
272272
void SetTypeID(BattlegroundTypeId TypeID) { m_TypeID = TypeID; }
273273
void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
@@ -539,7 +539,7 @@ class Battleground
539539
bool m_PrematureCountDown;
540540
uint32 m_PrematureCountDownTimer;
541541
std::string m_Name;
542-
ObjectGuid m_Guid;
542+
uint64 m_Guid;
543543

544544
/* Pre- and post-update hooks */
545545

src/server/game/Battlegrounds/BattlegroundMgr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
154154
ObjectGuid bgGuid;
155155

156156
if (bg)
157-
bgGuid = bg->GetGUID();
157+
;//bgGuid = bg->GetGUID();
158158
else
159159
StatusID = STATUS_NONE;
160160

@@ -358,7 +358,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
358358
void BattlegroundMgr::BuildStatusFailedPacket(WorldPacket* data, Battleground* bg, Player* player, uint8 QueueSlot, GroupJoinBattlegroundResult result)
359359
{
360360
ObjectGuid guidBytes1 = player->GetGUID(); // player who caused the error
361-
ObjectGuid guidBytes2 = bg->GetGUID();
361+
ObjectGuid guidBytes2;// = bg->GetGUID();
362362
ObjectGuid unkGuid3;
363363

364364
data->Initialize(SMSG_BATTLEFIELD_STATUS_FAILED);
@@ -652,7 +652,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original
652652
bg->SetRandomTypeID(bgTypeId);
653653
bg->SetRated(isRated);
654654
bg->SetRandom(isRandom);
655-
bg->SetGuid(ObjectGuid(HighGuid::Null, uint64(bgTypeId) | UI64LIT(0x1F10000000000000)));
655+
bg->SetGuid(uint64(bgTypeId) | UI64LIT(0x1F10000000000000));
656656

657657
// Set up correct min/max player counts for scoreboards
658658
if (bg->isArena())
@@ -755,7 +755,7 @@ bool BattlegroundMgr::CreateBattleground(BattlegroundTemplate const* bgTemplate)
755755
bg->SetStartMaxDist(bgTemplate->MaxStartDistSq);
756756
bg->SetLevelRange(bgTemplate->MinLevel, bgTemplate->MaxLevel);
757757
bg->SetScriptId(bgTemplate->ScriptId);
758-
bg->SetGuid(ObjectGuid(HighGuid::Null, uint64(bgTemplate->Id) | UI64LIT(0x1F10000000000000)));
758+
bg->SetGuid(uint64(bgTemplate->Id) | UI64LIT(0x1F10000000000000));
759759

760760
AddBattleground(bg);
761761

src/server/game/Calendar/CalendarMgr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void CalendarMgr::LoadFromDB()
5858
Field* fields = result->Fetch();
5959

6060
uint64 eventId = fields[0].GetUInt64();
61-
ObjectGuid creatorGUID = ObjectGuid(HighGuid::Player, fields[1].GetUInt64());
61+
ObjectGuid creatorGUID = ObjectGuid::Create<HighGuid::Player>(fields[1].GetUInt64());
6262
std::string title = fields[2].GetString();
6363
std::string description = fields[3].GetString();
6464
CalendarEventType type = CalendarEventType(fields[4].GetUInt8());
@@ -91,8 +91,8 @@ void CalendarMgr::LoadFromDB()
9191

9292
uint64 inviteId = fields[0].GetUInt64();
9393
uint64 eventId = fields[1].GetUInt64();
94-
ObjectGuid invitee = ObjectGuid(HighGuid::Player, fields[2].GetUInt64());
95-
ObjectGuid senderGUID = ObjectGuid(HighGuid::Player, fields[3].GetUInt64());
94+
ObjectGuid invitee = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt64());
95+
ObjectGuid senderGUID = ObjectGuid::Create<HighGuid::Player>(fields[3].GetUInt64());
9696
CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
9797
uint32 statusTime = fields[5].GetUInt32();
9898
CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());

src/server/game/Chat/Chat.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(ObjectGuid::Lo
950950

951951
Player* pl = m_session->GetPlayer();
952952

953-
GameObject* obj = pl->GetMap()->GetGameObject(ObjectGuid(HighGuid::GameObject, entry, lowguid));
953+
GameObject* obj = pl->GetMap()->GetGameObject(ObjectGuid::Create<HighGuid::GameObject>(pl->GetMapId(), entry, lowguid));
954954

955955
if (!obj && sObjectMgr->GetGOData(lowguid)) // guid is DB guid of object
956956
{
@@ -1100,7 +1100,7 @@ ObjectGuid ChatHandler::extractGuidFromLink(char* text)
11001100
ObjectGuid::LowType lowguid = strtoull(idS, nullptr, 10);
11011101

11021102
if (CreatureData const* data = sObjectMgr->GetCreatureData(lowguid))
1103-
return ObjectGuid(HighGuid::Creature, data->id, lowguid);
1103+
return ObjectGuid::Create<HighGuid::Creature>(data->mapid, data->id, lowguid);
11041104
else
11051105
return ObjectGuid::Empty;
11061106
}
@@ -1109,7 +1109,7 @@ ObjectGuid ChatHandler::extractGuidFromLink(char* text)
11091109
ObjectGuid::LowType lowguid = strtoull(idS, nullptr, 10);
11101110

11111111
if (GameObjectData const* data = sObjectMgr->GetGOData(lowguid))
1112-
return ObjectGuid(HighGuid::GameObject, data->id, lowguid);
1112+
return ObjectGuid::Create<HighGuid::GameObject>(data->mapid, data->id, lowguid);
11131113
else
11141114
return ObjectGuid::Empty;
11151115
}

0 commit comments

Comments
 (0)