Exemplo n.º 1
0
def main():
    # pylint: disable=import-outside-toplevel,too-many-branches,unsupported-assignment-operation,duplicate-code
    """main function, runs and parses sims"""
    parser = utils.generate_parser("Parses a list of reports from Raidbots.")
    parser.add_argument(
        '--iterations',
        help='Pass through specific iterations to run on. Default is 10000')
    parser.add_argument('--local',
                        help='indicate if the simulation should run local.',
                        action='store_true')
    parser.add_argument(
        '--auto_download',
        help='indicate if we should automatically download latest simc.',
        action='store_true')
    args = parser.parse_args()

    sys.path.insert(0, args.dir)

    # Download simc if needed
    if local_secrets and args.local and args.auto_download:
        from internal.auto_download import download_latest
        local_secrets.simc_path['latest'] = download_latest()
        # Additional temp swap to using the latest build
        config['simcBuild'] = 'latest'

    weights = config["sims"][args.dir[:-1]]["weights"]
    if args.iterations:
        iterations = args.iterations
    else:
        iterations = str(config["defaultIterations"])

    talents = utils.get_talents(args)
    covenants = utils.get_covenant(args)

    if covenants:
        if talents:
            for talent, covenant in [(talent, covenant) for talent in talents
                                     for covenant in covenants]:
                print(f"Simming {talent}-{covenant} profiles...")
                run_sims(args, iterations, talent, covenant)
                convert_to_csv(args, weights, talent, covenant)
                analyze_data(args, talent, covenant, weights)
        else:
            for covenant in covenants:
                print(f"Simming {covenant} profiles...")
                run_sims(args, iterations, None, covenant)
                convert_to_csv(args, weights, None, covenant)
                analyze_data(args, None, covenant, weights)
    elif talents:
        for talent in talents:
            print(f"Simming {talent} profiles...")
            run_sims(args, iterations, talent, None)
            convert_to_csv(args, weights, talent, None)
            analyze_data(args, talent, None, weights)
    else:
        print("Simming default profiles...")
        run_sims(args, iterations, None, None)
        convert_to_csv(args, weights, None, None)
        analyze_data(args, None, None, weights)
Exemplo n.º 2
0
            simc_file = build_simc_file(
                talent_string, covenant_string, profile_name)
            with open(args.dir + simc_file, "w+") as file:
                if args.ptr:
                    file.writelines(fightExpressions["ptr"])
                file.writelines(data)
                file.writelines(settings)
                file.close()


if __name__ == '__main__':
    parser = utils.generate_parser('Generates sim profiles.')
    args = parser.parse_args()

    talents = utils.get_talents(args)
    covenants = utils.get_covenant(args)

    clear_out_folders('%soutput/' % args.dir)
    clear_out_folders('%sprofiles/' % args.dir)

    if args.dir[:-1] == 'stats':
        build_stats_files()

    if covenants:
        for talent, covenant in [
            (talent, covenant) for talent in talents for covenant in covenants
        ]:
            clear_out_folders(
                '{0}output/{1}/{2}/'.format(args.dir, talent, covenant))
            clear_out_folders(