summaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/Socialhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/Socialhandler.cpp')
-rw-r--r--src/server/game/Handlers/Socialhandler.cpp44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/server/game/Handlers/Socialhandler.cpp b/src/server/game/Handlers/Socialhandler.cpp
index ac3f5dd92e..07453f6162 100644
--- a/src/server/game/Handlers/Socialhandler.cpp
+++ b/src/server/game/Handlers/Socialhandler.cpp
@@ -40,15 +40,14 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
LOG_DEBUG("network", "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName().c_str(), friendName.c_str());
// xinef: Get Data From global storage
- uint32 guidLow = sWorld->GetGlobalPlayerGUID(friendName);
- if (!guidLow)
+ ObjectGuid friendGuid = sWorld->GetGlobalPlayerGUID(friendName);
+ if (!friendGuid)
return;
- GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow);
+ GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(friendGuid.GetCounter());
if (!playerData)
return;
- uint64 friendGuid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
uint32 friendAccountId = playerData->accountId;
TeamId teamId = Player::TeamIdForRace(playerData->race);
FriendsResult friendResult = FRIEND_NOT_FOUND;
@@ -61,11 +60,11 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
friendResult = FRIEND_SELF;
else if (GetPlayer()->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity()))
friendResult = FRIEND_ENEMY;
- else if (GetPlayer()->GetSocial()->HasFriend(guidLow))
+ else if (GetPlayer()->GetSocial()->HasFriend(friendGuid))
friendResult = FRIEND_ALREADY;
else
{
- Player* pFriend = ObjectAccessor::FindPlayerInOrOutOfWorld(friendGuid);
+ Player* pFriend = ObjectAccessor::FindConnectedPlayer(friendGuid);
if (pFriend && pFriend->IsVisibleGloballyFor(GetPlayer()) && !AccountMgr::IsGMAccount(pFriend->GetSession()->GetSecurity()))
friendResult = FRIEND_ADDED_ONLINE;
else
@@ -75,23 +74,23 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
else
friendResult = FRIEND_LIST_FULL;
}
- GetPlayer()->GetSocial()->SetFriendNote(guidLow, friendNote);
+ GetPlayer()->GetSocial()->SetFriendNote(friendGuid, friendNote);
}
}
- sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, guidLow, false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid, false);
LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
void WorldSession::HandleDelFriendOpcode(WorldPacket& recv_data)
{
- uint64 FriendGUID;
+ ObjectGuid FriendGUID;
recv_data >> FriendGUID;
- _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), SOCIAL_FLAG_FRIEND);
+ _player->GetSocial()->RemoveFromSocialList(FriendGUID, SOCIAL_FLAG_FRIEND);
- sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, FriendGUID, false);
LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
}
@@ -107,44 +106,43 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recv_data)
LOG_DEBUG("network", "WORLD: %s asked to Ignore: '%s'", GetPlayer()->GetName().c_str(), ignoreName.c_str());
- uint32 lowGuid = sWorld->GetGlobalPlayerGUID(ignoreName);
- if (!lowGuid)
+ ObjectGuid ignoreGuid = sWorld->GetGlobalPlayerGUID(ignoreName);
+ if (!ignoreGuid)
return;
- uint64 IgnoreGuid = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER);
FriendsResult ignoreResult;
- if (IgnoreGuid == GetPlayer()->GetGUID()) //not add yourself
+ if (ignoreGuid == GetPlayer()->GetGUID()) //not add yourself
ignoreResult = FRIEND_IGNORE_SELF;
- else if (GetPlayer()->GetSocial()->HasIgnore(lowGuid))
+ else if (GetPlayer()->GetSocial()->HasIgnore(ignoreGuid))
ignoreResult = FRIEND_IGNORE_ALREADY;
else
{
ignoreResult = FRIEND_IGNORE_ADDED;
// ignore list full
- if (!GetPlayer()->GetSocial()->AddToSocialList(lowGuid, SOCIAL_FLAG_IGNORED))
+ if (!GetPlayer()->GetSocial()->AddToSocialList(ignoreGuid, SOCIAL_FLAG_IGNORED))
ignoreResult = FRIEND_IGNORE_FULL;
}
- sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, lowGuid, false);
+ sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, ignoreGuid, false);
LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recv_data)
{
- uint64 IgnoreGUID;
+ ObjectGuid IgnoreGUID;
recv_data >> IgnoreGUID;
- _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), SOCIAL_FLAG_IGNORED);
- sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false);
+ _player->GetSocial()->RemoveFromSocialList(IgnoreGUID, SOCIAL_FLAG_IGNORED);
+ sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, IgnoreGUID, false);
}
void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recv_data)
{
- uint64 guid;
+ ObjectGuid guid;
std::string note;
recv_data >> guid >> note;
- _player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note);
+ _player->GetSocial()->SetFriendNote(guid, note);
}