summaryrefslogtreecommitdiff
path: root/src/net/protocol.h
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-07-25 18:04:38 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-07-25 18:04:38 +0000
commitc7e7b62aa94bf295ca1dc556762ad6070221e0cd (patch)
tree04f827df0df64a80e04a4115986609486d715237 /src/net/protocol.h
parentc0c8775271679ac4904bc0bc02a74d28fc75efd0 (diff)
downloadmana-client-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.gz
mana-client-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.bz2
mana-client-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.xz
mana-client-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.zip
Switched client to use enet and modified login sequence to work with the new protocol from tmwserv.
Diffstat (limited to 'src/net/protocol.h')
-rw-r--r--src/net/protocol.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 72b459ed..0db4dfb0 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -104,6 +104,103 @@
#define CMSG_PLAYER_EQUIP 0x00a9
#define CMSG_PLAYER_UNEQUIP 0x00ab
+/**
+ * Enumerated type for communicated messages
+ * - PAMSG_*: from client to account server
+ * - APMSG_*: from account server to client
+ * - PCMSG_*: from client to chat server
+ * - CPMSG_*: from chat server to client
+ * - PGMSG_*: from client to game server
+ * - GPMSG_*: from game server to client
+ * Components: B byte, W word, D double word, S variable-size string
+ */
+enum {
+ // Login/Register
+ PAMSG_REGISTER = 0x0000, // S version, S username, S password, S email
+ APMSG_REGISTER_RESPONSE = 0x0002, // B error
+ PAMSG_UNREGISTER = 0x0003, // -
+ APMSG_UNREGISTER_RESPONSE = 0x0004, // B error
+ PAMSG_LOGIN = 0x0010, // S version, S username, S password
+ APMSG_LOGIN_RESPONSE = 0x0012, // B error
+ PAMSG_LOGOUT = 0x0013, // -
+ APMSG_LOGOUT_RESPONSE = 0x0014, // B error
+ PAMSG_CHAR_CREATE = 0x0020, // S name, B hair style, B hair color, B gender, W*6 stats
+ APMSG_CHAR_CREATE_RESPONSE = 0x0021, // B error
+ PAMSG_CHAR_DELETE = 0x0022, // B index
+ APMSG_CHAR_DELETE_RESPONSE = 0x0023, // B error
+ PAMSG_CHAR_LIST = 0x0024, // -
+ APMSG_CHAR_LIST_RESPONSE = 0x0025, // B number, { B index, S name, B gender, B hair style, B hair color, B level, W money, W*6 stats, S mapname, W*2 position }*
+ PAMSG_CHAR_SELECT = 0x0026, // B index
+ APMSG_CHAR_SELECT_RESPONSE = 0x0027, // B error, S mapname, W*2 position
+ PAMSG_EMAIL_CHANGE = 0x0030, // S email
+ APMSG_EMAIL_CHANGE_RESPONSE = 0x0031, // B error
+ PAMSG_EMAIL_GET = 0x0032, // -
+ APMSG_EMAIL_GET_RESPONSE = 0x0033, // B error, S email
+ PAMSG_PASSWORD_CHANGE = 0x0034, // S old password, S new password
+ APMSG_PASSWORD_CHANGE_RESPONSE = 0x0035, // B error
+ PAMSG_ENTER_WORLD = 0x0040, // -
+ APMSG_ENTER_WORLD_RESPONSE = 0x0041, // B error, S address, W port, B*32 token
+ PAMSG_ENTER_CHAT = 0x0042, // -
+ APMSG_ENTER_CHAT_RESPONSE = 0x0043, // B error, S address, W port, B*32 token
+ PGMSG_CONNECT = 0x0050, // B*32 token
+ GPMSG_CONNECT_RESPONSE = 0x0051, // B error
+ PCMSG_CONNECT = 0x0053, // B*32 token
+ CPMSG_CONNECT_RESPONSE = 0x0054, // B error
+
+ // Game
+ PGMSG_PICKUP = 0x0110,
+ GPMSG_PICKUP_RESPONSE = 0x0111,
+ GPMSG_BEING_ENTER = 0x0200, // B type, L being id
+ // player: S name, B hair style, B hair color, B gender
+ GPMSG_BEING_LEAVE = 0x0201, // B type, L being id
+ PGMSG_WALK = 0x0260, // L*2 destination
+ PGMSG_SAY = 0x02A0, // S text
+ GPMSG_SAY = 0x02A1, // S being, S text
+ PGMSG_USE_ITEM = 0x0300, // L item id
+ GPMSG_USE_RESPONSE = 0x0301, // B error
+ PGMSG_EQUIP = 0x0302, // L item id, B slot
+ GPMSG_EQUIP_RESPONSE = 0x0303, // B error
+
+ // Chat
+ CPMSG_ERROR = 0x0401, // B error
+ CPMSG_ANNOUNCEMENT = 0x0402, // S text
+ CPMSG_PRIVMSG = 0x0403, // S user, S text
+ CPMSG_PUBMSG = 0x0404, // W channel, S user, S text
+ PCMSG_CHAT = 0x0410, // S text, W channel
+ PCMSG_ANNOUNCE = 0x0411, // S text
+ PCMSG_PRIVMSG = 0x0412, // S user, S text
+ // -- Channeling
+ PCMSG_REGISTER_CHANNEL = 0x0413, // B pub/priv, S name, S announcement, S password
+ CPMSG_REGISTER_CHANNEL_RESPONSE = 0x0414, // B error
+ PCMSG_UNREGISTER_CHANNEL = 0x0415, // W channel
+ CPMSG_UNREGISTER_CHANNEL_RESPONSE = 0x0416, // B error
+ CPMSG_CHANNEL_EVENT = 0x0418, // W channel, B event, S user
+ PCMSG_ENTER_CHANNEL = 0x0419, // W channel, S password
+ CPMSG_ENTER_CHANNEL_RESPONSE = 0x0420, // B error
+ PCMSG_QUIT_CHANNEL = 0x0421, // W channel
+ CPMSG_QUIT_CHANNEL_RESPONSE = 0x0422, // B error
+
+ XXMSG_INVALID = 0x7FFF
+};
+
+// Generic return values
+
+enum {
+ ERRMSG_OK = 0, // everything is fine
+ ERRMSG_FAILURE, // the action failed
+ ERRMSG_NO_LOGIN, // the user is not yet logged
+ ERRMSG_NO_CHARACTER_SELECTED, // the user needs a character
+ ERRMSG_INSUFFICIENT_RIGHTS, // the user is not privileged
+ ERRMSG_INVALID_ARGUMENT, // part of the received message was invalid
+};
+
+// Login specific return values
+enum {
+ LOGIN_INVALID_VERSION = 0x40, // the user is using an incompatible protocol
+ LOGIN_SERVER_FULL // the server is overloaded
+};
+
+
/** Encodes coords and direction in 3 bytes data */
void set_coordinates(char *data, unsigned short x, unsigned short y, unsigned char direction);