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')
Exemplo n.º 2
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))
class PremadeSimRelationships:

    @staticmethod
    def _verify_tunable_callback(instance_class, tunable_name, source, value):
        sim_to_household = {}
        for household in services.get_instance_manager(sims4.resources.Types.SIM_TEMPLATE).types.values():
            if household.template_type != SimTemplateType.PREMADE_HOUSEHOLD:
                continue
            for sim in household.get_household_members():
                sim_to_household[sim.sim_template] = household
        pairs = set()
        for entry in value:
            a = entry.sim_a
            b = entry.sim_b
            if a is None:
                if b is not None:
                    logger.error('Premade Sim has rel with a Sim in unloaded pack. a: {}', a.__name__)
                    if b is None:
                        if a is not None:
                            logger.error('Premade Sim has rel with a Sim in unloaded pack. b: {}', b.__name__)
                            if entry.relationship_loot is None:
                                logger.error('Premade Sims have relationship loot in unloaded pack. a: {}, b: {}', a.__name__, b.__name__)
                            elif a is b:
                                logger.error('Premade Sim has rel with himself/herself. a: {}, b: {}', a.__name__, b.__name__)
                            elif sim_to_household[a] is sim_to_household[b]:
                                logger.error('Premade Sim has rel with Sim in same household. a: {}, b: {}', a.__name__, b.__name__)
                            else:
                                key = (a.guid64, b.guid64)
                                reverse_key = (b.guid64, a.guid64)
                                if key in pairs or reverse_key in pairs:
                                    logger.error('Multiple rel tuning between preamde Sims. a: {}, b: {}', a.__name__, b.__name__)
                                pairs.add(key)
                    elif entry.relationship_loot is None:
                        logger.error('Premade Sims have relationship loot in unloaded pack. a: {}, b: {}', a.__name__, b.__name__)
                    elif a is b:
                        logger.error('Premade Sim has rel with himself/herself. a: {}, b: {}', a.__name__, b.__name__)
                    elif sim_to_household[a] is sim_to_household[b]:
                        logger.error('Premade Sim has rel with Sim in same household. a: {}, b: {}', a.__name__, b.__name__)
                    else:
                        key = (a.guid64, b.guid64)
                        reverse_key = (b.guid64, a.guid64)
                        if key in pairs or reverse_key in pairs:
                            logger.error('Multiple rel tuning between preamde Sims. a: {}, b: {}', a.__name__, b.__name__)
                        pairs.add(key)
            elif b is None:
                if a is not None:
                    logger.error('Premade Sim has rel with a Sim in unloaded pack. b: {}', b.__name__)
                    if entry.relationship_loot is None:
                        logger.error('Premade Sims have relationship loot in unloaded pack. a: {}, b: {}', a.__name__, b.__name__)
                    elif a is b:
                        logger.error('Premade Sim has rel with himself/herself. a: {}, b: {}', a.__name__, b.__name__)
                    elif sim_to_household[a] is sim_to_household[b]:
                        logger.error('Premade Sim has rel with Sim in same household. a: {}, b: {}', a.__name__, b.__name__)
                    else:
                        key = (a.guid64, b.guid64)
                        reverse_key = (b.guid64, a.guid64)
                        if key in pairs or reverse_key in pairs:
                            logger.error('Multiple rel tuning between preamde Sims. a: {}, b: {}', a.__name__, b.__name__)
                        pairs.add(key)
            elif entry.relationship_loot is None:
                logger.error('Premade Sims have relationship loot in unloaded pack. a: {}, b: {}', a.__name__, b.__name__)
            elif a is b:
                logger.error('Premade Sim has rel with himself/herself. a: {}, b: {}', a.__name__, b.__name__)
            elif sim_to_household[a] is sim_to_household[b]:
                logger.error('Premade Sim has rel with Sim in same household. a: {}, b: {}', a.__name__, b.__name__)
            else:
                key = (a.guid64, b.guid64)
                reverse_key = (b.guid64, a.guid64)
                if key in pairs or reverse_key in pairs:
                    logger.error('Multiple rel tuning between preamde Sims. a: {}, b: {}', a.__name__, b.__name__)
                pairs.add(key)

    RELATIONSHIP_MAP = TunableList(description='\n        Relationship to give between premade Sims in different households.\n        ', tunable=TunableTuple(description='\n            Two Sims and a loot. The two Sims must be in different premade\n            households, and there can only be one entry per pair of Sims.\n            ', sim_a=PremadeSimTemplate.TunablePackSafeReference(description='\n                Relationship Loot uses this Sim as Actor.\n                '), sim_b=PremadeSimTemplate.TunablePackSafeReference(description='\n                Relationship Loot uses this Sim as TargetSim.\n                '), relationship_loot=LootActions.TunablePackSafeReference(description='\n                Loot that contains relationship to add between the two Sims.\n                Sim A is Actor and Sim B is TargetSim.\n                ')), verify_tunable_callback=_verify_tunable_callback)

    @classmethod
    def apply_relationships(cls, premade_sim_infos):
        loot_matrix = defaultdict(dict)
        for entry in PremadeSimRelationships.RELATIONSHIP_MAP:
            if not entry.sim_a is None:
                if entry.sim_b is None:
                    continue
                loot_matrix[entry.sim_a][entry.sim_b] = entry.relationship_loot
        for (premade_sim_template, sim_info) in premade_sim_infos.items():
            if premade_sim_template not in loot_matrix:
                continue
            for (other_template, rel_loot) in loot_matrix[premade_sim_template].items():
                if other_template not in premade_sim_infos:
                    continue
                other_sim_info = premade_sim_infos[other_template]
                resolver = DoubleSimResolver(sim_info, other_sim_info)
                rel_loot.apply_to_resolver(resolver)