public static float GetPregnancyProgress(this Pawn pawn) { Hediff hediff = PregnancyHelper.GetPregnancy(pawn); if (hediff is Hediff_BasePregnancy) { Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; return(h.GestationProgress); } return(-1); }
public static Pawn GetFetus(this Pawn pawn) { Hediff hediff = PregnancyHelper.GetPregnancy(pawn); if (hediff is Hediff_BasePregnancy) { Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; if (!h.babies.NullOrEmpty()) { return(h.babies.First()); } else { Log.Error("Baby not exist: baby was not created or removed. Remove pregnancy."); pawn.health.RemoveHediff(hediff); return(null); } } return(null); }
private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp) { Texture2D icon, icon_overay; string description = ""; if (Configurations.Debug) { description += comp.curStage + ": " + comp.curStageHrs + "\n" + "fertcums: " + comp.TotalFertCum + "\n" + "ovarypower: " + comp.ovarypower + "\n" + "eggs: " + comp.GetNumofEggs + "\n"; } else { description += comp.GetCurStageLabel + "\n"; } if (pawn.IsPregnant()) { Hediff hediff = PregnancyHelper.GetPregnancy(pawn); if (Utility.ShowFetusImage((Hediff_BasePregnancy)hediff)) { icon = comp.GetPregnancyIcon(hediff); if (hediff is Hediff_BasePregnancy) { Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; if (h.GestationProgress < 0.2f) { icon_overay = comp.GetCumIcon(); } else { icon_overay = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } } else { icon_overay = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } } else { icon = comp.GetWombIcon(); icon_overay = comp.GetCumIcon(); } } else { Hediff hediff = pawn.health.hediffSet.GetHediffs <Hediff_InsectEgg>().FirstOrDefault(); if (hediff != null) { icon = ContentFinder <Texture2D> .Get(("Womb/Womb_Egged"), true); icon_overay = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } else { icon = comp.GetWombIcon(); icon_overay = comp.GetCumIcon(); } } foreach (string s in comp.GetCumsInfo) { description += s + "\n"; } Color c = comp.GetCumMixtureColor; Gizmo gizmo = new Gizmo_Womb { defaultLabel = pawn.LabelShort, defaultDesc = description, icon = icon, icon_overay = icon_overay, shrinkable = Configurations.AllowShrinkIcon, cumcolor = c, comp = comp, order = 100, hotKey = VariousDefOf.OpenStatusWindowKey, action = delegate { Dialog_WombStatus.ToggleWindow(pawn, comp); } }; return(gizmo); }
public static bool Prefix(SexProps props) { xxx.rjwSextype sextype = props.sexType; Pawn pawn = props.pawn; Pawn partner = props.partner; if (sextype == xxx.rjwSextype.Vaginal) { var pawnpartBPR = Genital_Helper.get_genitalsBPR(pawn); var maleparts = Genital_Helper.get_PartsHediffList(pawn, pawnpartBPR); var partnerpartBPR = Genital_Helper.get_genitalsBPR(partner); var femaleparts = Genital_Helper.get_PartsHediffList(partner, partnerpartBPR); Pawn female = null, male = null; if (Genital_Helper.has_vagina(partner, femaleparts)) { female = partner; male = pawn; } else if (Genital_Helper.has_vagina(pawn, maleparts)) { female = pawn; femaleparts = maleparts; male = partner; maleparts = Genital_Helper.get_PartsHediffList(partner, partnerpartBPR); } else { return(true); } if (female.IsAnimal() && !Configurations.EnableAnimalCycle) { return(true); } HediffComp_Menstruation comp = female.GetMenstruationComp(); if (comp != null) { if (Genital_Helper.has_penis_fertile(male, maleparts) && PregnancyHelper.CanImpregnate(male, female, sextype)) { PregnancyHelper.Doimpregnate(male, female); return(false); } else if (Genital_Helper.has_ovipositorM(male, maleparts)) { comp.CumIn(male, Rand.Range(0.5f, 3.0f) * RJWSettings.cum_on_body_amount_adjust * male.BodySize, 1.0f); } else { comp.CumIn(male, male.GetCumVolume(maleparts), 0); } } //if (Genital_Helper.has_vagina(partner, partnerparts)) //{ // if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true; // HediffComp_Menstruation comp = Utility.GetMenstruationComp(partner); // if (comp != null) // { // if (Genital_Helper.has_penis_fertile(pawn, pawnparts) && PregnancyHelper.CanImpregnate(pawn, partner, sextype)) // { // PregnancyHelper.Doimpregnate(pawn, partner); // return false; // } // else comp.CumIn(pawn, pawn.GetCumVolume(), 0); // } //} //else if (Genital_Helper.has_vagina(pawn, pawnparts)) //{ // if (pawn.IsAnimal() && !Configurations.EnableAnimalCycle) return true; // HediffComp_Menstruation comp = Utility.GetMenstruationComp(pawn); // if (comp != null) // { // if (Genital_Helper.has_penis_fertile(partner, partnerparts) && PregnancyHelper.CanImpregnate(partner, pawn, sextype)) // { // PregnancyHelper.Doimpregnate(partner, pawn); // return false; // } // else comp.CumIn(partner, partner.GetCumVolume(), 0); // } //} } return(true); }
private void MainContents(Rect mainRect) { boxstyle.hover = boxstyle.normal; boxstyle.onHover = boxstyle.normal; boxstyle.onNormal = boxstyle.normal; buttonstyle.onHover = buttonstyle.onNormal; buttonstyle.hover = buttonstyle.normal; boxstyle.border.left = 4; boxstyle.border.right = 4; boxstyle.border.bottom = 4; boxstyle.border.top = 4; fontstyleleft.normal.textColor = Color.white; float preginfoheight = 0f; bool pregnant = pawn.IsPregnant(); Hediff hediff = PregnancyHelper.GetPregnancy(pawn); if (pregnant && Utility.ShowFetusImage((Hediff_BasePregnancy)hediff)) { womb = comp.GetPregnancyIcon(hediff); if (hediff is Hediff_MultiplePregnancy) { Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)hediff; if (h.GestationProgress < 0.2f) { cum = comp.GetCumIcon(); } else { cum = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } Pawn fetus = pawn.GetFetus(); if (fetus != null && Utility.ShowFetusInfo()) { string feinfo = h.GetBabyInfo(); string fainfo = h.GetFatherInfo() + " "; if (feinfo.Length + fainfo.Length > 45) { preginfoheight = fontheight + 2; buttonstyle.alignment = TextAnchor.UpperLeft; fontstyleright.alignment = TextAnchor.LowerRight; } else { preginfoheight = fontheight; buttonstyle.alignment = TextAnchor.MiddleLeft; } Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight); fontstyleright.normal.textColor = Color.white; GUI.Box(preginfo, feinfo, buttonstyle); GUI.Label(preginfo, fainfo, fontstyleright); } } else if (hediff is Hediff_BasePregnancy) { Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; if (h.GestationProgress < 0.2f) { cum = comp.GetCumIcon(); } else { cum = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } Pawn fetus = pawn.GetFetus(); if (fetus != null && Utility.ShowFetusInfo()) { preginfoheight = fontheight; Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight); fontstyleright.normal.textColor = Color.white; fontstyleright.alignment = TextAnchor.MiddleRight; buttonstyle.alignment = TextAnchor.MiddleLeft; GUI.Box(preginfo, h.babies.Count + " " + fetus.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle); GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + h.father.LabelShort + " ", fontstyleright); } } else { cum = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } } else { womb = comp.GetWombIcon(); cum = comp.GetCumIcon(); } Rect pawnRect = new Rect(0, 0, pawnRectWidth, pawnRectHeight); Widgets.DrawTextureFitted(pawnRect, PortraitsCache.Get(pawn, pawnRect.size, Rot4.South, default, 1, true, true, false, !naked), 1.0f);
private void MainContents(Rect mainRect) { boxstyle.hover = boxstyle.normal; boxstyle.onHover = boxstyle.normal; boxstyle.onNormal = boxstyle.normal; buttonstyle.onHover = buttonstyle.onNormal; buttonstyle.hover = buttonstyle.normal; boxstyle.border.left = 4; boxstyle.border.right = 4; boxstyle.border.bottom = 4; boxstyle.border.top = 4; fontstyleleft.normal.textColor = Color.white; float preginfoheight = 0f; bool pregnant = pawn.IsPregnant(); Hediff hediff = PregnancyHelper.GetPregnancy(pawn); if (pregnant && Utility.ShowFetusImage((Hediff_BasePregnancy)hediff)) { womb = comp.GetPregnancyIcon(hediff); if (hediff is Hediff_MultiplePregnancy) { Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)hediff; if (h.GestationProgress < 0.2f) { cum = comp.GetCumIcon(); } else { cum = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } Pawn fetus = pawn.GetFetus(); if (fetus != null && Utility.ShowFetusInfo()) { string feinfo = h.GetBabyInfo(); string fainfo = h.GetFatherInfo() + " "; if (feinfo.Length + fainfo.Length > 45) { preginfoheight = fontheight + 2; buttonstyle.alignment = TextAnchor.UpperLeft; fontstyleright.alignment = TextAnchor.LowerRight; } else { preginfoheight = fontheight; buttonstyle.alignment = TextAnchor.MiddleLeft; } Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight); fontstyleright.normal.textColor = Color.white; GUI.Box(preginfo, feinfo, buttonstyle); GUI.Label(preginfo, fainfo, fontstyleright); } } else if (hediff is Hediff_BasePregnancy) { Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; if (h.GestationProgress < 0.2f) { cum = comp.GetCumIcon(); } else { cum = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } Pawn fetus = pawn.GetFetus(); if (fetus != null && Utility.ShowFetusInfo()) { preginfoheight = fontheight; Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight); fontstyleright.normal.textColor = Color.white; fontstyleright.alignment = TextAnchor.MiddleRight; buttonstyle.alignment = TextAnchor.MiddleLeft; GUI.Box(preginfo, h.babies.Count + " " + fetus.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle); GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + h.father.LabelShort + " ", fontstyleright); } } else { cum = ContentFinder <Texture2D> .Get(("Womb/Empty"), true); } } else { womb = comp.GetWombIcon(); cum = comp.GetCumIcon(); } Rect pawnRect = new Rect(0, 0, pawnRectWidth, pawnRectHeight); Widgets.DrawTextureFitted(pawnRect, PortraitsCache.Get(pawn, pawnRect.size), 1.0f); Rect pawnLabelRect = new Rect(0, pawnRectHeight, pawnRectWidth, fontheight - 10); Rect pawnLabel2Rect = new Rect(0, pawnRectHeight + fontheight - 10, pawnRectWidth, fontheight - 10); fontstylecenter.normal.textColor = pawn.DrawColor; GUI.Label(pawnLabelRect, pawn.Name.ToStringFull, fontstylecenter); if (pawn.story != null) { GUI.Label(pawnLabel2Rect, pawn.story.Title, fontstylecenter); } GUI.color = Color.white; float wombrecth = 0; if (Configurations.DrawWombStatus) { wombrecth = wombRectHeight; cumcolor = comp.GetCumMixtureColor; Rect wombRect = new Rect(0f, mainRect.yMax - wombRectHeight + preginfoheight, wombRectWidth, wombRectWidth * 0.9f); DrawWomb(wombRect); if (Configurations.DrawEggOverlay) { comp.DrawEggOverlay(wombRect); } } Rect wombInfoRect = new Rect(0f, mainRect.yMax - wombrecth - fontheight - 2, wombRectWidth, fontheight); buttonstyle.normal.textColor = Color.white; //boxstyle.normal.background = Texture2D.whiteTexture; buttonstyle.alignment = TextAnchor.MiddleLeft; GUI.backgroundColor = new Color(0.24f, 0.29f, 0.35f, 1); GUI.Box(wombInfoRect, Translations.Dialog_WombInfo01 + ": " + comp.GetCurStageLabel, buttonstyle); GUI.color = Color.white; fontstyleright.normal.textColor = Color.red; fontstyleright.alignment = TextAnchor.MiddleRight; //if (comp.GetFertilization) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo05 + " ", fontstyleright); //else if (comp.GetEggFertilizing) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo06 + " ", fontstyleright); //else if (comp.GetEgg) GUI.Label(wombInfoRect, Translations.Dialog_WombInfo07 + " ", fontstyleright); GUI.Label(wombInfoRect, comp.GetFertilizingInfo + " ", fontstyleright); //Widgets.Label(wombInfoRect,Translations.Dialog_WombInfo01 + ": " + comp.GetCurStageLabel); Rect cumlistTitle, cumlistRect; if (Configurations.DrawVaginaStatus && !pawn.IsAnimal()) { Rect genitalRect = new Rect(pawnRectWidth + 24, pawnRectHeight + 2 * fontheight, genitalRectWidth, genitalRectHeight + fontheight * 2); Rect breastRect = new Rect(pawnRectWidth + 24, 40f, breastRectWidth, breastRectHeight + fontheight); DrawVagina(genitalRect); DrawBreast(breastRect); cumlistTitle = new Rect(wombRectWidth + 4f, 0, 150f, fontheight); cumlistRect = new Rect(wombRectWidth + 4f, fontheight, 150f, mainRect.yMax - fontheight + preginfoheight + 3); } else { cumlistTitle = new Rect(pawnRectWidth, 0, 150f, fontheight); cumlistRect = new Rect(pawnRectWidth, fontheight, 150f, mainRect.yMax - wombRectHeight - fontheight); } Rect infoRect = new Rect(0, pawnRectHeight + 2 * fontheight, pawnRectWidth, pawnRect.yMax + 2 * fontheight - wombInfoRect.y); DrawInfos(infoRect); GUI.Label(cumlistTitle, Translations.Dialog_WombInfo04); DrawCumlist(cumlistRect); }