Skip to content

Message

Michał Kapała edited this page Aug 27, 2024 · 9 revisions

Game data protocol used by router service. By default uses TCP, however UDP traffic is possible too.

Header

The header differs slightly depending on property:

  1. GSMessage and GSEncryptMessage
struct GSMessageHeader {
  unsigned int size;
  unsigned char msgFlags;
  unsigned char type;
  unsigned char senderReceiver;
};
  1. GameMessage
struct GameMessageHeader {
  unsigned int size;
  unsigned char msgFlags;
  unsigned char type;
  unsigned short sender;
};

Size

The message's size in bytes, self-inclusive (3 bytes, big endian).

Message flags

The 4th byte is divided into property (2b) and priority (6b) values.

Priority

The priority of a message (6 least significant bits).

Property

The upper 2 bits encode the message's variant:

Value Variant Encryption
0 GSMessage GSXOR
1 GameMessage -
2 GSEncryptMessage Blowfish

Type

Identifier of the payload.

ID Message type
1 NEWUSERREQUEST
2 CONNECTIONREQUEST
3 PLAYERNEW
4 DISCONNECTION
5 PLAYERREMOVED
6 EVENT_UDPCONNECT
7 NEWS
8 SEARCHPLAYER
9 REMOVEACCOUNT
11 SERVERSLIST
13 SESSIONLIST
15 PLAYERLIST
16 GETGROUPINFO
17 GROUPINFO
18 GETPLAYERINFO
19 PLAYERINFO
20 CHATALL
21 CHATLIST
22 CHATSESSION
24 CHAT
26 CREATESESSION
27 SESSIONNEW
28 JOINSESSION
31 JOINNEW
32 LEAVESESSION
33 JOINLEAVE
34 SESSIONREMOVE
38 GSSUCCESS
39 GSFAIL
40 BEGINGAME
45 UPDATEPLAYERINFO
48 MASTERCHANGED
51 UPDATESESSIONSTATE
52 URGENTMESSAGE
54 NEWWAITMODULE
55 KILLMODULE
58 STILLALIVE
59 PING
60 PLAYERKICK
61 PLAYERMUTE
62 ALLOWGAME
63 FORBIDGAME
64 GAMELIST
65 UPDATEADVERTISMEMENTS
66 UPDATENEWS
67 VERSIONLIST
68 UPDATEVERSIONS
70 UPDATEDISTANTROUTERS
71 ADMINLOGIN
72 STAT_PLAYER
73 STAT_GAME
74 UPDATEFRIEND
75 ADDFRIEND
76 DELFRIEND
77 LOGINWAITMODULE
78 LOGINFRIENDS
79 ADDIGNOREFRIEND
80 DELIGNOREFRIEND
81 STATUSCHANGE
82 JOINARENA
83 LEAVEARENA
84 IGNORELIST
85 IGNOREFRIEND
86 GETARENA
87 GETSESSION
88 PAGEPLAYER
89 FRIENDLIST
90 PEERMSG
91 PEERPLAYER
92 DISCONNECTFRIENDS
93 JOINWAITMODULE
94 LOGINSESSION
95 DISCONNECTSESSION
96 PLAYERDISCONNECT
97 ADVERTISEMENT
98 MODIFYUSER
99 STARTGAME
100 CHANGEVERSION
101 PAGER
102 LOGIN
103 PHOTO
104 LOGINARENA
106 SQLCREATE
107 SQLSELECT
108 SQLDELETE
109 SQLSET
110 SQLSTAT
111 SQLQUERY
127 ROUTEURLIST
131 DISTANCEVECTOR
132 WRAPPEDMESSAGE
133 CHANGEFRIEND
134 NEWRELFRIEND
135 DELRELFRIEND
136 NEWIGNOREFRIEND
137 DELETEIGNOREFRIEND
138 ARENACONNECTION
139 ARENADISCONNECTION
140 ARENAWAITMODULE
141 ARENANEW
143 NEWBASICGROUP
144 ARENAREMOVED
145 DELETEBASICGROUP
146 SESSIONSBEGIN
148 GROUPDATA
151 ARENA_MESSAGE
157 ARENALISTREQUEST
158 ROUTERPLAYERNEW
159 BASEGROUPREQUEST
166 UPDATEPLAYERPING
169 UPDATEGROUPSIZE
179 SLEEP
180 WAKEUP
181 SYSTEMPAGE
189 SESSIONOPEN
190 SESSIONCLOSE
192 LOGINCLANMANAGER
193 DISCONNECTCLANMANAGER
194 CLANMANAGERPAGE
195 UPDATECLANPLAYER
196 PLAYERCLANS
199 GETPERSISTANTGROUPINFO
202 UPDATEGROUPPING
203 DEFERREDGAMESTARTED
204 PROXY_HANDLER
205 BEGINCLIENTHOSTGAME
209 LOBBY_MSG
210 LOBBYSERVERLOGIN
211 SETGROUPSZDATA
212 GROUPSZDATA
219 KEY_EXCHANGE
221 REQUESTPORTID
222 REQUESTMOTD

Sender/receiver

This field varies depending on the property's value.

For both GS message variants, the 6th byte is split:

  • upper nibble is sender
  • lower nibble is receiver
Value Sender/receiver
1 R
2 S
3 W
4 P
5 AP
6 B
7 LP
8 UNK
9 G
10 A

For game messages instead there's only sender (u16).

Payload

The payload is a DataList with format depending on the type of a request.

GSSUCCESS

The server's response indicating the previous request (referenced by its message type) was processed successfully.

It can be extended with additional data appended at the end.

[b'<request type byte>']

LOGINWAITMODULE

Authentication request to a wait module.

Request

['username']

Response

Standard GSSUCCESS.

JOINWAITMODULE

A service's redirection to its wait module.

Request

No payload.

Response

An extended GSSUCCESS. The wait module's port is a little-endian u32 buffer.

[b'request type byte', ['wm host', b'port']]

LOGIN

Login form data. This is the only known GSEncryptMessage to be used.

Request

['username', 'password', 'game name', b'save pass flag']

Response

Standard GSSUCCESS.