]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/scoreboard.mako
Merge branch 'master' into zykure/wip
[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       % if show_latency and pgstat.avg_latency is not None:
8         <td class="tdcenter">
9           ${int(round(pgstat.avg_latency))}
10         </td>
11       % elif show_latency:
12         <td class="tdcenter">-</td>
13       % endif
14
15       <td class="player-nick">
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="nick">${pgstat.nick_html_colors()|n}</span>
20           </a>
21         % else:
22           <span class="nick">${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="ping">Ping</th>
52     % endif
53     <th class="nick">Nick</th>
54     <th class="kills">Kills</th>
55     <th class="deaths">Deaths</th>
56     <th class="suicides">Suicides</th>
57     <th class="objectives">Objectives</th>
58     <th class="score">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="ping">Ping</th>
71     % endif
72     <th class="nick">Nick</th>
73     <th class="kills">Kills</th>
74     <th class="deaths">Deaths</th>
75     <th class="suicides">Suicides</th>
76     <th class="score">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="ping">Ping</th>
89     % endif
90     <th class="nick">Nick</th>
91     <th class="kills">Kills</th>
92     <th class="deaths">Deaths</th>
93     <th class="captured">Captured</th>
94     <th class="released">Released</th>
95     <th class="score">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="ping">Ping</th>
108     % endif
109     <th class="nick">Nick</th>
110     <th class="fastest">Fastest Time</th>
111     <th class="deaths">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="ping">Ping</th>
121     % endif
122     <th class="nick">Nick</th>
123     <th class="kills">Kills</th>
124     <th class="captures">Captures</th>
125     <th class="pickups">Pickups</th>
126     <th class="fck" title="Flag Carrier Kill">FCK</th>
127     <th class="returns">Returns</th>
128     <th class="score">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="ping">Ping</th>
141     % endif
142     <th class="nick">Nick</th>
143     <th class="kills">Kills</th>
144     <th class="deaths">Deaths</th>
145     <th class="takes">Takes</th>
146     <th class="ticks">Ticks</th>
147     <th class="score">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="ping">Ping</th>
160     % endif
161     <th class="nick">Nick</th>
162     <th class="kills">Kills</th>
163     <th class="deaths">Deaths</th>
164     <th class="revivals">Revivals</th>
165     <th class="score">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="ping">Ping</th>
178     % endif
179     <th class="nick">Nick</th>
180     <th class="kills">Kills</th>
181     <th class="deaths">Deaths</th>
182     <th class="pickups">Pickups</th>
183     <th class="bctime">BC Time</th>
184     <th class="bckills">BC Kills</th>
185     <th class="score">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="ping">Ping</th>
198     % endif
199     <th class="nick">Nick</th>
200     <th class="kills">Kills</th>
201     <th class="deaths">Deaths</th>
202     <th class="pickups">Pickups</th>
203     <th class="caps">Captures</th>
204     <th class="losses">Losses</th>
205     <th class="pushes">Pushes</th>
206     <th class="destroys">Destroys</th>
207     <th class="kckills">KC Kills</th>
208     <th class="score">Score</th>
209     % if show_elo:
210     <th>Elo Change</th>
211     % endif
212   </tr>
213 </thead>
214 % endif
215
216 % if game_type_cd in 'nb' 'nexball':
217 <thead class="nb ${pgstat.team_html_color()}">
218   <tr>
219     % if show_latency:
220     <th class="ping">Ping</th>
221     % endif
222     <th class="nick">Nick</th>
223     <th class="goals">Goals</th>
224     <th class="faults">Faults</th>
225     <th class="score">Score</th>
226     % if show_elo:
227     <th>Elo Change</th>
228     % endif
229   </tr>
230 </thead>
231 % endif
232
233 % if game_type_cd == 'rc':
234 <thead>
235   <tr>
236     % if show_latency:
237     <th class="ping">Ping</th>
238     % endif
239     <th class="nick">Nick</th>
240     <th class="laps">Laps</th>
241     <th class="fastest">Fastest Lap</th>
242     <th class="time">Time</th>
243   </tr>
244 </thead>
245 % endif
246
247 </%def>
248
249 ##### SCOREBOARD ROWS #####
250 <%def name="scoreboard_row(game_type_cd, pgstat)">
251 % if game_type_cd == 'as':
252   <td>${pgstat.kills}</td>
253   <td>${pgstat.deaths}</td>
254   <td>${pgstat.suicides}</td>
255   <td>${pgstat.collects}</td>
256 % endif
257
258 % if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
259   <td>${pgstat.kills}</td>
260   <td>${pgstat.deaths}</td>
261   <td>${pgstat.suicides}</td>
262 % endif
263
264 % if game_type_cd == 'cq':
265   <td>${pgstat.kills}</td>
266   <td>${pgstat.deaths}</td>
267   <td>${pgstat.captures}</td>
268   <td>${pgstat.drops}</td>
269 % endif
270
271 % if game_type_cd == 'cts':
272   % if pgstat.fastest is not None:
273     <td>${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
274   % else:
275     <td>-</td>
276   % endif
277
278   <td>${pgstat.deaths}</td>
279 % endif
280
281 % if game_type_cd == 'ctf':
282   <td>${pgstat.kills}</td>
283   <td>${pgstat.captures}</td>
284   <td>${pgstat.pickups}</td>
285   <td>${pgstat.carrier_frags}</td>
286   <td>${pgstat.returns}</td>
287 % endif
288
289 % if game_type_cd == 'dom':
290   <td>${pgstat.kills}</td>
291   <td>${pgstat.deaths}</td>
292   <td>${pgstat.pickups}</td>
293   <td>${pgstat.drops}</td>
294 % endif
295
296 % if game_type_cd in 'ft' 'freezetag':
297   <td>${pgstat.kills}</td>
298   <td>${pgstat.deaths}</td>
299   <td>${pgstat.revivals}</td>
300 % endif
301
302 % if game_type_cd in 'ka' 'keepaway':
303   <td>${pgstat.kills}</td>
304   <td>${pgstat.deaths}</td>
305   <td>${pgstat.pickups}</td>
306
307   % if pgstat.time is not None:
308     <td>${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
309   % else:
310     <td>-</td>
311   % endif
312
313   <td>${pgstat.carrier_frags}</td>
314 % endif
315
316 % if game_type_cd == 'kh':
317   <td>${pgstat.kills}</td>
318   <td>${pgstat.deaths}</td>
319   <td>${pgstat.pickups}</td>
320   <td>${pgstat.captures}</td>
321   <td>${pgstat.drops}</td>
322   <td>${pgstat.pushes}</td>
323   <td>${pgstat.destroys}</td>
324   <td>${pgstat.carrier_frags}</td>
325 % endif
326
327 % if game_type_cd in 'nb' 'nexball':
328   <td>${pgstat.captures}</td>
329   <td>${pgstat.drops}</td>
330 % endif
331
332 % if game_type_cd == 'rc':
333   <td>${pgstat.laps}</td>
334
335   % if pgstat.fastest is not None:
336     <td>${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
337   % else:
338     <td>-</td>
339   % endif
340
341   % if pgstat.time is not None:
342     <td>${round(float(pgstat.time.seconds) + (pgstat.time.microseconds/1000000.0), 2)}</td>
343   % else:
344     <td>-</td>
345   % endif
346 % endif
347
348 </%def>