00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined(__INCLUDE_ChannelTexth_INCLUDE__)
00022 #define __INCLUDE_ChannelTexth_INCLUDE__
00023
00024 #include <string>
00025 #include <vector>
00026 #include <net/NetBuffer.h>
00027
00028 class ChannelDefinition
00029 {
00030 public:
00031 enum ChannelDefinitionTypes
00032 {
00033 eReadOnlyChannel = 1,
00034 eWhisperChannel = 2
00035 };
00036
00037 ChannelDefinition(const char *channel = "",
00038 unsigned int type = 0);
00039
00040 const char *getChannel() { return channel_.c_str(); }
00041 void setChannel(const char *c) { channel_ = c; }
00042
00043 unsigned int getType() { return type_; }
00044 void setType(unsigned int t) { type_ = t; }
00045
00046 protected:
00047 std::string channel_;
00048 unsigned int type_;
00049 };
00050
00051 class ChannelText
00052 {
00053 public:
00054 enum Flags
00055 {
00056 eNoLog = 1,
00057 eNoSound = 2
00058 };
00059
00060 ChannelText();
00061 ChannelText(
00062 const std::string &channel,
00063 const LangString &message);
00064 ChannelText(
00065 const std::string &channel,
00066 const std::string &key,
00067 const std::string &value);
00068 ChannelText(
00069 const std::string &channel,
00070 const std::string &key,
00071 const std::string &value,
00072 const LangStringConverter ¶m1);
00073 ChannelText(
00074 const std::string &channel,
00075 const std::string &key,
00076 const std::string &value,
00077 const LangStringConverter ¶m1,
00078 const LangStringConverter ¶m2);
00079 ChannelText(
00080 const std::string &channel,
00081 const std::string &key,
00082 const std::string &value,
00083 const LangStringConverter ¶m1,
00084 const LangStringConverter ¶m2,
00085 const LangStringConverter ¶m3);
00086 ChannelText(
00087 const std::string &channel,
00088 const std::string &key,
00089 const std::string &value,
00090 const LangStringConverter ¶m1,
00091 const LangStringConverter ¶m2,
00092 const LangStringConverter ¶m3,
00093 const LangStringConverter ¶m4);
00094
00095 void setChannel(const std::string &channel) { channel_ = channel; }
00096 void setMessage(const LangString &message) { message_ = message; }
00097 void setMessageKey(const std::string &key) { messageKey_ = key; }
00098 void setMessageValue(const std::string &value) { messageValue_ = value; }
00099 void setSrcPlayerId(unsigned int srcPlayerId) { srcPlayerId_ = srcPlayerId; }
00100 void setDestPlayerId(unsigned int destPlayerId) { destPlayerId_ = destPlayerId; }
00101 void setFlags(unsigned int flags) { flags_ = flags; }
00102 void setAdminPlayer(const std::string &admin) { admin_ = admin; }
00103
00104 const std::string &getChannel() { return channel_; }
00105 const LangString &getMessage();
00106 const std::string &getAdminPlayer() { return admin_; }
00107 const std::string &getMessageKey() { return messageKey_; }
00108 const std::string &getMessageValue() { return messageValue_; }
00109 const std::vector<LangString> &getMessageParams() { return messageParams_; }
00110 unsigned int getSrcPlayerId() { return srcPlayerId_; }
00111 unsigned int getDestPlayerId() { return destPlayerId_; }
00112 unsigned int getFlags() { return flags_; }
00113
00114 virtual bool writeMessage(NetBuffer &buffer);
00115 virtual bool readMessage(NetBufferReader &reader);
00116
00117 protected:
00118 unsigned int srcPlayerId_;
00119 unsigned int destPlayerId_;
00120 unsigned int flags_;
00121 std::string messageKey_;
00122 std::vector<LangString> messageParams_;
00123 std::string messageValue_;
00124 std::string channel_;
00125 LangString message_;
00126 std::string admin_;
00127 };
00128
00129 #endif // __INCLUDE_ChannelTexth_INCLUDE__