Пример #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 prep_for_ti(self):
		self.players()
		player_q.mass_get_player_powers(self.cursor, self._players)
		
		self.teams()
		team_q.mass_get_team_deities(self.cursor, self._teams)
		team_q.mass_get_team_spells(self.cursor, self._teams)
		team_q.mass_get_team_techs(self.cursor, self._teams)
		team_q.mass_get_team_stats(self.cursor, self._teams, common.current_turn())
		team_q.mass_get_team_stats(self.cursor, self._teams, common.current_turn()-1)
		team_q.mass_get_team_stats(self.cursor, self._teams, common.current_turn()-2)
		
		self.cities()
		city_q.mass_get_city_buildings(self.cursor, self._cities)
		city_q.mass_get_city_artefacts(self.cursor, self._cities)
		city_q.mass_get_city_wonders(self.cursor, self._cities)
		
		self.armies()
		# squad_q.mass_get_squads(self.cursor, self._armies)
		self.mass_get_army_squads()
		self.mass_get_army_monsters()
		
		self.units()
		unit_q.mass_get_unit_equipment(self.cursor, self._units)