Author: elias
Date: Thu May 1 00:43:38 2008
New Revision: 26265
URL: http://svn.gna.org/viewcvs/wesnoth?rev=26265&view=rev
Log:
wmlunits: Fixed abilities and attacks display.
Modified:
trunk/data/tools/wmlunits
Modified: trunk/data/tools/wmlunits
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlunits?rev=26265&r1=26264&r2=26265&view=diff
==============================================================================
--- trunk/data/tools/wmlunits (original)
+++ trunk/data/tools/wmlunits Thu May 1 00:43:38 2008
@@ -317,8 +317,23 @@
image = os.path.join("../pics", picname)
return image
+ def get_abilities(self, u):
+ anames = []
+ already = {}
+ for abilities in u.get_all("abilities"):
+ for ability in abilities.children():
+ id = ability.get_text_val("id")
+ if id in already: continue
+ already[id] = True
+ name = ability.get_text_val("name")
+ if not name: name = id
+ if not name: name = ability.name
+ anames.append(name)
+ return anames
+
def write_units(self):
def write(x): self.output.write(x)
+ def _(x): return self.get_translation("wesnoth", x)
rows = self.unitgrid
write("<table class=\"units\">\n")
write("<colgroup>")
@@ -396,13 +411,7 @@
self.get_translation("wesnoth", "XP: "), xp))
# Write info about abilities.
- anames = []
- for abilities in u.get_all("abilities"):
- for ability in abilities.children():
- name = ability.get_text_val("name")
- if not name: name = ability.get_text_val("id")
- if not name: name = ability.name
- anames.append(name)
+ anames = self.get_abilities(u)
if anames:
write("\n<div style=\"clear:both\">")
write(", ".join(anames))
@@ -411,8 +420,7 @@
# Write info about attacks.
write("\n<div style=\"clear:both\">")
for attack in u.get_all("attack"):
- t = attack.get_text_val("type")
- write("%s " % self.get_translation("wesnoth", t))
+
n = attack.get_text_val("number")
x = attack.get_text_val("damage")
@@ -420,7 +428,8 @@
write("%s " % x)
r = attack.get_text_val("range")
- write("%s" % self.get_translation("wesnoth", r))
+ t = attack.get_text_val("type")
+ write("%s (%s)" % (_(r), _(t)))
s = []
specials = attack.get_first("specials")
@@ -558,13 +567,7 @@
write("</tr>\n")
# Write info about abilities.
- anames = []
- for abilities in unit.get_all("abilities"):
- for ability in abilities.children():
- name = ability.get_text_val("name")
- if not name: name = ability.get_text_val("id")
- if not name: name = ability.name
- anames.append(name)
+ anames = self.get_abilities(unit)
write("<tr>\n")
write("<th>%s</th>" % _("Abilities: "))
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits