pass
class DivinationCardsParser(WikiTableParser):
+ reward_kinds = ("currency", "map", "unique", "links", "skillgem", "rare", "magic", "other")
+
def handle_starttag(self, tag, attrs):
super(DivinationCardsParser, self).handle_starttag(tag, attrs)
by_reward.setdefault(it.reward_kind, []).append(it)
out = open("cards.txt", "w")
- for r, il in by_reward.items():
+ for r in DivinationCardsParser.reward_kinds:
out.write('category "card.{}"\n'.format(r))
out.write('{\n\tclass "Card";\n\tor\n\t{\n')
- for it in il:
+ for it in by_reward[r]:
out.write('\t\tbase_type "{}";\n'.format(it.name))
out.write("\t};\n};\n")