Esempio n. 1
0
 def show_dialog(self, **kwargs):
     self.title = lambda **_: LocalizationHelperTuning.get_raw_text(
         'Tuning Error Notifier')
     self.text = lambda **_: LocalizationHelperTuning.get_raw_text(
         'XML tuning errors matching your filters were detected.  Press OK to view these in your web browser, or Cancel to ignore.'
     )
     super().show_dialog(**kwargs)
Esempio n. 2
0
 def get_test_result(self, sim, cls):
     unavailable_items = Counter()
     unavailable_item_description = {}
     for item in self.ingredients:
         item_count = sim.inventory_component.get_item_quantity_by_definition(
             item.ingredient)
         if item_count < item.quantity:
             unavailable_items[
                 item.ingredient] += item.quantity - item_count
             unavailable_item_description[
                 item.ingredient] = item.missing_ingredient_additional_text
     if unavailable_items:
         tooltip = LocalizationHelperTuning.get_bulleted_list(
             ItemCost.UNAVAILABLE_TOOLTIP_HEADER(sim),
             *tuple(
                 LocalizationHelperTuning.get_object_count(
                     count,
                     ingredientDef,
                     detail_text=unavailable_item_description[ingredientDef]
                 ) for (ingredientDef, count) in unavailable_items.items()))
         return event_testing.results.TestResult(
             False,
             "Sim doesn't have the required items in inventory.",
             tooltip=lambda *_, **__: tooltip)
     return TestResult.TRUE
 def show_royalty_notification(self, royalty_payment_dict):
     notification_text = LocalizationHelperTuning.get_new_line_separated_strings(*(LocalizationHelperTuning.get_bulleted_list(RoyaltyTracker.get_name_for_type(royalty_type), *(RoyaltyTracker.get_line_item_string(r.entry_name, royalty_payment_dict[r]) for r in royalty_list)) for (royalty_type, royalty_list) in self._royalties.items()))
     notification_text = LocalizationHelperTuning.get_new_line_separated_strings(self.ROYALTY_NOTIFICATION_HEADER, notification_text)
     sim_info = self.sim_info
     resolver = SingleSimResolver(sim_info)
     dialog = self.ROYALTY_NOTIFICATION(sim_info, resolver, text=lambda *_: notification_text)
     dialog.show_dialog()
Esempio n. 4
0
 def _ui_metadata_gen(self):
     if GardeningTuning.is_spliced(self.owner):
         fruit_names = self.get_root_stock_names()
         description = LocalizationHelperTuning.get_comma_separated_list(
             *fruit_names)
         plant_name = GardeningTuning.SPLICED_PLANT_NAME()
     else:
         unidentified_overrides = self._unidentified_overrides
         if unidentified_overrides is not None and GardeningTuning.is_unidentified(
                 self.owner):
             description = unidentified_overrides.unidentified_description
             plant_name = unidentified_overrides.unidentified_name
         else:
             if self.is_shoot and self.root_stock is not None:
                 description = LocalizationHelperTuning.get_name_value_pair(
                     GardeningTuning.SHOOT_DESCRIPTION_STRING,
                     LocalizationHelperTuning.get_object_name(
                         self.root_stock.main_spawner.definition))
             else:
                 description = LocalizationHelperTuning.get_object_description(
                     self.owner.definition)
             plant_name = LocalizationHelperTuning.get_object_name(
                 self.owner.definition)
     yield ('recipe_name', plant_name)
     yield ('recipe_description', description)
     subtext = self.owner.get_state_strings()
     if subtext is not None:
         yield ('subtext', subtext)
Esempio n. 5
0
 def get_state_strings(self, first_string=None):
     obj = self.owner
     int_token = 0
     for state_int_data in self.state_value_numbers:
         state_value = state_int_data.state_value
         if state_value is None:
             continue
         if obj.has_state(state_value.state):
             if obj.get_state(state_value.state) is state_value:
                 int_token = state_int_data.number
                 break
     bullet_points = [] if first_string is None else [first_string]
     for state_string_datas in self.state_value_strings:
         for state_string_data in state_string_datas:
             state_value = state_string_data.state_value
             if state_value is None:
                 continue
             if obj.has_state(state_value.state) and obj.get_state(
                     state_value.state) is state_value:
                 bullet_point = state_string_data.text(int_token)
                 bullet_points.append(bullet_point)
                 break
     if bullet_points:
         if len(bullet_points) == 1:
             return LocalizationHelperTuning.get_raw_text(bullet_points[0])
         else:
             return LocalizationHelperTuning.get_bulleted_list(
                 None, *bullet_points)
Esempio n. 6
0
 def get_interaction_tooltip(self, tooltip=None, sim=None):
     if self.ingredients:
         item_tooltip = LocalizationHelperTuning.get_bulleted_list(self.AVAILABLE_TOOLTIP_HEADER(sim), *tuple(LocalizationHelperTuning.get_object_count(ingredient.quantity, ingredient.ingredient) for ingredient in self.ingredients))
         if tooltip is None:
             return item_tooltip
         return LocalizationHelperTuning.get_new_line_separated_strings(tooltip, item_tooltip)
     return tooltip
 def _get_name(cls,
               inst,
               target=DEFAULT,
               context=DEFAULT,
               track=None,
               **interaction_parameters):
     if track is None:
         return inst.create_localized_string(inst.display_name)
     tag_set = None
     if track in ObjectRelationshipTrack.OBJECT_BASED_FRIENDSHIP_TRACKS:
         tag_set = ObjectRelationshipTrack.OBJECT_BASED_FRIENDSHIP_TRACKS[
             track]
     if tag_set is not None:
         relationship_service = services.relationship_service()
         relationship = relationship_service.get_object_relationship(
             context.sim.id, tag_set)
         if relationship is not None:
             object_name = relationship.get_object_rel_name()
             if object_name:
                 if cls.custom_name_string_wrapper is not None:
                     return cls.custom_name_string_wrapper(
                         LocalizationHelperTuning.get_raw_text(object_name))
                 return LocalizationHelperTuning.get_raw_text(object_name)
     if track in cls.object_variant_mapping:
         return cls.create_localized_string(
             cls.object_variant_mapping[track].display_name,
             context=context,
             target=target)
     return inst.create_localized_string(inst.display_name)
 def _apply_to_subject_and_target(self, subject, target, resolver):
     if subject.is_npc:
         return
     obj_counter = Counter()
     if self._object_rewards.spawn_type == ObjectRewardsTuning.SPAWNER_REWARD:
         participant = resolver.get_participant(
             self._object_rewards.spawner_participant)
         if participant is not None:
             weighted_data = participant.interaction_spawner_data()
             if weighted_data is not None:
                 self._create_object_rewards(weighted_data, obj_counter,
                                             resolver)
     elif self._object_rewards.spawn_type == ObjectRewardsTuning.TUNABLE_REWARD:
         for _ in range(self._object_rewards.quantity):
             weight_pairs = [(data.weight, data.reward)
                             for data in self._object_rewards.reward_objects
                             ]
             self._create_object_rewards(weight_pairs, obj_counter,
                                         resolver)
     if obj_counter and self._notification is not None:
         obj_names = [
             LocalizationHelperTuning.get_object_count(count, obj)
             for (obj, count) in obj_counter.items()
         ]
         dialog = self._notification(subject, resolver=resolver)
         dialog.show_dialog(
             additional_tokens=(LocalizationHelperTuning.get_bulleted_list(
                 None, *obj_names), ))
     return True
Esempio n. 9
0
def register_custom_career(opt_sim: OptionalSimInfoParam = None,
                           _connection=None):
    sim_info = get_optional_target(opt_sim,
                                   target_type=OptionalSimInfoParam,
                                   _connection=_connection)

    def on_response(dialog):
        if not dialog.accepted:
            return
        name = dialog.text_input_responses.get(Career.TEXT_INPUT_NEW_NAME)
        description = dialog.text_input_responses.get(
            Career.TEXT_INPUT_NEW_DESCRIPTION)
        sim_info.career_tracker.set_custom_career_data(
            custom_name=name, custom_description=description)

    register_dialog_data = Career.REGISTER_CAREER_DIALOG_DATA
    dialog = register_dialog_data.register_career_dialog(
        sim_info, SingleSimResolver(sim_info))
    text_input_overrides = None
    if sim_info.career_tracker.has_custom_career:
        text_input_overrides = {}
        custom_career_data = sim_info.career_tracker.custom_career_data
        text_input_overrides[
            Career.
            TEXT_INPUT_NEW_NAME] = lambda *_, **__: LocalizationHelperTuning.get_raw_text(
                custom_career_data.get_custom_career_name())
        text_input_overrides[
            Career.
            TEXT_INPUT_NEW_DESCRIPTION] = lambda *_, **__: LocalizationHelperTuning.get_raw_text(
                custom_career_data.get_custom_career_description())
    dialog.show_dialog(on_response=on_response,
                       text_input_overrides=text_input_overrides)
    return True
Esempio n. 10
0
 def _do_behavior(self):
     royalty_payment = self.royalty_payment
     recipient = self.interaction.get_participant(
         royalty_payment.royalty_recipient)
     if recipient is None:
         logger.error(
             "Trying to set up a royalty payment but interaction, {}, doesn't have the participant type {}.",
             self.interaction, royalty_payment.royalty_recipient)
     royalty_tracker = recipient.sim_info.royalty_tracker
     if royalty_tracker is None:
         logger.error(
             'Trying to set up a royalty payment but the sim has a None royalty tracker.'
         )
     participant = self.interaction.get_participant(
         royalty_payment.royalty_subject)
     if participant is None:
         logger.error(
             "Trying to set up a royalty payment but the royalty subject, {}, doesn't exist in this interaction.",
             royalty_payment.royalty_subject)
     if isinstance(participant, (str, LocalizedString)):
         display_name = LocalizationHelperTuning.get_raw_text(participant)
     else:
         display_name = LocalizationHelperTuning.get_object_name(
             participant)
     royalty_tracker.start_royalty(
         royalty_payment.royalty_type, royalty_payment.guid64, display_name,
         royalty_payment.payment_multipliers.get_multiplier(
             self.interaction.get_resolver()))
Esempio n. 11
0
 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)
Esempio n. 12
0
 def _get_entry_tooltip(self, entry_def):
     return EntryTooltip(
         HovertipStyle.HOVER_TIP_DEFAULT, {
             TooltipFields.recipe_name:
             LocalizationHelperTuning.get_object_name(entry_def),
             TooltipFields.recipe_description:
             LocalizationHelperTuning.get_object_description(entry_def)
         })
Esempio n. 13
0
def show_notif(sim, text):
    title = "{} said".format(
        Distributor.instance().get_distributor_with_active_sim_matching_sim_id(
            sim.id).client._account.persona_name)
    notification = UiDialogNotification.TunableFactory().default(
        sim,
        text=lambda **_: LocalizationHelperTuning.get_raw_text(text),
        title=lambda **_: LocalizationHelperTuning.get_raw_text(title))
    notification.show_dialog(icon_override=(None, sim))
 def get_non_active_display(cls, token_data):
     if token_data.token_property == GlobalPolicyTokenType.NAME:
         return LocalizationHelperTuning.get_raw_text(
             token_data.global_policy.display_name())
     if token_data.token_property == GlobalPolicyTokenType.PROGRESS:
         return LocalizationHelperTuning.get_raw_text(
             cls.GLOBAL_POLICY_TOKEN_NON_ACTIVE())
     logger.error(
         'Invalid Global Policy Property {} tuned on the Global Policy token.'
         .format(token_data.property))
Esempio n. 15
0
 def update_hovertip(cls, owner, crafter=None):
     description = cls.recipe_description(crafter)
     genre = Genre.get_genre_localized_string(owner)
     if genre is not None:
         description = LocalizationHelperTuning.get_new_line_separated_strings(description, genre)
     value_text = cls.value_text
     if value_text:
         localized_value = value_text(owner.current_value)
         description = LocalizationHelperTuning.get_new_line_separated_strings(description, localized_value)
     objects.components.crafting_component._set_recipe_decription(owner, description)
Esempio n. 16
0
 def name(self):
     if self._name is not None:
         if self._localized_custom_name is None:
             self._localized_custom_name = LocalizationHelperTuning.get_raw_text(
                 self._name)
     if self._localized_custom_name is not None:
         return self._localized_custom_name
     if self.club_seed is not None:
         return self.club_seed.name
     return LocalizationHelperTuning.get_raw_text('')
Esempio n. 17
0
 def get_tooltip_field(self, field, context=None, target=None):
     if field == TooltipFields.relic_description:
         sim = context.sim
         if sim is None:
             return
         return sim.sim_info.relic_tracker.get_description_for_objects(
             self.owner, target)
     name = TooltipFieldsComplete(field).name
     existing_handle = self._ui_metadata_handles.get(name, None)
     if existing_handle is not None:
         (_, _, value) = self.owner.get_ui_metadata(existing_handle)
         return value
     tooltip_component = None
     tooltip_override = self.owner.get_tooltip_override()
     if tooltip_override is not None:
         tooltip_component = tooltip_override.get_component(
             types.TOOLTIP_COMPONENT)
     if tooltip_component is None:
         tooltip_component = self
     tooltip_text = None
     resolver = SingleObjectResolver(self.owner)
     for tooltip_data in tooltip_component.custom_tooltips:
         object_tests = tooltip_data.object_tests
         if object_tests and not object_tests.run_tests(resolver):
             continue
         tooltip_text = tooltip_data.tooltip_fields.get(field, tooltip_text)
     if tooltip_text is not None:
         if tooltip_text.text_tokens is not None:
             tokens = tooltip_text.text_tokens.get_tokens(resolver)
             if None in tokens:
                 return
         else:
             tokens = ()
         text = tooltip_text.text(*tokens)
         external_field_data_tuple = tooltip_component._external_field_to_data.get(
             name)
         if external_field_data_tuple:
             tooltip_override_data = tooltip_text.override_component_information
             if tooltip_override_data is not None:
                 if tooltip_override_data.concatenation_type == TooltipFieldConcatenationType.CONCATENATE_BEFORE:
                     text = LocalizationHelperTuning.get_separated_string_by_style(
                         tooltip_override_data.concatenation_style, text,
                         external_field_data_tuple.field_data)
                 else:
                     text = LocalizationHelperTuning.get_separated_string_by_style(
                         tooltip_override_data.concatenation_style,
                         external_field_data_tuple.field_data, text)
         if name == self.SUBTEXT_HANDLE:
             if tooltip_component._ui_metadata_handles:
                 subtext = tooltip_component.get_state_strings(text)
                 if subtext is not None:
                     text = subtext
         handle = self.owner.add_ui_metadata(name, text)
         self._ui_metadata_handles[name] = handle
         return text
Esempio n. 18
0
 def _payout_rebates(self, *_):
     if not self._rebates:
         return
     active_sim = self._household.client.active_sim
     line_item_text = LocalizationHelperTuning.get_new_line_separated_strings(*(self.REBATE_NOTIFICATION_LINE_ITEM(t.display_name(active_sim), a) for (t, a) in self._rebates.items()))
     notification_text = LocalizationHelperTuning.get_new_line_separated_strings(self.REBATE_NOTIFICATION_HEADER, line_item_text)
     dialog = self.REBATE_NOTIFICATION(active_sim, text=lambda *_, **__: notification_text)
     dialog.show_dialog()
     total_rebate_amount = sum(self._rebates.values())
     self._household.funds.add(total_rebate_amount, reason=Consts_pb2.TELEMETRY_MONEY_ASPIRATION_REWARD, sim=active_sim)
     self.clear_rebates()
Esempio n. 19
0
def show_notification(text, title=None):
    client = services.client_manager().get_first_client()
    if title is None:
        title = 'Neutron Core'

    localized_title = lambda **_: LocalizationHelperTuning.get_raw_text(title)
    localized_text = lambda **_: LocalizationHelperTuning.get_raw_text(text)

    notification = UiDialogNotification.TunableFactory().default(
        client.active_sim, text=localized_text, title=localized_title)
    notification.show_dialog()
Esempio n. 20
0
def mp_chat(target_id=None, _connection=None):
    try:
        target_id = int(target_id)

        ts4mp_log("chat", target_id)
        distributor = Distributor.instance(
        ).get_distributor_with_active_sim_matching_sim_id(target_id)

        client = distributor.client
        ts4mp_log("chat", client)

        def enter_dialog_callback(dialog):
            if not dialog.accepted:
                ts4mp_log("chat", "Dialog was not accepted.")
                return
            dialog_text = dialog.text_input_responses.get("dialog")
            ts4mp_log("chat", 'Showing message')

            distributor = Distributor.instance(
            ).get_distributor_with_active_sim_matching_sim_id(target_id)
            if distributor is not None:
                client = distributor.client
                ts4mp_log("chat", 'Showing message')

                show_notif(client.active_sim, dialog_text)

        localized_title = lambda **_: LocalizationHelperTuning.get_raw_text(
            "Say Something")
        localized_text = lambda **_: LocalizationHelperTuning.get_raw_text(
            "Say something to anybody who's listening.")
        localized_fname = lambda **_: LocalizationHelperTuning.get_raw_text(
            "Type your message here!")
        localized_lname = lambda **_: LocalizationHelperTuning.get_raw_text(
            "Type your emote here!")

        text_input_1 = UiTextInput(sort_order=0)
        text_input_1.default_text = localized_fname
        text_input_1.title = None
        text_input_1.max_length = 100
        text_input_1.initial_value = localized_fname
        text_input_1.length_restriction = Scum_TextInputLengthName()

        inputs = AttributeDict({'dialog': text_input_1})
        dialog = UiDialogTextInputOkCancel.TunableFactory().default(
            client.active_sim,
            text=localized_text,
            title=localized_title,
            text_inputs=inputs,
            is_special_dialog=True)
        ts4mp_log("chat", "Dialog id: {}".format(dialog.dialog_id))
        dialog.add_listener(enter_dialog_callback)
        dialog.show_dialog()
    except Exception as e:
        ts4mp_log('chat', e)
 def get_definition_notebook_data(self, ingredient_cache=()):
     definition_manager = services.definition_manager()
     fruit_definition = definition_manager.get(
         self.entry_object_definition_id)
     if fruit_definition is None:
         return
     gardening_tuned_values = fruit_definition.cls._components.gardening._tuned_values
     plant_definition = gardening_tuned_values.plant
     sub_list_data = []
     sub_list_data.append(
         SubListData(None, 0, 0, True, False,
                     self.entry_text_value(fruit_definition.price / 5),
                     None, None))
     season_service = services.season_service()
     if season_service is not None:
         season_text = GardeningTuning.get_seasonality_text_from_plant(
             plant_definition)
         if season_text is None:
             season_text = GardeningTuning.PLANT_SEASONALITY_TEXT(
                 GardeningTuning.SEASONALITY_ALL_SEASONS_TEXT)
         sub_list_data.append(
             SubListData(None, 0, 0, True, False, season_text, None, None))
     sub_list_data.append(
         SubListData(
             None, 0, 0, True, False,
             LocalizationHelperTuning.get_object_description(
                 plant_definition), None, None))
     for (splice_fruit, splice_fruit_result
          ) in gardening_tuned_values.splicing_recipies.items():
         sub_list_data.append(
             SubListData(
                 None, 0, 0, True, False,
                 self.entry_text_splicing(splice_fruit,
                                          splice_fruit_result), None, None))
     gardening_collection_data = ObjectCollectionData.get_collection_data(
         CollectionIdentifier.Gardening)
     for obj_data in itertools.chain(
             gardening_collection_data.object_list,
             gardening_collection_data.bonus_object_list):
         if obj_data.collectable_item is fruit_definition:
             rarity_text = ObjectCollectionData.COLLECTION_RARITY_MAPPING[
                 obj_data.rarity].text_value
             sub_list_data.append(
                 SubListData(None, 0, 0, True, False,
                             self.entry_text_rarity(rarity_text), None,
                             None))
             break
     entry_data = EntryData(
         LocalizationHelperTuning.get_object_name(fruit_definition),
         IconInfoData(obj_def_id=fruit_definition.id), None, sub_list_data,
         None)
     return entry_data
Esempio n. 22
0
 def update_hovertip(cls, owner, crafter=None):
     description = cls.recipe_description(crafter)
     genre = Genre.get_genre_localized_string(owner)
     if genre is not None:
         description = LocalizationHelperTuning.get_new_line_separated_strings(
             description, genre)
     value_text = cls.value_text
     if value_text:
         localized_value = value_text(owner.current_value)
         description = LocalizationHelperTuning.get_new_line_separated_strings(
             description, localized_value)
     objects.components.crafting_component._set_recipe_decription(
         owner, description)
Esempio n. 23
0
 def _apply_to_subject_and_target(self, subject, target, resolver):
     degree_tracker = subject.degree_tracker
     if degree_tracker is None:
         return
     empty_list_counter = 0
     first_list_entry = True
     active_scholarship_list = degree_tracker.get_scholarships_list_by_status(
         ScholarshipStatus.ACTIVE, subject, first_list_entry)
     if active_scholarship_list is None:
         active_scholarship_list = LocalizationHelperTuning.get_raw_text('')
         empty_list_counter += 1
     else:
         first_list_entry = False
     pending_scholarships_list = degree_tracker.get_scholarships_list_by_status(
         ScholarshipStatus.PENDING, subject, first_list_entry)
     if pending_scholarships_list is None:
         pending_scholarships_list = LocalizationHelperTuning.get_raw_text(
             '')
         empty_list_counter += 1
     else:
         first_list_entry = False
     accepted_scholarships_list = degree_tracker.get_scholarships_list_by_status(
         ScholarshipStatus.ACCEPTED, subject, first_list_entry)
     if accepted_scholarships_list is None:
         accepted_scholarships_list = LocalizationHelperTuning.get_raw_text(
             '')
         empty_list_counter += 1
     else:
         first_list_entry = False
     rejected_scholarships_list = degree_tracker.get_scholarships_list_by_status(
         ScholarshipStatus.REJECTED, subject, first_list_entry)
     if rejected_scholarships_list is None:
         rejected_scholarships_list = LocalizationHelperTuning.get_raw_text(
             '')
         empty_list_counter += 1
     else:
         first_list_entry = False
     if empty_list_counter >= self.SCHOLARSHIP_STATUS_CATEGORIES_AMOUNT:
         dialog = self.SCHOLARSHIP_STATUS_NO_SCHOLARSHIPS_NOTIFICATION(
             subject, None)
         dialog.show_dialog(
             secondary_icon_override=IconInfoData(obj_instance=subject),
             additional_tokens=(subject, ))
         return
     dialog = self.SCHOLARSHIP_STATUS_NOTIFICATION(subject, None)
     dialog.show_dialog(
         secondary_icon_override=IconInfoData(obj_instance=subject),
         additional_tokens=(subject, active_scholarship_list,
                            pending_scholarships_list,
                            accepted_scholarships_list,
                            rejected_scholarships_list))
 def _get_fish_caught_text(self, fish_caught):
     all_fish_strings = []
     for fish in fish_caught:
         type_loc_string = LocalizationHelperTuning.get_object_name(
             fish.definition)
         value_loc_string = LocalizationHelperTuning.get_money(
             fish.current_value)
         weight_loc_string = fish.get_localized_weight()
         fish_data_text = self.fish_information_text(
             weight_loc_string, type_loc_string, value_loc_string)
         all_fish_strings.append(fish_data_text)
     final_fish_text = LocalizationHelperTuning.get_bulleted_list(
         self.fish_header_text(), *all_fish_strings)
     return final_fish_text
Esempio n. 25
0
	def _apply_to_subject_and_target (self, subject, target, resolver, placement_override_func = None, post_object_create_func = None):
		if subject.is_npc:
			return
		obj_counter = Counter()
		quantity = self._object_rewards.quantity
		quantity += self._object_rewards.tested_bonus_quantity.get_modified_value(resolver)
		for _ in range(int(quantity)):
			weight_pairs = [(data.weight, (data.reward, data.states_on_reward_object, data.quantity)) for data in self._object_rewards.reward_objects]
			self._create_object_rewards(weight_pairs, obj_counter, resolver, subject = subject, placement_override_func = placement_override_func, post_object_create_func = post_object_create_func)
		if obj_counter and self._notification is not None:
			obj_names = [LocalizationHelperTuning.get_object_count(count, obj) for (obj, count) in obj_counter.items()]
			dialog = self._notification(subject, resolver = resolver)
			dialog.show_dialog(additional_tokens = (LocalizationHelperTuning.get_bulleted_list(None, *obj_names),))
		return True
 def get_active_policy_display(self, token_data):
     if token_data.token_property == GlobalPolicyTokenType.NAME:
         return LocalizationHelperTuning.get_raw_text(self.display_name())
     if token_data.token_property == GlobalPolicyTokenType.PROGRESS:
         progress_percentage_str = str(
             int(
                 round(
                     float(self.progress_value) /
                     float(self.progress_max_value), 2) * 100))
         return LocalizationHelperTuning.get_raw_text(
             progress_percentage_str)
     logger.error(
         'Invalid Global Policy Property {} tuned on the Global Policy token.'
         .format(token_data.property))
Esempio n. 27
0
 def show_royalty_notification(self, royalty_payment_dict):
     notification_text = LocalizationHelperTuning.get_new_line_separated_strings(
         *(LocalizationHelperTuning.get_bulleted_list(
             RoyaltyTracker.get_name_for_type(royalty_type),
             *(RoyaltyTracker.get_line_item_string(r.entry_name,
                                                   royalty_payment_dict[r])
               for r in royalty_list))
           for (royalty_type, royalty_list) in self._royalties.items()
           if royalty_list))
     sim_info = self.sim_info
     resolver = SingleSimResolver(sim_info)
     dialog = self.ROYALTY_NOTIFICATION(sim_info,
                                        resolver,
                                        text=lambda *_: notification_text)
     dialog.show_dialog()
Esempio n. 28
0
 def _do_behavior(self):
     royalty_payment = self.royalty_payment
     recipient = self.interaction.get_participant(royalty_payment.royalty_recipient)
     if recipient is None:
         logger.error("Trying to set up a royalty payment but interaction, {}, doesn't have the participant type {}.", self.interaction, royalty_payment.royalty_recipient)
     royalty_tracker = recipient.sim_info.royalty_tracker
     if royalty_tracker is None:
         logger.error('Trying to set up a royalty payment but the sim has a None royalty tracker.')
     participant = self.interaction.get_participant(royalty_payment.royalty_subject)
     if participant is None:
         logger.error("Trying to set up a royalty payment but the royalty subject, {}, doesn't exist in this interaction.", royalty_payment.royalty_subject)
     if isinstance(participant, (str, LocalizedString)):
         display_name = LocalizationHelperTuning.get_raw_text(participant)
     else:
         display_name = LocalizationHelperTuning.get_object_name(participant)
     royalty_tracker.start_royalty(royalty_payment.royalty_type, royalty_payment.guid64, display_name, royalty_payment.payment_multipliers.get_multiplier(self.interaction.get_resolver()))
    def _run_interaction_gen(self, timeline):
        target_name_component = self.target.name_component

        def on_response(dialog):
            if not dialog.accepted:
                return
            name = dialog.text_input_responses.get(self.TEXT_INPUT_NEW_NAME)
            description = dialog.text_input_responses.get(self.TEXT_INPUT_NEW_DESCRIPTION)
            target = self.target
            if target is not None:
                if name is not None:
                    target.set_custom_name(name)
                if description is not None:
                    target.set_custom_description(description)
                self._update_ui_metadata(target)
            sequence = self._build_outcome_sequence()
            services.time_service().sim_timeline.schedule(element_utils.build_element(sequence))

        text_input_overrides = {}
        (template_name, template_description) = target_name_component.get_template_name_and_description()
        if target_name_component.allow_name:
            text_input_overrides[self.TEXT_INPUT_NEW_NAME] = None
            if self.target.has_custom_name():
                text_input_overrides[self.TEXT_INPUT_NEW_NAME] = lambda *_, **__: LocalizationHelperTuning.get_object_name(self.target)
            elif template_name is not None:
                text_input_overrides[self.TEXT_INPUT_NEW_NAME] = template_name
        if target_name_component.allow_description:
            text_input_overrides[self.TEXT_INPUT_NEW_DESCRIPTION] = None
            if self.target.has_custom_description():
                text_input_overrides[self.TEXT_INPUT_NEW_DESCRIPTION] = lambda *_, **__: LocalizationHelperTuning.get_object_description(self.target)
            elif template_description is not None:
                text_input_overrides[self.TEXT_INPUT_NEW_DESCRIPTION] = template_description
        dialog = self.rename_dialog(self.sim, self.get_resolver())
        dialog.show_dialog(on_response=on_response, text_input_overrides=text_input_overrides)
        return True
Esempio n. 30
0
 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()
Esempio n. 31
0
 def get_string(self, sim_info):
     degree_tracker = sim_info.degree_tracker
     if degree_tracker is None:
         logger.error(
             'Trying to perform UniversityDynamicSignView op on sim {} with no degree tracker.',
             sim_info)
         return
     uni = self.university
     manager = services.get_instance_manager(
         sims4.resources.Types.UNIVERSITY_MAJOR)
     degree_ids = degree_tracker.get_available_degrees_to_enroll()[
         uni.guid64]
     bullet_points = ()
     if self.info_type == UniversityInfoType.PRESTIGE_DEGREES:
         bullet_points = (manager.get(i).display_name
                          for i in degree_ids
                          if i in uni.prestige_degree_ids)
     elif self.info_type == UniversityInfoType.NON_PRESTIGE_DEGREES:
         bullet_points = (manager.get(i).display_name
                          for i in degree_ids
                          if i in uni.non_prestige_degree_ids)
     final_string = LocalizationHelperTuning.get_bulleted_list(
         None, *bullet_points)
     if final_string is None:
         final_string = self.fallback_string(sim_info)
     return final_string
 def _get_cost_string(cls, inst, entry):
     cost_string = entry.cost_string
     if cost_string is None:
         return
     if isinstance(cost_string, int):
         return LocalizationHelperTuning.get_for_money(cost_string)
     return cost_string()
Esempio n. 33
0
 def get_definition_notebook_data(self, ingredient_cache=[]):
     ingredients_used = {}
     recipe_definition = self.get_recipe_definition()
     if recipe_definition is None or self.final_product is None:
         return
     ingredient_display = []
     if recipe_definition.use_ingredients is not None:
         for tuned_ingredient_factory in recipe_definition.sorted_ingredient_requirements:
             ingredients_found_count = 0
             ingredients_needed_count = 0
             ingredient_requirement = tuned_ingredient_factory()
             ingredient_requirement.attempt_satisfy_ingredients(
                 ingredient_cache, ingredients_used)
             ingredients_found_count += ingredient_requirement.count_satisfied
             ingredients_needed_count += ingredient_requirement.count_required
             ingredient_display.append(
                 SubListData(None, ingredients_found_count,
                             ingredients_needed_count, True, False,
                             ingredient_requirement.get_diplay_name(), None,
                             None))
     return EntryData(
         LocalizationHelperTuning.get_object_name(self.final_product),
         IconInfoData(obj_def_id=self.final_product.id),
         self._get_entry_tooltip(self.final_product), ingredient_display,
         self.entry_sublist_is_sortable)
Esempio n. 34
0
 def add_aop(self,
             aop,
             user_pick_target=None,
             result_override=DEFAULT,
             do_test=True):
     result = ChoiceMenu.is_valid_aop(aop,
                                      self.context,
                                      self.make_pass,
                                      user_pick_target=user_pick_target,
                                      result_override=result_override,
                                      do_test=do_test)
     if aop.affordance.allow_user_directed is False:
         if _show_interaction_failure_reason:
             if result:
                 failure_result = TestResult(
                     False,
                     tooltip=lambda *_, **__:
                     LocalizationHelperTuning.get_name_value_pair(
                         'Failure', 'Not allowed user-directed'))
             else:
                 failure_result = result
             self._add_menu_item(aop, failure_result)
         return result
     if not result and not result.tooltip:
         return result
     self._add_menu_item(aop, result)
     return result
Esempio n. 35
0
 def _apply_to_subject_and_target(self, subject, target, resolver):
     knowledge = subject.relationship_tracker.get_knowledge(target.sim_id,
                                                            initialize=True)
     if knowledge is None:
         return
     trait_tracker = target.trait_tracker
     if self.traits.learned_type == self.TRAIT_SPECIFIED:
         traits = tuple(trait for trait in self.traits.potential_traits
                        if trait_tracker.has_trait(trait)
                        if trait not in knowledge.known_traits)
     elif self.traits.learned_type == self.TRAIT_ALL:
         traits = self._select_traits(knowledge, trait_tracker)
     elif self.traits.learned_type == self.TRAIT_RANDOM:
         traits = self._select_traits(knowledge,
                                      trait_tracker,
                                      random_count=self.traits.count)
         if not traits and self.notification_no_more_traits is not None:
             interaction = resolver.interaction
             if interaction is not None:
                 self.notification_no_more_traits(
                     interaction).show_notification(
                         additional_tokens=(subject, target),
                         recipients=(subject, ),
                         icon_override=IconInfoData(obj_instance=target))
     for trait in traits:
         knowledge.add_known_trait(trait)
     if traits:
         interaction = resolver.interaction
         if interaction is not None and self.notification is not None:
             trait_string = LocalizationHelperTuning.get_bulleted_list(
                 None, *(trait.display_name(target) for trait in traits))
             self.notification(interaction).show_notification(
                 additional_tokens=(subject, target, trait_string),
                 recipients=(subject, ),
                 icon_override=IconInfoData(obj_instance=target))
Esempio n. 36
0
 def set_custom_name(self, name):
     if self.allow_name:
         self.owner.custom_name = name if name else None
         self._call_name_changed_callback()
         if self.owner.update_object_tooltip() is None and isinstance(self.owner, ClientObjectMixin):
             _set_recipe_name(self.owner, LocalizationHelperTuning.get_raw_text(name))
         return True
     return False
Esempio n. 37
0
 def set_custom_description(self, description):
     if self.allow_description:
         self.owner.custom_description = description if description else None
         self._call_name_changed_callback()
         if self.owner.update_object_tooltip() is None and isinstance(self.owner, ClientObjectMixin):
             _set_recipe_decription(self.owner, LocalizationHelperTuning.get_raw_text(description))
         return True
     return False
Esempio n. 38
0
 def get_genre_localized_string(obj):
     genres = Genre.get_genres(obj)
     if not genres:
         return
     strings = tuple(Genre.TAG_TO_TUNING_MAP[genre].localized_name for genre in genres)
     comma_seperated_list = LocalizationHelperTuning.get_comma_separated_list(*strings)
     genre_text = Genre.GENRE_PREFIX_STRING_FACTORY(comma_seperated_list)
     return genre_text
 def get_state_strings(self):
     obj = self.owner
     int_token = 0
     for state_int_data in self.state_value_numbers:
         state_value = state_int_data.state_value
         while obj.has_state(state_value.state) and obj.get_state(state_value.state) is state_value:
             int_token = state_int_data.number
             break
     bullet_points = []
     for state_string_datas in self.state_value_strings:
         for state_string_data in state_string_datas:
             state_value = state_string_data.state_value
             while obj.has_state(state_value.state) and obj.get_state(state_value.state) is state_value:
                 bullet_point = state_string_data.text(int_token)
                 bullet_points.append(bullet_point)
                 break
     if bullet_points:
         if len(bullet_points) == 1:
             return LocalizationHelperTuning.get_raw_text(bullet_points[0])
         return LocalizationHelperTuning.get_bulleted_list(None, *bullet_points)
 def root_stock_name_list(self):
     if not self._fruit_spawners:
         return
     name_list = []
     for spawner in self._fruit_spawners:
         tree_fruit_name = spawner.main_spawner.cls._components.gardening_component._tuned_values.fruit_name
         while tree_fruit_name not in name_list:
             name_list.append(tree_fruit_name)
     for (index, name) in enumerate(name_list):
         name_list[index] = LocalizationHelperTuning.get_object_name(_SplicedFruitData(name))
     return name_list
Esempio n. 41
0
 def complete_milestone(self, aspiration, sim_info):
     aspiration_type = aspiration.aspiration_type()
     if aspiration_type == AspriationType.FULL_ASPIRATION:
         sim_info = self._owner_ref()
         if not (aspiration.is_child_aspiration and sim_info.is_child):
             return
         super().complete_milestone(aspiration, sim_info)
         if aspiration.reward is not None:
             aspiration.reward.give_reward(sim_info)
         track = self.active_track
         if track is None:
             logger.error('Active track is None when completing full aspiration.')
             return
         if aspiration in track.aspirations.values():
             if aspiration.screen_slam is not None:
                 aspiration.screen_slam.send_screen_slam_message(sim_info, sim_info, aspiration.display_name, track.display_text)
             if all(self.milestone_completed(track_aspiration.guid64) for track_aspiration in track.aspirations.values()):
                 if track.reward is not None:
                     reward_payout = track.reward.give_reward(sim_info)
                 else:
                     reward_payout = ()
                 reward_text = LocalizationHelperTuning.get_bulleted_list(None, *(reward.get_display_text() for reward in reward_payout))
                 dialog = track.notification(sim_info, SingleSimResolver(sim_info))
                 dialog.show_dialog(icon_override=(track.icon, None), secondary_icon_override=(None, sim_info), additional_tokens=(reward_text,), event_id=aspiration.guid64)
             next_aspiration = track.get_next_aspriation(aspiration)
             if next_aspiration is not None:
                 self._activate_aspiration(next_aspiration)
                 for objective in next_aspiration.objectives:
                     while objective.set_starting_point(self.data_object):
                         self.update_objective(objective.guid64, 0, objective.goal_value(), objective.is_goal_value_money)
             else:
                 self._active_aspiration = None
             with telemetry_helper.begin_hook(writer, TELEMETRY_HOOK_COMPLETE_MILESTONE, sim=sim_info.get_sim_instance()) as hook:
                 hook.write_enum('type', aspiration.aspiration_type())
                 hook.write_guid('guid', aspiration.guid64)
         services.get_event_manager().process_event(test_events.TestEvent.UnlockEvent, sim_info=sim_info, unlocked=aspiration)
     elif aspiration_type == AspriationType.FAMILIAL:
         super().complete_milestone(aspiration, sim_info)
         for relationship in aspiration.target_family_relationships:
             family_member_sim_id = sim_info.get_relation(relationship)
             family_member_sim_info = services.sim_info_manager().get(family_member_sim_id)
             while family_member_sim_info is not None:
                 services.get_event_manager().process_event(test_events.TestEvent.FamilyTrigger, sim_info=family_member_sim_info, trigger=aspiration)
     elif aspiration_type == AspriationType.WHIM_SET:
         self._whimsets_to_reset.add(aspiration.guid64)
         super().complete_milestone(aspiration, sim_info)
         self._owner_ref().whim_tracker.activate_set(aspiration)
     elif aspiration_type == AspriationType.NOTIFICATION:
         dialog = aspiration.notification(sim_info, SingleSimResolver(sim_info))
         dialog.show_dialog(event_id=aspiration.guid64)
         super().complete_milestone(aspiration, sim_info)
     else:
         super().complete_milestone(aspiration, sim_info)
 def _ui_metadata_gen(self):
     additional_information = self._get_additional_information()
     if additional_information and self.show_gardening_details():
         additional_information.sort()
         object_info_names = []
         object_info_descriptions = []
         bullet_points = []
         for (_, name, value) in additional_information:
             object_info_names.append(name)
             object_info_descriptions.append(value)
             bullet_point = LocalizationHelperTuning.get_name_value_pair(name, value)
             bullet_points.append(bullet_point)
         description = LocalizationHelperTuning.get_bulleted_list(None, *bullet_points)
         plant_name = LocalizationHelperTuning.get_object_name(self.owner.definition)
     else:
         object_info_names = None
         object_info_descriptions = None
         if GardeningTuning.is_spliced(self.owner):
             description = self._spliced_description
             plant_name = GardeningTuning.SPLICED_PLANT_NAME()
         else:
             if GardeningTuning.is_shoot(self.owner) and self.root_stock is not None:
                 description = LocalizationHelperTuning.get_object_name(self.root_stock.main_spawner)
             else:
                 description = LocalizationHelperTuning.get_object_description(self.owner.definition)
             plant_name = LocalizationHelperTuning.get_object_name(self.owner.definition)
     subtext = self.owner.get_state_strings()
     yield ('object_info_names', object_info_names)
     yield ('object_info_descriptions', object_info_descriptions)
     yield ('recipe_name', plant_name)
     yield ('recipe_description', description)
     if subtext is not None:
         yield ('subtext', subtext)
Esempio n. 43
0
 def add_aop(self, aop, user_pick_target=None, result_override=DEFAULT, do_test=True):
     result = ChoiceMenu.is_valid_aop(aop, self.context, self.make_pass, user_pick_target=user_pick_target, result_override=result_override, do_test=do_test)
     if aop.affordance.allow_user_directed is False:
         if _show_interaction_failure_reason:
             if result:
                 failure_result = TestResult(False, tooltip=lambda *_, **__: LocalizationHelperTuning.get_name_value_pair('Failure', 'Not allowed user-directed'))
             else:
                 failure_result = result
             self._add_menu_item(aop, failure_result)
         return result
     if not result and not result.tooltip:
         return result
     self._add_menu_item(aop, result)
     return result
 def populate_protocol_buffer(self, lot_row_data):
     super().populate_protocol_buffer(lot_row_data.base_data, name_override=LocalizationHelperTuning.get_raw_text(self.name))
     logger.assert_raise(self.zone_id is not None, 'No zone_id passed to lot picker row', owner='nbaker')
     lot_row_data.lot_info_item.zone_id = self.zone_id
     if self.name is not None:
         lot_row_data.lot_info_item.name = self.name
     if self.world_id is not None:
         lot_row_data.lot_info_item.world_id = self.world_id
     if self.lot_template_id is not None:
         lot_row_data.lot_info_item.lot_template_id = self.lot_template_id
     if self.lot_description_id is not None:
         lot_row_data.lot_info_item.lot_description_id = self.lot_description_id
     if self.venue_type_name is not None:
         lot_row_data.lot_info_item.venue_type_name = self.venue_type_name
     if self.household_name is not None:
         lot_row_data.lot_info_item.household_name = self.household_name
Esempio n. 45
0
 def _get_performance_tooltip(self):
     loc_strings = []
     metrics = self.current_level_tuning.performance_metrics
     if metrics.performance_tooltip is not None:
         loc_strings.append(metrics.performance_tooltip)
     for metric in metrics.statistic_metrics:
         text = metric.tooltip_text
         while text is not None:
             if text.general_description:
                 lower_threshold = None
                 stat = self._sim_info.get_statistic(metric.statistic)
                 if stat is not None:
                     (lower_threshold, _) = self._get_statistic_progress_thresholds(stat.stat_type, stat.get_value())
                 if lower_threshold:
                     description = text.general_description(lower_threshold.text)
                 else:
                     description = text.general_description()
                 loc_strings.append(description)
     if loc_strings:
         return LocalizationHelperTuning.get_new_line_separated_strings(*loc_strings)
Esempio n. 46
0
 def _handle_promotion(self):
     self._pending_promotion = True
     previous_level_tuning = self.current_level_tuning
     previous_salary = self.get_hourly_pay()
     previous_highest_level = self._sim_info.career_tracker.get_highest_level_reached(self.guid64)
     try:
         yield None
     finally:
         if self.current_level_tuning is not previous_level_tuning:
             self._pending_promotion = False
             if self.user_level > previous_highest_level and self.current_level_tuning.promotion_reward is not None:
                 reward_payout = self.current_level_tuning.promotion_reward.give_reward(self._sim_info)
                 reward_text = LocalizationHelperTuning.get_bulleted_list(None, *(reward.get_display_text() for reward in reward_payout))
             else:
                 reward_text = None
             (_, next_work_time, _) = self.get_next_work_time()
             salary = self.get_hourly_pay()
             salary_increase = salary - previous_salary
             level_text = self.current_level_tuning.promotion_notification_text(self._sim_info)
             is_not_school = not self.get_is_school()
             if reward_text is None:
                 self.send_career_message(self.career_messages.promote_career_rewardless_notification, next_work_time, salary, salary_increase, level_text, display_career_info=is_not_school)
             else:
                 self.send_career_message(self.career_messages.promote_career_notification, next_work_time, salary, salary_increase, level_text, reward_text, display_career_info=is_not_school)
             promotion_sting = self.current_level_tuning.promotion_audio_sting
             if promotion_sting is not None:
                 play_tunable_audio(promotion_sting)
             if self.current_level_tuning.screen_slam is not None:
                 self.current_level_tuning.screen_slam.send_screen_slam_message(self._sim_info, self._sim_info, self.current_level_tuning.title(self._sim_info), self.user_level, self.current_track_tuning.career_name(self._sim_info))
             if self.has_outfit():
                 self._sim_info.refresh_current_outfit()
             else:
                 new_outfit = self._sim_info._outfits.get_outfit_for_clothing_change(None, OutfitChangeReason.DefaultOutfit, resolver=SingleSimResolver(self._sim_info))
                 self._sim_info.set_current_outfit(new_outfit)
             with telemetry_helper.begin_hook(career_telemetry_writer, TELEMETRY_HOOK_CAREER_PROMOTION, sim=self._sim_info) as hook:
                 hook.write_int(TELEMETRY_CAREER_ID, self.guid64)
                 hook.write_int(TELEMETRY_CAREER_LEVEL, self._user_level)
                 hook.write_guid(TELEMETRY_TRACK_ID, self._current_track.guid64)
                 hook.write_int(TELEMETRY_TRACK_LEVEL, self._level)
Esempio n. 47
0
 def is_valid_aop(aop, context, make_pass, user_pick_target=None, result_override=DEFAULT, do_test=True):
     test_result = None
     result = TestResult.TRUE
     if result_override is not DEFAULT:
         result = result_override
     else:
         if not make_pass:
             if user_pick_target is not None and user_pick_target.check_affordance_for_suppression(context.sim, aop, user_directed=True):
                 result = TestResult(False, '{} failed, aop is being suppressed.', aop)
             else:
                 result = aop.test(context)
                 test_result = str(result)
         else:
             result = aop.can_make_test_pass(context)
         if not result:
             logger.info('Test Failure: {}: {}', aop, result.reason)
         if not result:
             if _show_interaction_failure_reason:
                 result = TestResult(result.result, tooltip=lambda *_, reason=result.reason, **__: LocalizationHelperTuning.get_name_value_pair('Failure', reason))
             elif not result.tooltip:
                 result = TestResult(False, '{} failed and has no tooltip', aop)
         if do_test and make_pass and aop.test(context):
             result = TestResult(False, '{} already passes', aop)
     if gsi_handlers.sim_handlers_log.pie_menu_generation_archiver.enabled:
         gsi_handlers.sim_handlers_log.log_aop_result(context.sim, aop, result, test_result)
     return result
Esempio n. 48
0
 def _get_display_text(self):
     return LocalizationHelperTuning.get_money(self._money)
Esempio n. 49
0
 def _get_display_text(self):
     return LocalizationHelperTuning.get_object_name(self._definition)
 def factory(candidate_ingredients, ingredient_ref):
     for ingredient in candidate_ingredients:
         while ingredient.id == ingredient_ref.id:
             return ([ingredient], None, LocalizationHelperTuning.get_object_name(ingredient_ref))
     return ([], None, LocalizationHelperTuning.get_object_name(ingredient_ref))
Esempio n. 51
0
def ui_dialog_notification_test(*all_text, _connection=None):
    client = services.client_manager().get(_connection)
    all_text_str = ' '.join(all_text)
    if '/' in all_text:
        (title, text) = all_text_str.split('/')
        notification = UiDialogNotification.TunableFactory().default(client.active_sim, text=lambda **_: LocalizationHelperTuning.get_raw_text(text), title=lambda **_: LocalizationHelperTuning.get_raw_text(title))
    else:
        notification = UiDialogNotification.TunableFactory().default(client.active_sim, text=lambda **_: LocalizationHelperTuning.get_raw_text(all_text_str))
    notification.show_dialog(icon_override=(None, client.active_sim))