The network protocol for this client follows a different structure for each 
message id.  If the client or server does not know an id, it cannot recover 
and MUST force a disconnect.  This is because there is no way to know how long
a message is without understanding that message.

For the PW implementation, the messages between the client and the server send 
in Big-Endian (Network Byte Order).  Messages between spring and the client 
are little-endian.  For the purpose of this document, only messages that are 
sent between the client and server are included.  Also note that PW uses a
GUID not an Int for channel ids, and this version of the client reflects that change.

Each message starts off with a single byte ID, identified by the PACKETS enum.
Any message sent as a string is encoded in ASCII right-padded with 0 bytes
to the max size of that string.

Below are the structures for each packet as I have identified them by 
looking at the source:

PACK_LOGIN				=1,
The login packet is sent only from the client to the server.
It contains these parameters:
1 byte: The Major version of the client's protocol
1 byte: The Minor version of the client's protocol
[MAXNAME] bytes: The user's username
[MAXPASS] bytes: The user's password

PACK_LOGINFAILED		=9,
If a login request fails, the server returns a LOGINFAILED packet.
It contains a single byte parameter with the reason for the failure.
This is the LOGINERROR enum

PACK_LOGGEDIN			=8,
For a successful login, the server return's this packet.
Its parameters are:
4 bytes: The user's ID number as a 32-bit integer
[MAXNAME] bytes: The user's username
		
PACK_CHATMESSAGE		=2,
This packet handles chat messages in both directions.
Note that the structure is different depending on which direction.

From the client to the server:
2 bytes: The size of the message string as an unsigned 16-bit integer
16 bytes: The GUID of the channel to send the message to
[length] bytes: The message encoded in ASCII

From the server to the client:
2 bytes: The size of the chat message string as an unsigned 16-bit integer
4 bytes: The id of the user who sent the message
16 bytes: The GUID of the channel to which the message belongs
[length] bytes: The message encoded in ASCII

PACK_REQJOINCHAT		=3,
This message is from the client to the server only.
It is a request to join a chat room based on the channel GUID
The only parameter is the 16-byte GUID

PACK_CHATLIST			=4,
This message is from the server to the client only.  It contains
all the channels currently active on the server, and is sent during login only.
The parameters are:
2 bytes: The number of channels to receive

Each channel is made up of the following:
16 bytes: The GUID of the channel
2 bytes: The number of users in the channel
[MAXCHATNAME] bytes: The name of the channel

PACK_BOOTFROMCHAT		=5,
This message appears to notify a user they have been booted from chat, but 
currently does not do anything.

PACK_KILLCHAT			=6,
This message does not do anything as yet.

PACK_KICKEDFROMCHAT		=7,
This message does not do anything as yet.

PACK_BLOCKED			=10,
This message follows the same structure as LOGINFAILED.  I am not sure the purpose of it.

PACK_JOINCHAT			=11,
This message is sent from the server to the client only when a user joins a chat room.
It contains the list of users in the room, and is structured as follows:
16 bytes: The GUID of the channel to join
4 bytes: The number of users in the channel

Each user contains these parameters:
4 bytes: The ID of the user
MAXNAME bytes: The username of the user
MAXCLAN bytes: The clan of the user

PACK_LEAVECHAT			=12,
This is sent from the client to server informing the server 
the user closed a chat window
The only parameter is the 16 byte GUID of the channel

PACK_USERENTERCHAT		=13,
This is sent from the server to the client when a user enters a chat room
The parameters are:
16 bytes: GUID of the channel
4 bytes: User ID of the new user
MAXNAME bytes: Username of the new user
MAXCLAN bytes: Clan name of the new user

PACK_USERLEAVECHAT		=14,
This is sent from the server to the client when a user leaves a chat room
The parameters are:
16 bytes: GUID of the channel
4 bytes: User ID of the user leaving

PACK_REGISTER			=15,
PACK_REGISTERSUCCESS	=35,
PACK_REGISTERFAILED		=36,
These are not used by PW and MUST NOT be sent to the server.

PACK_JOINBATTLE			=16,
PACK_LEAVEBATTLE		=17,
PACK_USERENTERBATTLE	=18,
PACK_USERLEAVEBATTLE	=19,
PACK_REQJOINBATTLE		=20,
PACK_BATTLEMESSAGE		=21,
These don't seem to be used?

PACK_BATTLELIST			=22,
This is sent from the server to the client during login 
and contains a list of all games currently running.
The parameters are:
4 bytes: Number of battles

Each battle consists of the following:
4 bytes: Battle ID as Unsigned Integer
MAXBATTLENAME bytes: Name of battle
MAXCLAN bytes: Clan name of host
MAXNAME bytes: Name of host
2 bytes: Port of host as unsigned short
1 byte: Max Number of players
4 bytes: Interface Address? (possibly IPv4 address?)
MAXMAPNAME bytes: Name of map
1 byte: Boolean Has Password
1 byte: Current Number of players
1 byte: Boolean In Progress

PACK_BOOTFROMBATTLE		=23,
Not used currently

PACK_CREATECHAT			=24,
This message can be sent from the client or the server,
and has a different structure for each.

From Server To Client:
Tells the client about a new channel
16 bytes: Channel GUID
MAXCHAT bytes: Channel Name

From Client To Server:
Requests to create a new channel
MAXCHAT bytes: Name of new channel

PACK_CREATEBATTLE		=25,
This can be sent from the client or the server,
and has a different structure for each.

From Server To Client:
Tells client about a new battle
4 bytes: Battle ID as unsigned integer
MAXBATTLENAME bytes: Name of battle
MAXCLAN bytes: Clan of host
MAXNAME bytes: Name of host
2 bytes: Port of host, as unsigned short
1 byte: Max Number of Players
4 bytes: Interface Address (IPv4 address of host?)
MAXMAPNAME bytes: Name of Map
1 byte: Boolean Has Password
Note Current Players defaults to 1 in this case, and in play defaults to false

From Client To Server:
Requests creation of a battle
MAXBATTLENAME bytes: Name of battle
1 byte: Max Players
2 bytes: Port as Unsigned Short
MAXMAPNAME bytes: Name of Map
1 byte: Boolean Has Password

PACK_KICKEDFROMBATTLE	=26,
Not currently used

PACK_DESTROYBATTLE		=27,
This is sent from the server to client, saying that a battle is over.
The only parameter is the 4 byte unsigned id.

It is also sent from the client to the server, with no parameters.

PACK_CHATCREATESUCCESS	=28,
This is not currently used

PACK_FAILEDCREATECHAT	=29,
No parameters, simply error creating chat room.

PACK_CHATDESTROYED		=30,
Sent from the server to the client informing a chat room is deleted
Only parameter is 16 byte GUID

PACK_BATTLECREATESUCCESS =31,
Sent from server to client
Parameters:
4 bytes: Unsigned Battle ID
2 bytes: Port Unsigned short
MAXMAPNAME bytes: Name of map
1 byte: Boolean has password
1 byte: Max Players

PACK_BATTLECREATEFAILED	=32,
Server to client if there is an error creating a battle
No parameters

PACK_BATTLELOGGEDIN		=33,
This appears to be sent from Spring to the client during a battle join

PACK_INTERNALBATTLELIST =34,
Does not appear to be used

PACK_KEEPALIVE			=37,
Sent from the client to the server as a ping
No parameters

PACK_IPOVERRIDE			=38,
Sent from the client to the server to set an override IP for firewalls
4 bytes: IP address, or 0 to disable override

PACK_CHATSIZEUPDATE		=39,
Sent from server to client updating a channel's size
Parameters:
16 bytes: Channel GUID
2 bytes: New Number of Users

PACK_BATTLELOGINFAILED	=40,
Appears to be used between client and spring

PACK_BATTLESIZEUPDATE	=41,
Sent from server to client, new number of users
Parameters:
4 bytes: Unsigned Battle ID
1 byte: New Number of Users

Sent from client to server, updating user count
It appears only the host keeps track of who is in a game
Parameters:
1 byte: New Number of Users (game id is not sent)

PACK_MAPUPDATE			=42,
Sent from client or from server, updating a battle's map
To Client Parameters:
4 bytes: Unsigned Battle ID
MAXMAPNAME bytes: New Map Name

To Server Parameters:
MAXMAPNAME bytes: New Map Name
Game ID is not sent

PACK_BATTLEPROGRESS		=43,
Sent from client or server, updating a battle's state
Parameters:
4 bytes: Unsigned Battle ID
1 byte: Battle State

PACK_BATTLETEST			=44
Appears to be some kind of test message?