This commit is contained in:
xbl
2025-12-29 17:06:14 +01:00
parent bc4f62dcf8
commit 1a57258a2d
3 changed files with 16 additions and 17 deletions

View File

@ -10,9 +10,9 @@ DEFAULT_HOST = 'tcp://127.0.0.1:27961'
POLL_TIMEOUT = 100
# UI dimensions
INFO_WINDOW_HEIGHT = 11
INFO_WINDOW_HEIGHT = 12
INFO_WINDOW_Y = 2
OUTPUT_WINDOW_Y = 12
OUTPUT_WINDOW_Y = 14
INPUT_WINDOW_HEIGHT = 2
# Event deduplication

View File

@ -155,7 +155,7 @@ class EventParser:
# -1 for environmental death
if not data.get('WARMUP', False):
self.game_state.player_tracker.update_score(victim_name, -1)
score_prefix = "^0^1[-1]^9 "
score_prefix = "^0^1[-1]^7^9 "
mod = data.get('MOD', 'UNKNOWN')
msg_template = DEATH_MESSAGES.get(mod, "%s^0%s^9 ^1DIED FROM %s^7")
@ -183,7 +183,7 @@ class EventParser:
# -1 for suicide
if not data.get('WARMUP', False):
self.game_state.player_tracker.update_score(victim_name, -1)
score_prefix = "^0^1[-1]^9 "
score_prefix = "^0^1[-1]^7^9 "
weapon = killer.get('WEAPON', 'OTHER_WEAPON')
if weapon != 'OTHER_WEAPON':
@ -194,7 +194,7 @@ class EventParser:
# Regular kill: +1 for killer
if not data.get('WARMUP', False):
self.game_state.player_tracker.update_score(killer_name, 1)
score_prefix = "^0^2[+1]^9 "
score_prefix = "^0^2[+1]^7^9 "
else:
score_prefix = ""

23
ui.py
View File

@ -127,7 +127,7 @@ class UIManager:
# Output window (middle - main display)
self.output_window = curses.newwin(
maxy - 15,
maxy - 17,
maxx - 4,
OUTPUT_WINDOW_Y,
2
@ -324,6 +324,9 @@ class UIManager:
f"^3^9Type:^7^0 {gametype} ^9^3| Map:^7^0 {mapname} ^9^3| Players:^7^0 {curclients}/{maxclients} "
f"^3^9| Limits (T/F/R/C):^7^0 {timelimit}/{fraglimit}/{roundlimit}/{caplimit}^9\n", 0)
# Blank lines to fill
self.info_window.addstr("\n")
# Line 3: Team headers and player lists
teams = game_state.player_tracker.get_players_by_team()
@ -348,7 +351,7 @@ class UIManager:
red_score = f"{red_total:>3} "
blue_score = f"{blue_total:>3} "
print_colored(self.info_window, f"^0^1RED TEAM: ^7{red_score} ^4BLUE TEAM: ^7{blue_score} ^3(SPEC)\n", 0)
print_colored(self.info_window, f"^0^7{red_score}^1RED TEAM ^7{blue_score}^4BLUE TEAM\n", 0)
# Sort players by score within each team
red_players_with_scores = []
@ -382,7 +385,6 @@ class UIManager:
for i in range(4):
red_name = red_players[i] if i < len(red_players) else ''
blue_name = blue_players[i] if i < len(blue_players) else ''
spec = spec_players[i] if i < len(spec_players) else ''
# Get scores for team players
red_score = ''
@ -405,15 +407,13 @@ class UIManager:
from formatter import strip_color_codes
red_clean = strip_color_codes(red)
blue_clean = strip_color_codes(blue)
spec_clean = strip_color_codes(spec)
red_pad = 24 - len(red_clean)
blue_pad = 24 - len(blue_clean)
line = f"^0{red}^9{' ' * red_pad}^0{blue}^9{' ' * blue_pad}^0{spec}^9\n"
line = f"^0{red}^9{' ' * red_pad}^0{blue}^9\n"
print_colored(self.info_window, line, 0)
else:
print_colored(self.info_window, f" ^0^5(FREE) ^5(FREE) ^3(SPEC)\n", 0)
print_colored(self.info_window, f"^0 ^5FREE\n", 0)
# Sort FREE players by score (highest first)
free_players = teams['FREE']
free_players_with_scores = []
@ -436,7 +436,6 @@ class UIManager:
for i in range(4):
col1_name = free_col1[i] if i < len(free_col1) else ''
col2_name = free_col2[i] if i < len(free_col2) else ''
spec = spec_players[i] if i < len(spec_players) else ''
# Get scores for FREE players
col1_score = ''
@ -459,18 +458,18 @@ class UIManager:
from formatter import strip_color_codes
col1_clean = strip_color_codes(col1)
col2_clean = strip_color_codes(col2)
spec_clean = strip_color_codes(spec)
col1_pad = 24 - len(col1_clean)
col2_pad = 24 - len(col2_clean)
line = f"^0{col1}^9{' ' * col1_pad}^0{col2}^9{' ' * col2_pad}^0{spec}^9\n"
line = f"^0{col1}^9{' ' * col1_pad}^0{col2}^9\n"
print_colored(self.info_window, line, 0)
# Blank lines to fill
self.info_window.addstr("\n")
line=f"^0^3(SPEC)^7^9\n"
# List spectators on one line
spec_list = " ".join(spec_players)
line = f"^0 ^3SPEC^7 {spec_list}\n"
print_colored(self.info_window, line, 0)
# Blank lines to fill