Exemplo n.º 1
0
	def hostility_check(self, bytes):
		if len(bytes) < 10 or bytes[0] != 0x8c:
			return
			
		player_id_1 = utility.read_bytes(bytes, 1, 4)
		player_id_2 = utility.read_bytes(bytes, 5, 4)
		
		my_id = craw.get_player_id()
		if my_id == None:
			return
		
		if player_id_1 != my_id:
			return
			
		if bytes[9] < 0x08:
			return
			
		for hostility_handler in self.hostility_handlers:
			hostility_handler()
			
		in_town = utility.town_check()
		
		if in_town == None:
			return
			
		if not in_town and configuration.chicken_on_hostile:
			player_name = craw.get_name_by_id(player_id_2)
			if player_name == None:
				print 'Leaving the game because an unknown player has declared hostility against us'
			else:
				print 'Leaving the game because player %s has declared hostility against us' % player_name
			craw.leave_game()
Exemplo n.º 2
0
def hostile_players():
    print "Declaring hostility to all players"
    players = craw.get_players()
    my_id = craw.get_player_id()
    players = filter(lambda player: player.id != my_id and player.level >= 9, players)
    packet = ""
    for player in players:
        packet += hostile_player_string(player.id)

    craw.send_packet(packet)
Exemplo n.º 3
0
	def process_bytes(self, bytes):
		ownership = packets.portal_ownership(bytes)
		if ownership == None:
			return
			
		my_id = craw.get_player_id()
		if my_id == None:
			self.debug_print('Unable to retrieve my ID')
			return
			
		player_id, portal_id = ownership
			
		if player_id != my_id:
			self.debug_print('IDs do not match: %08x vs. %08x (%s, %s)' % (my_id, player_id, str(type(my_id)), str(type(player_id))))
			return
		
		if self.tp_handler != None:
			self.tp_handler(portal_id)
			self.tp_handler = None