]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/templates/accuracy.mako
Remove Persona since it was shut down. :(
[xonotic/xonstat.git] / xonstat / templates / accuracy.mako
index 46e014161546620fda761cd18dc87db9102e01d8..3c1e007c33dbf41f0301ca9b62f7d26ef92d651f 100644 (file)
 ## [3] = Max damage
 ## [4] = Hit
 ## [5] = Fired
+## [6] = Frags
 
-<table class="table table-bordered table-condensed">
-<thead>
-    <th></th>
-    <th>Weapon</th>
-    <th>Hit</th>
-    <th>Fired</th>
-    <th>Hit %</th>
-    <th>Actual Damage</th>
-    <th>Potential Damage</th>
-    <th>Damage %</th>
-</thead>
-% for weapon_stat in weapon_stats:
-<%
-if weapon_stat[3] > 0: 
-    damage_pct = round(float(weapon_stat[2])/weapon_stat[3]*100, 2)
-else:
-    damage_pct = 0
-if weapon_stat[5] > 0: 
-    hit_pct = round(float(weapon_stat[4])/weapon_stat[5]*100, 2)
-else:
-    hit_pct = 0
-%>
-<tr>
-    ## Note: the name of the image must match up with the weapon_cd 
-    ## entry of that weapon, else this won't work
-    <td><img src="${request.static_url("xonstat:static/images/%s.png" % weapon_stat[1])}" /></td>
-    <td>${weapon_stat[0]}</td>
-    <td>${weapon_stat[4]}</td>
-    <td>${weapon_stat[5]}</td>
-    <td>${hit_pct}%</td>
-    <td>${weapon_stat[2]}</td>
-    <td>${weapon_stat[3]}</td>
-    <td>${damage_pct}%</td>
-</tr>
-% endfor
+<table class="table-hover table-condensed">
+  <thead>
+    <th class="small-2 medium-1"></th>
+    <th class="show-for-medium-up">Weapon</th>
+    <th class="show-for-medium-up">Frags</th>
+    <th>Accuracy</th>
+    <th>Damage</th>
+  </thead>
+
+  <%
+    total_damage = 0
+    for weapon_stat in weapon_stats:
+      total_damage += weapon_stat[2]
+    if total_damage == 0:
+      total_damage = 1
+  %>
+
+  % for weapon_stat in weapon_stats:
+    <%
+      if weapon_stat[3] > 0: 
+        damage_pct = round(float(weapon_stat[2])/weapon_stat[3]*100, 2)
+      else:
+        damage_pct = 0
+
+      if weapon_stat[5] > 0: 
+        hit_pct = round(float(weapon_stat[4])/weapon_stat[5]*100, 2)
+      else:
+        hit_pct = 0
+    %>
+    <tr>
+      ## Note: the name of the image must match up with the weapon_cd 
+      ## entry of that weapon, else this won't work
+      <td class="small-2 medium-1 text-center"><span class="sprite sprite-${weapon_stat[1]}"></span></td>
+      <td class="show-for-medium-up">${weapon_stat[0]}</td>
+      <td class="show-for-medium-up">${weapon_stat[6]}</td>
+      <td>${weapon_stat[4]}/${weapon_stat[5]} (${hit_pct}%)</td>
+      <td>${weapon_stat[2]} (${round(float(weapon_stat[2])/total_damage*100, 2)}%)</td>
+    </tr>
+  % endfor
 </table>
 </%def>