Combat Log¶
Normalizes combat-log data from both Source 1 and Source 2 ingestion paths into a unified entry shape.
See also: The Combat Log, Using the Combat Log
gem.combatlog.CombatLogProcessor
¶
Parses and dispatches combat log entries.
Attributes:
| Name | Type | Description |
|---|---|---|
_handlers |
list[CombatLogHandler]
|
Registered CombatLogHandler callables. |
Source code in src/gem/combatlog.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
on_combat_log_entry(handler: CombatLogHandler) -> None
¶
Register a handler to receive decoded CombatLogEntry objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handler
|
CombatLogHandler
|
Callable |
required |
process_rune_pickup(player_slot: int, rune_type: int, tick: int = 0) -> None
¶
Emit a PICKUP_RUNE CombatLogEntry from a CDOTAUserMsg_ChatEvent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
player_slot
|
int
|
Player slot (0-9) from ChatEvent.playerid_1. |
required |
rune_type
|
int
|
Rune type integer from ChatEvent.value. |
required |
tick
|
int
|
Current game tick. |
0
|
Source code in src/gem/combatlog.py
process_s1_event(game_event: Any, name_table: Any, tick: int = 0) -> None
¶
Parse a dota_combatlog S1 game event and emit a CombatLogEntry.
Names are integer indices resolved via the CombatLogNames string table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
game_event
|
Any
|
A |
required |
name_table
|
Any
|
An object with an |
required |
tick
|
int
|
Current game tick. |
0
|
Source code in src/gem/combatlog.py
process_s2_bulk(msg: Any, name_table: Any, tick: int = 0) -> None
¶
Parse a CDOTAUserMsg_CombatLogBulkData and emit CombatLogEntry per entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
Any
|
A |
required |
name_table
|
Any
|
String table with |
required |
tick
|
int
|
Current game tick. |
0
|
Source code in src/gem/combatlog.py
process_s2_entry(msg: Any, name_table: Any, tick: int = 0) -> None
¶
Parse a CMsgDOTACombatLogEntry and emit a CombatLogEntry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg
|
Any
|
A |
required |
name_table
|
Any
|
An object with an |
required |
tick
|
int
|
Current game tick. |
0
|
Source code in src/gem/combatlog.py
gem.combatlog.CombatLogEntry
dataclass
¶
One decoded combat log entry.
Attributes:
| Name | Type | Description |
|---|---|---|
tick |
int
|
Game tick at which the event occurred. |
log_type |
str
|
String label from COMBAT_LOG_TYPES. |
attacker_name |
str
|
Name of the attacker unit/hero. |
target_name |
str
|
Name of the target unit/hero. |
inflictor_name |
str
|
Ability or item that caused the event. |
value |
int
|
Numeric value (damage, heal amount, gold, xp, etc.). |
attacker_is_hero |
bool
|
True if the attacker is a hero. |
target_is_hero |
bool
|
True if the target is a hero. |
attacker_is_illusion |
bool
|
True if the attacker is an illusion. |
target_is_illusion |
bool
|
True if the target is an illusion. |
ability_level |
int
|
Ability level (for ability/item events). |
gold_reason |
int
|
Gold reason code (for GOLD events). |
xp_reason |
int
|
XP reason code (for XP events). |
value_name |
str
|
Resolved name for the value field (PURCHASE events: item name). |
damage_type |
str
|
Damage type label for DAMAGE events ("physical", "magical", "pure"). |
stun_duration |
float
|
Duration of stun applied by this event in seconds (S2 only; 0.0 if none). |