wmlunits: increased font size of unit level indicator,
...added faction-leader indicator, added info link, added abilities, added id
This commit is contained in:
parent
75f986ad52
commit
7e93462d43
3 changed files with 72 additions and 5 deletions
|
@ -169,12 +169,19 @@ class WesnothList:
|
|||
era.faction_lookup[fid] = multiplayer_side
|
||||
recruit = multiplayer_side.get_text_val("recruit").strip()
|
||||
leader = multiplayer_side.get_text_val("leader").strip()
|
||||
units = recruit.split(",") + leader.split(",")
|
||||
units = recruit.split(",")
|
||||
leaders = leader.split(",")
|
||||
multiplayer_side.units = {}
|
||||
multiplayer_side.is_leader = {}
|
||||
for u in units:
|
||||
uid = u.strip()
|
||||
if uid:
|
||||
multiplayer_side.units[uid] = True
|
||||
for u in leaders:
|
||||
uid = u.strip()
|
||||
if uid:
|
||||
multiplayer_side.units[uid] = True
|
||||
multiplayer_side.is_leader[uid] = True
|
||||
return eid
|
||||
|
||||
def add_campaign(self, campaign):
|
||||
|
|
|
@ -137,11 +137,23 @@ col.col5 {
|
|||
div.l {
|
||||
color: gray;
|
||||
font-weight: normal;
|
||||
font-size: xx-small;
|
||||
font-size: small;
|
||||
border: 1px solid;
|
||||
float: right;
|
||||
margin: 0px;
|
||||
}
|
||||
div.i {
|
||||
padding: 4px;
|
||||
font-weight: normal;
|
||||
font-size: small;
|
||||
border: 1px solid white;
|
||||
float: left;
|
||||
margin: 0px;
|
||||
}
|
||||
div.i a {
|
||||
color: #8080ff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
div.attributes {
|
||||
font-size: small;
|
||||
font-weight: normal;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
#encoding: utf8
|
||||
"""
|
||||
wmlunits -- tool to output information on all units in HTML
|
||||
|
||||
|
@ -324,6 +325,7 @@ class HTMLOutput:
|
|||
for i in range(6):
|
||||
write("<col class=\"col%d\" />" % i)
|
||||
write("</colgroup>")
|
||||
ms = None
|
||||
for row in range(len(rows)):
|
||||
write("<tr>\n")
|
||||
for column in range(6):
|
||||
|
@ -338,6 +340,15 @@ class HTMLOutput:
|
|||
attributes += " colspan=%d" % hspan
|
||||
|
||||
if un and isinstance(un, helpers.GroupNode):
|
||||
# Find the current multiplayer side so we can show the
|
||||
# little crowns..
|
||||
ms = None
|
||||
try:
|
||||
eid, fid = un.data
|
||||
era = self.wesnoth.era_lookup[eid]
|
||||
ms = era.faction_lookup[fid]
|
||||
except TypeError:
|
||||
pass
|
||||
racename = un.name
|
||||
attributes += " class=\"raceheader\""
|
||||
write("<td%s>" % attributes)
|
||||
|
@ -356,8 +367,17 @@ class HTMLOutput:
|
|||
xp = self.wesnoth.get_unit_value(u, "experience")
|
||||
level = self.wesnoth.get_unit_value(u, "level")
|
||||
|
||||
write("<div class=\"l\">L%s</div>" % level)
|
||||
crown = ""
|
||||
if ms:
|
||||
if un.id in ms.units:
|
||||
crown = u" ♟"
|
||||
if un.id in ms.is_leader:
|
||||
crown = u" ♛"
|
||||
|
||||
link = "../%s/%s.html" % (self.isocode, uid)
|
||||
write("<div class=\"i\"><a href=\"%s\" title=\"%s\">%s</a></div>" % (
|
||||
link, uid, u"ℹ"))
|
||||
write("<div class=\"l\">L%s%s</div>" % (level, crown))
|
||||
write("<a href=\"%s\">%s</a><br/>" % (link, name))
|
||||
|
||||
write('<div class="pic">')
|
||||
|
@ -374,9 +394,22 @@ class HTMLOutput:
|
|||
self.get_translation("wesnoth", "MP: "), mp))
|
||||
write("%s%s<br />" % (
|
||||
self.get_translation("wesnoth", "XP: "), xp))
|
||||
|
||||
write("\n<div style=\"clear:both\">")
|
||||
|
||||
# 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)
|
||||
if anames:
|
||||
write("\n<div style=\"clear:both\">")
|
||||
write(", ".join(anames))
|
||||
write("</div>")
|
||||
|
||||
# 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))
|
||||
|
@ -522,6 +555,21 @@ class HTMLOutput:
|
|||
if val == "alignment": x = self.get_translation("wesnoth", x)
|
||||
write("<td>%s</td>" % x)
|
||||
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)
|
||||
|
||||
write("<tr>\n")
|
||||
write("<th>%s</th>" % _("Abilities: "))
|
||||
write("<td>" + (", ".join(anames)) + "</td>")
|
||||
write("</tr>\n")
|
||||
|
||||
write("</table>\n")
|
||||
|
||||
# Write info about attacks.
|
||||
|
|
Loading…
Add table
Reference in a new issue