Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sr2echa/TF2-Source-Code/llms.txt

Use this file to discover all available pages before exploring further.

TF2’s item economy is defined in a schema — a large data file (fetched from the Steam GC) parsed into CTFItemSchema (game/shared/tf/tf_item_schema.h). The schema maps item definition indices to CEconItemDefinition records describing weapon stats, cosmetic models, attribute lists, and crafting recipes.

Schema class hierarchy

CEconItemSchema          (game/shared/econ/econ_item_schema.h)
    └── CTFItemSchema    (game/shared/tf/tf_item_schema.h)
CTFItemSchema extends the base schema with TF2-specific constructs: class loadout slots, MvM tour definitions, matchmaking descriptions, and timed drop data.

CEconItemDefinition

Each item in the schema is a CEconItemDefinition:
// game/shared/econ/econ_item_schema.h (key members)
class CEconItemDefinition
{
public:
    item_definition_index_t  GetDefinitionIndex() const;
    const char              *GetItemBaseName() const;      // "Rocket Launcher"
    const char              *GetItemTypeName() const;      // "primary"
    const char              *GetClassname() const;         // "tf_weapon_rocketlauncher"
    int                      GetLoadoutSlot( int iClass ) const;
    int                      GetQualityRange( int *pMinQuality ) const;

    // Attribute list attached to this item definition
    const CUtlVector< static_attrib_t > &GetStaticAttributes() const;
};

Item qualities

Item qualities control name color and drop rarity:
QualityValueColor
Normal0Grey
Genuine1Dark green
Vintage3Blue
Unusual5Purple
Unique6Yellow (default)
Community7Green
Valve8Light blue
Self-Made9Green
Strange11Orange
Haunted13Green
Collector’s14Red

Weapon attributes

Attributes modify weapon behavior at runtime. CEconItemAttribute stores a uint32 attribute definition index and a float value. The weapon code reads attributes via FindAttribute():
// Reading an attribute from an item
CEconItemView *pItem = pWeapon->GetItem();
float flDamageBonus = 1.0f;
CALL_ATTRIB_HOOK_FLOAT( flDamageBonus, mult_dmg );
// CALL_ATTRIB_HOOK_FLOAT expands to a FindAttribute + multiply pattern
Attribute hooks are defined per-weapon class using the CALL_ATTRIB_HOOK_* macros, allowing the schema to override any stat without code changes.

Loadout slots

Each class has named loadout slots. CTFItemSchema::GetLoadoutSlotForClass() maps a slot name (“primary”, “secondary”, “melee”, “head”, “misc1”, etc.) to a slot index for a given TF2 class.
  • Slot 0 (primary): Rocket Launcher
  • Slot 1 (secondary): Shotgun / Buff Banner / Concheror / Battalion’s Backup
  • Slot 2 (melee): Shovel and variants
  • Slot 4 (action): Canteen (MvM)
Slots head, misc1, misc2 hold cosmetic wearables. action holds items like the Gunboat / Mantreads effect items that have passive effects.

MvM tour definitions

CTFItemSchema holds CTFMvMTourDescription entries that map MvM tours (e.g., “Operation Two Cities”) to their mission lists, badge items, and loot table definitions.
The item schema is not compiled into the game binary — it is fetched live from the Steam Game Coordinator on startup. The CTFItemSystem (tf_item_system.h) manages schema requests, caching, and the fallback to local schema data.

Build docs developers (and LLMs) love