def get_char_id(self, char_name): char_name = char_name.capitalize() if char_name in self.name_to_id: return self.name_to_id[char_name] else: self.bot.send_packet(CharacterLookup(char_name)) while char_name not in self.name_to_id: self.bot.iterate() return self.name_to_id.get(char_name, None)
def _send_lookup_if_needed(self, char_name): # char_name must be .capitalize()'ed if char_name not in self.name_to_id and char_name not in self.waiting_for_response: self.waiting_for_response.add(char_name) # TODO load balance over all conns? self.bot.get_primary_conn().send_packet(CharacterLookup(char_name))
def _send_lookup_if_needed(self, char_name): # char_name must be .capitalize()'ed if char_name not in self.name_to_id and char_name not in self.waiting_for_response: self.waiting_for_response.add(char_name) self.bot.send_packet(CharacterLookup(char_name))