1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3 <%namespace file="accuracy.mako" import="accuracy" />
5 <%block name="navigation">
11 <link href="/static/css/sprites.css" rel="stylesheet">
15 % if player is not None:
16 <script src="/static/js/jquery-1.7.1.min.js"></script>
17 <script src="/static/js/jquery.flot.min.js"></script>
18 <script src="/static/js/bootstrap-tab.js"></script>
19 <script type="text/javascript">
21 $('#gbtab li').click(function(e) {
26 $('#gbtab a:first').tab('show');
30 <script type="text/javascript">
32 // plot the accuracy graph
33 function plot_acc_graph(data) {
34 var games = new Array();
35 var avgs = new Array();
36 var accs = new Array();
39 for(i=0; i < data.games; i++) {
40 avgs[i] = [i, data.avg];
41 accs[i] = [i, data.accs[i][1]];
42 game_link = '/game/' + data.accs[i][0];
44 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
49 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
50 { label: 'accuracy', data: accs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
51 { yaxis: {ticks: 10, min: 0, max: 100 },
52 xaxis: {ticks: games},
53 grid: { hoverable: true, clickable: true },
57 // plot the damage graph
58 function plot_dmg_graph(data) {
59 var games = new Array();
60 var avgs = new Array();
61 var dmgs = new Array();
64 for(i=0; i < data.games; i++) {
65 avgs[i] = [i, data.avg];
66 dmgs[i] = [i, data.dmgs[i][1]];
67 game_link = '/game/' + data.dmgs[i][0];
69 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
74 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
75 { label: 'efficiency', data: dmgs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
76 { yaxis: {ticks: 10, min: 0 },
77 xaxis: {ticks: games},
78 grid: { hoverable: true, clickable: true },
82 function showTooltip(x, y, contents) {
83 $('<div id="tooltip">' + contents + '</div>').css( {
88 border: '1px solid #fdd',
90 'background-color': '#333333',
92 }).appendTo("body").fadeIn(200);
95 var previousPoint = null;
96 var previousLabel = null;
97 $('#acc-graph').bind("plothover", function (event, pos, item) {
99 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
100 previousLabel = item.series.label;
101 previousPoint = item.dataIndex;
103 $("#tooltip").remove();
104 var x = item.datapoint[0].toFixed(2),
105 y = item.datapoint[1].toFixed(2);
107 showTooltip(item.pageX, item.pageY, y + "%");
111 $("#tooltip").remove();
112 previousPoint = null;
113 previousLabel = null;
117 $('#dmg-graph').bind("plothover", function (event, pos, item) {
119 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
120 previousPoint = item.dataIndex;
121 previousLabel = item.series.label;
123 $("#tooltip").remove();
124 var x = item.datapoint[0].toFixed(2),
125 y = item.datapoint[1].toFixed(2);
127 showTooltip(item.pageX, item.pageY, y);
131 $("#tooltip").remove();
132 previousPoint = null;
133 previousLabel = null;
137 // bind click events to the weapon images
138 $(".acc-weap").click(function () {
139 var dataurl = $(this).find('a').attr('href');
141 $('.accuracy-nav').find('.weapon-active').removeClass('weapon-active');
142 $(this).addClass('weapon-active');
148 success: plot_acc_graph
152 $(".dmg-weap").click(function () {
153 var dataurl = $(this).find('a').attr('href');
155 $('.damage-nav').find('.weapon-active').removeClass('weapon-active');
156 $(this).addClass('weapon-active');
162 success: plot_dmg_graph
166 // populate the graphs with the default weapons
168 url: '${request.route_url("player_accuracy", id=player.player_id)}',
171 success: plot_acc_graph
175 url: '${request.route_url("player_damage", id=player.player_id)}',
178 success: plot_dmg_graph
185 <%block name="title">
191 <h2>This player is so good we couldn't find him!</h2>
192 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
197 <h2>${player.nick_html_colors()|n}</h2>
202 <div id="gbtabcontainer" class="tabbable tabs-below">
203 <div class="tab-content">
204 % for g in games_played:
205 <div class="tab-pane fade in
206 % if g.game_type_cd == 'overall':
209 " id="tab-${g.game_type_cd}">
212 % if g.game_type_cd in overall_stats:
213 Last Played: <small><span class="abstime" data-epoch="${overall_stats[g.game_type_cd].last_played_epoch}" title="${overall_stats[g.game_type_cd].last_played.strftime('%a, %d %b %Y %H:%M:%S UTC')}"> ${overall_stats[g.game_type_cd].last_played_fuzzy} </span> <br /></small>
216 Games Played: <small>${g.games} <br /></small>
218 Playing Time: <small>${overall_stats[g.game_type_cd].total_playing_time} <br /></small>
220 % if g.game_type_cd in fav_maps:
221 Favorite Map: <small>${fav_maps[g.game_type_cd].map_name} <br /></small>
227 Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
229 % if g.game_type_cd in overall_stats:
230 % if overall_stats[g.game_type_cd].k_d_ratio is not None:
231 Kill Ratio: <small>${round(overall_stats[g.game_type_cd].k_d_ratio,2)} (${overall_stats[g.game_type_cd].total_kills} kills, ${overall_stats[g.game_type_cd].total_deaths} deaths) <br /></small>
235 % if g.game_type_cd in elos:
236 % if g.game_type_cd == 'overall':
237 Best Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].game_type_cd}, ${elos[g.game_type_cd].games} games) <br /></small>
239 Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br /></small>
243 % if g.game_type_cd in ranks:
244 % if g.game_type_cd == 'overall':
245 Best Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (${ranks[g.game_type_cd].game_type_cd}, percentile: ${round(ranks[g.game_type_cd].percentile,2)})<br /></small>
248 Rank: <small>${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} (percentile: ${round(ranks[g.game_type_cd].percentile,2)})<br /></small>
252 % if g.game_type_cd == 'ctf':
253 % if overall_stats[g.game_type_cd].cap_ratio is not None:
254 Cap Ratio: <small>${round(overall_stats[g.game_type_cd].cap_ratio,2)} (${overall_stats[g.game_type_cd].total_captures} captures, ${overall_stats[g.game_type_cd].total_pickups} pickups) <br /></small>
266 <ul id="gbtab" class="nav nav-tabs">
267 % for g in games_played:
269 <a href="#tab-${g.game_type_cd}" data-toggle="tab">
270 <span class="sprite sprite-${g.game_type_cd}"> </span><br />
271 ${g.game_type_cd} <br />
272 <small>(${g.games})</small>
281 % if 'nex' in recent_weapons or 'rifle' in recent_weapons or 'minstanex' in recent_weapons or 'uzi' in recent_weapons or 'shotgun' in recent_weapons:
285 <div id="acc-graph" class="flot" style="width:900px; height:200px;">
288 <div class="weapon-nav accuracy-nav">
290 % if 'nex' in recent_weapons:
292 <div class="acc-weap weapon-active">
293 <span class="sprite sprite-nex"></span>
294 <p><small>Nex</small></p>
295 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'nex'})}" title="Show nex accuracy"></a>
300 % if 'rifle' in recent_weapons:
302 <div class="acc-weap">
303 <span class="sprite sprite-rifle"></span>
304 <p><small>Rifle</small></p>
305 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'rifle'})}" title="Show rifle accuracy"></a>
310 % if 'minstanex' in recent_weapons:
312 <div class="acc-weap">
313 <span class="sprite sprite-minstanex"></span>
314 <p><small>Minstanex</small></p>
315 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'minstanex'})}" title="Show minstanex accuracy"></a>
320 % if 'uzi' in recent_weapons:
322 <div class="acc-weap">
323 <span class="sprite sprite-uzi"></span>
324 <p><small>Uzi</small></p>
325 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'uzi'})}" title="Show uzi accuracy"></a>
330 % if 'shotgun' in recent_weapons:
332 <div class="acc-weap">
333 <span class="sprite sprite-shotgun"></span>
334 <p><small>Shotgun</small></p>
335 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'shotgun'})}" title="Show shotgun accuracy"></a>
347 % if 'rocketlauncher' in recent_weapons or 'grenadelauncher' in recent_weapons or 'electro' in recent_weapons or 'crylink' in recent_weapons or 'laser' in recent_weapons:
350 <h3>Damage Efficiency</h3>
351 <div id="dmg-graph" class="flot" style="width:900px; height:200px;">
354 <div class="weapon-nav damage-nav">
356 % if 'rocketlauncher' in recent_weapons:
358 <div class="dmg-weap weapon-active">
359 <span class="sprite sprite-rocketlauncher"></span>
360 <p><small>Rocket</small></p>
361 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'rocketlauncher'})}" title="Show rocket launcher efficiency"></a>
366 % if 'grenadelauncher' in recent_weapons:
368 <div class="dmg-weap">
369 <span class="sprite sprite-grenadelauncher"></span>
370 <p><small>Mortar</small></p>
371 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'grenadelauncher'})}" title="Show mortar damage efficiency"></a>
376 % if 'electro' in recent_weapons:
378 <div class="dmg-weap">
379 <span class="sprite sprite-electro"></span>
380 <p><small>Electro</small></p>
381 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'electro'})}" title="Show electro damage efficiency"></a>
386 % if 'crylink' in recent_weapons:
388 <div class="dmg-weap">
389 <span class="sprite sprite-crylink"></span>
390 <p><small>Crylink</small></p>
391 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'crylink'})}" title="Show crylink damage efficiency"></a>
396 % if 'hagar' in recent_weapons:
398 <div class="dmg-weap">
399 <span class="sprite sprite-hagar"></span>
400 <p><small>Hagar</small></p>
401 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'hagar'})}" title="Show hagar damage efficiency"></a>
406 % if 'laser' in recent_weapons:
408 <div class="dmg-weap">
409 <span class="sprite sprite-laser"></span>
410 <p><small>Laser</small></p>
411 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'laser'})}" title="Show laser damage efficiency"></a>
424 ##### RECENT GAMES (v2) ####
428 <h3>Recent Games</h3>
429 <table class="table table-bordered table-condensed">
442 % for rg in recent_games:
444 <td class="tdcenter"><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">view</a></td>
445 <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}"></span></td>
446 <td>${rg.server_name}</td>
447 <td>${rg.map_name}</td>
449 % if rg.team != None:
450 % if rg.team == rg.winner:
463 <td><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
464 <td class="tdcenter">
465 <a href="${request.route_url('game_info', id=rg.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
466 % if rg.elo_delta is not None:
467 % if round(rg.elo_delta,2) > 0:
468 <span title="Elo went up by ${round(rg.elo_delta,2)}"><i class="icon-arrow-up icon-white"></i></span>
469 % elif round(rg.elo_delta,2) < 0:
470 <span title="Elo went down by ${round(-rg.elo_delta,2)}"><i class="icon-arrow-down icon-white"></i></span>
472 <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
475 <span title="Elo did not change"><i class="icon-minus icon-white"></i></span>
483 % if total_games > 10:
484 <a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.nick}">More games played by ${player.nick_html_colors()|n}...</a>