]> de.git.xonotic.org Git - xonotic/xonstat.git/blob - xonstat/templates/player_info.mako
Spruce up the player info page a bit: add weapon images for accuracy for starters.
[xonotic/xonstat.git] / xonstat / templates / player_info.mako
1 <%inherit file="base.mako"/>
2
3 <%block name="title">
4 % if player:
5 Player Information for ${player.nick_html_colors()} - 
6 % endif
7
8 ${parent.title()}
9 </%block>
10
11
12 % if player is None:
13 <h2>This player is so good we couldn't find him!</h2>
14 <p>Seriously though, he probably doesn't exist...just a figment of your imagination. Carry on then!</p>
15
16 % else:
17 <h2>${player.nick_html_colors()}</h2>
18 <p>
19    Joined: ${player.create_dt.strftime('%m/%d/%Y at %I:%M %p')} <br />
20 </p>
21 % endif
22
23
24 ##### ACCURACY #####
25 % if weapon_stats:
26 <h2>Accuracy</h2>
27 <table class="accuracy-table" border="1" cellpadding="3" align="center">
28 <tr class="accuracy-table-header">
29     <td></td>
30     <td>Weapon</td>
31     <td>Hit</td>
32     <td>Fired</td>
33     <td>Hit %</td>
34     <td>Actual Damage</td>
35     <td>Potential Damage</td>
36     <td>Damage %</td>
37 </tr>
38 % for weapon_stat in weapon_stats:
39 <%
40 if weapon_stat[2] > 0: 
41     damage_pct = round(float(weapon_stat[2])/weapon_stat[3]*100, 2)
42 else:
43     damage_pct = 0
44 if weapon_stat[4] > 0: 
45     hit_pct = round(float(weapon_stat[4])/weapon_stat[5]*100, 2)
46 else:
47     hit_pct = 0
48 %>
49 <tr>
50     ## Note: the name of the image must match up with the weapon_cd 
51     ## entry of that weapon, else this won't work
52     <td><img src="${request.static_url("xonstat:static/images/%s.png" % weapon_stat[1])}" /></td>
53     <td style="text-align: left;">${weapon_stat[0]}</td>
54     <td>${weapon_stat[4]}</td>
55     <td>${weapon_stat[5]}</td>
56     <td>${hit_pct}%</td>
57     <td>${weapon_stat[2]}</td>
58     <td>${weapon_stat[3]}</td>
59     <td>${damage_pct}%</td>
60 </tr>
61 % endfor
62 </table>
63
64 % endif
65
66 ##### RECENT GAMES #####
67 % if recent_games:
68 <h2>Recent Games</h2>
69 % for (gamestat, game, server, map) in recent_games:
70    <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>
71 <br />
72 % endfor
73 <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()}...
74 % endif
75
76