def build_from_xml(elem): f = Spell() f.id = elem.attrib['id'] f.name = read_attribute(elem, 'name') f.area = read_attribute(elem, 'area') f.mastery = read_attribute_int(elem, 'mastery') f.range = read_attribute(elem, 'range') f.duration = read_attribute(elem, 'duration') f.element = read_attribute(elem, 'element') f.tags = read_spell_tag_list(elem) f.require = read_requirements_list(elem) f.desc = read_sub_element_text(elem, 'Description', "").strip() f.elements = [] f.raises = [] if elem.find('Raises') is not None: for se in elem.find('Raises').iter(): if se.tag == 'Raise': f.raises.append(se.text) # support for Multi-Element spells if elem.find('MultiElement') is not None: for se in elem.find('MultiElement').iter(): if se.tag == 'Element': f.elements.append(se.text) return f
def build_from_xml(elem): f = Kata() f.id = elem.attrib['id'] f.name = read_attribute(elem, 'name') f.element = read_attribute(elem, 'element') f.mastery = read_attribute_int(elem, 'mastery') f.desc = read_sub_element_text(elem, 'Description', "") f.require = read_requirements_list(elem) f.tags = read_tag_list(elem) return f
def build_from_xml(elem): f = School() f.id = read_attribute( elem, 'id' ) f.name = read_attribute( elem, 'name' ) f.clanid = read_attribute( elem, 'clanid' ) f.trait = read_sub_element_text( elem, 'Trait' ) f.tags = [] for se in elem.find('Tags').iter(): if se.tag == 'Tag': f.tags.append(se.text) f.affinity = read_sub_element_text( elem, 'Affinity' ) f.deficiency = read_sub_element_text( elem, 'Deficiency' ) f.honor = float( read_sub_element_text( elem, 'Honor', "0.0" ) ) # school skills f.skills = [] f.skills_pc = [] for se in elem.find('Skills').iter(): if se.tag == 'Skill': f.skills.append(SchoolSkill.build_from_xml(se)) elif se.tag == 'PlayerChoose': f.skills_pc.append(SchoolSkillWildcardSet.build_from_xml(se)) # school techs f.techs = [] for se in elem.find('Techs').iter(): if se.tag == 'Tech': f.techs.append(SchoolTech.build_from_xml(se)) # school spells f.spells = [] f.spells_pc = [] for se in elem.find('Spells').iter(): if se.tag == 'PlayerChoose': f.spells_pc.append(SchoolSpellWildcard.build_from_xml(se)) elif se.tag == 'Spell': f.spells.append(SchoolSpell.build_from_xml(se)) f.outfit = [ ] f.money = [0]*3 # koku, bu, zeni outfit_elem = elem.find('Outfit') if outfit_elem: for se in outfit_elem.iter(): if se.tag == 'Item': f.outfit.append(se.text) f.money[0] = read_attribute_int(outfit_elem, 'koku') f.money[1] = read_attribute_int(outfit_elem, 'bu') f.money[2] = read_attribute_int(outfit_elem, 'zeni') #elif 'advanced' not in f.tags and 'alternate' not in f.tags: # print('missing outfit: {school_id}'.format(school_id=f.id)) f.require = read_requirements_list(elem) # kihos and tattoos f.kihos = None f.tattoos = None if elem.find('Kihos') is not None: f.kihos = SchoolKiho.build_from_xml( elem.find('Kihos') ) if elem.find('Tattoos') is not None: f.tattoos = SchoolTattoo.build_from_xml( elem.find('Tattoos') ) # starting Merit and Flaws f.perks = [] if elem.find('Perks') is not None: for se in elem.find('Perks').iter(): if se.tag == 'Perk': f.perks.append(SchoolPerk.build_from_xml(se)) return f
def build_from_xml(elem): f = School() f.id = read_attribute(elem, 'id') f.name = read_attribute(elem, 'name') f.clanid = read_attribute(elem, 'clanid') f.trait = read_sub_element_text(elem, 'Trait') f.tags = [] for se in elem.find('Tags').iter(): if se.tag == 'Tag': f.tags.append(se.text) f.affinity = read_sub_element_text(elem, 'Affinity') f.deficiency = read_sub_element_text(elem, 'Deficiency') f.honor = float(read_sub_element_text(elem, 'Honor', "0.0")) # school skills f.skills = [] f.skills_pc = [] for se in elem.find('Skills').iter(): if se.tag == 'Skill': f.skills.append(SchoolSkill.build_from_xml(se)) elif se.tag == 'PlayerChoose': f.skills_pc.append(SchoolSkillWildcardSet.build_from_xml(se)) # school techs f.techs = [] for se in elem.find('Techs').iter(): if se.tag == 'Tech': f.techs.append(SchoolTech.build_from_xml(se)) # school spells f.spells = [] f.spells_pc = [] for se in elem.find('Spells').iter(): if se.tag == 'PlayerChoose': f.spells_pc.append(SchoolSpellWildcard.build_from_xml(se)) elif se.tag == 'Spell': f.spells.append(SchoolSpell.build_from_xml(se)) f.outfit = [] f.money = [0] * 3 # koku, bu, zeni outfit_elem = elem.find('Outfit') if outfit_elem: for se in outfit_elem.iter(): if se.tag == 'Item': f.outfit.append(se.text) f.money[0] = read_attribute_int(outfit_elem, 'koku') f.money[1] = read_attribute_int(outfit_elem, 'bu') f.money[2] = read_attribute_int(outfit_elem, 'zeni') #elif 'advanced' not in f.tags and 'alternate' not in f.tags: # print('missing outfit: {school_id}'.format(school_id=f.id)) f.require = read_requirements_list(elem) # kihos and tattoos f.kihos = None f.tattoos = None if elem.find('Kihos') is not None: f.kihos = SchoolKiho.build_from_xml(elem.find('Kihos')) if elem.find('Tattoos') is not None: f.tattoos = SchoolTattoo.build_from_xml(elem.find('Tattoos')) # starting Merit and Flaws f.perks = [] if elem.find('Perks') is not None: for se in elem.find('Perks').iter(): if se.tag == 'Perk': f.perks.append(SchoolPerk.build_from_xml(se)) return f