Core/Entities: Use ObjectGuid class in game project
This commit is contained in:
1 parent
ce67a097bf
commit
a0e50ea35f
256 files changed
+3334
-3833
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user