]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/scoreboard.mako
Merge zykure-approved, my fixes, and merge fixes :D
[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-hover 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 class="player-nick">
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     <th class="deaths">Deaths</th>
108   </tr>
109 </thead>
110 % endif
111
112 % if game_type_cd == 'ctf':
113 <thead class="ctf ${pgstat.team_html_color()}">
114   <tr>
115     <th class="nick">Nick</th>
116     % if show_latency:
117     <th class="ping">Ping</th>
118     % endif
119     <th class="kills">Kills</th>
120     <th class="captures">Captures</th>
121     <th class="pickups">Pickups</th>
122     <th class="fck" title="Flag Carrier Kill">FCK</th>
123     <th class="returns">Returns</th>
124     <th class="score">Score</th>
125     % if show_elo:
126     <th>Elo Change</th>
127     % endif
128   </tr>
129 </thead>
130 % endif
131
132 % if game_type_cd == 'dom':
133 <thead class="dom ${pgstat.team_html_color()}">
134   <tr>
135     <th class="nick">Nick</th>
136     % if show_latency:
137     <th class="ping">Ping</th>
138     % endif
139     <th class="kills">Kills</th>
140     <th class="deaths">Deaths</th>
141     <th class="takes">Takes</th>
142     <th class="ticks">Ticks</th>
143     <th class="score">Score</th>
144     % if show_elo:
145     <th>Elo Change</th>
146     % endif
147   </tr>
148 </thead>
149 % endif
150
151 % if game_type_cd in 'ft' 'freezetag':
152 <thead class="freezetag ${pgstat.team_html_color()}">
153   <tr>
154     <th class="nick">Nick</th>
155     % if show_latency:
156     <th class="ping">Ping</th>
157     % endif
158     <th class="kills">Kills</th>
159     <th class="deaths">Deaths</th>
160     <th class="revivals">Revivals</th>
161     <th class="score">Score</th>
162     % if show_elo:
163     <th>Elo Change</th>
164     % endif
165   </tr>
166 </thead>
167 % endif
168
169 % if game_type_cd in 'ka' 'keepaway':
170 <thead>
171   <tr>
172     <th class="nick">Nick</th>
173     % if show_latency:
174     <th class="ping">Ping</th>
175     % endif
176     <th class="kills">Kills</th>
177     <th class="deaths">Deaths</th>
178     <th class="pickups">Pickups</th>
179     <th class="bctime">BC Time</th>
180     <th class="bckills">BC Kills</th>
181     % if show_elo:
182     <th>Elo Change</th>
183     % endif
184   </tr>
185 </thead>
186 % endif
187
188 % if game_type_cd == 'kh':
189 <thead class="kh ${pgstat.team_html_color()}">
190   <tr>
191     <th class="nick">Nick</th>
192     % if show_latency:
193     <th class="ping">Ping</th>
194     % endif
195     <th class="kills">Kills</th>
196     <th class="deaths">Deaths</th>
197     <th class="pickups">Pickups</th>
198     <th class="caps">Captures</th>
199     <th class="losses">Losses</th>
200     <th class="pushes">Pushes</th>
201     <th class="destroys">Destroys</th>
202     <th class="kckills">KC Kills</th>
203     <th class="score">Score</th>
204     % if show_elo:
205     <th>Elo Change</th>
206     % endif
207   </tr>
208 </thead>
209 % endif
210
211 % if game_type_cd in 'nb' 'nexball':
212 <thead class="nb ${pgstat.team_html_color()}">
213   <tr>
214     <th class="nick">Nick</th>
215     % if show_latency:
216     <th class="ping">Ping</th>
217     % endif
218     <th class="goals">Goals</th>
219     <th class="faults">Faults</th>
220     <th class="score">Score</th>
221     % if show_elo:
222     <th>Elo Change</th>
223     % endif
224   </tr>
225 </thead>
226 % endif
227
228 % if game_type_cd == 'rc':
229 <thead>
230   <tr>
231     <th class="nick">Nick</th>
232     % if show_latency:
233     <th class="ping">Ping</th>
234     % endif
235     <th class="laps">Laps</th>
236     <th class="fastest">Fastest Lap</th>
237     <th class="time">Time</th>
238   </tr>
239 </thead>
240 % endif
241
242 </%def>
243
244 ##### SCOREBOARD ROWS #####
245 <%def name="scoreboard_row(game_type_cd, pgstat)">
246 % if game_type_cd == 'as':
247 <td>${pgstat.kills}</td>
248 <td>${pgstat.deaths}</td>
249 <td>${pgstat.suicides}</td>
250 <td>${pgstat.collects}</td>
251 % endif
252
253 % if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
254 <td>${pgstat.kills}</td>
255 <td>${pgstat.deaths}</td>
256 <td>${pgstat.suicides}</td>
257 % endif
258
259 % if game_type_cd == 'cq':
260 <td>${pgstat.kills}</td>
261 <td>${pgstat.deaths}</td>
262 <td>${pgstat.captures}</td>
263 <td>${pgstat.drops}</td>
264 % endif
265
266 % if game_type_cd == 'cts':
267 % if pgstat.fastest is not None:
268 <td>${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
269 % else:
270 <td>-</td>
271 % endif
272 <td>${pgstat.deaths}</td>
273 % endif
274
275 % if game_type_cd == 'ctf':
276 <td>${pgstat.kills}</td>
277 <td>${pgstat.captures}</td>
278 <td>${pgstat.pickups}</td>
279 <td>${pgstat.carrier_frags}</td>
280 <td>${pgstat.returns}</td>
281 % endif
282
283 % if game_type_cd == 'dom':
284 <td>${pgstat.kills}</td>
285 <td>${pgstat.deaths}</td>
286 <td>${pgstat.pickups}</td>
287 <td>${pgstat.drops}</td>
288 % endif
289
290 % if game_type_cd in 'ft' 'freezetag':
291 <td>${pgstat.kills}</td>
292 <td>${pgstat.deaths}</td>
293 <td>${pgstat.revivals}</td>
294 % endif
295
296 % if game_type_cd in 'ka' 'keepaway':
297 <td>${pgstat.kills}</td>
298 <td>${pgstat.deaths}</td>
299 <td>${pgstat.pickups}</td>
300
301 % if pgstat.time is not None:
302 <td>${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
303 % else:
304 <td>-</td>
305 % endif
306
307 <td>${pgstat.fckills}</td>
308 % endif
309
310 % if game_type_cd == 'kh':
311 <td>${pgstat.kills}</td>
312 <td>${pgstat.deaths}</td>
313 <td>${pgstat.pickups}</td>
314 <td>${pgstat.captures}</td>
315 <td>${pgstat.drops}</td>
316 <td>${pgstat.pushes}</td>
317 <td>${pgstat.destroys}</td>
318 <td>${pgstat.carrier_frags}</td>
319 % endif
320
321 % if game_type_cd in 'nb' 'nexball':
322 <td>${pgstat.captures}</td>
323 <td>${pgstat.drops}</td>
324 % endif
325
326 % if game_type_cd == 'rc':
327 <td>${pgstat.laps}</td>
328
329 % if pgstat.fastest is not None:
330 <td>${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
331 % else:
332 <td>-</td>
333 % endif
334
335 % if pgstat.time is not None:
336 <td>${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
337 % else:
338 <td>-</td>
339 % endif
340 % endif
341
342 </%def>