Skip to content

How to CUtlRBTree?

Pre-release
Pre-release
Compare
Choose a tag to compare
@nosoop nosoop released this 11 Apr 07:46
· 41 commits to master since this release

This release adds support for item qualities and rarities.

Linux has CEconItemSchema::GetQualityDefinition(), but Windows doesn't (probably stripping out unused functions, which that particular one is). After doing a bunch of research, it turns out the CUtlRBTree lookup just points to an index in an underlying array, so I ditched it altogether in favor of iterating the data.

Support for rarities was added shortly after since it was the exact same setup barring offset and iteration size changes.

Added

  • Native TF2Econ_GetQualityName, which stores the name of a given item quality into a given buffer. (TF2 stores qualities internally as a CEconItemQualityDefinition, so we use "get" in this case even though there aren't any other properties present.)
  • Native TF2Econ_TranslateQualityNameToValue, which returns the item quality value given a valid name, or -1 if not valid.
  • Native TF2Econ_GetQualityList, which returns all the valid quality values in an ArrayList.
  • Native TF2Econ_GetRarityName, which stores the name of a given item rarity into a given buffer.
  • Native TF2Econ_TranslateRarityNameToValue, which returns the item rarity value given a valid name, or -1 if not valid.
  • Native TF2Econ_GetRarityList, which returns all the valid rarity values in an ArrayList.
  • Native TF2Econ_GetRarityDefinitionAddress, which returns the address of the CEconItemRarityDefinition of the given rarity value.