Constants¶
Display-name helpers and lookup tables backed by bundled dotaconstants data.
gem.constants
¶
Dota 2 game constants — heroes, items, abilities, XP thresholds.
Data is bundled from odota/dotaconstants and pre-processed by
scripts/build_constants.py into src/gem/data/.
All public functions accept internal game names and return human-readable display strings, falling back gracefully when a name is not found.
Reference: https://github.com/odota/dotaconstants
hero_display(npc_name: str) -> str
¶
Return the localized display name for an npc_dota_hero_* string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
npc_name
|
str
|
Internal hero name, e.g. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Localized name (e.g. |
Source code in src/gem/constants.py
hero_short(npc_name: str) -> str
¶
Return display name from either a full npc_dota_hero_* or a bare suffix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
npc_name
|
str
|
Full internal name or bare suffix (e.g. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Localized display name. |
Source code in src/gem/constants.py
hero_meta(npc_name: str) -> dict
¶
Return the full hero metadata dict, or an empty dict if not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
npc_name
|
str
|
Internal hero name (case-insensitive). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dict with keys |
Source code in src/gem/constants.py
item_display(internal: str) -> str
¶
Return display name for an item_* prefixed internal name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
internal
|
str
|
Internal item name, e.g. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Display name (e.g. |
Source code in src/gem/constants.py
ability_display(internal: str) -> str
¶
Return display name for an ability or item internal name.
Falls back to item_display for item_* names, and to a
prettified version of the internal name for any unrecognised ability
(strips hero prefix, title-cases remainder).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
internal
|
str
|
Internal ability or item name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Display name string. |
Source code in src/gem/constants.py
xp_to_next_level(level: int, current_xp: int) -> int | None
¶
Return XP needed to reach the next level, or None at max level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
Current hero level (1-based). |
required |
current_xp
|
int
|
Current cumulative XP total. |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
XP remaining to next level, or |
Source code in src/gem/constants.py
permanent_buff_name(buff_id: int) -> str
¶
Return the item name for a permanent buff integer ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buff_id
|
int
|
Integer buff identifier from entity state. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Internal item name (e.g. |
Source code in src/gem/constants.py
league_name(leagueid: int) -> str | None
¶
Return the league name for a given league ID, or None if unknown/not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
leagueid
|
int
|
Numeric Dota 2 league ID. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
League name string (e.g. |
str | None
|
if the league is not in the bundled data (e.g. pub games, unknown leagues). |