1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3 <%namespace file="accuracy.mako" import="accuracy" />
5 <%block name="navigation">
10 % if player is not None:
11 <script src="/static/js/jquery-1.7.1.min.js"></script>
12 <script src="/static/js/jquery.flot.min.js"></script>
13 <script src="/static/js/bootstrap-tab.js"></script>
14 <script type="text/javascript">
16 $('#gbtab').click(function(e) {
21 $('#gbtab a:first').tab('show');
25 <script type="text/javascript">
27 // plot the accuracy graph
28 function plot_acc_graph(data) {
29 var games = new Array();
30 var avgs = new Array();
31 var accs = new Array();
34 for(i=0; i < data.games; i++) {
35 avgs[i] = [i, data.avg];
36 accs[i] = [i, data.accs[i][1]];
37 game_link = '/game/' + data.accs[i][0];
39 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
44 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
45 { label: 'accuracy', data: accs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
46 { yaxis: {ticks: 10, min: 0, max: 100 },
47 xaxis: {ticks: games},
48 grid: { hoverable: true, clickable: true },
52 // plot the damage graph
53 function plot_dmg_graph(data) {
54 var games = new Array();
55 var avgs = new Array();
56 var dmgs = new Array();
59 for(i=0; i < data.games; i++) {
60 avgs[i] = [i, data.avg];
61 dmgs[i] = [i, data.dmgs[i][1]];
62 game_link = '/game/' + data.dmgs[i][0];
64 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
69 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
70 { label: 'efficiency', data: dmgs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
71 { yaxis: {ticks: 10, min: 0 },
72 xaxis: {ticks: games},
73 grid: { hoverable: true, clickable: true },
77 function showTooltip(x, y, contents) {
78 $('<div id="tooltip">' + contents + '</div>').css( {
83 border: '1px solid #fdd',
85 'background-color': '#333333',
87 }).appendTo("body").fadeIn(200);
90 var previousPoint = null;
91 var previousLabel = null;
92 $('#acc-graph').bind("plothover", function (event, pos, item) {
94 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
95 previousLabel = item.series.label;
96 previousPoint = item.dataIndex;
98 $("#tooltip").remove();
99 var x = item.datapoint[0].toFixed(2),
100 y = item.datapoint[1].toFixed(2);
102 showTooltip(item.pageX, item.pageY, y + "%");
106 $("#tooltip").remove();
107 previousPoint = null;
108 previousLabel = null;
112 $('#dmg-graph').bind("plothover", function (event, pos, item) {
114 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
115 previousPoint = item.dataIndex;
116 previousLabel = item.series.label;
118 $("#tooltip").remove();
119 var x = item.datapoint[0].toFixed(2),
120 y = item.datapoint[1].toFixed(2);
122 showTooltip(item.pageX, item.pageY, y);
126 $("#tooltip").remove();
127 previousPoint = null;
128 previousLabel = null;
132 // bind click events to the weapon images
133 $(".acc-weap").click(function () {
134 var dataurl = $(this).find('a').attr('href');
136 $('.accuracy-nav').find('.weapon-active').removeClass('weapon-active');
137 $(this).addClass('weapon-active');
143 success: plot_acc_graph
147 $(".dmg-weap").click(function () {
148 var dataurl = $(this).find('a').attr('href');
150 $('.damage-nav').find('.weapon-active').removeClass('weapon-active');
151 $(this).addClass('weapon-active');
157 success: plot_dmg_graph
161 // populate the graphs with the default weapons
163 url: '${request.route_url("player_accuracy", id=player.player_id)}',
166 success: plot_acc_graph
170 url: '${request.route_url("player_damage", id=player.player_id)}',
173 success: plot_dmg_graph
180 <%block name="title">
186 <h2>This player is so good we couldn't find him!</h2>
187 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
192 <h2>${player.nick_html_colors()|n}</h2>
197 <div id="gbtabcontainer" class="tabbable tabs-right">
198 <ul id="gbtab" class="nav nav-tabs">
199 % for g in games_played:
200 <li><a href="#tab-${g.game_type_cd}" data-toggle="tab">${g.game_type_cd} (${g.games})</a></li>
204 <div class="tab-content">
205 % for g in games_played:
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>
217 Games Played: <small>${g.games} <br /></small>
219 Playing Time: <small>${overall_stats[g.game_type_cd].total_playing_time} <br /></small>
221 % if g.game_type_cd in fav_maps:
222 Favorite Map: <small>${fav_maps[g.game_type_cd].map_name} <br /></small>
228 Win Percentage: <small>${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br /></small>
230 % if g.game_type_cd in overall_stats:
231 % if overall_stats[g.game_type_cd].k_d_ratio is not None:
232 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>
236 % if g.game_type_cd in elos:
237 % if g.game_type_cd == 'overall':
238 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>
240 Elo: <small>${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br /></small>
244 % if g.game_type_cd in ranks:
245 % if g.game_type_cd == 'overall':
246 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>
249 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>
253 % if g.game_type_cd == 'ctf':
254 % if overall_stats[g.game_type_cd].cap_ratio is not None:
255 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>
267 % 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:
271 <div id="acc-graph" class="flot" style="width:900px; height:200px;">
274 <div class="weapon-nav accuracy-nav">
276 % if 'nex' in recent_weapons:
278 <div class="acc-weap weapon-active">
279 <img src="${request.static_url("xonstat:static/images/nex.png")}" />
280 <p><small>Nex</small></p>
281 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'nex'})}" title="Show nex accuracy"></a>
286 % if 'rifle' in recent_weapons:
288 <div class="acc-weap">
289 <img src="${request.static_url("xonstat:static/images/rifle.png")}" />
290 <p><small>Rifle</small></p>
291 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'rifle'})}" title="Show rifle accuracy"></a>
296 % if 'minstanex' in recent_weapons:
298 <div class="acc-weap">
299 <img src="${request.static_url("xonstat:static/images/minstanex.png")}" />
300 <p><small>Minstanex</small></p>
301 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'minstanex'})}" title="Show minstanex accuracy"></a>
306 % if 'uzi' in recent_weapons:
308 <div class="acc-weap">
309 <img src="${request.static_url("xonstat:static/images/uzi.png")}" />
310 <p><small>Uzi</small></p>
311 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'uzi'})}" title="Show uzi accuracy"></a>
316 % if 'shotgun' in recent_weapons:
318 <div class="acc-weap">
319 <img src="${request.static_url("xonstat:static/images/shotgun.png")}" />
320 <p><small>Shotgun</small></p>
321 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'shotgun'})}" title="Show shotgun accuracy"></a>
333 % 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:
336 <h3>Damage Efficiency</h3>
337 <div id="dmg-graph" class="flot" style="width:900px; height:200px;">
340 <div class="weapon-nav damage-nav">
342 % if 'rocketlauncher' in recent_weapons:
344 <div class="dmg-weap weapon-active">
345 <img src="${request.static_url("xonstat:static/images/rocketlauncher.png")}" />
346 <p><small>Rocket</small></p>
347 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'rocketlauncher'})}" title="Show rocket launcher efficiency"></a>
352 % if 'grenadelauncher' in recent_weapons:
354 <div class="dmg-weap">
355 <img src="${request.static_url("xonstat:static/images/grenadelauncher.png")}" />
356 <p><small>Mortar</small></p>
357 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'grenadelauncher'})}" title="Show mortar damage efficiency"></a>
362 % if 'electro' in recent_weapons:
364 <div class="dmg-weap">
365 <img src="${request.static_url("xonstat:static/images/electro.png")}" />
366 <p><small>Electro</small></p>
367 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'electro'})}" title="Show electro damage efficiency"></a>
372 % if 'crylink' in recent_weapons:
374 <div class="dmg-weap">
375 <img src="${request.static_url("xonstat:static/images/crylink.png")}" />
376 <p><small>Crylink</small></p>
377 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'crylink'})}" title="Show crylink damage efficiency"></a>
382 % if 'hagar' in recent_weapons:
384 <div class="dmg-weap">
385 <img src="${request.static_url("xonstat:static/images/hagar.png")}" />
386 <p><small>Hagar</small></p>
387 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'hagar'})}" title="Show hagar damage efficiency"></a>
392 % if 'laser' in recent_weapons:
394 <div class="dmg-weap">
395 <img src="${request.static_url("xonstat:static/images/laser.png")}" />
396 <p><small>Laser</small></p>
397 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'laser'})}" title="Show laser damage efficiency"></a>
410 ##### RECENT GAMES (v2) ####
414 <h3>Recent Games</h3>
415 <table class="table table-bordered table-condensed">
427 % for (gamestat, game, server, map) in recent_games:
429 <td><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">view</a></td>
430 <td style="width:20px;"><img title="${game.game_type_cd}" src="/static/images/icons/24x24/${game.game_type_cd}.png" alt="${game.game_type_cd}" /></td>
431 <td>${server.name}</td>
434 % if gamestat.team != None:
435 % if gamestat.team == game.winner:
441 % if gamestat.rank == 1:
444 Loss (#${gamestat.rank})
448 <td><span class="abstime" data-epoch="${game.epoch()}" title="${game.create_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span></td>
453 % if total_games > 10:
454 <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>