def ops_catching(): from functions import operative_f the_world = spy_world.Spy_world(database.get_cursor()) the_world.cursor.execute("BEGIN") operative_f.catch_operatives(the_world, verbose=True) the_world.cursor.execute("ROLLBACK") exit("Exit()")
def pre_orders(options): start_time = time.time() cursor = database.get_cursor() the_world = spy_world.Spy_world(cursor) team_dict = the_world.active_teams() # Stats first, it's used for some favour stuff #------------------------ for team_id, the_team in team_dict.items(): stat_f.build_team_stats(the_world.cursor, the_team, the_world) # Now to assign the stats team_q.mass_get_team_stats(the_world.cursor, team_dict, common.current_turn()) # Pre orders - Teams #------------------------ cursor.execute("BEGIN") print(database.shell_text("Team pre-orders"), end="") for team_id, the_team in team_dict.items(): try: team_f.pre_orders(the_world, the_team) except Exception as e: cursor.execute("ROLLBACK") print(database.shell_text(" - [r]Failure[/r]")) print("Failure running pre-orders for %s" % the_team.name) print(database.shell_text("[r]Re run as 'rob3 start -l True[/r]'")) raise print(database.shell_text(" - [g]Done[/g]")) # Pre orders - System #------------------------ print(database.shell_text("System pre-orders"), end="") try: # Army history army_f.location_history(the_world) # Player history player_f.turn_history(the_world) # Power history power_f.turn_history(the_world) # Artefact history artefact_f.turn_history(the_world) # Operatives catching operative_f.catch_operatives(the_world) # Border history team_f.border_history(the_world) except Exception as e: cursor.execute("ROLLBACK") print(database.shell_text(" - [r]Failure[/r]")) print(database.shell_text("[r]Re run as 'rob3 start -l True[/r]'")) raise cursor.execute("COMMIT") print(database.shell_text("\nNow run [g]rob orders[/g]"))