def _add_consumable_hovertip(self): owner = self.owner owner.hover_tip = ui_protocols.UiObjectMetadata.HOVER_TIP_CONSUMABLE_CRAFTABLE crafting_process = self._crafting_process recipe = self._get_recipe() if recipe is None: return self.owner.update_tooltip_field( TooltipFieldsComplete.recipe_name, recipe.get_recipe_name(crafting_process.crafter)) crafted_by_text = crafting_process.get_crafted_by_text( is_from_gallery=self.owner.is_from_gallery) crafted_with_text = crafting_process.get_crafted_with_text() if crafted_by_text is not None: if crafted_with_text is not None: crafted_by_text = LocalizationHelperTuning.NEW_LINE_LIST_STRUCTURE( crafted_by_text, crafted_with_text) crafter_sim_id = crafting_process.crafter_sim_id if crafter_sim_id is not None: self.owner.update_tooltip_field( TooltipFieldsComplete.crafter_sim_id, crafter_sim_id) elif crafted_with_text is not None: crafted_by_text = crafted_with_text self.owner.update_tooltip_field(TooltipFieldsComplete.crafted_by_text, crafted_by_text) if owner.has_state(CraftingTuning.QUALITY_STATE): value_quality = CraftingTuning.QUALITY_STATE_VALUE_MAP.get( owner.get_state(CraftingTuning.QUALITY_STATE)) if value_quality is not None: self.owner.update_tooltip_field( TooltipFieldsComplete.quality, value_quality.state_star_number) if owner.has_state( CraftingTuning.MASTERWORK_STATE ) and owner.get_state( CraftingTuning.MASTERWORK_STATE ) is CraftingTuning.MASTERWORK_STATE_VALUE and recipe.masterwork_name is not None: self.owner.update_tooltip_field( TooltipFieldsComplete.quality_description, recipe.masterwork_name) inscription = crafting_process.inscription if inscription is not None: self.owner.update_tooltip_field(TooltipFieldsComplete.inscription, inscription) self._add_spoil_listener( state_override=recipe.spoil_time_commodity_override) if recipe.time_until_spoiled_string_override is not None: self.owner.update_tooltip_field( TooltipFieldsComplete.spoiled_time_text, recipe.time_until_spoiled_string_override) subtext = self.owner.get_state_strings() if subtext is not None: self.owner.update_tooltip_field(TooltipFieldsComplete.subtext, subtext) recipe.update_hovertip(self.owner, crafter=crafting_process.crafter) current_inventory = owner.get_inventory() if current_inventory is not None: current_inventory.push_inventory_item_update_msg(owner) self.owner.on_hovertip_requested() self.owner.update_object_tooltip()
def __call__(self, sim, *args, household=DEFAULT, **kwargs): household = sim.household if household is DEFAULT else household string = self._get_string_for_humans(sim, household, *args, **kwargs) pets_string = self._get_string_for_pets(sim, household, *args, **kwargs) if pets_string is not None: string = LocalizationHelperTuning.NEW_LINE_LIST_STRUCTURE( string, pets_string) return string
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, ))
def _trap_catch_notification(self, fish_caught, treasure_caught, junk_count): final_string = None if treasure_caught: final_string = self._get_treasure_caught_text(treasure_caught) if fish_caught: fish_text = self._get_fish_caught_text(fish_caught) if final_string is None: final_string = fish_text else: final_string = LocalizationHelperTuning.NEW_LINE_LIST_STRUCTURE( final_string, fish_text) if junk_count > 0: junk_text = self._get_junk_caught_text(junk_count) if final_string is None: final_string = junk_text else: final_string = LocalizationHelperTuning.NEW_LINE_LIST_STRUCTURE( final_string, junk_text) if final_string is None: final_string = self.empty_trap_text() dialog = self.catch_item_notification(self.sim.sim_info) dialog.show_dialog(additional_tokens=(final_string, ))