]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/templates/player_info.mako
Show recent game scoreboards in an iframe viewport from the player_info view/template.
[xonotic/xonstat.git] / xonstat / templates / player_info.mako
index df133d4f849a5d798cf00692ab008e9273baee55..7b572fe75edc73164e1bc25e027c90f9df0c6505 100755 (executable)
@@ -1,4 +1,21 @@
 <%inherit file="base.mako"/>
+<%namespace file="accuracy.mako" import="accuracy" />
+
+<%block name="css">
+${parent.css()}
+<link rel="stylesheet" href="/static/css/colorbox.css" type="text/css" media="screen" />
+</%block>
+
+<%block name="js">
+${parent.js()}
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
+<script src="/static/js/jquery.colorbox-min.js"></script>
+<script>
+$(document).ready(function(){
+    $(".recent_game_box").colorbox({width:"80%", height:"80%", iframe:true});
+});
+</script>
+</%block>
 
 <%block name="title">
 % if player:
@@ -20,52 +37,79 @@ ${parent.title()}
 </p>
 % endif
 
-% if recent_games:
-<h2>Recent Games</h2>
-<ul>
-% for (gamestat, game, server, map) in recent_games:
-   <li><a href="${request.route_url("game_info", id=game.game_id)}" name="Game info page for game #${game.game_id}">#${game.game_id}:</a> <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a> on <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a></li>
-% endfor
-</ul>
-<a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.nick}">More games</a> played by ${player.nick_html_colors()}...
-% endif
 
+##### STATS #####
+% if game_stats:
+<h2>Overall Game Stats</h2>
+<table class="accuracy-table" border="1" cellpadding="3" align="center">
+  <tr>
+    <td>Playing Time</td><td>${game_stats['total_alivetime']}</td>
+    <td>Drops</td><td>${game_stats['total_drops']}</td>
+  </tr>
+  <tr>
+    <td>Average Rank</td><td>${game_stats['avg_rank']}</td>
+    <td>Returns</td><td>${game_stats['total_returns']}</td>
+  </tr>
+  <tr>
+    <td>Score</td><td>${game_stats['total_score']}</td>
+    <td>Carrier Kills</td><td>${game_stats['total_carrier_frags']}</td>
+  </tr>
+  <tr>
+    <td>Kills</td><td>${game_stats['total_kills']}</td>
+    <td>Collects</td><td>${game_stats['total_collects']}</td>
+  </tr>
+  <tr>
+    <td>Deaths</td><td>${game_stats['total_deaths']}</td>
+    <td>Destroys</td><td>${game_stats['total_destroys']}</td>
+  </tr>
+  <tr>
+    <td>Suicides</td><td>${game_stats['total_suicides']}</td>
+    <td>Destroys (with key)</td><td>${game_stats['total_destroys']}</td>
+  </tr>
+  <tr>
+    <td>Captures</td><td>${game_stats['total_captures']}</td>
+    <td>Pushes</td><td>${game_stats['total_pushes']}</td>
+  </tr>
+  <tr>
+    <td>Pickups</td><td>${game_stats['total_pickups']}</td>
+    <td>Pushed</td><td>${game_stats['total_pushed']}</td>
+  </tr>
+</table>
+% endif
 
+##### ACCURACY #####
 % if weapon_stats:
-<h2>Accuracy</h2>
-<table border="1" cellpadding="3">
-<tr>
-    <td></td>
-    <td>Weapon</td>
-    <td>Hit</td>
-    <td>Fired</td>
-    <td>Hit %</td>
-    <td>Actual Damage</td>
-    <td>Potential Damage</td>
-    <td>Damage %</td>
+<h2>Overall Accuracy</h2>
+${accuracy(weapon_stats)}
+% endif
+
+
+##### RECENT GAMES (v2) ####
+% if recent_games:
+<h2>Recent Games</h2>
+<table class="accuracy-table" border="1" cellpadding="3" align="center">
+<tr class='accuracy-table-header'>
+   <td>Game Type</td>
+   <td>Map</td>
+   <td>Result</td>
+   <td>Played</td>
+   <td>Permalink</td>
 </tr>
-% for weapon_stat in weapon_stats:
-<%
-if weapon_stat[2] > 0: 
-    damage_pct = round(float(weapon_stat[1])/weapon_stat[2]*100, 2)
-else:
-    damage_pct = 0
-if weapon_stat[4] > 0: 
-    hit_pct = round(float(weapon_stat[3])/weapon_stat[4]*100, 2)
-else:
-    hit_pct = 0
-%>
+% for (gamestat, game, server, map) in recent_games:
 <tr>
-    <td>[IMAGE]</td>
-    <td>${weapon_stat[0]}</td>
-    <td>${weapon_stat[3]}</td>
-    <td>${weapon_stat[4]}</td>
-    <td>${hit_pct}%</td>
-    <td>${weapon_stat[1]}</td>
-    <td>${weapon_stat[2]}</td>
-    <td>${damage_pct}%</td>
+   <td>${game.game_type_cd}</td>
+   <td>${map.name}</td>
+   <td>
+   % if gamestat.team != None and gamestat.team == game.winner:
+   Win
+   % else:
+   Loss
+   % endif
+   </td>
+   <td>${game.fuzzy_date()}</td>
+   <td><a class="recent_game_box" href="${request.route_url("game_info", id=game.game_id)}" name="Game info page for game #${game.game_id}">View</a></td>
 </tr>
 % endfor
 </table>
-
+<a href="${request.route_url("player_game_index", player_id=player.player_id, page=1)}" title="Game index for ${player.nick}">More games</a> played by ${player.nick_html_colors()}...
 % endif