From: Ant Zucaro Date: Thu, 26 May 2011 17:05:05 +0000 (-0400) Subject: Add the actual accuracy template (whoops). X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=21491a9453a02c87cf25e751c1e227fc066196e4;p=xonotic%2Fxonstat.git Add the actual accuracy template (whoops). --- diff --git a/xonstat/templates/accuracy.mako b/xonstat/templates/accuracy.mako new file mode 100755 index 0000000..f8b9db7 --- /dev/null +++ b/xonstat/templates/accuracy.mako @@ -0,0 +1,50 @@ +<%def name="accuracy(weapon_stats)"> + +## Parameters: +## weapon_stats is an array containing what we'll call "weapon_stat" +## objects. These objects have the following attributes: +## +## [0] = Weapon description +## [1] = Weapon code +## [2] = Actual damage +## [3] = Max damage +## [4] = Hit +## [5] = Fired + + + + + + + + + + + + +% 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 +%> + + ## Note: the name of the image must match up with the weapon_cd + ## entry of that weapon, else this won't work + + + + + + + + + +% endfor +
WeaponHitFiredHit %Actual DamagePotential DamageDamage %
${weapon_stat[0]}${weapon_stat[4]}${weapon_stat[5]}${hit_pct}%${weapon_stat[2]}${weapon_stat[3]}${damage_pct}%
+