mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
*Cleanup, fix the wholist, thanks SoulForge and Forgiven
--HG-- branch : trunk
This commit is contained in:
@@ -593,7 +593,7 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
||||
}
|
||||
|
||||
void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player,
|
||||
std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint32 usable,
|
||||
std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount)
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ class AuctionHouseObject
|
||||
void BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||
void BuildListAuctionItems(WorldPacket& data, Player* player,
|
||||
std::wstring const& searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint32 usable,
|
||||
std::wstring const& searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount);
|
||||
|
||||
|
||||
@@ -152,8 +152,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
|
||||
|
||||
uint32 clientcount = 0;
|
||||
|
||||
uint8 level_min, level_max;
|
||||
uint32 racemask, classmask, zones_count, str_count;
|
||||
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;
|
||||
uint32 zoneids[10]; // 10 is client limit
|
||||
std::string player_name, guild_name;
|
||||
|
||||
@@ -165,7 +164,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
|
||||
|
||||
recv_data >> racemask; // race mask
|
||||
recv_data >> classmask; // class mask
|
||||
recv_data >> zones_count; // zones count, client limit=10 (2.0.10)
|
||||
recv_data >> zones_count; // zones count, client limit = 10 (2.0.10)
|
||||
|
||||
if (zones_count > 10)
|
||||
return; // can't be received from real client or broken packet
|
||||
|
||||
@@ -44,24 +44,23 @@ uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag)
|
||||
{
|
||||
uint32 counter = 0;
|
||||
for (PlayerSocialMap::const_iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
|
||||
{
|
||||
if(itr->second.Flags & flag)
|
||||
if (itr->second.Flags & flag)
|
||||
++counter;
|
||||
}
|
||||
|
||||
return counter;
|
||||
}
|
||||
|
||||
bool PlayerSocial::AddToSocialList(uint32 friend_guid, bool ignore)
|
||||
{
|
||||
// check client limits
|
||||
if(ignore)
|
||||
if (ignore)
|
||||
{
|
||||
if(GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
|
||||
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
|
||||
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -88,29 +87,27 @@ bool PlayerSocial::AddToSocialList(uint32 friend_guid, bool ignore)
|
||||
void PlayerSocial::RemoveFromSocialList(uint32 friend_guid, bool ignore)
|
||||
{
|
||||
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid);
|
||||
if(itr == m_playerSocialMap.end()) // not exist
|
||||
if (itr == m_playerSocialMap.end()) // not exist
|
||||
return;
|
||||
|
||||
uint32 flag = SOCIAL_FLAG_FRIEND;
|
||||
if(ignore)
|
||||
if (ignore)
|
||||
flag = SOCIAL_FLAG_IGNORED;
|
||||
|
||||
itr->second.Flags &= ~flag;
|
||||
if(itr->second.Flags == 0)
|
||||
if (itr->second.Flags == 0)
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM character_social WHERE guid = '%u' AND friend = '%u'", GetPlayerGUID(), friend_guid);
|
||||
m_playerSocialMap.erase(itr);
|
||||
}
|
||||
else
|
||||
{
|
||||
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags & ~%u) WHERE guid = '%u' AND friend = '%u'", flag, GetPlayerGUID(), friend_guid);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note)
|
||||
{
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid);
|
||||
if(itr == m_playerSocialMap.end()) // not exist
|
||||
if (itr == m_playerSocialMap.end()) // not exist
|
||||
return;
|
||||
|
||||
utf8truncate(note,48); // DB and client size limitation
|
||||
@@ -123,7 +120,7 @@ void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note)
|
||||
void PlayerSocial::SendSocialList()
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(GetPlayerGUID());
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
uint32 size = m_playerSocialMap.size();
|
||||
@@ -139,10 +136,10 @@ void PlayerSocial::SendSocialList()
|
||||
data << uint64(itr->first); // player guid
|
||||
data << uint32(itr->second.Flags); // player flag (0x1-friend?, 0x2-ignored?, 0x4-muted?)
|
||||
data << itr->second.Note; // string note
|
||||
if(itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend()
|
||||
if (itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend()
|
||||
{
|
||||
data << uint8(itr->second.Status); // online/offline/etc?
|
||||
if(itr->second.Status) // if online
|
||||
if (itr->second.Status) // if online
|
||||
{
|
||||
data << uint32(itr->second.Area); // player area
|
||||
data << uint32(itr->second.Level); // player level
|
||||
@@ -173,12 +170,10 @@ bool PlayerSocial::HasIgnore(uint32 ignore_guid)
|
||||
|
||||
SocialMgr::SocialMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SocialMgr::~SocialMgr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &friendInfo)
|
||||
@@ -236,7 +231,7 @@ void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, uint32 fr
|
||||
WorldPacket data;
|
||||
MakeFriendStatusPacket(result, friend_guid, &data);
|
||||
GetFriendInfo(player, friend_guid, fi);
|
||||
switch(result)
|
||||
switch (result)
|
||||
{
|
||||
case FRIEND_ADDED_OFFLINE:
|
||||
case FRIEND_ADDED_ONLINE:
|
||||
@@ -246,7 +241,7 @@ void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, uint32 fr
|
||||
break;
|
||||
}
|
||||
|
||||
switch(result)
|
||||
switch (result)
|
||||
{
|
||||
case FRIEND_ADDED_ONLINE:
|
||||
case FRIEND_ONLINE:
|
||||
@@ -259,7 +254,7 @@ void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, uint32 fr
|
||||
break;
|
||||
}
|
||||
|
||||
if(broadcast)
|
||||
if (broadcast)
|
||||
BroadcastToFriendListers(player, &data);
|
||||
else
|
||||
player->GetSession()->SendPacket(&data);
|
||||
@@ -267,19 +262,19 @@ void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, uint32 fr
|
||||
|
||||
void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet)
|
||||
{
|
||||
if(!player)
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
uint32 team = player->GetTeam();
|
||||
uint32 team = player->GetTeam();
|
||||
AccountTypes security = player->GetSession()->GetSecurity();
|
||||
uint32 guid = player->GetGUIDLow();
|
||||
uint32 guid = player->GetGUIDLow();
|
||||
AccountTypes gmLevelInWhoList = AccountTypes(sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
|
||||
bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
|
||||
|
||||
for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr)
|
||||
{
|
||||
PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(guid);
|
||||
if(itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND))
|
||||
if (itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND))
|
||||
{
|
||||
Player *pFriend = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
|
||||
|
||||
@@ -322,7 +317,7 @@ PlayerSocial *SocialMgr::LoadFromDB(QueryResult *result, uint32 guid)
|
||||
if(social->m_playerSocialMap.size() >= 50)
|
||||
break;
|
||||
}
|
||||
while( result->NextRow() );
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
return social;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ struct FriendInfo
|
||||
FriendStatus Status;
|
||||
uint32 Flags;
|
||||
uint32 Area;
|
||||
uint32 Level;
|
||||
uint32 Class;
|
||||
uint8 Level;
|
||||
uin8 Class;
|
||||
std::string Note;
|
||||
|
||||
FriendInfo()
|
||||
|
||||
Reference in New Issue
Block a user