def name(self): if self._pet_familiar_id is None: return LocalizationHelperTuning.get_raw_text(self._name) pet_familiar = services.sim_info_manager().get(self._pet_familiar_id) if pet_familiar is None: logger.error("Attempting to get the name of a pet familiar that doesn't exist.") return return LocalizationHelperTuning.get_sim_name(pet_familiar)
def return_lost_objects(self): returned_objects = defaultdict(list) current_zone = services.current_zone() current_zone_id = services.current_zone_id() current_open_street_id = current_zone.open_street_id active_household = services.active_household() for locator in list(self._object_locators): if locator.zone_id != current_zone_id: if locator.open_street_id != current_open_street_id: elapsed_time = services.time_service( ).sim_now - locator.time_stamp if elapsed_time.in_minutes() < locator.time_before_lost: continue if locator.object_data is None: self.remove_object(locator.object_id) else: (obj_returned, owner) = self._return_lost_object(locator) if obj_returned is not None: if owner is not None: if isinstance(owner, int): if owner == active_household.id: returned_objects[owner].append( obj_returned) if owner.household is active_household: returned_objects[owner].append( obj_returned) elif owner.household is active_household: returned_objects[owner].append( obj_returned) if not returned_objects: return returned_objects_string = None household_manager = services.household_manager() for (owner, objects) in returned_objects.items(): if isinstance(owner, int): household = household_manager.get(owner) header = ObjectLostAndFoundService.FAMILY_NAME_HEADER( household.name) next_string = LocalizationHelperTuning.get_bulleted_list( header, *(LocalizationHelperTuning.get_object_name(obj) for obj in objects)) else: next_string = LocalizationHelperTuning.get_bulleted_list( LocalizationHelperTuning.get_sim_name(owner), *(LocalizationHelperTuning.get_object_name(obj) for obj in objects)) if returned_objects_string is None: returned_objects_string = next_string else: returned_objects_string = LocalizationHelperTuning.NEW_LINE_LIST_STRUCTURE( returned_objects_string, next_string) dialog = ObjectLostAndFoundService.OBJECTS_RETURN_MESSAGE_DIALOG( services.active_sim_info()) dialog.show_dialog(additional_tokens=(returned_objects_string, ))