def __call__(self, actors: typing.Tuple[sim_info.SimInfo, ...]): if len(actors) == 0: Debug.Log( "Took pill recently test received an empty actors parameter.", This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__) return results.TestResult(False) targetActor = actors[0] # type: sim_info.SimInfo targetSystem = Reproduction.GetSimSystem( targetActor) # type: ReproductionShared.ReproductiveSystem if targetSystem is None: return results.TestResult(False) targetCycleTracker = targetSystem.GetTracker( FemalesShared.CycleTrackerIdentifier) if targetCycleTracker is None: return results.TestResult(False) return results.TestResult(True)
def __call__ (self, affordance): if affordance is None: return results.TestResult(False) if not issubclass(affordance, DebugExtension): return results.TestResult(True) if not Settings.DebugMode.Get(): return results.TestResult(False) return results.TestResult(True)
def __call__(self, *args, **kwargs): if not Settings.PregnancyTestRequiresItem.Get(): return results.TestResult(True) superResults = super().__call__(*args, **kwargs) return superResults
def __call__(self, affordance): if affordance is None: return results.TestResult(False) if not issubclass(affordance, DependentExtension): return results.TestResult(True) if affordance.DependentOnMod: if affordance.DependentMod is not None: if not affordance.DependentMod.IsLoaded(): return results.TestResult( False, tooltip=DisabledTooltip.GetCallableLocalizationString( affordance.DependentMod.Namespace)) return results.TestResult(True)
def run_test(cls, event, resolver, event_data_tracker): if event not in cls.objective_test.test_events and event != TestEvent.UpdateObjectiveData: return results.TestResult( False, 'Objective test not present in event set.') if not cls.objective_completion_type.check_if_should_test(resolver): return results.TestResult( False, 'Objective completion type prevents testing this objective.') test_result = resolver(cls.objective_test, data_object=event_data_tracker.data_object, objective_guid64=cls.guid64) if test_result: additional_test_results = cls.additional_tests.run_tests(resolver) else: additional_test_results = results.TestResult.NONE return cls.objective_completion_type.increment_data( cls, resolver, event_data_tracker, test_result, additional_test_results)
def _test(cls, target, context, **interaction_parameters): attractor_points = list( services.object_manager().get_objects_with_tag_gen( cls._attractor_point_identifier)) if not attractor_points: return results.TestResult( False, 'No attractor points with tag {} found.', cls._attractor_point_identifier) return super()._test(target, context, **interaction_parameters)
def __call__(self, actors: typing.Tuple[sim_info.SimInfo, ...]): if len(actors) == 0: Debug.Log( "Has cycle tracker test recived an empty actors parameter.", This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__) return results.TestResult(False) targetSimInfo = actors[0] # type: sim_info.SimInfo targetSimSystem = Reproduction.GetSimSystem( targetSimInfo ) # type: typing.Optional[ReproductionShared.ReproductiveSystem] if targetSimSystem is None: return results.TestResult(False) return results.TestResult( targetSimSystem.HasTracker( FemalesShared.CycleTrackerIdentifier))
def _WickedWhimsTakeBirthControlPillInteractionTestPatch( originalCallable: typing.Callable, *args, **kwargs) -> typing.Union[bool, results.TestResult]: try: return results.TestResult(False) except: Debug.Log( "Failed to handle WickedWhim's take birth control pill interaction test method.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, lockIdentifier=__name__ + ":" + str(Python.GetLineNumber())) return originalCallable(*args, **kwargs)
def _WickedWhimsDisallowBirthControlPillsAutoUseInteractionTestPatch( originalCallable: typing.Callable, *args, **kwargs) -> typing.Union[bool, results.TestResult]: try: return results.TestResult(False, tooltip=DisabledBecauseCycleInstalledToolTip. GetCallableLocalizationString()) except: Debug.Log( "Failed to handle WickedWhim's disallow birth control pills auto use interaction test method.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, lockIdentifier=__name__ + ":" + str(Python.GetLineNumber())) return originalCallable(*args, **kwargs)
def increment_data(self, objective, resolver, event_data_tracker, result, additional_result): data_object = event_data_tracker.data_object if result and additional_result: zone_id = resolver.sim_info.zone_id world_id = services.get_persistence_service( ).get_world_id_from_zone(zone_id) world_desc_id = services.get_world_description_id(world_id) if world_desc_id == 0: return results.TestResult( False, 'Unable to determine world for Zone {}', zone_id) if world_desc_id is not None: data_object.add_objective_value(objective, world_id) self.on_increment_objective_data(event_data_tracker) count = data_object.get_objective_count(objective) if count < self.unique_worlds_required_to_pass: return results.TestResultNumeric( False, 'Objective: not enough matching world iterations.', current_value=count, goal_value=self.unique_worlds_required_to_pass, is_money=False) return results.TestResult.TRUE
def run_test(cls, event, resolver, objective_data=None): if event not in cls.objective_test.test_events and event != TestEvent.UpdateObjectiveData: return results.TestResult( False, 'Objective test not present in event set.') iterations_required = cls.objective_completion_type.num_required() test_result = resolver(cls.objective_test, objective_data, cls.guid64) if not test_result: if iterations_required > 1: return cls._get_current_iterations_test_result(objective_data) return test_result additional_test_results = cls.additional_tests.run_tests(resolver) if not additional_test_results: if iterations_required > 1 or isinstance( additional_test_results, results.TestResultNumeric): return cls._get_current_iterations_test_result(objective_data) return additional_test_results if not resolver.on_zone_load: return cls.objective_completion_type.increment_data( objective_data, cls.guid64, cls.objective_test, resolver) if iterations_required == 1 and isinstance(test_result, results.TestResultNumeric): test_result.result = False return test_result return cls._get_current_iterations_test_result(objective_data)
def __call__(self, affordance: typing.Type[_DotAppInteraction], actors: typing.Tuple[sim_info.SimInfo, ...]): if affordance is None: return results.TestResult(False) if not issubclass(affordance, _DotAppInteraction): return results.TestResult(False) if len(actors) == 0: Debug.Log( "Dot app state test recived an empty actors parameter.", This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__, lockIdentifier=__name__ + ":" + str(Python.GetLineNumber())) return results.TestResult(False) targetSimInfo = actors[0] # type: sim_info.SimInfo dotInformation = Dot.GetDotInformation( targetSimInfo) # type: typing.Optional[Dot.DotInformation] if dotInformation is None: Debug.Log( "Missing dot information for a sim with the id '%s'." % targetSimInfo.id, This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__, lockIdentifier=__name__ + ":" + str(Python.GetLineNumber()), lockReference=targetSimInfo) return results.TestResult(False) if affordance.RequiredDotEnabledState is None: return results.TestResult(True) else: return results.TestResult(dotInformation.Enabled == affordance.RequiredDotEnabledState)
def __call__(self, affordance: typing.Type[_ChangeUseStateInteraction], actors: typing.Tuple[sim_info.SimInfo, ...]): if affordance is None: return results.TestResult(False) if not issubclass(affordance, _ChangeUseStateInteraction): return results.TestResult(False) if len(actors) == 0: Debug.Log( "Method use test recieved an empty actors parameter.", This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__) return results.TestResult(False) if not isinstance(affordance.WoohooSafetyMethod.value, WoohooSafety.WoohooSafetyMethod): Debug.Log( "Change use state interaction value 'WoohooSafetyMethod' did not point to a valid woohoo safety method snippet.", This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__) return results.TestResult(False) if WoohooSafety.IsUsingWoohooSafetyMethod( affordance.WoohooSafetyMethod.value, actors[0]): if affordance.EnablingMethodUse: return results.TestResult(False) else: if not affordance.EnablingMethodUse: return results.TestResult(False) return results.TestResult.TRUE
def __call__(self): if Settings.ShowPurchaseContraceptivesInteractions.Get(): return results.TestResult(True) else: return results.TestResult(False)
def run_test(cls, event, resolver, event_data_tracker): return results.TestResult( False, "Objective doesn't complete utilizing tests.")
def __call__(self): return results.TestResult(False, tooltip=self.ReasonToolTip)