Populate team rosters from a LIVESTATS team token and tag the damage list
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
@@ -37,7 +37,8 @@ RENAME_PATTERN = re.compile(r'^(.+?)\s+renamed to\s+(.+?)$')
|
||||
STATUS_HEAD_PATTERN = re.compile(r'^\s*\d+\s+-?\d+\s+(bot|\d+)\s+\S', re.MULTILINE)
|
||||
STATUS_MAP_PATTERN = re.compile(r'^map:\s+\S+\s*$', re.MULTILINE)
|
||||
STEAMID_PATTERN = re.compile(r'\b\d{16,}\b')
|
||||
LIVESTATS_PATTERN = re.compile(r'^LIVESTATS\s+(.+)\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)\s*$')
|
||||
LIVESTATS_PATTERN = re.compile(
|
||||
r'^LIVESTATS\s+(.+)\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+([A-Za-z]+|\d))?\s*$')
|
||||
STATUS_ROW_PATTERN = re.compile(
|
||||
r'^\s*(\d+)\s+(-?\d+)\s+(\d+)\s+(.+?)\s+(\d+)\s+(\S+)\s+(\d+)\s+(\d+)(?:\s+(\d{15,}))?\s*$')
|
||||
ROSTER_CHAT_GUARD_PATTERN = re.compile(r'^.{1,40}:\s')
|
||||
@@ -179,7 +180,9 @@ def handle_livestats(message, game_state, ui, verbose=0):
|
||||
Consume every LIVESTATS heartbeat line (engine damage counters emitted
|
||||
every 10s by the livedamage plugin, plus its summary variants). Lines
|
||||
matching the full player shape update live score/damage/ping; names may
|
||||
contain spaces, so the counters anchor from the end. The raw lines
|
||||
contain spaces, so the counters anchor from the end. An optional trailing
|
||||
team token (extended livedamage format) is authoritative and populates
|
||||
the roster with correct teams — including during warmup. The raw lines
|
||||
display only at -v or higher verbosity; they are never treated as chat.
|
||||
"""
|
||||
clean = strip_color_codes(message).strip()
|
||||
@@ -187,8 +190,11 @@ def handle_livestats(message, game_state, ui, verbose=0):
|
||||
return False
|
||||
match = LIVESTATS_PATTERN.match(clean)
|
||||
if match:
|
||||
name, score, dealt, taken, ping = match.groups()
|
||||
game_state.player_tracker.update_livestats(name, int(score), int(dealt), int(taken), int(ping))
|
||||
name, score, dealt, taken, ping, team = match.groups()
|
||||
if team is not None and team.isdigit():
|
||||
team = int(team)
|
||||
game_state.player_tracker.update_livestats(
|
||||
name, int(score), int(dealt), int(taken), int(ping), team)
|
||||
ui.update_server_info(game_state)
|
||||
if verbose > 0:
|
||||
timestamp = time.strftime('%H:%M:%S')
|
||||
|
||||
Reference in New Issue
Block a user