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