2 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __MANGOS_SOCIALMGR_H
20 #define __MANGOS_SOCIALMGR_H
22 #include "Policies/Singleton.h"
23 #include "Database/DatabaseEnv.h"
33 FRIEND_STATUS_OFFLINE
= 0,
34 FRIEND_STATUS_ONLINE
= 1,
35 FRIEND_STATUS_AFK
= 2,
36 FRIEND_STATUS_UNK3
= 3,
42 SOCIAL_FLAG_FRIEND
= 0x01,
43 SOCIAL_FLAG_IGNORED
= 0x02,
44 SOCIAL_FLAG_MUTED
= 0x04 // guessed
58 Status
= FRIEND_STATUS_OFFLINE
;
66 FriendInfo(uint32 flags
, const std::string
& note
)
68 Status
= FRIEND_STATUS_OFFLINE
;
77 typedef std::map
<uint32
, FriendInfo
> PlayerSocialMap
;
78 typedef std::map
<uint32
, PlayerSocial
> SocialMap
;
80 /// Results of friend related commands
83 FRIEND_DB_ERROR
= 0x00,
84 FRIEND_LIST_FULL
= 0x01,
86 FRIEND_OFFLINE
= 0x03,
87 FRIEND_NOT_FOUND
= 0x04,
88 FRIEND_REMOVED
= 0x05,
89 FRIEND_ADDED_ONLINE
= 0x06,
90 FRIEND_ADDED_OFFLINE
= 0x07,
91 FRIEND_ALREADY
= 0x08,
94 FRIEND_IGNORE_FULL
= 0x0B,
95 FRIEND_IGNORE_SELF
= 0x0C,
96 FRIEND_IGNORE_NOT_FOUND
= 0x0D,
97 FRIEND_IGNORE_ALREADY
= 0x0E,
98 FRIEND_IGNORE_ADDED
= 0x0F,
99 FRIEND_IGNORE_REMOVED
= 0x10,
100 FRIEND_IGNORE_AMBIGUOUS
= 0x11, // That name is ambiguous, type more of the player's server name
101 FRIEND_MUTE_FULL
= 0x12,
102 FRIEND_MUTE_SELF
= 0x13,
103 FRIEND_MUTE_NOT_FOUND
= 0x14,
104 FRIEND_MUTE_ALREADY
= 0x15,
105 FRIEND_MUTE_ADDED
= 0x16,
106 FRIEND_MUTE_REMOVED
= 0x17,
107 FRIEND_MUTE_AMBIGUOUS
= 0x18, // That name is ambiguous, type more of the player's server name
108 FRIEND_UNK7
= 0x19, // no message at client
109 FRIEND_UNKNOWN
= 0x1A // Unknown friend response from server
112 #define SOCIALMGR_FRIEND_LIMIT 50
113 #define SOCIALMGR_IGNORE_LIMIT 25
117 friend class SocialMgr
;
122 bool AddToSocialList(uint32 friend_guid
, bool ignore
);
123 void RemoveFromSocialList(uint32 friend_guid
, bool ignore
);
124 void SetFriendNote(uint32 friend_guid
, std::string note
);
126 void SendSocialList();
128 bool HasFriend(uint32 friend_guid
);
129 bool HasIgnore(uint32 ignore_guid
);
130 uint32
GetPlayerGUID() { return m_playerGUID
; }
131 void SetPlayerGUID(uint32 guid
) { m_playerGUID
= guid
; }
132 uint32
GetNumberOfSocialsWithFlag(SocialFlag flag
);
134 PlayerSocialMap m_playerSocialMap
;
144 void RemovePlayerSocial(uint32 guid
) { m_socialMap
.erase(guid
); }
146 void GetFriendInfo(Player
*player
, uint32 friendGUID
, FriendInfo
&friendInfo
);
148 void MakeFriendStatusPacket(FriendsResult result
, uint32 friend_guid
, WorldPacket
*data
);
149 void SendFriendStatus(Player
*player
, FriendsResult result
, uint32 friend_guid
, bool broadcast
);
150 void BroadcastToFriendListers(Player
*player
, WorldPacket
*packet
);
152 PlayerSocial
*LoadFromDB(QueryResult
*result
, uint32 guid
);
154 SocialMap m_socialMap
;
157 #define sSocialMgr MaNGOS::Singleton<SocialMgr>::Instance()