class ZoneModifierDisplayInfo(HasTunableReference,
                              metaclass=HashedTunedInstanceMetaclass,
                              manager=services.get_instance_manager(
                                  Types.USER_INTERFACE_INFO)):
    base_game_only = True
    INSTANCE_TUNABLES = {
        'zone_modifier_icon':
        TunableIcon(
            description="\n            The zone modifier's icon.\n            ",
            export_modes=ExportModes.All,
            tuning_group=GroupNames.UI),
        'zone_modifier_name':
        TunableLocalizedString(
            description="\n            The zone modifier's name.\n            ",
            export_modes=ExportModes.All,
            tuning_group=GroupNames.UI),
        'zone_modifier_description':
        TunableLocalizedString(
            description=
            "\n            The zone modifier's description.\n            ",
            export_modes=ExportModes.All,
            tuning_group=GroupNames.UI),
        'zone_modifier_reference':
        TunablePackSafeReference(
            description=
            '\n            The zone modifier gameplay tuning reference ID.\n            \n            This ID will be what is persisted in save data and used\n            for any lookups.\n            ',
            manager=services.zone_modifier_manager(),
            export_modes=ExportModes.All,
            tuning_group=GroupNames.UI)
    }
Пример #2
0
 def __init__(self, **kwargs):
     super().__init__(
         cancelable=Tunable(
             description=
             '\n                If this tutorial tip can be canceled.\n                ',
             tunable_type=bool,
             default=True),
         text=TunableLocalizedStringFactory(
             description=
             "\n                The text for this tip.\n                Token {0} is the active sim. i.e. {0.SimFirstName}\n                Token {1.String} is a 'wildcard' string to be used for things\n                like aspiration names or buff names during the tutorial.\n                Not used when display type is INDICATOR_ARROW.\n                ",
             allow_none=True),
         action_text=TunableLocalizedStringFactory(
             description=
             "\n                The action the user must make for this tip to satisfy.\n                Token {0} is the active sim. i.e. {0.SimFirstName}\n                Token {1.String} is a 'wildcard' string to be used for things\n                like aspiration names or buff names during the tutorial.\n                ",
             allow_none=True),
         timeout=TunableRange(
             description=
             '\n                How long, in seconds, until this tutorial tip times out.\n                ',
             tunable_type=int,
             default=1,
             minimum=1),
         ui_element=TunableEnumEntry(
             description=
             '\n                The UI element associated with this tutorial tip.\n                ',
             tunable_type=TutorialTipUiElement,
             default=TutorialTipUiElement.UI_INVALID),
         is_modal=Tunable(
             description=
             '\n                Enable if this tip should be modal.\n                Disable, if not.\n                ',
             tunable_type=bool,
             default=False),
         icon=TunableResourceKey(
             description=
             '\n                The icon to be displayed in a modal tutorial tip.\n                If Is Modal is disabled, this field can be ignored.\n                ',
             resource_types=sims4.resources.CompoundTypes.IMAGE,
             default=None,
             allow_none=True),
         icon_console=TunableResourceKey(
             description=
             '\n                The icon to be displayed in a modal tutorial tip on console.\n                If unset, will fall back to Icon.\n                If Is Modal is disabled, this field can be ignored.\n                ',
             resource_types=sims4.resources.CompoundTypes.IMAGE,
             default=None,
             allow_none=True,
             display_name='Icon (Console)',
             export_modes=ExportModes.ClientBinary),
         title=TunableLocalizedString(
             description=
             '\n                The title of this tutorial tip.\n                Not used when display type is INDICATOR_ARROW.\n                ',
             allow_none=True),
         pagination_label=TunableLocalizedString(
             description=
             '\n                The label of what page this tutorial tip is in within the\n                tutorial tip group.\n                Not used when display type is INDICATOR_ARROW.\n                ',
             allow_none=True),
         display_type_option=TunableEnumEntry(
             description=
             '\n                The display type of this tutorial tip.\n                ',
             tunable_type=TutorialTipDisplayOption,
             default=TutorialTipDisplayOption.STANDARD),
         **kwargs)
class LifestyleBrandProductsPicker(PickerSuperInteraction):
    INSTANCE_TUNABLES = {
        'products':
        TunableList(
            description=
            '\n            A list of the type of products that a lifestyle brand can be selling.\n            ',
            tunable=TunableTuple(
                description=
                '\n                A product is represented by a type, name, description, and icon.\n                ',
                product_type=TunableEnumEntry(
                    description=
                    '\n                    The enum entry that identifies what type of product this is.\n                    This will be used with the target market to determine the\n                    payout curve of the lifestyle brand.\n                    ',
                    tunable_type=LifestyleBrandProduct,
                    default=LifestyleBrandProduct.INVALID,
                    invalid_enums=(LifestyleBrandProduct.INVALID, )),
                name=TunableLocalizedString(
                    description=
                    '\n                    The name that is displayed in the picker for the products.\n                    '
                ),
                description_text=TunableLocalizedString(
                    description=
                    '\n                    The description for the product that is displayed in the picker.\n                    '
                ),
                icon=TunableIconFactory()),
            unique_entries=True,
            tuning_group=GroupNames.PICKERTUNING)
    }

    def _run_interaction_gen(self, timeline):
        self._show_picker_dialog(self.sim, target_sim=self.sim)
        return True
        yield

    @flexmethod
    def picker_rows_gen(cls, inst, target, context, **kwargs):
        inst_or_cls = inst if inst is not None else cls
        selected_product = None
        tracker = inst_or_cls.sim.sim_info.lifestyle_brand_tracker
        selected_product = tracker.product_choice
        for product in inst_or_cls.products:
            name = product.name
            description = product.description_text
            yield ObjectPickerRow(
                name=name,
                row_description=description,
                icon_info=IconInfoData(icon_resource=product.icon.key),
                tag=product.product_type,
                is_selected=selected_product == product.product_type)

    def on_choice_selected(self, choice_tag, **kwargs):
        sim = self.sim
        tracker = sim.sim_info.lifestyle_brand_tracker
        if tracker is None:
            return
        tracker.product_choice = choice_tag
Пример #4
0
class SpellbookTuning:
    FRONT_PAGE_DATA = TunableTuple(description='\n        UI-specific data used to display front page.\n        ', title=TunableLocalizedStringFactory(description='\n            The title to use on the front page of the spellbook.\n            '), icon=OptionalTunable(description='\n            Image displayed on front page of spellbook.\n            If unset, image is not shown.\n            ', tunable=TunableIconAllPacks()), page_description=OptionalTunable(description='\n            Description used for this page in the spellbook.\n            If unset, description is not shown.\n            ', tunable=TunableLocalizedString()))
    CATEGORY_LIST_DATA = TunableTuple(description='\n        UI-specific data used to display second page of the spellbook.\n        ', title=TunableLocalizedStringFactory(description='\n            The title to use on the category list of the spellbook.\n            '), icon=OptionalTunable(description='\n            Icon used on the category list page of the spellbook.\n            ', tunable=TunableIconAllPacks()), page_description=OptionalTunable(description='\n            Description used for this page in the spellbook.\n            If unset, description is not shown.\n            ', tunable=TunableLocalizedString()))
    CATEGORY_DATAS = TunableList(description='\n        A list of a spellbook category data.\n        ', tunable=SpellbookCategoryData.TunableFactory(), tuning_group=GroupNames.UI)
    POTION_DISPLAY_DATA = TunableMapping(description="\n        A mapping of a potion's recipe to it's spellbook display data. \n        ", key_type=TunableReference(description="\n            The potion's recipe.\n            ", manager=services.get_instance_manager(Types.RECIPE), class_restrictions=('Recipe',), pack_safe=True), value_type=SpellbookRecipeData.TunableFactory(), tuning_group=GroupNames.UI)
    INGREDIENTS_LABEL = TunableLocalizedString(description='\n        Text used to display ingredients label for a spell or potion.\n        \n        e.g. "Ingredients:"\n        ', tuning_group=GroupNames.UI)
    PROGRESS_LABEL = TunableLocalizedString(description='\n        Text used to display field name for progress into a specific\n        category.\n        \n        e.g. "Learned:"\n        ', tuning_group=GroupNames.UI)
    PROGRESS_TEXT_FORMAT = TunableLocalizedStringFactory(description='\n        Text used to display the progress towards completing a specific\n        category.  Takes current items learned and and total available.\n\n        e.g. "{0.Number}/{1.Number}"\n        ', tuning_group=GroupNames.UI)
    CATEGORY_FRONT_PAGE_ENTRY_COUNT = TunableRange(description=',\n        Number of entries allotted for the front page of a category section.\n        ', tunable_type=int, minimum=0, tuning_group=GroupNames.UI, default=2)
    CATEGORY_ENTRY_COUNT = TunableRange(description=',\n        Number of entries allotted for the subsequent pages of a category section.\n        ', tunable_type=int, minimum=1, tuning_group=GroupNames.UI, default=4)
    INGREDIENT_FORMAT = TunableLocalizedStringFactory(description='\n        The format used for ingredients in the spellbook.\n        First parameter will be name of ingredient, second will be quantity required.\n        e.g. {0.String}({1.Number}) = "Frog(1)"\n        ', tuning_group=GroupNames.UI)
Пример #5
0
class SituationMeterData(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {
        '_meter_id':
        Tunable(
            description=
            '\n            Meter ID used by UI to differentiate meters from each other\n            (when multiple meters exist in a situation).\n            \n            This will typically be assigned by a GPE in code as opposed to tuned.\n            ',
            tunable_type=bool,
            default=True),
        '_threshold_data':
        TunableList(
            description=
            '\n            List of thresholds for this meter.\n            ',
            tunable=TunableTuple(
                color=TunableColorSnippet(
                    description=
                    '\n                    Color of meter at this specified threshold.\n                    \n                    Note: alpha value is not used.\n                    '
                ),
                threshold_value=Tunable(
                    description=
                    '\n                    Value at or above which this threshold exists. \n                    ',
                    tunable_type=int,
                    default=0))),
        '_display_text':
        OptionalTunable(
            description=
            '\n            Optional meter display text.\n            ',
            tunable=TunableLocalizedString()),
        '_tooltip':
        OptionalTunable(
            description='\n            Optional tooltip text.\n            ',
            tunable=TunableLocalizedString())
    }

    def build_data_message(self, msg):
        msg.meter_id = self._meter_id
        display_text = self._display_text
        if display_text is not None:
            msg.meter_text = display_text
        tooltip = self._tooltip
        if tooltip is not None:
            msg.meter_tooltip = tooltip
        self._build_meter_threshold_data(msg.thresholds)

    def _build_meter_threshold_data(self, msg):
        for threshold in self._threshold_data:
            with ProtocolBufferRollback(msg) as threshold_msg:
                threshold_msg.color = threshold.color
                threshold_msg.threshold = threshold.threshold_value

    def create_meter(self, situation):
        return SituationMeter(situation, self._meter_id)
Пример #6
0
class Reward(HasTunableReference, metaclass=HashedTunedInstanceMetaclass, manager=services.get_instance_manager(sims4.resources.Types.REWARD)):
    __qualname__ = 'Reward'
    INSTANCE_SUBCLASSES_ONLY = True
    INSTANCE_TUNABLES = {'name': TunableLocalizedString(description='\n            The display name for this reward.\n            ', export_modes=ExportModes.All), 'reward_description': TunableLocalizedString(description='\n            Description for this reward.\n            ', export_modes=ExportModes.All), 'icon': TunableResourceKey(description='\n            The icon image for this reward.\n            ', default='PNG:missing_image', resource_types=sims4.resources.CompoundTypes.IMAGE, export_modes=ExportModes.All), 'tests': TunableTestSet(description='\n            A series of tests that must pass in order for reward to be available.\n            '), 'rewards': TunableList(TunableVariant(description='\n                The gifts that will be given for this reward. They can be either\n                a specific reward or a random reward, in the form of a list of\n                specific rewards.\n                ', specific_reward=TunableSpecificReward(), random_reward=TunableList(TunableRandomReward()))), 'notification': OptionalTunable(description='\n            If enabled, this notification will show when the sim/household receives this reward.\n            ', tunable=TunableUiDialogNotificationSnippet())}

    @classmethod
    def give_reward(cls, sim_info):
        raise NotImplementedError

    @classmethod
    def try_show_notification(cls, sim_info):
        if cls.notification is not None:
            dialog = cls.notification(sim_info, SingleSimResolver(sim_info))
            dialog.show_dialog()

    @classmethod
    def is_valid(cls, sim_info):
        if not cls.tests.run_tests(SingleSimResolver(sim_info)):
            return False
        for reward in cls.rewards:
            if not isinstance(reward, tuple):
                return reward.valid_reward(sim_info)
            for each_reward in reward:
                while not each_reward.reward.valid_reward(sim_info):
                    return False
            return True
Пример #7
0
class ItemCost(ItemCostBase, AutoFactoryInit, HasTunableSingletonFactory):
    UNAVAILABLE_TOOLTIP_HEADER = TunableLocalizedStringFactory(
        description=
        '\n        A string to be used as a header for a bulleted list of items that the\n        Sim is missing in order to run this interaction.\n        '
    )
    AVAILABLE_TOOLTIP_HEADER = TunableLocalizedStringFactory(
        description=
        '\n        A string to be used as a header for a bulleted list of items that the\n        Sim will consume in order to run this interaction.\n        '
    )
    FACTORY_TUNABLES = {
        'ingredients':
        TunableList(
            description=
            '\n            List of tuples of Objects and Quantity, which will indicate\n            the cost of items for this interaction to run\n            ',
            tunable=TunableTuple(
                description=
                '\n                Pair of Object and Quantity needed for this interaction\n                ',
                ingredient=TunableReference(
                    description=
                    '\n                    Object reference of the type of game object needed.\n                    ',
                    manager=services.definition_manager()),
                quantity=TunableRange(
                    description=
                    '\n                    Quantity of objects needed\n                    ',
                    tunable_type=int,
                    default=1,
                    minimum=1),
                missing_ingredient_additional_text=OptionalTunable(
                    description=
                    '\n                    If set, this text is inserted on a new line following a missing ingredient.\n                    ',
                    tunable=TunableLocalizedString(
                        default=None,
                        description='The string key of the text description'
                    ))))
    }
 def __init__(self, **kwargs):
     super().__init__(
         gender=TunableEnumEntry(
             description=
             "\n                The Sim's gender.\n                ",
             tunable_type=sim_info_types.Gender,
             needs_tuning=True,
             default=None),
         age_variant=TunableVariant(
             description=
             "\n                The sim's age for creation. Can be a literal age or random\n                between two ages.\n                ",
             literal=LiteralAge.TunableFactory(),
             random=RandomAge.TunableFactory(),
             needs_tuning=True),
         resource_key=OptionalTunable(
             description=
             '\n                If enabled, the Sim will be created using a saved SimInfo file.\n                ',
             tunable=TunableResourceKey(
                 description=
                 '\n                    The SimInfo file to use.\n                    ',
                 default=None,
                 resource_types=(sims4.resources.Types.SIMINFO, ))),
         full_name=OptionalTunable(
             description=
             "\n                If specified, then the Sim's name will be determined by this\n                localized string. Their first, last and full name will all be\n                set to this.\n                ",
             tunable=TunableLocalizedString()),
         tunable_tag_set=TunableReference(
             description=
             '\n                The set of tags that this template uses for CAS creation.\n                ',
             manager=services.get_instance_manager(
                 sims4.resources.Types.TAG_SET)),
         **kwargs)
Пример #9
0
 def __init__(self, **kwargs):
     super().__init__(
         description='The text for this slide.',
         text=TunableLocalizedString(),
         image=TunableResourceKey(
             description=
             '\n                             The image for this slide.\n                             ',
             default=None,
             resource_types=sims4.resources.CompoundTypes.IMAGE),
         platform_filter=TunableEnumEntry(
             description=
             '\n                            The platforms on which this slide is shown.\n                            ',
             tunable_type=TutorialPlatformFilter,
             default=TutorialPlatformFilter.ALL_PLATFORMS,
             export_modes=ExportModes.ClientBinary),
         image_console=TunableResourceKey(
             description=
             '\n                             The image for this slide on console.  If unset the Image will be used as a fallback.\n                             ',
             default=None,
             allow_none=True,
             resource_types=sims4.resources.CompoundTypes.IMAGE,
             display_name='Image (Console)',
             export_modes=ExportModes.ClientBinary),
         image_console_jp=TunableResourceKey(
             description=
             '\n                             The image for this slide on console for the JP SKU.  Fallback order is: Image (Console), Image.\n                             ',
             default=None,
             allow_none=True,
             resource_types=sims4.resources.CompoundTypes.IMAGE,
             display_name='Image (Console; JP)',
             export_modes=ExportModes.ClientBinary),
         **kwargs)
class CommonUiObjectCategoryPicker(UiObjectPicker):
    """An ObjectPicker with categories listed in a drop down.

    """
    FACTORY_TUNABLES = {
        'object_categories':
        TunableList(
            description=
            '\n            The categories to display in the drop down for this picker.\n            ',
            tunable=TunableTuple(object_category=Tunable(tunable_type=str,
                                                         default='ALL'),
                                 icon=TunableIconFactory(),
                                 category_name=TunableLocalizedString()))
    }

    def _build_customize_picker(self, picker_data) -> None:
        for category in self.object_categories:
            with ProtocolBufferRollback(
                    picker_data.filter_data) as category_data:
                category_data.tag_type = abs(hash(
                    category.object_category)) % (10**8)
                build_icon_info_msg(category.icon(None), None,
                                    category_data.icon_info)
                category_data.description = category.category_name
        super()._build_customize_picker(picker_data)
class RelationshipBitCollection(metaclass=HashedTunedInstanceMetaclass,
                                manager=services.relationship_bit_manager()):
    __qualname__ = 'RelationshipBitCollection'
    INSTANCE_TUNABLES = {
        'name':
        TunableLocalizedString(
            export_modes=ExportModes.All,
            description='Name to be displayed for the collection.'),
        'icon':
        TunableResourceKey(
            'PNG:missing_image',
            resource_types=CompoundTypes.IMAGE,
            export_modes=ExportModes.All,
            description='Icon to be displayed for the collection.'),
        'collection_id':
        TunableEnumEntry(RelationshipBitCollectionUid,
                         RelationshipBitCollectionUid.Invalid,
                         export_modes=ExportModes.All,
                         description='The unique id of the relationship bit')
    }
    is_rel_bit = False

    @classmethod
    def _verify_tuning_callback(cls):
        validate_locked_enum_id(RelationshipBitCollection, cls.collection_id,
                                cls, RelationshipBitCollectionUid.Invalid)

    @classmethod
    def matches_bit(cls, bit_type):
        return cls.collection_id in bit_type.collection_ids
Пример #12
0
class Tutorial(metaclass=HashedTunedInstanceMetaclass,
               manager=services.get_instance_manager(
                   sims4.resources.Types.TUTORIAL)):
    INSTANCE_TUNABLES = {
        'name':
        TunableLocalizedString(
            description=
            '\n            Name of the tutorial. i.e. if this is a tutorial about Build/Buy\n            you might put "Build Buy Mode"\n            ',
            export_modes=ExportModes.ClientBinary),
        'category':
        TunableReference(
            description=
            '\n            The tutorial category in which this tutorial belongs.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.TUTORIAL),
            class_restrictions=TutorialCategory,
            export_modes=ExportModes.ClientBinary),
        'slides':
        TunableList(
            description=
            '\n            These are the slides (images with a description) that create the\n            story for this tutorial. They will be shown in the order they are\n            provided, so the first slide in this list will be the first slide\n            of the tutorial.\n            ',
            tunable=TunableTutorialSlideTuple(),
            export_modes=ExportModes.ClientBinary),
        'ui_sort_order':
        Tunable(
            description=
            '\n            Order in which this tutorial is sorted against other tutorials in \n            its category in the UI. If two tutorials in a category share the \n            same sort order, undefined behavior will occur.\n            ',
            tunable_type=int,
            default=0,
            export_modes=ExportModes.ClientBinary)
    }
Пример #13
0
class CurrencyBuck(DisplaySnippet):
    INSTANCE_TUNABLES = {
        'buck_type':
        TunableEnumEntry(
            description=
            '\n            The buck type for this currency.\n            ',
            tunable_type=BucksType,
            default=BucksType.INVALID,
            export_modes=ExportModes.ClientBinary,
            binary_type=EnumBinaryExportType.EnumUint32),
        'value_string':
        TunableLocalizedString(
            description=
            '\n            A string like "{0.Money}" that will be used in UI to display a\n            value of this currency.\n            ',
            export_modes=ExportModes.All,
            tuning_group=GroupNames.UI),
        'gain_string':
        TunableLocalizedString(
            description=
            '\n            A string like "++{0.Money}" that will be used in UI to display an\n            increase in this currency.\n            ',
            export_modes=ExportModes.All,
            tuning_group=GroupNames.UI),
        'lose_string':
        TunableLocalizedString(
            description=
            '\n            A string like "--{0.Money}" that will be used in UI to display a\n            decrease in this currency.\n            ',
            export_modes=ExportModes.All,
            tuning_group=GroupNames.UI),
        'flyaway_gain_audio':
        Tunable(
            description=
            '\n            Audio to use for the flyaway for this currency if currency is \n            gained.\n            ',
            tunable_type=str,
            default='',
            allow_empty=True,
            tuning_group=GroupNames.UI,
            export_modes=ExportModes.ClientBinary),
        'flyaway_loss_audio':
        Tunable(
            description=
            '\n            Audio to use for the flyaway for this currency if currency is \n            lost.\n            ',
            tunable_type=str,
            default='',
            allow_empty=True,
            tuning_group=GroupNames.UI,
            export_modes=ExportModes.ClientBinary)
    }
Пример #14
0
class SituationCategory:
    CATEGORIES = TunableMapping(
        description='\n\t\tMapping from Uid to Name\n        ',
        key_type=TunableEnumEntry(
            description='\n            The Situation Category.\n            ',
            tunable_type=SituationCategoryUid,
            default=SituationCategoryUid.DEFAULT),
        value_type=TunableLocalizedString(
            description='\n            The Category Name\n            '))
Пример #15
0
class TrendTuning:
    TREND_DATA = TunableList(
        description='\n        A list of data about trends.\n        ',
        tunable=TunableTuple(
            description=
            '\n            The data about this trend.\n            ',
            trend_tag=TunableTag(
                description=
                '\n                The tag for this trend.\n                ',
                filter_prefixes=('func_trend', )),
            trend_type=TunableEnumEntry(
                description=
                '\n                The type of this trend.\n                ',
                tunable_type=TrendType,
                default=TrendType.INVALID,
                invalid_enums=(TrendType.INVALID, )),
            trend_name=TunableLocalizedString(
                description=
                '\n                The name for this trend. This will show up in a bulleted\n                list when a player researches current trends.\n                '
            )))
    TREND_REFRESH_COOLDOWN = TunableTimeSpan(
        description=
        '\n        The amount of time it takes before trends refresh.\n        ',
        default_days=2)
    TREND_TIME_REMAINING_DESCRIPTION = TunableMapping(
        description=
        '\n        A mapping of thresholds, in Sim Hours, to descriptions used when\n        describing the amount of time remaining in the study trends\n        notification.\n        ',
        key_name='sim_hours',
        key_type=int,
        value_name='description_string',
        value_type=TunableLocalizedString())
    TODDLER_CHILD_TREND = TunableTag(
        description=
        '\n        The tag we use to indicate Toddler or Child trends.\n        ',
        filter_prefixes=('func_trend', ))
    CELEBRITY_TREND = TunableTag(
        description=
        '\n        The tag we use to indicate Celebrity Trends.\n        ',
        filter_prefixes=('func_trend', ))
    TRENDLESS_VIDEO_DEFINITION = TunableReference(
        description=
        '\n        The object definition to use if a Sim records a trendless video.\n        ',
        manager=services.definition_manager(),
        pack_safe=True)
Пример #16
0
class TutorialCategory(metaclass=HashedTunedInstanceMetaclass,
                       manager=services.get_instance_manager(
                           sims4.resources.Types.TUTORIAL)):
    INSTANCE_TUNABLES = {
        'name':
        TunableLocalizedString(
            description=
            '\n            Name of the tutorial category.\n            ',
            export_modes=ExportModes.All)
    }
Пример #17
0
class SituationCategory:
    __qualname__ = 'SituationCategory'
    CATEGORIES = TunableMapping(
        key_type=TunableEnumEntry(SituationCategoryUid,
                                  export_modes=ExportModes.All,
                                  default=SituationCategoryUid.DEFAULT,
                                  description='The Situation Category.'),
        value_type=TunableLocalizedString(description='The Category Name'),
        export_modes=ExportModes.All,
        description='Mapping from Uid to Name')
Пример #18
0
 def __init__(self, *args, **kwargs):
     super().__init__(
         color=TunableColor.TunableColorRGBA(
             description=
             '\n                Tunable RGBA values used to set the color of a light. Tuning the\n                A value will not do anything as it is not used.\n                '
         ),
         name=TunableLocalizedString(
             description=
             ' \n                The name of the color that appears when you mouse over it.\n                '
         ))
Пример #19
0
class CSFCustomSliderInfo(HasTunableFactory, AutoFactoryInit):
    """ Holds information related to a Custom Slider. """
    FACTORY_TUNABLES = {
        'slider_display_name':
        TunableLocalizedString(default=None),
        'slider_raw_display_name':
        Tunable(tunable_type=str, default=None),
        'slider_description':
        TunableLocalizedString(default=None),
        'slider_author':
        Tunable(tunable_type=str, default=None),
        'slider_icon_id':
        Tunable(tunable_type=int, default=0),
        'slider_minimum_value':
        Tunable(tunable_type=float, default=-100.0),
        'slider_maximum_value':
        Tunable(tunable_type=float, default=100.0),
        'slider_positive_modifier_id':
        Tunable(tunable_type=int, default=0),
        'slider_negative_modifier_id':
        Tunable(tunable_type=int, default=0),
        'available_for_genders':
        TunableEnumSet(enum_type=CommonGender,
                       default_enum_list=frozenset(
                           (CommonGender.MALE, CommonGender.FEMALE))),
        'available_for_ages':
        TunableEnumSet(enum_type=Age,
                       default_enum_list=frozenset(
                           (Age.BABY, Age.TODDLER, Age.CHILD, Age.TEEN,
                            Age.YOUNGADULT, Age.ADULT, Age.ELDER))),
        'available_for_species':
        TunableEnumSet(enum_type=CommonSpecies,
                       default_enum_list=frozenset(
                           (CommonSpecies.HUMAN, CommonSpecies.SMALL_DOG,
                            CommonSpecies.LARGE_DOG, CommonSpecies.CAT))),
        'slider_categories':
        TunableEnumSet(enum_type=CSFSliderCategory,
                       default_enum_list=frozenset(
                           (CSFSliderCategory.OTHER, ))),
        'tags':
        TunableSet(tunable=Tunable(tunable_type=str, default=''),
                   tuning_group=GroupNames.TAG),
    }
Пример #20
0
 def __init__(self, **kwargs):
     super().__init__(
         name=TunableLocalizedString(
             export_modes=ExportModes.All,
             description='Localization String for the kind of memory.'),
         reminisce_affordance=TunableReference(
             manager=services.get_instance_manager(
                 sims4.resources.Types.INTERACTION),
             class_restrictions='SuperInteraction',
             description=
             'The interaction that is pushed on the Sim when they Reminisce about this Memory. Should most often be from the Reminisce Prototype.'
         ),
         **kwargs)
Пример #21
0
class OCOutfitPartData(HasTunableFactory, AutoFactoryInit):
    """ Holds information related to an outfit part. """
    FACTORY_TUNABLES = {
        'part_display_name': TunableLocalizedString(default=None),
        'part_raw_display_name': Tunable(tunable_type=str, default=None),
        'part_author': Tunable(tunable_type=str, default=None),
        'part_icon_id': Tunable(tunable_type=int, default=0),
        'part_id': Tunable(tunable_type=int, default=-1),
        'available_for_genders': TunableEnumSet(enum_type=Gender),
        'available_for_ages': TunableEnumSet(enum_type=Age),
        'available_for_species': TunableEnumSet(enum_type=CommonSpecies),
        'part_tags': TunableSet(tunable=Tunable(tunable_type=str, default=None), tuning_group=GroupNames.TAG),
    }
Пример #22
0
 def __init__(self, reload_dependent=False, **kwargs):
     super().__init__(
         buff_type=TunableReference(
             manager=services.buff_manager(),
             description='Buff that will get added to sim.',
             reload_dependent=reload_dependent),
         buff_reason=OptionalTunable(
             description=
             '\n                            If set, specify a reason why the buff was added.\n                            ',
             tunable=TunableLocalizedString(
                 description=
                 '\n                                The reason the buff was added. This will be displayed in the\n                                buff tooltip.\n                                '
             )),
         **kwargs)
Пример #23
0
class UiPurchasePicker(UiDialogObjectPicker):
    __qualname__ = 'UiPurchasePicker'
    FACTORY_TUNABLES = {
        'categories':
        TunableList(
            description=
            '\n            A list of categories that will be displayed in the picker.\n            ',
            tunable=TunableTuple(
                description=
                '\n                Tuning for a single category in the picker.\n                ',
                tag=TunableEnumEntry(
                    description=
                    '\n                    A single tag used for filtering items.  If an item\n                    in the picker has this tag then it will be displayed\n                    in this category.\n                    ',
                    tunable_type=tag.Tag,
                    default=tag.Tag.INVALID),
                icon=TunableResourceKey(
                    description=
                    '\n                    Icon that represents this category.\n                    ',
                    default=None,
                    resource_types=sims4.resources.CompoundTypes.IMAGE),
                tooltip=TunableLocalizedString(
                    description=
                    '\n                    A localized string for the tooltip of the category.\n                    '
                )))
    }

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.picker_type = ObjectPickerType.PURCHASE
        self.object_id = 0
        self.show_description = 0
        self.mailman_purchase = False

    def _validate_row(self, row):
        return isinstance(row, PurchasePickerRow)

    def _build_customize_picker(self, picker_data):
        picker_data.shop_picker_data.object_id = self.object_id
        picker_data.shop_picker_data.show_description = self.show_description
        picker_data.shop_picker_data.mailman_purchase = self.mailman_purchase
        for category in self.categories:
            category_data = picker_data.shop_picker_data.categories.add()
            category_data.tag_type = category.tag
            build_icon_info_msg((category.icon, None), None,
                                category_data.icon_info)
            category_data.description = category.tooltip
        for row in self.picker_rows:
            row_data = picker_data.shop_picker_data.row_data.add()
            row.populate_protocol_buffer(row_data)
class LifestyleBrandTargetMarketPicker(PickerSuperInteraction):
    INSTANCE_TUNABLES = {
        'target_markets':
        TunableList(
            description=
            '\n            A list of all the tuning needed for the different target markets for\n            the lifestyle brand Perk\n            ',
            tunable=TunableTuple(
                description=
                '\n                A Target Market consists of a type, name, and icon to be displayed.\n                ',
                target_type=TunableEnumEntry(
                    description=
                    '\n                    The type of target market this is associated with.\n                    ',
                    tunable_type=LifestyleBrandTargetMarket,
                    default=LifestyleBrandTargetMarket.INVALID,
                    invalid_enums=(LifestyleBrandTargetMarket.INVALID, )),
                name=TunableLocalizedString(
                    description=
                    '\n                    The name of the target market that is displayed in the picker.\n                    '
                ),
                icon=TunableIconFactory()),
            tuning_group=GroupNames.PICKERTUNING)
    }

    def _run_interaction_gen(self, timeline):
        self._show_picker_dialog(self.sim, target_sim=self.sim)
        return True
        yield

    @flexmethod
    def picker_rows_gen(cls, inst, target, context, **kwargs):
        inst_or_cls = inst if inst is not None else cls
        selected_target_market = None
        tracker = inst_or_cls.sim.sim_info.lifestyle_brand_tracker
        selected_target_market = tracker.target_market
        for target_market in inst_or_cls.target_markets:
            name = target_market.name
            yield ObjectPickerRow(
                name=name,
                icon_info=IconInfoData(icon_resource=target_market.icon.key),
                tag=target_market.target_type,
                is_selected=selected_target_market ==
                target_market.target_type)

    def on_choice_selected(self, choice_tag, **kwargs):
        sim = self.sim
        tracker = sim.sim_info.lifestyle_brand_tracker
        if tracker is None:
            return
        tracker.target_market = choice_tag
class Organization(DisplaySnippet):
    INSTANCE_TUNABLES = {
        'progress_statistic':
        TunableReference(
            description=
            '\n            The Ranked Statistic represents Organization Progress.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.STATISTIC),
            class_restrictions='RankedStatistic',
            export_modes=ExportModes.All),
        'hidden':
        Tunable(
            description=
            '\n            If True, then the organization is hidden from the organization panel.\n            ',
            tunable_type=bool,
            default=False,
            export_modes=ExportModes.All),
        'organization_task_data':
        TunableList(
            description=
            '\n            List of possible tested organization tasks that can be offered to \n            active organization members.\n            ',
            tunable=TunableTuple(
                description=
                '\n                Tuple of test and aspirations that is run on activating\n                organization tasks.\n                ',
                tests=event_testing.tests.TunableTestSet(
                    description=
                    '\n                   Tests run when the task is activated. If tests do not pass,\n                   the tasks are not considered for assignment.\n                   '
                ),
                organization_task=TunableReference(
                    description=
                    '\n                    An aspiration to use for task completion.\n                    ',
                    manager=services.get_instance_manager(
                        sims4.resources.Types.ASPIRATION),
                    class_restrictions='AspirationOrganizationTask'))),
        'organization_filter':
        TunableSimFilter.TunableReference(
            description=
            "\n            Terms to add a member to the Organization's membership list.\n            "
        ),
        'no_events_are_scheduled_string':
        OptionalTunable(
            description=
            '\n            If enabled and the organization has no scheduled events, this text\n            will be displayed in the org panel background.\n            ',
            tunable=TunableLocalizedString(
                description=
                '\n                The string to show in the organization panel if there are no scheduled\n                events.\n                '
            ))
    }
Пример #26
0
class ObjectCollectionData:
    __qualname__ = 'ObjectCollectionData'
    COLLECTIONS_DEFINITION = TunableList(
        description=
        '\n        List of collection groups.  Will need one defined per collection id\n        ',
        tunable=TunableCollectionTuple())
    COLLECTION_RARITY_MAPPING = TunableMapping(
        description=
        '\n            Mapping of collectible rarity to localized string for that rarity.\n            Used for displaying rarity names on the UI.',
        key_type=TunableEnumEntry(ObjectCollectionRarity,
                                  ObjectCollectionRarity.COMMON),
        value_type=TunableLocalizedString(
            description=
            '\n                Localization String For the name of the collection.  \n                This will be read on the collection UI to show item rarities.\n                '
        ))
    COLLECTION_COLLECTED_STING = TunablePlayAudio(
        description=
        '\n            The audio sting that gets played when a collectable is found.\n            '
    )
    COLLECTION_COMPLETED_STING = TunablePlayAudio(
        description=
        '\n            The audio sting that gets played when a collection is completed.\n            '
    )
    _COLLECTION_DATA = {}

    @classmethod
    def initialize_collection_data(cls):
        if not cls._COLLECTION_DATA:
            for collection_data in cls.COLLECTIONS_DEFINITION:
                for collectible_object in collection_data.object_list:
                    collectible_object._collection_id = collection_data.collection_id
                    cls._COLLECTION_DATA[collectible_object.collectable_item.
                                         id] = collectible_object

    @classmethod
    def get_collection_info_by_definition(cls, obj_def_id):
        if not cls._COLLECTION_DATA:
            ObjectCollectionData.initialize_collection_data()
        collectible = cls._COLLECTION_DATA.get(obj_def_id)
        if collectible:
            return (collectible._collection_id, collectible)
        return (None, None)

    @classmethod
    def get_collection_data(cls, collection_id):
        for collection_data in cls.COLLECTIONS_DEFINITION:
            while collection_data.collection_id == collection_id:
                return collection_data
Пример #27
0
 def __init__(self, description='', **kwargs):
     super().__init__(
         image_large=TunableResourceKey(
             description=
             '\n                The large version of the screenshot displayed in the Pack\n                Preview Panel.\n                ',
             resource_types=sims4.resources.CompoundTypes.IMAGE),
         image_small=TunableResourceKey(
             description=
             '\n                The small version of the screenshot displayed in the Pack \n                Detail Panel.\n                ',
             resource_types=sims4.resources.CompoundTypes.IMAGE),
         title=TunableLocalizedString(
             description=
             '\n                The title displayed over the screenshot in both the Pack\n                Detail Panel and Pack Preview Panel.\n                '
         ),
         description=description,
         **kwargs)
Пример #28
0
class AgingLiability(Liability):
    __qualname__ = 'AgingLiability'
    AGING_SAVELOCK_TOOLTIP = TunableLocalizedString(description='\n        The tooltip that is used as the reason why the game is save locked\n        while the age up dialog is visible.\n        ')

    def __init__(self, sim_info, starting_age):
        self._sim_info = sim_info
        self._starting_age = starting_age

    def get_lock_save_reason(self):
        return AgingLiability.AGING_SAVELOCK_TOOLTIP

    def release(self):
        if self._sim_info.age != self._starting_age and not self._sim_info.is_npc:
            services.get_persistence_service().lock_save(self)
            dialog = AgeTransitions.AGE_TRANSITION_INFO[self._sim_info.age].age_transition_dialog(self._sim_info, assignment_sim_info=self._sim_info, resolver=SingleSimResolver(self._sim_info))
            dialog.show_dialog(on_response=lambda _: services.get_persistence_service().unlock_save(self))
Пример #29
0
 def __init__(self, **kwargs):
     super().__init__(
         collection_id=TunableEnumEntry(
             description=
             '\n                            Unique Id for this collectible, cannot be re-used.\n                            ',
             tunable_type=CollectionIdentifier,
             default=CollectionIdentifier.Unindentified,
             export_modes=ExportModes.All),
         collection_name=TunableLocalizedString(
             description=
             '\n                            Localization String For the name of the \n                            collection.  This will be read on the collection\n                            UI to separate each item group.\n                            ',
             export_modes=ExportModes.All),
         completed_award=TunableReference(
             description=
             '\n                            Object award when the collection is completed.  \n                            This is an object that will be awarded to the Sim\n                            when all the items inside a collection have been \n                            discovered.\n                            ',
             manager=services.definition_manager(),
             export_modes=ExportModes.All),
         completed_award_money=TunableRange(
             description=
             '\n                            Money award when the collection is completed.  \n                            ',
             tunable_type=int,
             default=100,
             minimum=0,
             export_modes=ExportModes.All),
         completed_award_notification=UiDialogNotification.TunableFactory(
             description=
             '\n                            Notification that will be shown when the collection\n                            is completed and the completed_award is given.\n                            '
         ),
         object_list=TunableList(
             description=
             '\n                            List of object that belong to a collectible group.\n                            ',
             tunable=CollectibleTuple.TunableFactory(),
             export_modes=ExportModes.All),
         screen_slam=OptionalTunable(
             description=
             '\n                             Screen slam to show when the collection is\n                             completed and the completed_award is given.\n                             Localization Tokens: Collection Name = {0.String}\n                             ',
             tunable=ui.screen_slam.TunableScreenSlamSnippet()),
         first_collected_notification=OptionalTunable(
             description=
             '\n                            If enabled a notification will be displayed when\n                            the first item of this collection has been found.\n                            ',
             tunable=UiDialogNotification.TunableFactory(
                 description=
                 '\n                                Notification that will be shown the first item of\n                                this collection has been found.\n                                '
             ),
             disabled_name='No_notification',
             enabled_name='Display_notification'))
Пример #30
0
 def __init__(self, **kwargs):
     super().__init__(
         object=TunableVenueObjectTags(
             description=
             "\n                Specify object tag(s) that must be on this venue. Allows you to\n                group objects, i.e. weight bench, treadmill, and basketball\n                goals are tagged as\n                'exercise objects.'\n                ",
             export_modes=ExportModes.All),
         number=TunableRange(
             description=
             '\n                Number of the tuned object that have to be on the venue. Ex\n                Barstools 4 means you have to have at least 4 barstools before\n                it can be this venue.\n                ',
             tunable_type=int,
             default=1,
             minimum=1,
             export_modes=ExportModes.All),
         object_display_name=TunableLocalizedString(
             description=
             '\n                Name that will be displayed for the object(s)\n                ',
             export_modes=ExportModes.All),
         **kwargs)