Valhalla Legends Forums Archive | General Programming | BnChat Protocol Specification

AuthorMessageTime
JoeTheOdd
A few days ago I got *really* bored and wrote this up, while working on prjTAHCBot. I think someone could use this, instead of actually having to look it all up themselves. :)

[code]BNCHAT PROTOCOL SPECIFICATION
DOCUMENT VERSION V1.0
WRITTEN BY JOETHEODD

Definitions:
Packet - A line of data sent from the server to the client. These can be sent together, delimited by a CRLF.
String - A string of characters terminated by a space.
String Array - A set of strings contained within a set of ASCII Character 34's (Quotation marks). These will be denoted as STRING[]
Integer - Like a string, but always a number. This is a Base-16 integer.
Product ID - The foreward, 4-byte product code, contained within brackets ("[ ]")

Basic Packet Format:
(STRING) Packet ID
(STRING) Packet Name
(VOID)  Packet Data

Packet 1001 - USER:
This packet is sent when the client joins a channel, knotifing the client there is a user in the channel.
(STRING)  Username
(INTEGER) Flags
(STRING)  Product ID

Packet 1002 - JOIN:
This packet is sent when a user joins the client's channel.
(STRING)  Username
(INTEGER) Flags
(STRING)  Product ID

Packet 1003 - LEAVE:
This packet is sent when a user leaves the client's channel.
(STRING)  Usernanme
(INTEGER) Flags

Packet 1005 - TALK:
This packet is sent whenever a user talks.
(STRING)  Username
(STRING[]) Message

Packet 1007 - CHANNEL:
This packet is sent once a client joins a channel.
(STRING[]) Channel name

Packet 1018 - INFO:
(STRING[]) Message

Packet 2000 - NULL:
This is a keepalive packet an should be completely ignored.
No packet format.

Packet 2010 - NAME:
This packet is sent when a client logs on. This specifys the unique username.
(STRING) Unique Username[/code]
April 4, 2005, 8:47 AM
LoRd
The beauty of a good text-based protocol is that it needs no explaining.  Also, BnetDocs has had these event ID's listed for quite some time now.

[quote]Event IDs:

[0x01] EID_SHOWUSER: User in channel
[0x02] EID_JOIN: User joined channel
[0x03] EID_LEAVE: User left channel
[0x04] EID_WHISPER: Recieved whisper
[0x05] EID_TALK: Chat text
[0x06] EID_BROADCAST: Server broadcast
[0x07] EID_CHANNEL: Channel information
[0x09] EID_USERFLAGS: Flags update
[0x0A] EID_WHISPERSENT: Sent whisper
[0x0D] EID_CHANNELFULL: Channel full
[0x0E] EID_CHANNELDOESNOTEXIST: Channel doesn't exist
[0x0F] EID_CHANNELRESTRICTED: Channel is restricted
[0x12] EID_INFO: Information
[0x13] EID_ERROR: Error message
[0x17] EID_EMOTE: Emote


View consts: [pas cpp vb]

Notes on some EIDs follow. Those not mentioned below are self-explanatory.

EID_SHOWUSER:
This is sent for each user who is already in a channel when you join it, as opposed to EID_JOIN, which is sent when a user joins a channel you have already joined. It is also sent when logged on using D2XP/D2DV and a user requires an update to their statstring - for example, by logging a different character onto a realm.

EID_BROADCAST:
The username supplied for this event is now always 'Battle.net'. Historically, username contained the name of the Battle.net Administrator who sent the broadcast.

EID_CHANNEL:
The flags field for this event is used and indicates what special conditions exist for the channel in question. See [Battle.net Flags] for more information.

EID_USERFLAGS:
This is sent to inform the client of an update to one or more user's flags. Battle.net always sends this event for every user in the channel, even if only one user's flags have changed. This behaviour can be exploited to detect invisible users, by performing an action (such as an unignore) to illicit a flags update. Users included in the flags update whose presence has not been indicated by EID_JOIN or EID_SHOWUSER can then be added to the userlist as invisible. Care should be taken, however, to account for the possibility that an asynchronous send error has occured. Should an EID_JOIN or EID_SHOWUSER event occur for an invisible user, they should be marked as a normal user, not readded to the userlist.

EID_WHISPER & EID_WHISPERSENT:
The Flags and Ping fields in these packets are equal to the originating user - the one who sent the whisper. In other words, EID_WHISPERSENT contains your flags & ping, not those of the person you whispered.[/quote]

Edit:

I've also noticed that you've missed a few and most of the information looks as if it was written by an escaped mental patient.

[quote]String - A string of characters terminated by a space.[/quote]

[quote]Integer - Like a string, but always a number.[/quote]
April 4, 2005, 9:35 AM
JoeTheOdd
Thanks for the.. help?
April 4, 2005, 11:46 AM
R.a.B.B.i.T
WTF?  Don't revive old topics.
May 18, 2005, 6:55 PM
111787
Some one got the wabbit, for the mere fact of staying on topic, good work Joe.
May 19, 2005, 1:29 AM

Search