コード例 #1
0
def build_sql_database(output_filename, mhdata):
    "Builds a SQLite database and outputs to output_filename"
    sessionbuilder = db.recreate_database(output_filename)

    with db.session_scope(sessionbuilder) as session:
        # Add languages before starting the build
        for language in cfg.supported_languages:
            session.add(
                db.Language(id=language,
                            name=cfg.all_languages[language],
                            is_complete=(language
                                         not in cfg.incomplete_languages)))

        # Create object used for detecting if an item is unmapped
        item_tracker = ItemTracker(mhdata)

        # Build the individual components
        # These functions are defined lower down in the file
        build_items(session, mhdata, item_tracker)
        build_locations(session, mhdata, item_tracker)
        build_monsters(session, mhdata, item_tracker)
        build_skills(session, mhdata)
        build_armor(session, mhdata)
        build_weapons(session, mhdata)
        build_kinsects(session, mhdata)
        build_decorations(session, mhdata)
        build_charms(session, mhdata)
        build_tools(session, mhdata)
        build_quests(session, mhdata, item_tracker)

        item_tracker.print_unmarked()

    print("Finished build")
コード例 #2
0
def build_sql_database(output_filename, mhdata):
    "Builds a SQLite database and outputs to output_filename"
    sessionbuilder = db.recreate_database(output_filename)

    with db.session_scope(sessionbuilder) as session:
        # Add languages before starting the build
        for language in cfg.supported_languages:
            session.add(db.Language(
                id=language,
                name=cfg.all_languages[language],
                is_complete=(language not in cfg.incomplete_languages)
            ))

        # Build the individual components
        # These functions are defined lower down in the file
        build_items(session, mhdata)
        build_locations(session, mhdata)
        build_monsters(session, mhdata)
        build_skills(session, mhdata)
        build_armor(session, mhdata)
        build_weapons(session, mhdata)
        build_decorations(session, mhdata)
        build_charms(session, mhdata)
        
    print("Finished build")