]> git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/scoreboard.mako
Make latency displays parameter-driven.
[xonotic/xonstat.git] / xonstat / templates / scoreboard.mako
1 <%def name="scoreboard(game_type_cd, pgstats, show_elo=False, show_latency=False)">
2 <table  class="table table-bordered table-condensed">
3 ${scoreboard_header(game_type_cd, pgstats[0])}
4 ${show_latency}
5   <tbody>
6   % for pgstat in pgstats:
7     <tr class="${pgstat.team_html_color()}">
8       <td>
9       % if pgstat.player_id > 2:
10         <a href="${request.route_url("player_info", id=pgstat.player_id)}"
11          title="Go to the info page for this player">
12         <span class="nick">${pgstat.nick_html_colors()|n}</span>
13         </a>
14       % else:
15         <span class="nick">${pgstat.nick_html_colors()|n}</span>
16       % endif
17       </td>
18       % if show_latency and pgstat.avg_latency is not None:
19       <td>
20         ${int(round(pgstat.avg_latency))}
21       </td>
22       % elif show_latency:
23       <td></td>
24       % endif
25       ${scoreboard_row(game_type_cd, pgstat)}
26       <td>${pgstat.score}</td>
27       % if show_elo:
28         % if pgstat.elo_delta is not None:
29         <td>${round(pgstat.elo_delta,2)}</td>
30         % else:
31         <td>-</td>
32         % endif
33       % endif
34     </tr>
35   % endfor
36   </tbody>
37 </table>
38 </%def>
39
40 ##### SCOREBOARD HEADER #####
41 <%def name="scoreboard_header(game_type_cd, pgstat)">
42 % if game_type_cd == 'dm' or game_type_cd == 'tdm' or game_type_cd == 'duel':
43     <thead>
44     <tr>
45       <th class="nick">Nick</th>
46       % if show_latency:
47       <th class="ping">Ping</th>
48       % endif
49       <th class="kills">Kills</th>
50       <th class="deaths">Deaths</th>
51       <th class="suicides">Suicides</th>
52       <th class="score">Score</th>
53       % if show_elo:
54       <th>Elo Change</th>
55       % endif
56     </tr>
57     </thead>
58 % endif
59
60 % if game_type_cd == 'ctf':
61     <thead class="ctf ${pgstat.team_html_color()}">
62     <tr>
63       <th class="nick">Nick</th>
64       % if show_latency:
65       <th class="ping">Ping</th>
66       % endif
67       <th class="kills">Kills</th>
68       <th class="captures">Captures</th>
69       <th class="pickups">Pickups</th>
70       <th class="fck" title="Flag Carrier Kill">FCK</th>
71       <th class="returns">Returns</th>
72       <th class="score">Score</th>
73       % if show_elo:
74       <th>Elo Change</th>
75       % endif
76     </tr>
77     </thead>
78 % endif
79
80 % if game_type_cd == 'ca':
81     <thead class="ca ${pgstat.team_html_color()}">
82     <tr>
83       <th class="nick">Nick</th>
84       % if show_latency:
85       <th class="ping">Ping</th>
86       % endif
87       <th class="kills">Kills</th>
88       <th class="score">Score</th>
89       % if show_elo:
90       <th>Elo Change</th>
91       % endif
92     </tr>
93     </thead>
94 % endif
95
96 % if game_type_cd == 'freezetag':
97     <thead class="freezetag ${pgstat.team_html_color()}">
98     <tr>
99       <th class="nick">Nick</th>
100       % if show_latency:
101       <th class="ping">Ping</th>
102       % endif
103       <th class="kills">Kills</th>
104       <th class="deaths">Deaths</th>
105       <th class="suicides">Suicides</th>
106       <th class="score">Score</th>
107       % if show_elo:
108       <th>Elo Change</th>
109       % endif
110     </tr>
111     </thead>
112 % endif
113 </%def>
114
115 ##### SCOREBOARD ROWS #####
116 <%def name="scoreboard_row(game_type_cd, pgstat)">
117 % if game_type_cd == 'dm' or game_type_cd == 'tdm' or game_type_cd == 'duel':
118         <td>${pgstat.kills}</td>
119         <td>${pgstat.deaths}</td>
120         <td>${pgstat.suicides}</td>
121 % endif
122
123 % if game_type_cd == 'ctf':
124         <td>${pgstat.kills}</td>
125         <td>${pgstat.captures}</td>
126         <td>${pgstat.pickups}</td>
127         <td>${pgstat.carrier_frags}</td>
128         <td>${pgstat.returns}</td>
129 % endif
130
131 % if game_type_cd == 'ca':
132         <td>${pgstat.kills}</td>
133 % endif
134
135 % if game_type_cd == 'freezetag':
136         <td>${pgstat.kills}</td>
137         <td>${pgstat.deaths}</td>
138         <td>${pgstat.suicides}</td>
139 % endif
140 </%def>