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) {
23 <script type="text/javascript">
25 // plot the accuracy graph
26 function plot_acc_graph(data) {
27 var games = new Array();
28 var avgs = new Array();
29 var accs = new Array();
32 for(i=0; i < data.games; i++) {
33 avgs[i] = [i, data.avg];
34 accs[i] = [i, data.accs[i][1]];
35 game_link = '/game/' + data.accs[i][0];
37 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
42 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
43 { label: 'accuracy', data: accs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
44 { yaxis: {ticks: 10, min: 0, max: 100 },
45 xaxis: {ticks: games},
46 grid: { hoverable: true, clickable: true },
50 // plot the damage graph
51 function plot_dmg_graph(data) {
52 var games = new Array();
53 var avgs = new Array();
54 var dmgs = new Array();
57 for(i=0; i < data.games; i++) {
58 avgs[i] = [i, data.avg];
59 dmgs[i] = [i, data.dmgs[i][1]];
60 game_link = '/game/' + data.dmgs[i][0];
62 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
67 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
68 { label: 'efficiency', data: dmgs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
69 { yaxis: {ticks: 10, min: 0 },
70 xaxis: {ticks: games},
71 grid: { hoverable: true, clickable: true },
75 function showTooltip(x, y, contents) {
76 $('<div id="tooltip">' + contents + '</div>').css( {
81 border: '1px solid #fdd',
83 'background-color': '#333333',
85 }).appendTo("body").fadeIn(200);
88 var previousPoint = null;
89 var previousLabel = null;
90 $('#acc-graph').bind("plothover", function (event, pos, item) {
92 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
93 previousLabel = item.series.label;
94 previousPoint = item.dataIndex;
96 $("#tooltip").remove();
97 var x = item.datapoint[0].toFixed(2),
98 y = item.datapoint[1].toFixed(2);
100 showTooltip(item.pageX, item.pageY, y + "%");
104 $("#tooltip").remove();
105 previousPoint = null;
106 previousLabel = null;
110 $('#dmg-graph').bind("plothover", function (event, pos, item) {
112 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
113 previousPoint = item.dataIndex;
114 previousLabel = item.series.label;
116 $("#tooltip").remove();
117 var x = item.datapoint[0].toFixed(2),
118 y = item.datapoint[1].toFixed(2);
120 showTooltip(item.pageX, item.pageY, y);
124 $("#tooltip").remove();
125 previousPoint = null;
126 previousLabel = null;
130 // bind click events to the weapon images
131 $(".acc-weap").click(function () {
132 var dataurl = $(this).find('a').attr('href');
134 $('.accuracy-nav').find('.weapon-active').removeClass('weapon-active');
135 $(this).addClass('weapon-active');
141 success: plot_acc_graph
145 $(".dmg-weap").click(function () {
146 var dataurl = $(this).find('a').attr('href');
148 $('.damage-nav').find('.weapon-active').removeClass('weapon-active');
149 $(this).addClass('weapon-active');
155 success: plot_dmg_graph
159 // populate the graphs with the default weapons
161 url: '${request.route_url("player_accuracy", id=player.player_id)}',
164 success: plot_acc_graph
168 url: '${request.route_url("player_damage", id=player.player_id)}',
171 success: plot_dmg_graph
178 <%block name="title">
184 <h2>This player is so good we couldn't find him!</h2>
185 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
190 <h2>${player.nick_html_colors()|n}</h2>
195 <div class="tabbable tabs-right">
196 <ul id="gbtab" class="nav nav-tabs">
197 % for g in games_played:
198 <li><a href="#tab-${g.game_type_cd}" data-toggle="tab">${g.game_type_cd} (${g.games})</a></li>
202 <div class="tab-content">
203 % for g in games_played:
204 <div class="tab-pane fade in
205 % if g.game_type_cd == 'overall':
208 " id="tab-${g.game_type_cd}">
210 % if g.game_type_cd in overall_stats:
211 Last Played: ${overall_stats[g.game_type_cd].last_played} <br />
214 Games Played: ${g.games} <br />
216 % if g.game_type_cd in fav_maps:
217 Favorite Map: ${fav_maps[g.game_type_cd].map_name} <br />
220 Win Percentage: ${round(g.win_pct,2)}% (${g.wins} wins, ${g.losses} losses) <br />
222 % if g.game_type_cd in overall_stats:
223 Kill Ratio: ${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 />
226 % if g.game_type_cd in elos:
227 Elo: ${round(elos[g.game_type_cd].elo,2)} (${elos[g.game_type_cd].games} games) <br />
230 % if g.game_type_cd in ranks:
231 Rank: ${ranks[g.game_type_cd].rank} of ${ranks[g.game_type_cd].max_rank} <br />
242 % 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:
246 <div id="acc-graph" class="flot" style="width:900px; height:200px;">
249 <div class="weapon-nav accuracy-nav">
251 % if 'nex' in recent_weapons:
253 <div class="acc-weap weapon-active">
254 <img src="${request.static_url("xonstat:static/images/nex.png")}" />
255 <p><small>Nex</small></p>
256 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'nex'})}" title="Show nex accuracy"></a>
261 % if 'rifle' in recent_weapons:
263 <div class="acc-weap">
264 <img src="${request.static_url("xonstat:static/images/rifle.png")}" />
265 <p><small>Rifle</small></p>
266 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'rifle'})}" title="Show rifle accuracy"></a>
271 % if 'minstanex' in recent_weapons:
273 <div class="acc-weap">
274 <img src="${request.static_url("xonstat:static/images/minstanex.png")}" />
275 <p><small>Minstanex</small></p>
276 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'minstanex'})}" title="Show minstanex accuracy"></a>
281 % if 'uzi' in recent_weapons:
283 <div class="acc-weap">
284 <img src="${request.static_url("xonstat:static/images/uzi.png")}" />
285 <p><small>Uzi</small></p>
286 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'uzi'})}" title="Show uzi accuracy"></a>
291 % if 'shotgun' in recent_weapons:
293 <div class="acc-weap">
294 <img src="${request.static_url("xonstat:static/images/shotgun.png")}" />
295 <p><small>Shotgun</small></p>
296 <a href="${request.route_url('player_accuracy', id=player.player_id, _query={'weapon':'shotgun'})}" title="Show shotgun accuracy"></a>
308 % 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:
311 <h3>Damage Efficiency</h3>
312 <div id="dmg-graph" class="flot" style="width:900px; height:200px;">
315 <div class="weapon-nav damage-nav">
317 % if 'rocketlauncher' in recent_weapons:
319 <div class="dmg-weap weapon-active">
320 <img src="${request.static_url("xonstat:static/images/rocketlauncher.png")}" />
321 <p><small>Rocket</small></p>
322 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'rocketlauncher'})}" title="Show rocket launcher efficiency"></a>
327 % if 'grenadelauncher' in recent_weapons:
329 <div class="dmg-weap">
330 <img src="${request.static_url("xonstat:static/images/grenadelauncher.png")}" />
331 <p><small>Mortar</small></p>
332 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'grenadelauncher'})}" title="Show mortar damage efficiency"></a>
337 % if 'electro' in recent_weapons:
339 <div class="dmg-weap">
340 <img src="${request.static_url("xonstat:static/images/electro.png")}" />
341 <p><small>Electro</small></p>
342 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'electro'})}" title="Show electro damage efficiency"></a>
347 % if 'crylink' in recent_weapons:
349 <div class="dmg-weap">
350 <img src="${request.static_url("xonstat:static/images/crylink.png")}" />
351 <p><small>Crylink</small></p>
352 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'crylink'})}" title="Show crylink damage efficiency"></a>
357 % if 'hagar' in recent_weapons:
359 <div class="dmg-weap">
360 <img src="${request.static_url("xonstat:static/images/hagar.png")}" />
361 <p><small>Hagar</small></p>
362 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'hagar'})}" title="Show hagar damage efficiency"></a>
367 % if 'laser' in recent_weapons:
369 <div class="dmg-weap">
370 <img src="${request.static_url("xonstat:static/images/laser.png")}" />
371 <p><small>Laser</small></p>
372 <a href="${request.route_url('player_damage', id=player.player_id, _query={'weapon':'laser'})}" title="Show laser damage efficiency"></a>
385 ##### RECENT GAMES (v2) ####
389 <h3>Recent Games</h3>
390 <table class="table table-bordered table-condensed">
402 % for (gamestat, game, server, map) in recent_games:
404 <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>
405 <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>
406 <td>${server.name}</td>
409 % if gamestat.team != None:
410 % if gamestat.team == game.winner:
416 % if gamestat.rank == 1:
419 Loss (#${gamestat.rank})
423 <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>
428 % if total_games > 10:
429 <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>