mirror of
				https://github.com/amevarashi/RJW-Sexperience.git
				synced 2024-08-14 23:54:08 +00:00 
			
		
		
		
	Remove some more code warnings
This commit is contained in:
		
							parent
							
								
									99d3d18d8a
								
							
						
					
					
						commit
						89439d1f32
					
				
					 6 changed files with 207 additions and 216 deletions
				
			
		| 
						 | 
					@ -1,22 +1,16 @@
 | 
				
			||||||
using System;
 | 
					using HarmonyLib;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					 | 
				
			||||||
using System.Linq;
 | 
					 | 
				
			||||||
using System.Text;
 | 
					 | 
				
			||||||
using System.Threading.Tasks;
 | 
					 | 
				
			||||||
using System.Reflection;
 | 
					using System.Reflection;
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
using HarmonyLib;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJWSexperience
 | 
					namespace RJWSexperience
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    [StaticConstructorOnStartup]
 | 
						[StaticConstructorOnStartup]
 | 
				
			||||||
    internal static class First
 | 
						internal static class First
 | 
				
			||||||
    {
 | 
						{
 | 
				
			||||||
        static First()
 | 
							static First()
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            var har = new Harmony("RJW_Sexperience");
 | 
								var har = new Harmony("RJW_Sexperience");
 | 
				
			||||||
            har.PatchAll(Assembly.GetExecutingAssembly());
 | 
								har.PatchAll(Assembly.GetExecutingAssembly());
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
    }
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,16 +1,16 @@
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
using RJWSexperience.ExtensionMethods;
 | 
					 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJWSexperience
 | 
					namespace RJWSexperience
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class CumOutcomeDoers : IngestionOutcomeDoer
 | 
						public class CumOutcomeDoers : IngestionOutcomeDoer
 | 
				
			||||||
    {
 | 
						{
 | 
				
			||||||
        public float unitAmount = 1.0f;
 | 
							[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
 | 
				
			||||||
 | 
							public float unitAmount = 1.0f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
 | 
							protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            pawn.AteCum(ingested.stackCount * unitAmount);
 | 
								pawn.AteCum(ingested.stackCount * unitAmount);
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
    }
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -282,8 +282,7 @@ namespace RJWSexperience
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in histories)
 | 
									foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in histories)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					element.Value.parent = this;
 | 
										element.Value.PartnerID = element.Key;
 | 
				
			||||||
					element.Value.partnerID = element.Key;
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			base.PostExposeData();
 | 
								base.PostExposeData();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,91 +1,86 @@
 | 
				
			||||||
using System;
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using rjw;
 | 
				
			||||||
 | 
					using RJWSexperience.ExtensionMethods;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Text;
 | 
					 | 
				
			||||||
using System.Threading.Tasks;
 | 
					 | 
				
			||||||
using RimWorld;
 | 
					 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
using rjw;
 | 
					 | 
				
			||||||
using UnityEngine;
 | 
					 | 
				
			||||||
using RJWSexperience.ExtensionMethods;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJWSexperience
 | 
					namespace RJWSexperience
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class SexPartnerHistoryRecord : IExposable
 | 
						public class SexPartnerHistoryRecord : IExposable
 | 
				
			||||||
    {
 | 
						{
 | 
				
			||||||
        public SexPartnerHistory parent;
 | 
							public string PartnerID { get; set; }
 | 
				
			||||||
        public string partnerID;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected Pawn partner = null;
 | 
							protected Pawn partner = null;
 | 
				
			||||||
        protected string namecache;
 | 
							protected string namecache;
 | 
				
			||||||
        protected int totalsexhad = 0;
 | 
							protected int totalsexhad = 0;
 | 
				
			||||||
        protected int raped = 0;
 | 
							protected int raped = 0;
 | 
				
			||||||
        protected int rapedme = 0;
 | 
							protected int rapedme = 0;
 | 
				
			||||||
        protected int orgasms = 0;
 | 
							protected int orgasms = 0;
 | 
				
			||||||
        protected xxx.rjwSextype bestsextype = xxx.rjwSextype.None;
 | 
							protected xxx.rjwSextype bestsextype = xxx.rjwSextype.None;
 | 
				
			||||||
        protected float bestsatisfaction = 0;
 | 
							protected float bestsatisfaction = 0;
 | 
				
			||||||
        protected bool itookvirgin = false;
 | 
							protected bool itookvirgin = false;
 | 
				
			||||||
        protected bool incest = false;
 | 
							protected bool incest = false;
 | 
				
			||||||
        protected int recentsextickabs = 0;
 | 
							protected int recentsextickabs = 0;
 | 
				
			||||||
        protected int bestsextickabs = 0;
 | 
							protected int bestsextickabs = 0;
 | 
				
			||||||
        protected bool cannotLoadPawnData = false;
 | 
							protected bool cannotLoadPawnData = false;
 | 
				
			||||||
        protected ThingDef race;
 | 
							protected ThingDef race;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public string Label
 | 
							public string Label
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                if (partner != null)
 | 
									if (partner != null)
 | 
				
			||||||
                {
 | 
									{
 | 
				
			||||||
                    namecache = partner.Label;
 | 
										namecache = partner.Label;
 | 
				
			||||||
                    return namecache;
 | 
										return namecache;
 | 
				
			||||||
                }
 | 
									}
 | 
				
			||||||
                else return namecache;
 | 
									else return namecache;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
        public xxx.rjwSextype BestSextype
 | 
							public xxx.rjwSextype BestSextype
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                return bestsextype;
 | 
									return bestsextype;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
        public float BestSatisfaction
 | 
							public float BestSatisfaction
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                return bestsatisfaction;
 | 
									return bestsatisfaction;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
        public int TotalSexCount
 | 
							public int TotalSexCount
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                return totalsexhad;
 | 
									return totalsexhad;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
        public Pawn Partner
 | 
							public Pawn Partner
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                if (!cannotLoadPawnData && partner == null)
 | 
									if (!cannotLoadPawnData && partner == null)
 | 
				
			||||||
                {
 | 
									{
 | 
				
			||||||
                    LoadPartnerPawn(partnerID);
 | 
										LoadPartnerPawn(PartnerID);
 | 
				
			||||||
                    if (partner == null) cannotLoadPawnData = true;
 | 
										if (partner == null) cannotLoadPawnData = true;
 | 
				
			||||||
                }
 | 
									}
 | 
				
			||||||
                return partner;
 | 
									return partner;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
        public string RapeInfo
 | 
							public string RapeInfo
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                string res = "";
 | 
									string res = "";
 | 
				
			||||||
                if (raped > 0) res += Keyed.RS_Raped + raped + " ";
 | 
									if (raped > 0) res += Keyed.RS_Raped + raped + " ";
 | 
				
			||||||
                if (rapedme > 0) res += Keyed.RS_RapedMe + rapedme + " ";
 | 
									if (rapedme > 0) res += Keyed.RS_RapedMe + rapedme + " ";
 | 
				
			||||||
                return res;
 | 
									return res;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
		public int OrgasmCount => orgasms;
 | 
							public int OrgasmCount => orgasms;
 | 
				
			||||||
		public bool IamFirst => itookvirgin;
 | 
							public bool IamFirst => itookvirgin;
 | 
				
			||||||
		public bool Incest => incest;
 | 
							public bool Incest => incest;
 | 
				
			||||||
| 
						 | 
					@ -95,118 +90,118 @@ namespace RJWSexperience
 | 
				
			||||||
		public int BestSexTickAbs => bestsextickabs;
 | 
							public int BestSexTickAbs => bestsextickabs;
 | 
				
			||||||
		public int BestSexElapsedTicks => GenTicks.TicksAbs - bestsextickabs;
 | 
							public int BestSexElapsedTicks => GenTicks.TicksAbs - bestsextickabs;
 | 
				
			||||||
		public string BestSexDays
 | 
							public string BestSexDays
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                if (bestsextickabs != 0) return Keyed.RS_HadBestSexDaysAgo(GenDate.ToStringTicksToDays(BestSexElapsedTicks) + " " + Keyed.RS_Ago);
 | 
									if (bestsextickabs != 0) return Keyed.RS_HadBestSexDaysAgo(GenDate.ToStringTicksToDays(BestSexElapsedTicks) + " " + Keyed.RS_Ago);
 | 
				
			||||||
                return "";
 | 
									return "";
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
        public ThingDef Race
 | 
							public ThingDef Race
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            get
 | 
								get
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                if (Partner != null)
 | 
									if (Partner != null)
 | 
				
			||||||
                {
 | 
									{
 | 
				
			||||||
                    race = Partner.def;
 | 
										race = Partner.def;
 | 
				
			||||||
                    return race;
 | 
										return race;
 | 
				
			||||||
                }
 | 
									}
 | 
				
			||||||
                else return race;
 | 
									else return race;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public SexPartnerHistoryRecord() { }
 | 
							public SexPartnerHistoryRecord() { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public SexPartnerHistoryRecord(Pawn pawn, bool incest = false)
 | 
							public SexPartnerHistoryRecord(Pawn pawn, bool incest = false)
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            this.partner = pawn;
 | 
								this.partner = pawn;
 | 
				
			||||||
            this.namecache = pawn.Label;
 | 
								this.namecache = pawn.Label;
 | 
				
			||||||
            this.incest = incest;
 | 
								this.incest = incest;
 | 
				
			||||||
            this.race = pawn.def;
 | 
								this.race = pawn.def;
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void ExposeData()
 | 
							public void ExposeData()
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            Scribe_Values.Look(ref namecache, "namecache", namecache, true);
 | 
								Scribe_Values.Look(ref namecache, "namecache", namecache, true);
 | 
				
			||||||
            Scribe_Values.Look(ref totalsexhad, "totalsexhad", totalsexhad, true);
 | 
								Scribe_Values.Look(ref totalsexhad, "totalsexhad", totalsexhad, true);
 | 
				
			||||||
            Scribe_Values.Look(ref raped, "raped", raped, true);
 | 
								Scribe_Values.Look(ref raped, "raped", raped, true);
 | 
				
			||||||
            Scribe_Values.Look(ref rapedme, "rapedme", rapedme, true);
 | 
								Scribe_Values.Look(ref rapedme, "rapedme", rapedme, true);
 | 
				
			||||||
            Scribe_Values.Look(ref orgasms, "orgasms", orgasms, true);
 | 
								Scribe_Values.Look(ref orgasms, "orgasms", orgasms, true);
 | 
				
			||||||
            Scribe_Values.Look(ref bestsextype, "bestsextype", bestsextype, true);
 | 
								Scribe_Values.Look(ref bestsextype, "bestsextype", bestsextype, true);
 | 
				
			||||||
            Scribe_Values.Look(ref bestsatisfaction, "bestsatisfaction", bestsatisfaction, true);
 | 
								Scribe_Values.Look(ref bestsatisfaction, "bestsatisfaction", bestsatisfaction, true);
 | 
				
			||||||
            Scribe_Values.Look(ref itookvirgin, "itookvirgin", itookvirgin, true);
 | 
								Scribe_Values.Look(ref itookvirgin, "itookvirgin", itookvirgin, true);
 | 
				
			||||||
            Scribe_Values.Look(ref incest, "incest", incest, true);
 | 
								Scribe_Values.Look(ref incest, "incest", incest, true);
 | 
				
			||||||
            Scribe_Values.Look(ref recentsextickabs, "recentsextickabs", recentsextickabs, true);
 | 
								Scribe_Values.Look(ref recentsextickabs, "recentsextickabs", recentsextickabs, true);
 | 
				
			||||||
            Scribe_Values.Look(ref bestsextickabs, "bestsextickabs", bestsextickabs, true);
 | 
								Scribe_Values.Look(ref bestsextickabs, "bestsextickabs", bestsextickabs, true);
 | 
				
			||||||
            Scribe_Defs.Look(ref race, "race");
 | 
								Scribe_Defs.Look(ref race, "race");
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void RecordSex(SexProps props)
 | 
							public void RecordSex(SexProps props)
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            totalsexhad++;
 | 
								totalsexhad++;
 | 
				
			||||||
            if (props.isRape)
 | 
								if (props.isRape)
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                if (partner == props.GetInteractionInitiator())
 | 
									if (partner == props.GetInteractionInitiator())
 | 
				
			||||||
                {
 | 
									{
 | 
				
			||||||
                    rapedme++;
 | 
										rapedme++;
 | 
				
			||||||
                }
 | 
									}
 | 
				
			||||||
                else if (partner == props.GetInteractionRecipient())
 | 
									else if (partner == props.GetInteractionRecipient())
 | 
				
			||||||
                {
 | 
									{
 | 
				
			||||||
                    raped++;
 | 
										raped++;
 | 
				
			||||||
                }
 | 
									}
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
            recentsextickabs = GenTicks.TicksAbs;
 | 
								recentsextickabs = GenTicks.TicksAbs;
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void RecordSatisfaction(SexProps props, float satisfaction)
 | 
							public void RecordSatisfaction(SexProps props, float satisfaction)
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            if (satisfaction > bestsatisfaction)
 | 
								if (satisfaction > bestsatisfaction)
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                orgasms++;
 | 
									orgasms++;
 | 
				
			||||||
                bestsextype = props.sexType;
 | 
									bestsextype = props.sexType;
 | 
				
			||||||
                bestsatisfaction = satisfaction;
 | 
									bestsatisfaction = satisfaction;
 | 
				
			||||||
                bestsextickabs = GenTicks.TicksAbs;
 | 
									bestsextickabs = GenTicks.TicksAbs;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void TookVirgin()
 | 
							public void TookVirgin()
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            itookvirgin = true;
 | 
								itookvirgin = true;
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected void LoadPartnerPawn(string partnerID)
 | 
							protected void LoadPartnerPawn(string partnerID)
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            foreach (Map map in Find.Maps)
 | 
								foreach (Map map in Find.Maps)
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                partner = map.mapPawns.AllPawns.FirstOrDefault(x => x.ThingID.Equals(partnerID));
 | 
									partner = map.mapPawns.AllPawns.FirstOrDefault(x => x.ThingID.Equals(partnerID));
 | 
				
			||||||
                if (partner != null) return;
 | 
									if (partner != null) return;
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
            partner = Find.WorldPawns.AllPawnsAliveOrDead.FirstOrDefault(x => x.ThingID.Equals(partnerID));
 | 
								partner = Find.WorldPawns.AllPawnsAliveOrDead.FirstOrDefault(x => x.ThingID.Equals(partnerID));
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public class RecentOrderComparer : IComparer<SexPartnerHistoryRecord>
 | 
							public class RecentOrderComparer : IComparer<SexPartnerHistoryRecord>
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
 | 
								public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                return y.RecentSexTickAbs.CompareTo(x.RecentSexTickAbs);
 | 
									return y.RecentSexTickAbs.CompareTo(x.RecentSexTickAbs);
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public class MostOrderComparer : IComparer<SexPartnerHistoryRecord>
 | 
							public class MostOrderComparer : IComparer<SexPartnerHistoryRecord>
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
 | 
								public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                return y.TotalSexCount.CompareTo(x.TotalSexCount);
 | 
									return y.TotalSexCount.CompareTo(x.TotalSexCount);
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public class NameOrderComparer : IComparer<SexPartnerHistoryRecord>
 | 
							public class NameOrderComparer : IComparer<SexPartnerHistoryRecord>
 | 
				
			||||||
        {
 | 
							{
 | 
				
			||||||
            public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
 | 
								public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
 | 
				
			||||||
            {
 | 
								{
 | 
				
			||||||
                return x.Label.CompareTo(y.Label);
 | 
									return x.Label.CompareTo(y.Label);
 | 
				
			||||||
            }
 | 
								}
 | 
				
			||||||
        }
 | 
							}
 | 
				
			||||||
    }
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@ namespace RJWSexperience
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			get
 | 
								get
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false) return minimumValueforStage.Count;
 | 
									if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false) return MinimumValueforStage.Count;
 | 
				
			||||||
				return base.CurStageIndex;
 | 
									return base.CurStageIndex;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Diagnostics.CodeAnalysis;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJWSexperience
 | 
					namespace RJWSexperience
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -8,7 +9,9 @@ namespace RJWSexperience
 | 
				
			||||||
	/// </summary>
 | 
						/// </summary>
 | 
				
			||||||
	public class ThoughtDef_Recordbased : ThoughtDef
 | 
						public class ThoughtDef_Recordbased : ThoughtDef
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
 | 
				
			||||||
		public RecordDef recordDef;
 | 
							public RecordDef recordDef;
 | 
				
			||||||
 | 
							[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
 | 
				
			||||||
		public List<float> minimumValueforStage = new List<float>();
 | 
							public List<float> minimumValueforStage = new List<float>();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,17 +21,17 @@ namespace RJWSexperience
 | 
				
			||||||
	public class Thought_Recordbased : Thought_Memory
 | 
						public class Thought_Recordbased : Thought_Memory
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		protected ThoughtDef_Recordbased Def => (ThoughtDef_Recordbased)def;
 | 
							protected ThoughtDef_Recordbased Def => (ThoughtDef_Recordbased)def;
 | 
				
			||||||
		protected RecordDef recordDef => Def.recordDef;
 | 
							protected RecordDef RecordDef => Def.recordDef;
 | 
				
			||||||
		protected List<float> minimumValueforStage => Def.minimumValueforStage;
 | 
							protected List<float> MinimumValueforStage => Def.minimumValueforStage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public override int CurStageIndex
 | 
							public override int CurStageIndex
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			get
 | 
								get
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				float value = pawn?.records?.GetValue(recordDef) ?? 0f;
 | 
									float value = pawn?.records?.GetValue(RecordDef) ?? 0f;
 | 
				
			||||||
				for (int i = minimumValueforStage.Count - 1; i > 0; i--)
 | 
									for (int i = MinimumValueforStage.Count - 1; i > 0; i--)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if (minimumValueforStage[i] < value) return i + 1;
 | 
										if (MinimumValueforStage[i] < value) return i + 1;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				return 0;
 | 
									return 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue