Skip to content
YVT edited this page Jan 4, 2017 · 25 revisions

ENet Packets

S2C: server to client C2S: client to server

17: Chat Message [S2C/C2S]

C2S variant:

+-----------------------+
|  Sender Player ID (8) |
+-----------------------+
|  Message Type (8)     |
+-----------------------+----+
|  Text ...                  |
+----------------------------+

Text is a string of the type ChatMessageString.

There are no further differences from the original protocol.

S2C variant:

+-----------------------+
|  Sender Player ID (8) |
+-----------------------+
|  Message Type (8)     |
+-----------------------+----+
|  Text ...                  |
+----------------------------+

Text is a string of the type ChatMessageString.

If Message Type is 2 and Text starts with N% , !% , or %% , then it will be handled specially by the OpenSpades client. This behavior can be disabled by the user by setting cg_serverAlert to 0.

  • N% : Displays a "Notice" alert.
  • !% : Displays a "Error" alert accompanied with a sound.
  • %% : Displays a "Warning" alert accompanied with a sound.

There are no further differences from the original protocol.

33: Version Get [S2C]

This is a new packet type introduced in OpenSpades.

(empty)

The OpenSpades client will send back a Version Send upon receiving this packet.

34: Version Send [C2S]

This is a new packet type introduced in OpenSpades.

+--------------------+
|  Magic? 'o' (8)    |
+--------------------+
|  Major version (8) |
+--------------------+
|  Minor version (8) |
+--------------------+
|  Revision (8)      |
+--------------------+-------+
|  Operating System Name ... |
+----------------------------+

Contains the version number of the currently running OpenSpades client software.

Operating System Name contains a human-readable ASCII encoded string, and does NOT end with a null character, The value of the field is not formally defined but it's usually one of "Linux", "Mac OS X", "Windows 2000", "Windows XP", "Windows XPx64", "Windows Vista", "Windows 7", "Windows 8", "Windows 8.1", [TODO: what about windows 10?], "Unknown OS".

Example: OpenSpades 0.1.0 running on macOS would send 6F 00 01 00 4d 61 63 20 4f 53 20 58.

Type: ChatMessageString

In the original client (AoS 0.75β) the chat text was encoded using CP437 (code page 437). OpenSpades extends this by supporting UTF-8.

UTF-8 encoded strings are distinguished by the prefix byte ff. For example, the text ほげ will be encoded to ff e3 81 bb e3 81 92. A string without the prefix shall be decoded as a CP437 string.

The OpenSpades client will send a UTF-8 string only in the circumstances where the string cannot encoded with CP437 and the user has not disabled this behavior by setting cg_unicode to 0. In other cases the string will be encoded with CP437, and all characters unrepresentable in CP437 will be replaced with U+00A0, which will be encoded to ff with CP437.