aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers')
-rw-r--r--src/server/game/Handlers/ArenaTeamHandler.cpp8
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp50
-rw-r--r--src/server/game/Handlers/BattleGroundHandler.cpp22
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp91
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp122
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp4
-rw-r--r--src/server/game/Handlers/CombatHandler.cpp4
-rw-r--r--src/server/game/Handlers/DuelHandler.cpp6
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp28
-rw-r--r--src/server/game/Handlers/GuildHandler.cpp43
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp68
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp34
-rw-r--r--src/server/game/Handlers/LootHandler.cpp46
-rw-r--r--src/server/game/Handlers/MailHandler.cpp64
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp99
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp57
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp75
-rw-r--r--src/server/game/Handlers/PetHandler.cpp72
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp112
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp21
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp52
-rw-r--r--src/server/game/Handlers/ReferAFriendHandler.cpp11
-rw-r--r--src/server/game/Handlers/SkillHandler.cpp4
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp32
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp18
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp6
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp12
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp60
28 files changed, 588 insertions, 633 deletions
diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp
index 87febd8f1e7..b77a3fd41cc 100644
--- a/src/server/game/Handlers/ArenaTeamHandler.cpp
+++ b/src/server/game/Handlers/ArenaTeamHandler.cpp
@@ -33,9 +33,9 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "MSG_INSPECT_ARENA_TEAMS");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
+ TC_LOG_DEBUG("network", "Inspect Arena stats %s", guid.ToString().c_str());
Player* player = ObjectAccessor::FindPlayer(guid);
@@ -319,7 +319,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
arenaTeam->DelMember(member->Guid, true);
// Broadcast event
- arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
+ arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, ObjectGuid::Empty, 3, name, arenaTeam->GetName(), _player->GetName());
}
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
@@ -362,7 +362,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
arenaTeam->SetCaptain(member->Guid);
// Broadcast event
- arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName(), name, arenaTeam->GetName());
+ arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ObjectGuid::Empty, 3, _player->GetName(), name, arenaTeam->GetName());
}
void WorldSession::SendArenaTeamCommandResult(uint32 teamAction, const std::string& team, const std::string& player, uint32 errorId)
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 86fa0429cce..d1d7b35cb43 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -33,13 +33,13 @@
//void called when player click on auctioneer npc
void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
{
- uint64 guid; //NPC guid
+ ObjectGuid guid; //NPC guid
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %s) not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -51,7 +51,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
}
//this void causes that auction window is opened
-void WorldSession::SendAuctionHello(uint64 guid, Creature* unit)
+void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit)
{
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ))
{
@@ -83,7 +83,7 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin
}
//this function sends notification, if bidder is online
-void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
+void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
{
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
data << uint32(location);
@@ -113,13 +113,12 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
//this void creates new auction and adds auction to some auctionhouse
void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
{
- uint64 auctioneer;
+ ObjectGuid auctioneer;
uint32 itemsCount, etime, bid, buyout;
recvData >> auctioneer;
recvData >> itemsCount;
- uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
- memset(itemGUIDs, 0, sizeof(itemGUIDs));
+ ObjectGuid itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
uint32 count[MAX_AUCTION_ITEMS];
memset(count, 0, sizeof(count));
@@ -160,14 +159,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) not found or you can't interact with him.", auctioneer.ToString().c_str());
return;
}
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction());
if (!auctionHouseEntry)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) has wrong faction.", auctioneer.ToString().c_str());
return;
}
@@ -263,7 +262,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
AH->auctioneer = 23442; ///@TODO - HARDCODED DB GUID, BAD BAD BAD
else
- AH->auctioneer = GUID_LOPART(auctioneer);
+ AH->auctioneer = auctioneer.GetCounter();
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
if (itemsCount == 1 && item->GetCount() == count[0])
@@ -287,7 +286,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
+ _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(item);
auctionHouse->AddAuction(AH);
@@ -334,7 +334,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
+ _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(newItem);
auctionHouse->AddAuction(AH);
@@ -385,7 +386,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID");
- uint64 auctioneer;
+ ObjectGuid auctioneer;
uint32 auctionId;
uint32 price;
recvData >> auctioneer;
@@ -397,7 +398,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - %s not found or you can't interact with him.", auctioneer.ToString().c_str());
return;
}
@@ -418,8 +419,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
}
// impossible have online own another character (use this for speedup check in case online owner)
- Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
- if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
+ ObjectGuid ownerGuid(HIGHGUID_PLAYER, auction->owner);
+ Player* auction_owner = ObjectAccessor::FindPlayer(ownerGuid);
+ if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(ownerGuid) == player->GetSession()->GetAccountId())
{
//you cannot bid your another character auction:
SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
@@ -512,7 +514,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
- uint64 auctioneer;
+ ObjectGuid auctioneer;
uint32 auctionId;
recvData >> auctioneer;
recvData >> auctionId;
@@ -521,7 +523,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - %s not found or you can't interact with him.", auctioneer.ToString().c_str());
return;
}
@@ -589,7 +591,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
- uint64 guid; //NPC guid
+ ObjectGuid guid; //NPC guid
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
@@ -605,7 +607,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - %s not found or you can't interact with him.", guid.ToString().c_str());
recvData.rfinish();
return;
}
@@ -647,7 +649,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
uint32 listfrom;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
recvData >> listfrom; // not used in fact (this list not have page control in client)
@@ -655,7 +657,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -686,7 +688,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
std::string searchedname;
uint8 levelmin, levelmax, usable;
uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
recvData >> listfrom; // start, used for page control listing by 50 elements
@@ -710,7 +712,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 95e4dd3b5e0..ccea6f64a8d 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -37,9 +37,9 @@
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from %s", guid.ToString().c_str());
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
@@ -63,7 +63,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
SendBattleGroundList(guid, bgTypeId);
}
-void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId)
+void WorldSession::SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId)
{
WorldPacket data;
sBattlegroundMgr->BuildBattlegroundListPacket(&data, guid, _player, bgTypeId, 0);
@@ -72,7 +72,7 @@ void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId
void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 bgTypeId_;
uint32 instanceId;
uint8 joinAsGroup;
@@ -98,7 +98,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from %s", guid.ToString().c_str());
// can do this, since it's battleground, not arena
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0);
@@ -257,14 +257,14 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa
Player* allianceFlagCarrier = NULL;
Player* hordeFlagCarrier = NULL;
- if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
+ if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
{
allianceFlagCarrier = ObjectAccessor::FindPlayer(guid);
if (allianceFlagCarrier)
++flagCarrierCount;
}
- if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
+ if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_HORDE))
{
hordeFlagCarrier = ObjectAccessor::FindPlayer(guid);
if (hordeFlagCarrier)
@@ -336,7 +336,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recvData)
}
WorldPacket data;
- sBattlegroundMgr->BuildBattlegroundListPacket(&data, 0, _player, BattlegroundTypeId(bgTypeId), fromWhere);
+ sBattlegroundMgr->BuildBattlegroundListPacket(&data, ObjectGuid::Empty, _player, BattlegroundTypeId(bgTypeId), fromWhere);
SendPacket(&data);
}
@@ -485,7 +485,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team);
if (at)
{
- TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating);
+ TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %s by opponents rating: %u, because he has left queue!", _player->GetGUID().ToString().c_str(), ginfo.OpponentsTeamRating);
at->MemberLost(_player, ginfo.OpponentsMatchmakerRating);
at->SaveToDB();
}
@@ -587,7 +587,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
- uint64 guid; // arena Battlemaster guid
+ ObjectGuid guid; // arena Battlemaster guid
uint8 arenaslot; // 2v2, 3v3 or 5v5
uint8 asGroup; // asGroup
uint8 isRated; // isRated
@@ -753,7 +753,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
void WorldSession::HandleReportPvPAFK(WorldPacket& recvData)
{
- uint64 playerGuid;
+ ObjectGuid playerGuid;
recvData >> playerGuid;
Player* reportedPlayer = ObjectAccessor::FindPlayer(playerGuid);
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index dd654fb3ad0..d805b0fdc21 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -50,7 +50,7 @@ Copied events should probably have a new owner
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
time_t currTime = time(NULL);
@@ -69,12 +69,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()))
{
data << uint8(calendarEvent->IsGuildEvent());
- data.appendPackGUID(calendarEvent->GetCreatorGUID());
+ data << calendarEvent->GetCreatorGUID().WriteAsPacked();
}
else
{
data << uint8(0);
- data.appendPackGUID((*itr)->GetSenderGUID());
+ data << (*itr)->GetSenderGUID().WriteAsPacked();
}
}
@@ -90,7 +90,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
data.AppendPackedTime(calendarEvent->GetEventTime());
data << uint32(calendarEvent->GetFlags());
data << int32(calendarEvent->GetDungeonId());
- data.appendPackGUID(calendarEvent->GetCreatorGUID());
+ data << calendarEvent->GetCreatorGUID().WriteAsPacked();
}
data << uint32(currTime); // server time
@@ -218,7 +218,7 @@ void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
std::string title;
std::string description;
@@ -253,7 +253,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
if (calendarEvent->IsGuildAnnouncement())
{
// 946684800 is 01/01/2000 00:00:00 - default response time
- CalendarInvite invite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
+ CalendarInvite invite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
// WARNING: By passing pointer to a local variable, the underlying method(s) must NOT perform any kind
// of storage of the pointer as it will lead to memory corruption
sCalendarMgr->AddInvite(calendarEvent, &invite);
@@ -264,11 +264,10 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
const uint32 MaxPlayerInvites = 100;
uint32 inviteCount;
- uint64 invitee[MaxPlayerInvites];
+ ObjectGuid invitee[MaxPlayerInvites];
uint8 status[MaxPlayerInvites];
uint8 rank[MaxPlayerInvites];
- memset(invitee, 0, sizeof(invitee));
memset(status, 0, sizeof(status));
memset(rank, 0, sizeof(rank));
@@ -278,7 +277,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
{
- recvData.readPackGUID(invitee[i]);
+ recvData >> invitee[i].ReadAsPacked();
recvData >> status[i] >> rank[i];
}
}
@@ -309,7 +308,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
time_t oldEventTime;
uint64 eventId;
@@ -365,7 +364,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
recvData >> eventId;
@@ -376,7 +375,7 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
uint32 eventTime;
@@ -420,7 +419,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_INVITE");
- uint64 playerGuid = _player->GetGUID();
+ ObjectGuid playerGuid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
@@ -428,7 +427,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
bool isPreInvite;
bool isGuildEvent;
- uint64 inviteeGuid = 0;
+ ObjectGuid inviteeGuid;
uint32 inviteeTeam = 0;
uint32 inviteeGuildId = 0;
@@ -449,7 +448,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
- inviteeGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ inviteeGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
inviteeTeam = Player::TeamForRace(fields[1].GetUInt8());
inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid);
}
@@ -511,7 +510,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
bool tentative;
@@ -537,7 +536,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
uint32 status;
@@ -574,19 +573,18 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
- uint64 invitee;
+ ObjectGuid guid = _player->GetGUID();
+ ObjectGuid invitee;
uint64 eventId;
uint64 ownerInviteId; // isn't it sender's inviteId?
uint64 inviteId;
- recvData.readPackGUID(invitee);
+ recvData >> invitee.ReadAsPacked();
recvData >> inviteId >> ownerInviteId >> eventId;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE ["
- UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId ["
- UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])",
- guid, eventId, ownerInviteId, invitee, inviteId);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [%s] EventId [" UI64FMTD
+ "], ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" UI64FMTD "])",
+ guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
{
@@ -604,18 +602,18 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
- uint64 invitee;
+ ObjectGuid guid = _player->GetGUID();
+ ObjectGuid invitee;
uint64 eventId;
uint64 inviteId;
uint64 ownerInviteId; // isn't it sender's inviteId?
uint8 status;
- recvData.readPackGUID(invitee);
+ recvData >> invitee.ReadAsPacked();
recvData >> eventId >> inviteId >> ownerInviteId >> status;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId ["
- UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
- UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [%s] EventId ["
+ UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: ["
+ UI64FMTD "], status %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, status);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
{
@@ -638,18 +636,18 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
- uint64 invitee;
+ ObjectGuid guid = _player->GetGUID();
+ ObjectGuid invitee;
uint64 eventId;
uint64 inviteId;
uint64 ownerInviteId; // isn't it sender's inviteId?
uint8 rank;
- recvData.readPackGUID(invitee);
- recvData >> eventId >> inviteId >> ownerInviteId >> rank;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId ["
- UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
- UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank);
+ recvData >> invitee.ReadAsPacked();
+ recvData >> eventId >> inviteId >> ownerInviteId >> rank;
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [%s] EventId ["
+ UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: ["
+ UI64FMTD "], rank %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, rank);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
{
@@ -668,24 +666,23 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint64 eventId;
- uint64 complainGUID;
+ ObjectGuid complainGUID;
recvData >> eventId >> complainGUID;
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId ["
- UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [%s] EventId ["
+ UI64FMTD "] guid [%s]", guid.ToString().c_str(), eventId, complainGUID.ToString().c_str());
// what to do with complains?
}
void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/)
{
- uint64 guid = _player->GetGUID();
+ ObjectGuid guid = _player->GetGUID();
uint32 pending = sCalendarMgr->GetPlayerNumPending(guid);
- TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD
- "] Pending: %u", guid, pending);
+ TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [%s] Pending: %u", guid.ToString().c_str(), pending);
WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
data << uint32(pending);
@@ -736,9 +733,9 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
if (!save)
return;
- uint64 guid = _player->GetGUID();
- TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD
- "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty());
+ ObjectGuid guid = _player->GetGUID();
+ TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [%s] Map: %u, Difficulty %u",
+ guid.ToString().c_str(), save->GetMapId(), save->GetDifficulty());
time_t currTime = time(NULL);
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index b2507877111..be8c4916e7c 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -52,11 +52,11 @@ class LoginQueryHolder : public SQLQueryHolder
{
private:
uint32 m_accountId;
- uint64 m_guid;
+ ObjectGuid m_guid;
public:
- LoginQueryHolder(uint32 accountId, uint64 guid)
+ LoginQueryHolder(uint32 accountId, ObjectGuid guid)
: m_accountId(accountId), m_guid(guid) { }
- uint64 GetGuid() const { return m_guid; }
+ ObjectGuid GetGuid() const { return m_guid; }
uint32 GetAccountId() const { return m_accountId; }
bool Initialize();
};
@@ -66,7 +66,7 @@ bool LoginQueryHolder::Initialize()
SetSize(MAX_PLAYER_LOGIN_QUERY);
bool res = true;
- uint32 lowGuid = GUID_LOPART(m_guid);
+ uint32 lowGuid = m_guid.GetCounter();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER);
stmt->setUInt32(0, lowGuid);
@@ -220,16 +220,16 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
{
do
{
- uint32 guidlow = (*result)[0].GetUInt32();
- TC_LOG_INFO("network", "Loading char guid %u from account %u.", guidlow, GetAccountId());
+ ObjectGuid guid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
+ TC_LOG_INFO("network", "Loading %s from account %u.", guid.ToString().c_str(), GetAccountId());
if (Player::BuildEnumData(result, &data))
{
// Do not allow banned characters to log in
if (!(*result)[20].GetUInt32())
- _legitCharacters.insert(guidlow);
+ _legitCharacters.insert(guid);
- if (!sWorld->HasCharacterNameData(guidlow)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet.
- sWorld->AddCharacterNameData(guidlow, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8());
+ if (!sWorld->HasCharacterNameData(guid)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet.
+ sWorld->AddCharacterNameData(guid, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8());
++num;
}
}
@@ -682,7 +682,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
std::string IP_str = GetRemoteAddress();
TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
sScriptMgr->OnPlayerCreate(&newChar);
- sWorld->AddCharacterNameData(newChar.GetGUIDLow(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel());
+ sWorld->AddCharacterNameData(newChar.GetGUID(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel());
newChar.CleanupsBeforeDelete();
delete createInfo;
@@ -694,7 +694,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// Initiating
uint32 initAccountId = GetAccountId();
@@ -731,7 +731,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DATA_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
@@ -749,7 +749,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
}
std::string IP_str = GetRemoteAddress();
- TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level);
+ TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, %s, Level: %u", accountId, IP_str.c_str(), name.c_str(), guid.ToString().c_str(), level);
// To prevent hook failure, place hook before removing reference from DB
sScriptMgr->OnPlayerDelete(guid, initAccountId); // To prevent race conditioning, but as it also makes sense, we hand the accountId over for successful delete.
@@ -758,8 +758,8 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
if (sLog->ShouldLog("entities.player.dump", LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
std::string dump;
- if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
- sLog->outCharDump(dump.c_str(), accountId, GUID_LOPART(guid), name.c_str());
+ if (PlayerDumpWriter().GetDump(guid.GetCounter(), dump))
+ sLog->outCharDump(dump.c_str(), accountId, guid.GetCounter(), name.c_str());
}
sCalendarMgr->RemoveAllPlayerEventsAndInvites(guid);
@@ -780,15 +780,15 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
}
m_playerLoading = true;
- uint64 playerGuid = 0;
+ ObjectGuid playerGuid;
TC_LOG_DEBUG("network", "WORLD: Recvd Player Logon Message");
recvData >> playerGuid;
- if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid)))
+ if (!IsLegitCharacterForAccount(playerGuid))
{
- TC_LOG_ERROR("network", "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
+ TC_LOG_ERROR("network", "Account (%u) can't login with that character (%s).", GetAccountId(), playerGuid.ToString().c_str());
KickPlayer();
return;
}
@@ -801,19 +801,19 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
return;
}
- _charLoginCallback = CharacterDatabase.DelayQueryHolder((SQLQueryHolder*)holder);
+ _charLoginCallback = CharacterDatabase.DelayQueryHolder(holder);
}
void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
{
- uint64 playerGuid = holder->GetGuid();
+ ObjectGuid playerGuid = holder->GetGuid();
Player* pCurrChar = new Player(this);
// for send server info and strings (config)
ChatHandler chH = ChatHandler(pCurrChar->GetSession());
// "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
- if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
+ if (!pCurrChar->LoadFromDB(playerGuid, holder))
{
SetPlayer(NULL);
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
@@ -1127,7 +1127,7 @@ void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData)
void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
std::string newName;
recvData >> guid;
@@ -1168,7 +1168,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_FREE_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
stmt->setUInt32(1, GetAccountId());
stmt->setUInt16(2, AT_LOGIN_RENAME);
stmt->setUInt16(3, AT_LOGIN_RENAME);
@@ -1192,7 +1192,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
uint32 guidLow = fields[0].GetUInt32();
std::string oldName = fields[1].GetString();
- uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
+ ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidLow);
// Update name and at_login flag in the db
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME);
@@ -1210,7 +1210,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
CharacterDatabase.Execute(stmt);
- TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
+ TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (%s) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guid.ToString().c_str(), newName.c_str());
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(RESPONSE_SUCCESS);
@@ -1218,12 +1218,12 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
data << newName;
SendPacket(&data);
- sWorld->UpdateCharacterNameData(guidLow, newName);
+ sWorld->UpdateCharacterNameData(guid, newName);
}
void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
@@ -1299,11 +1299,11 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_DECLINED_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
for (uint8 i = 0; i < 5; i++)
stmt->setString(i+1, declinedname.name[i]);
@@ -1414,14 +1414,14 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData)
void WorldSession::HandleCharCustomize(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
std::string newName;
recvData >> guid;
- if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ if (!IsLegitCharacterForAccount(guid))
{
- TC_LOG_ERROR("network", "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
- GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "Account %u, IP: %s tried to customise %s, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str());
recvData.rfinish();
KickPlayer();
return;
@@ -1434,7 +1434,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
// TODO: Make async with callback
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -1485,7 +1485,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
}
// character with this name already exist
- if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newName))
+ if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newName))
{
if (newguid != guid)
{
@@ -1497,13 +1497,13 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
result = CharacterDatabase.Query(stmt);
if (result)
{
std::string oldname = result->Fetch()[0].GetString();
- TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
+ TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s), Character[%s] (%s) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), guid.ToString().c_str(), newName.c_str());
}
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
@@ -1512,17 +1512,17 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
stmt->setString(0, newName);
stmt->setUInt16(1, uint16(AT_LOGIN_CUSTOMIZE));
- stmt->setUInt32(2, GUID_LOPART(guid));
+ stmt->setUInt32(2, guid.GetCounter());
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, guid.GetCounter());
CharacterDatabase.Execute(stmt);
- sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newName, gender);
+ sWorld->UpdateCharacterNameData(guid, newName, gender);
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1+8+(newName.size()+1)+6);
data << uint8(RESPONSE_SUCCESS);
@@ -1564,11 +1564,11 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- uint64 itemGuid;
- recvData.readPackGUID(itemGuid);
+ ObjectGuid itemGuid;
+ recvData >> itemGuid.ReadAsPacked();
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
- if (itemGuid == 1)
+ if (itemGuid.GetRawValue() == 1)
{
// ignored slots saved as bit mask because we have no free special values for Items[i]
eqSet.IgnoreMask |= 1 << i;
@@ -1583,7 +1583,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
if (item && item->GetGUID() != itemGuid) // cheating check 2
return;
- eqSet.Items[i] = GUID_LOPART(itemGuid);
+ eqSet.Items[i] = itemGuid.GetCounter();
}
_player->SetEquipmentSet(index, eqSet);
@@ -1605,16 +1605,16 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- uint64 itemGuid;
- recvData.readPackGUID(itemGuid);
+ ObjectGuid itemGuid;
+ recvData >> itemGuid.ReadAsPacked();
uint8 srcbag, srcslot;
recvData >> srcbag >> srcslot;
- TC_LOG_DEBUG("entities.player.items", "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
+ TC_LOG_DEBUG("entities.player.items", "%s: srcbag %u, srcslot %u", itemGuid.ToString().c_str(), srcbag, srcslot);
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
- if (itemGuid == 1)
+ if (itemGuid.GetRawValue() == 1)
continue;
// Only equip weapons in combat
@@ -1657,15 +1657,15 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
std::string newname;
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
recvData >> guid;
- if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ if (!IsLegitCharacterForAccount(guid))
{
- TC_LOG_ERROR("network", "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
- GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "Account %u, IP: %s tried to factionchange character %s, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str());
recvData.rfinish();
KickPlayer();
return;
@@ -1674,10 +1674,10 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
recvData >> newname;
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
- uint32 lowGuid = GUID_LOPART(guid);
+ uint32 lowGuid = guid.GetCounter();
// get the players old (at this moment current) race
- CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGuid);
+ CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid);
if (!nameData)
{
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
@@ -1764,7 +1764,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
}
// character with this name already exist
- if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newname))
+ if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newname))
{
if (newguid != guid)
{
@@ -1793,7 +1793,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
- sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
+ sWorld->UpdateCharacterNameData(guid, newname, gender, race);
if (oldRace != race)
{
@@ -1932,7 +1932,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32()))
- guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true);
+ guild->DeleteMember(guid, false, false, true);
Player::LeaveAllArenaTeams(guid);
}
@@ -1963,7 +1963,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt->setFloat (3, -8867.68f);
stmt->setFloat (4, 673.373f);
stmt->setFloat (5, 97.9034f);
- Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, lowGuid);
+ Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, guid);
}
else
{
@@ -1972,7 +1972,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt->setFloat (3, 1633.33f);
stmt->setFloat (4, -4439.11f);
stmt->setFloat (5, 15.7588f);
- Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, lowGuid);
+ Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, guid);
}
trans->Append(stmt);
@@ -2003,13 +2003,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
stmt->setUInt32(0, (team == TEAM_ALLIANCE ? item_alliance : item_horde));
stmt->setUInt32(1, (team == TEAM_ALLIANCE ? item_horde : item_alliance));
- stmt->setUInt32(2, guid);
+ stmt->setUInt32(2, lowGuid);
trans->Append(stmt);
}
// Delete all current quests
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
- stmt->setUInt32(0, GUID_LOPART(guid));
+ stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
// Quest conversion
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index eccf7a6fd38..df43db28b73 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -547,7 +547,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
}
uint32 text_emote, emoteNum;
- uint64 guid;
+ ObjectGuid guid;
recvData >> text_emote;
recvData >> emoteNum;
@@ -598,7 +598,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData)
{
- uint64 iguid;
+ ObjectGuid iguid;
uint8 unk;
//TC_LOG_DEBUG("network", "WORLD: Received CMSG_CHAT_IGNORED");
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index e07f1384880..152d6994949 100644
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
@@ -30,10 +30,10 @@
void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.ToString().c_str());
Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid);
diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp
index b07df587fbf..f93fc7e8ce0 100644
--- a/src/server/game/Handlers/DuelHandler.cpp
+++ b/src/server/game/Handlers/DuelHandler.cpp
@@ -26,7 +26,7 @@
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
Player* player;
Player* plTarget;
@@ -35,7 +35,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
if (!GetPlayer()->duel) // ignore accept from duel-sender
return;
- player = GetPlayer();
+ player = GetPlayer();
plTarget = player->duel->opponent;
if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0)
@@ -56,7 +56,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_CANCELLED");
- uint64 guid;
+ ObjectGuid guid;
recvPacket >> guid;
// no duel requested
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 8f5df3e02e5..a7ce1f8533a 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -275,7 +275,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE_GUID");
- uint64 guid;
+ ObjectGuid guid;
std::string reason;
recvData >> guid;
recvData >> reason;
@@ -350,7 +350,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
if (!grp)
return;
- if (uint64 guid = grp->GetMemberGUID(membername))
+ if (ObjectGuid guid = grp->GetMemberGUID(membername))
{
Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID());
return;
@@ -369,7 +369,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_SET_LEADER");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Player* player = ObjectAccessor::FindPlayer(guid);
@@ -414,7 +414,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LOOT_METHOD");
uint32 lootMethod;
- uint64 lootMaster;
+ ObjectGuid lootMaster;
uint32 lootThreshold;
recvData >> lootMethod >> lootMaster >> lootThreshold;
@@ -445,7 +445,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
void WorldSession::HandleLootRoll(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 itemSlot;
uint8 rollType;
recvData >> guid; // guid of the item rolled
@@ -546,10 +546,10 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
if (group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- if (IS_PLAYER_GUID(guid))
+ if (guid.IsPlayer())
{
Player* target = ObjectAccessor::FindPlayer(guid);
@@ -599,7 +599,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
- uint64 senderGuid = GetPlayer()->GetGUID();
+ ObjectGuid senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
@@ -607,7 +607,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
return;
Player* movedPlayer = sObjectAccessor->FindPlayerByName(name);
- uint64 guid;
+ ObjectGuid guid;
if (movedPlayer)
{
guid = movedPlayer->GetGUID();
@@ -632,7 +632,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
if (!group->IsLeader(GetPlayer()->GetGUID()))
return;
- uint64 guid;
+ ObjectGuid guid;
bool apply;
recvData >> guid;
recvData >> apply;
@@ -648,13 +648,13 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
if (!group)
return;
- uint64 senderGuid = GetPlayer()->GetGUID();
+ ObjectGuid senderGuid = GetPlayer()->GetGUID();
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
return;
uint8 assignment;
bool apply;
- uint64 guid;
+ ObjectGuid guid;
recvData >> assignment >> apply;
recvData >> guid;
@@ -910,7 +910,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
- uint64 Guid;
+ ObjectGuid Guid;
recvData >> Guid;
Player* player = HashMapHolder<Player>::Find(Guid);
@@ -918,7 +918,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
- data.appendPackGUID(Guid);
+ data << Guid.WriteAsPacked();
data << uint32(GROUP_UPDATE_FLAG_STATUS);
data << uint16(MEMBER_STATUS_OFFLINE);
SendPacket(&data);
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index b652192bfd7..ac226f71e96 100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -269,15 +269,14 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
{
- uint64 vendorGuid;
+ ObjectGuid vendorGuid;
recvPacket >> vendorGuid;
EmblemInfo emblemInfo;
emblemInfo.ReadPacket(recvPacket);
- TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD
- "] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
- , GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle()
+ TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [%s] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
+ , GetPlayerInfo().c_str(), vendorGuid.ToString().c_str(), emblemInfo.GetStyle()
, emblemInfo.GetColor(), emblemInfo.GetBorderStyle()
, emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor());
@@ -323,12 +322,12 @@ void WorldSession::HandleGuildPermissions(WorldPacket& /* recvData */)
// Called when clicking on Guild bank gameobject
void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
bool sendAllSlots;
recvData >> guid >> sendAllSlots;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u"
- , GetPlayerInfo().c_str(), guid, sendAllSlots);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: [%s] AllSlots: %u"
+ , GetPlayerInfo().c_str(), guid.ToString().c_str(), sendAllSlots);
Guild* const guild = GetPlayer()->GetGuild();
if (!guild)
@@ -343,14 +342,14 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
// Called when opening guild bank tab only (first one)
void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint8 tabId;
bool full;
recvData >> guid >> tabId >> full;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u"
- , GetPlayerInfo().c_str(), guid, tabId, full);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: %s, TabId: %u, ShowTabs: %u"
+ , GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, full);
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -359,12 +358,12 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData)
void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 money;
recvData >> guid >> money;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
- GetPlayerInfo().c_str(), guid, money);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: [%s], money: %u",
+ GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (money && GetPlayer()->HasEnoughMoney(money))
@@ -374,12 +373,12 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 money;
recvData >> guid >> money;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
- GetPlayerInfo().c_str(), guid, money);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: [%s], money: %u",
+ GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (Guild* guild = GetPlayer()->GetGuild())
@@ -390,7 +389,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData)
{
TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str());
- uint64 GoGuid;
+ ObjectGuid GoGuid;
recvData >> GoGuid;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
@@ -469,12 +468,12 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData)
void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint8 tabId;
recvData >> guid >> tabId;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: [%s[, TabId: %u", GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId);
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
@@ -484,14 +483,14 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData)
void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint8 tabId;
std::string name, icon;
recvData >> guid >> tabId >> name >> icon;
- TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s"
- , GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str());
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: [%s], TabId: %u, Name: %s, Icon: %s"
+ , GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, name.c_str(), icon.c_str());
if (!name.empty() && !icon.empty())
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 60966ace011..3172c7a3184 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -87,13 +87,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -105,7 +105,7 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
{
- uint64 itemguid;
+ ObjectGuid itemguid;
uint8 dstslot;
recvData >> itemguid >> dstslot;
@@ -151,13 +151,13 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData)
if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -497,7 +497,7 @@ void WorldSession::HandleReadItem(WorldPacket& recvData)
void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM");
- uint64 vendorguid, itemguid;
+ ObjectGuid vendorguid, itemguid;
uint32 count;
recvData >> vendorguid >> itemguid >> count;
@@ -508,7 +508,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - %s not found or you can not interact with him.", vendorguid.ToString().c_str());
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0);
return;
}
@@ -609,7 +609,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
void WorldSession::HandleBuybackItem(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM");
- uint64 vendorguid;
+ ObjectGuid vendorguid;
uint32 slot;
recvData >> vendorguid >> slot;
@@ -617,8 +617,8 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
- _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
+ TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", vendorguid.ToString().c_str());
+ _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty, 0);
return;
}
@@ -657,7 +657,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
- uint64 vendorguid, bagguid;
+ ObjectGuid vendorguid, bagguid;
uint32 item, slot, count;
uint8 bagslot;
@@ -699,7 +699,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM");
- uint64 vendorguid;
+ ObjectGuid vendorguid;
uint32 item, slot, count;
uint8 unk1;
@@ -716,7 +716,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
@@ -728,15 +728,15 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
SendListInventory(guid);
}
-void WorldSession::SendListInventory(uint64 vendorGuid)
+void WorldSession::SendListInventory(ObjectGuid vendorGuid)
{
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY");
Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR);
if (!vendor)
{
- TC_LOG_DEBUG("network", "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid)));
- _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0);
+ TC_LOG_DEBUG("network", "WORLD: SendListInventory - %s not found or you can not interact with him.", vendorGuid.ToString().c_str());
+ _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, ObjectGuid::Empty, 0);
return;
}
@@ -879,12 +879,12 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT");
- uint64 guid;
+ ObjectGuid guid;
recvPacket >> guid;
if (!CanUseBank(guid))
{
- TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -934,7 +934,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
if (!CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -971,7 +971,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
if (!CanUseBank())
{
- TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
return;
}
@@ -1035,17 +1035,17 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
_player->RemoveAmmo();
}
-void WorldSession::SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId)
+void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
{
WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4)); // last check 2.0.10
- data.appendPackGUID(target);
- data.appendPackGUID(caster);
+ data << target.WriteAsPacked();
+ data << caster.WriteAsPacked();
data << uint32(itemId);
data << uint32(enchantId);
GetPlayer()->SendMessageToSet(&data, true);
}
-void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration)
+void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
{
// last check 2.0.10
WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8+4+4+8));
@@ -1124,7 +1124,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
return;
}
- if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
+ if (!item->GetGuidValue(ITEM_FIELD_GIFTCREATOR).IsEmpty()) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
{
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, NULL);
return;
@@ -1158,7 +1158,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT);
- stmt->setUInt32(0, GUID_LOPART(item->GetOwnerGUID()));
+ stmt->setUInt32(0, item->GetOwnerGUID().GetCounter());
stmt->setUInt32(1, item->GetGUIDLow());
stmt->setUInt32(2, item->GetEntry());
stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS));
@@ -1175,7 +1175,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
case 17307: item->SetEntry(17308); break;
case 21830: item->SetEntry(21831); break;
}
- item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
+ item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED);
item->SetState(ITEM_CHANGED, _player);
@@ -1195,8 +1195,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS");
- uint64 item_guid;
- uint64 gem_guids[MAX_GEM_SOCKETS];
+ ObjectGuid item_guid;
+ ObjectGuid gem_guids[MAX_GEM_SOCKETS];
recvData >> item_guid;
if (!item_guid)
@@ -1417,7 +1417,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid; // item guid
Item* item = _player->GetItemByGuid(guid);
@@ -1433,7 +1433,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
void WorldSession::HandleItemRefund(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid; // item guid
Item* item = _player->GetItemByGuid(guid);
@@ -1457,10 +1457,10 @@ void WorldSession::HandleItemRefund(WorldPacket &recvData)
*/
void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
{
- uint64 itemGuid;
+ ObjectGuid itemGuid;
recvData >> itemGuid;
- TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
+ TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY %s", itemGuid.ToString().c_str());
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size
@@ -1478,7 +1478,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
SendPacket(&data);
}
-bool WorldSession::CanUseBank(uint64 bankerGUID) const
+bool WorldSession::CanUseBank(ObjectGuid bankerGUID) const
{
// bankerGUID parameter is optional, set to 0 by default.
if (!bankerGUID)
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index a984c033872..65b4ef66c04 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -87,8 +87,8 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/)
{
Group* group = GetPlayer()->GetGroup();
- uint64 guid = GetPlayer()->GetGUID();
- uint64 gguid = group ? group->GetGUID() : guid;
+ ObjectGuid guid = GetPlayer()->GetGUID();
+ ObjectGuid gguid = group ? group->GetGUID() : guid;
TC_LOG_DEBUG("lfg", "CMSG_LFG_LEAVE %s in group: %u",
GetPlayerInfo().c_str(), group ? 1 : 0);
@@ -114,7 +114,7 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
{
uint8 roles;
recvData >> roles; // Player Group Roles
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
Group* group = GetPlayer()->GetGroup();
if (!group)
{
@@ -122,9 +122,9 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
GetPlayerInfo().c_str());
return;
}
- uint64 gguid = group->GetGUID();
+ ObjectGuid gguid = group->GetGUID();
TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u",
- GUID_LOPART(gguid), GetPlayerInfo().c_str(), roles);
+ gguid.GetCounter(), GetPlayerInfo().c_str(), roles);
sLFGMgr->UpdateRoleCheck(gguid, guid, roles);
}
@@ -144,7 +144,7 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData)
bool agree; // Agree to kick player
recvData >> agree;
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_BOOT_VOTE %s agree: %u",
GetPlayerInfo().c_str(), agree ? 1 : 0);
sLFGMgr->UpdateBoot(guid, agree);
@@ -162,7 +162,7 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData)
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
TC_LOG_DEBUG("lfg", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s",
GetPlayerInfo().c_str());
@@ -233,7 +233,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
TC_LOG_DEBUG("lfg", "CMSG_LFG_PARTY_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str());
Group* group = GetPlayer()->GetGroup();
@@ -248,7 +248,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
if (!plrg)
continue;
- uint64 pguid = plrg->GetGUID();
+ ObjectGuid pguid = plrg->GetGUID();
if (pguid == guid)
continue;
@@ -287,7 +287,7 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
{
TC_LOG_DEBUG("lfg", "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str());
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
if (GetPlayer()->GetGroup())
@@ -385,10 +385,10 @@ void WorldSession::SendLfgUpdateParty(const lfg::LfgUpdateData& updateData)
SendPacket(&data);
}
-void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
+void WorldSession::SendLfgRoleChosen(ObjectGuid guid, uint8 roles)
{
TC_LOG_DEBUG("lfg", "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u",
- GetPlayerInfo().c_str(), GUID_LOPART(guid), roles);
+ GetPlayerInfo().c_str(), guid.GetCounter(), roles);
WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4);
data << uint64(guid); // Guid
@@ -419,7 +419,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
if (!roleCheck.roles.empty())
{
// Leader info MUST be sent 1st :S
- uint64 guid = roleCheck.leader;
+ ObjectGuid guid = roleCheck.leader;
uint8 roles = roleCheck.roles.find(guid)->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
@@ -520,7 +520,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat
void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
{
- uint64 guid = GetPlayer()->GetGUID();
+ ObjectGuid guid = GetPlayer()->GetGUID();
lfg::LfgAnswer playerVote = boot.votes.find(guid)->second;
uint8 votesNum = 0;
uint8 agreeNum = 0;
@@ -538,7 +538,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
"didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - "
"needed: %u - reason %s",
GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING),
- uint8(playerVote == lfg::LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum,
+ uint8(playerVote == lfg::LFG_ANSWER_AGREE), boot.victim.GetCounter(), votesNum, agreeNum,
secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());
data << uint8(boot.inProgress); // Vote in progress
@@ -555,8 +555,8 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal)
{
- uint64 guid = GetPlayer()->GetGUID();
- uint64 gguid = proposal.players.find(guid)->second.group;
+ ObjectGuid guid = GetPlayer()->GetGUID();
+ ObjectGuid gguid = proposal.players.find(guid)->second.group;
bool silent = !proposal.isNew && gguid == proposal.group;
uint32 dungeonEntry = proposal.dungeonId;
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 8bc9c5dc659..64c01075341 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -35,13 +35,13 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
Player* player = GetPlayer();
- uint64 lguid = player->GetLootGUID();
+ ObjectGuid lguid = player->GetLootGUID();
Loot* loot = NULL;
uint8 lootSlot = 0;
recvData >> lootSlot;
- if (IS_GAMEOBJECT_GUID(lguid))
+ if (lguid.IsGameObject())
{
GameObject* go = player->GetMap()->GetGameObject(lguid);
@@ -54,7 +54,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
loot = &go->loot;
}
- else if (IS_ITEM_GUID(lguid))
+ else if (lguid.IsItem())
{
Item* pItem = player->GetItemByGuid(lguid);
@@ -66,7 +66,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
loot = &pItem->loot;
}
- else if (IS_CORPSE_GUID(lguid))
+ else if (lguid.IsCorpse())
{
Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid);
if (!bones)
@@ -94,7 +94,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
player->StoreLootItem(lootSlot, loot);
// If player is removing the last LootItem, delete the empty container.
- if (loot->isLooted() && IS_ITEM_GUID(lguid))
+ if (loot->isLooted() && lguid.IsItem())
player->GetSession()->DoLootRelease(lguid);
}
@@ -103,14 +103,14 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT_MONEY");
Player* player = GetPlayer();
- uint64 guid = player->GetLootGUID();
+ ObjectGuid guid = player->GetLootGUID();
if (!guid)
return;
Loot* loot = NULL;
bool shareMoney = true;
- switch (GUID_HIPART(guid))
+ switch (guid.GetHigh())
{
case HIGHGUID_GAMEOBJECT:
{
@@ -211,7 +211,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
loot->DeleteLootMoneyFromContainerItemDB();
// Delete container if empty
- if (loot->isLooted() && IS_ITEM_GUID(guid))
+ if (loot->isLooted() && guid.IsItem())
player->GetSession()->DoLootRelease(guid);
}
}
@@ -220,11 +220,11 @@ void WorldSession::HandleLootOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// Check possible cheat
- if (!GetPlayer()->IsAlive() || !IS_CRE_OR_VEH_GUID(guid))
+ if (!GetPlayer()->IsAlive() || !guid.IsCreatureOrVehicle())
return;
GetPlayer()->SendLoot(guid, LOOT_CORPSE);
@@ -240,20 +240,20 @@ void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData)
// cheaters can modify lguid to prevent correct apply loot release code and re-loot
// use internal stored guid
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- if (uint64 lguid = GetPlayer()->GetLootGUID())
+ if (ObjectGuid lguid = GetPlayer()->GetLootGUID())
if (lguid == guid)
DoLootRelease(lguid);
}
-void WorldSession::DoLootRelease(uint64 lguid)
+void WorldSession::DoLootRelease(ObjectGuid lguid)
{
Player *player = GetPlayer();
Loot *loot;
- player->SetLootGUID(0);
+ player->SetLootGUID(ObjectGuid::Empty);
player->SendLootRelease(lguid);
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
@@ -261,7 +261,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
if (!player->IsInWorld())
return;
- if (IS_GAMEOBJECT_GUID(lguid))
+ if (lguid.IsGameObject())
{
GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
@@ -298,10 +298,10 @@ void WorldSession::DoLootRelease(uint64 lguid)
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
- loot->roundRobinPlayer = 0;
+ loot->roundRobinPlayer.Clear();
}
}
- else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
+ else if (lguid.IsCorpse()) // ONLY remove insignia at BG
{
Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
@@ -315,7 +315,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
}
}
- else if (IS_ITEM_GUID(lguid))
+ else if (lguid.IsItem())
{
Item* pItem = player->GetItemByGuid(lguid);
if (!pItem)
@@ -369,7 +369,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
// if the round robin player release, reset it.
if (player->GetGUID() == loot->roundRobinPlayer)
{
- loot->roundRobinPlayer = 0;
+ loot->roundRobinPlayer.Clear();
if (Group* group = player->GetGroup())
{
@@ -389,7 +389,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
{
uint8 slotid;
- uint64 lootguid, target_playerguid;
+ ObjectGuid lootguid, target_playerguid;
recvData >> lootguid >> slotid >> target_playerguid;
@@ -399,7 +399,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
return;
}
- Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER));
+ Player* target = ObjectAccessor::FindPlayer(target_playerguid);
if (!target)
{
_player->SendLootError(lootguid, LOOT_ERROR_PLAYER_NOT_FOUND);
@@ -423,7 +423,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
Loot* loot = NULL;
- if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
+ if (GetPlayer()->GetLootGUID().IsCreatureOrVehicle())
{
Creature* creature = GetPlayer()->GetMap()->GetCreature(lootguid);
if (!creature)
@@ -431,7 +431,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
loot = &creature->loot;
}
- else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
+ else if (GetPlayer()->GetLootGUID().IsGameObject())
{
GameObject* pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
if (!pGO)
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 1270f4e6419..6ea3ae69786 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -29,7 +29,7 @@
#include "Item.h"
#include "AccountMgr.h"
-bool WorldSession::CanOpenMailBox(uint64 guid)
+bool WorldSession::CanOpenMailBox(ObjectGuid guid)
{
if (guid == _player->GetGUID())
{
@@ -39,12 +39,12 @@ bool WorldSession::CanOpenMailBox(uint64 guid)
return false;
}
}
- else if (IS_GAMEOBJECT_GUID(guid))
+ else if (guid.IsGameObject())
{
if (!_player->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
return false;
}
- else if (IS_CRE_OR_VEH_OR_PET_GUID(guid))
+ else if (guid.IsAnyTypeCreature())
{
if (!_player->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_MAILBOX))
return false;
@@ -57,14 +57,14 @@ bool WorldSession::CanOpenMailBox(uint64 guid)
void WorldSession::HandleSendMail(WorldPacket& recvData)
{
- uint64 mailbox, unk3;
+ ObjectGuid mailbox, unk3;
std::string receiverName, subject, body;
- uint32 unk1, unk2, money, COD;
+ uint32 stationery, package, money, COD;
uint8 unk4;
uint8 items_count;
recvData >> mailbox >> receiverName >> subject >> body
- >> unk1 // stationery?
- >> unk2 // 0x00000000
+ >> stationery // stationery?
+ >> package // 0x00000000
>> items_count; // attached items count
if (items_count > MAX_MAIL_ITEMS) // client limit
@@ -74,7 +74,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
return;
}
- uint64 itemGUIDs[MAX_MAIL_ITEMS];
+ ObjectGuid itemGUIDs[MAX_MAIL_ITEMS];
for (uint8 i = 0; i < items_count; ++i)
{
@@ -102,7 +102,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
return;
}
- uint64 receiverGuid = 0;
+ ObjectGuid receiverGuid;
if (normalizePlayerName(receiverName))
receiverGuid = sObjectMgr->GetPlayerGUIDByName(receiverName);
@@ -111,15 +111,15 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: not existed!) with subject %s "
"and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
player->GetGUIDLow(), receiverName.c_str(), subject.c_str(), body.c_str(),
- items_count, money, COD, unk1, unk2);
+ items_count, money, COD, stationery, package);
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
return;
}
- TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s "
+ TC_LOG_INFO("network", "Player %u is sending mail to %s (%s) with subject %s and body %s "
"includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
- player->GetGUIDLow(), receiverName.c_str(), GUID_LOPART(receiverGuid), subject.c_str(),
- body.c_str(), items_count, money, COD, unk1, unk2);
+ player->GetGUIDLow(), receiverName.c_str(), receiverGuid.ToString().c_str(), subject.c_str(),
+ body.c_str(), items_count, money, COD, stationery, package);
if (player->GetGUID() == receiverGuid)
{
@@ -163,7 +163,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
receiverTeam = sObjectMgr->GetPlayerTeamByGUID(receiverGuid);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT);
- stmt->setUInt32(0, GUID_LOPART(receiverGuid));
+ stmt->setUInt32(0, receiverGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -173,7 +173,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_LEVEL);
- stmt->setUInt32(0, GUID_LOPART(receiverGuid));
+ stmt->setUInt32(0, receiverGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
if (result)
@@ -293,9 +293,9 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (log)
{
sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail item: %s (Entry: %u Count: %u) "
- "to player: %s (GUID: %u) (Account: %u)", GetPlayerName().c_str(), GetGuidLow(), GetAccountId(),
+ "to: %s (%s) (Account: %u)", GetPlayerName().c_str(), GetGuidLow(), GetAccountId(),
item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(),
- receiverName.c_str(), GUID_LOPART(receiverGuid), receiverAccountId);
+ receiverName.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
}
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
@@ -314,8 +314,8 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
if (log && money > 0)
{
- sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail money: %u to player: %s (GUID: %u) (Account: %u)",
- GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), money, receiverName.c_str(), GUID_LOPART(receiverGuid), receiverAccountId);
+ sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail money: %u to: %s (%s) (Account: %u)",
+ GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), money, receiverName.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
}
}
@@ -330,7 +330,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
draft
.AddMoney(money)
.AddCOD(COD)
- .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
+ .SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
@@ -339,7 +339,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
//called when mail is read
void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
recvData >> mailId;
@@ -362,7 +362,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
//called when client deletes mail
void WorldSession::HandleMailDelete(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
recvData >> mailId;
@@ -390,7 +390,7 @@ void WorldSession::HandleMailDelete(WorldPacket& recvData)
void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
recvData >> mailId;
@@ -454,7 +454,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
//called when player takes item attached in mail
void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
uint32 itemId;
recvData >> mailbox;
@@ -499,7 +499,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail
{
- uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER);
+ ObjectGuid sender_guid(HIGHGUID_PLAYER, m->sender);
Player* receiver = ObjectAccessor::FindPlayer(sender_guid);
uint32 sender_accId = 0;
@@ -557,7 +557,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
recvData >> mailId;
@@ -596,7 +596,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
//called when player lists his received mails
void WorldSession::HandleGetMailList(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
recvData >> mailbox;
if (!CanOpenMailBox(mailbox))
@@ -649,7 +649,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
switch ((*itr)->messageType)
{
case MAIL_NORMAL: // sender guid
- data << uint64(MAKE_NEW_GUID((*itr)->sender, 0, HIGHGUID_PLAYER));
+ data << ObjectGuid(HIGHGUID_PLAYER, (*itr)->sender);
break;
case MAIL_CREATURE:
case MAIL_GAMEOBJECT:
@@ -716,7 +716,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
//used when player copies mail body to his inventory
void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
{
- uint64 mailbox;
+ ObjectGuid mailbox;
uint32 mailId;
recvData >> mailbox;
@@ -756,7 +756,9 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
else
bodyItem->SetText(m->body);
- bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender);
+ if (m->messageType == MAIL_NORMAL)
+ bodyItem->SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HIGHGUID_PLAYER, m->sender));
+
bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK);
TC_LOG_INFO("network", "HandleMailCreateTextItem mailid=%u", mailId);
@@ -810,7 +812,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recvData*/)
if (sentSenders.count(m->sender))
continue;
- data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid
+ data << uint64(m->messageType == MAIL_NORMAL ? ObjectGuid(HIGHGUID_PLAYER, m->sender) : ObjectGuid::Empty); // player guid
data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries
data << uint32(m->messageType);
data << uint32(m->stationery);
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index b3d81e8f9e1..7f6b6aeb9cc 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -92,7 +92,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
uint32 gossipListId;
uint32 menuId;
- uint64 guid;
+ ObjectGuid guid;
std::string code = "";
recvData >> guid >> menuId >> gossipListId;
@@ -112,27 +112,27 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
Creature* unit = NULL;
GameObject* go = NULL;
- if (IS_CRE_OR_VEH_GUID(guid))
+ if (guid.IsCreatureOrVehicle())
{
unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
}
- else if (IS_GAMEOBJECT_GUID(guid))
+ else if (guid.IsGameObject())
{
go = _player->GetMap()->GetGameObject(guid);
if (!go)
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found.", guid.ToString().c_str());
return;
}
}
else
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported %s.", guid.ToString().c_str());
return;
}
@@ -376,7 +376,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
- if (uint64 lguid = GetPlayer()->GetLootGUID())
+ if (ObjectGuid lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);
bool instantLogout = (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat()) ||
@@ -509,7 +509,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData)
void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
_player->SetSelection(guid);
@@ -562,19 +562,18 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
if (!GetPlayer())
return;
- uint64 friendGuid;
+ ObjectGuid friendGuid;
uint32 friendAccountId;
uint32 team;
FriendsResult friendResult;
friendResult = FRIEND_NOT_FOUND;
- friendGuid = 0;
if (result)
{
Field* fields = result->Fetch();
- friendGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ friendGuid = ObjectGuid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32());
team = Player::TeamForRace(fields[1].GetUInt8());
friendAccountId = fields[2].GetUInt32();
@@ -586,7 +585,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
friendResult = FRIEND_SELF;
else if (GetPlayer()->GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_ADD_FRIEND))
friendResult = FRIEND_ENEMY;
- else if (GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
+ else if (GetPlayer()->GetSocial()->HasFriend(friendGuid.GetCounter()))
friendResult = FRIEND_ALREADY;
else
{
@@ -595,33 +594,33 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
friendResult = FRIEND_ADDED_ONLINE;
else
friendResult = FRIEND_ADDED_OFFLINE;
- if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
+ if (!GetPlayer()->GetSocial()->AddToSocialList(friendGuid.GetCounter(), false))
{
friendResult = FRIEND_LIST_FULL;
TC_LOG_DEBUG("network", "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str());
}
}
- GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote);
+ GetPlayer()->GetSocial()->SetFriendNote(friendGuid.GetCounter(), friendNote);
}
}
}
- sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, GUID_LOPART(friendGuid), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData)
{
- uint64 FriendGUID;
+ ObjectGuid FriendGUID;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_FRIEND");
recvData >> FriendGUID;
- _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), false);
+ _player->GetSocial()->RemoveFromSocialList(FriendGUID.GetCounter(), false);
- sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, FriendGUID.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
}
@@ -652,49 +651,48 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result)
if (!GetPlayer())
return;
- uint64 IgnoreGuid;
+ ObjectGuid IgnoreGuid;
FriendsResult ignoreResult;
ignoreResult = FRIEND_IGNORE_NOT_FOUND;
- IgnoreGuid = 0;
if (result)
{
- IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ IgnoreGuid = ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
if (IgnoreGuid)
{
if (IgnoreGuid == GetPlayer()->GetGUID()) //not add yourself
ignoreResult = FRIEND_IGNORE_SELF;
- else if (GetPlayer()->GetSocial()->HasIgnore(GUID_LOPART(IgnoreGuid)))
+ else if (GetPlayer()->GetSocial()->HasIgnore(IgnoreGuid.GetCounter()))
ignoreResult = FRIEND_IGNORE_ALREADY;
else
{
ignoreResult = FRIEND_IGNORE_ADDED;
// ignore list full
- if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(IgnoreGuid), true))
+ if (!GetPlayer()->GetSocial()->AddToSocialList(IgnoreGuid.GetCounter(), true))
ignoreResult = FRIEND_IGNORE_FULL;
}
}
}
- sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, GUID_LOPART(IgnoreGuid), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, IgnoreGuid.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData)
{
- uint64 IgnoreGUID;
+ ObjectGuid IgnoreGUID;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_IGNORE");
recvData >> IgnoreGUID;
- _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), true);
+ _player->GetSocial()->RemoveFromSocialList(IgnoreGUID.GetCounter(), true);
- sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, IgnoreGUID.GetCounter(), false);
TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
}
@@ -702,10 +700,10 @@ void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData)
void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_SET_CONTACT_NOTES");
- uint64 guid;
+ ObjectGuid guid;
std::string note;
recvData >> guid >> note;
- _player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note);
+ _player->GetSocial()->SetFriendNote(guid.GetCounter(), note);
}
void WorldSession::HandleBugOpcode(WorldPacket& recvData)
@@ -737,7 +735,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
if (_player->IsAlive())
@@ -774,7 +772,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE");
- uint64 guid;
+ ObjectGuid guid;
uint8 status;
recvData >> guid;
recvData >> status;
@@ -1026,7 +1024,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recvData)
dest.resize(destSize);
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
- data << uint64(_player ? _player->GetGUID() : 0); // player guid
+ data << uint64(_player ? _player->GetGUID() : ObjectGuid::Empty);
data << uint32(type); // type (0-7)
data << uint32(adata->Time); // unix time
data << uint32(size); // decompressed length
@@ -1062,8 +1060,8 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
/* WorldSession::Update(getMSTime());*/
TC_LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_TIME_SKIPPED");
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
recvData.read_skip<uint32>();
/*
uint64 guid;
@@ -1167,7 +1165,7 @@ void WorldSession::HandlePlayedTime(WorldPacket& recvData)
void WorldSession::HandleInspectOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_INSPECT");
@@ -1175,7 +1173,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData)
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid);
+ TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from %s", guid.ToString().c_str());
return;
}
@@ -1205,14 +1203,14 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData)
void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- TC_LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid);
+ TC_LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from %s", guid.ToString().c_str());
return;
}
@@ -1332,7 +1330,7 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN");
uint8 spam_type; // 0 - mail, 1 - chat
- uint64 spammer_guid;
+ ObjectGuid spammer_guid;
uint32 unk1 = 0;
uint32 unk2 = 0;
uint32 unk3 = 0;
@@ -1364,7 +1362,8 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData)
data << uint8(0);
SendPacket(&data);
- TC_LOG_DEBUG("network", "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str());
+ TC_LOG_DEBUG("network", "REPORT SPAM: type %u, %s, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s",
+ spam_type, spammer_guid.ToString().c_str(), unk1, unk2, unk3, unk4, description.c_str());
}
void WorldSession::HandleRealmSplitOpcode(WorldPacket& recvData)
@@ -1396,11 +1395,11 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
if (apply)
{
- TC_LOG_DEBUG("network", "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
+ TC_LOG_DEBUG("network", "Added FarSight %s to player %u", _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str(), _player->GetGUIDLow());
if (WorldObject* target = _player->GetViewpoint())
_player->SetSeer(target);
else
- TC_LOG_ERROR("network", "Player %s (GUID: %u) requests non-existing seer " UI64FMTD, _player->GetName().c_str(), GUID_LOPART(_player->GetGUID()), _player->GetUInt64Value(PLAYER_FARSIGHT));
+ TC_LOG_ERROR("network", "Player %s (%s) requests non-existing seer %s", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str());
}
else
{
@@ -1604,8 +1603,8 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData)
// fly mode on/off
TC_LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK");
- uint64 guid; // guid - unused
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // guid - unused
+ recvData >> guid.ReadAsPacked();
recvData.read_skip<uint32>(); // unk
@@ -1640,10 +1639,10 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData)
void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData)
{
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
- TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [" UI64FMTD "] Inspected Player [" UI64FMTD "]", _player->GetGUID(), guid);
+ TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [%s] Inspected Player [%s]", _player->GetGUID().ToString().c_str(), guid.ToString().c_str());
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
return;
@@ -1688,7 +1687,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData)
Battleground* bg = _player->GetBattleground();
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -1711,7 +1710,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData)
Battleground* bg = _player->GetBattleground();
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -1772,7 +1771,7 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY");
- uint64 guid;
+ ObjectGuid guid;
uint32 spellId;
float elevation, speed;
float curX, curY, curZ;
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 64d0ae36e7a..68d89310a08 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -71,7 +71,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if (GetPlayer()->IsInWorld())
{
- TC_LOG_ERROR("network", "Player %s (GUID: %u) is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId());
+ TC_LOG_ERROR("network", "%s %s is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str(), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId());
oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
@@ -198,14 +198,12 @@ void WorldSession::HandleMoveWorldportAckOpcode()
void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK");
- uint64 guid;
+ ObjectGuid guid;
- recvData.readPackGUID(guid);
+ recvData >> guid.ReadAsPacked();
uint32 flags, time;
recvData >> flags >> time;
- TC_LOG_DEBUG("network", "Guid " UI64FMTD, guid);
- TC_LOG_DEBUG("network", "Flags %u, time %u", flags, time/IN_MILLISECONDS);
Player* plMover = _player->m_mover->ToPlayer();
@@ -264,9 +262,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
}
/* extract packet */
- uint64 guid;
+ ObjectGuid guid;
- recvData.readPackGUID(guid);
+ recvData >> guid.ReadAsPacked();
MovementInfo movementInfo;
movementInfo.guid = guid;
@@ -407,15 +405,12 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
{
- uint32 opcode = recvData.GetOpcode();
- TC_LOG_DEBUG("network", "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
-
/* extract packet */
- uint64 guid;
+ ObjectGuid guid;
uint32 unk1;
float newspeed;
- recvData.readPackGUID(guid);
+ recvData >> guid.ReadAsPacked();
// now can skip not our packet
if (_player->GetGUID() != guid)
@@ -442,7 +437,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" };
- switch (opcode)
+ switch (recvData.GetOpcode())
{
case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break;
@@ -454,7 +449,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break;
case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break;
default:
- TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
+ TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", recvData.GetOpcode());
return;
}
@@ -488,22 +483,20 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
if (GetPlayer()->IsInWorld())
- {
if (_player->m_mover->GetGUID() != guid)
- TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
- }
+ TC_LOG_DEBUG("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s" , guid.ToString().c_str(), _player->m_mover->GetGUID().ToString().c_str());
}
void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
- uint64 old_mover_guid;
- recvData.readPackGUID(old_mover_guid);
+ ObjectGuid old_mover_guid;
+ recvData >> old_mover_guid.ReadAsPacked();
MovementInfo mi;
ReadMovementInfo(recvData, &mi);
@@ -525,8 +518,8 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK");
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
if (_player->m_mover->GetGUID() != guid)
return;
@@ -539,7 +532,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
_player->m_movementInfo = movementInfo;
WorldPacket data(MSG_MOVE_KNOCK_BACK, 66);
- data.appendPackGUID(guid);
+ data << guid.WriteAsPacked();
_player->BuildMovementPacket(&data);
// knockback specific info
@@ -555,30 +548,30 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK");
- uint64 guid; // guid - unused
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // guid - unused
+ recvData >> guid.ReadAsPacked();
- recvData.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
ReadMovementInfo(recvData, &movementInfo);
- recvData.read_skip<uint32>(); // unk2
+ recvData.read_skip<uint32>(); // unk2
}
void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK");
- uint64 guid; // guid - unused
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // guid - unused
+ recvData >> guid.ReadAsPacked();
- recvData.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
ReadMovementInfo(recvData, &movementInfo);
- recvData.read_skip<uint32>(); // unk2
+ recvData.read_skip<uint32>(); // unk2
}
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
@@ -586,7 +579,7 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
if (!_player->IsAlive() || _player->IsInCombat())
return;
- uint64 summoner_guid;
+ ObjectGuid summoner_guid;
bool agree;
recvData >> summoner_guid;
recvData >> agree;
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index 1311cda1ef9..d402cdd265e 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -50,13 +50,13 @@ enum StableResultCode
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -67,7 +67,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
SendTabardVendorActivate(guid);
}
-void WorldSession::SendTabardVendorActivate(uint64 guid)
+void WorldSession::SendTabardVendorActivate(ObjectGuid guid)
{
WorldPacket data(MSG_TABARDVENDOR_ACTIVATE, 8);
data << guid;
@@ -76,7 +76,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid)
void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE");
@@ -85,7 +85,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -96,7 +96,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
SendShowBank(guid);
}
-void WorldSession::SendShowBank(uint64 guid)
+void WorldSession::SendShowBank(ObjectGuid guid)
{
WorldPacket data(SMSG_SHOW_BANK, 8);
data << guid;
@@ -104,7 +104,7 @@ void WorldSession::SendShowBank(uint64 guid)
SendPacket(&data);
}
-void WorldSession::SendShowMailBox(uint64 guid)
+void WorldSession::SendShowMailBox(ObjectGuid guid)
{
WorldPacket data(SMSG_SHOW_MAILBOX, 8);
data << guid;
@@ -113,26 +113,26 @@ void WorldSession::SendShowMailBox(uint64 guid)
void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
SendTrainerList(guid);
}
-void WorldSession::SendTrainerList(uint64 guid)
+void WorldSession::SendTrainerList(ObjectGuid guid)
{
std::string str = GetTrinityString(LANG_NPC_TAINER_HELLO);
SendTrainerList(guid, str);
}
-void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
+void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
{
TC_LOG_DEBUG("network", "WORLD: SendTrainerList");
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: SendTrainerList - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -140,19 +140,10 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- CreatureTemplate const* ci = unit->GetCreatureTemplate();
-
- if (!ci)
- {
- TC_LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid));
- return;
- }
-
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
if (!trainer_spells)
{
- TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)",
- GUID_LOPART(guid), unit->GetEntry());
+ TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for %s", guid.ToString().c_str());
return;
}
@@ -241,16 +232,16 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 spellId = 0;
recvData >> guid >> spellId;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL %s, learn spell id is: %u", guid.ToString().c_str(), spellId);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -300,13 +291,13 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -390,13 +381,13 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str());
return;
}
@@ -441,7 +432,7 @@ void WorldSession::SendSpiritResurrect()
void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
{
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive())
@@ -450,7 +441,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_INNKEEPER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str());
return;
}
@@ -483,7 +474,7 @@ void WorldSession::SendBindPoint(Creature* npc)
void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
@@ -501,7 +492,7 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
SendStablePet(npcGUID);
}
-void WorldSession::SendStablePet(uint64 guid)
+void WorldSession::SendStablePet(ObjectGuid guid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS_DETAIL);
@@ -513,7 +504,7 @@ void WorldSession::SendStablePet(uint64 guid)
_sendStabledPetCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
-void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid)
+void WorldSession::SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid)
{
if (!GetPlayer())
return;
@@ -522,7 +513,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
- data << uint64 (guid);
+ data << uint64(guid);
Pet* pet = _player->GetPet();
@@ -576,7 +567,7 @@ void WorldSession::SendStableResult(uint8 res)
void WorldSession::HandleStablePet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
@@ -651,7 +642,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
void WorldSession::HandleUnstablePet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET.");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
uint32 petnumber;
recvData >> npcGUID >> petnumber;
@@ -732,7 +723,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32
void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
recvData >> npcGUID;
@@ -770,7 +761,7 @@ void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */)
void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET.");
- uint64 npcGUID;
+ ObjectGuid npcGUID;
uint32 petId;
recvData >> npcGUID >> petId;
@@ -863,7 +854,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM");
- uint64 npcGUID, itemGUID;
+ ObjectGuid npcGUID, itemGUID;
uint8 guildBank; // new in 2.3.2, bool that means from guild bank money
recvData >> npcGUID >> itemGUID >> guildBank;
@@ -871,7 +862,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
+ TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str());
return;
}
@@ -884,7 +875,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
if (itemGUID)
{
- TC_LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID));
+ TC_LOG_DEBUG("network", "ITEM: Repair %s, at %s", itemGUID.ToString().c_str(), npcGUID.ToString().c_str());
Item* item = _player->GetItemByGuid(itemGUID);
if (item)
@@ -892,7 +883,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID));
+ TC_LOG_DEBUG("network", "ITEM: Repair all items at %s", npcGUID.ToString().c_str());
_player->DurabilityRepairAll(true, discountMod, guildBank != 0);
}
}
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 9346e982bd2..cb58d8968e8 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -35,17 +35,17 @@
void WorldSession::HandleDismissCritter(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for %s", guid.ToString().c_str());
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if (!pet)
{
- TC_LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)",
- uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
+ TC_LOG_DEBUG("network", "Vanitypet (%s) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)",
+ guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
return;
}
@@ -58,9 +58,9 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
void WorldSession::HandlePetAction(WorldPacket& recvData)
{
- uint64 guid1;
+ ObjectGuid guid1;
uint32 data;
- uint64 guid2;
+ ObjectGuid guid2;
recvData >> guid1; //pet guid
recvData >> data;
recvData >> guid2; //tag guid
@@ -69,18 +69,18 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
// used also for charmed creature
- Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
- TC_LOG_INFO("network", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
+ Unit* pet = ObjectAccessor::GetUnit(*_player, guid1);
+ TC_LOG_INFO("network", "HandlePetAction: %s - flag: %u, spellid: %u, target: %s.", guid1.ToString().c_str(), uint32(flag), spellid, guid2.ToString().c_str());
if (!pet)
{
- TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_DEBUG("network", "HandlePetAction: %s doesn't exist for %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
if (pet != GetPlayer()->GetFirstControlled())
{
- TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_DEBUG("network", "HandlePetAction: %s does not belong to %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
@@ -113,23 +113,23 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for %s", guid.ToString().c_str());
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if (!pet)
{
- TC_LOG_ERROR("network", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
+ TC_LOG_ERROR("network", "HandlePetStopAttack: %s does not exist", guid.ToString().c_str());
return;
}
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
{
- TC_LOG_ERROR("network", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s",
- uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "HandlePetStopAttack: %s isn't a pet or charmed creature of player %s",
+ guid.ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
@@ -139,13 +139,13 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
pet->AttackStop();
}
-void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2)
+void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2)
{
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
- guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId());
+ TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: %s, tagGuid: %s, spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
+ guid1.ToString().c_str(), guid2.ToString().c_str(), spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId());
return;
}
@@ -401,7 +401,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
TC_LOG_INFO("network", "HandlePetNameQuery. CMSG_PET_NAME_QUERY");
uint32 petnumber;
- uint64 petguid;
+ ObjectGuid petguid;
recvData >> petnumber;
recvData >> petguid;
@@ -409,7 +409,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
SendPetNameQuery(petguid, petnumber);
}
-void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
+void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber)
{
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
if (!pet)
@@ -440,14 +440,14 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
_player->GetSession()->SendPacket(&data);
}
-bool WorldSession::CheckStableMaster(uint64 guid)
+bool WorldSession::CheckStableMaster(ObjectGuid guid)
{
// spell case or GM
if (guid == GetPlayer()->GetGUID())
{
if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
{
- TC_LOG_DEBUG("network", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "%s attempt open stable in cheating way.", guid.ToString().c_str());
return false;
}
}
@@ -456,7 +456,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
{
if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
{
- TC_LOG_DEBUG("network", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "Stablemaster %s not found or you can't interact with him.", guid.ToString().c_str());
return false;
}
}
@@ -467,7 +467,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
{
TC_LOG_INFO("network", "HandlePetSetAction. CMSG_PET_SET_ACTION");
- uint64 petguid;
+ ObjectGuid petguid;
uint8 count;
recvData >> petguid;
@@ -476,7 +476,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
if (!pet || pet != _player->GetFirstControlled())
{
- TC_LOG_ERROR("network", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
+ TC_LOG_ERROR("network", "HandlePetSetAction: Unknown %s or owner (%s)", petguid.ToString().c_str(), _player->GetGUID().ToString().c_str());
return;
}
@@ -584,7 +584,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
{
TC_LOG_INFO("network", "HandlePetRename. CMSG_PET_RENAME");
- uint64 petguid;
+ ObjectGuid petguid;
uint8 isdeclined;
std::string name;
@@ -650,7 +650,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
stmt->setUInt32(0, _player->GetGUIDLow());
for (uint8 i = 0; i < 5; i++)
- stmt->setString(i+1, declinedname.name[i]);
+ stmt->setString(i + 1, declinedname.name[i]);
trans->Append(stmt);
}
@@ -668,9 +668,9 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
void WorldSession::HandlePetAbandon(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid; //pet guid
- TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
+ TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON %s", guid.ToString().c_str());
if (!_player->IsInWorld())
return;
@@ -697,7 +697,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData)
void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
{
TC_LOG_INFO("network", "CMSG_PET_SPELL_AUTOCAST");
- uint64 guid;
+ ObjectGuid guid;
uint32 spellid;
uint8 state; //1 for on, 0 for off
recvPacket >> guid >> spellid >> state;
@@ -712,7 +712,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm()))
{
- TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode. %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
return;
}
@@ -746,14 +746,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL");
- uint64 guid;
+ ObjectGuid guid;
uint8 castCount;
uint32 spellId;
uint8 castFlags;
recvPacket >> guid >> castCount >> spellId >> castFlags;
- TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags);
+ TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, %s, castCount: %u, spellId %u, castFlags %u", guid.ToString().c_str(), castCount, spellId, castFlags);
// This opcode is also sent from charmed and possessed units (players and creatures)
if (!_player->GetGuardianPet() && !_player->GetCharm())
@@ -763,7 +763,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
{
- TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()));
+ TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
return;
}
@@ -848,7 +848,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT");
- uint64 guid;
+ ObjectGuid guid;
uint32 talentId, requestedRank;
recvData >> guid >> talentId >> requestedRank;
@@ -860,7 +860,7 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
uint32 talentsCount;
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index d02b8986e08..d8063c707d0 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -54,7 +54,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_BUY");
- uint64 guidNPC;
+ ObjectGuid guidNPC;
uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client
std::string name;
@@ -81,13 +81,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
recvData >> clientIndex; // index
recvData.read_skip<uint32>(); // 0
- TC_LOG_DEBUG("network", "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
+ TC_LOG_DEBUG("network", "Petitioner %s tried sell petition: name %s", guidNPC.ToString().c_str(), name.c_str());
// prevent cheating
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
+ TC_LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - %s not found or you can't interact with him.", guidNPC.ToString().c_str());
return;
}
@@ -250,11 +250,10 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SHOW_SIGNATURES");
uint8 signs = 0;
- uint64 petitionguid;
+ ObjectGuid petitionguid;
recvData >> petitionguid; // petition guid
- // solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
- uint32 petitionGuidLow = GUID_LOPART(petitionguid);
+ uint32 petitionGuidLow = petitionguid.GetCounter();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
@@ -264,7 +263,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
if (!result)
{
- TC_LOG_DEBUG("entities.player.items", "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
+ TC_LOG_DEBUG("entities.player.items", "Petition %u is not found for player %u %s", petitionguid.GetCounter(), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
return;
}
Field* fields = result->Fetch();
@@ -297,7 +296,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
Field* fields2 = result->Fetch();
uint32 lowGuid = fields2[0].GetUInt32();
- data << uint64(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER)); // Player GUID
+ data << ObjectGuid(HIGHGUID_PLAYER, 0, lowGuid); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
@@ -310,41 +309,41 @@ void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_QUERY"); // ok
uint32 guildguid;
- uint64 petitionguid;
+ ObjectGuid petitionguid;
recvData >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid)
recvData >> petitionguid; // petition guid
- TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid);
+ TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition %s Guild GUID %u", petitionguid.ToString().c_str(), guildguid);
SendPetitionQueryOpcode(petitionguid);
}
-void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
+void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
{
- uint64 ownerguid = 0;
+ ObjectGuid ownerguid;
uint32 type;
std::string name = "NO_NAME_FOR_GUID";
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
Field* fields = result->Fetch();
- ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
name = fields[1].GetString();
type = fields[2].GetUInt8();
}
else
{
- TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid));
+ TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (%s)", petitionguid.ToString().c_str());
return;
}
WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+name.size()+1+1+4*12+2+10));
- data << uint32(GUID_LOPART(petitionguid)); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid)
+ data << uint32(petitionguid.GetCounter()); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid)
data << uint64(ownerguid); // charter owner guid
data << name; // name (guild/arena team)
data << uint8(0); // some string
@@ -384,7 +383,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_RENAME"); // ok
- uint64 petitionGuid;
+ ObjectGuid petitionGuid;
uint32 type;
std::string newName;
@@ -397,7 +396,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -408,7 +407,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid));
+ TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition %s", petitionGuid.ToString().c_str());
return;
}
@@ -442,11 +441,11 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME);
stmt->setString(0, newName);
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(1, petitionGuid.GetCounter());
CharacterDatabase.Execute(stmt);
- TC_LOG_DEBUG("network", "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str());
+ TC_LOG_DEBUG("network", "Petition %s renamed to '%s'", petitionGuid.ToString().c_str(), newName.c_str());
WorldPacket data(MSG_PETITION_RENAME, (8+newName.size()+1));
data << uint64(petitionGuid);
data << newName;
@@ -458,31 +457,31 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SIGN"); // ok
Field* fields;
- uint64 petitionGuid;
+ ObjectGuid petitionGuid;
uint8 unk;
recvData >> petitionGuid; // petition guid
recvData >> unk;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURES);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
+ stmt->setUInt32(1, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- TC_LOG_ERROR("network", "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "Petition %s is not found for player %u %s", petitionGuid.ToString().c_str(), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
return;
}
fields = result->Fetch();
- uint64 ownerGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ObjectGuid ownerGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
uint64 signs = fields[1].GetUInt64();
uint8 type = fields[2].GetUInt8();
uint32 playerGuid = _player->GetGUIDLow();
- if (GUID_LOPART(ownerGuid) == playerGuid)
+ if (ownerGuid == _player->GetGUID())
return;
// not let enemies sign guild charter
@@ -541,7 +540,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIG_BY_ACCOUNT);
stmt->setUInt32(0, GetAccountId());
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(1, petitionGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
@@ -563,14 +562,14 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE);
- stmt->setUInt32(0, GUID_LOPART(ownerGuid));
- stmt->setUInt32(1, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, ownerGuid.GetCounter());
+ stmt->setUInt32(1, petitionGuid.GetCounter());
stmt->setUInt32(2, playerGuid);
stmt->setUInt32(3, GetAccountId());
CharacterDatabase.Execute(stmt);
- TC_LOG_DEBUG("network", "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId());
+ TC_LOG_DEBUG("network", "PETITION SIGN: %s by player: %s (GUID: %u Account: %u)", petitionGuid.ToString().c_str(), _player->GetName().c_str(), playerGuid, GetAccountId());
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
data << uint64(petitionGuid);
@@ -594,14 +593,13 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_DECLINE"); // ok
- uint64 petitionguid;
- uint64 ownerguid;
+ ObjectGuid petitionguid;
recvData >> petitionguid; // petition guid
- TC_LOG_DEBUG("network", "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
+ TC_LOG_DEBUG("network", "Petition %s declined by %u", petitionguid.ToString().c_str(), _player->GetGUIDLow());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_OWNER_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -609,7 +607,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
return;
Field* fields = result->Fetch();
- ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ ObjectGuid ownerguid(HIGHGUID_PLAYER, 0, fields[0].GetUInt32());
Player* owner = ObjectAccessor::FindPlayer(ownerguid);
if (owner) // petition owner online
@@ -625,7 +623,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
TC_LOG_DEBUG("network", "Received opcode CMSG_OFFER_PETITION"); // ok
uint8 signs = 0;
- uint64 petitionguid, plguid;
+ ObjectGuid petitionguid, plguid;
uint32 type, junk;
Player* player;
recvData >> junk; // this is not petition type!
@@ -638,7 +636,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_TYPE);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
@@ -648,7 +646,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
Field* fields = result->Fetch();
type = fields[0].GetUInt8();
- TC_LOG_DEBUG("network", "OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid));
+ TC_LOG_DEBUG("network", "OFFER PETITION: type %u, %s, to %s", type, petitionguid.ToString().c_str(), plguid.ToString().c_str());
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam())
{
@@ -703,7 +701,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, GUID_LOPART(petitionguid));
+ stmt->setUInt32(0, petitionguid.GetCounter());
result = CharacterDatabase.Query(stmt);
@@ -714,13 +712,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
data << uint64(petitionguid); // petition guid
data << uint64(_player->GetGUID()); // owner guid
- data << uint32(GUID_LOPART(petitionguid)); // guild guid
+ data << uint32(petitionguid.GetCounter()); // guild guid
data << uint8(signs); // sign's count
for (uint8 i = 1; i <= signs; ++i)
{
Field* fields2 = result->Fetch();
- data << uint64(MAKE_NEW_GUID(fields2[0].GetUInt32(), 0, HIGHGUID_PLAYER)); // Player GUID
+ data << uint64(ObjectGuid(HIGHGUID_PLAYER, fields2[0].GetUInt32())); // Player GUID
data << uint32(0); // there 0 ...
result->NextRow();
@@ -735,7 +733,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
// Get petition guid from packet
WorldPacket data;
- uint64 petitionGuid;
+ ObjectGuid petitionGuid;
recvData >> petitionGuid;
@@ -744,7 +742,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
if (!item)
return;
- TC_LOG_DEBUG("network", "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow());
+ TC_LOG_DEBUG("network", "Petition %s turned in by %u", petitionGuid.ToString().c_str(), _player->GetGUIDLow());
// Get petition data from db
uint32 ownerguidlo;
@@ -752,7 +750,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
std::string name;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -764,7 +762,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_ERROR("network", "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));
+ TC_LOG_ERROR("network", "Player %s (guid: %u) tried to turn in petition (%s) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), petitionGuid.ToString().c_str());
return;
}
@@ -817,7 +815,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
uint8 signatures;
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURE);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
result = CharacterDatabase.Query(stmt);
if (result)
@@ -865,7 +863,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
for (uint8 i = 0; i < signatures; ++i)
{
Field* fields = result->Fetch();
- guild->AddMember(MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
+ guild->AddMember(ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32()));
result->NextRow();
}
}
@@ -892,9 +890,9 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
for (uint8 i = 0; i < signatures; ++i)
{
Field* fields = result->Fetch();
- uint32 memberGUID = fields[0].GetUInt32();
- TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID);
- arenaTeam->AddMember(MAKE_NEW_GUID(memberGUID, 0, HIGHGUID_PLAYER));
+ ObjectGuid memberGUID(HIGHGUID_PLAYER, fields[0].GetUInt32());
+ TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %s", arenaTeam->GetId(), memberGUID.ToString().c_str());
+ arenaTeam->AddMember(memberGUID);
result->NextRow();
}
}
@@ -902,17 +900,17 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID);
- stmt->setUInt32(0, GUID_LOPART(petitionGuid));
+ stmt->setUInt32(0, petitionGuid.GetCounter());
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
// created
- TC_LOG_DEBUG("network", "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid));
+ TC_LOG_DEBUG("network", "Player %s (%s) turning in petition %s", _player->GetName().c_str(), _player->GetGUID().ToString().c_str(), petitionGuid.ToString().c_str());
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << (uint32)PETITION_TURN_OK;
@@ -923,18 +921,18 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "Received CMSG_PETITION_SHOWLIST");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
SendPetitionShowList(guid);
}
-void WorldSession::SendPetitionShowList(uint64 guid)
+void WorldSession::SendPetitionShowList(ObjectGuid guid)
{
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index dbcfb1c4970..661ecf4652e 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -31,13 +31,13 @@
#include "Pet.h"
#include "MapManager.h"
-void WorldSession::SendNameQueryOpcode(uint64 guid)
+void WorldSession::SendNameQueryOpcode(ObjectGuid guid)
{
Player* player = ObjectAccessor::FindPlayer(guid);
- CharacterNameData const* nameData = sWorld->GetCharacterNameData(GUID_LOPART(guid));
+ CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid);
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
- data.appendPackGUID(guid);
+ data << guid.WriteAsPacked();
if (!nameData)
{
data << uint8(1); // name unknown
@@ -66,7 +66,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// This is disable by default to prevent lots of console spam
@@ -93,13 +93,12 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
recvData >> entry;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
if (ci)
{
-
std::string Name, SubName;
Name = ci->Name;
SubName = ci->SubName;
@@ -142,8 +141,8 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)",
- GUID_LOPART(guid), entry);
+ TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (%s, ENTRY: %u)",
+ guid.ToString().c_str(), entry);
WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4);
data << uint32(entry | 0x80000000);
SendPacket(&data);
@@ -156,7 +155,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
recvData >> entry;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry);
@@ -198,8 +197,8 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
}
else
{
- TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)",
- GUID_LOPART(guid), entry);
+ TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (%s, ENTRY: %u)",
+ guid.ToString().c_str(), entry);
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4);
data << uint32(entry | 0x80000000);
SendPacket(&data);
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 3590796bc0a..cb6ca112718 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -34,14 +34,14 @@
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
uint32 questStatus = DIALOG_STATUS_NONE;
Object* questGiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!questGiver)
{
- TC_LOG_INFO("network", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
+ TC_LOG_INFO("network", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (%s)", guid.ToString().c_str());
return;
}
@@ -71,16 +71,16 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO %s", guid.ToString().c_str());
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!creature)
{
- TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.",
- GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - %s not found or you can't interact with him.",
+ guid.ToString().c_str());
return;
}
@@ -101,19 +101,19 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 questId;
uint32 unk1;
recvData >> guid >> questId >> unk1;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
#define CLOSE_GOSSIP_CLEAR_DIVIDER() \
do { \
_player->PlayerTalkClass->SendCloseGossip(); \
- _player->SetDivider(0); \
+ _player->SetDivider(ObjectGuid::Empty); \
} while (0)
// no or incorrect quest giver
@@ -154,13 +154,13 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
return;
}
- if (_player->GetDivider() != 0)
+ if (!_player->GetDivider().IsEmpty())
{
Player* player = ObjectAccessor::FindPlayer(_player->GetDivider());
if (player)
{
player->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST);
- _player->SetDivider(0);
+ _player->SetDivider(ObjectGuid::Empty);
}
}
@@ -208,11 +208,11 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 questId;
uint8 unk1;
recvData >> guid >> questId >> unk1;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
// Verify that the guid is valid and is a questgiver or involved in the requested quest
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM);
@@ -256,7 +256,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
{
uint32 questId, reward;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid >> questId >> reward;
if (reward >= QUEST_REWARD_CHOICES_COUNT)
@@ -265,7 +265,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
return;
}
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %s, quest = %u, reward = %u", guid.ToString().c_str(), questId, reward);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(questId))
@@ -346,10 +346,10 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData)
{
uint32 questId;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid >> questId;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %s, quest = %u", guid.ToString().c_str(), questId);
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
if (!object || !object->hasInvolvedQuest(questId))
@@ -450,18 +450,18 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
if (_player->CanAddQuest(quest, true))
_player->AddQuestAndCheckCompletion(quest, NULL); // NULL, this prevent DB script from duplicate running
- _player->SetDivider(0);
+ _player->SetDivider(ObjectGuid::Empty);
}
}
void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
{
uint32 questId;
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid >> questId;
- TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
+ TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %s, quest = %u", guid.ToString().c_str(), questId);
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
if (!quest)
@@ -557,7 +557,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
- if (receiver->GetDivider() != 0)
+ if (receiver->GetDivider())
{
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_BUSY);
continue;
@@ -580,7 +580,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 questId;
uint8 msg;
recvPacket >> guid >> questId >> msg;
@@ -596,7 +596,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
data << uint64(_player->GetGUID());
data << uint8(msg); // valid values: 0-8
player->SendDirectMessage(&data);
- _player->SetDivider(0);
+ _player->SetDivider(ObjectGuid::Empty);
}
}
}
@@ -610,11 +610,11 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
data << uint32(count); // placeholder
- for (Player::ClientGUIDs::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
+ for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
{
uint32 questStatus = DIALOG_STATUS_NONE;
- if (IS_CRE_OR_VEH_OR_PET_GUID(*itr))
+ if (itr->IsAnyTypeCreature())
{
// need also pet quests case support
Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr);
@@ -629,7 +629,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
data << uint8(questStatus);
++count;
}
- else if (IS_GAMEOBJECT_GUID(*itr))
+ else if (itr->IsGameObject())
{
GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp
index ff4f2c15c7d..3ffc8df465e 100644
--- a/src/server/game/Handlers/ReferAFriendHandler.cpp
+++ b/src/server/game/Handlers/ReferAFriendHandler.cpp
@@ -25,8 +25,8 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_GRANT_LEVEL");
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
Player* target = ObjectAccessor::GetObjectInWorld(guid, _player);
@@ -48,7 +48,8 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
else if (target->GetGroup() != _player->GetGroup())
error = ERR_REFER_A_FRIEND_NOT_IN_GROUP;
- if (error) {
+ if (error)
+ {
WorldPacket data(SMSG_REFER_A_FRIEND_FAILURE, 24);
data << uint32(error);
if (error == ERR_REFER_A_FRIEND_NOT_IN_GROUP)
@@ -67,8 +68,8 @@ void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_ACCEPT_LEVEL_GRANT");
- uint64 guid;
- recvData.readPackGUID(guid);
+ ObjectGuid guid;
+ recvData >> guid.ReadAsPacked();
Player* other = ObjectAccessor::GetObjectInWorld(guid, _player);
if (!(other && other->GetSession()))
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index 92c7c60bca0..42d43e621b4 100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -63,13 +63,13 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "MSG_TALENT_WIPE_CONFIRM");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 9cce494a522..61714d6f1e8 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -69,7 +69,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
uint8 bagIndex, slot, castFlags;
uint8 castCount; // next cast if exists (single or not)
- uint64 itemGUID;
+ ObjectGuid itemGUID;
uint32 glyphIndex; // something to do with glyphs?
uint32 spellId; // cast spell id
@@ -242,7 +242,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
uint32 entry = fields[0].GetUInt32();
uint32 flags = fields[1].GetUInt32();
- item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, 0);
+ item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Empty);
item->SetEntry(entry);
item->SetUInt32Value(ITEM_FIELD_FLAGS, flags);
item->SetState(ITEM_CHANGED, pUser);
@@ -266,10 +266,10 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [%s]", guid.ToString().c_str());
if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid))
{
@@ -287,10 +287,10 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
recvPacket >> guid;
- TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid));
+ TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [%s]", guid.ToString().c_str());
// ignore for remote control state
if (_player->m_mover != _player)
@@ -391,7 +391,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
spellInfo = actualSpellInfo;
}
- Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, 0, false);
+ Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false);
spell->m_cast_count = castCount; // set count of casts
spell->prepare(&targets);
}
@@ -436,7 +436,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
return;
// maybe should only remove one buff when there are multiple?
- _player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
+ _player->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
// If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other
if (sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES) && spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES))
@@ -453,14 +453,14 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
// Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a)
for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); it++)
- _player->RemoveOwnedAura(*it, 0, 0, AURA_REMOVE_BY_CANCEL);
+ _player->RemoveOwnedAura(*it, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
}
}
}
void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
{
- uint64 guid;
+ ObjectGuid guid;
uint32 spellId;
recvPacket >> guid;
@@ -477,13 +477,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
if (!pet)
{
- TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant %s by player '%s'", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm())
{
- TC_LOG_ERROR("network", "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
+ TC_LOG_ERROR("network", "HandlePetCancelAura: %s is not a pet of player '%s'", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
return;
}
@@ -493,7 +493,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
return;
}
- pet->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
+ pet->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
pet->AddCreatureSpellCooldown(spellId);
}
@@ -561,7 +561,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recvData*/)
void WorldSession::HandleSpellClick(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// this will get something not in world. crash
@@ -580,7 +580,7 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData)
void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_GET_MIRRORIMAGE_DATA");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// Get unit for which data is needed by client
@@ -668,7 +668,7 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_PROJECTILE_POSITION");
- uint64 casterGuid;
+ ObjectGuid casterGuid;
uint32 spellId;
uint8 castCount;
float x, y, z; // Position of missile hit
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index 34899fc23df..cc4599316e7 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -32,19 +32,19 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
SendTaxiStatus(guid);
}
-void WorldSession::SendTaxiStatus(uint64 guid)
+void WorldSession::SendTaxiStatus(ObjectGuid guid)
{
// cheating checks
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
{
- TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - %s not found.", guid.ToString().c_str());
return;
}
@@ -67,14 +67,14 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
// cheating checks
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!unit)
{
- TC_LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - %s not found or you can't interact with him.", guid.ToString().c_str());
return;
}
@@ -167,7 +167,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
- uint64 guid;
+ ObjectGuid guid;
uint32 node_count;
recvData >> guid >> node_count;
@@ -175,7 +175,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
{
- TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - %s not found or you can't interact with it.", guid.ToString().c_str());
return;
}
std::vector<uint32> nodes;
@@ -285,7 +285,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI");
- uint64 guid;
+ ObjectGuid guid;
std::vector<uint32> nodes;
nodes.resize(2);
@@ -294,7 +294,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
{
- TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
+ TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - %s not found or you can't interact with it.", guid.ToString().c_str());
return;
}
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index a2aa426c096..9c181233e3b 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -44,7 +44,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID());
if (ticket && ticket->IsCompleted())
- sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());;
+ sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());
// Player must not have ticket
if (!ticket || ticket->IsClosed())
@@ -218,7 +218,7 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData)
recvData >> comment;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SURVEY);
- stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
+ stmt->setUInt32(0, GetPlayer()->GetGUIDLow());
stmt->setUInt32(1, nextSurveyID);
stmt->setUInt32(2, mainSurvey);
stmt->setString(3, comment);
@@ -241,7 +241,7 @@ void WorldSession::HandleReportLag(WorldPacket& recvData)
recvData >> z;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT);
- stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
+ stmt->setUInt32(0, GetPlayer()->GetGUIDLow());
stmt->setUInt8 (1, lagType);
stmt->setUInt16(2, mapId);
stmt->setFloat (3, x);
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index b4932496077..3a2796ceb95 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -94,13 +94,13 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
data << uint32(item->GetCount()); // stack count
// wrapped: hide stats but show giftcreator name
data << uint32(item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED) ? 1 : 0);
- data << uint64(item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR));
+ data << uint64(item->GetGuidValue(ITEM_FIELD_GIFTCREATOR));
// perm. enchantment and gems
data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT));
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
// creator
- data << uint64(item->GetUInt64Value(ITEM_FIELD_CREATOR));
+ data << uint64(item->GetGuidValue(ITEM_FIELD_CREATOR));
data << uint32(item->GetSpellCharges()); // charges
data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
data << uint32(item->GetItemRandomPropertyId());// random properties id
@@ -475,12 +475,12 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
{
if (myItems[i])
{
- myItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
+ myItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
_player->MoveItemFromInventory(myItems[i]->GetBagSlot(), myItems[i]->GetSlot(), true);
}
if (hisItems[i])
{
- hisItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, trader->GetGUID());
+ hisItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, trader->GetGUID());
trader->MoveItemFromInventory(hisItems[i]->GetBagSlot(), hisItems[i]->GetSlot(), true);
}
}
@@ -584,7 +584,7 @@ void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
{
- uint64 ID;
+ ObjectGuid ID;
recvPacket >> ID;
if (GetPlayer()->m_trade)
@@ -750,7 +750,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
return;
}
- uint64 iGUID = item->GetGUID();
+ ObjectGuid iGUID = item->GetGUID();
// prevent place single item into many trade slots using cheating and client bugs
if (my_trade->HasItem(iGUID))
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index b3fa240e2d2..4ca5e2a4b35 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -27,7 +27,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
- uint64 vehicleGUID = _player->GetCharmGUID();
+ ObjectGuid vehicleGUID = _player->GetCharmGUID();
if (!vehicleGUID) // something wrong here...
{
@@ -35,9 +35,9 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
return;
}
- uint64 guid;
+ ObjectGuid guid;
- recvData.readPackGUID(guid);
+ recvData >> guid.ReadAsPacked();
MovementInfo mi;
mi.guid = guid;
@@ -78,15 +78,15 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
break;
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
{
- uint64 guid; // current vehicle guid
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // current vehicle guid
+ recvData >> guid.ReadAsPacked();
MovementInfo movementInfo;
ReadMovementInfo(recvData, &movementInfo);
vehicle_base->m_movementInfo = movementInfo;
- uint64 accessory; // accessory guid
- recvData.readPackGUID(accessory);
+ ObjectGuid accessory; // accessory guid
+ recvData >> accessory.ReadAsPacked();
int8 seatId;
recvData >> seatId;
@@ -106,8 +106,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
}
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
{
- uint64 guid; // current vehicle guid
- recvData.readPackGUID(guid);
+ ObjectGuid guid; // current vehicle guid
+ recvData >> guid.ReadAsPacked();
int8 seatId;
recvData >> seatId;
@@ -128,7 +128,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
{
// Read guid
- uint64 guid;
+ ObjectGuid guid;
data >> guid;
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -150,63 +150,37 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
if (!vehicle)
{
data.rfinish(); // prevent warnings spam
- TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
+ TC_LOG_ERROR("network", "HandleEjectPassenger: %s is not in a vehicle!", GetPlayer()->GetGUID().ToString().c_str());
return;
}
- uint64 guid;
+ ObjectGuid guid;
data >> guid;
- if (IS_PLAYER_GUID(guid))
- {
- Player* player = ObjectAccessor::FindPlayer(guid);
- if (!player)
- {
- TC_LOG_ERROR("network", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- return;
- }
-
- if (!player->IsOnVehicle(vehicle->GetBase()))
- {
- TC_LOG_ERROR("network", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- return;
- }
-
- VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(player);
- ASSERT(seat);
- if (seat->IsEjectable())
- player->ExitVehicle();
- else
- TC_LOG_ERROR("network", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
- }
-
- else if (IS_CREATURE_GUID(guid))
+ if (guid.IsUnit())
{
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
if (!unit) // creatures can be ejected too from player mounts
{
- TC_LOG_ERROR("network", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "%s tried to eject %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
return;
}
if (!unit->IsOnVehicle(vehicle->GetBase()))
{
- TC_LOG_ERROR("network", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "%s tried to eject %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
return;
}
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(unit);
ASSERT(seat);
if (seat->IsEjectable())
- {
- ASSERT(GetPlayer() == vehicle->GetBase());
unit->ExitVehicle();
- }
else
- TC_LOG_ERROR("network", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ TC_LOG_ERROR("network", "Player %u attempted to eject %s from non-ejectable seat.", GetPlayer()->GetGUIDLow(), guid.ToString().c_str());
}
else
- TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
+ TC_LOG_ERROR("network", "HandleEjectPassenger: %s tried to eject invalid %s ", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
}
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)