Advertisement
Xtraeme

Unpyc3 of tunable_handler.py

Jul 4th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.81 KB | None | 0 0
  1. import services
  2. from event_testing.test_variants import SimInfoTest, UserRunningInteractionTest
  3. from event_testing.tests import CompoundTestList, TestList
  4. from interactions import ParticipantType
  5. from sims.phone_tuning import PhoneTuning
  6. from sims.sim_info_types import Age
  7. from sims4.collections import make_immutable_slots_class, ListSet
  8. from sims4.localization import TunableLocalizedStringFactory
  9. from sims4.resources import Types, get_resource_key
  10. from sims4.tuning.instance_manager import InstanceManager
  11. from wickedwoohoo.global_manager import register_game_load_listener
  12. from wickedwoohoo.utils_enums import SimInteraction
  13. from wickedwoohoo.utils_injector import injector
  14. from wickedwoohoo.utils_tunings import get_sim_info_age_test, create_impossible_sim_info_age_test
  15. NUDE_CLOTHING_BUFF = 128807
  16. NUDE_TEENS_TEST_SETS = (129064,)
  17. NUDITY_AFFORDANCE_LIST = (120455, 120453, 128625, 129163, 117339, 26878)
  18. ALL_SIMS_AFFORDANCE_LIST = (125127, 125129)
  19. DISABLE_AFFORDANCE_LIST = (128922, 129168, 128960, 142210)
  20.  
  21. @register_game_load_listener()
  22. def _add_test_to_phone_tuning(is_first_load):
  23.     if is_first_load is False:
  24.         return
  25.     affordance_manager = services.get_instance_manager(Types.INTERACTION)
  26.     affordances = {affordance_manager.get(get_resource_key(SimInteraction.WW_SEX_INTERACTION, Types.INTERACTION)), affordance_manager.get(get_resource_key(SimInteraction.WW_SETUP_SEX, Types.INTERACTION)), affordance_manager.get(get_resource_key(SimInteraction.WW_WAIT_FOR_SEX_PARTNER, Types.INTERACTION)), affordance_manager.get(get_resource_key(SimInteraction.WW_GO_TO_GROUP_SEX_DESTINATION, Types.INTERACTION)), affordance_manager.get(get_resource_key(SimInteraction.WW_GO_TO_JOIN_GROUP_SEX_DESTINATION, Types.INTERACTION)), affordance_manager.get(get_resource_key(SimInteraction.WW_GO_TO_SEX_DESTINATION, Types.INTERACTION))}
  27.     test = UserRunningInteractionTest(participant=ParticipantType.Actor, affordances=affordances, affordance_lists=list(), test_for_not_running=False, all_participants_running=False)
  28.     immutable_slots_class = make_immutable_slots_class(['test', 'tooltip'])
  29.     immutable_slots = immutable_slots_class(dict(test=test, tooltip=TunableLocalizedStringFactory._Wrapper(1181912093)))
  30.     items_list = list(PhoneTuning.DISABLE_PHONE_TESTS)
  31.     items_list.append(immutable_slots)
  32.     PhoneTuning.DISABLE_PHONE_TESTS = ListSet(items_list)
  33.  
  34. @injector(InstanceManager, 'load_data_into_class_instances')
  35. def _wickedwoohoo_load_data_and_disable_interactions(original, self, *args, **kwargs):
  36.     result = original(self, *args, **kwargs)
  37.     if self.TYPE != Types.INTERACTION:
  38.         return result
  39.     for affordance_id in ALL_SIMS_AFFORDANCE_LIST:
  40.         affordance_key = get_resource_key(affordance_id, Types.INTERACTION)
  41.         affordance_instance = self._tuned_classes.get(affordance_key)
  42.         if affordance_instance is None:
  43.             pass
  44.         while hasattr(affordance_instance, 'test_globals') and affordance_instance.test_globals:
  45.             affordance_tests_list = []
  46.             for test in affordance_instance.test_globals:
  47.                 test = get_sim_info_age_test(test, add_age=(Age(2), Age(4), Age(8), Age(16), Age(32), Age(64)))
  48.                 affordance_tests_list.append(test)
  49.             affordance_instance.test_globals = TestList(affordance_tests_list)
  50.     return result
  51.  
  52. @injector(InstanceManager, 'load_data_into_class_instances')
  53. def _wickedwoohoo_load_data_and_disable_interactions(original, self, *args, **kwargs):
  54.     result = original(self, *args, **kwargs)
  55.     if self.TYPE != Types.INTERACTION:
  56.         return result
  57.     for affordance_id in DISABLE_AFFORDANCE_LIST:
  58.         affordance_key = get_resource_key(affordance_id, Types.INTERACTION)
  59.         affordance_instance = self._tuned_classes.get(affordance_key)
  60.         if affordance_instance is None:
  61.             pass
  62.         while hasattr(affordance_instance, 'test_globals') and affordance_instance.test_globals:
  63.             affordance_tests_list = []
  64.             has_age_test = False
  65.             for test in affordance_instance.test_globals:
  66.                 if isinstance(test, SimInfoTest):
  67.                     test = create_impossible_sim_info_age_test()
  68.                     has_age_test = True
  69.                 affordance_tests_list.append(test)
  70.             if has_age_test is False:
  71.                 affordance_tests_list.append(create_impossible_sim_info_age_test())
  72.             affordance_instance.test_globals = TestList(affordance_tests_list)
  73.     return result
  74.  
  75. @injector(InstanceManager, 'load_data_into_class_instances')
  76. def _wickedwoohoo_load_data_into_nudity_buff(original, self, *args, **kwargs):
  77.     result = original(self, *args, **kwargs)
  78.     if self.TYPE != Types.BUFF:
  79.         return result
  80.     key = get_resource_key(NUDE_CLOTHING_BUFF, Types.BUFF)
  81.     buff_instance = self._tuned_classes.get(key)
  82.     if buff_instance is None:
  83.         return result
  84.     buff_instance.broadcaster = None
  85.     return result
  86.  
  87. @injector(InstanceManager, 'load_data_into_class_instances')
  88. def _wickedwoohoo_load_data_into_nudity_testsets(original, self, *args, **kwargs):
  89.     result = original(self, *args, **kwargs)
  90.     if self.TYPE != Types.SNIPPET:
  91.         return result
  92.     for snippet_id in NUDE_TEENS_TEST_SETS:
  93.         snippet_key = get_resource_key(snippet_id, Types.SNIPPET)
  94.         snippet_instance = self._tuned_classes.get(snippet_key)
  95.         if snippet_instance is None:
  96.             pass
  97.         testset_groups_list = []
  98.         for test_group in snippet_instance.test:
  99.             testset_tests_list = []
  100.             for test in test_group:
  101.                 test = get_sim_info_age_test(test, add_age=(Age(1), Age(2), Age(4), Age(8)))
  102.                 testset_tests_list.append(test)
  103.             testset_groups_list.append(tuple(testset_tests_list))
  104.         snippet_instance.test = CompoundTestList(list(testset_groups_list))
  105.     return result
  106.  
  107. @injector(InstanceManager, 'load_data_into_class_instances')
  108. def _wickedwoohoo_load_data_into_nudity_interactions(original, self, *args, **kwargs):
  109.     result = original(self, *args, **kwargs)
  110.     if self.TYPE != Types.INTERACTION:
  111.         return result
  112.     for affordance_id in NUDITY_AFFORDANCE_LIST:
  113.         affordance_key = get_resource_key(affordance_id, Types.INTERACTION)
  114.         affordance_instance = self._tuned_classes.get(affordance_key)
  115.         if affordance_instance is None:
  116.             pass
  117.         if hasattr(affordance_instance, 'test_globals') and affordance_instance.test_globals:
  118.             affordance_tests_list = []
  119.             for test in affordance_instance.test_globals:
  120.                 test = get_sim_info_age_test(test, add_age=(Age(8),))
  121.                 affordance_tests_list.append(test)
  122.             affordance_instance.test_globals = TestList(affordance_tests_list)
  123.         if hasattr(affordance_instance, 'sim_tests') and affordance_instance.sim_tests:
  124.             simtests_group_list = []
  125.             for test_group in affordance_instance.sim_tests:
  126.                 simtest_tests_list = []
  127.                 for test in test_group:
  128.                     test = get_sim_info_age_test(test, add_age=(Age(8),))
  129.                     simtest_tests_list.append(test)
  130.                 simtests_group_list.append(tuple(simtest_tests_list))
  131.             affordance_instance.sim_tests = CompoundTestList(simtests_group_list)
  132.         while hasattr(affordance_instance, 'tests') and affordance_instance.tests:
  133.             tests_group_list = []
  134.             for test_group in affordance_instance.tests:
  135.                 test_tests_list = []
  136.                 for test in test_group:
  137.                     test = get_sim_info_age_test(test, add_age=(Age(8),))
  138.                     test_tests_list.append(test)
  139.                 tests_group_list.append(tuple(test_tests_list))
  140.             affordance_instance.tests = CompoundTestList(tests_group_list)
  141.     return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement