From 21491a9453a02c87cf25e751c1e227fc066196e4 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Thu, 26 May 2011 13:05:05 -0400 Subject: [PATCH] Add the actual accuracy template (whoops). --- xonstat/templates/accuracy.mako | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 xonstat/templates/accuracy.mako 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}%
+ -- 2.39.2