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