Ejemplo n.º 1
0
def _OnStart(cause) -> None:
    if cause:
        pass

    Patcher.Patch(pregnancy_tracker.PregnancyTracker, "start_pregnancy",
                  _StartPregnancy)
    Patcher.Patch(pregnancy_tracker.PregnancyTracker, "clear_pregnancy",
                  _ClearPregnancy)

    Settings.RegisterOnUpdateCallback(_SettingsOnUpdateCallback)
Ejemplo n.º 2
0
def _OnStart(cause: LoadingShared.LoadingCauses) -> None:
    global _preload, _loggingEnabled, _writeChronological, _writeGroups, _logLevel, _logInterval

    if cause != LoadingShared.LoadingCauses.Reloading:
        Patcher.Patch(log, "debug", _Debug)
        Patcher.Patch(log.Logger, "debug", _LoggerDebug)

        Patcher.Patch(log, "info", _Info)
        Patcher.Patch(log.Logger, "info", _LoggerInfo)

        Patcher.Patch(log, "warn", _Warning)
        Patcher.Patch(log.Logger, "warn", _LoggerWarning)

        Patcher.Patch(log, "error", _Error)
        Patcher.Patch(log.Logger, "error", _LoggerError)

        Patcher.Patch(log, "exception", _Exception)

    _UpdateSettings()
    Settings.RegisterOnUpdateCallback(_UpdateSettingsCallback)

    _preload = False
    _logger.Flush()

    Reporting.RegisterReportFileCollector(_DebugLogCollector)
Ejemplo n.º 3
0
	def __init__ (self, targetObject: object, targetCallableName: str, announcementName: str, announcementCallWrapper: typing.Callable = None, limitErrors: bool = False):
		self.AnnouncementName = announcementName  # type: str
		self.AnnouncementCallWrapper = announcementCallWrapper  # type: typing.Optional[typing.Callable]
		self.LimitErrors = limitErrors  # type: bool

		def AnnouncementBeforePatch (*args, **kwargs) -> typing.Any:
			self._TriggerAnnouncement(self.AnnouncementName, True, *args, **kwargs)

		def AnnouncementAfterPatch (*args, **kwargs) -> typing.Any:
			self._TriggerAnnouncement(self.AnnouncementName, False, *args, **kwargs)

		Patcher.Patch(targetObject, targetCallableName, AnnouncementBeforePatch, patchType = Patcher.PatchTypes.Before, permanent = True)
		Patcher.Patch(targetObject, targetCallableName, AnnouncementAfterPatch, patchType = Patcher.PatchTypes.After, permanent = True)
Ejemplo n.º 4
0
def _PatchPregnancyElement() -> None:
    Patcher.Patch(pregnancy_element.PregnancyElement,
                  "_run",
                  PregnancyElementShouldDoBehaviourPatch,
                  patchType=Patcher.PatchTypes.Custom)
    Patcher.Patch(pregnancy_element.PregnancyElement,
                  "_behavior_element",
                  PregnancyElementShouldDoBehaviourPatch,
                  patchType=Patcher.PatchTypes.Custom)
    Patcher.Patch(pregnancy_element.PregnancyElement,
                  "_behavior_event_handler",
                  PregnancyElementShouldDoBehaviourPatch,
                  patchType=Patcher.PatchTypes.Custom)
    Patcher.Patch(pregnancy_element.PregnancyElement,
                  "_do_behavior",
                  PregnancyElementDoBehaviorPatch,
                  patchType=Patcher.PatchTypes.Custom)
Ejemplo n.º 5
0
def _DoCycleRemovePillFromObjectPatch() -> None:
    try:
        Patcher.Patch(SafetyBirthControlPills,
                      "RemovePillFromObject",
                      _CycleRemovePillFromObjectPatch,
                      patchType=Patcher.PatchTypes.Custom)
    except:
        Debug.Log("Could not complete Cycle remove pill from object patch.",
                  This.Mod.Namespace,
                  Debug.LogLevels.Warning,
                  group=This.Mod.Namespace,
                  owner=__name__)
Ejemplo n.º 6
0
def _DoCycleGetPillsLeftInObjectPatch() -> None:
    try:
        Patcher.Patch(SafetyBirthControlPills,
                      "GetPillsLeftInObject",
                      _CycleGetPillsLeftInObjectPatch,
                      patchType=Patcher.PatchTypes.Custom)
    except:
        Debug.Log("Could not complete Cycle get pills left in object patch.",
                  This.Mod.Namespace,
                  Debug.LogLevels.Warning,
                  group=This.Mod.Namespace,
                  owner=__name__)
Ejemplo n.º 7
0
def _DoCycleFindValidPillsObjectPatch() -> None:
    try:
        Patcher.Patch(SafetyBirthControlPills,
                      "FindValidPillsObject",
                      _CycleFindValidPillsObjectPatch,
                      patchType=Patcher.PatchTypes.Custom)
    except:
        Debug.Log("Could not complete Cycle find valid pills object patch.",
                  This.Mod.Namespace,
                  Debug.LogLevels.Warning,
                  group=This.Mod.Namespace,
                  owner=__name__)
Ejemplo n.º 8
0
 def on_affordance_loaded_callback(
         cls,
         affordance: interaction.Interaction,
         paymentElement: payment_element.PaymentElement,
         object_tuning_id=singletons.DEFAULT):
     # noinspection PyUnresolvedReferences
     paymentElementPayment = paymentElement.payment
     Patcher.Patch(paymentElementPayment,
                   "get_simoleon_delta",
                   cls._PaymentGetSimoleonDeltaPatch,
                   patchType=Patcher.PatchTypes.Custom)
     super().on_affordance_loaded_callback(
         affordance, paymentElement, object_tuning_id=object_tuning_id)
Ejemplo n.º 9
0
def _DoWickedWhimsMenstruationPatch() -> None:
    try:
        # noinspection PyUnresolvedReferences
        from wickedwhims.sex import sex_settings as WickedWhimsSexSettings
        Patcher.Patch(WickedWhimsSexSettings,
                      "update_sex_settings_to_general_save_data",
                      _WickedWhimsUpdateSexSettingsToGeneralSaveDataPatch,
                      patchType=Patcher.PatchTypes.Custom)
    except:
        Debug.Log("Could not complete WickedWhims menstruation patch.",
                  This.Mod.Namespace,
                  Debug.LogLevels.Warning,
                  group=This.Mod.Namespace,
                  owner=__name__)
Ejemplo n.º 10
0
def _DoWickedWhimsImpregnationPatch() -> None:
    try:
        # noinspection PyUnresolvedReferences
        from wickedwhims.sex.integral.sex_handlers.active_sex.helpers import pregnancy as WickedWhimsPregnancy
        Patcher.Patch(WickedWhimsPregnancy.SexInstancePregnancyHelper,
                      "_try_impregnate_sim",
                      _WickedWhimsTryImpregnateSimPatch,
                      patchType=Patcher.PatchTypes.Custom)
    except:
        Debug.Log("Could not complete WickedWhims impregnation patch.",
                  This.Mod.Namespace,
                  Debug.LogLevels.Warning,
                  group=This.Mod.Namespace,
                  owner=__name__)
Ejemplo n.º 11
0
def _DoWickedWhimsTakeBirthControlPillInteractionTestPatch() -> None:
    try:
        # noinspection PyUnresolvedReferences
        from wickedwhims.sex.pregnancy.birth_control import interactions
        Patcher.Patch(interactions.TakeBirthControlPillInteraction,
                      "on_interaction_test",
                      _WickedWhimsTakeBirthControlPillInteractionTestPatch,
                      patchType=Patcher.PatchTypes.Custom)
    except:
        Debug.Log(
            "Could not complete WickedWhims take birth control pill interaction test patch.",
            This.Mod.Namespace,
            Debug.LogLevels.Warning,
            group=This.Mod.Namespace,
            owner=__name__)
Ejemplo n.º 12
0
def _PatchPregnancyCommodity() -> None:
    pregnancyCommodity = GamePregnancyTracker.PregnancyTracker.PREGNANCY_COMMODITY_MAP.get(
        sim_info_types.Species.HUMAN,
        None)  # type: typing.Optional[typing.Type[commodity.Commodity]]

    if pregnancyCommodity is None:
        Debug.Log(
            "Went to patch the human pregnancy commodity but could not find it.",
            This.Mod.Namespace,
            Debug.LogLevels.Error,
            group=This.Mod.Namespace,
            owner=__name__)
        return

    Patcher.Patch(pregnancyCommodity,
                  "__init__",
                  _PregnancyCommodityInit,
                  patchType=Patcher.PatchTypes.After)
Ejemplo n.º 13
0
def _DoWickedWhimsTakeBirthControlPillPatch() -> None:
    try:
        # noinspection PyUnresolvedReferences
        from wickedwhims.sex.pregnancy.birth_control import pills, interactions, birth_control_handler
        Patcher.Patch(pills,
                      "take_birth_control_pill",
                      _WickedWhimsTakeBirthControlPillPatch,
                      patchType=Patcher.PatchTypes.Custom)

        interactions.take_birth_control_pill = pills.take_birth_control_pill  # Please do not directly import functions, it makes it harder to patch them. Calling "pills.take_birth_control_pill" instead of "take_birth_control_pill" is not really a big deal.
        birth_control_handler.take_birth_control_pill = pills.take_birth_control_pill
    except:
        Debug.Log(
            "Could not complete WickedWhims take birth control pill patch.",
            This.Mod.Namespace,
            Debug.LogLevels.Warning,
            group=This.Mod.Namespace,
            owner=__name__)
Ejemplo n.º 14
0
def _OnStart(cause) -> None:
    Settings.RegisterOnUpdateCallback(_SettingsOnUpdatedCallback)

    if cause != LoadingShared.LoadingCauses.Reloading:
        Patcher.Patch(GamePregnancyTracker.PregnancyTracker, "clear_pregnancy",
                      _GamePregnancyTrackerClearPregnancyPatch)
Ejemplo n.º 15
0
def _DoLocalizationCreateTokensPatch() -> None:
    Patcher.Patch(localization,
                  "create_tokens",
                  _CreateTokensPatch,
                  patchType=Patcher.PatchTypes.Custom)
Ejemplo n.º 16
0
def _DoLocalizationStringHashPatch() -> None:
    Patcher.Patch(Localization_pb2.LocalizedString,
                  "__hash__",
                  _LocalizationStringHashPatch,
                  patchType=Patcher.PatchTypes.Custom)