From d0c68216c2517d0c3fb0564d73c1421e14ea2372 Mon Sep 17 00:00:00 2001 From: antzucaro Date: Mon, 27 Jun 2011 21:44:02 -0400 Subject: [PATCH] Modularize the scoreboard with defs - one for header, the other for the bulk of stat rows. --- xonstat/templates/scoreboard.mako | 122 +++++++++++++++++------------- 1 file changed, 70 insertions(+), 52 deletions(-) diff --git a/xonstat/templates/scoreboard.mako b/xonstat/templates/scoreboard.mako index 9d89092..b62ba06 100755 --- a/xonstat/templates/scoreboard.mako +++ b/xonstat/templates/scoreboard.mako @@ -1,18 +1,7 @@ <%def name="scoreboard(game_type_cd, pgstats)"> -##### CTF ##### -% if game_type_cd == 'ctf': - - - - - - - - - - +${scoreboard_header(game_type_cd)} % for pgstat in pgstats: @@ -20,17 +9,13 @@ % if pgstat.player_id > 2: - ${pgstat.nick_html_colors()} + ${pgstat.nick_html_colors()|n} % else: - ${pgstat.nick_html_colors()} + ${pgstat.nick_html_colors()|n} % endif - - - - - + ${scoreboard_row(game_type_cd, pgstat)} % endfor -% endif +
NickKillsCapturesPickupsFlag Carrier KillsReturnsScoreAccuracy
${pgstat.kills}${pgstat.captures}${pgstat.pickups}${pgstat.carrier_frags}${pgstat.returns}${pgstat.score} % if pgstat.player_id > 1: @@ -42,46 +27,79 @@
+ -##### DM ##### -% if game_type_cd == 'dm': +##### SCOREBOARD HEADER ##### +<%def name="scoreboard_header(game_type_cd)"> +% if game_type_cd == 'dm' or game_type_cd == 'tdm': - Nick - Kills - Deaths - Suicides - Score - Accuracy + Nick + Kills + Deaths + Suicides + Score + Accuracy +% endif -% for pgstat in pgstats: - - - % if pgstat.player_id > 2: - - ${pgstat.nick_html_colors()} - - % else: - ${pgstat.nick_html_colors()} - % endif - +% if game_type_cd == 'ctf': + + Nick + Kills + Captures + Pickups + Flag Carrier Kills + Returns + Score + Accuracy + +% endif + +% if game_type_cd == 'ca': + + Nick + Kills + Score + Accuracy + +% endif + +% if game_type_cd == 'freezetag': + + Nick + Kills + Deaths + Suicides + Score + Accuracy + +% endif + + +##### SCOREBOARD ROWS ##### +<%def name="scoreboard_row(game_type_cd, pgstat)"> +% if game_type_cd == 'dm' or game_type_cd == 'tdm': ${pgstat.kills} ${pgstat.deaths} ${pgstat.suicides} - ${pgstat.score} - - % if pgstat.player_id > 1: - - View - - % endif - - -% endfor % endif - +% if game_type_cd == 'ctf': + ${pgstat.kills} + ${pgstat.captures} + ${pgstat.pickups} + ${pgstat.carrier_frags} + ${pgstat.returns} +% endif + +% if game_type_cd == 'ca': + ${pgstat.kills} +% endif + +% if game_type_cd == 'freezetag': + ${pgstat.kills} + ${pgstat.deaths} + ${pgstat.suicides} +% endif -- 2.39.2