Icons.bni
File format and conventions for server-defined chat icons
Icons.bni
is a file downloaded by Blizzard's games during their handshake with Battle.net and is used to display client icons in chat, including icons like tournament trophies and number of wins. There are also product-specific variations of this file such as icons_STAR.bni
. The correct file to use can be obtained by sending SID_GETICONDATA after client authentication.
Standard File Format
(UINT32) Size of BNI header (always 16)
(UINT16) BNI Version
(UINT16) Alignment Padding (Unused)
(UINT32) Number of Icons
(UINT32) Image data Offset
For each icon:
(UINT32) Flags
(UINT32) X Size
(UINT32) Y Size
(UINT32)[] Icon Code (zero-terminated)
(VOID) Targa image data
- The
BNI version
value has only been observed to be0x01
. This document only applies to that version. The BNI format was replaced by a separate system using MPQ files, as can be seen inicons-WAR3.bni
(which is actually an MPQ file with a different extension). - The
image data offset
is the position in the file where the Targa image data begins. - The
flags
value, when non-zero, corresponds to a user chat flag that the icon should be displayed for. In the case of multiple matching flags with icons, the first should be used. X Size
andY Size
refer to the width and height of the image in pixels, respectively.Icon code
is an array of DWORD-strings corresponding to the icon code value from a chat user statstring. This is only used when theflags
for an icon is set to0x00
, otherwise it is a single DWORD with a value of 0. The array will always end on a DWORD value of 0 and appears to have a maximum limit of 32 values.Targa image data
is typically in 24-bit TrueColor (RGB) compressed with run-length encoding.
Additional Notes
- This document, written by Kane, has a good overview of the relevant parts of the format, including the Targa data.
- More information on the Targa format can be found here.
- Some unusual BNI files have been found in circulation. These have been found with some of the following format-breaking differences:
icons_clan.bni
andicons_lag.bni
have a header size value that is actually the image data offset, minus 4. Their image data offset value is0xFFFFFFFF
. Their pixel-origin in the Targa data is also0x30
(top-right) which seems to be obscure and not supported by some image manipulation programs/libraries.classic_icons.bni
has a NULL (0) icon code for its first 45 icons, followed by the NULL (0) code array terminator, which can break for code expecting the list to end on the first NULL value.
- Observed samples of this file (including the unusual ones) can be found here.
- Some BNI files may contain multiple icons with flags 0 and no icon codes. These were reported to be referenced directly by-index from the game clients.
Comments
Icon Precedence:
-
For any user, display the first icon in
icons.bni
that has icon flags matching the bitwise-and of the icon flags and user flags (given by server in SID_CHATEVENT). -
For StarCraft users displaying icons other StarCraft users' icons, the first icon in
icons_STAR.bni
that has an icon code matching the value in theIcon Code
field in chat statstrings.
For WarCraft 3 users displaying other WarCraft 3 users' icons, the first icon inicons-WAR3.bni
that has an icon code matching the value in theIcon Code
field in chat statstrings. -
For any user displaying icons of users with different product codes, display the first icon in
icons.bni
that has icon flags matching theIcon Code
field in chat statstrings. -
For any user displaying icons of users with the same product code, display an internal icon. See http://classic.battle.net/info/icons.shtml and http://classic.battle.net/war3/ladder/w3xp-ladder-info-laddericons.aspx?Gateway=Lordaeron for examples.