Example #1
0
	def summoner_thread(self):
		while True:
			player = utility.get_my_player()
			if player == None:
				#print 'No summoner unit'
				time.sleep(configuration.summoner_check_delay)
				continue
			break
				
		if player.name not in configuration.summoners:
			#print 'This is not a summoner'
			return
			
		while True:
			my_unit = utility.get_my_unit()
			if my_unit == None:
				print 'Unable to retrieve summoner unit'
				return
				
			standing_still = my_unit.mode == 1
			if standing_still and not utility.town_check():
				targets = self.get_targets()
				if len(targets) == 0:
					craw.print_text('There are no nearby corpses')
				else:
					target = random.choice(targets)
					description, skill = random.choice(skills)
					craw.print_text('%s: %08x' % (description, target))
					packets.set_right_skill(skill)
					time.sleep(configuration.summoner_switch_delay)
					packets.cast_right_skill_at_target(1, target)
					time.sleep(configuration.summoner_cast_delay)
					continue
				
			time.sleep(configuration.summoner_check_delay)
Example #2
0
	def attack_thread(self):
		self.attack_print('Attack thread has been launched')
		while self.attacking:
			self.i = utility.get_my_player()
			if self.i == None:
				return
				
			my_unit = utility.get_my_unit()
			if my_unit == None:
				self.attack_print('Unable to retrieve unit')
				return
				
			standing_still = my_unit.mode == 1
			if standing_still and not utility.town_check():
				targets = self.get_targets()
				if len(targets) == 0:
					self.attack_print('No targets in range')
					pass
				else:
					self.attack_print('Targets in range:')
					for distance, id in targets:
						self.attack_print('%08x: %.1f' % (id, distance))
						
					if targets[0][0] <= configuration.follower_defence_radius:
						#a monster got too close, kill it, quickly!
						target = targets[0][1]
						self.attack_print('Dangerous close proximity monster detected')
					else:
						index = random.randint(0, min(len(targets), configuration.follower_attack_maximal_randomisation_position) - 1)
						target = targets[index][1]
						
					self.attack_print('Attacking target %08x' % target)
					packets.cast_left_skill_at_target(1, target)
			else:
				self.attack_print('Not standing still (player mode is %d)' % my_unit.mode)
				pass
				
			time.sleep(configuration.follower_attack_delay)