-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_define.h
231 lines (194 loc) · 5.65 KB
/
message_define.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/*
* message_define.h
*
* Created on: 2013年8月22日
* Author: 1854
*/
#ifndef MESSAGE_DEFINE_H_
#define MESSAGE_DEFINE_H_
#include "frame_msg_impl.h"
#include "server_namespace.h"
#include "common/common_string.h"
#include "common/common_singleton.h"
#include "frame_msg_impl.h"
#include "def.h"
FRAME_ROBOT_NAMESPACE_BEGIN
//玩家登陆游戏请求
#define MSGID_LOGINGAME_REQ 5
class CLoginGameReq : public IMsgBody
{
public:
CLoginGameReq()
{
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
CString<MAX_USERNAME_LENGTH> strUserName;
CString<MAX_PASSWORD_LENGTH> strPassword;
};
typedef uint8_t LoginGameResult;
enum
{
LOGIN_SUCCESS = 0x00,
LOGIN_INFO_ERROR = 0x01,
LOGIN_USER_ONLINE = 0x02,
};
#define MSGID_LOGINGAME_RESP 6
class CLoginGameResp : public IMsgBody
{
public:
CLoginGameResp()
{
m_nResult = 0;
m_nPlayerID = 0;
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
LoginGameResult m_nResult;
int32_t m_nPlayerID;
uint32_t m_nUserID;
uint8_t m_nSex;
uint8_t m_arrNickName[48];
uint8_t m_nUserCountry;
uint8_t m_nUserMajor;
uint8_t m_nUserLevel;
uint8_t m_nUserHair;
};
#define MSGID_ENTERGAME_REQ 11
class CEnterGameReq : public IMsgBody
{
public:
CEnterGameReq()
{
m_nIsRelogin = 0;
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
uint8_t m_nIsRelogin;
};
#define MSGID_WORLDCHAT_REQ 18
class CWorldChatReq : public IMsgBody
{
public:
CWorldChatReq()
{
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
uint32_t m_nUserID;
uint8_t m_nInfoType;
uint8_t m_nNameLen;
uint8_t m_nChatLen;
CString<MAX_USERNAME_LENGTH> m_strUserName;
CString<MAX_CHATCONTENT_LENGTH> m_strChatContent;
};
#define MSGID_WORLDCHAT_RESP 18
class CWorldChatResp : public IMsgBody
{
public:
CWorldChatResp()
{
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
uint32_t m_nUserID;
uint8_t m_nUserCountry;
uint8_t m_nUserTitle;
uint8_t m_nInfoType;
uint8_t m_nNameLen;
uint8_t m_nChatLen;
CString<MAX_USERNAME_LENGTH> m_strUserName;
CString<MAX_CHATCONTENT_LENGTH> m_strChatContent;
};
#define MSGID_HEARTBEAT_REQ 33
class CHeartBeatReq : public IMsgBody
{
public:
CHeartBeatReq()
{
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
};
#define MSGID_CHANGEMAP_REQ 157
class CChangeMapReq : public IMsgBody
{
public:
CChangeMapReq()
{
m_nNewMapID = 0;
m_nCoordX = 0;
m_nCoordY = 0;
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
int32_t m_nNewMapID;
int32_t m_nCoordX;
int32_t m_nCoordY;
};
#define MSGID_PLAYERMOVE_REQ 16
class CPlayerMoveReq : public IMsgBody
{
public:
CPlayerMoveReq()
{
m_nCoordX = 0;
m_nCoordY = 0;
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
int32_t m_nCoordX;
int32_t m_nCoordY;
};
#define MSGID_PLAYERMOVE_NOTI 17
class CPlayerMoveNoti : public IMsgBody
{
public:
CPlayerMoveNoti()
{
m_nUserID = 0;
m_nCoordX = 0;
m_nCoordY = 0;
m_nLastActTime = 0;
}
virtual int32_t GetSize();
virtual int32_t MessageEncode(uint8_t* buf, const uint32_t size, uint32_t& offset);
virtual int32_t MessageDecode(const uint8_t *buf, const uint32_t size, uint32_t& offset);
virtual void Dump(char* buf, const uint32_t size, uint32_t& offset);
public:
int32_t m_nUserID;
int32_t m_nCoordX;
int32_t m_nCoordY;
int32_t m_nLastActTime;
};
//只有接收的消息才加映射
MESSAGEMAP_DECL_BEGIN(message)
MESSAGEMAP_DECL_MSG(MSGID_LOGINGAME_RESP, new CLoginGameResp())
MESSAGEMAP_DECL_MSG(MSGID_WORLDCHAT_RESP, new CWorldChatResp())
//MESSAGEMAP_DECL_MSG(MSGID_PLAYERMOVE_NOTI, new CPlayerMoveNoti())
MESSAGEMAP_DECL_END()
FRAME_ROBOT_NAMESPACE_END
#endif /* MESSAGE_DEFINE_H_ */