# Path: l5r/exporters/fdfexporter.py
# class FDFExporter(object):
# 
#     def __init__(self):
#         self.model = None
#         self.form = None
# 
#     def set_model(self, model):
#         self.model = model
# 
#     def set_form(self, form):
#         self.form = form
# 
#     def export(self, io):
#         self.export_header(io)
#         self.export_body(io)
#         self.export_footer(io)
# 
#     def export_header(self, io):
#         hd = u"""<?xml version="1.0" encoding="UTF-8"?>
#         <xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><fields>"""
# 
#         io.write(hd.encode('UTF-8'))
# 
#     def export_body(self, io):
#         pass
# 
#     def export_footer(self, io):
#         ft = u"""</fields></xfdf>"""
#         io.write(ft.encode('UTF-8'))
# 
#     def fdf_escape(self, value):
#         return value.replace('\\', '\\\\').replace('(', '\\(').replace(')', '\\)')
# 
#     def export_field(self, key, value, io):
# 
#         string_value = value
#         if isinstance(value, bool):
#             string_value = u"Yes" if value else u"No"
# 
#         tx = u"""<field name="{n}"><value>{v}</value></field>\n""".format(
#             n=key, v=string_value)
# 
#         io.write(tx.encode('UTF-8'))
# 
#     # HELPERS
# 
#     def get_clan_name(self):
#         return self.form.lb_pc_clan.text()
# 
#     def get_family_name(self):
#         return self.form.lb_pc_family.text()
# 
#     def get_school_name(self):
#         return self.form.lb_pc_school.text()
# 
#     def get_exp(self):
#         return u'%s / %s' % (api.character.xp(), api.character.xp_limit())
# 
# def zigzag(l1, l2):
#     def _zigzag(l1_, l2_):
#         rl = []
#         i = 0
#         for i in range(0, len(l2_)):
#             rl.append(l1_[i])
#             rl.append(l2_[i])
#         return rl + l1_[len(l2_):]
# 
#     if len(l1) >= len(l2):
#         return _zigzag(l1, l2)
#     return _zigzag(l2, l1)


import l5r.models as models
import l5r.api as api
import l5r.api.data
import l5r.api.data.skills
import l5r.api.data.clans
import l5r.api.data.families
import l5r.api.data.schools
import l5r.api.rules
import l5r.api.character
from l5r.exporters.fdfexporter import FDFExporter, zigzag

        # rings
        _af("Earth", api.character.ring_rank('earth'))
        _af("Air", api.character.ring_rank('air'))
        _af("Water", api.character.ring_rank('water'))
        _af("Fire", api.character.ring_rank('fire'))
        _af("Void", api.character.ring_rank('void'))

        # traits
        _af("Stamina", api.character.trait_rank('stamina'))
        _af("Willpower", api.character.trait_rank('willpower'))
        _af("Reflexes", api.character.trait_rank('reflexes'))
        _af("Awareness", api.character.trait_rank('awareness'))
        _af("Strength", api.character.trait_rank('strength'))
        _af("Perception", api.character.trait_rank('perception'))
        _af("Agility", api.character.trait_rank('agility'))
        _af("Intelligence", api.character.trait_rank('intelligence'))

        _af("Initiative", api.rules.format_rtk_t(api.rules.get_tot_initiative()))
        _af("Armor", api.character.get_full_tn())
        _af("Reduction", api.character.get_full_rd())

        # HEALTH
        w_labels = ['Healthy', 'Nicked', 'Grazed',
                    'Hurt', 'Injured', 'Crippled',
                    'Down', 'Out']

        hl = [0] * 8
        for i in range(0, 8):
            if i == 0:

# Path: l5r/exporters/fdfexporter.py
# class FDFExporter(object):
# 
#     def __init__(self):
#         self.model = None
#         self.form = None
# 
#     def set_model(self, model):
#         self.model = model
# 
#     def set_form(self, form):
#         self.form = form
# 
#     def export(self, io):
#         self.export_header(io)
#         self.export_body(io)
#         self.export_footer(io)
# 
#     def export_header(self, io):
#         hd = u"""<?xml version="1.0" encoding="UTF-8"?>
#         <xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"><fields>"""
# 
#         io.write(hd.encode('UTF-8'))
# 
#     def export_body(self, io):
#         pass
# 
#     def export_footer(self, io):
#         ft = u"""</fields></xfdf>"""
#         io.write(ft.encode('UTF-8'))
# 
#     def fdf_escape(self, value):
#         return value.replace('\\', '\\\\').replace('(', '\\(').replace(')', '\\)')
# 
#     def export_field(self, key, value, io):
# 
#         string_value = value
#         if isinstance(value, bool):
#             string_value = u"Yes" if value else u"No"
# 
#         tx = u"""<field name="{n}"><value>{v}</value></field>\n""".format(
#             n=key, v=string_value)
# 
#         io.write(tx.encode('UTF-8'))
# 
#     # HELPERS
# 
#     def get_clan_name(self):
#         return self.form.lb_pc_clan.text()
# 
#     def get_family_name(self):
#         return self.form.lb_pc_family.text()
# 
#     def get_school_name(self):
#         return self.form.lb_pc_school.text()
# 
#     def get_exp(self):
#         return u'%s / %s' % (api.character.xp(), api.character.xp_limit())
# 
# def zigzag(l1, l2):
#     def _zigzag(l1_, l2_):
#         rl = []
#         i = 0
#         for i in range(0, len(l2_)):
#             rl.append(l1_[i])
#             rl.append(l2_[i])
#         return rl + l1_[len(l2_):]
# 
#     if len(l1) >= len(l2):
#         return _zigzag(l1, l2)
#     return _zigzag(l2, l1)


# Path: l5r/exporters/npc.py
import l5r.models as models
import l5r.api as api
import l5r.api.data
import l5r.api.data.skills
import l5r.api.data.clans
import l5r.api.data.families
import l5r.api.data.schools
import l5r.api.rules
import l5r.api.character
from l5r.exporters.fdfexporter import FDFExporter, zigzag


        # rings
        _af("Earth", api.character.ring_rank('earth'))
        _af("Air", api.character.ring_rank('air'))
        _af("Water", api.character.ring_rank('water'))
        _af("Fire", api.character.ring_rank('fire'))
        _af("Void", api.character.ring_rank('void'))

        # traits
        _af("Stamina", api.character.trait_rank('stamina'))
        _af("Willpower", api.character.trait_rank('willpower'))
        _af("Reflexes", api.character.trait_rank('reflexes'))
        _af("Awareness", api.character.trait_rank('awareness'))
        _af("Strength", api.character.trait_rank('strength'))
        _af("Perception", api.character.trait_rank('perception'))
        _af("Agility", api.character.trait_rank('agility'))
        _af("Intelligence", api.character.trait_rank('intelligence'))

        _af("Initiative", api.rules.format_rtk_t(api.rules.get_tot_initiative()))
        _af("Armor", api.character.get_full_tn())
        _af("Reduction", api.character.get_full_rd())

        # HEALTH
        w_labels = ['Healthy', 'Nicked', 'Grazed',
                    'Hurt', 'Injured', 'Crippled',
                    'Down', 'Out']

        hl = [0] * 8
        for i in range(0, 8):
            if i == 0:

                hl[i] = api.rules.get_health_rank(i)