Пример #1
0
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]"))
Пример #2
0
def make_ti(the_world, the_team):
	# Build team stats
	stat_f.build_team_stats(the_world.cursor, the_team, the_world)
	
	# Get some properties
	# the_team.get_population(cursor)
	
	output = {}
	
	output['evolutions']	= evolutions(the_world, the_team)	
	output['resources']		= resources(the_world, the_team)
	output['deities']		= deities(the_world, the_team)
	output['cities']		= cities(the_world, the_team)
	output['units']			= units(the_world, the_team)
	output['armies']		= armies(the_world, the_team)
	output['operatives']	= operatives(the_world, the_team)
	output['techs']			= techs(the_world, the_team)
	output['spells']		= spells(the_world, the_team)
	output['chosen']		= chosen(the_world, the_team)
	output['diplomacy']		= diplomacy(the_world, the_team)
	
	return json.dumps(output)
Пример #3
0
def make_ti(cursor, the_world, the_team, return_stats=False):
	the_stats = {}
	
	start_time = time.time()
	
	# Build team stats
	temp = time.time()
	stat_f.build_team_stats(cursor, the_team, the_world)
	
	# Get some properties
	the_team.get_population(cursor)
	the_stats['stats'] = time.time() - temp
	
	output = []
	
	# Tabs
	output.append(tabs(cursor, the_team))
	
	# Evolutions
	temp = time.time()
	output.append(evolutions(cursor, the_world, the_team))
	the_stats['evolutions'] = time.time() - temp
	
	# Deities
	temp = time.time()
	output.append(deities(cursor, the_world, the_team))
	# output.append(common.onload("switch_to_deities();"))
	the_stats['deities'] = time.time() - temp
	
	# Resources and points
	temp = time.time()
	output.append(resources(cursor, the_world, the_team))
	output.append(common.onload("switch_to_resources();"))
	the_stats['resources'] = time.time() - temp
	
	# Cities
	temp = time.time()
	output.append(cities(cursor, the_world, the_team))
	# output.append(common.onload("switch_to_cities();"))
	the_stats['cities'] = time.time() - temp
	
	# Units
	temp = time.time()
	temp = time.time()
	output.append(units(cursor, the_world, the_team))
	the_stats['units'] = time.time() - temp
	
	# Armies
	temp = time.time()
	output.append(armies(cursor, the_world, the_team))
	# output.append(common.onload("switch_to_armies();"))
	the_stats['armies'] = time.time() - temp
	
	# Operatives
	temp = time.time()
	output.append(operatives(cursor, the_world, the_team))
	# output.append(common.onload("switch_to_operatives();"))
	the_stats['operatives'] = time.time() - temp
	
	# Techs
	temp = time.time()
	output.append(techs(cursor, the_world, the_team))
	the_stats['techs'] = time.time() - temp
	
	# Spells
	temp = time.time()
	output.append(spells(cursor, the_world, the_team))
	the_stats['spells'] = time.time() - temp
	
	# Chosen
	temp = time.time()
	output.append(chosen(cursor, the_world, the_team))
	# output.append(common.onload("switch_to_chosen();"))
	the_stats['chosen'] = time.time() - temp
	
	# Diplomacy
	temp = time.time()
	output.append(diplomacy(cursor, the_world, the_team))
	# output.append(common.onload("switch_to_diplomacy();"))
	the_stats['diplomacy'] = time.time() - temp
	
	the_stats['total'] = time.time() - start_time
	
	# output.append(common.onload("switch_to_resources();"))
	
	return "".join(output)