private void _maintainPrePregnanciesInfo() { List <Hero> heroList = new List <Hero>(); using (Dictionary <Hero, PregnancyControlBehavior.PrePregnancyInfo> .Enumerator enumerator = this.m_prePregnancyInfoMap.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <Hero, PregnancyControlBehavior.PrePregnancyInfo> current = enumerator.Current; if (!current.Key.IsDead && current.Key.IsPregnant == false) { CampaignTime pregnantDate = current.Value.m_pregnantDate; } else { heroList.Add(current.Key); } } } using (List <Hero> .Enumerator enumerator = heroList.GetEnumerator()) { while (enumerator.MoveNext()) { Hero current = enumerator.Current; this.m_prePregnancyInfoMap.Remove(current); Utillty.DebugDisplayMessage("_checkAddNewPregnancies Remove! Mother : " + ((object)current.Name).ToString()); } } }
public void DoAbortionNotificationAndLog(Hero mother, Hero causedHero) { TextObject textObject; if (mother == Hero.MainHero) { textObject = new TextObject(Utillty.ET("{=pcm_child_abortion_ntf_self}You just had an abortion."), null); } else if (mother == Hero.MainHero.Spouse) { textObject = new TextObject(Utillty.ET("{=pcm_child_abortion_ntf_spouse}Your spouse {MOTHER} just had an abortion."), null); textObject.SetTextVariable("MOTHER", (TextObject)mother.Name); } else if (mother.Clan == Clan.PlayerClan) { textObject = new TextObject(Utillty.ET("{=pcm_child_abortion_ntf_clan}Your clan member {MOTHER} just had an abortion."), null); textObject.SetTextVariable("MOTHER", (TextObject)mother.Name); } else { if (causedHero != Hero.MainHero) { return; } textObject = new TextObject(Utillty.ET("{=pcm_child_abortion_ntf_caused}{MOTHER} just had an abortion."), null); textObject.SetTextVariable("MOTHER", (TextObject)mother.Name); } InformationManager.AddQuickInformation(textObject, 0, (BasicCharacterObject)null, ""); LogEntry.AddLogEntry((LogEntry) new AbortionLogEntry(mother, causedHero), CampaignTime.Now); }
public TextObject GetEncyclopediaText() { TextObject textObject = new TextObject(Utillty.ET("{=pcm_child_abortion_log}{MOTHER.LINK} had an abortion."), null); StringHelpers.SetCharacterProperties("MOTHER", this.m_mother.CharacterObject, (TextObject)null, textObject, false); return(textObject); }
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 bool conversation_player_abortion_ask_on_condition() { Hero conversationHero = Hero.OneToOneConversationHero; TextObject empty = (TextObject)TextObject.Empty; MBTextManager.SetTextVariable("ABORTION_ASK", ((object)new TextObject(Utillty.ET("{=pcm_abor_ask_1}I don't want our unborn child anymore."), null)).ToString(), false); return(PregCampHelper.IsInPregnancies(conversationHero, Hero.MainHero) && !this.IsPreAbortion(conversationHero)); }
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); }
public void RecordPreAbortion(Hero mother, Hero caused) { if (mother == null || !PregCampHelper.IsInPregnancies(mother, (Hero)null) || this.m_preAbortionMap.ContainsKey(mother)) { return; } this.m_preAbortionMap.Add(mother, caused); Utillty.DebugDisplayMessage("_recordAbortion Success! Mother : " + ((object)mother.Name).ToString()); }
public bool conversation_player_abortion_reply_on_condition() { Hero conversationHero = Hero.OneToOneConversationHero; TextObject empty = (TextObject)TextObject.Empty; MBTextManager.SetTextVariable("ABORTION_REPLY", ((object)new TextObject(Utillty.ET("{=pcm_abor_reply_1}Ok."), null)).ToString(), false); this.RecordPreAbortion(conversationHero, Hero.MainHero); return(true); }
public static object GetHeroPregnanciesObject() { if (PregCampHelper.m_heroPregnanciesField == (FieldInfo)null) { return((object)null); } PregnancyCampaignBehavior behaviorInstance = Utillty.GetPregnancyCampaignBehaviorInstance(); return(behaviorInstance == null ? (object)null : PregCampHelper.m_heroPregnanciesField.GetValue((object)behaviorInstance)); }
private void _recordPreAbortion() { Hero curSelectedMember = UIHelper.GetCurSelectedMember(); if (curSelectedMember == null) { return; } Utillty.GetPregnancyControlBehaviorInstance()?.RecordPreAbortion(curSelectedMember, (Hero)null); }
private static void _checkNotificationOnChildConceived() { if (PregnancyChildConceivedPatch.m_mother == null || PregnancyChildConceivedPatch.m_mother == Hero.MainHero || (PregnancyChildConceivedPatch.m_mother == Hero.MainHero.Spouse || PregnancyChildConceivedPatch.m_mother.Clan == Clan.PlayerClan) || PregnancyChildConceivedPatch.m_father != Hero.MainHero) { return; } TextObject textObject = new TextObject(Utillty.ET("{=pcm_child_conceived_ntf_father}{MOTHER} has just learned that she is with your child."), null); textObject.SetTextVariable("MOTHER", (TextObject)PregnancyChildConceivedPatch.m_mother.Name); InformationManager.AddQuickInformation(textObject, 0, (BasicCharacterObject)null, ""); }
public bool conversation_player_sex_nor_ask_on_condition() { Hero mainHero = Hero.MainHero; Hero conversationHero = Hero.OneToOneConversationHero; bool flag1 = Config.Instance.EnableNotSpouseGaySex || (mainHero == conversationHero.Spouse || mainHero.IsFemale != conversationHero.IsFemale); bool sex = this.IsEnoughRealtionToSex(mainHero, conversationHero); bool flag2 = this.IsSexEnableToday(mainHero); TextObject empty = (TextObject)TextObject.Empty; MBTextManager.SetTextVariable("SEX_NOR_ASK", ((object)new TextObject(Utillty.ET("{=pcm_sex_nor_ask_1}Less talking! More f*****g!"), null)).ToString(), false); return(!conversationHero.IsWanderer & flag1 & sex & flag2); }
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 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!"); }
private void _addPregCtrlClanLayer(TutorialContextChangedEvent tccEvent) { if (tccEvent.NewContext != TutorialContexts.ClanScreen) { return; } GauntletLayer screenGauntletLayer = UIHelper.GetClanScreenGauntletLayer(); if (screenGauntletLayer == null) { return; } this.m_pregContClanVM = new PregnancyControlClanVM(); if (((List <Tuple <GauntletMovie, ViewModel> >)screenGauntletLayer._moviesAndDatasources).FindIndex((Predicate <Tuple <GauntletMovie, ViewModel> >)(obj => string.Equals(obj.Item1.MovieName, this.m_sPregCtrlClanXmlName))) >= 0) { return; } screenGauntletLayer.LoadMovie("PregnancyControlClan", (ViewModel)this.m_pregContClanVM); Utillty.DebugDisplayMessage("_addPregCtrlClanLayer Add Layer Success!"); }
public void OnClickAbortionButton() { Hero curSelectedMember = UIHelper.GetCurSelectedMember(); if (curSelectedMember == null) { return; } TextObject textObject; if (curSelectedMember == Hero.MainHero) { textObject = new TextObject(Utillty.ET("{=pcm_clan_abortion_ask_msg_self}Do you want to have an abortion?"), null); } else { textObject = new TextObject(Utillty.ET("{=pcm_clan_abortion_ask_msg_clan}Do you want {MOTHER} to have an abortion?"), null); textObject.SetTextVariable("MOTHER", (TextObject)curSelectedMember.Name); } UIHelper.InvokeHintViewModelExecuteEndHint((object)this.m_abortionHint); InformationManager.ShowInquiry(new InquiryData(((object)new TextObject("", null)).ToString(), ((object)textObject).ToString(), true, true, ((object)new TextObject(Utillty.ET("{=aeouhelq}Yes"), null)).ToString(), ((object)new TextObject(Utillty.ET("{=8OkPHu4f}No"), null)).ToString(), (Action)(() => this._recordPreAbortion()), (Action)null, ""), false); }
private static void _changeFatherInCurPregnancy() { if (PregnancyChildConceivedPatch.m_mother == null || PregnancyChildConceivedPatch.m_father == null) { return; } IEnumerable pregnanciesObject = (IEnumerable)PregCampHelper.GetHeroPregnanciesObject(); if (pregnanciesObject == null) { return; } foreach (object pregnancyObj in pregnanciesObject) { if (PregCampHelper.GetPregnancyMother(pregnancyObj) == PregnancyChildConceivedPatch.m_mother) { PregCampHelper.SetPregnancyFather(pregnancyObj, PregnancyChildConceivedPatch.m_father); Utillty.DebugDisplayMessage("_changeFatherInCurPregnancy Make Pregnant! Mother : " + ((object)PregnancyChildConceivedPatch.m_mother.Name).ToString() + " Father : " + ((object)PregnancyChildConceivedPatch.m_father.Name).ToString()); break; } } }
public void RecordPrePregnantInfo(Hero sexPartner1, Hero sexPartner2) { if ((double)MBRandom.RandomFloatRanged(0.0f, 1f) > (double)Config.Instance.PregnancyProbability || sexPartner1 == null || sexPartner2 == null || !Config.Instance.EnableLesbianPregnancy && sexPartner1.IsFemale && sexPartner2.IsFemale) { return; } Hero key = (Hero)null; Hero father = (Hero)null; if (sexPartner1.IsAlive && sexPartner1.IsFemale && (sexPartner1.IsPregnant == false && (double)sexPartner1.Age > (double)Config.Instance.MinAge)) { key = sexPartner1; father = sexPartner2; } if (sexPartner2.IsAlive && sexPartner2.IsFemale && (sexPartner2.IsPregnant == false && (double)sexPartner2.Age > (double)Config.Instance.MinAge) && (key == null || MBRandom.RandomInt(0, 1) == 0)) { key = sexPartner2; father = sexPartner1; } if (key == null || father == null) { return; } CampaignTime pregnantDate = CampaignTime.DaysFromNow((float)MBRandom.RandomInt(Config.Instance.MinPregnancyDelayDays, Config.Instance.MaxPregnancyDelayDays)); if (this.m_prePregnancyInfoMap.ContainsKey(key)) { if (this.m_prePregnancyInfoMap[key].m_pregnantDate > pregnantDate) { this.m_prePregnancyInfoMap[key].m_father = father; this.m_prePregnancyInfoMap[key].m_pregnantDate = pregnantDate; } } else { this.m_prePregnancyInfoMap.Add(key, new PregnancyControlBehavior.PrePregnancyInfo(father, pregnantDate)); } Utillty.DebugDisplayMessage("_recordPrePregnantInfo Success! Mother : " + ((object)key.Name).ToString() + " Father : " + ((object)father.Name).ToString() + " PregnantDate : " + pregnantDate.ToString()); }
public static void DoChildConceivedMethod(Hero hero) { if (hero == null) { return; } PregnancyCampaignBehavior behaviorInstance = Utillty.GetPregnancyCampaignBehaviorInstance(); if (behaviorInstance == null) { return; } MethodInfo method = typeof(PregnancyCampaignBehavior).GetMethod("ChildConceived", BindingFlags.Instance | BindingFlags.NonPublic); if (method == (MethodInfo)null) { return; } method.Invoke((object)behaviorInstance, new object[1] { (object)hero }); }
public bool conversation_player_sex_nor_reply_on_condition() { Hero mainHero = Hero.MainHero; Hero conversationHero = Hero.OneToOneConversationHero; TextObject empty = (TextObject)TextObject.Empty; TextObject textObject; if (this.IsPreAbortion(mainHero)) { textObject = new TextObject(Utillty.ET("{=pcm_sex_nor_reply_me_abor_1}You are making preparations for an abortion. Not this time."), null); } else if (this.IsPreAbortion(conversationHero)) { textObject = new TextObject(Utillty.ET("{=pcm_sex_nor_reply_sp_abor_1}I'm making preparations for an abortion. Not this time."), null); } else if ((bool)mainHero.IsPregnant) { textObject = new TextObject(Utillty.ET("{=pcm_sex_nor_reply_me_preg_1}You are pregnant. Not this time."), null); } else if ((bool)conversationHero.IsPregnant) { textObject = new TextObject(Utillty.ET("{=pcm_sex_nor_reply_sp_preg_1}I'm pregnant. Not this time."), null); } else if (!this.IsSexEnableDate(mainHero, conversationHero) || !this.IsSexEnableToday(conversationHero)) { textObject = !conversationHero.IsFemale ? new TextObject(Utillty.ET("{=pcm_sex_nor_reply_dis_ma_1}Uhhh... maybe some other time."), null) : new TextObject(Utillty.ET("{=pcm_sex_nor_reply_dis_fe_1}Not this time."), null); } else { textObject = new TextObject(Utillty.ET("{=pcm_sex_nor_reply_suc_1}A great idea my {TITLE}."), null); textObject.SetTextVariable("TITLE", Hero.MainHero.IsFemale ? "lady" : "lord"); this.RecordSexInfo(mainHero, conversationHero); this.RecordPrePregnantInfo(mainHero, conversationHero); } MBTextManager.SetTextVariable("SEX_NOR_RESP", ((object)textObject).ToString(), false); return(true); }
public void RecordSexInfo(Hero sexPartner1, Hero sexPartner2) { if (sexPartner1 == null || sexPartner1.IsDead || (sexPartner2 == null || sexPartner2.IsDead)) { return; } CampaignTime nextSexEnableDate = CampaignTime.DaysFromNow((float)MBRandom.RandomInt(Config.Instance.MinSexDelayDays, Config.Instance.MaxSexDelayDays)); if (this.m_dailySexTimeCountMap.ContainsKey(sexPartner1)) { ++this.m_dailySexTimeCountMap[sexPartner1]; } else { this.m_dailySexTimeCountMap.Add(sexPartner1, 1); } if (this.m_dailySexTimeCountMap.ContainsKey(sexPartner2)) { ++this.m_dailySexTimeCountMap[sexPartner2]; } else { this.m_dailySexTimeCountMap.Add(sexPartner2, 1); } int index = this.m_sexInformationList.FindIndex((Predicate <PregnancyControlBehavior.SexInfo>)(info => info.m_sexPartner1 == sexPartner1 && info.m_sexPartner2 == sexPartner2 || info.m_sexPartner2 == sexPartner1 && info.m_sexPartner1 == sexPartner2)); if (index >= 0) { this.m_sexInformationList[index].m_nextSexEnableDate = (this.m_sexInformationList[index].m_nextSexEnableDate >= nextSexEnableDate) ? this.m_sexInformationList[index].m_nextSexEnableDate : nextSexEnableDate; } else { this.m_sexInformationList.Add(new PregnancyControlBehavior.SexInfo(sexPartner1, sexPartner2, nextSexEnableDate)); } Utillty.DebugDisplayMessage("_recordSexInfo Success! Partner1 : " + ((object)sexPartner1.Name).ToString() + " Partner2 : " + ((object)sexPartner2.Name).ToString() + " NexSexEnableDate : " + nextSexEnableDate.ToString()); }
public static GauntletLayer GetClanScreenGauntletLayer() { GauntletClanScreen clanScreenInstance = Utillty.GetClanScreenInstance(); return(clanScreenInstance == null || UIHelper.m_clanScreenGauntletLayerField == (FieldInfo)null ? (GauntletLayer)null : UIHelper.m_clanScreenGauntletLayerField.GetValue((object)clanScreenInstance) as GauntletLayer); }
public PregnancyControlClanVM() : base() { var to = new TextObject(Utillty.ET("{=pcm_clan_abortion_button_hint}Make current selected member to have an abortion."), null); this.AbortionHint = new HintViewModel(to, (string)null); }
public static ClanManagementVM GetClanScreenClanVM() { GauntletClanScreen clanScreenInstance = Utillty.GetClanScreenInstance(); return(clanScreenInstance == null || UIHelper.m_clanScreenGauntletLayerField == (FieldInfo)null ? (ClanManagementVM)null : UIHelper.m_clanScreenClanVMField.GetValue((object)clanScreenInstance) as ClanManagementVM); }
public void CleanPreAbortionList() { this.m_preAbortionMap.Clear(); Utillty.DebugDisplayMessage("CleanPreAbortionList Success!"); }