예제 #1
0
	def process_bytes(self, bytes):
		if not configuration.player_kill_information:
			return
			
		if len(bytes) < 26:
			return
			
		if bytes[0 : 2] != [0x5a, 0x06]:
			return
			
		#print utility.get_packet_string(bytes)
			
		victim_name = utility.read_name(bytes, 8)
		killer_name = utility.read_name(bytes, 24)
		
		#self.lame_print(victim_name, killer_name)
		
		victim = utility.get_player_data_by_name(victim_name)
		killer = utility.get_player_data_by_name(killer_name)
		
		if victim == None or killer == None:
			return
		
		self.request_lock.acquire()
		self.pending_requests.append(player_kill_whois_request(victim_name, killer_name))
		self.request_lock.release()
		
		self.bncs_handler.whois(victim_name, self.victim_whois_handler)
예제 #2
0
	def lame_print(self, victim_name, killer_name):
		victim = utility.get_player_data_by_name(victim_name)
		killer = utility.get_player_data_by_name(killer_name)
		
		if victim == None or killer == None:
			print 'Somebody got killed but the program was unable to extract the victim/killer'
			return
		
		victim_string = utility.get_character_string(victim)
		killer_string = utility.get_character_string(killer)
		
		line = '%s %s (%s) was slain by %s (%s) ' % (nil.time.timestamp(), victim_name, victim_string, killer_name, killer_string)
		print line
예제 #3
0
	def process_command(self, name, message):
		if not privileges.is_friend(name):
			return
			
		player = utility.get_player_data_by_name(name)
		if player == None:
			print 'Unable to retrieve player data of %s!' % name
			return
			
		if message == configuration.party_invitation_command:
			print 'Inviting %s' % name
			packets.invite_player(player.id)
예제 #4
0
	def __init__(self, name):
		if not configuration.player_kill_information:
			return
			
		self.name = name
		player_data = utility.get_player_data_by_name(name)
		if player_data == None:
			self.character_class_string = '[Unknown]'
			print 'Unable to extract player information for name %s' % name
		else:
			self.character_class_string = utility.get_character_string(player_data)
		self.account = None
예제 #5
0
	def process_command(self, name, message):
		self.player = utility.get_player_data_by_name(name)
		self.my_player = utility.get_my_player()
		
		if self.player.id == self.my_player.id:
			return
		
		if self.player == None or self.my_player == None:
			return
		
		enchant_level = craw.get_skill_level(enchant_handler_class.enchant_skill)
		if enchant_level == None:
			print 'Unable to retrieve the enchant skill level'
			return
			
		if enchant_level == 0:
			print 'Unable to enchant - this character does not even have this skill!'
			return
		
		self.enchant_level = enchant_level
		
		self.mana = craw.get_mana()
		if self.mana == None:
			print 'Unable to retrieve mana'
			return
	
		if message == configuration.enchant_command:
			self.launch_function(self.enchant_player)
				
		elif message == configuration.enchant_minions_command:
			self.launch_function(self.enchant_minions)
				
		elif message == configuration.enchant_all_command:
			self.launch_function(self.enchant_all)
			
		elif message == configuration.enchant_players_command:
			self.launch_function(self.enchant_players)