Added ai command setEquipment
[ryzomcore.git] / ryzom / server / src / input_output_service / chat_client.h
blobb59e15fadfa13fe9aab7be52f10fa644259d6469
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
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 Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CHAT_CLIENT_H
20 #define CHAT_CLIENT_H
24 // game share
25 #include "game_share/chat_group.h"
26 #include "game_share/base_types.h"
27 #include "game_share/dyn_chat.h"
29 // std
30 #include <vector>
31 #include <set>
34 typedef uint8 TFilter;
37 /**
38 * CChatClient
39 * \author Stephane Coutelas
40 * \author Nevrax France
41 * \date 2002
43 class CChatClient
45 public :
47 /**
48 * Constructor
50 CChatClient( const TDataSetRow& id );
51 /************************************************************************/
52 /* Destructor */
53 /************************************************************************/
54 ~CChatClient();
56 /**
57 * Get the id of this client
59 const NLMISC::CEntityId &getId() const { return _Id; }
60 /**
61 * Get the dataset row of this client
63 const TDataSetRow &getDataSetIndex() const { return _DataSetIndex; }
65 /**
66 * Mute or unmute this client, nobody will received chat from him
67 * the player can be muted for a fixed period of time
68 * If the player is unmuted, the delay is not taken into account
69 * \param delay is the mute delay
71 /// DEPRECATED
72 void mute( sint32 delay );
74 /**
75 * Get the mute state of this client
77 * \return true if this client is muted
79 bool isMuted();
81 /**
82 * Add or remove a character from the ignore list of this client
84 * \param id is the id of the character to be add/remove in the ignore list
86 void setIgnoreStatus( const NLMISC::CEntityId &id, bool ignored);
88 // Set the ignore list
89 void setIgnoreList(const std::vector<NLMISC::CEntityId> &ignoreList);
91 /**
92 * Return true if the character is in the ignore list of this client
94 * \return true if the character is in the ignore list, false else
96 bool isInIgnoreList( const NLMISC::CEntityId &id );
97 bool isInIgnoreList( const TDataSetRow &id );
99 /**
100 * Add or remove a string filter
101 * \param filterId the filter
103 void filter( TFilter filterId );
106 * Return true if the filter is on
107 * \param filterId the filter
109 bool isFilterOn( TFilter filterId ) const;
112 * Set the chat mode
113 * \param mode the chat mode
114 * \param dynChatChan If mode is dyn chat, then gives the channel
116 void setChatMode( CChatGroup::TGroupType mode, TChanID dynChatChan = NLMISC::CEntityId::Unknown);
119 * Get the chat mode
120 * \return the chat mode
122 CChatGroup::TGroupType getChatMode() const { return _ChatMode; }
125 * Get dyn chat channel. Relevant only if chat mode is CChatGroup::dyn_chat
127 TChanID getDynChatChan() const { return _DynChatChan; }
130 * Set the chat group
131 * \param gId the group's id
133 // void setChatGroup( TGroupId gId) { _ChatGroup = gId; }
135 void setTeamChatGroup( TGroupId gId)
137 _TeamChat = gId;
139 void setGuildChatGroup( TGroupId gId)
141 _GuildChat = gId;
143 void setRegionChatGroup( TGroupId gId)
145 _RegionChat = gId;
148 TGroupId getTeamChatGroup()
150 return _TeamChat;
152 TGroupId getGuildChatGroup()
154 return _GuildChat;
156 TGroupId getRegionChatGroup()
158 return _RegionChat;
162 * Get the chat group
163 * \return the group's id
165 // TGroupId getChatGroup() const { return _ChatGroup; }
168 * Update the audience of this client
170 void updateAudience();
173 * Get the dynamic chat group
174 * \return the dynamic chat group
176 CChatGroup& getAudience();
179 * Get the say dynamic chat group
180 * \return the say dynamic chat group
182 CChatGroup& getSayAudience( bool updateAudience = false );
184 TGroupId getSayAudienceId() { return _SayAudienceId; }
187 * Get the shout dynamic chat group
188 * \return the shout dynamic chat group
190 CChatGroup& getShoutAudience( bool updateAudience = false );
192 TGroupId getShoutAudienceId() { return _ShoutAudienceId; }
195 * The client now know the string
196 * \param index is the index of the string
197 * \return true if the string was already known by the client
199 bool knowString( uint32 index );
201 // store chat group subscribe
202 void subscribeInChatGroup(TGroupId groupId);
203 // store chat group unsubscribe
204 void unsubscribeInChatGroup(TGroupId groupId);
206 // unsubscribe to all chat group
207 void unsubscribeAllChatGroup();
209 void disableSendTranslation( const std::string &lang );
210 void disableReceiveTranslation( const std::string &lang );
211 void resetDisabledTranslations();
212 bool dontReceiveTranslation( const std::string &lang );
213 bool dontSendTranslation( const std::string &lang );
215 private :
217 /// CLient datasetrow
218 TDataSetRow _DataSetIndex;
219 /// client character id
220 NLMISC::CEntityId _Id;
222 /// if true : nobody will see chat message incoming from this client
223 bool _Muted;
225 /// mute start time
226 NLMISC::TTime _MuteStartTime;
228 /// mute delay (in min)
229 sint32 _MuteDelay;
231 typedef std::set<NLMISC::CEntityId> TIgnoreListCont;
232 /// this client won't see chat incoming from these characters
233 // std::set<NLMISC::CEntityId> _IgnoreList;
234 TIgnoreListCont _IgnoreList;
236 /// string filters
237 std::set<TFilter> _Filters;
239 /// current chat mode
240 CChatGroup::TGroupType _ChatMode;
241 TChanID _DynChatChan; // if _ChatMode == dyn_chta, gives the unique ID of the channel
243 /// Team chat
244 TGroupId _TeamChat;
245 /// Guild chat
246 TGroupId _GuildChat;
247 /// region chat
248 TGroupId _RegionChat;
250 /// The subscribed chat group (including team and guild chat)
251 typedef std::set<TGroupId> TSubscribedGroupCont;
252 TSubscribedGroupCont _SubscribedGroups;
255 /// current chat group
256 // TGroupId _ChatGroup;
258 /// say audience
259 // CChatGroup _SayAudience;
260 /// Say audience group id
261 NLMISC::CEntityId _SayAudienceId;
263 /// shout audience
264 // CChatGroup _ShoutAudience;
265 /// Shout audience group id
266 NLMISC::CEntityId _ShoutAudienceId;
268 /// Time of the last say audience update
269 NLMISC::TTime _SayLastAudienceUpdateTime;
271 /// Time of the last shout audience update
272 NLMISC::TTime _ShoutLastAudienceUpdateTime;
274 /// time period between 2 audience update
275 NLMISC::TTime _AudienceUpdatePeriod;
277 /// keep infos about which string has been received by the client
278 std::vector<bool> _KnownStrings;
280 std::vector<std::string> _DontReceiveTranslation;
281 std::vector<std::string> _DontSendTranslation;
284 * Update the audience of this client
286 void updateAudience( NLMISC::CEntityId &audienceId, sint maxDist, NLMISC::TTime& lastAudienceUpdateTime );
290 #endif // CHAT_CLIENT_H
292 /* End of chat_client.h */