------------------------- 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 }