aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/MiscHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp92
1 files changed, 44 insertions, 48 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 81c08b4c35b..279b06e2cef 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -93,7 +93,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
uint32 gossipListId;
uint32 menuId;
- uint64 guid;
+ ObjectGuid guid;
std::string code = "";
recvData >> guid >> menuId >> gossipListId;
@@ -113,27 +113,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;
}
@@ -377,7 +377,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()) ||
@@ -541,7 +541,7 @@ void WorldSession::HandleRequestCemeteryList(WorldPacket& /*recvPacket*/)
void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData)
{
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
_player->SetSelection(guid);
@@ -593,19 +593,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();
@@ -617,7 +616,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
{
@@ -626,33 +625,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)");
}
@@ -683,49 +682,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)");
}
@@ -733,10 +731,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)
@@ -770,7 +768,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE");
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
if (_player->IsAlive())
@@ -807,7 +805,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;
@@ -946,10 +944,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
if (Battleground* bg = player->GetBattleground())
if (bg->GetStatus() == STATUS_IN_PROGRESS)
- {
bg->HandleAreaTrigger(player, triggerId);
- return;
- }
if (OutdoorPvP* pvp = player->GetOutdoorPvP())
if (pvp->HandleAreaTrigger(_player, triggerId))
@@ -1059,7 +1054,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
@@ -1227,7 +1222,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");
@@ -1235,7 +1230,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;
}
@@ -1292,7 +1287,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData)
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- TC_LOG_DEBUG("network", "CMSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, (uint64)guid);
+ TC_LOG_DEBUG("network", "CMSG_INSPECT_HONOR_STATS: No player found from %s", guid.ToString().c_str());
return;
}
@@ -1427,7 +1422,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;
@@ -1460,7 +1455,8 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData)
data << uint8(0); // value 0xC generates a "CalendarError" in client.
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)
@@ -1492,11 +1488,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
{
@@ -1729,10 +1725,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;
@@ -1828,7 +1824,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData)
Battleground* bg = _player->GetBattleground();
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -1851,7 +1847,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData)
Battleground* bg = _player->GetBattleground();
- uint64 guid;
+ ObjectGuid guid;
recvData >> guid;
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -1980,7 +1976,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;