using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using UnityEngine; using Verse; namespace RJWSexperience { public class Configurations : ModSettings { public const float MaxInitialLustDefault = 500; public const float AvgLustDefault = 0; public const float MaxSexCountDeviationDefault = 90; public const float LustEffectPowerDefault = 0.5f; public const float SexPerYearDefault = 30; public const bool SlavesBeenRapedExpDefault = true; public const bool EnableStatRandomizerDefault = true; public const float LustLimitDefault = 500f/3f; public const float MinSexablePercentDefault = 0.2f; public const float VirginRatioDefault = 0.01f; public static float MaxLustDeviation = MaxInitialLustDefault; public static float AvgLust = AvgLustDefault; public static float MaxSexCountDeviation = MaxSexCountDeviationDefault; public static float LustEffectPower = LustEffectPowerDefault; public static float SexPerYear = SexPerYearDefault; public static bool SlavesBeenRapedExp = SlavesBeenRapedExpDefault; public static bool EnableRecordRandomizer = EnableStatRandomizerDefault; public static float LustLimit = LustLimitDefault; public static float MinSexablePercent = MinSexablePercentDefault; public static float VirginRatio = VirginRatioDefault; public static bool SelectionLocked = false; public static void ResettoDefault() { MaxLustDeviation = MaxInitialLustDefault; AvgLust = AvgLustDefault; MaxSexCountDeviation = MaxSexCountDeviationDefault; LustEffectPower = LustEffectPowerDefault; SexPerYear = SexPerYearDefault; SlavesBeenRapedExp = SlavesBeenRapedExpDefault; EnableRecordRandomizer = EnableStatRandomizerDefault; LustLimit = LustLimitDefault; MinSexablePercent = MinSexablePercentDefault; VirginRatio = VirginRatioDefault; } public override void ExposeData() { Scribe_Values.Look(ref MaxLustDeviation, "MaxLustDeviation", MaxLustDeviation, true); Scribe_Values.Look(ref AvgLust, "AvgLust", AvgLust, true); Scribe_Values.Look(ref MaxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviation, true); Scribe_Values.Look(ref LustEffectPower, "LustEffectPower", LustEffectPower, true); Scribe_Values.Look(ref SexPerYear, "SexPerYear", SexPerYear, true); Scribe_Values.Look(ref SlavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExp, true); Scribe_Values.Look(ref EnableRecordRandomizer, "EnableRecordRandomizer", EnableRecordRandomizer, true); Scribe_Values.Look(ref LustLimit, "LustLimit", LustLimit, true); Scribe_Values.Look(ref MinSexablePercent, "MinSexablePercent", MinSexablePercent, true); Scribe_Values.Look(ref VirginRatio, "VirginRatio", VirginRatio, true); Scribe_Values.Look(ref SelectionLocked, "SelectionLocked", SelectionLocked, true); base.ExposeData(); } } public class RJWSexperience : Mod { private readonly Configurations config; private static Vector2 scroll; public RJWSexperience(ModContentPack content) : base(content) { config = GetSettings(); } public override string SettingsCategory() { return Keyed.Mod_Title; } public override void DoSettingsWindowContents(Rect inRect) { int Adjuster; float fAdjuster; Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); Rect mainRect = new Rect(0f, 0f, inRect.width - 30f, inRect.height + 480f); Listing_Standard listmain = new Listing_Standard(); listmain.maxOneColumn = true; Widgets.BeginScrollView(outRect, ref scroll, mainRect); listmain.Begin(mainRect); listmain.Gap(20f); LabelwithTextfield(listmain.GetRect(24f), Keyed.Option_2_Label + " x" + Configurations.LustEffectPower, Keyed.Option_2_Desc, ref Configurations.LustEffectPower, 0f, 100f); Adjuster = (int)(Configurations.LustEffectPower * 1000); //listmain.Label(Keyed.Option_2_Label + " x" + Configurations.LustEffectPower , -1, Keyed.Option_2_Desc); Adjuster = (int)listmain.Slider(Adjuster, 0, 2000); Configurations.LustEffectPower = (float)Adjuster / 1000; fAdjuster = Configurations.LustLimit * 3; LabelwithTextfield(listmain.GetRect(24f), Keyed.Option_8_Label + " " + fAdjuster, Keyed.Option_8_Desc, ref fAdjuster, 0, 10000f); fAdjuster = (int)listmain.Slider(fAdjuster, 0, 1000); Configurations.LustLimit = fAdjuster / 3; listmain.CheckboxLabeled(Keyed.Option_1_Label, ref Configurations.EnableRecordRandomizer, Keyed.Option_1_Desc); if (Configurations.EnableRecordRandomizer) { Listing_Standard section = listmain.BeginSection(24f*13f); LabelwithTextfield(section.GetRect(24f), Keyed.Option_3_Label + " " + Configurations.MaxLustDeviation, Keyed.Option_3_Label, ref Configurations.MaxLustDeviation, 0f, 2000f); Adjuster = (int)Configurations.MaxLustDeviation; //listmain.Label(Keyed.Option_3_Label + " " + Configurations.MaxLustDeviation, -1, Keyed.Option_3_Desc); Adjuster = (int)section.Slider(Adjuster, 0, 2000); Configurations.MaxLustDeviation = Adjuster; LabelwithTextfield(section.GetRect(24f), Keyed.Option_4_Label + " " + Configurations.AvgLust, Keyed.Option_4_Desc, ref Configurations.AvgLust, -1000f, 1000f); Adjuster = (int)Configurations.AvgLust; //listmain.Label(Keyed.Option_4_Label + " " + Configurations.AvgLust, -1, Keyed.Option_4_Desc); Adjuster = (int)section.Slider(Adjuster, -1000, 1000); Configurations.AvgLust = Adjuster; LabelwithTextfield(section.GetRect(24f), Keyed.Option_5_Label + " " + Configurations.MaxSexCountDeviation, Keyed.Option_5_Desc, ref Configurations.MaxSexCountDeviation, 0f, 2000f); Adjuster = (int)Configurations.MaxSexCountDeviation; //listmain.Label(Keyed.Option_5_Label + " " + Configurations.MaxSexCountDeviation, -1, Keyed.Option_5_Desc); Adjuster = (int)section.Slider(Adjuster, 0, 2000); Configurations.MaxSexCountDeviation = Adjuster; LabelwithTextfield(section.GetRect(24f), Keyed.Option_6_Label + " " + Configurations.SexPerYear, Keyed.Option_6_Desc, ref Configurations.SexPerYear, 0f, 2000f); Adjuster = (int)Configurations.SexPerYear; //listmain.Label(Keyed.Option_6_Label + " " + Configurations.SexPerYear, -1, Keyed.Option_6_Desc); Adjuster = (int)section.Slider(Adjuster, 0, 2000); Configurations.SexPerYear = Adjuster; SliderOption(section.GetRect(48f), Keyed.Option_9_Label + " " + Configurations.MinSexablePercent*100 + "% " + ThingDefOf.Human.race.lifeExpectancy * Configurations.MinSexablePercent + "years", Keyed.Option_9_Desc, ref Configurations.MinSexablePercent, 0, 1, 1000f); SliderOption(section.GetRect(48f), Keyed.Option_10_Label + " " + Configurations.VirginRatio*100 + "%" , Keyed.Option_10_Desc, ref Configurations.VirginRatio, 0, 1, 1000f); section.CheckboxLabeled(Keyed.Option_7_Label, ref Configurations.SlavesBeenRapedExp, Keyed.Option_7_Desc); listmain.EndSection(section); } if (listmain.ButtonText("reset to default")) { Configurations.ResettoDefault(); } listmain.End(); Widgets.EndScrollView(); } public void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, float min, float max) { Rect textfieldRect = new Rect(rect.xMax - 100f, rect.y, 100f, rect.height); string valuestr = value.ToString(); Widgets.Label(rect, label); Widgets.TextFieldNumeric(textfieldRect,ref value, ref valuestr, min, max); Widgets.DrawHighlightIfMouseover(rect); TooltipHandler.TipRegion(rect, tooltip); } public void SliderOption(Rect doublerect, string label, string tooltip, ref float value, float min, float max, float division) { int Adjuster; LabelwithTextfield(doublerect.TopHalf(), label, tooltip, ref value, min, max); Adjuster = (int)(value.Normalization(min,max)*division); Adjuster = (int)Widgets.HorizontalSlider(doublerect.BottomHalf(), Adjuster, 0, division); value = (Adjuster / division).Denormalization(min,max); } } }