示例#1
0
def build_skills(session : sqlalchemy.orm.Session, mhdata):
    skill_map = mhdata.skill_map

    for skill_entry in skill_map.values():
        skilltree = db.SkillTree(
            id=skill_entry.id,
            max_level=len(skill_entry['levels']),
            icon_color=skill_entry['icon_color'])

        for language in cfg.supported_languages:
            skilltree.translations.append(db.SkillTreeText(
                lang_id=language,
                name=skill_entry.name(language),
                description=skill_entry['description'][language]
            ))

            for effect in skill_entry['levels']:
                skilltree.skills.append(db.Skill(
                    lang_id=language,
                    level=effect['level'],
                    description=effect['description'][language]
                ))

        session.add(skilltree)
    
    print("Built Skills")
示例#2
0
def build_skills(session: sqlalchemy.orm.Session, mhdata):
    skill_map = mhdata.skill_map

    for skill_entry in skill_map.values():
        skilltree = db.SkillTree(id=skill_entry.id,
                                 max_level=len(skill_entry['levels']),
                                 icon_color=skill_entry['icon_color'],
                                 secret=skill_entry['secret'] or 0,
                                 unlocks_id=skill_map.id_of(
                                     'en', skill_entry['unlocks']))

        for language in cfg.supported_languages:
            skilltree.translations.append(
                db.SkillTreeText(lang_id=language,
                                 name=get_translated(skill_entry, 'name',
                                                     language),
                                 description=get_translated(
                                     skill_entry, 'description', language)))

            for effect in skill_entry['levels']:
                skilltree.skills.append(
                    db.Skill(lang_id=language,
                             level=effect['level'],
                             description=get_translated(
                                 effect, 'description', language)))

        session.add(skilltree)

    print("Built Skills")
示例#3
0
文件: sql.py 项目: kevinn/MHWorldData
def build_skills(session: sqlalchemy.orm.Session, mhdata):
    skill_map = mhdata.skill_map

    for id, entry in skill_map.items():
        skilltree = db.SkillTree(id=id)

        for language in supported_languages:
            skilltree.translations.append(
                db.SkillTreeText(lang_id=language,
                                 name=entry.name(language),
                                 description=entry['description'][language]))

            for effect in entry['effects']:
                skilltree.skills.append(
                    db.Skill(lang_id=language,
                             level=effect['level'],
                             description=effect['description'][language]))

        session.add(skilltree)

    print("Built Skills")