Index
defineD2ITEMTYPE_TOME_TP
defineD2ITEMTYPE_TOME_ID
enumd2filetype
enumd2rarity
enumd2location
enumd2panel
enumd2equiplocation
enumd2lowquality
enumd2itemreader_parse_state
enumd2char_section
CHECK_RESULT d2errd2gamedata_init_default(d2gamedata* data)
CHECK_RESULT d2errd2gamedata_init_files(d2gamedata* data,d2gamedatafiles files)
CHECK_RESULT d2errd2gamedata_init_bufs(d2gamedata* data,d2gamedatabufs bufs)
voidd2gamedata_destroy(d2gamedata* data)
d2filetype d2filetype_get(const uint8_t * data, size_t size)
d2filetype d2filetype_of_file(const char * filename)
CHECK_RESULT d2errd2itemreader_parse_any_file(const char * filename,d2itemlist* itemList,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2itemreader_parse_any(const uint8_t *const data, size_t dataSizeBytes,d2itemlist* itemList,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2itemlist_parse(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2itemlist* items,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2itemlist_parse_num(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2itemlist* items, uint16_t numItems,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2itemlist_init(d2itemlist* list, size_t initialSize)
voidd2itemlist_init_empty(d2itemlist* list)
CHECK_RESULT d2errd2itemlist_append(d2itemlist* list, constd2item*const item)
CHECK_RESULT d2errd2itemlist_append_copy(d2itemlist* list, constd2item*const item)
CHECK_RESULT d2errd2itemlist_append_list_copy(d2itemlist* dest, constd2itemlist*const src)
CHECK_RESULT d2errd2itemlist_copy(d2itemlist* dest, constd2itemlist*const src)
voidd2itemlist_destroy(d2itemlist* list)
CHECK_RESULT d2errd2itemproplist_parse(d2bitreader * br,d2itemproplist* list,d2gamedata* gameData)
CHECK_RESULT d2errd2itemproplist_init(d2itemproplist* list, size_t initialSize)
CHECK_RESULT d2errd2itemproplist_append(d2itemproplist* list,d2itemprop prop)
CHECK_RESULT d2errd2itemproplist_copy(d2itemproplist* dest, constd2itemproplist*const src)
voidd2itemproplist_destroy(d2itemproplist* list)
CHECK_RESULT d2errd2item_parse_file(const char * filename,d2item* item,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2item_parse(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2item* item,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2item_parse_single(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2item* item,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2item_copy(d2item* dest, constd2item*const src)
voidd2item_destroy(d2item* item)
CHECK_RESULT d2errd2sharedstash_parse_file(const char * filename,d2sharedstash* stash,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2sharedstash_parse(const uint8_t *const data, size_t dataSizeBytes,d2sharedstash* stash,d2gamedata* gameData, size_t * out_bytesRead)
voidd2sharedstash_destroy(d2sharedstash* stash)
CHECK_RESULT d2errd2personalstash_parse_file(const char * filename,d2personalstash* stash,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2personalstash_parse(const uint8_t *const data, size_t dataSizeBytes,d2personalstash* stash,d2gamedata* gameData, size_t * out_bytesRead)
voidd2personalstash_destroy(d2personalstash* stash)
CHECK_RESULT d2errd2char_parse_file(const char * filename,d2char* character,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2char_parse(const uint8_t *const data, size_t dataSizeBytes,d2char* character,d2gamedata* gameData, size_t * out_bytesRead)
voidd2char_destroy(d2char* character)
CHECK_RESULT d2errd2atmastash_parse_file(const char * filename,d2atmastash* stash,d2gamedata* gameData, size_t * out_bytesRead)
CHECK_RESULT d2errd2atmastash_parse(const uint8_t *const data, size_t dataSizeBytes,d2atmastash* stash,d2gamedata* gameData, size_t * out_bytesRead)
voidd2atmastash_destroy(d2atmastash* stash)
CHECK_RESULT d2errd2itemreader_open_file(d2itemreader_stream* stream, const char * filepath,d2gamedata* gameData)
CHECK_RESULT d2errd2itemreader_open_buffer(d2itemreader_stream* stream, const uint8_t *const data, size_t dataSizeBytes,d2gamedata* gameData)
voidd2itemreader_close(d2itemreader_stream* stream)
const uint8_t *d2itemreader_dump_last_item(d2itemreader_stream* stream, size_t * out_itemSizeBytes)
size_td2itemreader_bytepos(d2itemreader_stream* stream)
CHECK_RESULT boold2itemreader_next(d2itemreader_stream* stream,d2item* item)
CHECK_RESULT boold2itemreader_next_but_stop_on(d2itemreader_stream* stream,d2item* item,d2itemreader_parse_state stopOn)
boold2itemreader_seek_parse_state(d2itemreader_stream* stream,d2itemreader_parse_state state)
boold2itemreader_seek_valid_item(d2itemreader_stream* stream)
structd2atmastash
structd2atmastash_info
structd2char
structd2char_info
structd2ear
structd2gamedata
structd2gamedata_itemstat
structd2gamedatabufs
structd2gamedatafiles
structd2item
structd2itemlist
structd2itemprop
structd2itemproplist
structd2itemreader_source
structd2itemreader_state
structd2itemreader_stream
structd2personalstash
structd2personalstash_info
structd2sharedstash
structd2sharedstash_info
structd2stashpage
uniond2itemreader_stream.info

defineD2ITEMTYPE_TOME_TP

defineD2ITEMTYPE_TOME_ID

enumd2filetype

Values Descriptions
D2FILETYPE_UNKNOWN Filetype could not be determined or file is malformed.
D2FILETYPE_D2_CHARACTER Parsable using d2char_parse() or d2char_parse_file()
D2FILETYPE_PLUGY_SHARED_STASH Parsable using d2sharedstash_parse() or d2sharedstash_parse_file()
D2FILETYPE_PLUGY_PERSONAL_STASH Parsable using d2personalstash_parse() or d2personalstash_parse_file()
D2FILETYPE_ATMA_STASH Parsable using d2atmastash_parse() or d2atmastash_parse_file()
D2FILETYPE_D2_ITEM Parsable using d2item_parse() or d2item_parse_file()

See also: d2filetype_get(), d2filetype_of_file()

enumd2rarity

Values Descriptions
D2RARITY_INVALID
D2RARITY_LOW_QUALITY
D2RARITY_NORMAL
D2RARITY_HIGH_QUALITY AKA Superior.
D2RARITY_MAGIC
D2RARITY_SET
D2RARITY_RARE
D2RARITY_UNIQUE
D2RARITY_CRAFTED
D2RARITY_TEMPERED Was never actually enabled in an official release.

enumd2location

Values Descriptions
D2LOCATION_STORED
D2LOCATION_EQUIPPED
D2LOCATION_BELT
D2LOCATION_GROUND
D2LOCATION_CURSOR
D2LOCATION_SOCKETED

enumd2panel

Values Descriptions
D2PANEL_NONE
D2PANEL_INVENTORY
D2PANEL_CUBE
D2PANEL_STASH

enumd2equiplocation

Values Descriptions
D2EQUIP_HEAD
D2EQUIP_NECK
D2EQUIP_TORSO
D2EQUIP_HAND_RIGHT
D2EQUIP_HAND_LEFT
D2EQUIP_FINGER_RIGHT
D2EQUIP_FINGER_LEFT
D2EQUIP_WAIST
D2EQUIP_FEET
D2EQUIP_HANDS
D2EQUIP_ALT_HAND_RIGHT
D2EQUIP_ALT_HAND_LEFT

NOTE: All equipment locations are based on character orientation on the inventory screen, meaning the right hand is on the left side of the screen (i.e. imagine that the character is oriented as if it is facing towards the screen)

enumd2lowquality

Values Descriptions
D2LOWQUALITY_CRUDE
D2LOWQUALITY_CRACKED
D2LOWQUALITY_DAMAGED
D2LOWQUALITY_LOW_QUALITY

enumd2itemreader_parse_state

Values Descriptions
PARSE_STATE_NOTHING_PARSED
PARSE_STATE_ITEMLIST_READY
PARSE_STATE_ITEM_READY
PARSE_STATE_ITEMLIST_DONE
PARSE_STATE_PAGE_READY
PARSE_STATE_NEEDS_VERIFICATION
PARSE_STATE_FINISHED
PARSE_STATE_NONE

enumd2char_section

Values Descriptions
D2CHAR_SECTION_MAIN
D2CHAR_SECTION_CORPSE
D2CHAR_SECTION_MERC

CHECK_RESULT d2errd2gamedata_init_default(d2gamedata* data)

Load the default data packaged with d2itemreader (should work for un-modded D2 versions >= 1.10)

Returns

D2ERR_OK on success

IMPORTANT: d2gamedata_destroy() only needs to be called if the init function returns D2ERR_OK

See also: d2gamedata_init_files(), d2gamedata_init_bufs(), d2gamedata_destroy()

CHECK_RESULT d2errd2gamedata_init_files(d2gamedata* data,d2gamedatafiles files)

Load the data from the file paths given in files

Parameters

  • files Paths to the .txt game data files

Returns

D2ERR_OK on success

IMPORTANT: d2gamedata_destroy() only needs to be called if the init function returns D2ERR_OK

See also: d2gamedata_init_default(), d2gamedata_init_bufs(), d2gamedata_destroy()

CHECK_RESULT d2errd2gamedata_init_bufs(d2gamedata* data,d2gamedatabufs bufs)

Load the data from the buffers given in bufs

Parameters

  • files Buffers to the .txt game data

Returns

D2ERR_OK on success

IMPORTANT: d2gamedata_destroy() only needs to be called if the init function returns D2ERR_OK

See also: d2gamedata_init_files(), d2gamedata_init_default(), d2gamedata_destroy()

voidd2gamedata_destroy(d2gamedata* data)

Cleanup memory used by d2gamedata.

IMPORTANT: d2gamedata_destroy() only needs to be called if the init function returns D2ERR_OK

See also: d2gamedata_init_default(), d2gamedata_init_files(), d2gamedata_init_bufs()

d2filetype d2filetype_get(const uint8_t * data, size_t size)

Attempt to determine the filetype of the given binary data.

d2filetype d2filetype_of_file(const char * filename)

Attempt to determine the filetype of the given file path.

CHECK_RESULT d2errd2itemreader_parse_any_file(const char * filename,d2itemlist* itemList,d2gamedata* gameData, size_t * out_bytesRead)

Parse the file in filename if it is of any parsable format, and store the result in itemList

This is a convenience function for when you are only interested in the items in a file, and don't care about anything else (i.e. when the metadata you get from more specific parsers is irrelevent)

Parameters

  • itemList A pointer to an uninitialized d2itemlist object. If this function returns D2ERR_OK, then itemList will need to be cleaned up with d2itemlist_destroy(). If this function returns something other than D2ERR_OK, then itemList will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the file. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

CHECK_RESULT d2errd2itemreader_parse_any(const uint8_t *const data, size_t dataSizeBytes,d2itemlist* itemList,d2gamedata* gameData, size_t * out_bytesRead)

CHECK_RESULT d2errd2itemlist_parse(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2itemlist* items,d2gamedata* gameData, size_t * out_bytesRead)

Parse the itemlist in data starting at startByte, and store the result in items

Parameters

  • items A pointer an uninitialized d2itemlist object (i.e. d2itemlist_init() has NOT been called on it). If this function returns D2ERR_OK, then items will need to be cleaned up with d2itemlist_destroy(). If this function returns something other than D2ERR_OK, then items will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the item list. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

See also: d2itemlist_destroy(), d2itemlist_parse_num()

CHECK_RESULT d2errd2itemlist_parse_num(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2itemlist* items, uint16_t numItems,d2gamedata* gameData, size_t * out_bytesRead)

Parse the itemlist containing exactly numItems items (not including items in sockets) in data starting at startByte, and store the result in items

Parameters

  • items A pointer an uninitialized d2itemlist object (i.e. d2itemlist_init() has NOT been called on it). If this function returns D2ERR_OK, then items will need to be cleaned up with d2itemlist_destroy(). If this function returns something other than D2ERR_OK, then items will remain uninitialized.

  • numItems The number of items to parse, not including items in sockets

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the item list. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

See also: d2itemlist_destroy(), d2itemlist_parse()

CHECK_RESULT d2errd2itemlist_init(d2itemlist* list, size_t initialSize)

voidd2itemlist_init_empty(d2itemlist* list)

CHECK_RESULT d2errd2itemlist_append(d2itemlist* list, constd2item*const item)

CHECK_RESULT d2errd2itemlist_append_copy(d2itemlist* list, constd2item*const item)

CHECK_RESULT d2errd2itemlist_append_list_copy(d2itemlist* dest, constd2itemlist*const src)

CHECK_RESULT d2errd2itemlist_copy(d2itemlist* dest, constd2itemlist*const src)

voidd2itemlist_destroy(d2itemlist* list)

CHECK_RESULT d2errd2itemproplist_parse(d2bitreader * br,d2itemproplist* list,d2gamedata* gameData)

Parse the item property list using br, and store the result in list

Parameters

  • br A pointer a d2bitreader struct

  • list A pointer an uninitialized d2itemproplist object (i.e. d2itemproplist_init() has NOT been called on it). If this function returns D2ERR_OK, then list will need to be cleaned up with d2itemproplist_destroy(). If this function returns something other than D2ERR_OK, then list will remain uninitialized.

Returns

D2ERR_OK on success

See also: d2itemproplist_destroy()

CHECK_RESULT d2errd2itemproplist_init(d2itemproplist* list, size_t initialSize)

CHECK_RESULT d2errd2itemproplist_append(d2itemproplist* list,d2itemprop prop)

CHECK_RESULT d2errd2itemproplist_copy(d2itemproplist* dest, constd2itemproplist*const src)

voidd2itemproplist_destroy(d2itemproplist* list)

CHECK_RESULT d2errd2item_parse_file(const char * filename,d2item* item,d2gamedata* gameData, size_t * out_bytesRead)

Parse the item (+ any socketed items within) in filename, and store the result in item

Parameters

  • item A pointer an uninitialized d2item object. If this function returns D2ERR_OK, then item will need to be cleaned up with d2item_destroy(). If this function returns something other than D2ERR_OK, then item will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the item. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

See also: d2item_destroy(), d2item_parse(), d2item_parse_single()

CHECK_RESULT d2errd2item_parse(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2item* item,d2gamedata* gameData, size_t * out_bytesRead)

Parse the item (+ any socketed items within) in data starting at startByte, and store the result in item

Parameters

  • item A pointer an uninitialized d2item object. If this function returns D2ERR_OK, then item will need to be cleaned up with d2item_destroy(). If this function returns something other than D2ERR_OK, then item will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the item. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

See also: d2item_destroy(), d2item_parse_file(), d2item_parse_single()

CHECK_RESULT d2errd2item_parse_single(const uint8_t *const data, size_t dataSizeBytes, size_t startByte,d2item* item,d2gamedata* gameData, size_t * out_bytesRead)

Parse the item (but not socketed items within) in data starting at startByte, and store the result in item

If the item has items socketed in it, item->socketedItems will be initialized with size item->numItemsInSockets, but will be empty.

Parameters

  • item A pointer an uninitialized d2item object. If this function returns D2ERR_OK, then item will need to be cleaned up with d2item_destroy(). If this function returns something other than D2ERR_OK, then item will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the item. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

See also: d2item_destroy(), d2item_parse_file(), d2item_parse()

CHECK_RESULT d2errd2item_copy(d2item* dest, constd2item*const src)

voidd2item_destroy(d2item* item)

CHECK_RESULT d2errd2sharedstash_parse_file(const char * filename,d2sharedstash* stash,d2gamedata* gameData, size_t * out_bytesRead)

Parse the PlugY shared stash in filename, and store the result in stash

Parameters

  • stash A pointer to an uninitialized d2sharedstash object. If this function returns D2ERR_OK, then stash will need to be cleaned up with d2sharedstash_destroy(). If this function returns something other than D2ERR_OK, then stash will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the stash. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

CHECK_RESULT d2errd2sharedstash_parse(const uint8_t *const data, size_t dataSizeBytes,d2sharedstash* stash,d2gamedata* gameData, size_t * out_bytesRead)

voidd2sharedstash_destroy(d2sharedstash* stash)

CHECK_RESULT d2errd2personalstash_parse_file(const char * filename,d2personalstash* stash,d2gamedata* gameData, size_t * out_bytesRead)

Parse the PlugY personal stash in filename, and store the result in stash

Parameters

  • stash A pointer to an uninitialized d2personalstash object. If this function returns D2ERR_OK, then stash will need to be cleaned up with d2personalstash_destroy(). If this function returns something other than D2ERR_OK, then stash will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the stash. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

CHECK_RESULT d2errd2personalstash_parse(const uint8_t *const data, size_t dataSizeBytes,d2personalstash* stash,d2gamedata* gameData, size_t * out_bytesRead)

voidd2personalstash_destroy(d2personalstash* stash)

CHECK_RESULT d2errd2char_parse_file(const char * filename,d2char* character,d2gamedata* gameData, size_t * out_bytesRead)

Parse the character in filename, and store the result in character

Parameters

  • character A pointer to an uninitialized d2char object. If this function returns D2ERR_OK, then character will need to be cleaned up with d2char_destroy(). If this function returns something other than D2ERR_OK, then character will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the character. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

CHECK_RESULT d2errd2char_parse(const uint8_t *const data, size_t dataSizeBytes,d2char* character,d2gamedata* gameData, size_t * out_bytesRead)

voidd2char_destroy(d2char* character)

CHECK_RESULT d2errd2atmastash_parse_file(const char * filename,d2atmastash* stash,d2gamedata* gameData, size_t * out_bytesRead)

Parse the d2x ATMA stash in filename, and store the result in stash

Parameters

  • stash A pointer to an uninitialized d2atmastash object. If this function returns D2ERR_OK, then stash will need to be cleaned up with d2atmastash_destroy(). If this function returns something other than D2ERR_OK, then stash will remain uninitialized.

  • out_bytesRead On D2ERR_OK, set to the number of bytes read when parsing the stash. On error, set to the number of bytes successfully parsed before the error.

Returns

D2ERR_OK on success

CHECK_RESULT d2errd2atmastash_parse(const uint8_t *const data, size_t dataSizeBytes,d2atmastash* stash,d2gamedata* gameData, size_t * out_bytesRead)

voidd2atmastash_destroy(d2atmastash* stash)

CHECK_RESULT d2errd2itemreader_open_file(d2itemreader_stream* stream, const char * filepath,d2gamedata* gameData)

CHECK_RESULT d2errd2itemreader_open_buffer(d2itemreader_stream* stream, const uint8_t *const data, size_t dataSizeBytes,d2gamedata* gameData)

voidd2itemreader_close(d2itemreader_stream* stream)

const uint8_t *d2itemreader_dump_last_item(d2itemreader_stream* stream, size_t * out_itemSizeBytes)

size_td2itemreader_bytepos(d2itemreader_stream* stream)

CHECK_RESULT boold2itemreader_next(d2itemreader_stream* stream,d2item* item)

Get the next item in the stream

Parameters

  • stream A pointer to an open d2itemreader_stream.

  • item If this function returns true, set to the parsed item. If this function returns false, *item remains uninitialized.

Returns

true on success, false on error or no more items. On error, stream->err != D2ERR_OK. On no more items, stream->parseState == PARSE_STATE_FINISHED.

CHECK_RESULT boold2itemreader_next_but_stop_on(d2itemreader_stream* stream,d2item* item,d2itemreader_parse_state stopOn)

Get the next item in the stream but stop if the stopOn parse state is hit at any point.

Parameters

  • stream A pointer to an open d2itemreader_stream.

  • item If this function returns true, set to the parsed item. If this function returns false, *item remains uninitialized.

  • stopOn The parse state to check for.

Returns

true on success; false on error, no more items, or stopOn being hit. On error, stream->err != D2ERR_OK. On no more items, stream->parseState == PARSE_STATE_FINISHED. On stop, stream->parseState == onStop.

boold2itemreader_seek_parse_state(d2itemreader_stream* stream,d2itemreader_parse_state state)

Seek the stream until the specified state is hit or an error occurs. Will never seek past PARSE_STATE_ITEM_READY or PARSE_STATE_FINISHED states.

Parameters

Returns

true on success, false on error while seeking (check stream->err for the error)

boold2itemreader_seek_valid_item(d2itemreader_stream* stream)

Seek the stream until it is ready to read a valid item. Similar to d2itemreader_seek_parse_state but will skip over empty item lists.

Parameters

Returns

true on success, false on error while seeking (check stream->err for the error)

struct d2atmastash

ATMA Stash (.d2x)

Members Descriptions
d2itemlist items
d2atmastash_info info

struct d2atmastash_info

Members Descriptions
uint16_tfileVersion
uint16_texpectedNumItems

struct d2char

Character Save File (.d2s)

Members Descriptions
d2itemlist items
d2itemlist itemsCorpse
d2itemlist itemsMerc
d2char_info info

struct d2char_info

Members Descriptions
boolisExpansion
uint32_tfileVersion
uint32_tmercID
boolisDead

struct d2ear

Members Descriptions
uint8_tclassID class of the player
uint8_tlevel level of the player
charname[D2_MAX_CHAR_NAME_BYTELEN] null-terminated player name

struct d2gamedata

Members Descriptions
uint16_tinitState
strset_t *armorsSet
strset_t *weaponsSet
strset_t *stackablesSet
d2gamedata_itemstat itemstats[D2DATA_MAX_ITEMSTATCOST_IDS]

struct d2gamedata_itemstat

Members Descriptions
uint16_tid
uint8_tencode
uint16_tsaveBits
int16_tsaveAdd
uint16_tsaveParamBits
uint16_tnextInChain
uint16_tcharSaveBits

struct d2gamedatabufs

See also: d2gamedata_init_bufs()

Members Descriptions
char *armorTxt
size_tarmorTxtSize
char *weaponsTxt
size_tweaponsTxtSize
char *miscTxt
size_tmiscTxtSize
char *itemStatCostTxt
size_titemStatCostTxtSize

struct d2gamedatafiles

See also: d2gamedata_init_files()

Members Descriptions
const char *armorTxtFilepath
const char *weaponsTxtFilepath
const char *miscTxtFilepath
const char *itemStatCostTxtFilepath

struct d2item

Members Descriptions
boolidentified
boolsocketed
boolisNew
boolisEar
boolstarterItem
boolsimpleItem
boolethereal
boolpersonalized
boolisRuneword Diablo II does not save any info that directly maps an item to a Runes.txt row. Instead, which runeword the item has is determined by the runes socketed in it, and can be checked against Runes.txt's RuneX columns (in order) to determine which row matches the item's runes
uint8_tversion 0 = pre-1.08, 1 = classic, 100 = expansion, 101 = expansion 1.10+
uint8_tlocationID see the d2location enum
uint8_tequippedID see the d2equiplocation enum
uint8_tpositionX the x coordinate of the item
uint8_tpositionY the y coordinate of the item
uint8_tpanelID the ID of the page the item is on (main inventory, stash, cube, etc). only set if the item's locationID != D2LOCATION_STORED
d2ear ear only initialized if isEar is true. NOTE: Anything below this will be uninitialized when isEar is true
charcode[D2_ITEM_CODE_BYTELEN] null-terminated item code, typical string length is 3-4 characters. note: space characters are treated as NUL characters when parsing this string
uint8_tnumItemsInSockets Number of items that are socketed within this item.
d2itemlist socketedItems List of items socketed within this item.
uint32_tid random unique ID assigned to this item typically displayed using printf("%08X", id)
uint8_tlevel item level
uint8_trarity see the d2rarity enum
boolmultiplePictures
uint8_tpictureID
boolclassSpecific
uint16_tautomagicID only set if classSpecific is true automagicID = the row in automagic.txt, where the first non-header row is ID 0, and no rows are skipped when incrementing ID
uint8_tlowQualityID see d2lowquality enum
uint8_tsuperiorID related in some way to qualityitems.txt, unsure what the ID <-> row mapping is
uint16_tmagicPrefix magicPrefix = the row in MagicPrefix.txt, where the first non-header row is ID 1, and only the "Expansion" row is skipped when incrementing ID (ID 0 is no prefix)
uint16_tmagicSuffix magicSuffix = the row in MagicSuffix.txt, where the first non-header row is ID 1, and only the "Expansion" row is skipped when incrementing ID (ID 0 is no suffix)
uint16_tsetID setID = the row in SetItems.txt, where the first non-header row is ID 0, and only the "Expansion" row is skipped when incrementing ID
uint16_tuniqueID uniqueID = the row in UniqueItems.txt, where the first non-header row is ID 0, and only the "Expansion" row is skipped when incrementing ID
uint8_tnameID1 rare or crafted prefix nameID1 = the row in RarePrefix.txt, where the first non-header row is (the max ID in RareSuffix.txt)+1, and no rows are skipped when incrementing ID for example, with the default txt files:
uint8_tnameID2 nameID2 = the row in RareSuffix.txt, where the first non-header row is ID 1, and no rows are skipped when incrementing ID (ID 0 is no suffix)
uint16_trarePrefixes[D2_MAX_RARE_PREFIXES] list of magic prefixes used by this rare/crafted item (see magicPrefix)
uint8_tnumRarePrefixes
uint16_trareSuffixes[D2_MAX_RARE_SUFFIXES] list of magic suffixes used by this rare/crafted item (see magicSuffix)
uint8_tnumRareSuffixes
charpersonalizedName[D2_MAX_CHAR_NAME_BYTELEN] null-terminated name, not including the 's suffix added by the game
booltimestamp
uint16_tdefenseRating the armor value; only set if the item code is in Armor.txt
uint8_tmaxDurability only set if the item code has durability (i.e. is in Armor.txt or Weapons.txt) but can be 0 for items that don't have durability (i.e. phase blade)
uint8_tcurrentDurability only set if maxDurability > 0
uint16_tquantity only set for stackable items (i.e. the stackable column in its .txt is 1)
uint8_tnumSockets number of total sockets in the item (regardless of their filled state)
d2itemproplist magicProperties list of magic properties, not including set bonuses, runeword properties, or the properties of any socketed items
d2itemproplist setBonuses[D2_MAX_SET_PROPERTIES] List of per-item set bonuses (i.e. green bonuses, not the overall set bonuses). These are always set even when the bonuses are not active.
uint8_tsetBonusesBits Bit field containing the position of valid elements in the setBonuses array.
d2itemproplist runewordProperties list of magic properties added to the item via a runeword (see also isRuneword)

struct d2itemlist

Members Descriptions
d2item*items
size_tcount
size_t_size

struct d2itemprop

Members Descriptions
uint16_tid
intparams[D2_ITEMPROP_MAX_PARAMS]
intnumParams

struct d2itemproplist

Members Descriptions
d2itemprop*properties
size_tcount
size_t_size

struct d2itemreader_source

Members Descriptions
const uint8_t *data
size_tdataSizeBytes
size_tcurByte
booldataNeedsFree

struct d2itemreader_state

Members Descriptions
d2itemreader_parse_state parseState
uint32_tcurPage
uint32_tnumPages
uint16_tcurItem
uint16_tnumItems
size_tlastItemSize

struct d2itemreader_stream

Members Descriptions
d2itemreader_source source
d2gamedata*gameData
d2errerr
d2filetype filetype
d2itemreader_state state
union d2itemreader_stream::@0info
d2stashpage curPage
d2char_section curSection

struct d2personalstash

PlugY Personal Stash (.d2x)

Members Descriptions
d2itemlist*itemsByPage
d2stashpage*pages
uint32_tnumPages
d2personalstash_info info

struct d2personalstash_info

Members Descriptions
uint16_tfileVersion
uint32_texpectedNumPages

struct d2sharedstash

PlugY Shared Stash (.sss)

Members Descriptions
d2itemlist*itemsByPage
d2stashpage*pages
uint32_tnumPages
d2sharedstash_info info

struct d2sharedstash_info

Members Descriptions
uint16_tfileVersion
uint32_tsharedGold
uint32_texpectedNumPages

struct d2stashpage

Members Descriptions
uint32_tpageNum
uint32_tflags
charname[D2_MAX_STASH_PAGE_NAME_BYTELEN]

Generated by Moxygen