private static void _removeAbortionMotherInHeroPregnancies(Hero hero)
        {
            if (hero == null)
            {
                return;
            }
            PregnancyControlBehavior pregnancyControlInst = Utillty.GetPregnancyControlBehaviorInstance();

            if (pregnancyControlInst == null || !pregnancyControlInst.PreAbortionMap.ContainsKey(hero))
            {
                return;
            }
            object pregnanciesObject = PregCampHelper.GetHeroPregnanciesObject();

            if (pregnanciesObject == null)
            {
                return;
            }
            MethodInfo pregnanciesMethodInfo = PregCampHelper.GetHeroPregnanciesMethodInfo("RemoveAll");

            if (pregnanciesMethodInfo == (MethodInfo)null)
            {
                return;
            }
            Predicate <object> predicate = (Predicate <object>)(pregnancyObj => PregnancyCheckOffspringsToDeliverPatch._removeAbortionMotherPredicate(ref pregnancyControlInst, hero, pregnancyObj));

            Utillty.DebugDisplayMessage("_removeAbortionMotherInHeroPregnancies Success! RemoveNums : " + ((int)pregnanciesMethodInfo.Invoke(pregnanciesObject, new object[1]
            {
                (object)predicate
            })).ToString());
            pregnancyControlInst.CleanPreAbortionList();
        }
        public static bool Prefix(PregnancyLogEntry __instance, ref bool __result)
        {
            PregnancyControlBehavior behaviorInstance = Utillty.GetPregnancyControlBehaviorInstance();
            bool flag = behaviorInstance != null && behaviorInstance.IsTimeToAddNewPregnant((Hero)__instance.Mother, Hero.MainHero);

            __result = (uint)((Config.Instance.ShowNpcPregnancyLog ? 1 : (((object)((Hero)__instance.Mother).Clan).Equals((object)Hero.MainHero.Clan) ? 1 : 0)) | (flag ? 1 : 0)) > 0U;
            return(false);
        }
Ejemplo n.º 3
0
        private bool _isShowAbortionButton()
        {
            if (!UIHelper.IsSelectedMember())
            {
                return(false);
            }
            Hero curSelectedMember = UIHelper.GetCurSelectedMember();

            if (curSelectedMember == null)
            {
                return(false);
            }
            PregnancyControlBehavior behaviorInstance = Utillty.GetPregnancyControlBehaviorInstance();

            return(behaviorInstance != null && PregCampHelper.IsInPregnancies(curSelectedMember, (Hero)null) && !behaviorInstance.IsPreAbortion(curSelectedMember));
        }
        private static bool _removeAbortionMotherPredicate(
            ref PregnancyControlBehavior pregnancyControlInst,
            Hero hero,
            object heroPregnancyObj)
        {
            if (heroPregnancyObj == null)
            {
                return(false);
            }
            Hero pregnancyMother = PregCampHelper.GetPregnancyMother(heroPregnancyObj);

            if (pregnancyMother != hero)
            {
                return(false);
            }
            pregnancyControlInst.DoAbortionNotificationAndLog(pregnancyMother, pregnancyControlInst.PreAbortionMap[pregnancyMother]);
            return(true);
        }
        private static void _getRealParentsInCurPregnancy(Hero mother)
        {
            if (mother == null)
            {
                return;
            }
            PregnancyControlBehavior behaviorInstance = Utillty.GetPregnancyControlBehaviorInstance();

            if (behaviorInstance == null)
            {
                return;
            }
            Hero fatherInCurPregnancy = behaviorInstance.GetRealFatherInCurPregnancy(mother);

            PregnancyChildConceivedPatch.m_father = fatherInCurPregnancy != mother.Spouse ? fatherInCurPregnancy : (Hero)null;
            PregnancyChildConceivedPatch.m_mother = PregnancyChildConceivedPatch.m_father != null ? mother : (Hero)null;
            Utillty.DebugDisplayMessage("_getRealParentsInCurPregnancy End!");
        }