Exemple #1
0
	def prep_for_oh(self):
		"""Runs a set of prep functions for the OH"""
		
		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_resources(self.cursor, self._teams)
		self.mass_get_team_resources()
		
		self.buildings()
		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.units()
		unit_q.mass_get_unit_equipment(self.cursor, self._units)
		
		for k, v in self._buildings.items():
			if v.upgrades > -1:
				if v.upgrades not in self._building_requirements:
					self._building_requirements[v.upgrades] = []
				
				self._building_requirements[v.upgrades].append(k)
Exemple #2
0
	def prep_for_orders(self):
		"""Runs a set of prep functions for orders"""
		# player_q.mass_get_player_powers(self.cursor, self._players)
		mapper_q.get_terrain(self.cursor, 0, 0)
		
		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_resources(self.cursor, self._teams)
		self.mass_get_team_resources()
		team_q.mass_get_team_evolutions(self.cursor, self._teams)
		
		self.buildings()
		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)
		
		# squad_q.mass_get_squads(self.cursor, self._armies)
		
		unit_q.mass_get_unit_equipment(self.cursor, self._units)
		
		for k, v in self._buildings.items():
			if v.upgrades > -1:
				if v.upgrades not in self._building_requirements:
					self._building_requirements[v.upgrades] = []
				
				self._building_requirements[v.upgrades].append(k)
Exemple #3
0
	def __init__(self, cursor):
		super(Spy_world, self).__init__(cursor)
		
		# Spy specific things
		self._operatives_in_area = {}
		self._operatives_in_city = {}
		self._cities_in_area = {}
		self._armies_in_area = {}
		self._armies_by_base = {}
		self._diff_cache = {}
		
		# Prep for spy reports
		# player_q.mass_get_player_powers(self.cursor, self._players)
		# mapper_q.get_terrain(self.cursor, 0, 0)
		
		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_resources(self.cursor, self._teams)
		team_q.mass_get_team_evolutions(self.cursor, self._teams)
		
		self.buildings()
		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.units()
		unit_q.mass_get_unit_equipment(self.cursor, self._units)
Exemple #4
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)
Exemple #5
0
def main(cursor, options):
	the_world = world.World(cursor)
	team_dict = the_world.teams()
	
	team_list = []
	
	# Work out our team
	try:
		t = options.team
		
		if t != "":
			for t, the_team in team_dict.items():
				if the_team.name.lower() == options.team.lower():
					team_list = [t]
			
			if team_list == []:
				raise Exception()
		else:
			raise Exception()
	except Exception as e:
		team_list = [t for t in team_dict.keys() if (team_dict[t].active and not team_dict[t].ir)]
	
	# Some caching stuff
	the_world.cities()
	the_world.armies()
	the_world.players()
	the_world.units()
	
	player_q.mass_get_player_powers(cursor, the_world._players)
	
	team_q.mass_get_team_deities(cursor, the_world._teams)
	team_q.mass_get_team_spells(cursor, the_world._teams)
	team_q.mass_get_team_techs(cursor, the_world._teams)
	team_q.mass_get_team_resources(cursor, the_world._teams)
	team_q.mass_get_team_evolutions(cursor, the_world._teams)
	
	city_q.mass_get_city_buildings(cursor, the_world._cities)
	city_q.mass_get_city_artefacts(cursor, the_world._cities)
	city_q.mass_get_city_wonders(cursor, the_world._cities)
	
	unit_q.mass_get_unit_equipment(cursor, the_world._units)
	
	squad_q.mass_get_squads(cursor, the_world._armies)
	
	print("Caches setup")
	
	t_output = []
	for t in team_list:
		the_team = the_world._teams[t]
		
		headers = ti_f.headers(the_team)
		footers = ti_f.footers(the_team)
		js = ti_f.javascript(the_team)
		
		try:
			team_start = time.time()
			
			ti_output = ti_f.make_ti(cursor, the_world, the_team)
			
			output = "".join([js, ti_output])
			
			md5_name = team_f.team_hash(the_team.name)
			try:
				f = open('%sti_%s.html' % (common.data['cache_path'], md5_name), 'w')
				f.write(output)
				f.close()
			except Exception as e:
				pass
			
			t_output.append(output)
			
			print("Made for %s in %s" % (the_world._teams[t].name, round(time.time() - team_start, 3)))
		except Exception as e:
			print("Error in making TI for team '%s'" % the_world._teams[t].name)
			raise
		
	
	return "".join(t_output)
Exemple #6
0
	def mass_get_team_techs(self, force_requery=False):
		if "mass_get_team_techs" not in self.mass_get_checker or force_requery:
			team_q.mass_get_team_techs(self.cursor, self.teams())
			self.mass_get_checker.add("mass_get_team_techs")