]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/scoreboard.mako
Add ft support to the scoreboard.
[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-bordered 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>
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' '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 </%def>
169
170 ##### SCOREBOARD ROWS #####
171 <%def name="scoreboard_row(game_type_cd, pgstat)">
172 % if game_type_cd == 'as':
173         <td>${pgstat.kills}</td>
174         <td>${pgstat.deaths}</td>
175         <td>${pgstat.suicides}</td>
176         <td>${pgstat.collects}</td>
177 % endif
178
179 % if game_type_cd in 'ca' 'dm' 'duel' 'tdm':
180         <td>${pgstat.kills}</td>
181         <td>${pgstat.deaths}</td>
182         <td>${pgstat.suicides}</td>
183 % endif
184
185 % if game_type_cd == 'cq':
186         <td>${pgstat.kills}</td>
187         <td>${pgstat.deaths}</td>
188         <td>${pgstat.captures}</td>
189         <td>${pgstat.drops}</td>
190 % endif
191
192 % if game_type_cd == 'cts':
193         <td>${round(float(pgstat.fastest.seconds) + (pgstat.fastest.microseconds/1000000.0), 2)}</td>
194         <td>${pgstat.deaths}</td>
195 % endif
196
197 % if game_type_cd == 'ctf':
198         <td>${pgstat.kills}</td>
199         <td>${pgstat.captures}</td>
200         <td>${pgstat.pickups}</td>
201         <td>${pgstat.carrier_frags}</td>
202         <td>${pgstat.returns}</td>
203 % endif
204
205 % if game_type_cd == 'dom':
206         <td>${pgstat.kills}</td>
207         <td>${pgstat.deaths}</td>
208         <td>${pgstat.pickups}</td>
209         <td>${pgstat.drops}</td>
210 % endif
211
212 % if game_type_cd in 'ft' 'freezetag':
213         <td>${pgstat.kills}</td>
214         <td>${pgstat.deaths}</td>
215         <td>${pgstat.revivals}</td>
216 % endif
217 </%def>