Example #1
0
	def cancel_jump(self, evt):

		turn = db.getTurn()
		out_dir = os.path.join(util.getTempDir(), config.options['data']['raw-dir'])
		util.assureDirClean(out_dir)

		for acc in config.accounts():
			user_id = int(acc['id'])
			self.pending_actions.user_id = user_id
			
			fleets = []
			fleet_flt = ['owner_id=%s'%(user_id,)]
			
			fleet_name = None #unicode('Fleet')
			# can also filter fleets by names
			#TODO: beware escapes
			if fleet_name:
				fleet_flt.append( 'name="%s"'%(fleet_name,) ) 
			for fleet in db.flyingFleets(turn, fleet_flt):
				#print 'found fleet %s'%(fleet,)
				if fleet['in_transit'] != 0:
					continue
				print 'fleet %s can be stopped'%(fleet,)
			
				self.pending_actions.cancelJump(fleet['id'])
			
			self.perform_actions()
Example #2
0
	def onMakeScoutFleets(self, _):		
		# get all planets
		# get harrison units able to scout
		# create fleets
		# put units to fleets
		
		# get all scouting fleets ( available to jump ( on my planets ) )
		# get unexplored planets
		# send nearest fleets to these planets
		
		# load size-map, use it to scout biggest first ( N > 70, descending )
		
		# get all scouting fleets ( on other planets )
		# geo-explore
		# send them back to nearest home planet
		
		#command_type, 
		#move_command = ('move_to', 
		
		#move_commands = [((x,y), fleet_id)]
	
		carapace = 11 # probe/zond
		fleet_name = 'scout:geo'
		turn = db.getTurn()
		
		for acc in config.accounts():
			user_id = int(acc['id'])
			
			
			#if user_id < 601140:
			#	continue

			units_classes = db.get_units_class(turn, ['carapace=%s'%(carapace,), 'owner_id=%s'%(user_id,)])
			any_class = 'class in (%s)'%(','.join([str(cls) for cls in units_classes]),)
			print 'testing user %s with class %s'%(user_id, any_class)
			
			self.pending_actions.user_id = user_id
			pending_units = []
			
			for planet in db.planets(turn, ['owner_id=%s'%(user_id,)]):
				coord = get_coord(planet)
				print 'checking harrison for planet %s'%(planet,)
				for unit in db.garrison_units(turn, filter_coord(coord) + [any_class]):
					print 'found unit %s on planet %s'%(unit, planet,)
					self.pending_actions.createNewFleet(coord, fleet_name)
					pending_units.append( (self.pending_actions.get_action_id(), coord, unit['id'] ) )
					print 'found unit %s on planet %s'%(unit, coord )
			
			if len(pending_units) == 0:
				continue
			
			self.recv_data_callback[acc['login']] = (self.cb_move_units_to_fleets, user_id, pending_units )
			# exec actions to create fleets on the planets
			self.perform_actions()
Example #3
0
	def onUpdateGeo(self, event):
		'download and process info from server'
		import loader
		l = loader.AsyncLoader()
		
		out_dir = os.path.join(util.getTempDir(), config.options['data']['raw-dir'])
		util.assureDirClean(out_dir)
		for acc in config.accounts():
			log.info('requesting user %s info'%(acc['login'],))
			d = os.path.join(util.getTempDir(), 'raw_data') if not out_dir else out_dir
			l.getDcData(self, acc['login'], 'known_planets', d)
		l.start()
Example #4
0
	def onUpdate(self, event):
		'download and process info from server'
		import loader
		l = loader.AsyncLoader()
		
		out_dir = os.path.join(util.getTempDir(), config.options['data']['raw-dir'])
		util.assureDirClean(out_dir)
		for acc in config.accounts():
			if self.command_selected_user and int(acc['id']) != self.map.selected_user_id:
				continue
			log.info('requesting user %s info'%(acc['login'],))
			l.getUserInfo(self, acc['login'], out_dir)
		l.start()
Example #5
0
	def onUpdate(self, event):
		'download and process info from server'
		l = loader.AsyncLoader()
		
		out_dir = os.path.join(util.getTempDir(), config.options['data']['raw-dir'])
		util.assureDirClean(out_dir)
		
		for acc in config.accounts():
			if self.command_selected_user and int(acc['id']) != self.map.selected_user_id:
				continue
			log.info('requesting user %s info'%(acc['login'],))
			for msg_type in ['all', 'known_planets', 'fleetsmessages']:
				l.getDcData(self, acc['login'], msg_type, out_dir)
		l.start()
Example #6
0
	def onExploreGeoAll(self, _):
		'upload pending events on server'
		
		turn = db.getTurn()
		explore_owned_planets = True
		
		out_dir = os.path.join(util.getTempDir(), config.options['data']['raw-dir'])
		util.assureDirClean(out_dir)
		for acc in config.accounts():
			log.info('requesting user %s info'%(acc['login'],))
			# find if there is any explore-capable fleets over unexplored planets
			# or simply tell explore to every unit =))) game server will do the rest
			
			#1. find all fleets above empty planets
			
			# get fleet position, check if planet geo is unknown
			fleet_planet = {}
			pl = {}
			
			for fleet in db.fleets(turn, ['owner_id=%s'%(acc['id'],)] ):
				print 'got fleet %s'%(fleet,)
				coord = get_coord(fleet)
				cfilter = filter_coord(coord)
				for planet in db.planets(turn, cfilter):
					# skip if occupied
					if planet['owner_id'] and not explore_owned_planets:
						continue
					if planet['o'] and planet['e'] and planet['m'] and planet['t']:
						continue
					#check holes and stars
					if not db.is_planet(coord):
						print '%s not a planet'%(coord,)
						continue
					if not coord in pl:
						pl[coord] = set()
					pl[ coord ].add(fleet['id'])
					print 'planet unexplored %s'%(planet,)
			
			acts = {}
			
			# get all fleet units, check if explore capable
			for coord, planet_fleets in pl.iteritems():
				for fleet_id in planet_fleets:
					for unit in db.units(turn, ['fleet_id=%s'%(fleet_id,)]):
						print '%s %s unit %s'%(coord, fleet_id, unit)
						# ok unit
						bc = unit['class']
						
						#for proto in db.prototypes(['id=%s'%(bc,)]):
						#	print 'proto %s'%(proto,)

						#type 1 probably geo explore
						for act in db.proto_actions(['proto_id=%s'%(bc,), 'type=1']):
							#print 'ACTION: %s %s %s'%(coord, bc, act)
							acts[coord] = unit['id']

			self.pending_actions.user_id = int(acc['id'])
			#self.pendingActions[int(acc['id'])] = actions
			#hw_planet = db.getUserHw(acc['id'])
			#actions.createNewFleet(hw_planet, 'a_new_shiny_fleet')
			
			at_least_one = False
			for coord, unit_id in acts.iteritems():
				print 'explore (%s) %s'%(coord, unit_id)
				self.pending_actions.explore_planet( coord, unit_id )
				at_least_one = True
			
			if at_least_one:
				self.perform_actions()
Example #7
0
	def onFlyHomeScouts(self, _):
		turn = db.getTurn()
				
		for acc in config.accounts():
			user_id = int(acc['id'])
			self.pending_actions.user_id = user_id
			print 'fly home scouts for user %s %s'%(user_id, acc['login'])
							
			# fly scouts back to base
			
			fleets = []
			fleet_flt = ['owner_id=%s'%(user_id,)]
			
			fleet_name = None #unicode('Fleet')
			# can also filter fleets by names
			#TODO: beware escapes
			if fleet_name:
				fleet_flt.append( 'name="%s"'%(fleet_name,) ) 
			for fleet in db.fleets(turn, fleet_flt):
				print 'found fleet %s'%(fleet,)
				# if fleet over empty planet - jump back home
				coord = get_coord(fleet)
				planet = db.get_planet( coord )
				if not planet or not planet['owner_id'] or int(planet['owner_id']) != user_id:
					print 'fleet %s not at home'%(fleet['id'],)
					units = []
					for unit in db.units(turn, ['fleet_id=%s'%(fleet['id'],)]):
						print 'fleet %s has unit %s'%(fleet['id'], unit)
						units.append(unit)
					
					# not a scout fleet if more then one unit in fleet
					# if zero units - don't care about empty fleet as well
					if len(units) != 1:
						print 'fleet %s has %s units, while required 1'%(fleet['id'], len(units))
						continue

					if int(units[0]['id']) in self.manual_control_units:
						continue

					proto = db.get_prototype(units[0]['class'])
					if proto['carapace'] != CARAPACE_PROBE:
						print 'fleet %s unit %s is not a probe'%(fleet['id'], units[0])
						continue

					#jump back
					print 'fleet %s %s needs to get home'%(coord, fleet)
					fleets.append( (coord, fleet) )					

			if not fleets:
				print 'no scout fleets found not at home'
				continue
			
			coords = []
			for planet in db.planets(turn, ['owner_id=%s'%(user_id,)]):
				coord = get_coord(planet)
				coords.append( coord )
				print 'possible home planet %s'%(coord,)
				
			if coords == None or fleets == []:
				print 'oops %s %s'%(coords, fleets)
				continue
			
			print 'looking for best route for %s fleets' %(len(fleets,),)
			for coord, fleet in fleets:
				#find closest planet
				closest_planet = coords[0]
				min_distance = util.distance(coords[0], coord)
				for c in coords:
					if util.distance(coord, c) < min_distance:
						min_distance = util.distance(coord, c)
						closest_planet = c
				
				# ok, found then jump
				print 'Jump (%s) %s'%(closest_planet, fleet)
				self.pending_actions.fleetMove( fleet['id'], closest_planet )
			
			self.perform_actions()
Example #8
0
	def onSendScouts(self, _):
		turn = db.getTurn()
		min_size = 70
		max_size = 99
		
		#helps avoid flying on the same planet with different accounts
		friend_geo_scout_ids = []
		for user in db.users():
			friend_geo_scout_ids.append(str(user['id']))
		
		for acc in config.accounts():
			user_id = int(acc['id'])

			if self.command_selected_user and user_id != self.map.selected_user_id:
				continue

			self.pending_actions.user_id = user_id
			print 'send scouts %s size %s'%(user_id, min_size)
					
			# find units that can geo-explore
			# find the ones that are already in fleets in one of our planets
			
			fly_range = 0.0
			ready_scout_fleets = {}
			# get all fleets over our planets
			for planet in db.open_planets(user_id):
				print 'open planet %s'%(planet,)
				coord = get_coord(planet)
				for fleet in db.fleets(turn, filter_coord(coord)+['owner_id=%s'%(user_id,)]):
					if value_in(self.exclude_fleet_names, fleet['name']):
						continue
					units = db.get_units(turn, ['fleet_id=%s'%(fleet['id'],)])
					if len(units) != 1:
						print 'fleet %s has wrong units count ( != 1 ) %s, skipping it'%(fleet, units)
						
						continue
					unit = units[0]
					if int(unit['id']) in self.manual_control_units:
						print 'unit %s reserved for manual control, skipping it'%(unit,)
						continue

					if not self.is_geo_scout(unit):
						print 'unit %s is not geo-scout, skipping it'%(unit,)
						continue
					fly_range = max(fly_range, self.get_unit_range(unit))
					print 'unit %s on planet %s for fleet %s is geo-scout'%(unit, coord, fleet)
					# ok, this is geo-scout, single unit in fleet, on our planet
					#ready_scout_fleets.append((coord, fleet))
					ready_scout_fleets.setdefault(coord, []).append((fleet, fly_range))
					
			
			# get possible planets to explore in nearest distance
			for coord in ready_scout_fleets.keys():
				serialization.load_geo_size_center(coord, 10)
			
			# jump to nearest/biggest unexplored planet
			exclude = set()
			for coord, fleets in ready_scout_fleets.iteritems():
				lt = int(coord[0]-fly_range), int(coord[1]-fly_range)
				
				possible_planets = []
				#s<=99 - skip stars
				for p in db.planets_size(['s>=%s'%(min_size,), 's<=%s'%(max_size,)] + planet_area_filter( lt, (int(fly_range*2), int(fly_range*2)))):
					dest = get_coord(p)
					if dest in exclude:
						continue
					dist = util.distance(dest, coord)
					if dist > fly_range:
						continue
						
					planet = db.get_planet(dest)
					if planet and 'o' in planet:
						continue
					
					has_flying_geo_scouts = False
					# get list of all flying fleets ( or our allies and mults ) to this planet 
					for fleet in db.flyingFleets(turn, filter_coord(dest) + ['owner_id in(%s)'%','.join(friend_geo_scout_ids)]):
						# check if the fleet is geo-scout
						if self.is_geo_scout_fleet(turn, fleet['id']):
							has_flying_geo_scouts = True
							print 'found another scout %s, skip planet %s'%(fleet, dest)
					if has_flying_geo_scouts:
						exclude.add(dest)
						continue
					
					#TODO: can check if it will take too long for the other fleet, send ours
					
					possible_planets.append( (dist, dest) )

				for fleet, fleet_range in fleets:
					for dist, planet in sorted(possible_planets):
						if dist > fleet_range:
							continue
						# ok fly to it
						self.pending_actions.fleetMove(fleet['id'], planet)
						exclude.add( planet )
						print 'jump %s from %s to %s'%(fleet, coord, planet)
						possible_planets.remove( (dist, planet ) )
						break
							
			self.perform_actions()
Example #9
0
	def onExploreGeoAll(self, _):
		'upload pending events on server'
		
		explore_owned_planets = True
		
		out_dir = os.path.join(util.getTempDir(), config.options['data']['raw-dir'])
		util.assureDirClean(out_dir)
		for acc in config.accounts():
			if not 'id' in acc:
				continue
			user_id = int(acc['id'])
				
			log.info('requesting user %s info'%(acc['login'],))
			# find if there is any explore-capable fleets over unexplored planets
			# or simply tell explore to every unit =))) game server will do the rest
			
			#1. find all fleets above empty planets
			
			# get fleet position, check if planet geo is unknown
			fleet_planet = {}
			pl = {}
			
			for fleet in store.iter_objects_list('fleet', {'user_id':acc['id']} ):
				#print 'got fleet %s'%(fleet,)
				coord = get_coord(fleet)
				
				if coord in pl:
					pl[coord].add(fleet['fleet_id'])
					continue

				planet = store.get_object('planet', {'x':coord[0], 'y':coord[1]})
				#check holes and stars
				if not planet:
					continue
				
				# check if already explored
				if 'o' in planet and planet['o']:
					continue
				
				if not coord in pl:
					pl[coord] = set()
				pl[ coord ].add(fleet['fleet_id'])
				#print 'Add to exploration list planet %s'%(planet,)
			
			acts = {}
			
			# get all fleet units, check if explore capable
			for coord, planet_fleets in pl.iteritems():
				for fleet_id in planet_fleets:
					for unit in store.get_fleet_units(fleet_id):
						#print '%s %s unit %s'%(coord, fleet_id, unit)
						# ok unit
						bc = unit['proto_id']
						
						#for proto in db.prototypes(['id=%s'%(bc,)]):
						#	print 'proto %s'%(proto,)

						#type 1 probably geo explore
						action_geo_explore = store.get_object('proto_action',{'proto_id':bc, 'proto_action_id':request.RequestMaker.GEO_EXPLORE})
						if action_geo_explore:
							acts[coord] = unit['unit_id']
							break
					# no need to request more then one explore of a single planet
					if coord in acts:
						break

			self.pending_actions.user_id = int(acc['id'])
			#self.pendingActions[int(acc['id'])] = actions
			#hw_planet = db.getUserHw(acc['id'])
			#actions.createNewFleet(hw_planet, 'a_new_shiny_fleet')
			
			at_least_one = False
			for coord, unit_id in acts.iteritems():
				fleet_unit = store.get_object('fleet_unit', {'unit_id':unit_id})
				self.actions.add_action(action.ActionStore(user_id, unit_id, fleet_unit['fleet_id'], coord, action.Action.GEO_EXPLORE))
				#self.pending_actions.explore_planet( coord, unit_id )
				at_least_one = True
			
			if at_least_one:
				self.perform_actions()
Example #10
0
	def onFlyHomeScouts(self, _):
				
		for acc in config.accounts():
			if not 'id' in acc:
				continue
			user_id = int(acc['id'])
			self.pending_actions.user_id = user_id
			#print 'fly home scouts for user %s %s'%(user_id, acc['login'])
							
			# fly scouts back to base
			
			fleets = []
			fleet_flt = ['owner_id=%s'%(user_id,)]
			
			fleet_name = None #unicode('Fleet')
			# can also filter fleets by names
			#TODO: beware escapes
			if fleet_name:
				fleet_flt.append( 'name="%s"'%(fleet_name,) ) 
			for fleet in store.iter_objects_list('fleet', {'user_id':user_id}):
				#print 'found fleet %s'%(fleet,)
				# if fleet over empty planet - jump back home
				coord = get_coord(fleet)
				coord_filter = {'x':coord[0], 'y':coord[1]}
				planet = store.get_object('planet', coord_filter )
				#TODO: allow jump on all open-planets ( not only owned by user )
				coord_filter['user_id'] = user_id
				user_open_planet = store.get_object('open_planet', coord_filter )
				if user_open_planet:
					continue

				#print 'fleet %s not at home'%(fleet['id'],)
				units = []
				for unit in store.get_fleet_units(fleet['fleet_id']):
					#print 'fleet %s has unit %s'%(fleet['id'], unit)
					units.append(unit)
				
				# not a scout fleet if more then one unit in fleet
				# if zero units - don't care about empty fleet as well
				if len(units) != 1:
					#print 'fleet %s has %s units, while required 1'%(fleet['id'], len(units))
					continue

				if int(units[0]['unit_id']) in self.manual_control_units:
					continue

				proto = store.get_object('proto', {'proto_id':units[0]['proto_id']})
				if proto['carapace'] != CARAPACE_PROBE:
					#print 'fleet %s unit %s is not a probe'%(fleet['id'], units[0])
					continue

				#jump back
				#print 'fleet %s %s needs to get home'%(coord, fleet)
				fleets.append( (coord, fleet) )					

			if not fleets:
				#print 'no scout fleets found not at home'
				continue
			
			coords = []
			for planet in store.iter_objects_list('open_planet', {'user_id':user_id}):
				coord = get_coord(planet)
				coords.append( coord )
				#print 'possible home planet %s'%(coord,)
				
			if coords == None or fleets == []:
				#print 'oops %s %s'%(coords, fleets)
				continue
			
			#print 'looking for best route for %s fleets' %(len(fleets,),)
			for coord, fleet in fleets:
				#find closest planet
				closest_planet = coords[0]
				min_distance = util.distance(coords[0], coord)
				for c in coords:
					if util.distance(coord, c) < min_distance:
						min_distance = util.distance(coord, c)
						closest_planet = c
				
				# ok, found then jump
				#print 'Jump (%s) %s'%(closest_planet, fleet)
				
				self.actions.add_action( action.ActionJump(user_id, fleet['fleet_id'], closest_planet ))
Example #11
0
	def onMakeScoutFleets(self, _):		
		# get all planets
		# get harrison units able to scout
		# create fleets
		# put units to fleets
		
		# get all scouting fleets ( available to jump ( on my planets ) )
		# get unexplored planets
		# send nearest fleets to these planets
		
		# load size-map, use it to scout biggest first ( N > 70, descending )
		
		# get all scouting fleets ( on other planets )
		# geo-explore
		# send them back to nearest home planet
		
		#command_type, 
		#move_command = ('move_to', 
		
		#move_commands = [((x,y), fleet_id)]
	
		carapace = 11 # probe/zond
		fleet_name = 'scout:geo'
		turn = db.getTurn()
		
		for acc in config.accounts():
			if not 'id' in acc:
				continue
			user_id = int(acc['id'])
			
			#if user_id < 601140:
			#	continue

			probes_types = store.get_objects_list('proto', {'carapace':carapace, 'user_id':user_id})
			#any_class = 'class in (%s)'%(','.join([str(cls) for cls in units_classes]),)
			#print 'testing user %s with class %s'%(user_id, any_class)
			probe_ids = [str(proto['proto_id']) for proto in probes_types]
			
			self.pending_actions.user_id = user_id
			pending_units = []
			
			for planet in store.iter_objects_list('user_planet', {'user_id':user_id}):
				coord = get_coord(planet)
				#print 'checking harrison for planet %s'%(planet,)
				for unit in store.get_garrison_units(coord, value_in=('proto_id', probe_ids)):
					#print 'found unit %s on planet %s'%(unit, planet,)
					action_create = action.ActionCreateFleet(user_id, fleet_name, coord)
					self.actions.add_action(action_create)
					fleet_id = action_create.fleet_id
					
					self.actions.add_action(action.ActionUnitMove(user_id, fleet_id, unit['unit_id']))
					
					#self.actions.add_action(action.Action('unit_move', user_id, {'planet':coord, 'unit_id':unit['unit_id'], 'fleet_id':fleet_id}))
					#self.actions.add_action(action.Action('unit_move', user_id, {'planet':coord, 'unit_id':unit['unit_id'], 'fleet_id':fleet_id}))
					
					#self.pending_actions.createNewFleet(coord, fleet_name)
					#pending_units.append( (self.pending_actions.get_action_id(), coord, unit['id'] ) )
					
					#print 'found unit %s on planet %s'%(unit, coord )
			
			if len(pending_units) == 0:
				continue
Example #12
0
	def onSendScouts(self, _):
		min_size = 70
		max_size = 99
		
		#helps avoid flying on the same planet with different accounts
		friend_geo_scout_ids = []
		for user in db.users():
			friend_geo_scout_ids.append(str(user['id']))
		
		for acc in config.accounts():
			user_id = int(acc['id'])

			if self.command_selected_user and user_id != self.map.selected_user_id:
				continue

			self.pending_actions.user_id = user_id
			#log.info('send scouts %s size %s'%(acc['login'], min_size))
					
			# find units that can geo-explore
			# find the ones that are already in fleets in one of our planets
			
			fly_range = 0.0
			ready_scout_fleets = {}
			# get all fleets over our planets
			for planet in store.iter_objects_list('open_planet', {'user_id':user_id}):
				#print 'open planet %s'%(planet,)
				coord = get_coord(planet)
				for fleet in store.iter_objects_list('fleet', {'user_id':user_id, 'x':coord[0], 'y':coord[1]}):
					if value_in(self.exclude_fleet_names, fleet['name']):
						continue
					units = store.get_fleet_units(fleet['fleet_id'])
					if len(units) != 1:
						#print 'fleet %s has wrong units count ( != 1 ) %s, skipping it'%(fleet, units)						
						continue
					unit = units[0]
					if int(unit['unit_id']) in self.manual_control_units:
						#print 'unit %s reserved for manual control, skipping it'%(unit,)
						continue

					if not self.is_geo_scout(unit):
						#print 'unit %s is not geo-scout, skipping it'%(unit,)
						continue
					#fly_range = max(fly_range, )
					#print 'unit %s on planet %s for fleet %s is geo-scout'%(unit, coord, fleet)
					# ok, this is geo-scout, single unit in fleet, on our planet
					#ready_scout_fleets.append((coord, fleet))
					_,r = store.get_fleet_speed_range(fleet['fleet_id'])
					fly_range = max(fly_range, r)
					ready_scout_fleets.setdefault(coord, []).append((fleet, r))
					
			
			# get possible planets to explore in nearest distance
			for coord in ready_scout_fleets.keys():
				#print 'load geo size centered at %s with range %s'%(coord, int(fly_range))
				save_load.load_geo_size_center(coord, int(fly_range))
			
			# jump to nearest/biggest unexplored planet
			exclude = set()
			for coord, fleets in ready_scout_fleets.iteritems():
				max_fly_range = 0
				for f,r in fleets:
					max_fly_range = max(max_fly_range, r)
				
				possible_planets = []
				#s<=99 - skip stars
				#dx = lt[0]-fly_range, lt[0]+fly_range
				#dy = lt[1]-fly_range, lt[1]+fly_range
				for p in store.iter_planets_size(pos=coord, fly_range=max_fly_range, size_min=min_size, bigger_first = True):
					if not (p['s']>=min_size and p['s']<=max_size):
						#print 'planet %s not fit the size'%(p,)
						continue
					dest = get_coord(p)
					if dest in exclude:
						continue
					dist = util.distance(dest, coord)
					if dist > fly_range:
						#print 'planet %s is too far away'%(p,)
						continue
						
					planet = db.get_planet(dest)
					if planet and 'o' in planet and planet['o']:
						#print 'planet %s already explored'%(p,)
						continue
					
					has_flying_geo_scouts = False
					
					# check if currently there is some explore fleet on planet, or explore fleet already fly there
					already_has_scout = False
					for fleet in store.iter_objects_list('fleet', {'x':dest[0], 'y':dest[1]}, controlled = True):
						if self.is_geo_scout_fleet(fleet['fleet_id']):
							already_has_scout = True
							break
					if already_has_scout:
						#print 'planet %s has scount fleet on it'%(p,)
						continue
						
					already_fly_geo_scouts = False
					for fleet in store.iter_objects_list('flying_fleet', {'x':dest[0], 'y':dest[1]}, controlled = True):
						if self.is_geo_scout_fleet(fleet['fleet_id']):
							already_fly_geo_scouts = True
							#self.actions.add_action( action.ActionGeoExplore(user_id, ':dest, 'fleet_id':fleet['fleet_id']}))
							break
					if already_fly_geo_scouts:
						#print 'planet %s has flying scount fleet'%(p,)
						continue

					possible_planets.append( (dist, dest) )
					#print 'add possible planet %s'%(dest,)

				for fleet, fleet_range in fleets:
					#print 'check planets for fleet %s'%(fleet,)
					for dist, planet in sorted(possible_planets):
						if dist > fleet_range:
							#print 'planet %s too scary'%(p,)
							continue
						# ok fly to it
						self.actions.add_action( action.ActionJump(user_id, fleet['fleet_id'], planet ))
						#self.pending_actions.fleetMove(fleet['id'], planet)
						exclude.add( planet )
						#print 'jump %s from %s to %s'%(fleet, coord, planet)
						possible_planets.remove( (dist, planet ) )
						break
Example #13
0
	def loadUsers(self):
		self.user_list.DeleteAllItems()		
		for acc in config.accounts():
			if 'password' in acc and 'login' in acc:
				self.user_list.Append((acc['login'], acc['password']))