]> git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/scoreboard.mako
Playing around with teamscore display (uses random scores for testing)
[xonotic/xonstat.git] / xonstat / templates / scoreboard.mako
1 <%def name="scoreboard(game_type_cd, pgstats, teams=None, show_elo=False, show_latency=False)">
2 ##teams: { scoreboardpos : ( teamname, teamscore, playercount ) }
3 % if teamscores:
4 <table class="table table-condensed">
5 <tbody><tr class="teamscores">
6 % for team,score in sorted(teamscores.items(), key=lambda x:x[1], reverse=True):
7     <td class="${team} teamscore" width="${100/len(teamscores)}%">${team.capitalize()} Team: ${score}</td>
8 % endfor
9   </tr></tbody>
10 </table>
11 % endif
12
13 <table class="table table-hover table-condensed">
14   ${scoreboard_header(game_type_cd, pgstats[0])}
15   <tbody>
16   % for pgstat in pgstats:
17   <tr class="${pgstat.team_html_color()}">
18     <td class="nostretch">
19       % if pgstat.player_id > 2:
20       <a href="${request.route_url("player_info", id=pgstat.player_id)}"
21         title="Go to the info page for this player">
22         <span class="nick">${pgstat.nick_html_colors()|n}</span>
23       </a>
24       % else:
25       <span class="nick">${pgstat.nick_html_colors()|n}</span>
26       % endif
27     </td>
28     % if show_latency and pgstat.avg_latency is not None:
29     <td class="scoreboard-entry">
30       ${int(round(pgstat.avg_latency))}
31     </td>
32     % elif show_latency:
33     <td class="scoreboard-entry"></td>
34     % endif
35     ${scoreboard_row(game_type_cd, pgstat)}
36     % if game_type_cd != 'cts':
37     <td class="scoreboard-entry">${pgstat.score}</td>
38     % endif
39     % if show_elo:
40     % if pgstat.elo_delta is not None:
41     <td class="scoreboard-entry">${round(pgstat.elo_delta,2)}</td>
42     % else:
43     <td class="scoreboard-entry">-</td>
44     % endif
45     % endif
46     ##% if teams:
47     ##% if teams.has_key(pgstat.scoreboardpos):
48     ##<td class="scoreboard-entry teamscore" rowspan="${teams[pgstat.scoreboardpos].playercount}">${teams[pgstat.scoreboardpos].teamscore}</td>
49     ##% endif
50     ##% endif
51   </tr>
52   % endfor
53   </tbody>
54 </table>
55 </%def>
56
57 ##### SCOREBOARD HEADER #####
58 <%def name="scoreboard_header(game_type_cd, pgstat)">
59 % if game_type_cd == 'as':
60 <thead>
61   <tr>
62     <th class="nick">Nick</th>
63     % if show_latency:
64     <th class="ping">Ping</th>
65     % endif
66     <th class="kills">Kills</th>
67     <th class="deaths">Deaths</th>
68     <th class="suicides">Suicides</th>
69     <th class="objectives">Objectives</th>
70     <th class="score">Score</th>
71     ##% if teams:
72     ##<th class="teamscore">Teamscore</th>
73     ##% endif
74     % if show_elo:
75     <th>Elo Change</th>
76     % endif
77   </tr>
78 </thead>
79 % endif
80
81 % if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
82 <thead>
83   <tr>
84     <th class="nick">Nick</th>
85     % if show_latency:
86     <th class="ping">Ping</th>
87     % endif
88     <th class="kills">Kills</th>
89     <th class="deaths">Deaths</th>
90     <th class="suicides">Suicides</th>
91     <th class="score">Score</th>
92     ##% if teams:
93     ##<th class="teamscore">Teamscore</th>
94     ##% endif
95     % if show_elo:
96     <th>Elo Change</th>
97     % endif
98   </tr>
99 </thead>
100 % endif
101
102 % if game_type_cd == 'cq':
103 <thead>
104   <tr>
105     <th class="nick">Nick</th>
106     % if show_latency:
107     <th class="ping">Ping</th>
108     % endif
109     <th class="kills">Kills</th>
110     <th class="deaths">Deaths</th>
111     <th class="captured">Captured</th>
112     <th class="released">Released</th>
113     <th class="score">Score</th>
114     ##% if show_elo:
115     ##<th>Elo Change</th>
116     ##% endif
117   </tr>
118 </thead>
119 % endif
120
121 % if game_type_cd == 'cts':
122 <thead>
123   <tr>
124     <th class="nick">Nick</th>
125     % if show_latency:
126     <th class="ping">Ping</th>
127     % endif
128     <th class="fastest">Fastest Time</th>
129     <th class="deaths">Deaths</th>
130   </tr>
131 </thead>
132 % endif
133
134 % if game_type_cd == 'ctf':
135 <thead class="ctf ${pgstat.team_html_color()}">
136   <tr>
137     <th class="nick">Nick</th>
138     % if show_latency:
139     <th class="ping">Ping</th>
140     % endif
141     <th class="kills">Kills</th>
142     <th class="captures">Captures</th>
143     <th class="pickups">Pickups</th>
144     <th class="fck" title="Flag Carrier Kill">FCK</th>
145     <th class="returns">Returns</th>
146     <th class="score">Score</th>
147     ##% if teams:
148     ##<th class="teamscore">Teamscore</th>
149     ##% endif
150     % if show_elo:
151     <th>Elo Change</th>
152     % endif
153   </tr>
154 </thead>
155 % endif
156
157 % if game_type_cd == 'dom':
158 <thead class="dom ${pgstat.team_html_color()}">
159   <tr>
160     <th class="nick">Nick</th>
161     % if show_latency:
162     <th class="ping">Ping</th>
163     % endif
164     <th class="kills">Kills</th>
165     <th class="deaths">Deaths</th>
166     <th class="takes">Takes</th>
167     <th class="ticks">Ticks</th>
168     <th class="score">Score</th>
169     ##% if teams:
170     ##<th class="teamscore">Teamscore</th>
171     ##% endif
172     % if show_elo:
173     <th>Elo Change</th>
174     % endif
175   </tr>
176 </thead>
177 % endif
178
179 % if game_type_cd in 'ft' 'freezetag':
180 <thead class="freezetag ${pgstat.team_html_color()}">
181   <tr>
182     <th class="nick">Nick</th>
183     % if show_latency:
184     <th class="ping">Ping</th>
185     % endif
186     <th class="kills">Kills</th>
187     <th class="deaths">Deaths</th>
188     <th class="revivals">Revivals</th>
189     <th class="score">Score</th>
190     ##% if teams:
191     ##<th class="teamscore">Teamscore</th>
192     ##% endif
193     % if show_elo:
194     <th>Elo Change</th>
195     % endif
196   </tr>
197 </thead>
198 % endif
199
200 % if game_type_cd in 'ka' 'keepaway':
201 <thead>
202   <tr>
203     <th class="nick">Nick</th>
204     % if show_latency:
205     <th class="ping">Ping</th>
206     % endif
207     <th class="kills">Kills</th>
208     <th class="deaths">Deaths</th>
209     <th class="pickups">Pickups</th>
210     <th class="bctime">BC Time</th>
211     <th class="bckills">BC Kills</th>
212     ##% if teams:
213     ##<th class="teamscore">Teamscore</th>
214     ##% endif
215     % if show_elo:
216     <th>Elo Change</th>
217     % endif
218   </tr>
219 </thead>
220 % endif
221
222 % if game_type_cd == 'kh':
223 <thead class="kh ${pgstat.team_html_color()}">
224   <tr>
225     <th class="nick">Nick</th>
226     % if show_latency:
227     <th class="ping">Ping</th>
228     % endif
229     <th class="kills">Kills</th>
230     <th class="deaths">Deaths</th>
231     <th class="pickups">Pickups</th>
232     <th class="caps">Captures</th>
233     <th class="losses">Losses</th>
234     <th class="pushes">Pushes</th>
235     <th class="destroys">Destroys</th>
236     <th class="kckills">KC Kills</th>
237     <th class="score">Score</th>
238     ##% if teams:
239     ##<th class="teamscore">Teamscore</th>
240     ##% endif
241     % if show_elo:
242     <th>Elo Change</th>
243     % endif
244   </tr>
245 </thead>
246 % endif
247
248 % if game_type_cd in 'nb' 'nexball':
249 <thead class="nb ${pgstat.team_html_color()}">
250   <tr>
251     <th class="nick">Nick</th>
252     % if show_latency:
253     <th class="ping">Ping</th>
254     % endif
255     <th class="goals">Goals</th>
256     <th class="faults">Faults</th>
257     <th class="score">Score</th>
258     ##% if teams:
259     ##<th class="teamscore">Teamscore</th>
260     ##% endif
261     % if show_elo:
262     <th>Elo Change</th>
263     % endif
264   </tr>
265 </thead>
266 % endif
267
268 % if game_type_cd == 'rc':
269 <thead>
270   <tr>
271     <th class="nick">Nick</th>
272     % if show_latency:
273     <th class="ping">Ping</th>
274     % endif
275     <th class="laps">Laps</th>
276     <th class="fastest">Fastest Lap</th>
277     <th class="time">Time</th>
278   </tr>
279 </thead>
280 % endif
281
282 </%def>
283
284 ##### SCOREBOARD ROWS #####
285 <%def name="scoreboard_row(game_type_cd, pgstat)">
286 % if game_type_cd == 'as':
287 <td class="scoreboard-entry">${pgstat.kills}</td>
288 <td class="scoreboard-entry">${pgstat.deaths}</td>
289 <td class="scoreboard-entry">${pgstat.suicides}</td>
290 <td class="scoreboard-entry">${pgstat.collects}</td>
291 % endif
292
293 % if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
294 <td class="scoreboard-entry">${pgstat.kills}</td>
295 <td class="scoreboard-entry">${pgstat.deaths}</td>
296 <td class="scoreboard-entry">${pgstat.suicides}</td>
297 % endif
298
299 % if game_type_cd == 'cq':
300 <td class="scoreboard-entry">${pgstat.kills}</td>
301 <td class="scoreboard-entry">${pgstat.deaths}</td>
302 <td class="scoreboard-entry">${pgstat.captures}</td>
303 <td class="scoreboard-entry">${pgstat.drops}</td>
304 % endif
305
306 % if game_type_cd == 'cts':
307 % if pgstat.fastest is not None:
308 <td class="scoreboard-entry">${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
309 % else:
310 <td class="scoreboard-entry">-</td>
311 % endif
312 <td class="scoreboard-entry">${pgstat.deaths}</td>
313 % endif
314
315 % if game_type_cd == 'ctf':
316 <td class="scoreboard-entry">${pgstat.kills}</td>
317 <td class="scoreboard-entry">${pgstat.captures}</td>
318 <td class="scoreboard-entry">${pgstat.pickups}</td>
319 <td class="scoreboard-entry">${pgstat.carrier_frags}</td>
320 <td class="scoreboard-entry">${pgstat.returns}</td>
321 % endif
322
323 % if game_type_cd == 'dom':
324 <td class="scoreboard-entry">${pgstat.kills}</td>
325 <td class="scoreboard-entry">${pgstat.deaths}</td>
326 <td class="scoreboard-entry">${pgstat.pickups}</td>
327 <td class="scoreboard-entry">${pgstat.drops}</td>
328 % endif
329
330 % if game_type_cd in 'ft' 'freezetag':
331 <td class="scoreboard-entry">${pgstat.kills}</td>
332 <td class="scoreboard-entry">${pgstat.deaths}</td>
333 <td class="scoreboard-entry">${pgstat.revivals}</td>
334 % endif
335
336 % if game_type_cd in 'ka' 'keepaway':
337 <td class="scoreboard-entry">${pgstat.kills}</td>
338 <td class="scoreboard-entry">${pgstat.deaths}</td>
339 <td class="scoreboard-entry">${pgstat.pickups}</td>
340
341 % if pgstat.time is not None:
342 <td class="scoreboard-entry">${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
343 % else:
344 <td class="scoreboard-entry">-</td>
345 % endif
346
347 <td class="scoreboard-entry">${pgstat.fckills}</td>
348 % endif
349
350 % if game_type_cd == 'kh':
351 <td class="scoreboard-entry">${pgstat.kills}</td>
352 <td class="scoreboard-entry">${pgstat.deaths}</td>
353 <td class="scoreboard-entry">${pgstat.pickups}</td>
354 <td class="scoreboard-entry">${pgstat.captures}</td>
355 <td class="scoreboard-entry">${pgstat.drops}</td>
356 <td class="scoreboard-entry">${pgstat.pushes}</td>
357 <td class="scoreboard-entry">${pgstat.destroys}</td>
358 <td class="scoreboard-entry">${pgstat.carrier_frags}</td>
359 % endif
360
361 % if game_type_cd in 'nb' 'nexball':
362 <td class="scoreboard-entry">${pgstat.captures}</td>
363 <td class="scoreboard-entry">${pgstat.drops}</td>
364 % endif
365
366 % if game_type_cd == 'rc':
367 <td class="scoreboard-entry">${pgstat.laps}</td>
368
369 % if pgstat.fastest is not None:
370 <td class="scoreboard-entry">${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
371 % else:
372 <td class="scoreboard-entry">-</td>
373 % endif
374
375 % if pgstat.time is not None:
376 <td class="scoreboard-entry">${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
377 % else:
378 <td class="scoreboard-entry">-</td>
379 % endif
380 % endif
381
382 </%def>