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