diff --git a/1.4/Assemblies/RJWSexperience.dll b/1.4/Assemblies/RJWSexperience.dll index abb50e2..938c28f 100644 Binary files a/1.4/Assemblies/RJWSexperience.dll and b/1.4/Assemblies/RJWSexperience.dll differ diff --git a/About/Manifest.xml b/About/Manifest.xml index 9a7693d..ddfe10f 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJWSexperience - 1.4.1.3 + 1.4.1.0
  • RimJobWorld >= 5.3.0
  • diff --git a/CHANGELOG.md b/CHANGELOG.md index 76883ce..4215777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,11 @@ -### 1.4.1.3 -* Prisoners use buckets to clean themselves - -### 1.4.1.2 -* Fixed IsVirgin check for pawns with children - -### 1.4.1.1 -* Fixed exception when pawn uses a bucket -* Marked Sex History button shrinkable and lowered its UI order - ### 1.4.1.0 + * Changed to a new versioning system. Now the first two digits are a Rimworld version, followed by the major and minor version of the mod. + ##### by Luciferus666 + * Added sex skill icons for VRE - Android and VRE - Genie + ##### by yiyuandian + * Added ChineseSimplified Translation \ No newline at end of file diff --git a/Languages/Japanese/DefInjected/HediffDef/Items_Resource_cum.xml b/Languages/Japanese/DefInjected/HediffDef/Items_Resource_cum.xml deleted file mode 100644 index dde3add..0000000 --- a/Languages/Japanese/DefInjected/HediffDef/Items_Resource_cum.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - 精液依存症 - - \ No newline at end of file diff --git a/Languages/Japanese/DefInjected/ThoughtDef/AteCum.xml b/Languages/Japanese/DefInjected/ThoughtDef/AteCum.xml deleted file mode 100644 index 530a9f5..0000000 --- a/Languages/Japanese/DefInjected/ThoughtDef/AteCum.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 精液を食べた - こんな胸が悪くなるようなものを二度と食べたくはない. - 精液を食べた - 臭くてまずいです. - 精液を食べた - 味はまずい. But I liked it. - \ No newline at end of file diff --git a/Languages/Japanese/DefInjected/TraitDef/Traits_sex.xml b/Languages/Japanese/DefInjected/TraitDef/Traits_sex.xml deleted file mode 100644 index a370f31..0000000 --- a/Languages/Japanese/DefInjected/TraitDef/Traits_sex.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - 童貞 - - 処女? - - 処女 - - - \ No newline at end of file diff --git a/Languages/Japanese/Keyed/RJW_Sexperience.xml b/Languages/Japanese/Keyed/RJW_Sexperience.xml deleted file mode 100644 index b14155d..0000000 --- a/Languages/Japanese/Keyed/RJW_Sexperience.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - RJW Sexperience - - - 合計集まった精液: - {1}は{0}の初めてを取りました - 最高のタイプ - 最近のタイプ - - {0}: {1}回 - 平均: {0} - セックス回数: - オガズム回数: - 最近の相手 - - 初めての相手 - - 最回の相手 - - 最高の相手 - - 合計セックス回数 - セックスした回数。 - 強姦: - 強姦した: - - セックス統計 - 相手リスト - セクシャリティ - レイプされた - レイプした - 種族の好み - 獣姦 - 種間 - - 死姦 - - - - - - - メイン - セックス記録 - デバッグ - - - - - - - * ゲームの再起動が必要\n\nEnables Sex History window, information collection for the said window and save/load of this information. Also enables sex partners count in pawn's records.\n\n[警告] Disabling this mid save will result in the loss of previously collected histories. - - - - - - デフォルトにリセット - - - 膣挿入 - 肛門挿入 - Oral - オナニー - 二穴挿入 - パイズリ - 手コキ - 足コキ - 手マン - シザリング - 相互オナニー - アナルフィスティング - メカノイドインプラント - アナル舐め - フェラチオ - クンニ - 69 - - - None - 無性愛者 - - 異性愛者 - - 両性愛者 - - Mostly gay - 同性愛者 - - - 性欲 - 不明 - 近親相姦 - - - 順序不同 - 最近 - 最回 - 名前 - \ No newline at end of file diff --git a/Mod Compatibility/RJW Cum/Assemblies/RJWSexperienceCum.dll b/Mod Compatibility/RJW Cum/Assemblies/RJWSexperienceCum.dll index 3a6db3d..318e183 100644 Binary files a/Mod Compatibility/RJW Cum/Assemblies/RJWSexperienceCum.dll and b/Mod Compatibility/RJW Cum/Assemblies/RJWSexperienceCum.dll differ diff --git a/Mod Compatibility/RJW Cum/Defs/ThinkTreeDefs/ThinkTree_CleanSelfWithBucket.xml b/Mod Compatibility/RJW Cum/Defs/ThinkTreeDefs/ThinkTree_CleanSelfWithBucket.xml deleted file mode 100644 index 80377be..0000000 --- a/Mod Compatibility/RJW Cum/Defs/ThinkTreeDefs/ThinkTree_CleanSelfWithBucket.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - CleanSelfWithBucket - Humanlike_PostDuty - 100 - - -
  • - true - -
  • - -
  • -
    -
    -
    -
    \ No newline at end of file diff --git a/Source/RJWSexperience/Cum/CumUtility.cs b/Source/RJWSexperience/Cum/CumUtility.cs index 1735a09..e3be0e9 100644 --- a/Source/RJWSexperience/Cum/CumUtility.cs +++ b/Source/RJWSexperience/Cum/CumUtility.cs @@ -145,15 +145,14 @@ namespace RJWSexperience.Cum if (!sexFillsCumbuckets) return; - // Enumerable throws System.InvalidOperationException: Collection was modified; enumeration operation may not execute. - List buckets = props.pawn.GetAdjacentBuildings().ToList(); + IEnumerable buckets = props.pawn.GetAdjacentBuildings(); - if (buckets?.Count > 0) + if (buckets?.EnumerableCount() > 0) { - var initialCum = GetCumVolume(props.pawn); + var initialCum = CumUtility.GetCumVolume(props.pawn); foreach (Building_CumBucket bucket in buckets) { - bucket.AddCum(initialCum / buckets.Count); + bucket.AddCum(initialCum / buckets.EnumerableCount()); } } } diff --git a/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs b/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs index f0cc1b7..aa40cfc 100644 --- a/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs +++ b/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs @@ -54,8 +54,8 @@ namespace RJWSexperience /// public static bool IsVirgin(this Pawn pawn) { - return pawn.records.GetValue(RsDefOf.Record.VaginalSexCount) == 0 && - (pawn.relations?.ChildrenCount ?? 0) < 1; // Male is a virgins unless he stick into vagina? Not sure it should work this way + return pawn.records.GetValue(RsDefOf.Record.VaginalSexCount) == 0 || + pawn.relations?.ChildrenCount > 0; // Male is a virgins unless he stick into vagina? Not sure it should work this way } /// diff --git a/Source/RJWSexperience/Patches/Rimworld_Patch.cs b/Source/RJWSexperience/Patches/Rimworld_Patch.cs index 15392a6..d00a943 100644 --- a/Source/RJWSexperience/Patches/Rimworld_Patch.cs +++ b/Source/RJWSexperience/Patches/Rimworld_Patch.cs @@ -27,25 +27,16 @@ namespace RJWSexperience [HarmonyPatch(typeof(ParentRelationUtility), nameof(ParentRelationUtility.SetMother))] public static class Rimworld_Patch_RemoveVirginOnSetMother { - /// - /// Retcon virginity if game desides to generate a child for the pawn - /// public static void Postfix(Pawn pawn, Pawn newMother) { if (!pawn.relations.DirectRelationExists(PawnRelationDefOf.Parent, newMother)) - return; // Failed to add relation? + return; Trait virgin = newMother.story?.traits?.GetTrait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleVirgin); if (virgin != null) { newMother.story.traits.RemoveTrait(virgin); - - // Player may notice the missing trait on their pawns. - // Doing this for all pawns results in up to a half of tribal raid generating with "virgin?" - if (newMother.IsColonist || newMother.IsPrisonerOfColony) - { - newMother.story.traits.GainTrait(new Trait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleAfterSurgery)); - } + newMother.story.traits.GainTrait(new Trait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleAfterSurgery)); } } } diff --git a/Source/RJWSexperience/RJWSexperience.csproj b/Source/RJWSexperience/RJWSexperience.csproj index 1dade10..2aef4a8 100644 --- a/Source/RJWSexperience/RJWSexperience.csproj +++ b/Source/RJWSexperience/RJWSexperience.csproj @@ -1,31 +1,116 @@ - + + + + Debug + AnyCPU {9C728E06-573B-4B04-A07F-ACBF60CB424D} - net472 + Library + Properties RJWSexperience RJWSexperience - ..\..\1.4\Assemblies\ - false - amevarashi - True - False + v4.7.2 + 512 + true + + + true + full + false + ..\..\Assemblies\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\1.4\Assemblies\ + TRACE + prompt + 4 + + + true - - - - 1.4.* - - - 2.* - runtime - compile; build; native; contentfiles; analyzers; buildtransitive - - - ..\..\..\rjw\1.4\Assemblies\RJW.dll False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.4.3641 + + + 2.2.2 + runtime + compile; build; native; contentfiles; analyzers; buildtransitive + + + \ No newline at end of file diff --git a/Source/RJWSexperience/RJWUtility.cs b/Source/RJWSexperience/RJWUtility.cs index 52f158e..d980f0c 100644 --- a/Source/RJWSexperience/RJWUtility.cs +++ b/Source/RJWSexperience/RJWUtility.cs @@ -3,7 +3,6 @@ using rjw; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Helpers; using rjw.Modules.Interactions.Objects; -using RJWSexperience.Logs; using System.Collections.Generic; using Verse; using Verse.AI; @@ -12,7 +11,6 @@ namespace RJWSexperience { public static class RJWUtility { - private static readonly rjw.Modules.Shared.Logs.ILog s_log = LogManager.GetLogger("RJWUtility"); /// /// For ideo patch /// @@ -157,28 +155,21 @@ namespace RJWSexperience public static Building_CumBucket FindClosestBucket(this Pawn pawn) { List buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket bucket && bucket.StoredStackCount < RsDefOf.Thing.GatheredCum.stackLimit); - if (buckets.Count == 0) - { - s_log.Message("FindClosestBucket: No buckets on the map or buckets are full"); + if (buckets.NullOrEmpty()) return null; - } Dictionary targets = new Dictionary(); for (int i = 0; i < buckets.Count; i++) { - if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.Some)) + if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None)) { targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position)); } } - if (targets.Count > 0) + if (!targets.NullOrEmpty()) { return (Building_CumBucket)targets.MinBy(x => x.Value).Key; } - else - { - s_log.Message("FindClosestBucket: No reachable buckets"); - } return null; } } diff --git a/Source/RJWSexperience/SexHistory/RecordRandomizer.cs b/Source/RJWSexperience/SexHistory/RecordRandomizer.cs index ff5eec5..b1c61f9 100644 --- a/Source/RJWSexperience/SexHistory/RecordRandomizer.cs +++ b/Source/RJWSexperience/SexHistory/RecordRandomizer.cs @@ -4,7 +4,6 @@ using Verse; using RimWorld; using UnityEngine; using RJWSexperience.Logs; -using System.Collections.Generic; namespace RJWSexperience.SexHistory { @@ -18,167 +17,137 @@ namespace RJWSexperience.SexHistory { log.Message($"Randomize request for {pawn.NameShortColored}"); - int avgSexPerYear = -500; - bool isVirgin = Rand.Chance(Settings.VirginRatio); + int avgsex = -500; + bool isvirgin = Rand.Chance(Settings.VirginRatio); + int totalsex = 0; + int totalbirth = 0; - if (isVirgin) + if (isvirgin) log.Message("Rand.Chance rolled virgin"); - if (pawn.story == null) + if (pawn.story != null) { - log.Error("Tried to randomize records for a pawn without a story"); - return false; - } - - int sexLifeYears = 0; - int minsexage = GetMinSexAge(pawn, out string errorMessage); - - if (minsexage < 0) - { - log.Error(errorMessage); - return false; - } - - log.Message($"Min sex age is {minsexage}"); - - float lust = RandomizeLust(pawn); - log.Message($"Lust set to {lust}"); - - if (pawn.ageTracker.AgeBiologicalYears > minsexage) - { - sexLifeYears = pawn.ageTracker.AgeBiologicalYears - minsexage; - avgSexPerYear = (int)(sexLifeYears * Settings.SexPerYear * LustUtility.GetLustFactor(lust)); - } - - log.Message($"Generating {sexLifeYears} years of sex life"); - log.Message($"Average sex/year: {avgSexPerYear}"); - - int totalSexCount = 0; - - if (pawn.relations != null && pawn.gender == Gender.Female) - { - // Make sure pawn had at least as much sex as ChildrenCount - // TODO: make sure the sex is vaginal - // TODO: children may be not humanlike - totalSexCount += pawn.relations.ChildrenCount; - pawn.records.AddTo(xxx.CountOfSexWithHumanlikes, pawn.relations.ChildrenCount); - pawn.records.Set(xxx.CountOfBirthHuman, pawn.relations.ChildrenCount); - - if (pawn.relations.ChildrenCount > 0) - isVirgin = false; - } - - if (!isVirgin) - { - Dictionary generatedRecords = GeneratePartnerTypeRecords(pawn, avgSexPerYear, sexLifeYears); - - foreach(KeyValuePair record in generatedRecords) + int sexableage = 0; + int minsexage = 0; + if (Settings.MinSexableFromLifestage) { - pawn.records.Set(record.Key, record.Value); - totalSexCount += record.Value; + LifeStageAge lifeStageAges = pawn.RaceProps.lifeStageAges.Find(x => x.def.reproductive); + if (lifeStageAges == null) + { + log.Message($"No reproductive life stage! {pawn.NameShortColored}'s randomization cancelled"); + return false; + } + minsexage = (int)lifeStageAges.minAge; + } + else + { + minsexage = (int)(pawn.RaceProps.lifeExpectancy * Settings.MinSexablePercent); } - if (totalSexCount > 0) - pawn.records.AddTo(RsDefOf.Record.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7))); - } + log.Message($"Min sex age is {minsexage}"); - pawn.records.Set(xxx.CountOfSex, totalSexCount); - log.Message($"Splitting {totalSexCount} sex acts between sex types"); - GenerateSextypeRecords(pawn, totalSexCount); + float lust = RandomizeLust(pawn); + log.Message($"Lust set to {lust}"); + + if (pawn.ageTracker.AgeBiologicalYears > minsexage) + { + sexableage = pawn.ageTracker.AgeBiologicalYears - minsexage; + avgsex = (int)(sexableage * Settings.SexPerYear * LustUtility.GetLustFactor(lust)); + } + + log.Message($"Generating {sexableage} years of sex life"); + log.Message($"Average sex/year: {avgsex}"); + + if (pawn.relations != null && pawn.gender == Gender.Female) + { + totalbirth += pawn.relations.ChildrenCount; + totalsex += totalbirth; + pawn.records?.AddTo(xxx.CountOfSexWithHumanlikes, totalbirth); + pawn.records?.SetTo(xxx.CountOfBirthHuman, totalbirth); + if (totalbirth > 0) isvirgin = false; + } + if (!isvirgin) + { + totalsex += GeneratePartnerTypeRecords(pawn, avgsex); + + if (Settings.SlavesBeenRapedExp && pawn.IsSlave) + { + totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByAnimals, Rand.Range(-50, 10), Rand.Range(0, 10) * sexableage); + totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByHumanlikes, 0, Rand.Range(0, 100) * sexableage); + } + } + } + pawn.records?.SetTo(xxx.CountOfSex, totalsex); + log.Message($"Splitting {totalsex} sex acts between sex types"); + GenerateSextypeRecords(pawn, totalsex); log.Message($"{pawn.NameShortColored} randomized"); return true; } - /// - /// Assign a new random value to the Lust record of the - /// - /// - /// Assigned value public static float RandomizeLust(Pawn pawn) { float value = Utility.RandGaussianLike(Settings.AvgLust - Settings.MaxLustDeviation, Settings.AvgLust + Settings.MaxLustDeviation); + float minValue; if (xxx.is_nympho(pawn)) - value = Mathf.Clamp(value, 0, float.MaxValue); + minValue = 0; + else + minValue = float.MinValue; - pawn.records.SetTo(RsDefOf.Record.Lust, value); + value = Mathf.Clamp(value, minValue, float.MaxValue); + float recordvalue = pawn.records.GetValue(RsDefOf.Record.Lust); + pawn.records.AddTo(RsDefOf.Record.Lust, value - recordvalue); return value; } - /// - /// Get minimal biological age the pawn can begin sex life - /// - /// - /// null if no error - /// -1 means error. should be not null in that case - private static int GetMinSexAge(Pawn pawn, out string errorMessage) + private static int RandomizeRecord(Pawn pawn, RecordDef record, int avg, int dist, int min = 0, int max = int.MaxValue) { - errorMessage = null; + int value = (int)Mathf.Clamp(Utility.RandGaussianLike(avg - dist, avg + dist), min, max); + int recordvalue = pawn.records.GetAsInt(record); + pawn.records.AddTo(record, value - recordvalue); - if (!Settings.MinSexableFromLifestage) - { - // Legacy approach. Does not account for long-lived races with human-like aging curve - return (int)(pawn.RaceProps.lifeExpectancy * Settings.MinSexablePercent); - } - - LifeStageAge lifeStageAges = pawn.RaceProps.lifeStageAges.Find(x => x.def.reproductive); - if (lifeStageAges == null) - { - errorMessage = $"No reproductive life stage! {pawn.NameShortColored}'s randomization cancelled"; - return -1; - } - return (int)lifeStageAges.minAge; + return value; } - private static int Randomize(int avg, int dist, int min = 0, int max = int.MaxValue) => (int)Mathf.Clamp(Utility.RandGaussianLike(avg - dist, avg + dist), min, max); - - private static Dictionary GeneratePartnerTypeRecords(Pawn pawn, int avgSexPerYear, int sexLifeYears) + private static int GeneratePartnerTypeRecords(Pawn pawn, int avgsex) { - Dictionary generatedRecords = new Dictionary(); int deviation = (int)Settings.MaxSexCountDeviation; + int totalSexCount = 0; if (xxx.is_rapist(pawn)) { if (xxx.is_zoophile(pawn)) { - if (pawn.Has(Quirk.ChitinLover)) - generatedRecords.Add(xxx.CountOfRapedInsects, Randomize(avgSexPerYear, deviation)); - else - generatedRecords.Add(xxx.CountOfRapedAnimals, Randomize(avgSexPerYear, deviation)); + if (pawn.Has(Quirk.ChitinLover)) totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation); + else totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedAnimals, avgsex, deviation); } else { - generatedRecords.Add(xxx.CountOfRapedHumanlikes, Randomize(avgSexPerYear, deviation)); + totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedHumanlikes, avgsex, deviation); } - avgSexPerYear /= 8; + avgsex /= 8; } if (xxx.is_zoophile(pawn)) { - if (pawn.Has(Quirk.ChitinLover)) - generatedRecords.Add(xxx.CountOfRapedInsects, Randomize(avgSexPerYear, deviation)); - else - generatedRecords.Add(xxx.CountOfSexWithAnimals, Randomize(avgSexPerYear, deviation)); - - avgSexPerYear /= 10; + if (pawn.Has(Quirk.ChitinLover)) totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation); + else totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithAnimals, avgsex, deviation); + avgsex /= 10; } else if (xxx.is_necrophiliac(pawn)) { - generatedRecords.Add(xxx.CountOfSexWithCorpse, Randomize(avgSexPerYear, deviation)); - avgSexPerYear /= 4; + totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithCorpse, avgsex, deviation); + avgsex /= 4; } - generatedRecords.Add(xxx.CountOfSexWithHumanlikes, Randomize(avgSexPerYear, deviation)); + totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithHumanlikes, avgsex, deviation); - if (Settings.SlavesBeenRapedExp && pawn.IsSlave) - { - generatedRecords.Add(xxx.CountOfBeenRapedByAnimals, Randomize(Rand.Range(-50, 10), Rand.Range(0, 10) * sexLifeYears)); - generatedRecords.Add(xxx.CountOfBeenRapedByHumanlikes, Randomize(0, Rand.Range(0, 100) * sexLifeYears)); - } + if (totalSexCount > 0) + pawn.records.AddTo(RsDefOf.Record.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7))); - return generatedRecords; + return totalSexCount; } private static void GenerateSextypeRecords(Pawn pawn, int totalsex) @@ -269,7 +238,10 @@ namespace RJWSexperience.SexHistory if (xxx.is_homosexual(pawn)) return pawn.gender; - return pawn.gender.Opposite(); + if (pawn.gender == Gender.Male) + return Gender.Female; + else + return Gender.Male; } } } diff --git a/Source/RJWSexperience/SexHistory/SexHistoryComp.cs b/Source/RJWSexperience/SexHistory/SexHistoryComp.cs index 5d5c893..a78a904 100644 --- a/Source/RJWSexperience/SexHistory/SexHistoryComp.cs +++ b/Source/RJWSexperience/SexHistory/SexHistoryComp.cs @@ -429,8 +429,6 @@ namespace RJWSexperience.SexHistory icon = HistoryUtility.HistoryIcon, defaultIconColor = HistoryUtility.HistoryColor, hotKey = RsDefOf.KeyBinding.OpenSexStatistics, - shrinkable = true, - Order = 5, action = () => UI.SexStatusWindow.ToggleWindow(this) }; } diff --git a/Source/RJWSexperience/SexHistory/UI/BarInfo.cs b/Source/RJWSexperience/SexHistory/UI/BarInfo.cs index 67cf348..b03341b 100644 --- a/Source/RJWSexperience/SexHistory/UI/BarInfo.cs +++ b/Source/RJWSexperience/SexHistory/UI/BarInfo.cs @@ -3,49 +3,33 @@ using Verse; namespace RJWSexperience.SexHistory.UI { - public class BarInfo + public readonly struct BarInfo { - private string _label; - private float _fillPercent; - private string _labelRight; + public readonly string label; + public readonly float fillPercent; + public readonly Texture2D fillTexture; + public readonly TipSignal tooltip; + public readonly string labelRight; + public readonly Texture2D border; - public string Label + public BarInfo(string label, float fillPercent, Texture2D fillTexture, TipSignal tooltip, string labelRight = "", Texture2D border = null) { - get => _label; - set => _label = value.CapitalizeFirst(); - } - public float FillPercent - { - get => _fillPercent; - set => _fillPercent = Mathf.Clamp01(value); - } - public Texture2D FillTexture { get; set; } - public TipSignal Tooltip { get; set; } - public string LabelRight - { - get => _labelRight; - set => _labelRight = value.CapitalizeFirst(); - } - public Texture2D Border { get; set; } - - public BarInfo() - { - _label = ""; - _fillPercent = 0f; - FillTexture = Texture2D.grayTexture; - Tooltip = default; - _labelRight = ""; - Border = null; + this.label = label.CapitalizeFirst(); + this.fillPercent = Mathf.Clamp01(fillPercent); + this.fillTexture = fillTexture; + this.tooltip = tooltip; + this.labelRight = labelRight.CapitalizeFirst(); + this.border = border; } - public BarInfo(Texture2D fillTexture) + public BarInfo(string label, float fillPercent, Texture2D fillTexture, string labelRight = "") { - _label = ""; - _fillPercent = 0f; - FillTexture = fillTexture; - Tooltip = default; - _labelRight = ""; - Border = null; + this.label = label.CapitalizeFirst(); + this.fillPercent = Mathf.Clamp01(fillPercent); + this.fillTexture = fillTexture; + this.tooltip = default; + this.labelRight = labelRight.CapitalizeFirst(); + this.border = null; } } } diff --git a/Source/RJWSexperience/SexHistory/UI/InfoCard.cs b/Source/RJWSexperience/SexHistory/UI/InfoCard.cs index 1755891..108305e 100644 --- a/Source/RJWSexperience/SexHistory/UI/InfoCard.cs +++ b/Source/RJWSexperience/SexHistory/UI/InfoCard.cs @@ -1,93 +1,86 @@ using RimWorld; using rjw; +using System; using UnityEngine; using Verse; namespace RJWSexperience.SexHistory.UI { - public class InfoCard + public readonly struct InfoCard { - private readonly Pawn _pawn; - private readonly string _tooltipLabel; + public readonly SexPartnerHistoryRecord partnerRecord; + public readonly string label; + public readonly string lastSexTime; + public readonly string name; + public readonly string sexCount; + public readonly string orgasms; + public readonly string relations; + public readonly BarInfo bestSextype; + public readonly PartnerPortraitInfo portraitInfo; + public readonly TipSignal tooltip; - public string Label { get; } - public string LastSexTime { get; set; } - public string Name { get; private set; } - public string SexCount { get; private set; } - public string Orgasms { get; private set; } - public string Relations { get; private set; } - public BarInfo BestSextype { get; } - public SexPartnerHistoryRecord PartnerRecord { get; private set; } - public PartnerPortraitInfo PortraitInfo { get; } - public TipSignal Tooltip { get; private set; } - - public InfoCard(Pawn pawn, string label, string tooltipLabel) + public InfoCard(Pawn pawn, SexPartnerHistoryRecord partnerRecord, string label, string tooltipLabel, int lastSexTimeTicks) { - Label = label; - _pawn = pawn; - _tooltipLabel = tooltipLabel; - BestSextype = new BarInfo(); - PortraitInfo = new PartnerPortraitInfo(_pawn); - } + this.partnerRecord = partnerRecord; + this.label = label; - public void UpdatePartnerRecord(SexPartnerHistoryRecord partnerRecord) - { - PartnerRecord = partnerRecord; - PortraitInfo.UpdatePartnerRecord(partnerRecord); + lastSexTime = UIUtility.GetSexDays(lastSexTimeTicks); + portraitInfo = new PartnerPortraitInfo(pawn, partnerRecord); - if (partnerRecord == null) + if (partnerRecord != null) { - Name = Keyed.Unknown; - SexCount = Keyed.RS_Sex_Count + "?"; - Orgasms = Keyed.RS_Orgasms + "?"; - Relations = string.Empty; - Tooltip = default; + name = partnerRecord.Partner?.Name?.ToStringFull ?? partnerRecord.Label.CapitalizeFirst(); + sexCount = Keyed.RS_Sex_Count + partnerRecord.TotalSexCount; - BestSextype.Label = Keyed.RS_Best_Sextype + ": " + Keyed.Sextype[(int)xxx.rjwSextype.None]; - BestSextype.FillPercent = 0f; - BestSextype.FillTexture = Texture2D.linearGrayTexture; - BestSextype.LabelRight = ""; - return; - } - - Name = partnerRecord.Partner?.Name?.ToStringFull ?? partnerRecord.Label.CapitalizeFirst(); - SexCount = Keyed.RS_Sex_Count + partnerRecord.TotalSexCount; - - if (partnerRecord.Raped > 0) - { - SexCount += " " + Keyed.RS_Raped + partnerRecord.Raped; - } - if (partnerRecord.RapedMe > 0) - { - SexCount += " " + Keyed.RS_RapedMe + partnerRecord.RapedMe; - } - - Orgasms = Keyed.RS_Orgasms + partnerRecord.OrgasmCount; - Relations = _pawn.GetRelationsString(partnerRecord.Partner); - Tooltip = new TipSignal(() => - { - string completeTip = _tooltipLabel; - - if (partnerRecord.Incest) + if (partnerRecord.Raped > 0) { - completeTip += " - " + Keyed.Incest; + sexCount += " " + Keyed.RS_Raped + partnerRecord.Raped; } - if (partnerRecord.IamFirst) + if (partnerRecord.RapedMe > 0) { - completeTip += "\n" + Keyed.RS_LostVirgin(partnerRecord.Label, _pawn.LabelShort); + sexCount += " " + Keyed.RS_RapedMe + partnerRecord.RapedMe; } - if (partnerRecord.BestSexTickAbs != 0) - { - completeTip += "\n" + Keyed.RS_HadBestSexDaysAgo(partnerRecord.BestSexElapsedTicks.ToStringTicksToDays() + " " + Keyed.RS_Ago); - } - return completeTip; - }, _tooltipLabel.GetHashCode()); - float relativeBestSatisfaction = partnerRecord.BestSatisfaction / UIUtility.BASESAT; - BestSextype.Label = Keyed.RS_Best_Sextype + ": " + Keyed.Sextype[(int)partnerRecord.BestSextype]; - BestSextype.FillPercent = relativeBestSatisfaction / 2; - BestSextype.FillTexture = HistoryUtility.SextypeColor[(int)partnerRecord.BestSextype]; - BestSextype.LabelRight = relativeBestSatisfaction.ToStringPercent(); + orgasms = Keyed.RS_Orgasms + partnerRecord.OrgasmCount; + relations = pawn.GetRelationsString(partnerRecord.Partner); + tooltip = new TipSignal(() => + { + string completeTip = tooltipLabel; + + if (partnerRecord.Incest) + { + completeTip += " - " + Keyed.Incest; + } + if (partnerRecord.IamFirst) + { + completeTip += "\n" + Keyed.RS_LostVirgin(partnerRecord.Label, pawn.LabelShort); + } + if (partnerRecord.BestSexTickAbs != 0) + { + completeTip += "\n" + Keyed.RS_HadBestSexDaysAgo(partnerRecord.BestSexElapsedTicks.ToStringTicksToDays() + " " + Keyed.RS_Ago); + } + return completeTip; + }, tooltipLabel.GetHashCode()); + + float relativeBestSatisfaction = partnerRecord.BestSatisfaction / UIUtility.BASESAT; + bestSextype = new BarInfo( + label: Keyed.RS_Best_Sextype + ": " + Keyed.Sextype[(int)partnerRecord.BestSextype], + fillPercent: relativeBestSatisfaction / 2, + fillTexture: HistoryUtility.SextypeColor[(int)partnerRecord.BestSextype], + labelRight: relativeBestSatisfaction.ToStringPercent()); + } + else + { + name = Keyed.Unknown; + sexCount = Keyed.RS_Sex_Count + "?"; + orgasms = Keyed.RS_Orgasms + "?"; + relations = string.Empty; + tooltip = default; + bestSextype = new BarInfo( + label: String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)xxx.rjwSextype.None]), + fillPercent: 0f, + fillTexture: Texture2D.linearGrayTexture); + } } } } diff --git a/Source/RJWSexperience/SexHistory/UI/PartnerPortraitInfo.cs b/Source/RJWSexperience/SexHistory/UI/PartnerPortraitInfo.cs index e604cc4..2de32de 100644 --- a/Source/RJWSexperience/SexHistory/UI/PartnerPortraitInfo.cs +++ b/Source/RJWSexperience/SexHistory/UI/PartnerPortraitInfo.cs @@ -5,43 +5,29 @@ using Verse; namespace RJWSexperience.SexHistory.UI { - public class PartnerPortraitInfo + public readonly struct PartnerPortraitInfo { - private readonly Pawn _pawn; - - public SexPartnerHistoryRecord PartnerRecord { get; private set; } - public bool Lover { get; private set; } - public Func PortraitGetter { get; private set; } - - public PartnerPortraitInfo(Pawn pawn) - { - _pawn = pawn; - } + public readonly SexPartnerHistoryRecord partnerRecord; + public readonly bool lover; + public readonly Func portraitGetter; public PartnerPortraitInfo(Pawn pawn, SexPartnerHistoryRecord partnerRecord) { - _pawn = pawn; - UpdatePartnerRecord(partnerRecord); - } - - public void UpdatePartnerRecord(SexPartnerHistoryRecord partnerRecord) - { - PartnerRecord = partnerRecord; + this.partnerRecord = partnerRecord; + lover = false; if (partnerRecord?.Partner != null) { - PortraitGetter = (size) => PortraitsCache.Get(partnerRecord.Partner, size, Rot4.South, default, 1, true, true, false, false); - Lover = LovePartnerRelationUtility.LovePartnerRelationExists(_pawn, partnerRecord.Partner); + portraitGetter = (size) => PortraitsCache.Get(partnerRecord.Partner, size, Rot4.South, default, 1, true, true, false, false); + lover = LovePartnerRelationUtility.LovePartnerRelationExists(pawn, partnerRecord.Partner); } else if (partnerRecord?.Race?.uiIcon != null) { - PortraitGetter = (_) => partnerRecord.Race.uiIcon; - Lover = false; + portraitGetter = (_) => partnerRecord.Race.uiIcon; } else { - PortraitGetter = (_) => HistoryUtility.UnknownPawn; - Lover = false; + portraitGetter = (_) => HistoryUtility.UnknownPawn; } } } diff --git a/Source/RJWSexperience/SexHistory/UI/PreferedRaceCard.cs b/Source/RJWSexperience/SexHistory/UI/PreferedRaceCard.cs index c9dffb7..65d9e74 100644 --- a/Source/RJWSexperience/SexHistory/UI/PreferedRaceCard.cs +++ b/Source/RJWSexperience/SexHistory/UI/PreferedRaceCard.cs @@ -3,58 +3,53 @@ using UnityEngine; namespace RJWSexperience.SexHistory.UI { - public class PreferedRaceCard + public readonly struct PreferedRaceCard { - private readonly SexHistoryComp _sexHistory; - - public string PreferRaceLabel { get; private set; } - public string PreferRaceTypeLabel { get; private set; } - public string SexCount { get; private set; } - public BarInfo BarInfo { get; } = new BarInfo(Texture2D.linearGrayTexture); - public Func PortraitGetter { get; private set; } + public readonly string preferRaceLabel; + public readonly string preferRaceTypeLabel; + public readonly string sexCount; + public readonly BarInfo? barInfo; + public readonly Func portraitGetter; public PreferedRaceCard(SexHistoryComp sexHistory) { - _sexHistory = sexHistory; - } - - public void Update() - { - if (_sexHistory.PreferRace == null) + if (sexHistory.PreferRace == null) { - PreferRaceLabel = Keyed.None; - PreferRaceTypeLabel = null; - SexCount = null; - BarInfo.Label = null; - BarInfo.FillPercent = 0f; - PortraitGetter = (_) => HistoryUtility.UnknownPawn; + preferRaceLabel = Keyed.None; + preferRaceTypeLabel = null; + sexCount = null; + barInfo = null; + portraitGetter = (_) => HistoryUtility.UnknownPawn; return; } - PreferRaceLabel = _sexHistory.PreferRace.LabelCap; - SexCount = Keyed.RS_Sex_Count + _sexHistory.PreferRaceSexCount; - PortraitGetter = (size) => UIUtility.GetRaceIcon(_sexHistory.PreferRacePawn, size); + preferRaceLabel = sexHistory.PreferRace.LabelCap; + sexCount = Keyed.RS_Sex_Count + sexHistory.PreferRaceSexCount; + portraitGetter = (size) => UIUtility.GetRaceIcon(sexHistory.PreferRacePawn, size); - if (_sexHistory.PreferRace != _sexHistory.ParentPawn.def) + if (sexHistory.PreferRace != sexHistory.ParentPawn.def) { - if (_sexHistory.PreferRace.race.Animal != _sexHistory.ParentPawn.def.race.Animal) + if (sexHistory.PreferRace.race.Animal != sexHistory.ParentPawn.def.race.Animal) { - PreferRaceTypeLabel = Keyed.RS_Bestiality; - BarInfo.Label = Keyed.RS_SexInfo(Keyed.RS_Bestiality, _sexHistory.BestialityCount); - BarInfo.FillPercent = _sexHistory.BestialityCount / 100f; + preferRaceTypeLabel = Keyed.RS_Bestiality; + barInfo = new BarInfo( + label: Keyed.RS_SexInfo(Keyed.RS_Bestiality, sexHistory.BestialityCount), + fillPercent: sexHistory.BestialityCount / 100f, + fillTexture: Texture2D.linearGrayTexture); } else { - PreferRaceTypeLabel = Keyed.RS_Interspecies; - BarInfo.Label = Keyed.RS_SexInfo(Keyed.RS_Interspecies, _sexHistory.InterspeciesCount); - BarInfo.FillPercent = _sexHistory.InterspeciesCount / 100f; + preferRaceTypeLabel = Keyed.RS_Interspecies; + barInfo = new BarInfo( + label: Keyed.RS_SexInfo(Keyed.RS_Interspecies, sexHistory.InterspeciesCount), + fillPercent: sexHistory.InterspeciesCount / 100f, + fillTexture: Texture2D.linearGrayTexture); } } else { - PreferRaceTypeLabel = null; - BarInfo.Label = null; - BarInfo.FillPercent = 0f; + preferRaceTypeLabel = null; + barInfo = null; } } } diff --git a/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs b/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs index e2b0079..e7b3538 100644 --- a/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs +++ b/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs @@ -1,5 +1,6 @@ using RimWorld; using rjw; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -48,43 +49,27 @@ namespace RJWSexperience.SexHistory.UI { AgeAndTitle = Pawn.ageTracker.AgeBiologicalYears + ", " + Pawn.def.label; } - - for (int i = 0; i < Sextype.Length; i++) - { - int sexIndex = Sextype[i]; - SexTypes.Add(new BarInfo(HistoryUtility.SextypeColor[sexIndex])); - } - - InfoCards.Add(new InfoCard(Pawn, Keyed.RS_Recent_Sex_Partner, Keyed.RS_Recent_Sex_Partner_ToolTip)); - InfoCards.Add(new InfoCard(Pawn, Keyed.RS_First_Sex_Partner, Keyed.RS_First_Sex_Partner_ToolTip)); - InfoCards.Add(new InfoCard(Pawn, Keyed.RS_Most_Sex_Partner, Keyed.RS_Most_Sex_Partner_ToolTip)); - InfoCards.Add(new InfoCard(Pawn, Keyed.RS_Best_Sex_Partner, Keyed.RS_Best_Sex_Partner_ToolTip)); - - SelectedPartnerCard = new InfoCard(Pawn, Keyed.RS_Selected_Partner, Keyed.RS_Selected_Partner); - PreferedRaceCard = new PreferedRaceCard(_history); } public Pawn Pawn => _history.ParentPawn; public string Name { get; } public string AgeAndTitle { get; } public List InfoCards { get; } = new List(); - public InfoCard SelectedPartnerCard { get; } - public PreferedRaceCard PreferedRaceCard { get; } + public InfoCard SelectedPartnerCard { get; private set; } + public PreferedRaceCard PreferedRaceCard { get; private set; } public List SexTypes { get; } = new List(); - public BarInfo PartnerCount { get; } = new BarInfo(HistoryUtility.Partners); - public BarInfo VirginsTaken { get; } = new BarInfo(HistoryUtility.Partners); - public BarInfo TotalSex { get; } = new BarInfo(HistoryUtility.TotalSex); - public BarInfo Lust { get; } = new BarInfo(HistoryUtility.Slaanesh); - public BarInfo BestSextype { get; } = new BarInfo(); - public BarInfo RecentSextype { get; } = new BarInfo(); - public BarInfo Necro { get; } = new BarInfo(HistoryUtility.Nurgle); - public BarInfo Incest { get; } = new BarInfo(HistoryUtility.Nurgle); - public BarInfo ConsumedCum { get; } = new BarInfo(Texture2D.linearGrayTexture); - public BarInfo CumHediff { get; } = new BarInfo(Texture2D.linearGrayTexture); - public BarInfo BeenRaped { get; } = new BarInfo(Texture2D.grayTexture); - public BarInfo Raped { get; } = new BarInfo(HistoryUtility.Khorne); - public BarInfo SexSatisfaction { get; } = new BarInfo(HistoryUtility.Satisfaction); - public BarInfo SexSkill { get; } = new BarInfo(HistoryUtility.Tzeentch); + public BarInfo TotalSex { get; private set; } + public BarInfo Lust { get; private set; } + public BarInfo BestSextype { get; private set; } + public BarInfo RecentSextype { get; private set; } + public BarInfo Necro { get; private set; } + public BarInfo Incest { get; private set; } + public BarInfo ConsumedCum { get; private set; } + public BarInfo? CumHediff { get; private set; } + public BarInfo BeenRaped { get; private set; } + public BarInfo Raped { get; private set; } + public BarInfo SexSatisfaction { get; private set; } + public BarInfo SexSkill { get; private set; } public string VirginLabel { get; private set; } public string SexualityLabel { get; private set; } public string QuirksLabel { get; private set; } @@ -103,7 +88,7 @@ namespace RJWSexperience.SexHistory.UI UpdateBars(); UpdateQuirks(); UpdateVirginAndSexuality(); - PreferedRaceCard.Update(); + PreferedRaceCard = new PreferedRaceCard(_history); int tickRateMultiplier = (int)Find.TickManager.TickRateMultiplier; if (tickRateMultiplier == 0) // Paused @@ -117,21 +102,35 @@ namespace RJWSexperience.SexHistory.UI private void UpdateInfoCards() { - InfoCard recentSexPartner = InfoCards[0]; - recentSexPartner.LastSexTime = UIUtility.GetSexDays(_history.RecentSexTickAbs); - recentSexPartner.UpdatePartnerRecord(_history.RecentPartnerRecord); + InfoCards.Clear(); - InfoCard firstSexPartner = InfoCards[1]; - firstSexPartner.LastSexTime = UIUtility.GetSexDays(_history.FirstSexTickAbs); - firstSexPartner.UpdatePartnerRecord(_history.FirstPartnerRecord); + InfoCards.Add(new InfoCard( + pawn: Pawn, + partnerRecord: _history.RecentPartnerRecord, + label: Keyed.RS_Recent_Sex_Partner, + tooltipLabel: Keyed.RS_Recent_Sex_Partner_ToolTip, + lastSexTimeTicks: _history.RecentSexTickAbs)); - InfoCard mostSexPartner = InfoCards[2]; - mostSexPartner.LastSexTime = UIUtility.GetSexDays(_history.MostSexTickAbs); - mostSexPartner.UpdatePartnerRecord(_history.MostPartnerRecord); + InfoCards.Add(new InfoCard( + pawn: Pawn, + partnerRecord: _history.FirstPartnerRecord, + label: Keyed.RS_First_Sex_Partner, + tooltipLabel: Keyed.RS_First_Sex_Partner_ToolTip, + lastSexTimeTicks: _history.FirstSexTickAbs)); - InfoCard bestSexPartner = InfoCards[3]; - bestSexPartner.LastSexTime = UIUtility.GetSexDays(_history.BestSexTickAbs); - bestSexPartner.UpdatePartnerRecord(_history.BestSexPartnerRecord); + InfoCards.Add(new InfoCard( + pawn: Pawn, + partnerRecord: _history.MostPartnerRecord, + label: Keyed.RS_Most_Sex_Partner, + tooltipLabel: Keyed.RS_Most_Sex_Partner_ToolTip, + lastSexTimeTicks: _history.MostSexTickAbs)); + + InfoCards.Add(new InfoCard( + pawn: Pawn, + partnerRecord: _history.BestSexPartnerRecord, + label: Keyed.RS_Best_Sex_Partner, + tooltipLabel: Keyed.RS_Best_Sex_Partner_ToolTip, + lastSexTimeTicks: _history.BestSexTickAbs)); if (SelectedPartner != null) { @@ -147,102 +146,124 @@ namespace RJWSexperience.SexHistory.UI maxSatisfaction = UIUtility.BASESAT; } + SexTypes.Clear(); + for (int i = 0; i < Sextype.Length; i++) { int sexIndex = Sextype[i]; float AverageSatisfaction = _history.GetAVGSat(sexIndex); float relativeSat = AverageSatisfaction / maxSatisfaction; float satisfactionRelativeToBase = AverageSatisfaction / UIUtility.BASESAT; - - BarInfo sexTypeBar = SexTypes[i]; - sexTypeBar.Label = Keyed.RS_SexInfo(Keyed.Sextype[sexIndex], _history.GetSexCount(sexIndex)); - sexTypeBar.FillPercent = relativeSat; - sexTypeBar.Tooltip = Keyed.RS_LastSex + ": " + UIUtility.GetSexDays(_history.GetSextypeRecentTickAbs(sexIndex), true); - sexTypeBar.LabelRight = Keyed.RS_SatAVG(satisfactionRelativeToBase); + SexTypes.Add(new BarInfo( + label: Keyed.RS_SexInfo(Keyed.Sextype[sexIndex], _history.GetSexCount(sexIndex)), + fillPercent: relativeSat, + fillTexture: HistoryUtility.SextypeColor[sexIndex], + tooltip: Keyed.RS_LastSex + ": " + UIUtility.GetSexDays(_history.GetSextypeRecentTickAbs(sexIndex), true), + labelRight: Keyed.RS_SatAVG(satisfactionRelativeToBase))); } - PartnerCount.Label = string.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", _history.PartnerCount, Pawn.records.GetValue(RsDefOf.Record.SexPartnerCount)); - PartnerCount.FillPercent = _history.PartnerCount / 50f; + SexTypes.Add(new BarInfo( + label: String.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", _history.PartnerCount, Pawn.records.GetValue(RsDefOf.Record.SexPartnerCount)), + fillPercent: _history.PartnerCount / 50, + fillTexture: HistoryUtility.Partners)); - VirginsTaken.Label = string.Format(Keyed.RS_VirginsTaken + ": {0:0}", _history.VirginsTaken); - VirginsTaken.FillPercent = _history.VirginsTaken / 100f; + SexTypes.Add(new BarInfo( + label: String.Format(Keyed.RS_VirginsTaken + ": {0:0}", _history.VirginsTaken), + fillPercent: _history.VirginsTaken / 100, + fillTexture: HistoryUtility.Partners)); - TotalSex.Label = string.Format(Keyed.RS_TotalSexHad + ": {0:0} ({1:0})", _history.TotalSexHad, Pawn.records.GetValue(xxx.CountOfSex)); - TotalSex.FillPercent = _history.TotalSexHad / 100f; - TotalSex.LabelRight = Keyed.RS_SatAVG(_history.AVGSat); + TotalSex = new BarInfo( + label: String.Format(Keyed.RS_TotalSexHad + ": {0:0} ({1:0})", _history.TotalSexHad, Pawn.records.GetValue(xxx.CountOfSex)), + fillPercent: _history.TotalSexHad / 100, + fillTexture: HistoryUtility.TotalSex, + labelRight: Keyed.RS_SatAVG(_history.AVGSat)); float lust = Pawn.records.GetValue(RsDefOf.Record.Lust); float sexDrive = GetStatValue(xxx.sex_drive_stat); float lustLimit = SexperienceMod.Settings.LustLimit * 3f; - Lust.Label = string.Format(Keyed.Lust + ": {0:0.00}", lust); - Lust.FillPercent = lust.Normalization(-lustLimit, lustLimit); - Lust.Tooltip = GetStatTooltip(xxx.sex_drive_stat, sexDrive); - Lust.LabelRight = xxx.sex_drive_stat.LabelCap + ": " + sexDrive.ToStringPercent(); + Lust = new BarInfo( + label: String.Format(Keyed.Lust + ": {0:0.00}", lust), + fillPercent: Mathf.Clamp01(lust.Normalization(-lustLimit, lustLimit)), + fillTexture: HistoryUtility.Slaanesh, + tooltip: GetStatTooltip(xxx.sex_drive_stat, sexDrive), + labelRight: xxx.sex_drive_stat.LabelCap + ": " + sexDrive.ToStringPercent()); float bestSextypeRelativeSatisfaction = _history.GetBestSextype(out xxx.rjwSextype bestSextype) / UIUtility.BASESAT; - BestSextype.Label = string.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)bestSextype]); - BestSextype.FillPercent = bestSextypeRelativeSatisfaction / 2; - BestSextype.FillTexture = HistoryUtility.SextypeColor[(int)bestSextype]; - BestSextype.LabelRight = Keyed.RS_SatAVG(bestSextypeRelativeSatisfaction); + BestSextype = new BarInfo( + label: String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)bestSextype]), + fillPercent: bestSextypeRelativeSatisfaction / 2, + fillTexture: HistoryUtility.SextypeColor[(int)bestSextype], + labelRight: Keyed.RS_SatAVG(bestSextypeRelativeSatisfaction)); float recentSextypeRelativeSatisfaction = _history.GetRecentSextype(out xxx.rjwSextype recentSextype) / UIUtility.BASESAT; - RecentSextype.Label = string.Format(Keyed.RS_Recent_Sextype + ": {0}", Keyed.Sextype[(int)recentSextype]); - RecentSextype.FillPercent = recentSextypeRelativeSatisfaction / 2; - RecentSextype.FillTexture = HistoryUtility.SextypeColor[(int)recentSextype]; - RecentSextype.LabelRight = recentSextypeRelativeSatisfaction.ToStringPercent(); + RecentSextype = new BarInfo( + label: String.Format(Keyed.RS_Recent_Sextype + ": {0}", Keyed.Sextype[(int)recentSextype]), + fillPercent: recentSextypeRelativeSatisfaction / 2, + fillTexture: HistoryUtility.SextypeColor[(int)recentSextype], + labelRight: recentSextypeRelativeSatisfaction.ToStringPercent()); - Necro.Label = string.Format(Keyed.RS_Necrophile + ": {0}", _history.CorpseFuckCount); - Necro.FillPercent = _history.CorpseFuckCount / 50f; + Necro = new BarInfo( + label: String.Format(Keyed.RS_Necrophile + ": {0}", _history.CorpseFuckCount), + fillPercent: _history.CorpseFuckCount / 50, + fillTexture: HistoryUtility.Nurgle); - Incest.Label = string.Format(Keyed.Incest + ": {0}", _history.IncestuousCount); - Incest.FillPercent = _history.IncestuousCount / 50f; + Incest = new BarInfo( + label: String.Format(Keyed.Incest + ": {0}", _history.IncestuousCount), + fillPercent: _history.IncestuousCount / 50, + fillTexture: HistoryUtility.Nurgle); float amountofEatenCum = Pawn.records.GetValue(RsDefOf.Record.AmountofEatenCum); - ConsumedCum.Label = string.Format(Keyed.RS_Cum_Swallowed + ": {0} mL, {1} " + Keyed.RS_NumofTimes, amountofEatenCum, Pawn.records.GetValue(RsDefOf.Record.NumofEatenCum)); - ConsumedCum.FillPercent = amountofEatenCum / 1000; + ConsumedCum = new BarInfo( + label: String.Format(Keyed.RS_Cum_Swallowed + ": {0} mL, {1} " + Keyed.RS_NumofTimes, amountofEatenCum, Pawn.records.GetValue(RsDefOf.Record.NumofEatenCum)), + fillPercent: amountofEatenCum / 1000, + fillTexture: Texture2D.linearGrayTexture); Hediff cumHediff = Pawn.health.hediffSet.GetFirstHediffOfDef(RsDefOf.Hediff.CumAddiction) ?? Pawn.health.hediffSet.GetFirstHediffOfDef(RsDefOf.Hediff.CumTolerance); if (cumHediff != null) { - CumHediff.Label = $"{cumHediff.Label}: {cumHediff.Severity.ToStringPercent()}"; - CumHediff.FillPercent = cumHediff.Severity; - CumHediff.Tooltip = new TipSignal(() => cumHediff.GetTooltip(Pawn, false), cumHediff.Label.GetHashCode()); - } - else - { - CumHediff.Label = ""; - CumHediff.FillPercent = 0f; - CumHediff.Tooltip = default; + CumHediff = new BarInfo( + label: $"{cumHediff.Label}: {cumHediff.Severity.ToStringPercent()}", + fillPercent: cumHediff.Severity, + fillTexture: Texture2D.linearGrayTexture, + tooltip: new TipSignal(() => cumHediff.GetTooltip(Pawn, false), cumHediff.Label.GetHashCode())); } float vulnerability = GetStatValue(xxx.vulnerability_stat); string vulnerabilityLabel = xxx.vulnerability_stat.LabelCap + ": " + vulnerability.ToStringPercent(); TipSignal vulnerabilityTip = GetStatTooltip(xxx.vulnerability_stat, vulnerability); - Raped.Label = string.Format(Keyed.RS_RapedSomeone + ": {0}", _history.RapedCount); - Raped.FillPercent = _history.RapedCount / 50f; - Raped.Tooltip = vulnerabilityTip; - Raped.LabelRight = vulnerabilityLabel; + Raped = new BarInfo( + label: String.Format(Keyed.RS_RapedSomeone + ": {0}", _history.RapedCount), + fillPercent: _history.RapedCount / 50, + fillTexture: HistoryUtility.Khorne, + tooltip: vulnerabilityTip, + labelRight: vulnerabilityLabel); - BeenRaped.Label = string.Format(Keyed.RS_BeenRaped + ": {0}", _history.BeenRapedCount); - BeenRaped.FillPercent = _history.BeenRapedCount / 50f; - BeenRaped.Tooltip = vulnerabilityTip; - BeenRaped.LabelRight = vulnerabilityLabel; + BeenRaped = new BarInfo( + label: String.Format(Keyed.RS_BeenRaped + ": {0}", _history.BeenRapedCount), + fillPercent: _history.BeenRapedCount / 50, + fillTexture: Texture2D.grayTexture, + tooltip: vulnerabilityTip, + labelRight: vulnerabilityLabel); float sexSatisfaction = GetStatValue(xxx.sex_satisfaction); - SexSatisfaction.Label = xxx.sex_satisfaction.LabelCap + ": " + sexSatisfaction.ToStringPercent(); - SexSatisfaction.FillPercent = sexSatisfaction / 2; - SexSatisfaction.Tooltip = GetStatTooltip(xxx.sex_satisfaction, sexSatisfaction); + SexSatisfaction = new BarInfo( + label: xxx.sex_satisfaction.LabelCap + ": " + sexSatisfaction.ToStringPercent(), + fillPercent: sexSatisfaction / 2, + fillTexture: HistoryUtility.Satisfaction, + tooltip: GetStatTooltip(xxx.sex_satisfaction, sexSatisfaction)); SkillRecord skill = Pawn.skills?.GetSkill(RsDefOf.Skill.Sex); float sexSkillLevel = skill?.Level ?? 0f; float sexStat = Pawn.GetSexStat(); - SexSkill.Label = $"{Keyed.RS_SexSkill}: {sexSkillLevel}, {skill?.xpSinceLastLevel / skill?.XpRequiredForLevelUp:P2}"; - SexSkill.FillPercent = sexSkillLevel / 20; - SexSkill.Tooltip = GetStatTooltip(RsDefOf.Stat.SexAbility, sexStat); - SexSkill.LabelRight = RsDefOf.Stat.SexAbility.LabelCap + ": " + sexStat.ToStringPercent(); - SexSkill.Border = HistoryUtility.GetPassionBG(skill?.passion); + SexSkill = new BarInfo( + label: $"{Keyed.RS_SexSkill}: {sexSkillLevel}, {skill?.xpSinceLastLevel / skill?.XpRequiredForLevelUp:P2}", + fillPercent: sexSkillLevel / 20, + fillTexture: HistoryUtility.Tzeentch, + tooltip: GetStatTooltip(RsDefOf.Stat.SexAbility, sexStat), + labelRight: RsDefOf.Stat.SexAbility.LabelCap + ": " + sexStat.ToStringPercent(), + border: HistoryUtility.GetPassionBG(skill?.passion)); } private void UpdateQuirks() @@ -304,13 +325,13 @@ namespace RJWSexperience.SexHistory.UI Partners = partners; break; case PartnerOrderMode.Recent: - Partners = partners.OrderBy(x => x.PartnerRecord.RecentSexTickAbs); + Partners = partners.OrderBy(x => x.partnerRecord.RecentSexTickAbs); break; case PartnerOrderMode.Most: - Partners = partners.OrderBy(x => x.PartnerRecord.TotalSexCount); + Partners = partners.OrderBy(x => x.partnerRecord.TotalSexCount); break; case PartnerOrderMode.Name: - Partners = partners.OrderBy(x => x.PartnerRecord.Label); + Partners = partners.OrderBy(x => x.partnerRecord.Label); break; } } @@ -323,16 +344,18 @@ namespace RJWSexperience.SexHistory.UI private void UpdateSelectedPartnerCard() { - SelectedPartnerCard.UpdatePartnerRecord(SelectedPartner); - if (SelectedPartner == null) { - SelectedPartnerCard.LastSexTime = null; - } - else - { - SelectedPartnerCard.LastSexTime = UIUtility.GetSexDays(SelectedPartner.RecentSexTickAbs); + SelectedPartnerCard = default; + return; } + + SelectedPartnerCard = new InfoCard( + pawn: Pawn, + partnerRecord: SelectedPartner, + label: Keyed.RS_Selected_Partner, + tooltipLabel: Keyed.RS_Selected_Partner, + lastSexTimeTicks: SelectedPartner.RecentSexTickAbs); } private float GetStatValue(StatDef statDef) => Pawn.Dead ? 0f : Pawn.GetStatValue(statDef); diff --git a/Source/RJWSexperience/SexHistory/UI/SexStatusWindow.cs b/Source/RJWSexperience/SexHistory/UI/SexStatusWindow.cs index 6aee41c..f684891 100644 --- a/Source/RJWSexperience/SexHistory/UI/SexStatusWindow.cs +++ b/Source/RJWSexperience/SexHistory/UI/SexStatusWindow.cs @@ -17,6 +17,9 @@ namespace RJWSexperience.SexHistory.UI public const float BASESAT = UIUtility.BASESAT; public const float ICONSIZE = UIUtility.ICONSIZE; + private static GUIStyle fontStyleCenter; + private static GUIStyle fontStyleRight; + private static GUIStyle fontStyleLeft; private static GUIStyle boxStyle; private static GUIStyle buttonStyle; @@ -29,13 +32,17 @@ namespace RJWSexperience.SexHistory.UI private static void InitStyles() { - if (boxStyle != null) + if (fontStyleCenter != null) { return; } + GUIStyleState fontStyleState = new GUIStyleState() { textColor = Color.white }; GUIStyleState boxStyleState = GUI.skin.textArea.normal; GUIStyleState buttonStyleState = GUI.skin.button.normal; + fontStyleCenter = new GUIStyle() { alignment = TextAnchor.MiddleCenter, normal = fontStyleState }; + fontStyleRight = new GUIStyle() { alignment = TextAnchor.MiddleRight, normal = fontStyleState }; + fontStyleLeft = new GUIStyle() { alignment = TextAnchor.MiddleLeft, normal = fontStyleState }; boxStyle = new GUIStyle(GUI.skin.textArea) { hover = boxStyleState, onHover = boxStyleState, onNormal = boxStyleState }; buttonStyle = new GUIStyle(GUI.skin.button) { hover = buttonStyleState, onHover = buttonStyleState, onNormal = buttonStyleState }; } @@ -118,7 +125,6 @@ namespace RJWSexperience.SexHistory.UI { Find.Selector.ClearSelection(); _context = new SexStatusViewModel(history, orderMode); - _context.Update(); if (!_context.Pawn.DestroyedOrNull() && Find.CurrentMap == _context.Pawn.Map) { Find.Selector.Select(_context.Pawn); @@ -155,13 +161,13 @@ namespace RJWSexperience.SexHistory.UI Rect sexinfoRect2 = new Rect(rect.x + portraitRect.width, rect.y + (FONTHEIGHT * 2), rect.width - portraitRect.width, FONTHEIGHT); Rect bestsexRect = new Rect(rect.x + 2f, rect.y + (FONTHEIGHT * 3), rect.width - 4f, FONTHEIGHT - 2f); - if (context.PartnerRecord != null) + if (context.partnerRecord != null) { - DrawPartnerPortrait(portraitRect, context.PortraitInfo); + DrawPartnerPortrait(portraitRect, context.portraitInfo); Widgets.DrawHighlightIfMouseover(portraitRect); if (Widgets.ButtonInvisible(portraitRect)) { - SexHistoryComp partnerHistory = context.PartnerRecord.Partner?.TryGetComp(); + SexHistoryComp partnerHistory = context.partnerRecord.Partner?.TryGetComp(); if (partnerHistory != null) { ChangePawn(partnerHistory); @@ -173,29 +179,24 @@ namespace RJWSexperience.SexHistory.UI } } - Text.Anchor = TextAnchor.MiddleRight; - Widgets.Label(sexinfoRect2, context.Relations + " "); - GenUI.ResetLabelAlign(); - TooltipHandler.TipRegion(rect, context.Tooltip); + GUI.Label(sexinfoRect2, context.relations + " ", fontStyleRight); + TooltipHandler.TipRegion(rect, context.tooltip); } else { Widgets.DrawTextureFitted(portraitRect, HistoryUtility.UnknownPawn, 1.0f); } - Widgets.Label(nameRect, context.Name); - Widgets.Label(sexinfoRect, context.SexCount); - Widgets.Label(sexinfoRect2, context.Orgasms); - UIUtility.FillableBarLabeled(bestsexRect, context.BestSextype); + Widgets.Label(nameRect, context.name); + Widgets.Label(sexinfoRect, context.sexCount); + Widgets.Label(sexinfoRect2, context.orgasms); + UIUtility.FillableBarLabeled(bestsexRect, context.bestSextype); } protected void DrawSexInfoCard(Rect rect, InfoCard context) { rect.SplitHorizontally(FONTHEIGHT, out Rect labelRect, out Rect infoRect); - Text.Anchor = TextAnchor.MiddleLeft; - Widgets.Label(labelRect, context.Label); - Text.Anchor = TextAnchor.MiddleRight; - Widgets.Label(labelRect, context.LastSexTime); - GenUI.ResetLabelAlign(); + GUI.Label(labelRect, context.label, fontStyleLeft); + GUI.Label(labelRect, context.lastSexTime, fontStyleRight); DrawInfoWithPortrait(infoRect, context); } @@ -210,9 +211,7 @@ namespace RJWSexperience.SexHistory.UI { DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), infoCard); } - Text.Anchor = TextAnchor.MiddleLeft; - listmain.Label(Keyed.RS_PreferRace); - GenUI.ResetLabelAlign(); + GUI.Label(listmain.GetRect(FONTHEIGHT), Keyed.RS_PreferRace, fontStyleLeft); DrawPreferRace(listmain.GetRect(66f + 15f), _context.PreferedRaceCard); listmain.End(); } @@ -226,27 +225,22 @@ namespace RJWSexperience.SexHistory.UI Rect infoRect2 = new Rect(infoRect.x, infoRect.y + FONTHEIGHT, infoRect.width, FONTHEIGHT); Rect infoRect3 = new Rect(infoRect.x, infoRect.y + (FONTHEIGHT * 2), infoRect.width - 2f, FONTHEIGHT); - Widgets.DrawTextureFitted(portraitRect, preferedRaceCard.PortraitGetter(portraitRect.size), 1.0f); + Widgets.DrawTextureFitted(portraitRect, preferedRaceCard.portraitGetter(portraitRect.size), 1.0f); + GUI.Label(infoRect1, preferedRaceCard.preferRaceLabel, fontStyleLeft); - Text.Anchor = TextAnchor.MiddleLeft; - Widgets.Label(infoRect1, preferedRaceCard.PreferRaceLabel); - - if (preferedRaceCard.SexCount != null) + if (preferedRaceCard.preferRaceTypeLabel != null) { - Widgets.Label(infoRect2, preferedRaceCard.SexCount); + GUI.Label(infoRect1, preferedRaceCard.preferRaceTypeLabel + " ", fontStyleRight); } - GenUI.ResetLabelAlign(); - - if (preferedRaceCard.PreferRaceTypeLabel != null) + if (preferedRaceCard.sexCount != null) { - Text.Anchor = TextAnchor.MiddleRight; - Widgets.Label(infoRect1, preferedRaceCard.PreferRaceTypeLabel + " "); + GUI.Label(infoRect2, preferedRaceCard.sexCount, fontStyleLeft); } - if (preferedRaceCard.BarInfo.Label != null) + if (preferedRaceCard.barInfo != null) { - UIUtility.FillableBarLabeled(infoRect3, preferedRaceCard.BarInfo); + UIUtility.FillableBarLabeled(infoRect3, (BarInfo)preferedRaceCard.barInfo); } } @@ -286,10 +280,8 @@ namespace RJWSexperience.SexHistory.UI } GUI.Box(nameRect, "", boxStyle); - Text.Anchor = TextAnchor.MiddleCenter; - Widgets.Label(nameRect.TopHalf(), _context.Name); - Widgets.Label(nameRect.BottomHalf(), _context.AgeAndTitle); - GenUI.ResetLabelAlign(); + GUI.Label(nameRect.TopHalf(), _context.Name, fontStyleCenter); + GUI.Label(nameRect.BottomHalf(), _context.AgeAndTitle, fontStyleCenter); Listing_Standard listmain = new Listing_Standard(); listmain.Begin(infoRect); @@ -300,9 +292,7 @@ namespace RJWSexperience.SexHistory.UI GUI.color = Color.red; GUI.Box(tmp, "", boxStyle); GUI.color = Color.white; - Text.Anchor = TextAnchor.MiddleCenter; - Widgets.Label(tmp, _context.VirginLabel); - GenUI.ResetLabelAlign(); + GUI.Label(tmp, _context.VirginLabel, fontStyleCenter); listmain.Gap(1f); } else @@ -314,7 +304,7 @@ namespace RJWSexperience.SexHistory.UI listmain.FillableBarLabeled(_context.BestSextype); listmain.FillableBarLabeled(_context.RecentSextype); - if (_context.Incest.FillPercent < _context.Necro.FillPercent) + if (_context.Incest.fillPercent < _context.Necro.fillPercent) { listmain.FillableBarLabeled(_context.Necro); } @@ -325,16 +315,16 @@ namespace RJWSexperience.SexHistory.UI listmain.FillableBarLabeled(_context.ConsumedCum); - if (_context.CumHediff.Label != "") + if (_context.CumHediff != null) { - listmain.FillableBarLabeled(_context.CumHediff); + listmain.FillableBarLabeled((BarInfo)_context.CumHediff); } else { listmain.Gap(FONTHEIGHT + 1f); } - if (_context.Raped.FillPercent < _context.BeenRaped.FillPercent) + if (_context.Raped.fillPercent < _context.BeenRaped.fillPercent) { listmain.FillableBarLabeled(_context.BeenRaped); } @@ -392,9 +382,7 @@ namespace RJWSexperience.SexHistory.UI listmain.Begin(rect); //Sex statistics - Text.Anchor = TextAnchor.MiddleLeft; - listmain.Label(" " + Keyed.RS_Statistics); - GenUI.ResetLabelAlign(); + GUI.Label(listmain.GetRect(FONTHEIGHT), " " + Keyed.RS_Statistics, fontStyleLeft); listmain.Gap(1f); for (int i = 0; i < _context.SexTypes.Count; i++) @@ -402,15 +390,10 @@ namespace RJWSexperience.SexHistory.UI listmain.FillableBarLabeled(_context.SexTypes[i]); } - listmain.FillableBarLabeled(_context.PartnerCount); - listmain.FillableBarLabeled(_context.VirginsTaken); - //Partner list Rect listLabelRect = listmain.GetRect(FONTHEIGHT); Rect sortbtnRect = new Rect(listLabelRect.xMax - 80f, listLabelRect.y, 80f, listLabelRect.height); - Text.Anchor = TextAnchor.MiddleLeft; - Widgets.Label(listLabelRect, " " + Keyed.RS_PartnerList); - GenUI.ResetLabelAlign(); + GUI.Label(listLabelRect, " " + Keyed.RS_PartnerList, fontStyleLeft); if (Widgets.ButtonText(sortbtnRect, orderMode.Translate())) { SoundDefOf.Click.PlayOneShotOnCamera(); @@ -446,17 +429,13 @@ namespace RJWSexperience.SexHistory.UI DrawPartnerPortrait(pawnRect, partner); Widgets.DrawHighlightIfMouseover(pawnRect); - - Text.Anchor = TextAnchor.MiddleCenter; - Widgets.Label(labelRect, partner.PartnerRecord.Label); - GenUI.ResetLabelAlign(); - + GUI.Label(labelRect, partner.partnerRecord.Label, fontStyleCenter); if (Widgets.ButtonInvisible(pawnRect)) { - _context.SetSelectedPartner(partner.PartnerRecord); + _context.SetSelectedPartner(partner.partnerRecord); SoundDefOf.Click.PlayOneShotOnCamera(); } - if (partner.PartnerRecord == _context.SelectedPartner) + if (partner.partnerRecord == _context.SelectedPartner) { Widgets.DrawHighlightSelected(pawnRect); } @@ -468,22 +447,22 @@ namespace RJWSexperience.SexHistory.UI protected void DrawPartnerPortrait(Rect rect, PartnerPortraitInfo context) { Rect iconRect = new Rect(rect.x + (rect.width * 3 / 4), rect.y, rect.width / 4, rect.height / 4); - Texture img = context.PortraitGetter(rect.size); + Texture img = context.portraitGetter(rect.size); - if (context.PartnerRecord.IamFirst) + if (context.partnerRecord.IamFirst) { GUI.color = HistoryUtility.HistoryColor; Widgets.DrawTextureFitted(rect, HistoryUtility.FirstOverlay, 1.0f); GUI.color = Color.white; } - if (context.PartnerRecord.Incest) + if (context.partnerRecord.Incest) { Widgets.DrawTextureFitted(iconRect, HistoryUtility.Incest, 1.0f); iconRect.x -= iconRect.width; } Widgets.DrawTextureFitted(rect, img, 1.0f); - if (context.Lover) + if (context.lover) { Widgets.DrawTextureFitted(iconRect, HistoryUtility.Heart, 1.0f); } diff --git a/Source/RJWSexperience/SexHistory/UI/UIUtility.cs b/Source/RJWSexperience/SexHistory/UI/UIUtility.cs index cbfc5fb..29721d4 100644 --- a/Source/RJWSexperience/SexHistory/UI/UIUtility.cs +++ b/Source/RJWSexperience/SexHistory/UI/UIUtility.cs @@ -52,22 +52,22 @@ namespace RJWSexperience.SexHistory.UI public static void FillableBarLabeled(Rect rect, BarInfo context) { - Widgets.FillableBar(rect, context.FillPercent, context.FillTexture, null, true); + Widgets.FillableBar(rect, context.fillPercent, context.fillTexture, null, true); Rect labelRect = rect.ContractedBy(4f, 0f); Text.Anchor = TextAnchor.MiddleLeft; - Widgets.Label(labelRect, context.Label); - if (context.LabelRight != "") + Widgets.Label(labelRect, context.label); + if (context.labelRight != "") { Text.Anchor = TextAnchor.MiddleRight; - Widgets.Label(labelRect, context.LabelRight); + Widgets.Label(labelRect, context.labelRight); } GenUI.ResetLabelAlign(); Widgets.DrawHighlightIfMouseover(rect); - TooltipHandler.TipRegion(rect, context.Tooltip); + TooltipHandler.TipRegion(rect, context.tooltip); - if (context.Border != null) + if (context.border != null) { - rect.DrawBorder(context.Border, 2f); + rect.DrawBorder(context.border, 2f); } } diff --git a/Source/RJWSexperience/Utility.cs b/Source/RJWSexperience/Utility.cs index 868e2cc..3a25e00 100644 --- a/Source/RJWSexperience/Utility.cs +++ b/Source/RJWSexperience/Utility.cs @@ -18,25 +18,13 @@ namespace RJWSexperience return ((float)res).Denormalization(min, max); } - - /// - /// Set exact for the - /// + public static void SetTo(this Pawn_RecordsTracker records, RecordDef record, float value) { float recordval = records.GetValue(record); records.AddTo(record, value - recordval); } - /// - /// Set exact for the - /// - public static void Set(this Pawn_RecordsTracker records, RecordDef record, int value) - { - int currentValue = records.GetAsInt(record); - records.AddTo(record, value - currentValue); - } - public static float Normalization(this float num, float min, float max) { return (num - min) / (max - min); diff --git a/Source/RJWSexperience/Virginity/TraitHandler.cs b/Source/RJWSexperience/Virginity/TraitHandler.cs index e6d79f6..21cc148 100644 --- a/Source/RJWSexperience/Virginity/TraitHandler.cs +++ b/Source/RJWSexperience/Virginity/TraitHandler.cs @@ -14,9 +14,7 @@ namespace RJWSexperience.Virginity if (pawn.gender == Gender.Female && !pawn.IsVirgin()) { - TechLevel techLevel = pawn.Faction?.def.techLevel ?? TechLevel.Industrial; - - if (techLevel >= TechLevel.Industrial && Rand.Chance(hymenSurgeryChance)) + if (Rand.Chance(hymenSurgeryChance)) { Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true); pawn.story.traits.GainTrait(virgin); diff --git a/Source/RJWSexperienceCum/JobGiver_CleanSelfWithBucket.cs b/Source/RJWSexperienceCum/JobGiver_CleanSelfWithBucket.cs deleted file mode 100644 index 8dadb92..0000000 --- a/Source/RJWSexperienceCum/JobGiver_CleanSelfWithBucket.cs +++ /dev/null @@ -1,27 +0,0 @@ -using RJWSexperience; -using Verse; -using Verse.AI; - -namespace RJWSexperienceCum -{ - public class JobGiver_CleanSelfWithBucket : ThinkNode_JobGiver - { - protected override Job TryGiveJob(Pawn pawn) - { - if (HediffDefOf.Hediff_CumController == null || !pawn.health.hediffSet.HasHediff(HediffDefOf.Hediff_CumController)) - { - // Nothing to clean - return null; - } - - Building_CumBucket bucket = pawn.FindClosestBucket(); - - if (bucket == null) - { - return null; - } - - return JobMaker.MakeJob(JobDefOf.CleanSelfwithBucket, pawn, bucket); - } - } -} diff --git a/Source/RJWSexperienceCum/RJWSexperienceCum.csproj b/Source/RJWSexperienceCum/RJWSexperienceCum.csproj index b7c7ac7..bdb12b3 100644 --- a/Source/RJWSexperienceCum/RJWSexperienceCum.csproj +++ b/Source/RJWSexperienceCum/RJWSexperienceCum.csproj @@ -1,29 +1,55 @@ - + + + + Debug + AnyCPU {73CB4597-22BD-4A3E-A3CE-6D65DD080F65} - net472 + Library + Properties RJWSexperienceCum RJWSexperienceCum - ..\..\Mod Compatibility\RJW Cum\Assemblies\ - false - amevarashi - True - False + v4.7.2 + 512 + true - + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\Mod Compatibility\RJW Cum\Assemblies\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + - 1.4.* + 1.4.3641 - - - - ..\..\..\rjw\1.4\Assemblies\RJW.dll - False - - - {9c728e06-573b-4b04-a07f-acbf60cb424d} @@ -31,4 +57,5 @@ False + \ No newline at end of file