Consume every LIVESTATS heartbeat variant and show them all only with -v
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,7 @@ 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+)\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*$')
|
||||
ROSTER_CHAT_GUARD_PATTERN = re.compile(r'^.{1,40}:\s')
|
||||
VOTE_CAST_PATTERN = re.compile(r'^(.+?) voted for (.+)\.$')
|
||||
CHAT_SHAPE_PATTERN = re.compile(r'^[\w(][^:]*:\s')
|
||||
@@ -156,14 +156,17 @@ def is_engine_output(message):
|
||||
|
||||
def handle_livestats(message, game_state, ui, verbose=0):
|
||||
"""
|
||||
Parse a LIVESTATS print (engine damage counters, emitted every 10s by the
|
||||
livedamage plugin) and update the player's live score/damage/ping.
|
||||
Returns True when the line is consumed. The raw line displays only at -v
|
||||
or higher verbosity; it is never treated as chat.
|
||||
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
|
||||
display only at -v or higher verbosity; they are never treated as chat.
|
||||
"""
|
||||
match = LIVESTATS_PATTERN.match(strip_color_codes(message).strip())
|
||||
if not match:
|
||||
clean = strip_color_codes(message).strip()
|
||||
if not clean.lower().startswith('livestats'):
|
||||
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))
|
||||
ui.update_server_info(game_state)
|
||||
|
||||
Reference in New Issue
Block a user