mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[10815] Use in social lists API ObjectGuid form.
0 GUID_LOPART uses in code. :)
This commit is contained in:
parent
3c0b80dada
commit
a8a7f3c796
13 changed files with 55 additions and 53 deletions
|
|
@ -111,7 +111,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// OK result but not send invite
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
|
||||
|
|
|
|||
|
|
@ -623,7 +623,7 @@ void Channel::Invite(uint64 p, const char *newname)
|
|||
}
|
||||
|
||||
WorldPacket data;
|
||||
if(!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
|
||||
if(!newp->GetSocial()->HasIgnore(p))
|
||||
{
|
||||
MakeInvite(&data, p);
|
||||
SendToOne(&data, newp->GetGUID());
|
||||
|
|
@ -668,7 +668,7 @@ void Channel::SendToAll(WorldPacket *data, uint64 p)
|
|||
Player *plr = sObjectMgr.GetPlayer(i->first);
|
||||
if(plr)
|
||||
{
|
||||
if(!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
|
||||
if(!p || !plr->GetSocial()->HasIgnore(p))
|
||||
plr->GetSession()->SendPacket(data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -724,7 +724,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
|||
group->SendUpdate();
|
||||
|
||||
// friend status
|
||||
sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true);
|
||||
sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetObjectGuid(), true);
|
||||
|
||||
// Place character in world (and load zone) before some object loading
|
||||
pCurrChar->LoadCorpse();
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
// just ignore us
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ void Guild::BroadcastToGuild(WorldSession *session, const std::string& msg, uint
|
|||
{
|
||||
Player *pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetGUIDLow()) )
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()) )
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
@ -576,7 +576,7 @@ void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, u
|
|||
|
||||
Player *pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetGUIDLow()))
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(),GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()))
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
|
|||
}
|
||||
|
||||
// OK result but not send invite
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
if(player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
return;
|
||||
|
||||
// not let enemies sign guild charter
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 acc
|
|||
friendResult = FRIEND_SELF;
|
||||
else if(session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
|
||||
friendResult = FRIEND_ENEMY;
|
||||
else if(session->GetPlayer()->GetSocial()->HasFriend(friendLowGuid))
|
||||
else if(session->GetPlayer()->GetSocial()->HasFriend(friendGuid))
|
||||
friendResult = FRIEND_ALREADY;
|
||||
else
|
||||
{
|
||||
|
|
@ -484,32 +484,32 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 acc
|
|||
else
|
||||
friendResult = FRIEND_ADDED_OFFLINE;
|
||||
|
||||
if(!session->GetPlayer()->GetSocial()->AddToSocialList(friendLowGuid, false))
|
||||
if(!session->GetPlayer()->GetSocial()->AddToSocialList(friendGuid, false))
|
||||
{
|
||||
friendResult = FRIEND_LIST_FULL;
|
||||
DEBUG_LOG( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName());
|
||||
}
|
||||
|
||||
session->GetPlayer()->GetSocial()->SetFriendNote(friendLowGuid, friendNote);
|
||||
session->GetPlayer()->GetSocial()->SetFriendNote(friendGuid, friendNote);
|
||||
}
|
||||
}
|
||||
|
||||
sSocialMgr.SendFriendStatus(session->GetPlayer(), friendResult, friendLowGuid, false);
|
||||
sSocialMgr.SendFriendStatus(session->GetPlayer(), friendResult, friendGuid, false);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent (SMSG_FRIEND_STATUS)" );
|
||||
}
|
||||
|
||||
void WorldSession::HandleDelFriendOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 FriendGUID;
|
||||
uint64 friendGuid;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_DEL_FRIEND" );
|
||||
|
||||
recv_data >> FriendGUID;
|
||||
recv_data >> friendGuid;
|
||||
|
||||
_player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), false);
|
||||
_player->GetSocial()->RemoveFromSocialList(friendGuid, false);
|
||||
|
||||
sSocialMgr.SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false);
|
||||
sSocialMgr.SendFriendStatus(GetPlayer(), FRIEND_REMOVED, friendGuid, false);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent motd (SMSG_FRIEND_STATUS)" );
|
||||
}
|
||||
|
|
@ -552,34 +552,34 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 acc
|
|||
{
|
||||
if (ignoreGuid == session->GetPlayer()->GetObjectGuid())
|
||||
ignoreResult = FRIEND_IGNORE_SELF;
|
||||
else if (session->GetPlayer()->GetSocial()->HasIgnore(ignoreLowGuid))
|
||||
else if (session->GetPlayer()->GetSocial()->HasIgnore(ignoreGuid))
|
||||
ignoreResult = FRIEND_IGNORE_ALREADY;
|
||||
else
|
||||
{
|
||||
ignoreResult = FRIEND_IGNORE_ADDED;
|
||||
|
||||
// ignore list full
|
||||
if(!session->GetPlayer()->GetSocial()->AddToSocialList(ignoreLowGuid, true))
|
||||
if(!session->GetPlayer()->GetSocial()->AddToSocialList(ignoreGuid, true))
|
||||
ignoreResult = FRIEND_IGNORE_FULL;
|
||||
}
|
||||
}
|
||||
|
||||
sSocialMgr.SendFriendStatus(session->GetPlayer(), ignoreResult, ignoreLowGuid, false);
|
||||
sSocialMgr.SendFriendStatus(session->GetPlayer(), ignoreResult, ignoreGuid, false);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent (SMSG_FRIEND_STATUS)" );
|
||||
}
|
||||
|
||||
void WorldSession::HandleDelIgnoreOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 IgnoreGUID;
|
||||
uint64 ignoreGuid;
|
||||
|
||||
DEBUG_LOG( "WORLD: Received CMSG_DEL_IGNORE" );
|
||||
|
||||
recv_data >> IgnoreGUID;
|
||||
recv_data >> ignoreGuid;
|
||||
|
||||
_player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), true);
|
||||
_player->GetSocial()->RemoveFromSocialList(ignoreGuid, true);
|
||||
|
||||
sSocialMgr.SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false);
|
||||
sSocialMgr.SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, ignoreGuid, false);
|
||||
|
||||
DEBUG_LOG( "WORLD: Sent motd (SMSG_FRIEND_STATUS)" );
|
||||
}
|
||||
|
|
@ -590,7 +590,7 @@ void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data )
|
|||
ObjectGuid guid;
|
||||
std::string note;
|
||||
recv_data >> guid >> note;
|
||||
_player->GetSocial()->SetFriendNote(guid.GetCounter(), note);
|
||||
_player->GetSocial()->SetFriendNote(guid, note);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBugOpcode( WorldPacket & recv_data )
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag)
|
|||
return counter;
|
||||
}
|
||||
|
||||
bool PlayerSocial::AddToSocialList(uint32 friend_lowguid, bool ignore)
|
||||
bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore)
|
||||
{
|
||||
// check client limits
|
||||
if(ignore)
|
||||
|
|
@ -66,25 +66,25 @@ bool PlayerSocial::AddToSocialList(uint32 friend_lowguid, bool ignore)
|
|||
if(ignore)
|
||||
flag = SOCIAL_FLAG_IGNORED;
|
||||
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_lowguid);
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||
if(itr != m_playerSocialMap.end())
|
||||
{
|
||||
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags | %u) WHERE guid = '%u' AND friend = '%u'", flag, m_playerLowGuid, friend_lowguid);
|
||||
m_playerSocialMap[friend_lowguid].Flags |= flag;
|
||||
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags | %u) WHERE guid = '%u' AND friend = '%u'", flag, m_playerLowGuid, friend_guid.GetCounter());
|
||||
m_playerSocialMap[friend_guid.GetCounter()].Flags |= flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
CharacterDatabase.PExecute("INSERT INTO character_social (guid, friend, flags) VALUES ('%u', '%u', '%u')", m_playerLowGuid, friend_lowguid, flag);
|
||||
CharacterDatabase.PExecute("INSERT INTO character_social (guid, friend, flags) VALUES ('%u', '%u', '%u')", m_playerLowGuid, friend_guid.GetCounter(), flag);
|
||||
FriendInfo fi;
|
||||
fi.Flags |= flag;
|
||||
m_playerSocialMap[friend_lowguid] = fi;
|
||||
m_playerSocialMap[friend_guid.GetCounter()] = fi;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PlayerSocial::RemoveFromSocialList(uint32 friend_lowguid, bool ignore)
|
||||
void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore)
|
||||
{
|
||||
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_lowguid);
|
||||
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||
if(itr == m_playerSocialMap.end()) // not exist
|
||||
return;
|
||||
|
||||
|
|
@ -95,18 +95,18 @@ void PlayerSocial::RemoveFromSocialList(uint32 friend_lowguid, bool ignore)
|
|||
itr->second.Flags &= ~flag;
|
||||
if(itr->second.Flags == 0)
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM character_social WHERE guid = '%u' AND friend = '%u'", m_playerLowGuid, friend_lowguid);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_social WHERE guid = '%u' AND friend = '%u'", m_playerLowGuid, friend_guid.GetCounter());
|
||||
m_playerSocialMap.erase(itr);
|
||||
}
|
||||
else
|
||||
{
|
||||
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags & ~%u) WHERE guid = '%u' AND friend = '%u'", flag, m_playerLowGuid, friend_lowguid);
|
||||
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags & ~%u) WHERE guid = '%u' AND friend = '%u'", flag, m_playerLowGuid, friend_guid.GetCounter());
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerSocial::SetFriendNote(uint32 friend_lowguid, std::string note)
|
||||
void PlayerSocial::SetFriendNote(ObjectGuid friend_guid, std::string note)
|
||||
{
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_lowguid);
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||
if(itr == m_playerSocialMap.end()) // not exist
|
||||
return;
|
||||
|
||||
|
|
@ -114,8 +114,8 @@ void PlayerSocial::SetFriendNote(uint32 friend_lowguid, std::string note)
|
|||
|
||||
std::string safe_note = note;
|
||||
CharacterDatabase.escape_string(safe_note);
|
||||
CharacterDatabase.PExecute("UPDATE character_social SET note = '%s' WHERE guid = '%u' AND friend = '%u'", safe_note.c_str(), m_playerLowGuid, friend_lowguid);
|
||||
m_playerSocialMap[friend_lowguid].Note = note;
|
||||
CharacterDatabase.PExecute("UPDATE character_social SET note = '%s' WHERE guid = '%u' AND friend = '%u'", safe_note.c_str(), m_playerLowGuid, friend_guid.GetCounter());
|
||||
m_playerSocialMap[friend_guid.GetCounter()].Note = note;
|
||||
}
|
||||
|
||||
void PlayerSocial::SendSocialList()
|
||||
|
|
@ -153,17 +153,17 @@ void PlayerSocial::SendSocialList()
|
|||
DEBUG_LOG("WORLD: Sent SMSG_CONTACT_LIST");
|
||||
}
|
||||
|
||||
bool PlayerSocial::HasFriend(uint32 friend_guid)
|
||||
bool PlayerSocial::HasFriend(ObjectGuid friend_guid)
|
||||
{
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid);
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||
if(itr != m_playerSocialMap.end())
|
||||
return itr->second.Flags & SOCIAL_FLAG_FRIEND;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlayerSocial::HasIgnore(uint32 ignore_guid)
|
||||
bool PlayerSocial::HasIgnore(ObjectGuid ignore_guid)
|
||||
{
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid);
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid.GetCounter());
|
||||
if(itr != m_playerSocialMap.end())
|
||||
return itr->second.Flags & SOCIAL_FLAG_IGNORED;
|
||||
return false;
|
||||
|
|
@ -227,8 +227,10 @@ void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldP
|
|||
*data << ObjectGuid(HIGHGUID_PLAYER, guid);
|
||||
}
|
||||
|
||||
void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, uint32 friend_lowguid, bool broadcast)
|
||||
void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, ObjectGuid friend_guid, bool broadcast)
|
||||
{
|
||||
uint32 friend_lowguid = friend_guid.GetCounter();
|
||||
|
||||
FriendInfo fi;
|
||||
|
||||
WorldPacket data;
|
||||
|
|
|
|||
|
|
@ -120,14 +120,14 @@ class PlayerSocial
|
|||
PlayerSocial();
|
||||
~PlayerSocial();
|
||||
// adding/removing
|
||||
bool AddToSocialList(uint32 friend_guid, bool ignore);
|
||||
void RemoveFromSocialList(uint32 friend_guid, bool ignore);
|
||||
void SetFriendNote(uint32 friend_guid, std::string note);
|
||||
bool AddToSocialList(ObjectGuid friend_guid, bool ignore);
|
||||
void RemoveFromSocialList(ObjectGuid friend_guid, bool ignore);
|
||||
void SetFriendNote(ObjectGuid friend_guid, std::string note);
|
||||
// Packet send's
|
||||
void SendSocialList();
|
||||
// Misc
|
||||
bool HasFriend(uint32 friend_guid);
|
||||
bool HasIgnore(uint32 ignore_guid);
|
||||
bool HasFriend(ObjectGuid friend_guid);
|
||||
bool HasIgnore(ObjectGuid ignore_guid);
|
||||
void SetPlayerGuid(ObjectGuid guid) { m_playerLowGuid = guid.GetCounter(); }
|
||||
uint32 GetNumberOfSocialsWithFlag(SocialFlag flag);
|
||||
private:
|
||||
|
|
@ -146,7 +146,7 @@ class SocialMgr
|
|||
void GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &friendInfo);
|
||||
// Packet management
|
||||
void MakeFriendStatusPacket(FriendsResult result, uint32 friend_guid, WorldPacket *data);
|
||||
void SendFriendStatus(Player *player, FriendsResult result, uint32 friend_guid, bool broadcast);
|
||||
void SendFriendStatus(Player *player, FriendsResult result, ObjectGuid friend_guid, bool broadcast);
|
||||
void BroadcastToFriendListers(Player *player, WorldPacket *packet);
|
||||
// Loading
|
||||
PlayerSocial *LoadFromDB(QueryResult *result, ObjectGuid guid);
|
||||
|
|
|
|||
|
|
@ -6842,7 +6842,7 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx)
|
|||
Player *target = (Player*)unitTarget;
|
||||
|
||||
// caster or target already have requested duel
|
||||
if( caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()) )
|
||||
if( caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetObjectGuid()) )
|
||||
return;
|
||||
|
||||
// Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities)
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||
{
|
||||
SendTradeStatus(TRADE_STATUS_IGNORE_YOU);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
_player->GetGroup()->SendUpdate();
|
||||
|
||||
///- Broadcast a logout message to the player's friends
|
||||
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetGUIDLow(), true);
|
||||
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetObjectGuid(), true);
|
||||
sSocialMgr.RemovePlayerSocial (_player->GetGUIDLow ());
|
||||
|
||||
///- Remove the player from the world
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10814"
|
||||
#define REVISION_NR "10815"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue