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">
16 % if player is not None:
17 <script src="/static/js/jquery.flot.min.js"></script>
18 <script type="text/javascript">
20 $('#gbtab li').click(function(e) {
25 $('#gbtab a:first').tab('show');
29 <script type="text/javascript">
31 // plot the accuracy graph
32 function plot_acc_graph(data) {
33 var games = new Array();
34 var avgs = new Array();
35 var accs = new Array();
38 for(i=0; i < data.games; i++) {
39 avgs[i] = [i, data.avg];
40 accs[i] = [i, data.accs[i][1]];
41 game_link = '/game/' + data.accs[i][0];
43 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
48 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
49 { label: 'accuracy', data: accs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
50 { yaxis: {ticks: 10, min: 0, max: 100 },
51 xaxis: {ticks: games},
52 grid: { hoverable: true, clickable: true },
56 // plot the damage graph
57 function plot_dmg_graph(data) {
58 var games = new Array();
59 var avgs = new Array();
60 var dmgs = new Array();
63 for(i=0; i < data.games; i++) {
64 avgs[i] = [i, data.avg];
65 dmgs[i] = [i, data.dmgs[i][1]];
66 game_link = '/game/' + data.dmgs[i][0];
68 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
73 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
74 { label: 'efficiency', data: dmgs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
75 { yaxis: {ticks: 10, min: 0 },
76 xaxis: {ticks: games},
77 grid: { hoverable: true, clickable: true },
81 function showTooltip(x, y, contents) {
82 $('<div id="tooltip">' + contents + '</div>').css( {
87 border: '1px solid #fdd',
89 'background-color': '#333333',
91 }).appendTo("body").fadeIn(200);
94 var previousPoint = null;
95 var previousLabel = null;
96 $('#acc-graph').bind("plothover", function (event, pos, item) {
98 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
99 previousLabel = item.series.label;
100 previousPoint = item.dataIndex;
102 $("#tooltip").remove();
103 var x = item.datapoint[0].toFixed(2),
104 y = item.datapoint[1].toFixed(2);
106 showTooltip(item.pageX, item.pageY, y + "%");
110 $("#tooltip").remove();
111 previousPoint = null;
112 previousLabel = null;
116 $('#dmg-graph').bind("plothover", function (event, pos, item) {
118 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
119 previousPoint = item.dataIndex;
120 previousLabel = item.series.label;
122 $("#tooltip").remove();
123 var x = item.datapoint[0].toFixed(2),
124 y = item.datapoint[1].toFixed(2);
126 showTooltip(item.pageX, item.pageY, y);
130 $("#tooltip").remove();
131 previousPoint = null;
132 previousLabel = null;
136 // bind click events to the weapon images
137 $(".acc-weap").click(function () {
138 var dataurl = $(this).find('a').attr('href');
140 $('.accuracy-nav').find('.weapon-active').removeClass('weapon-active');
141 $(this).addClass('weapon-active');
147 success: plot_acc_graph
151 $(".dmg-weap").click(function () {
152 var dataurl = $(this).find('a').attr('href');
154 $('.damage-nav').find('.weapon-active').removeClass('weapon-active');
155 $(this).addClass('weapon-active');
161 success: plot_dmg_graph
165 // populate the graphs with the default weapons
167 url: '${request.route_url("player_accuracy", id=player.player_id)}',
170 success: plot_acc_graph
174 url: '${request.route_url("player_damage", id=player.player_id)}',
177 success: plot_dmg_graph
184 <%block name="title">
190 <h2>This player is so good we couldn't find him!</h2>
191 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
196 <h2>${player.nick_html_colors()|n}</h2>
197 <h4><i><span class="abstime" data-epoch="${player.epoch()}" title="${player.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">Joined ${player.joined_pretty_date()}</span> (player #${player.player_id})</i></h4>
202 <div id="gbtabcontainer" class="tabbable tabs-below">
203 <div class="tab-content">
204 % for g in games_played:
205 % if not g.game_type_cd in ['cq']:
206 <div class="tab-pane fade in
207 % if g.game_type_cd == 'overall':
210 " id="tab-${g.game_type_cd}">
213 % if g.game_type_cd in overall_stats:
214 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 <small><br /></small>
220 % if g.game_type_cd == 'overall':
221 <small><a href="${request.route_url("player_game_index", player_id=player.player_id)}" title="View recent games">
223 <small><a href="${request.route_url("player_game_index", player_id=player.player_id, _query={'type':g.game_type_cd})}" title="View recent ${overall_stats[g.game_type_cd].game_type_descr} games">
225 ${g.games}</a> <br /></small>
227 Playing Time: <small>${overall_stats[g.game_type_cd].total_playing_time} <br /></small>
229 % if g.game_type_cd in fav_maps:
230 Favorite Map: <small><a href="${request.route_url("map_info", id=fav_maps[g.game_type_cd].map_id)}" title="Go to the detail page for this map">${fav_maps[g.game_type_cd].map_name}</a> <br /></small>
232 <small><br /></small>
235 % if g.game_type_cd == 'ctf':
236 % if overall_stats[g.game_type_cd].total_captures is not None:
237 <small><a href="${request.route_url("player_captimes", id=player.player_id)}">Fastest flag captures...</a> <br /></small>
239 <small><br /></small>
242 <small><br /></small>
249 Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
251 % if g.game_type_cd in overall_stats:
252 % if overall_stats[g.game_type_cd].k_d_ratio is not None:
253 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>
256 <small><br /></small>
259 % if g.game_type_cd in elos:
260 % if g.game_type_cd == 'overall':
261 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>
263 Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br /></small>
266 <small><br /></small>
269 % if g.game_type_cd in ranks:
270 % if g.game_type_cd == 'overall':
271 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>
273 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>
276 <small><br /></small>
279 % if g.game_type_cd == 'ctf':
280 % if overall_stats[g.game_type_cd].cap_ratio is not None:
281 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>
283 <small><br /></small>
286 <small><br /></small>
298 <ul id="gbtab" class="nav nav-tabs">
299 % for g in games_played:
301 <a href="#tab-${g.game_type_cd}" data-toggle="tab" alt="${g.game_type_cd}" title="${overall_stats[g.game_type_cd].game_type_descr}">
302 <span class="sprite sprite-${g.game_type_cd}"> </span><br />
303 ${g.game_type_cd} <br />
304 <small>(${g.games})</small>
313 % 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:
317 <div id="acc-graph" class="flot" style="width:95%; height:200px;">
320 <div class="weapon-nav accuracy-nav">
322 % if 'nex' in recent_weapons:
324 <div class="acc-weap weapon-active">
325 <span class="sprite sprite-nex"></span>
326 <p><small>Nex</small></p>
327 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'nex'})}" title="Show nex accuracy"></a>
332 % if 'rifle' in recent_weapons:
334 <div class="acc-weap">
335 <span class="sprite sprite-rifle"></span>
336 <p><small>Rifle</small></p>
337 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'rifle'})}" title="Show rifle accuracy"></a>
342 % if 'minstanex' in recent_weapons:
344 <div class="acc-weap">
345 <span class="sprite sprite-minstanex"></span>
346 <p><small>Minstanex</small></p>
347 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'minstanex'})}" title="Show minstanex accuracy"></a>
352 % if 'uzi' in recent_weapons:
354 <div class="acc-weap">
355 <span class="sprite sprite-uzi"></span>
356 <p><small>Uzi</small></p>
357 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'uzi'})}" title="Show uzi accuracy"></a>
362 % if 'shotgun' in recent_weapons:
364 <div class="acc-weap">
365 <span class="sprite sprite-shotgun"></span>
366 <p><small>Shotgun</small></p>
367 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'shotgun'})}" title="Show shotgun accuracy"></a>
379 % 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:
382 <h3>Damage Efficiency</h3>
383 <div id="dmg-graph" class="flot" style="width:95%; height:200px;">
386 <div class="weapon-nav damage-nav">
388 % if 'rocketlauncher' in recent_weapons:
390 <div class="dmg-weap weapon-active">
391 <span class="sprite sprite-rocketlauncher"></span>
392 <p><small>Rocket</small></p>
393 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'rocketlauncher'})}" title="Show rocket launcher efficiency"></a>
398 % if 'grenadelauncher' in recent_weapons:
400 <div class="dmg-weap">
401 <span class="sprite sprite-grenadelauncher"></span>
402 <p><small>Mortar</small></p>
403 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'grenadelauncher'})}" title="Show mortar damage efficiency"></a>
408 % if 'electro' in recent_weapons:
410 <div class="dmg-weap">
411 <span class="sprite sprite-electro"></span>
412 <p><small>Electro</small></p>
413 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'electro'})}" title="Show electro damage efficiency"></a>
418 % if 'crylink' in recent_weapons:
420 <div class="dmg-weap">
421 <span class="sprite sprite-crylink"></span>
422 <p><small>Crylink</small></p>
423 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'crylink'})}" title="Show crylink damage efficiency"></a>
428 % if 'hagar' in recent_weapons:
430 <div class="dmg-weap">
431 <span class="sprite sprite-hagar"></span>
432 <p><small>Hagar</small></p>
433 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'hagar'})}" title="Show hagar damage efficiency"></a>
438 % if 'laser' in recent_weapons:
440 <div class="dmg-weap">
441 <span class="sprite sprite-laser"></span>
442 <p><small>Laser</small></p>
443 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'laser'})}" title="Show laser damage efficiency"></a>
456 ##### RECENT GAMES (v2) ####
460 <h3>Recent Games</h3>
461 <table class="table table-hover table-condensed">
474 % for rg in recent_games:
476 <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>
477 <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
478 <td><a href="${request.route_url('server_info', id=rg.server_id)}" title="Go to the detail page for this server">${rg.server_name}</a></td>
479 <td><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the detail page for this map">${rg.map_name}</a></td>
481 % if rg.team != None:
482 % if rg.team == rg.winner:
495 <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>
496 <td class="tdcenter">
497 <a href="${request.route_url('game_info', id=rg.game_id, _query={'show_elo':1})}" title="View detailed information about this game">
498 % if rg.elo_delta is not None:
499 % if round(rg.elo_delta,2) > 0:
500 <span class="eloup" title="Elo went up by ${round(rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-up"></i></span>
501 % elif round(rg.elo_delta,2) < 0:
502 <span class="elodown" title="Elo went down by ${round(-rg.elo_delta,2)}"><i class="glyphicon glyphicon-arrow-down"></i></span>
504 <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
507 <span class="eloneutral" title="Elo did not change"><i class="glyphicon glyphicon-minus"></i></span>
515 % if total_games > 10:
516 <p><a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.nick}">More...</a></p>