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 type="text/javascript">
16 // plot the accuracy graph
17 function plot_acc_graph(data) {
18 var games = new Array();
19 var avgs = new Array();
20 var accs = new Array();
23 for(i=0; i < data.games; i++) {
24 avgs[i] = [i, data.avg];
25 accs[i] = [i, data.accs[i][1]];
26 game_link = '/game/' + data.accs[i][0];
28 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
33 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
34 { label: 'accuracy', data: accs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
35 { yaxis: {ticks: 10, min: 0, max: 100 },
36 xaxis: {ticks: games},
37 grid: { hoverable: true, clickable: true },
41 // plot the damage graph
42 function plot_dmg_graph(data) {
43 var games = new Array();
44 var avgs = new Array();
45 var dmgs = new Array();
48 for(i=0; i < data.games; i++) {
49 avgs[i] = [i, data.avg];
50 dmgs[i] = [i, data.dmgs[i][1]];
51 game_link = '/game/' + data.dmgs[i][0];
53 games[i] = [i, '<a href="' + game_link + '">' + j + '</a>'];
58 [ { label: 'average', data: avgs, hoverable: true, clickable: false },
59 { label: 'efficiency', data: dmgs, lines: {show:true}, points: {show:false}, hoverable: true, clickable: true }, ],
60 { yaxis: {ticks: 10, min: 0 },
61 xaxis: {ticks: games},
62 grid: { hoverable: true, clickable: true },
66 function showTooltip(x, y, contents) {
67 $('<div id="tooltip">' + contents + '</div>').css( {
72 border: '1px solid #fdd',
74 'background-color': '#333333',
76 }).appendTo("body").fadeIn(200);
79 var previousPoint = null;
80 var previousLabel = null;
81 $('#acc-graph').bind("plothover", function (event, pos, item) {
83 if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
84 previousPoint = item.dataIndex;
85 previousLabel = item.series.label;
87 $("#tooltip").remove();
88 var x = item.datapoint[0].toFixed(2),
89 y = item.datapoint[1].toFixed(2);
91 showTooltip(item.pageX, item.pageY, y + "%");
95 $("#tooltip").remove();
101 $('#dmg-graph').bind("plothover", function (event, pos, item) {
103 if (previousPoint != item.dataIndex) {
104 previousPoint = item.dataIndex;
106 $("#tooltip").remove();
107 var x = item.datapoint[0].toFixed(2),
108 y = item.datapoint[1].toFixed(2);
110 showTooltip(item.pageX, item.pageY, y);
114 $("#tooltip").remove();
115 previousPoint = null;
119 // bind click events to the weapon images
120 $(".acc-weap").click(function () {
121 var dataurl = $(this).find('a').attr('href');
123 $('.accuracy-nav').find('.weapon-active').removeClass('weapon-active');
124 $(this).addClass('weapon-active');
130 success: plot_acc_graph
134 $(".dmg-weap").click(function () {
135 var dataurl = $(this).find('a').attr('href');
137 $('.damage-nav').find('.weapon-active').removeClass('weapon-active');
138 $(this).addClass('weapon-active');
144 success: plot_dmg_graph
148 // populate the graphs with the default weapons
150 url: '${request.route_url("player_accuracy", id=player.player_id)}',
153 success: plot_acc_graph
157 url: '${request.route_url("player_damage", id=player.player_id)}',
160 success: plot_dmg_graph
167 <%block name="title">
173 <h2>This player is so good we couldn't find him!</h2>
174 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
179 <h2>${player.nick_html_colors()|n}</h2>
186 Member Since: <small>${player.create_dt.strftime('%m/%d/%Y at %I:%M %p')} </small><br />
188 Last Seen: <small>${recent_games[0][1].fuzzy_date()} </small><br />
190 Playing Time: <small>${total_stats['alivetime']} </small><br />
192 <% games_breakdown_str = ', '.join(["{0} {1}".format(ng, gt) for (gt, ng) in games_breakdown]) %>
193 Games Played: <small>${total_games} (${games_breakdown_str})</small><br />
195 % if fav_map is not None:
196 Favorite Map: <small><a href="${request.route_url('map_info', id=fav_map['id'])}" title="view map info">${fav_map['name']}</a></small><br />
199 % if fav_weapon is not None:
200 Favorite Weapons: <small>${", ".join([wpn['name'] for wpn in fav_weapon[:2]])}</small><br />
206 % if total_games > 0 and total_stats['wins'] is not None:
207 Win Percentage: <small>${round(float(total_stats['wins'])/total_games * 100, 2)}% (${total_stats['wins']} wins, ${total_games - total_stats['wins']} losses) </small><br />
210 % if total_stats['kills'] > 0 and total_stats['deaths'] > 0:
211 Kill Ratio: <small>${round(float(total_stats['kills'])/total_stats['deaths'], 3)} (${total_stats['kills']} kills, ${total_stats['deaths']} deaths) </small><br />
214 % if elos_display is not None and len(elos_display) > 0:
216 <small>${', '.join(elos_display)} </small>
218 %if '*' in ', '.join(elos_display):
219 <small><i>*preliminary Elo</i></small><br />
223 % if ranks_display != '':
224 Ranks: <small>${ranks_display}</small><br />
231 % 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:
235 <div id="acc-graph" class="flot" style="width:900px; height:200px;">
238 <div class="weapon-nav accuracy-nav">
240 % if 'nex' in recent_weapons:
242 <div class="acc-weap weapon-active">
243 <img src="${request.static_url("xonstat:static/images/nex.png")}" />
244 <p><small>Nex</small></p>
245 <a href="${request.route_url('player_accuracy', id=player.player_id, _query=[('weapon','nex')])}" title="Show nex accuracy"></a>
250 % if 'rifle' in recent_weapons:
252 <div class="acc-weap">
253 <img src="${request.static_url("xonstat:static/images/rifle.png")}" />
254 <p><small>Rifle</small></p>
255 <a href="${request.route_url('player_accuracy', id=player.player_id, _query=[('weapon','rifle')])}" title="Show rifle accuracy"></a>
260 % if 'minstanex' in recent_weapons:
262 <div class="acc-weap">
263 <img src="${request.static_url("xonstat:static/images/minstanex.png")}" />
264 <p><small>Minstanex</small></p>
265 <a href="${request.route_url('player_accuracy', id=player.player_id, _query=[('weapon','minstanex')])}" title="Show minstanex accuracy"></a>
270 % if 'uzi' in recent_weapons:
272 <div class="acc-weap">
273 <img src="${request.static_url("xonstat:static/images/uzi.png")}" />
274 <p><small>Uzi</small></p>
275 <a href="${request.route_url('player_accuracy', id=player.player_id, _query=[('weapon','uzi')])}" title="Show uzi accuracy"></a>
280 % if 'shotgun' in recent_weapons:
282 <div class="acc-weap">
283 <img src="${request.static_url("xonstat:static/images/shotgun.png")}" />
284 <p><small>Shotgun</small></p>
285 <a href="${request.route_url('player_accuracy', id=player.player_id, _query=[('weapon','shotgun')])}" title="Show shotgun accuracy"></a>
297 % 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:
300 <h3>Damage Efficiency</h3>
301 <div id="dmg-graph" class="flot" style="width:900px; height:200px;">
304 <div class="weapon-nav damage-nav">
306 % if 'rocketlauncher' in recent_weapons:
308 <div class="dmg-weap weapon-active">
309 <img src="${request.static_url("xonstat:static/images/rocketlauncher.png")}" />
310 <p><small>Rocket</small></p>
311 <a href="${request.route_url('player_damage', id=player.player_id, _query=[('weapon','rocketlauncher')])}" title="Show rocket launcher efficiency"></a>
316 % if 'grenadelauncher' in recent_weapons:
318 <div class="dmg-weap">
319 <img src="${request.static_url("xonstat:static/images/grenadelauncher.png")}" />
320 <p><small>Mortar</small></p>
321 <a href="${request.route_url('player_damage', id=player.player_id, _query=[('weapon','grenadelauncher')])}" title="Show mortar damage efficiency"></a>
326 % if 'electro' in recent_weapons:
328 <div class="dmg-weap">
329 <img src="${request.static_url("xonstat:static/images/electro.png")}" />
330 <p><small>Electro</small></p>
331 <a href="${request.route_url('player_damage', id=player.player_id, _query=[('weapon','electro')])}" title="Show electro damage efficiency"></a>
336 % if 'crylink' in recent_weapons:
338 <div class="dmg-weap">
339 <img src="${request.static_url("xonstat:static/images/crylink.png")}" />
340 <p><small>Crylink</small></p>
341 <a href="${request.route_url('player_damage', id=player.player_id, _query=[('weapon','crylink')])}" title="Show crylink damage efficiency"></a>
346 % if 'hagar' in recent_weapons:
348 <div class="dmg-weap">
349 <img src="${request.static_url("xonstat:static/images/hagar.png")}" />
350 <p><small>Hagar</small></p>
351 <a href="${request.route_url('player_damage', id=player.player_id, _query=[('weapon','hagar')])}" title="Show hagar damage efficiency"></a>
356 % if 'laser' in recent_weapons:
358 <div class="dmg-weap">
359 <img src="${request.static_url("xonstat:static/images/laser.png")}" />
360 <p><small>Laser</small></p>
361 <a href="${request.route_url('player_damage', id=player.player_id, _query=[('weapon','laser')])}" title="Show laser damage efficiency"></a>
374 ##### RECENT GAMES (v2) ####
378 <h3>Recent Games</h3>
379 <table class="table table-bordered table-condensed">
391 % for (gamestat, game, server, map) in recent_games:
393 <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>
394 <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>
395 <td>${server.name}</td>
398 % if gamestat.team != None:
399 % if gamestat.team == game.winner:
405 % if gamestat.rank == 1:
408 Loss (#${gamestat.rank})
412 <td>${game.fuzzy_date()}</td>
417 % if total_games > 10:
418 <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>