]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/scoreboard.mako
On second thought, don't
[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       % if game_type_cd != 'cts':
26       <td>${pgstat.score}</td>
27       % endif
28       % if show_elo:
29         % if pgstat.elo_delta is not None:
30         <td>${round(pgstat.elo_delta,2)}</td>
31         % else:
32         <td>-</td>
33         % endif
34       % endif
35     </tr>
36   % endfor
37   </tbody>
38 </table>
39 </%def>
40
41 ##### SCOREBOARD HEADER #####
42 <%def name="scoreboard_header(game_type_cd, pgstat)">
43 % if game_type_cd == 'as':
44     <thead>
45     <tr>
46       <th class="nick">Nick</th>
47       % if show_latency:
48       <th class="ping">Ping</th>
49       % endif
50       <th class="kills">Kills</th>
51       <th class="deaths">Deaths</th>
52       <th class="suicides">Suicides</th>
53       <th class="objectives">Objectives</th>
54       <th class="score">Score</th>
55       % if show_elo:
56       <th>Elo Change</th>
57       % endif
58     </tr>
59     </thead>
60 % endif
61
62 % if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
63     <thead>
64     <tr>
65       <th class="nick">Nick</th>
66       % if show_latency:
67       <th class="ping">Ping</th>
68       % endif
69       <th class="kills">Kills</th>
70       <th class="deaths">Deaths</th>
71       <th class="suicides">Suicides</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 == 'cq':
81     <thead>
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="deaths">Deaths</th>
89       <th class="captured">Captured</th>
90       <th class="released">Released</th>
91       <th class="score">Score</th>
92       % if show_elo:
93       <th>Elo Change</th>
94       % endif
95     </tr>
96     </thead>
97 % endif
98
99 % if game_type_cd == 'cts':
100     <thead>
101     <tr>
102       <th class="nick">Nick</th>
103       % if show_latency:
104       <th class="ping">Ping</th>
105       % endif
106       <th class="fastest">Fastest Time</th>
107     </tr>
108     </thead>
109 % endif
110
111 % if game_type_cd == 'ctf':
112     <thead class="ctf ${pgstat.team_html_color()}">
113     <tr>
114       <th class="nick">Nick</th>
115       % if show_latency:
116       <th class="ping">Ping</th>
117       % endif
118       <th class="kills">Kills</th>
119       <th class="captures">Captures</th>
120       <th class="pickups">Pickups</th>
121       <th class="fck" title="Flag Carrier Kill">FCK</th>
122       <th class="returns">Returns</th>
123       <th class="score">Score</th>
124       % if show_elo:
125       <th>Elo Change</th>
126       % endif
127     </tr>
128     </thead>
129 % endif
130
131 % if game_type_cd == 'dom':
132     <thead class="dom ${pgstat.team_html_color()}">
133     <tr>
134       <th class="nick">Nick</th>
135       % if show_latency:
136       <th class="ping">Ping</th>
137       % endif
138       <th class="kills">Kills</th>
139       <th class="deaths">Deaths</th>
140       <th class="takes">Takes</th>
141       <th class="ticks">Ticks</th>
142       <th class="score">Score</th>
143       % if show_elo:
144       <th>Elo Change</th>
145       % endif
146     </tr>
147     </thead>
148 % endif
149
150 % if game_type_cd in 'ft' 'freezetag':
151     <thead class="freezetag ${pgstat.team_html_color()}">
152     <tr>
153       <th class="nick">Nick</th>
154       % if show_latency:
155       <th class="ping">Ping</th>
156       % endif
157       <th class="kills">Kills</th>
158       <th class="deaths">Deaths</th>
159       <th class="revivals">Revivals</th>
160       <th class="score">Score</th>
161       % if show_elo:
162       <th>Elo Change</th>
163       % endif
164     </tr>
165     </thead>
166 % endif
167
168 % if game_type_cd in 'ka' 'keepaway':
169     <thead>
170     <tr>
171       <th class="nick">Nick</th>
172       % if show_latency:
173       <th class="ping">Ping</th>
174       % endif
175       <th class="kills">Kills</th>
176       <th class="deaths">Deaths</th>
177       <th class="pickups">Pickups</th>
178       <th class="bctime">BC Time</th>
179       <th class="bckills">BC Kills</th>
180       % if show_elo:
181       <th>Elo Change</th>
182       % endif
183     </tr>
184     </thead>
185 % endif
186
187 % if game_type_cd == 'kh':
188     <thead class="kh ${pgstat.team_html_color()}">
189     <tr>
190       <th class="nick">Nick</th>
191       % if show_latency:
192       <th class="ping">Ping</th>
193       % endif
194       <th class="kills">Kills</th>
195       <th class="deaths">Deaths</th>
196       <th class="pickups">Pickups</th>
197       <th class="caps">Captures</th>
198       <th class="losses">Losses</th>
199       <th class="pushes">Pushes</th>
200       <th class="destroys">Destroys</th>
201       <th class="kckills">KC Kills</th>
202       <th class="score">Score</th>
203       % if show_elo:
204       <th>Elo Change</th>
205       % endif
206     </tr>
207     </thead>
208 % endif
209
210 % if game_type_cd in 'nb' 'nexball':
211     <thead class="nb ${pgstat.team_html_color()}">
212     <tr>
213       <th class="nick">Nick</th>
214       % if show_latency:
215       <th class="ping">Ping</th>
216       % endif
217       <th class="goals">Goals</th>
218       <th class="faults">Faults</th>
219       <th class="score">Score</th>
220       % if show_elo:
221       <th>Elo Change</th>
222       % endif
223     </tr>
224     </thead>
225 % endif
226
227 % if game_type_cd == 'rc':
228     <thead>
229     <tr>
230       <th class="nick">Nick</th>
231       % if show_latency:
232       <th class="ping">Ping</th>
233       % endif
234       <th class="laps">Laps</th>
235       <th class="fastest">Fastest Lap</th>
236       <th class="time">Time</th>
237     </tr>
238     </thead>
239 % endif
240
241 </%def>
242
243 ##### SCOREBOARD ROWS #####
244 <%def name="scoreboard_row(game_type_cd, pgstat)">
245 % if game_type_cd == 'as':
246         <td>${pgstat.kills}</td>
247         <td>${pgstat.deaths}</td>
248         <td>${pgstat.suicides}</td>
249         <td>${pgstat.collects}</td>
250 % endif
251
252 % if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
253         <td>${pgstat.kills}</td>
254         <td>${pgstat.deaths}</td>
255         <td>${pgstat.suicides}</td>
256 % endif
257
258 % if game_type_cd == 'cq':
259         <td>${pgstat.kills}</td>
260         <td>${pgstat.deaths}</td>
261         <td>${pgstat.captures}</td>
262         <td>${pgstat.drops}</td>
263 % endif
264
265 % if game_type_cd == 'cts':
266         % if pgstat.fastest is not None:
267         <td>${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
268         % else:
269         <td>-</td>
270         % endif
271 % endif
272
273 % if game_type_cd == 'ctf':
274         <td>${pgstat.kills}</td>
275         <td>${pgstat.captures}</td>
276         <td>${pgstat.pickups}</td>
277         <td>${pgstat.carrier_frags}</td>
278         <td>${pgstat.returns}</td>
279 % endif
280
281 % if game_type_cd == 'dom':
282         <td>${pgstat.kills}</td>
283         <td>${pgstat.deaths}</td>
284         <td>${pgstat.pickups}</td>
285         <td>${pgstat.drops}</td>
286 % endif
287
288 % if game_type_cd in 'ft' 'freezetag':
289         <td>${pgstat.kills}</td>
290         <td>${pgstat.deaths}</td>
291         <td>${pgstat.revivals}</td>
292 % endif
293
294 % if game_type_cd in 'ka' 'keepaway':
295         <td>${pgstat.kills}</td>
296         <td>${pgstat.deaths}</td>
297         <td>${pgstat.pickups}</td>
298
299         % if pgstat.time is not None:
300         <td>${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
301         % else:
302         <td>-</td>
303         % endif
304
305         <td>${pgstat.fckills}</td>
306 % endif
307
308 % if game_type_cd == 'kh':
309         <td>${pgstat.kills}</td>
310         <td>${pgstat.deaths}</td>
311         <td>${pgstat.pickups}</td>
312         <td>${pgstat.captures}</td>
313         <td>${pgstat.drops}</td>
314         <td>${pgstat.pushes}</td>
315         <td>${pgstat.destroys}</td>
316         <td>${pgstat.carrier_frags}</td>
317 % endif
318
319 % if game_type_cd in 'nb' 'nexball':
320         <td>${pgstat.captures}</td>
321         <td>${pgstat.drops}</td>
322 % endif
323
324 % if game_type_cd == 'rc':
325         <td>${pgstat.laps}</td>
326
327         % if pgstat.fastest is not None:
328         <td>${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
329         % else:
330         <td>-</td>
331         % endif
332
333         % if pgstat.time is not None:
334         <td>${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
335         % else:
336         <td>-</td>
337         % endif
338 % endif
339
340 </%def>