def parsing_chara(html_text):
    parser = HtmlParser(html_text)
    chara = Chara()
    basics_table = parser.get_next_div()
    for tr in basics_table.table.find_all('tr'):
        col = tr.th.text
        val = tr.td.text
        if (col == '名称'):
            chara.name = val
        if (col == 'カテゴリ'):
            if (val == '冒険者'):
                chara.job = 'Adventurer'
            elif (val == 'アシスト'):
                chara.job = 'Assist'
    limit_break_status_table = parser.get_next_div()
    while ('最大値' not in limit_break_status_table.text):
        limit_break_status_table = parser.get_next_div()
    for tr in limit_break_status_table.table.find_all('tr'):
        if (tr.td is None):
            continue
        col = tr.td
        val = col.find_next_sibling()
        print(col.text, val.text)
        if (col.text == 'HP'):
            chara.hp = int(val.text)
        if (col.text == 'MP'):
            chara.mp = int(val.text)
        if (col.text == '物攻'):
            chara.str = int(val.text.split('(')[0])
        if (col.text == '魔攻'):
            chara.mag = int(val.text.split('(')[0])
        if (col.text == '防御'):
            chara.end = int(val.text.split('(')[0])
        if (col.text == '器用'):
            chara.dex = int(val.text.split('(')[0])
        if (col.text == '敏捷'):
            chara.agi = int(val.text.split('(')[0])
    all_skills = []
    all_passive_skills = []
    if (chara.job == 'Adventurer'):
        status_table_no_used = parser.get_next_div()
        special_skill = parser.get_next_div()
        special_skill_dec_str = gen_skill_str(special_skill.text, True)
    skills = parser.get_next_div()
    for s in skills.find_all('td'):
        skill_str = gen_skill_str(s.text)
        all_skills.append(skill_str)
    if (chara.job == 'Adventurer'):
        all_skills.append(special_skill_dec_str)
    concated_skills = ',\n        '.join(all_skills)
    chara.skills = f'skills=[{concated_skills}],'
    if (chara.job == 'Adventurer'):
        passive_skills = parser.get_next_div()
        for s in passive_skills.find_all('td'):
            passive_skill_str = gen_passive_skill_str(s.text)
            if passive_skill_str:
                all_passive_skills.append(passive_skill_str)
            if (chara.killer == ''):
                chara.killer = gen_killer_str(s.text)
            if (chara.counter_hp == ''):
                chara.counter_hp = gen_counter_hp_str(s.text)
        concated_passive_skills = ',\n        '.join(all_passive_skills)
        chara.passive_skills = f'passive_skills=[Skill(buffs=[{concated_passive_skills}])],'
    template = jinja2.Template('\n{{chara.job}}("{{chara.name}}", {{chara.hp}}, {{chara.mp}},\n    {{chara.str}}, {{chara.end}}, {{chara.dex}}, {{chara.agi}}, {{chara.mag}},\n    {{chara.skills}}\n    {{chara.passive_skills}}\n    {{chara.killer}}\n    {{chara.counter_hp}}\n),\n    ')
    if (chara.job == 'Adventurer'):
        out = template.render(chara=chara)
        print(out)
    else:
        for (i, s) in enumerate(all_skills):
            print('======================================================')
            if (i == 0):
                continue
            elif (i == 1):
                print('LV 60~76:')
            elif (i == 2):
                print('LV 80:')
            else:
                raise
            chara.skills = f'skill={s}'
            out = template.render(chara=chara)
            print(out)
def parsing_chara(html_text):
    parser = HtmlParser(html_text)
    chara = Chara()
    basics_table = parser.get_next_div()
    for tr in basics_table.table.find_all('tr'):
        col = tr.th.text
        val = tr.td.text
        if (col == '名称'):
            chara.name = val
        if (col == 'カテゴリ'):
            if (val == '冒険者'):
                chara.job = 'Adventurer'
            elif (val == 'アシスト'):
                chara.job = 'Assist'
    limit_break_status_table = parser.get_next_div()
    while ('最大値' not in limit_break_status_table.text):
        limit_break_status_table = parser.get_next_div()
    for tr in limit_break_status_table.table.find_all('tr'):
        if (tr.td is None):
            continue
        col = tr.td
        val = col.find_next_sibling()
        print(col.text, val.text)
        if (col.text == 'HP'):
            chara.hp = int(val.text)
        if (col.text == 'MP'):
            chara.mp = int(val.text)
        if (col.text == '物攻'):
            chara.str = int(val.text.split('(')[0])
        if (col.text == '魔攻'):
            chara.mag = int(val.text.split('(')[0])
        if (col.text == '防御'):
            chara.end = int(val.text.split('(')[0])
        if (col.text == '器用'):
            chara.dex = int(val.text.split('(')[0])
        if (col.text == '敏捷'):
            chara.agi = int(val.text.split('(')[0])
    all_skills = []
    all_passive_skills = []
    if (chara.job == 'Adventurer'):
        status_table_no_used = parser.get_next_div()
        special_skill = parser.get_next_div()
        special_skill_dec_str = gen_skill_str(special_skill.text, True)
    skills = parser.get_next_div()
    for s in skills.find_all('td'):
        skill_str = gen_skill_str(s.text)
        all_skills.append(skill_str)
    if (chara.job == 'Adventurer'):
        all_skills.append(special_skill_dec_str)
    concated_skills = ',\n        '.join(all_skills)
    chara.skills = f'skills=[{concated_skills}],'
    if (chara.job == 'Adventurer'):
        passive_skills = parser.get_next_div()
        for s in passive_skills.find_all('td'):
            passive_skill_str = gen_passive_skill_str(s.text)
            if passive_skill_str:
                all_passive_skills.append(passive_skill_str)
            if (chara.killer == ):
                chara.killer = gen_killer_str(s.text)
            if (chara.counter_hp == ):
                chara.counter_hp = gen_counter_hp_str(s.text)
        concated_passive_skills = ',\n        '.join(all_passive_skills)
        chara.passive_skills = f'passive_skills=[Skill(buffs=[{concated_passive_skills}])],'
    template = jinja2.Template('\n{{chara.job}}("{{chara.name}}", {{chara.hp}}, {{chara.mp}},\n    {{chara.str}}, {{chara.end}}, {{chara.dex}}, {{chara.agi}}, {{chara.mag}},\n    {{chara.skills}}\n    {{chara.passive_skills}}\n    {{chara.killer}}\n    {{chara.counter_hp}}\n),\n    ')
    if (chara.job == 'Adventurer'):
        out = template.render(chara=chara)
        print(out)
    else:
        for (i, s) in enumerate(all_skills):
            print('======================================================')
            if (i == 0):
                continue
            elif (i == 1):
                print('LV 60~76:')
            elif (i == 2):
                print('LV 80:')
            else:
                raise
            chara.skills = f'skill={s}'
            out = template.render(chara=chara)
            print(out)