summaryrefslogtreecommitdiff
path: root/docs/packets.txt
blob: 76db63d41e33d242c74913054a16719b747673cb (plain) (blame)
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
-------------------------
PACKET REFERENCE
-------------------------

1. INTRODUCTION
2. MESSAGE LIST
2.1 LOGIN/REGISTER
2.2 OBJECTS
2.3 BEINGS
2.4 ITEMS
2.5 CHAT PROTOCOL

1. INTRODUCTION

This is an attempt to define the protocol. The syntax of packet definition is
the following:

MESSAGE_IDENTIFIER 0xID
Description.
{
    [
    FIELDTYPE fieldName
        [
        * value = value info
        ]
    ]
}

NOTE: In this representation square brackets mean their content can be repeated
0 to n times.

- "MESSAGE_IDENTIFIER" should follow this structure:
    CMSG|SMSG[_ATTRIBUTE]_ACTION[_INFO]

    CMSG is a message sent by the client
    SMSG is a message sent by the server
    | means exclusive or

- "0xID" is hexadecimal representation of a short: from 0x0000 to 0xFFFF.

- "FIELDTYPE" is one of the following (as described in server.txt):
    A - char array (null terminated)
    C - char (1 byte)
    S - short (2 bytes)
    L - long (4 bytes)

- "fieldName" is the name of the field (choose a meaningful name).

- "value" is a list of every possible value for the field.

- "value info" is a small description of the meaning related to a
  certain value.

2. MESSAGE LIST

Message IDs are represented by a short, that means we can have 2^16
different packets. We will start from ID 0x0000.

2.1 LOGIN/REGISTER

CMSG_REGISTER 0x0000
Request to register a new account. Email verification by activation would
probably be good to add. Password will be sent only as md5 to hide the actual
password from both server admins and sniffers. Having the md5 would still allow
false identification, hence there is also an encrypted variant of this message.
{
    A username
    A password
    A emailAddress
}

CMSG_ENCRYPTED_REGISTER 0x0001
Request to register a new account encrypting user data. The contents of this
message are encrypted using server's public key and are otherwise the same as
in a normal register message.
{
    A username
    A password
    A emailAddress
}

SMSG_REGISTER_RESPONSE 0x0002
Response to register message. Error code 0 means registration was a success.
Error codes 1-3 shouldn't happen because there are also checked client side,
otherwise it could mean client is out of date or modified. Every error not in
this list should be considered unknown error.
{
    C errorCode
        * 0 = registration succeeded
        * 1 = invalid username
        * 2 = invalid password
        * 3 = invalid email address
        * 4 = existing username
        * 5 = existing email address
}

CMSG_LOGIN 0x0010
Sends info about player login data: username and password.
{
    A username
    A password
    L clientVersion
}

CMSG_ENCRYPTED_LOGIN 0x0011
Attempts an encrypted login. payload contains username and password encrypted
using server's public key.
{
    A payload
    L clientVersion
}

SMSG_LOGIN_ERROR 0x0012
The login process failed.
{
    C errorCode
        * 0 = invalid username
        * 1 = invalid password
        * 2 = invalid version (client is sending a version number > than
                               current one)
        * 2 = non existing username
        * 3 = incorrect password
        * 4 = old version (the client is outdated)
        * 5 = server down for maintenance
        * 6 = server full
        * 7 = account definitely banned
        * 8 = account under review
}

SMSG_LOGIN_CONFIRM 0x0013
The login process succeded. The content of this packet depends on account and
player implementation. Still to be developed.
{
    L accountId        // What would the client do with this id? - Hammerbear
    C number of characters
    [                  // Repeated for each character
      A name
      C hairStyle
      C hairColor
      C sex
          * 0 = male
          * 1 = female
      ...
    ]
}

CMSG_CHAR_CREATE 0x0020
Valid after login, this message sends a request for a new character to the
server. The message could be extended with region of origin and race.
{
    A name
    C hairStyle
    C hairColor
	C faceType
    C sex
        * 0 = male
        * 1 = female
    ...
}

SMSG_CHAR_CREATE_RESPONSE 0x0021
Response to character create message. Error code 0 means creation was a
success. Error codes 1-4 should not occur as they are also checked by the
client. Any not listed error codes are unknown errors.
{
    C errorCode
        * 0 = character creation succeeded
        * 1 = invalid name
        * 2 = invalid hair style
        * 3 = invalid hair color
        * 4 = invalid sex
        * 5 = existing username
        * 6 = existing email address
}


2.2 OBJECTS

SMSG_NEW_OBJECT 0x0100
An item was dropped.
{
	L itemId
	S x, y
}