def __init__(self, **kwargs):
     super().__init__(unlock_recipe=TunablePackSafeReference(
         manager=services.get_instance_manager(
             sims4.resources.Types.RECIPE)),
                      unlock_spell=TunablePackSafeReference(
                          manager=services.get_instance_manager(
                              sims4.resources.Types.SPELL)),
                      default='unlock_recipe',
                      **kwargs)
Beispiel #2
0
class FanTuning:
    FANNABLE_CELEBRITY_SITUATION = TunablePackSafeReference(description='\n        Situation that will store all celebrity Sims that can be used to\n        spawn fan or stan situations. \n        ', manager=services.get_instance_manager(Types.SITUATION), class_restrictions='FannableCelebritySimsSituation')
    FAN_TARGETTING_TAG = TunableTag(description='\n        Tag applied to celebrities that can be targeted by fans.\n        \n        Used in conjunction with autonomy modifiers so we can consider\n        celebrities without caring about whether or not they are on or off lot.\n        ', filter_prefixes=('Func',))
    FAN_SITUATION_TAG = TunableTag(description='\n        Tag which delineates which situations are fan situations.\n        ', filter_prefixes=('Situation',))
    STAN_DISABLING_BITS = TunableSet(description='\n        Rel bits, which if any are found on the stan, prevents the stan\n        from kicking off their situation. \n        \n        Used to prevent a stan from being too stanny. \n        ', tunable=TunableReference(services.get_instance_manager(Types.RELATIONSHIP_BIT), pack_safe=True))
    STAN_FILTER = TunablePackSafeReference(description='\n        Filter used to find the stan for a given Sim.  This should \n        only contain the minimum required filter terms for a Stan.\n        ', manager=services.get_instance_manager(Types.SIM_FILTER))
    STAN_PERK = TunablePackSafeReference(description='\n        Perk used to determine if a Sim is stannable.\n        ', manager=services.get_instance_manager(Types.BUCKS_PERK))

    @classproperty
    def are_fans_supported(cls):
        return cls.FANNABLE_CELEBRITY_SITUATION is not None
Beispiel #3
0
class CASMenu(HasTunableReference,
              metaclass=HashedTunedInstanceMetaclass,
              manager=services.get_instance_manager(Types.CAS_MENU)):
    INSTANCE_TUNABLES = {
        'cas_mode':
        TunableEnumEntry(
            description=
            '\n            The CAS mode for which this menu should be used.\n            ',
            tunable_type=CASMode,
            default=CASMode.BODY,
            export_modes=ExportModes.ClientBinary),
        'criteria':
        CASContextCriteria(
            description=
            '\n            List of criteria to determine when this menu should be used.\n            If more than one menu has its criteria met, the menu with the larger\n            number of criteria will be used.\n            ',
            export_modes=ExportModes.ClientBinary),
        'items':
        TunableList(
            description='\n            List of menu items.\n            ',
            tunable=TunableTuple(
                description=
                '\n                A menu item and its inclusion (and/or exclusion) criteria.\n                ',
                criteria=CASContextCriteria(
                    description=
                    '\n                    Include this item in the list of available menu items when all specified\n                    criteria are met.  If no criteria are defined, this item is always included.\n                    '
                ),
                item=TunablePackSafeReference(
                    description=
                    '\n                    Reference to a menu item for inclusion in this list.\n                    ',
                    manager=services.get_instance_manager(
                        Types.CAS_MENU_ITEM)),
                sub_items=TunableList(
                    description=
                    '\n                    Show the sub-menu, including this list of items.\n                    ',
                    tunable=TunableTuple(
                        description=
                        '\n                        A sub-menu item and its inclusion (and/or exclusion) criteria.\n                        ',
                        criteria=CASContextCriteria(
                            description=
                            '\n                            Include this item in the list of available menu items when all specified\n                            criteria are met.  If no criteria are defined, this item is always included.\n                            '
                        ),
                        item=TunablePackSafeReference(
                            description=
                            '\n                            Reference to a menu item for inclusion in this list.\n                            ',
                            manager=services.get_instance_manager(
                                Types.CAS_MENU_ITEM)),
                        export_class_name='CASSubMenuEntry')),
                export_class_name='CASMenuEntry'),
            export_modes=ExportModes.ClientBinary)
    }
Beispiel #4
0
class Street(HasTunableReference, metaclass=HashedTunedInstanceMetaclass, manager=services.street_manager()):
    WORLD_DESCRIPTION_TUNING_MAP = TunableMapping(description='\n        A mapping between Catalog world description and street tuning instance.\n        This way we can find out what world description the current zone\n        belongs to at runtime then grab its street tuning instance.\n        ', key_type=TunableWorldDescription(description='\n            Catalog-side World Description.\n            ', pack_safe=True), value_type=TunableReference(description="\n            Street Tuning instance. This is retrieved at runtime based on what\n            the active zone's world description is.\n            ", pack_safe=True, manager=services.street_manager()), key_name='WorldDescription', value_name='Street')
    INSTANCE_TUNABLES = {'open_street_director': TunablePackSafeReference(description='\n            The Scheduling Open Street Director to use for this world file.\n            This open street director will be able to load object layers and\n            spin up situations.\n            ', manager=services.get_instance_manager(sims4.resources.Types.OPEN_STREET_DIRECTOR)), 'travel_lot': OptionalTunable(description='\n            If enabled then this street will have a specific lot that it will\n            want to travel to when we travel to this "street."\n            ', tunable=TunableLotDescription(description='\n                The specific lot that we will travel to when asked to travel to\n                this street.\n                ')), 'townie_demographics': TunableTuple(description='\n            Townie population demographics for the street.\n            ', target_population=OptionalTunable(description='\n                If enabled, Sims created for other purposes will passively be\n                assigned to live on this street, gaining the filter features.\n                Sims are assigned out in round robin fashion up until all\n                streets have reached their target, after which those streets\n                will be assigned Sims in round robin fashion past their target.\n                \n                If disabled, this street will not passively be assigned townies\n                unless the Lives On Street filter explicitly requires the\n                Sim to be on the street.\n                ', tunable=TunableRange(description="\n                    The ideal number of townies that live on the street.\n                    \n                    0 is valid if you don't want Sims to live on this street\n                    while other streets haven't met their target population.\n                    ", tunable_type=int, default=1, minimum=0)), filter_features=TunableList(description='\n                Sims created as townies living on this street, they will gain\n                one set of features in this list. Features are applied as\n                Sim creation tags and additional filter terms to use.\n                ', tunable=TunableTuple(description='\n                    ', filter_terms=TunableList(description='\n                        Filter terms to inject into the filter.\n                        ', tunable=FilterTermVariant(conform_optional=True)), sim_creator_tags=TunableReference(description="\n                        Tags to inject into the filter's Sim template.\n                        ", manager=services.get_instance_manager(sims4.resources.Types.TAG_SET), allow_none=True, class_restrictions=('TunableTagSet',)), sim_name_type=TunableEnumEntry(description='\n                        What type of name the sim should have.\n                        ', tunable_type=SimNameType, default=SimNameType.DEFAULT), weight=TunableRange(description='\n                        Weighted chance.\n                        ', tunable_type=float, default=1, minimum=0)))), 'valid_conditional_layers': TunableSet(description='\n            A list of all of the conditional_layers on this Street.\n            ', tunable=TunableReference(description='\n                A reference to a conditional layer that exists on this Street.\n                ', manager=services.get_instance_manager(sims4.resources.Types.CONDITIONAL_LAYER), pack_safe=True)), 'tested_conditional_layers': TunableList(description='\n            The list of conditional layers that will load in to the the street\n            if its tests pass.\n            \n            NOTE: Only a subset of tests are registered to listen for updates.\n            Check with your GPE if you expect to have the conditional layers update\n            with test events. Otherwise, they will only be tested on zone-load.\n            ', tunable=TunableTuple(description='\n                A list of all of the conditional_layers to load into this Street.\n                ', conditional_layer=TunableReference(description='\n                    A reference to a conditional layer that exists on this Street.\n                    ', manager=services.get_instance_manager(sims4.resources.Types.CONDITIONAL_LAYER), pack_safe=True), tests=TunableGlobalTestList(description='\n                    The tests that must pass in order for this conditional layer\n                    to be loaded in. If tests are empty, the conditional layer\n                    is considered valid.\n                    '), process_after_event_handled=Tunable(description='\n                     When True, conditional layer requests triggered by the test\n                     events will be ordered to prioritize client-layer requests\n                     first, then gameplay-layers.\n                     ', tunable_type=bool, default=False), test_on_managed_world_edit_mode_load=Tunable(description='\n                    By default, conditional layers are not tested and started when entering\n                    from Managed World Edit Mode.  Those layers which are enabled via this\n                    option will be tested and started even in Managed World Edit Mode.\n                    Generally these should be Client Only layers, but no such restriction is\n                    enforced.\n                    ', tunable_type=bool, default=False))), 'beaches': TunableList(description='\n            List of locations to place beaches.\n            ', tunable=TunableTuple(description='\n                Beach creation data.\n                ', position=TunableVector3(description='\n                    The position to create the beach at.\n                    ', default=TunableVector3.DEFAULT_ZERO), forward=TunableVector2(description='\n                    The forward vector of the beach object.\n                    ', default=Vector2.Y_AXIS())), unique_entries=True), 'civic_policy': StreetProvider.TunableFactory(description='\n            Tuning to control the civic policy voting and enactment process for\n            a street.\n            '), 'initial_street_eco_footprint_override': OptionalTunable(description='\n            If enabled, overrides the initial value of the street eco footprint\n            statistic.\n            ', tunable=Tunable(description='\n                The initial value of the street eco footprint statistic.\n                ', tunable_type=float, default=0))}
    ZONE_IDS_BY_STREET = None
    street_to_lot_id_to_zone_ids = {}

    @classmethod
    def _cls_repr(cls):
        return "Street: <class '{}.{}'>".format(cls.__module__, cls.__name__)

    @classmethod
    def get_lot_to_travel_to(cls):
        if cls is services.current_street():
            return
        import world.lot
        return world.lot.get_lot_id_from_instance_id(cls.travel_lot)

    @classmethod
    def has_conditional_layer(cls, conditional_layer):
        return conditional_layer in cls.valid_conditional_layers

    @classmethod
    def clear_caches(cls):
        Street.street_to_lot_id_to_zone_ids.clear()
        Street.ZONE_IDS_BY_STREET = None
Beispiel #5
0
class ZoneModifierFromObjectsActionStatisticChange(
        ZoneModifierFromObjectsAction):
    FACTORY_TUNABLES = {
        'stat':
        TunablePackSafeReference(
            description=
            '\n            The statistic we are operating on.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.STATISTIC))
    }

    @property
    def action_type(self):
        return ZoneModifierFromObjectsActionType.STATISTIC_CHANGE

    def apply(self, object_count):
        if self.stat is None:
            return False
        tracker = self._get_participant_stat_tracker(self.stat)
        if tracker is not None:
            value = self.get_value(object_count)
            tracker.add_value(self.stat, value)
        return True

    def revert(self, object_count):
        if self.stat is None:
            return False
        tracker = self._get_participant_stat_tracker(self.stat)
        if tracker is not None:
            value = -self.get_value(object_count)
            tracker.add_value(self.stat, value)
        return True
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)
    }
class ScholarshipTuning:
    APPLICATION_RESPONSE_TUNING = TunableTuple(
        description=
        '\n        Loot actions to be run on scholarship acceptance or rejection.\n        \n        Reward object(s) given through the loot actions must have the\n        Scholarship Letter Component enabled in order to store information about\n        the resolved scholarship and sim applicant on the object.\n        ',
        value_threshold=Tunable(
            description=
            "\n            A value threshold that when exceeds runs the 'accepted_beyond_value_\n            threshold' loot action.\n            ",
            tunable_type=int,
            default=1),
        accepted_beyond_value_threshold=LootActions.TunablePackSafeReference(
            description=
            '\n            Loot action to be called when a Sim is accepted to\n            a scholarship and the value earned exceeds the tuned value threshold.\n            '
        ),
        accepted_below_value_threshold=LootActions.TunablePackSafeReference(
            description=
            '\n            Loot action to be called when a Sim is accepted to a scholarship and\n            the value does not exceed the tuned value threshold.\n            '
        ),
        rejected=LootActions.TunablePackSafeReference(
            description=
            '\n            Loot action to be called when a Sim is rejected from a scholarship.\n            '
        ))
    FULL_RIDE_LOOT = LootActions.TunablePackSafeReference(
        description=
        '\n        Loot to run if a sim has applied for scholarships and successfully\n        earned a full ride to attend university.\n        '
    )
    MERIT_SCHOLARSHIP = TunablePackSafeReference(
        description=
        '\n        The merit scholarship to evaluate on enrollment. One Merit Scholarship\n        is earned at enrollment if any prestige degrees are earned.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.SNIPPET),
        class_restrictions='Scholarship')
class TunableStatisticModifierCurve(HasTunableSingletonFactory, AutoFactoryInit):

	@TunableFactory.factory_option
	def axis_name_overrides (x_axis_name = None, y_axis_name = None):
		return {
			'multiplier': TunableVariant(description = '\n                Define how the multiplier will be applied.\n                ', value_curve = TunableCurve(description = '\n                    The multiplier will be determined by interpolating against a\n                    curve. The user-value is used. This means that a curve for\n                    skills should have levels as its x-axis.\n                    ', x_axis_name = x_axis_name, y_axis_name = y_axis_name), locked_args = {
				'raw_value': None
			}, default = 'raw_value')
		}

	FACTORY_TUNABLES = {
		'statistic': TunablePackSafeReference(description = "\n            The payout amount will be multiplied by this statistic's value.\n            ", manager = services.get_instance_manager(sims4.resources.Types.STATISTIC)),
		'subject': TunableEnumEntry(description = '\n            The participant to look for the specified statistic on.\n            ', tunable_type = ParticipantType, default = ParticipantType.Actor),
		'multiplier': TunableVariant(description = '\n            Define how the multiplier will be applied.\n            ', value_curve = TunableCurve(description = '\n                The multiplier will be determined by interpolating against a\n                curve. The user-value is used. This means that a curve for\n                skills should have levels as its x-axis.\n                '), locked_args = {
			'raw_value': None
		}, default = 'raw_value')
	}

	def get_value (self, stat, sim):
		return stat.convert_to_user_value(stat.get_value())

	def get_multiplier (self, resolver, sim):
		subject = resolver.get_participant(participant_type = self.subject, sim = sim)
		if subject is not None:
			stat = subject.get_stat_instance(self.statistic)
			if stat is not None:
				value = self.get_value(stat, sim)
				if self.multiplier is not None:
					return self.multiplier.get(value)
				else:
					return value
		return 1.0
class RelationshipBitCountTest(HasTunableSingletonFactory, AutoFactoryInit,
                               BaseTest):
    FACTORY_TUNABLES = {
        'subject':
        TunableEnumFlags(
            description=
            '\n            Owner of the relationship.\n            ',
            enum_type=ParticipantTypeSingleSim,
            default=ParticipantTypeSingleSim.Actor),
        'rel_bit':
        TunablePackSafeReference(
            description=
            "\n            The type of relationship we're looking for.\n            \n            In other words, we're looking for any relationship\n            with this Rel Bit.\n            ",
            manager=services.get_instance_manager(
                sims4.resources.Types.RELATIONSHIP_BIT)),
        'relationship_count':
        TunableRange(
            description=
            "\n            The number of relationships we want to compare against\n            the sim's actual number of relationships.\n            ",
            tunable_type=int,
            minimum=0,
            default=0),
        'comparison_operator':
        TunableOperator(
            description=
            "\n            The operator to use to compare the sim's\n            actual relationship count vs. the tuned\n            Relationship Count.\n            ",
            default=Operator.EQUAL)
    }

    def get_expected_args(self):
        return {'sim_infos': self.subject}

    @cached_test
    def __call__(self, sim_infos):
        if self.rel_bit is None:
            return TestResult(
                False,
                'Failed relationship bit count test: Rel Bit is not available due to pack-safeness'
            )
        sim_info_manager = services.sim_info_manager()
        for sim_info in sim_infos:
            rel_tracker = sim_info.relationship_tracker
            actual_rel_count = 0
            for other_sim_info_id in sim_info.relationship_tracker.target_sim_gen(
            ):
                other_sim_info = sim_info_manager.get(other_sim_info_id)
                if other_sim_info is None:
                    continue
                if rel_tracker.has_bit(other_sim_info_id, self.rel_bit):
                    actual_rel_count += 1
            threshold = sims4.math.Threshold(self.relationship_count,
                                             self.comparison_operator)
            if not threshold.compare(actual_rel_count):
                operator_symbol = Operator.from_function(
                    self.comparison_operator).symbol
                return TestResult(
                    False,
                    'Failed relationship bit count test: Actual Relationship Count ({}) {} Tuned Relationship Count ({})',
                    actual_rel_count, operator_symbol, self.relationship_count)
        return TestResult.TRUE
Beispiel #10
0
class SelectedAspirationTrackTest(HasTunableSingletonFactory, AutoFactoryInit,
                                  BaseTest):
    test_events = (TestEvent.AspirationTrackSelected, )

    @TunableFactory.factory_option
    def participant_type_override(participant_type_enum,
                                  participant_type_default):
        return {
            'who':
            TunableEnumEntry(
                description=
                '\n                    Who or what to apply this test to.\n                    ',
                tunable_type=participant_type_enum,
                default=participant_type_default)
        }

    FACTORY_TUNABLES = {
        'who':
        TunableEnumEntry(
            description=
            '\n            Who or what to apply this test to.\n            ',
            tunable_type=ParticipantTypeSingleSim,
            default=ParticipantTypeSingleSim.Actor),
        'aspiration_track':
        TunablePackSafeReference(
            description=
            '\n            The mood that must be active (or must not be active, if disallow is True).\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.ASPIRATION_TRACK))
    }

    def __init__(self, **kwargs):
        super().__init__(safe_to_skip=True, **kwargs)

    def get_expected_args(self):
        return {'test_targets': self.who}

    @cached_test
    def __call__(self, test_targets=()):
        for target in test_targets:
            if target is None:
                logger.error(
                    'Trying to call SelectedAspirationTrackTest with a None value in the sims iterable.'
                )
            else:
                if self.aspiration_track is None:
                    return TestResult(
                        False,
                        '{} failed SelectedAspirationTrackTest check. Aspiration Track is None',
                        target,
                        tooltip=self.tooltip)
                if target._primary_aspiration is not self.aspiration_track:
                    return TestResult(
                        False,
                        '{} failed SelectedAspirationTrackTest check. Track guids: {} is not {}',
                        target,
                        target._primary_aspiration,
                        self.aspiration_track.guid64,
                        tooltip=self.tooltip)
        return TestResult.TRUE
Beispiel #11
0
class RabbitHoleElement(XevtTriggeredElement, HasTunableFactory,
                        AutoFactoryInit):
    FACTORY_TUNABLES = {
        'rabbit_holed_participant':
        TunableEnumEntry(
            description=
            '\n            The participant to place in the rabbit hole.\n            ',
            tunable_type=ParticipantTypeSingle,
            default=ParticipantTypeSingle.Actor),
        'rabbit_hole':
        TunablePackSafeReference(
            description='\n            Rabbit hole to create\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.RABBIT_HOLE))
    }

    def _do_behavior(self):
        if self.rabbit_hole is None:
            return
        sim_or_sim_info = self.interaction.get_participant(
            self.rabbit_holed_participant)
        picked_skill = self.interaction.get_participant(
            ParticipantType.PickedStatistic)
        services.get_rabbit_hole_service().put_sim_in_managed_rabbithole(
            sim_or_sim_info.sim_info,
            self.rabbit_hole,
            picked_skill=picked_skill)
class ReputationTunables:
    REPUTATION_RANKED_STATISTIC = TunablePackSafeReference(
        description=
        '\n        The ranked statistic that is to be used for tracking reputation progress.\n        \n        This should not need to be tuned at all. If you think you need to tune\n        this please speak with a GPE before doing so.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.STATISTIC),
        class_restrictions=('RankedStatistic', ),
        export_modes=(ExportModes.ClientBinary, ))
class TunableSkillModifierCurve(TunableStatisticModifierCurve):
	FACTORY_TUNABLES = {
		'statistic': TunablePackSafeReference(description = "\n            The payout amount will be multiplied by this skill's value.\n            ", manager = services.get_instance_manager(sims4.resources.Types.STATISTIC), class_restrictions = ('Skill',)),
		'use_effective_skill_level': Tunable(description = '\n            If checked, the effective skill level will be used.\n            ', tunable_type = bool, default = False)
	}

	def get_value (self, stat, sim):
		if self.use_effective_skill_level:
			return sim.get_effective_skill_level(stat)
		return super().get_value(stat, sim)
class EP07NarrativeCommands:
    CONSERVATION_START_STAGE_LOOT = TunablePackSafeReference(
        description=
        '\n        The loot we will apply if the player runs the\n        narrative.restart_conservation_narrative cheat.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.ACTION),
        class_restrictions=('LootActions', ))
    CONSERVATION_INTERMEDIATE_STAGE_LOOT = TunablePackSafeReference(
        description=
        '\n        The loot we will apply if the player runs the\n        narrative.set_stage_intermediate_conservation_narrative cheat.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.ACTION),
        class_restrictions=('LootActions', ))
    CONSERVATION_FINAL_STAGE_LOOT = TunablePackSafeReference(
        description=
        '\n        The loot we will apply if the player runs the\n        narrative.set_stage_final_conservation_narrative cheat.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.ACTION),
        class_restrictions=('LootActions', ))
    CONSERVATION_NARRATIVE_START_STAGE = TunablePackSafeReference(
        description=
        '\n        The least conserved island narrative stage. Used for locking narrative\n        stages based on cheats.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.NARRATIVE))
    CONSERVATION_NARRATIVE_INTERMEDIATE_STAGE = TunablePackSafeReference(
        description=
        '\n        The intermediate island narrative stage. Used for locking narrative\n        stages based on cheats.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.NARRATIVE))
    CONSERVATION_NARRATIVE_FINAL_STAGE = TunablePackSafeReference(
        description=
        '\n        The final island narrative stage. Used for locking narrative\n        stages based on cheats.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.NARRATIVE))
Beispiel #15
0
class TutorialTipTuning:
    FTUE_TUNABLES = TunableTuple(
        description=
        '\n        Tunables relating to the FTUE tutorial mode.\n        ',
        start_house_description=TunableHouseDescription(
            description=
            '\n            A reference to the HouseDescription resource to load into in FTUE\n            '
        ),
        ftue_aspiration_category=TunablePackSafeReference(
            description=
            '\n            A reference to an aspiration category which is used in cas for the ftue flow\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.ASPIRATION_CATEGORY)),
        disable_ui_elements=TunableList(
            description=
            '\n            Disable one or more UI elements during a phase of the tutorial, denoted by\n            the starting and ending tips.\n            ',
            tunable=TunableTuple(
                description=
                '\n                Defines a set of UI elements to be disabled during a range of tips.\n                ',
                start_tip=TunablePackSafeReference(
                    description=
                    '\n                    When this tip becomes active or is satisfied, the target elements\n                    will become disabled.\n                    ',
                    manager=services.get_instance_manager(
                        sims4.resources.Types.TUTORIAL_TIP)),
                end_tip=TunablePackSafeReference(
                    description=
                    '\n                    When this tip becomes active or is satisfied, the target elements\n                    will become re-enabled.\n                    ',
                    manager=services.get_instance_manager(
                        sims4.resources.Types.TUTORIAL_TIP)),
                reason=TunableLocalizedString(
                    description=
                    '\n                    The reason the element has been disabled, usually displayed as a tooltip.\n                    '
                ),
                elements=TunableEnumSet(
                    description=
                    '\n                    List of UI elements to disable.  Note that not all elements can be disabled.\n                    ',
                    enum_type=TutorialTipUiElement),
                export_class_name='TutorialTipDisableUiElements')),
        export_modes=(ExportModes.ClientBinary, ),
        export_class_name='FtueDataTuple')
Beispiel #16
0
class _CareerSkillLootData(HasTunableSingletonFactory, AutoFactoryInit):
    FACTORY_TUNABLES = {'career': TunablePackSafeReference(description='\n            The career to reference a statistic from.\n            ', manager=services.get_instance_manager(sims4.resources.Types.CAREER), class_restrictions=('UniversityCourseCareerSlot',))}

    def __call__(self, sim_info, interaction):
        if sim_info is None:
            return
        degree_tracker = sim_info.degree_tracker
        if degree_tracker is None:
            return
        course_data = degree_tracker.get_course_data(self.career.guid64)
        if course_data is None:
            return
        return course_data.course_skill_data.related_skill
class ContinuousStatisticModifier(HasTunableSingletonFactory,
                                  BaseGameEffectModifier):
    @staticmethod
    def _verify_tunable_callback(cls, tunable_name, source, value):
        if value.modifier_value == 0:
            logger.error(
                'Trying to tune a Continuous Statistic Modifier to have a value of 0 which will do nothing on: {}.',
                StackVar(('cls', )))

    FACTORY_TUNABLES = {
        'description':
        "\n        The modifier to add to the current statistic modifier of this continuous statistic,\n        resulting in it's increase or decrease over time. Adding this modifier to something by\n        default doesn't change, i.e. a skill, will start that skill to be added to over time.\n        ",
        'statistic':
        TunablePackSafeReference(
            description='\n        "The statistic we are operating on.',
            manager=services.statistic_manager()),
        'modifier_value':
        Tunable(description=
                '\n        The value to add to the modifier. Can be negative.',
                tunable_type=float,
                default=0),
        'verify_tunable_callback':
        _verify_tunable_callback
    }

    def __init__(self, statistic, modifier_value, **kwargs):
        super().__init__(GameEffectType.CONTINUOUS_STATISTIC_MODIFIER)
        self.statistic = statistic
        self.modifier_value = modifier_value

    def apply_modifier(self, sim_info):
        if self.statistic is None:
            return
        stat = sim_info.get_statistic(self.statistic)
        if stat is None:
            return
        stat.add_statistic_modifier(self.modifier_value)
        if isinstance(stat, Skill):
            sim_info.current_skill_guid = stat.guid64

    def remove_modifier(self, sim_info, handle):
        if self.statistic is None:
            return
        stat = sim_info.get_statistic(self.statistic)
        if stat is None:
            return
        stat.remove_statistic_modifier(self.modifier_value)
        if isinstance(stat, Skill):
            if stat._statistic_modifier <= 0:
                if sim_info.current_skill_guid == stat.guid64:
                    sim_info.current_skill_guid = 0
Beispiel #18
0
class ScholarshipActionLoot(BaseLootOperation):
    class _LoseScholarship(HasTunableSingletonFactory, AutoFactoryInit):
        def perform(self, degree_tracker, scholarship):
            degree_tracker.lose_scholarship(scholarship)

    class _GrantScholarship(HasTunableSingletonFactory, AutoFactoryInit):
        def perform(self, degree_tracker, scholarship):
            degree_tracker.grant_scholarship(scholarship)

    FACTORY_TUNABLES = {
        'scholarship_action':
        TunableVariant(
            description=
            '\n            University operation to perform.\n            ',
            lose_scholarship=_LoseScholarship.TunableFactory(
                description=
                "\n                Cause the Sim to lose an earned scholarship. If it is not already earned,\n                it will still be added to the sim's rejected scholarship list, which\n                will prohibit the Sim from applying to that scholarship until a new\n                semester begins.\n                "
            ),
            grant_scholarship=_GrantScholarship.TunableFactory(
                description=
                "\n                Cause the Sim to gain a scholarship as if it was earned. This bypasses\n                the 'application' step.\n                "
            ),
            default='lose_scholarship'),
        'scholarship':
        TunablePackSafeReference(
            description=
            '\n            The scholarship to apply the scholarship action.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.SNIPPET),
            class_restrictions='Scholarship')
    }

    def __init__(self, scholarship_action, scholarship, **kwargs):
        super().__init__(**kwargs)
        self.scholarship_action = scholarship_action
        self.scholarship = scholarship

    def _apply_to_subject_and_target(self, subject, target, resolver):
        degree_tracker = subject.degree_tracker
        if degree_tracker is None:
            logger.error(
                'Cannot perform scholarship action loot for Sim ({}) because the degree tracker is None.',
                subject)
            return
        if self.scholarship is None:
            logger.error(
                'Cannot perform scholarship action loot for Sim ({}) because the scholarship is None.'
            )
            return
        self.scholarship_action.perform(degree_tracker, self.scholarship)
Beispiel #19
0
 def list_pack_safe(list_pack_safe=False):
     tuning_name = 'fallback_vehicle_def'
     description = "\n            The definition of the vehicle to spawn if the sim doesn't have\n            a favorite vehicle.\n        "
     if list_pack_safe:
         return {
             tuning_name:
             TunableReference(description=description,
                              manager=services.definition_manager(),
                              pack_safe=True)
         }
     return {
         tuning_name:
         TunablePackSafeReference(description=description,
                                  manager=services.definition_manager())
     }
Beispiel #20
0
class LoanTunables:
    DEBT_STATISTIC = TunableReference(description='\n        The statistic used to track the amount of debt this Sim has incurred.\n        ', manager=services.get_instance_manager(sims4.resources.Types.STATISTIC), class_restrictions=('Statistic',))
    DEATH_DEBT_COLLECTION_NOTIFICATION = TunableUiDialogNotificationSnippet(description='\n        The notification shown when a Sim that has unpaid debt dies.\n        ')
    POVERTY_LOOT = TunablePackSafeReference(description='\n        A loot action applied to all other members of the household if a Sim\n        with unpaid dies, and the debt amount is greater than or equal to\n        the household funds.\n        ', manager=services.get_instance_manager(sims4.resources.Types.ACTION), class_restrictions=('LootActions',))
    INTEREST_MAP = TunableMapping(description='\n        Mapping between loan type and the interest rate for that type.\n        ', key_type=TunableEnumEntry(description='\n            The type of loan taken.\n            ', tunable_type=LoanType, default=LoanType.INVALID, invalid_enums=(LoanType.INVALID,)), value_type=TunablePercent(description='\n            The interest rate for the corresponding loan type.\n            ', default=10), tuple_name='InterestMappingTuple', export_modes=ExportModes.All)

    @staticmethod
    def get_loan_amount(amount, loan_type):
        interest_rate = LoanTunables.INTEREST_MAP.get(loan_type, 0)
        amount += amount*interest_rate
        return int(amount)

    @staticmethod
    def add_debt(sim_info, amount):
        if amount == 0:
            return
        sim_info_debt_stat = sim_info.statistic_tracker.get_statistic(LoanTunables.DEBT_STATISTIC, add=True)
        sim_info_debt_stat.add_value(amount)
        LoanTunables.send_loan_op(sim_info, -amount)

    @staticmethod
    def send_loan_op(sim_info, amount):
        msg = Sims_pb2.SetLoan()
        msg.amount = amount
        op = GenericProtocolBufferOp(Operation.SET_LOAN, msg)
        Distributor.instance().add_op(sim_info, op)

    @staticmethod
    def on_death(sim_info):
        debt_stat = sim_info.statistic_tracker.get_statistic(LoanTunables.DEBT_STATISTIC)
        if debt_stat is None:
            return
        debt_amount = debt_stat.get_value()
        if debt_amount == 0:
            return
        resolver = SingleSimResolver(sim_info)
        dialog = LoanTunables.DEATH_DEBT_COLLECTION_NOTIFICATION(sim_info, resolver=resolver)
        dialog.show_dialog()
        household_funds = sim_info.household.funds.money
        if LoanTunables.POVERTY_LOOT is not None:
            if debt_amount >= household_funds:
                for hh_sim_info in sim_info.household.sim_info_gen():
                    if sim_info is hh_sim_info:
                        continue
                    resolver = DoubleSimResolver(hh_sim_info, sim_info)
                    LoanTunables.POVERTY_LOOT.apply_to_resolver(resolver)
        amount_to_remove = min(debt_amount, household_funds)
        sim_info.household.funds.try_remove_amount(amount_to_remove, Consts_pb2.TELEMETRY_LOANS_SIM_DEATH)
Beispiel #21
0
class DaycareTuning:
    NANNY_SERVICE_NPC = TunableReference(description='\n        The nanny service NPC. We check if this is hired to take \n        away babies on sims leaving.\n        ', manager=services.get_instance_manager(sims4.resources.Types.SERVICE_NPC))
    BUTLER_SERVICE_NPC = TunablePackSafeReference(description='\n        The butler service NPC. If selected to look after children, the butler\n        should have similar effects as the nanny with regards to Daycare.\n        ', manager=services.get_instance_manager(sims4.resources.Types.SERVICE_NPC))
    NANNY_SERVICE_NPC_DIALOG = UiDialogOkCancel.TunableFactory(description='\n        A dialog that shows up when toddlers (not babies) are left home alone\n        requiring daycare. If the player selects Ok, a Nanny NPC is hired for\n        the duration of daycare, and the player can keep playing with their\n        toddlers. If Cancel is selected, regular daycare behavior kicks in and\n        the toddlers become uncontrollable.\n        ')
    DAYCARE_TRAIT_ON_KIDS = TunableReference(description='\n        The trait that indicates a baby is at daycare.\n        ', manager=services.trait_manager())
    NANNY_TRAIT_ON_KIDS = TunableReference(description='\n        The trait that children and babies that are with the nanny have.\n        ', manager=services.trait_manager())
    SEND_BABY_TO_DAYCARE_NOTIFICATION_SINGLE_BABY = TunableUiDialogNotificationSnippet(description='\n        The message appearing when a single baby is sent to daycare. You can\n        reference this single baby by name.\n        ')
    SEND_BABY_TO_DAYCARE_NOTIFICATION_MULTIPLE_BABIES = TunableUiDialogNotificationSnippet(description='\n        The message appearing when multiple babies are sent to daycare. You can\n        not reference any of these babies by name.\n        ')
    BRING_BABY_BACK_FROM_DAYCARE_NOTIFICATION_SINGLE_BABY = TunableUiDialogNotificationSnippet(description='\n        The message appearing when a single baby is brought back from daycare.\n        You can reference this single baby by name.\n        ')
    BRING_BABY_BACK_FROM_DAYCARE_NOTIFICATION_MULTIPLE_BABIES = TunableUiDialogNotificationSnippet(description='\n        The message appearing when multiple babies are brought back from\n        daycare. You can not reference any of these babies by name.\n        ')
    SEND_CHILD_TO_NANNY_NOTIFICATION_SINGLE = TunableUiDialogNotificationSnippet(description='\n        The message appears when a single child is sent to the nanny. You can\n        reference this single nanny by name.\n        ')
    SEND_CHILD_TO_NANNY_NOTIFICATION_MULTIPLE = TunableUiDialogNotificationSnippet(description='\n        The message appearing when multiple children are sent to the nanny. You\n        can not reference any of these children by name.\n        ')
    BRING_CHILD_BACK_FROM_NANNY_NOTIFICATION_SINGLE = TunableUiDialogNotificationSnippet(description='\n        The message appearing when a single child is brought back from the\n        nanny. You can reference this single child by name.\n        ')
    BRING_CHILD_BACK_FROM_NANNY_NOTIFICATION_MULTIPLE = TunableUiDialogNotificationSnippet(description='\n        The message appearing when multiple children are brought back from\n        the nanny. You can not reference any of these by name.\n        ')
    GO_TO_DAYCARE_INTERACTION = TunableReference(description='\n        An interaction to push on instantiated Sims that need to go to Daycare.\n        ', manager=services.get_instance_manager(sims4.resources.Types.INTERACTION))
    DAYCARE_AWAY_ACTIONS = TunableMapping(description='\n        Map of commodities to away action.  When the default away action is\n        asked for we look at the ad data of each commodity and select the away\n        action linked to the commodity that is advertising the highest.\n        \n        This set of away actions is used exclusively for Sims in daycare.\n        ', key_type=TunableReference(description='\n            The commodity that we will look at the advertising value for.\n            ', manager=services.get_instance_manager(Types.STATISTIC), class_restrictions=('Commodity',)), value_type=TunableReference(description='\n            The away action that will applied if the key is the highest\n            advertising commodity of the ones listed.\n            ', manager=services.get_instance_manager(Types.AWAY_ACTION)))
Beispiel #22
0
class ButlerSituationStateChange(BaseLootOperation):
    FACTORY_TUNABLES = {
        'butler_situation':
        TunablePackSafeReference(
            description=
            "\n            The Situation who's state will change.\n            ",
            manager=services.situation_manager()),
        'operation':
        TunableVariant(
            description=
            '\n            Enable or disable operation for tuned tone.\n            ',
            locked_args={
                'enable': True,
                'disable': False
            },
            default='enable'),
        'situation_state':
        TunableEnumEntry(
            description=
            '\n            Situation state for the butler that should be enabled or disabled\n            depending on the operation.\n            ',
            tunable_type=ButlerSituationStates,
            default=ButlerSituationStates.DEFAULT,
            invalid_enums=(ButlerSituationStates.DEFAULT, ))
    }

    def __init__(self, *args, butler_situation, operation, situation_state,
                 **kwargs):
        super().__init__(*args, **kwargs)
        self._butler_situation = butler_situation
        self._operation = operation
        self._situation_state = situation_state

    def _apply_to_subject_and_target(self, subject, target, resolver):
        if subject is None:
            return
        situation_manager = services.get_zone_situation_manager()
        butler_situation = situation_manager.get_situation_by_type(
            self._butler_situation)
        if butler_situation is None:
            logger.error(
                'Sim {} trying to switch situation state {} while not running the butler situation',
                subject, self._situation_state)
            return
        if self._operation:
            butler_situation.enable_situation_state(self._situation_state)
        else:
            butler_situation.disable_situation_state(self._situation_state)
class SituationSimsPickerMixin:
    INSTANCE_TUNABLES = {
        'valid_situations':
        SituationSearchByDefinitionOrTagsVariant(
            description=
            '\n            Situations where the guest list will be collected to populate the picker.\n            ',
            tuning_group=GroupNames.PICKERTUNING),
        'job_filter':
        TunableList(
            description=
            '\n            If provided, only looks for Sims with the specified jobs.\n            ',
            tunable=TunablePackSafeReference(
                manager=services.get_instance_manager(
                    sims4.resources.Types.SITUATION_JOB)),
            tuning_group=GroupNames.PICKERTUNING)
    }
    REMOVE_INSTANCE_TUNABLES = ('sim_filter', 'sim_filter_household_override',
                                'sim_filter_requesting_sim',
                                'include_uninstantiated_sims',
                                'include_instantiated_sims',
                                'include_actor_sim', 'include_target_sim')

    @flexmethod
    def _get_valid_sim_choices_gen(cls, inst, target, context, **kwargs):
        inst_or_cls = inst if inst is not None else cls
        for situation in cls.valid_situations.get_all_matching_situations():
            for sim in situation.all_sims_in_situation_gen():
                if not not cls.job_filter and situation.get_current_job_for_sim(
                        sim) not in cls.job_filter:
                    continue
                if inst_or_cls.sim_tests:
                    if inst:
                        interaction_parameters = inst.interaction_parameters.copy(
                        )
                    else:
                        interaction_parameters = kwargs.copy()
                    interaction_parameters['picked_item_ids'] = {sim.sim_id}
                    resolver = InteractionResolver(cls,
                                                   inst,
                                                   target=target,
                                                   context=context,
                                                   **interaction_parameters)
                    if inst_or_cls.sim_tests.run_tests(resolver):
                        yield FilterResult(sim_info=sim.sim_info)
                        yield FilterResult(sim_info=sim.sim_info)
                else:
                    yield FilterResult(sim_info=sim.sim_info)
Beispiel #24
0
class ChefTuning:
    CHEF_STATION_POT_OBJECT = TunablePackSafeReference(
        description=
        "\n        The pot object to create at the chef's station.\n        ",
        manager=services.definition_manager())
    CHEF_STATION_PAN_OBJECT = TunablePackSafeReference(
        description=
        "\n        The pan object to create at the chef's station.\n        ",
        manager=services.definition_manager())
    CHEF_STATION_CUTTING_BOARD_OBJECT = TunablePackSafeReference(
        description=
        "\n        The cutting board object to create at the chef's station.\n        ",
        manager=services.definition_manager())
    CHEF_STATION_PAN_SLOT = Tunable(
        description=
        '\n        The name of the slot in which the pan object should be placed.\n        ',
        tunable_type=str,
        default='_ctnm_SimInteraction_1')
    CHEF_STATION_POT_SLOT = Tunable(
        description=
        '\n        The name of the slot in which the pot object should be placed.\n        ',
        tunable_type=str,
        default='_ctnm_SimInteraction_2')
    CHEF_STATION_CUTTING_BOARD_SLOT = Tunable(
        description=
        '\n        The name of the slot in which the cutting board object should be placed.\n        ',
        tunable_type=str,
        default='_ctnm_SimInteraction_4')
    CHEF_STATION_SERVE_SLOT_TYPE = TunableReference(
        description=
        '\n        The slot type of the serve slots on the chef station.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.SLOT_TYPE))
    CHEF_STATION_SERVING_PLATTER_OBJECT = TunablePackSafeReference(
        description=
        "\n        The serving platter object the chef will create and place when they're\n        done cooking an order.\n        ",
        manager=services.definition_manager())
    CHEF_HAS_ORDER_BUFF = TunablePackSafeReference(
        description=
        '\n        The buff a chef should get when they have an order. This should drive\n        them to do the active cooking animations.\n        ',
        manager=services.buff_manager())
    CHEF_COMPLIMENT_LOOT = LootActions.TunablePackSafeReference(
        description=
        "\n        The loot action to trigger when a customer compliments a chef. This\n        won't happen until the waitstaff deliver the compliment.\n        \n        The customer Sim will be the Actor and the Chef will be TargetSim.\n        "
    )
    CHEF_INSULT_LOOT = LootActions.TunablePackSafeReference(
        description=
        "\n        The loot action to trigger when a customer insults a chef. This won't\n        happen until the waitstaff deliver the insult.\n        \n        The customer Sim will be the Actor and the Chef will be TargetSim.\n        "
    )
    PICK_UP_ORDER_INTERACTION = TunablePackSafeReference(
        description=
        '\n        The interaction the sim will run when they pick their order up from the\n        Chef Station. This is only used when a Sim places an order directly at\n        the chef station.\n        ',
        manager=services.get_instance_manager(
            sims4.resources.Types.INTERACTION))
Beispiel #25
0
class ZoneModifierFromObjectsActionStatisticModifier(
        ZoneModifierFromObjectsAction):
    FACTORY_TUNABLES = {
        'stat':
        TunablePackSafeReference(
            description=
            '\n            The statistic we are operating on.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.STATISTIC))
    }

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._modifier_handles = None

    @property
    def action_type(self):
        return ZoneModifierFromObjectsActionType.STATISTIC_MODIFIER

    def apply(self, object_count):
        if self.stat is None:
            return False
        target = self._get_target()
        if target is None:
            return False
        autonomy_modifier = AutonomyModifier(
            statistic_modifiers={self.stat: self.get_value(object_count)})
        modifier_handle = target.add_statistic_modifier(autonomy_modifier)
        if self._modifier_handles is None:
            self._modifier_handles = []
        self._modifier_handles.append(modifier_handle)
        return True

    def revert(self, object_count):
        if self.stat is None:
            return False
        if self._modifier_handles is None:
            return False
        target = self._get_target()
        if target is None:
            return False
        for modifier_handle in self._modifier_handles:
            target.remove_statistic_modifier(modifier_handle)
        self._modifier_handles = None
        return True
class StreetCivicPolicySelectorMixin(HasTunableSingletonFactory,
                                     AutoFactoryInit):
    FACTORY_TUNABLES = {
        'street':
        TunableVariant(
            description=
            '\n            Select what street to test.\n            ',
            literal=TunablePackSafeReference(
                description=
                '\n                Identify a specific Street.\n                ',
                manager=services.get_instance_manager(
                    sims4.resources.Types.STREET)),
            via_zone_source=TunableVariant(
                description=
                '\n                Select the street to use by specifying a Zone Source.\n                ',
                use_current_zone=ActiveZone.TunableFactory(),
                use_pick_info=PickInfoZone.TunableFactory(),
                use_picked_zone_ids=PickedZoneIds.TunableFactory(),
                use_participant_home_zone=ParticipantHomeZone.TunableFactory(),
                default='use_current_zone'),
            via_street_participant=StreetParticipant.TunableFactory(),
            default='literal')
    }

    def _get_street(self, **kwargs):
        if self.street is None or hasattr(self.street, 'civic_policy'):
            street = self.street
        else:
            if isinstance(self.street, (StreetParticipant, )):
                return self.street.get_street(**kwargs)
            zone_id = self.street.get_zone_id(**kwargs)
            if zone_id is None:
                return
            from world.street import get_street_instance_from_zone_id
            street = get_street_instance_from_zone_id(zone_id)
        return street

    def _get_civic_policy_provider(self, *args, **kwargs):
        street_service = services.street_service()
        if street_service is None:
            return
        else:
            street = self._get_street(**kwargs)
            if street is not None:
                return street_service.get_provider(street)
Beispiel #27
0
class RemoveBuffLiability(Liability, HasTunableFactory):
    LIABILITY_TOKEN = 'RemoveBuffLiability'
    FACTORY_TUNABLES = {'buff_to_remove': TunablePackSafeReference(description='\n            The buff to remove on the interaction finishing.\n            ', manager=services.buff_manager())}

    def __init__(self, interaction, buff_to_remove, **kwargs):
        super().__init__(**kwargs)
        self._sim_info = interaction.sim.sim_info
        self._buffs_to_remove = set()
        if buff_to_remove is not None:
            self._buffs_to_remove.add(buff_to_remove)

    def merge(self, interaction, key, new_liability):
        new_liability._buffs_to_remove.update(self._buffs_to_remove)
        return new_liability

    def release(self):
        for buff_type in self._buffs_to_remove:
            self._sim_info.remove_buff_by_type(buff_type)
class UniversityHousingTuning:
    UNIVERSITY_HOUSING_KICK_OUT_SITUATION = TunableReference(
        description=
        '\n        The situation to kick a sim out of university housing.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.SITUATION),
        class_restrictions=('UniversityHousingKickOutSituation', ),
        pack_safe=True)
    UNIVERSITY_HOUSING_ROOMMATE_FILTER_TERM_TEMPLATES = TunableMapping(
        description=
        "\n        Template filter terms for each university housing roommate requirement criteria.\n        We will be modifying these terms in code based on what the player sets\n        in the venue's configuration UI. For example, the template gender filter\n        term is set to male, but if the player sets their university housing\n        venue as female only, we will modify this filter term before retrieving\n        roommates.  These values are set in tuning so the majority of the filter\n        terms' values are initialized to their defaults, instead of having\n        to do so in code.\n        ",
        key_type=TunableEnumEntry(
            tunable_type=UniversityHousingRoommateRequirementCriteria,
            default=UniversityHousingRoommateRequirementCriteria.NONE,
            invalid_enums=UniversityHousingRoommateRequirementCriteria.NONE,
            pack_safe=True),
        key_name='Requirement Criteria',
        value_type=FilterTermVariant(),
        value_name='Filter Term Template')
    UNIVERSITY_HOUSING_VENUE_TUNING = TunablePackSafeReference(
        description='\n        The university housing venue.\n        ',
        manager=services.get_instance_manager(sims4.resources.Types.VENUE))
    UNIVERSITY_HOUSING_PREGNANCY_TEST = TunableTestSet(
        description=
        '\n        Test to determine if a sim is at the appropriate stage in a pregnancy\n        in order to be kicked out of university housing.\n        '
    )
    UNIVERSITY_HOUSING_VALIDATION_CADENCE = TunableTimeSpan(
        description=
        '\n        When a university housing venue is loaded, the timespan between updates\n        where we validate household sims to decide if they need to be kicked out.\n        '
    )
    UNIVERSITY_HOUSING_KICKOUT_SITUATION_BLOCKER_TAG = TunableEnumWithFilter(
        description=
        "\n        If a situation with this tag is running, we won't start any kickout situations.  We use this tag to prevent\n        edge cases such as multiple kickouts running at the same time, or kicking out sims who have died.\n        ",
        tunable_type=Tag,
        filter_prefixes=['situation'],
        default=Tag.INVALID,
        pack_safe=True)

    @staticmethod
    def get_university_housing_zone_ids():
        university_venue_tuning = UniversityHousingTuning.UNIVERSITY_HOUSING_VENUE_TUNING
        if university_venue_tuning is None:
            return ()
        return tuple(services.venue_service().get_zones_for_venue_type_gen(
            university_venue_tuning))
Beispiel #29
0
    class _CheatedOnHomework(HasTunableSingletonFactory, AutoFactoryInit):
        FACTORY_TUNABLES = {
            'course_career_slot':
            TunablePackSafeReference(
                description=
                '\n                The course career slot we will get the course from to update the \n                cheating status of.\n                ',
                manager=services.get_instance_manager(
                    sims4.resources.Types.CAREER),
                class_restrictions='UniversityCourseCareerSlot'),
            'success_chance':
            SuccessChance.TunableFactory(
                description=
                '\n                Chance that the sim will be caught cheating.\n                '
            )
        }

        def perform(self, subject, target, resolver):
            if subject is None or not subject.is_sim:
                return
            if not subject.is_sim:
                return
            sim_info = subject.sim_info
            if self.course_career_slot is None:
                logger.error(
                    'Attempting to update the final project completion status for sim {}, but the specified course career slot is None.Possibly due to PackSafeness.',
                    sim_info)
                return
            degree_tracker = sim_info.degree_tracker
            if degree_tracker is None:
                logger.error(
                    'Attempting to mark that sim {} cheated on their homework but they have no degree tracker',
                    sim_info)
                return
            if random.random() > self.success_chance.get_chance(resolver):
                degree_tracker.update_homework_cheating_status(
                    self.course_career_slot,
                    HomeworkCheatingStatus.CHEATING_FAIL)
                return
            degree_tracker.update_homework_cheating_status(
                self.course_career_slot,
                HomeworkCheatingStatus.CHEATING_SUCCESS)
Beispiel #30
0
class ZoneModifierFromObjectsActionConvergenceChange(
        ZoneModifierFromObjectsAction):
    FACTORY_TUNABLES = {
        'stat':
        TunablePackSafeReference(
            description=
            '\n            The statistic we are operating on.\n            ',
            manager=services.get_instance_manager(
                sims4.resources.Types.STATISTIC),
            class_restrictions=('Commodity', ))
    }

    @property
    def action_type(self):
        return ZoneModifierFromObjectsActionType.CONVERGENCE_CHANGE

    def _get_stat_instance(self):
        if self.stat is None:
            return
        tracker = self._get_participant_stat_tracker(self.stat)
        if tracker is None:
            return
        return tracker.get_statistic(self.stat)

    def apply(self, object_count):
        stat_inst = self._get_stat_instance()
        if stat_inst is None:
            return False
        value = self.get_value(object_count)
        stat_inst.convergence_value += value
        return True

    def revert(self, object_count):
        stat_inst = self._get_stat_instance()
        if stat_inst is None:
            return False
        value = self.get_value(object_count)
        stat_inst.convergence_value -= value
        return True