mirror of
				https://gitgud.io/Ed86/rjw-whoring.git
				synced 2024-08-15 00:03:25 +00:00 
			
		
		
		
	added toggle to pay with goodwill instead of silver
This commit is contained in:
		
							parent
							
								
									a6079022ab
								
							
						
					
					
						commit
						2b326e0e97
					
				
					 14 changed files with 234 additions and 39 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -49,4 +49,11 @@
 | 
				
			||||||
		<workerClass>rjwwhoring.MainTab.PawnColumnWorker_Mood</workerClass>
 | 
							<workerClass>rjwwhoring.MainTab.PawnColumnWorker_Mood</workerClass>
 | 
				
			||||||
		<width>100</width>
 | 
							<width>100</width>
 | 
				
			||||||
	</PawnColumnDef>
 | 
						</PawnColumnDef>
 | 
				
			||||||
 | 
						<PawnColumnDef>
 | 
				
			||||||
 | 
							<defName>RJW_WhoringPolicy</defName>
 | 
				
			||||||
 | 
							<headerTip>Trade sex for benefits</headerTip>
 | 
				
			||||||
 | 
							<label>Payment type</label>
 | 
				
			||||||
 | 
							<workerClass>rjwwhoring.MainTab.PawnColumnWorker_WhoringPolicy</workerClass>
 | 
				
			||||||
 | 
							<width>100</width>
 | 
				
			||||||
 | 
						</PawnColumnDef>
 | 
				
			||||||
</Defs>
 | 
					</Defs>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@
 | 
				
			||||||
			<li>RJW_EarnedMoneyByWhore</li>
 | 
								<li>RJW_EarnedMoneyByWhore</li>
 | 
				
			||||||
			<li>RJW_AverageMoneyByWhore</li>
 | 
								<li>RJW_AverageMoneyByWhore</li>
 | 
				
			||||||
			<li>RJW_PriceRangeOfWhore</li>
 | 
								<li>RJW_PriceRangeOfWhore</li>
 | 
				
			||||||
 | 
								<li>RJW_WhoringPolicy</li>
 | 
				
			||||||
			<li>RemainingSpace</li>
 | 
								<li>RemainingSpace</li>
 | 
				
			||||||
		</columns>
 | 
							</columns>
 | 
				
			||||||
		<modExtensions>
 | 
							<modExtensions>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ namespace rjwwhoring
 | 
				
			||||||
	public class DataStore : WorldComponent
 | 
						public class DataStore : WorldComponent
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		public Dictionary<int, BedData> bedData = new Dictionary<int, BedData>();
 | 
							public Dictionary<int, BedData> bedData = new Dictionary<int, BedData>();
 | 
				
			||||||
 | 
							public Dictionary<int, WhoringData> whoringData = new Dictionary<int, WhoringData>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public DataStore(World world) : base(world)
 | 
							public DataStore(World world) : base(world)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -21,13 +22,16 @@ namespace rjwwhoring
 | 
				
			||||||
			if (Scribe.mode == LoadSaveMode.Saving)
 | 
								if (Scribe.mode == LoadSaveMode.Saving)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				bedData.RemoveAll(item => item.Value == null || !item.Value.IsValid);
 | 
									bedData.RemoveAll(item => item.Value == null || !item.Value.IsValid);
 | 
				
			||||||
 | 
									whoringData.RemoveAll(item => item.Value == null || !item.Value.IsValid);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
			base.ExposeData();
 | 
								base.ExposeData();
 | 
				
			||||||
			Scribe_Collections.Look(ref bedData, "BedData", LookMode.Value, LookMode.Deep);
 | 
								Scribe_Collections.Look(ref bedData, "BedData", LookMode.Value, LookMode.Deep);
 | 
				
			||||||
 | 
								Scribe_Collections.Look(ref whoringData, "WhoringData", LookMode.Value, LookMode.Deep);
 | 
				
			||||||
			if (Scribe.mode == LoadSaveMode.LoadingVars)
 | 
								if (Scribe.mode == LoadSaveMode.LoadingVars)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (bedData == null) bedData = new Dictionary<int, BedData>();
 | 
									if (bedData == null) bedData = new Dictionary<int, BedData>();
 | 
				
			||||||
 | 
									if (whoringData == null) whoringData = new Dictionary<int, WhoringData>();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,5 +50,21 @@ namespace rjwwhoring
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			return res;
 | 
								return res;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public WhoringData GetWhoringData(Pawn pawn)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								WhoringData res;
 | 
				
			||||||
 | 
								var filled = whoringData.TryGetValue(pawn.thingIDNumber, out res);
 | 
				
			||||||
 | 
								if ((res == null) || (!res.IsValid))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if (filled)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										whoringData.Remove(pawn.thingIDNumber);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									res = new WhoringData(pawn);
 | 
				
			||||||
 | 
									whoringData.Add(pawn.thingIDNumber, res);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return res;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										17
									
								
								1.4/Source/Mod/Data/PawnExtensions.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								1.4/Source/Mod/Data/PawnExtensions.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,17 @@
 | 
				
			||||||
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace rjwwhoring
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public static class PawnExtensions
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public static WhoringData WhoringData(this Pawn pawn)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return WhoringBase.DataStore.GetWhoringData(pawn);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										36
									
								
								1.4/Source/Mod/Data/WhoringData.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								1.4/Source/Mod/Data/WhoringData.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,36 @@
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using static rjw.xxx;
 | 
				
			||||||
 | 
					using System.Collections.ObjectModel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace rjwwhoring
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public class WhoringData : IExposable
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public Pawn pawn;
 | 
				
			||||||
 | 
							public bool allowedForWhoringOwner = true;
 | 
				
			||||||
 | 
							public bool allowedForWhoringAll = false;
 | 
				
			||||||
 | 
							public int reservedForPawnID = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public WhoringType WhoringPolicy = WhoringType.Silver;
 | 
				
			||||||
 | 
							public enum WhoringType { Silver, Goodwill };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public WhoringData() { }
 | 
				
			||||||
 | 
							public WhoringData(Pawn pawn)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this.pawn = pawn;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public void ExposeData()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Scribe_References.Look(ref pawn, "pawn");
 | 
				
			||||||
 | 
								Scribe_Values.Look(ref WhoringPolicy, "WhoringPolicy", WhoringType.Silver, true);
 | 
				
			||||||
 | 
								Scribe_Values.Look(ref allowedForWhoringOwner, "allowedForWhoringOwner", true, true);
 | 
				
			||||||
 | 
								Scribe_Values.Look(ref allowedForWhoringAll, "allowedForWhoringAll", false, true);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public bool IsValid { get { return pawn != null; } }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -142,6 +142,8 @@ namespace rjwwhoring
 | 
				
			||||||
					Bed.UnreserveForWhoring();
 | 
										Bed.UnreserveForWhoring();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (!(Partner.IsColonist && (pawn.IsPrisonerOfColony || pawn.IsColonist)))
 | 
										if (!(Partner.IsColonist && (pawn.IsPrisonerOfColony || pawn.IsColonist)))
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											if (pawn.WhoringData().WhoringPolicy == WhoringData.WhoringType.Silver)
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							int netPrice = (int) (basePrice * bedMult);
 | 
												int netPrice = (int) (basePrice * bedMult);
 | 
				
			||||||
							if (netPrice == 0)
 | 
												if (netPrice == 0)
 | 
				
			||||||
| 
						 | 
					@ -161,9 +163,15 @@ namespace rjwwhoring
 | 
				
			||||||
								else
 | 
													else
 | 
				
			||||||
									ModLog.Message(" Failed to pay base price");
 | 
														ModLog.Message(" Failed to pay base price");
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
 | 
					 | 
				
			||||||
							WhoringHelper.UpdateRecords(pawn, netPrice - defect);
 | 
												WhoringHelper.UpdateRecords(pawn, netPrice - defect);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
 | 
											else
 | 
				
			||||||
 | 
											{
 | 
				
			||||||
 | 
												int bedTip = 1;
 | 
				
			||||||
 | 
												ModLog.Message($"{GetType()}:afterSex toil - {Partner} tried to pay {bedTip} goodwill to {pawn}");
 | 
				
			||||||
 | 
												WhoringHelper.PayRespectToWhore(Partner, bedTip, pawn);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (SexUtility.ConsiderCleaning(pawn))
 | 
										if (SexUtility.ConsiderCleaning(pawn))
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using HugsLib.Utils;
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
| 
						 | 
					@ -132,6 +133,7 @@ namespace rjwwhoring
 | 
				
			||||||
				&& !x.IsPrisoner
 | 
									&& !x.IsPrisoner
 | 
				
			||||||
				&& !xxx.is_slave(x)
 | 
									&& !xxx.is_slave(x)
 | 
				
			||||||
				&& !x.IsColonist
 | 
									&& !x.IsColonist
 | 
				
			||||||
 | 
									//&& (!x.IsColonist || x.guest?.GuestStatus == GuestStatus.Guest)
 | 
				
			||||||
				&& x.Position.DistanceTo(pos) < 100
 | 
									&& x.Position.DistanceTo(pos) < 100
 | 
				
			||||||
				&& xxx.is_healthy_enough(x));
 | 
									&& xxx.is_healthy_enough(x));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -146,6 +148,7 @@ namespace rjwwhoring
 | 
				
			||||||
			if (!potentialClients.Any()) return null;
 | 
								if (!potentialClients.Any()) return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (WhoringBase.DebugWhoring) ModLog.Message($" FindAttractivePawn number of all potential clients {potentialClients.Count()}");
 | 
								if (WhoringBase.DebugWhoring) ModLog.Message($" FindAttractivePawn number of all potential clients {potentialClients.Count()}");
 | 
				
			||||||
 | 
								//if (WhoringBase.DebugWhoring) ModLog.Message($" FindAttractivePawn number of all potential clients {potentialClients.ListElements()}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			List<Pawn> valid_targets = new List<Pawn>();
 | 
								List<Pawn> valid_targets = new List<Pawn>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -165,6 +168,7 @@ namespace rjwwhoring
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (WhoringBase.DebugWhoring) ModLog.Message($" number of reachable clients {valid_targets.Count()}");
 | 
								if (WhoringBase.DebugWhoring) ModLog.Message($" number of reachable clients {valid_targets.Count()}");
 | 
				
			||||||
 | 
								//if (WhoringBase.DebugWhoring) ModLog.Message($" number of reachable clients {valid_targets.ListElements()}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//IEnumerable<Pawn> guestsSpawned = valid_targets.Where(x => x.Faction != whore.Faction
 | 
								//IEnumerable<Pawn> guestsSpawned = valid_targets.Where(x => x.Faction != whore.Faction
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,6 +78,7 @@
 | 
				
			||||||
    <Compile Include="Data\BedData.cs" />
 | 
					    <Compile Include="Data\BedData.cs" />
 | 
				
			||||||
    <Compile Include="Data\DataStore.cs" />
 | 
					    <Compile Include="Data\DataStore.cs" />
 | 
				
			||||||
    <Compile Include="Data\StringListDef.cs" />
 | 
					    <Compile Include="Data\StringListDef.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Data\WhoringData.cs" />
 | 
				
			||||||
    <Compile Include="DefOf\RecordDefDefOf.cs" />
 | 
					    <Compile Include="DefOf\RecordDefDefOf.cs" />
 | 
				
			||||||
    <Compile Include="harmony_Building_BedPatches.cs" />
 | 
					    <Compile Include="harmony_Building_BedPatches.cs" />
 | 
				
			||||||
    <Compile Include="harmony_AftersexPatch.cs" />
 | 
					    <Compile Include="harmony_AftersexPatch.cs" />
 | 
				
			||||||
| 
						 | 
					@ -86,6 +87,8 @@
 | 
				
			||||||
    <Compile Include="JobDrivers\JobDriver_WhoreIsServingVisitors.cs" />
 | 
					    <Compile Include="JobDrivers\JobDriver_WhoreIsServingVisitors.cs" />
 | 
				
			||||||
    <Compile Include="JobGivers\JobGiver_WhoreInvitingVisitors.cs" />
 | 
					    <Compile Include="JobGivers\JobGiver_WhoreInvitingVisitors.cs" />
 | 
				
			||||||
    <Compile Include="Location\Brothel_Room.cs" />
 | 
					    <Compile Include="Location\Brothel_Room.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Data\PawnExtensions.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="WhoringTab\WhoringPolicyUIUtility.cs" />
 | 
				
			||||||
    <Compile Include="WhoringTab\PawnColumnCheckbox_Whore.cs" />
 | 
					    <Compile Include="WhoringTab\PawnColumnCheckbox_Whore.cs" />
 | 
				
			||||||
    <Compile Include="WhoringTab\PawnColumnWorker_AverageMoneyByWhore.cs" />
 | 
					    <Compile Include="WhoringTab\PawnColumnWorker_AverageMoneyByWhore.cs" />
 | 
				
			||||||
    <Compile Include="WhoringTab\PawnColumnWorker_CountOfWhore.cs" />
 | 
					    <Compile Include="WhoringTab\PawnColumnWorker_CountOfWhore.cs" />
 | 
				
			||||||
| 
						 | 
					@ -95,6 +98,7 @@
 | 
				
			||||||
    <Compile Include="WhoringTab\PawnColumnWorker_PriceRangeOfWhore.cs" />
 | 
					    <Compile Include="WhoringTab\PawnColumnWorker_PriceRangeOfWhore.cs" />
 | 
				
			||||||
    <Compile Include="WhoringTab\PawnColumnWorker_TextCenter.cs" />
 | 
					    <Compile Include="WhoringTab\PawnColumnWorker_TextCenter.cs" />
 | 
				
			||||||
    <Compile Include="WhoringTab\PawnColumnWorker_WhoreExperience.cs" />
 | 
					    <Compile Include="WhoringTab\PawnColumnWorker_WhoreExperience.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="WhoringTab\PawnColumnWorker_WhoringPolicy.cs" />
 | 
				
			||||||
    <Compile Include="WhoringTab\PawnTable_Whores.cs" />
 | 
					    <Compile Include="WhoringTab\PawnTable_Whores.cs" />
 | 
				
			||||||
    <Compile Include="WhoringTab\WhoreCheckbox.cs" />
 | 
					    <Compile Include="WhoringTab\WhoreCheckbox.cs" />
 | 
				
			||||||
    <Compile Include="ThinkTreeNodes\ThinkNode_ChancePerHour_Whore.cs" />
 | 
					    <Compile Include="ThinkTreeNodes\ThinkNode_ChancePerHour_Whore.cs" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,17 @@ namespace rjwwhoring.MainTab
 | 
				
			||||||
		protected internal int max;
 | 
							protected internal int max;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		protected override string GetTextFor(Pawn pawn)
 | 
							protected override string GetTextFor(Pawn pawn)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (pawn.WhoringData().WhoringPolicy == WhoringData.WhoringType.Silver)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				min = WhoringHelper.WhoreMinPrice(pawn);
 | 
									min = WhoringHelper.WhoreMinPrice(pawn);
 | 
				
			||||||
				max = WhoringHelper.WhoreMaxPrice(pawn);
 | 
									max = WhoringHelper.WhoreMaxPrice(pawn);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									min = 1;
 | 
				
			||||||
 | 
									max = 1;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			return string.Format("{0} - {1}", min, max);
 | 
								return string.Format("{0} - {1}", min, max);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,16 +35,18 @@ namespace rjwwhoring.MainTab
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		protected override string GetTip(Pawn pawn)
 | 
							protected override string GetTip(Pawn pawn)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (pawn.WhoringData().WhoringPolicy == WhoringData.WhoringType.Silver)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				string minPriceTip = string.Format(
 | 
									string minPriceTip = string.Format(
 | 
				
			||||||
					"  Base: {0}\n  Traits: {1}",
 | 
										"  Base: {0}\n  Traits: {1}",
 | 
				
			||||||
					WhoringHelper.baseMinPrice,
 | 
										WhoringHelper.baseMinPrice,
 | 
				
			||||||
				(WhoringHelper.WhoreTraitAdjustmentMin(pawn) -1f).ToStringPercent()
 | 
										(WhoringHelper.WhoreTraitAdjustmentMin(pawn) - 1f).ToStringPercent()
 | 
				
			||||||
				);
 | 
									);
 | 
				
			||||||
				string maxPriceTip = string.Format(
 | 
									string maxPriceTip = string.Format(
 | 
				
			||||||
					"  Base: {0}\n  Traits: {1}",
 | 
										"  Base: {0}\n  Traits: {1}",
 | 
				
			||||||
					WhoringHelper.baseMaxPrice,
 | 
										WhoringHelper.baseMaxPrice,
 | 
				
			||||||
				(WhoringHelper.WhoreTraitAdjustmentMax(pawn) -1f).ToStringPercent()
 | 
										(WhoringHelper.WhoreTraitAdjustmentMax(pawn) - 1f).ToStringPercent()
 | 
				
			||||||
				);
 | 
									);
 | 
				
			||||||
				string bothTip = string.Format(
 | 
									string bothTip = string.Format(
 | 
				
			||||||
					"  Gender: {0}\n  Age: {1}\n  Injuries: {2}",
 | 
										"  Gender: {0}\n  Age: {1}\n  Injuries: {2}",
 | 
				
			||||||
| 
						 | 
					@ -46,6 +56,11 @@ namespace rjwwhoring.MainTab
 | 
				
			||||||
				);
 | 
									);
 | 
				
			||||||
				return string.Format("Min:\n{0}\nMax:\n{1}\nBoth:\n{2}", minPriceTip, maxPriceTip, bothTip);
 | 
									return string.Format("Min:\n{0}\nMax:\n{1}\nBoth:\n{2}", minPriceTip, maxPriceTip, bothTip);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									return string.Format("Raise Goodwill by 1");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		private int GetValueToCompare(Pawn pawn)
 | 
							private int GetValueToCompare(Pawn pawn)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										23
									
								
								1.4/Source/Mod/WhoringTab/PawnColumnWorker_WhoringPolicy.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								1.4/Source/Mod/WhoringTab/PawnColumnWorker_WhoringPolicy.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,23 @@
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using RimWorld.Planet;
 | 
				
			||||||
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					using Verse.Sound;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace rjwwhoring.MainTab
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						[StaticConstructorOnStartup]
 | 
				
			||||||
 | 
						public class PawnColumnWorker_WhoringPolicy : PawnColumnWorker
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (pawn.drugs != null)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									WhoringPolicyUIUtility.DoAssignWhoringPolicyButtons(rect, pawn);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										45
									
								
								1.4/Source/Mod/WhoringTab/WhoringPolicyUIUtility.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								1.4/Source/Mod/WhoringTab/WhoringPolicyUIUtility.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,45 @@
 | 
				
			||||||
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace rjwwhoring
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public static class WhoringPolicyUIUtility
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							//public const string AssigningDrugsTutorHighlightTag = "ButtonAssignDrugs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public static void DoAssignWhoringPolicyButtons(Rect rect, Pawn pawn)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								int num = Mathf.FloorToInt(rect.width);
 | 
				
			||||||
 | 
								float x = rect.x;
 | 
				
			||||||
 | 
								Rect rect2 = new Rect(x, rect.y + 2f, num, rect.height - 4f);
 | 
				
			||||||
 | 
								string text = pawn.WhoringData().WhoringPolicy.ToStringSafe();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								Widgets.Dropdown(rect2, pawn, (Pawn p) => p.WhoringData().WhoringPolicy, Button_GenerateMenu, text.Truncate(rect2.width), paintable: true);
 | 
				
			||||||
 | 
								//Widgets.Dropdown(rect2, pawn, (Pawn p) => p.drugs.CurrentPolicy, Button_GenerateMenu, text.Truncate(((Rect)(ref rect2)).get_width()), null, pawn.drugs.CurrentPolicy.label, null, delegate
 | 
				
			||||||
 | 
								//{
 | 
				
			||||||
 | 
								//	PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.DrugPolicies, KnowledgeAmount.Total);
 | 
				
			||||||
 | 
								//}, paintable: true);
 | 
				
			||||||
 | 
								x += num;
 | 
				
			||||||
 | 
								x += 4f;
 | 
				
			||||||
 | 
								//UIHighlighter.HighlightOpportunity(rect2, "ButtonAssignDrugs");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							private static IEnumerable<Widgets.DropdownMenuElement<Enum>> Button_GenerateMenu(Pawn pawn)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								foreach (WhoringData.WhoringType option in Enum.GetValues(typeof(WhoringData.WhoringType)))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									yield return new Widgets.DropdownMenuElement<Enum>
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										option = new FloatMenuOption(option.ToString(), delegate
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											pawn.WhoringData().WhoringPolicy = option;
 | 
				
			||||||
 | 
										}),
 | 
				
			||||||
 | 
										payload = option
 | 
				
			||||||
 | 
									};
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -188,6 +188,8 @@ namespace rjwwhoring
 | 
				
			||||||
		public static bool CanAfford(Pawn targetPawn, Pawn whore, int priceOfWhore = -1)
 | 
							public static bool CanAfford(Pawn targetPawn, Pawn whore, int priceOfWhore = -1)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			//if (targetPawn.Faction == whore.Faction) return true;
 | 
								//if (targetPawn.Faction == whore.Faction) return true;
 | 
				
			||||||
 | 
								if (whore.WhoringData().WhoringPolicy == WhoringData.WhoringType.Goodwill) return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (WhoringBase.MoneyPrinting) return true;
 | 
								if (WhoringBase.MoneyPrinting) return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//if (RJWSettings.DebugWhoring) ModLog.Message($"CanAfford for client {xxx.get_pawnname(targetPawn)}");
 | 
								//if (RJWSettings.DebugWhoring) ModLog.Message($"CanAfford for client {xxx.get_pawnname(targetPawn)}");
 | 
				
			||||||
| 
						 | 
					@ -310,6 +312,19 @@ namespace rjwwhoring
 | 
				
			||||||
			return AmountLeft;
 | 
								return AmountLeft;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public static int PayRespectToWhore(Pawn targetPawn, int priceOfWhore, Pawn whore)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if ((targetPawn.Faction != whore.Faction && targetPawn.GuestStatus != GuestStatus.Guest))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									if (WhoringBase.DebugWhoring) ModLog.Message($" No need to pay respect");
 | 
				
			||||||
 | 
									return 0;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								targetPawn.Faction.TryAffectGoodwillWith(Faction.OfPlayer, priceOfWhore);
 | 
				
			||||||
 | 
								if (WhoringBase.DebugWhoring) ModLog.Message($" price: {priceOfWhore}, paid: {priceOfWhore}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								return priceOfWhore;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//[SyncMethod]
 | 
							//[SyncMethod]
 | 
				
			||||||
		public static bool IsHookupAppealing(Pawn target, Pawn whore)
 | 
							public static bool IsHookupAppealing(Pawn target, Pawn whore)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 | 
				
			||||||
<Manifest>
 | 
					<Manifest>
 | 
				
			||||||
	<identifier>RimJobWorld Whoring</identifier>
 | 
						<identifier>RimJobWorld Whoring</identifier>
 | 
				
			||||||
	<version>1.0.2</version>
 | 
						<version>1.0.4</version>
 | 
				
			||||||
	<dependencies>
 | 
						<dependencies>
 | 
				
			||||||
		<li>RimJobWorld</li>
 | 
							<li>RimJobWorld</li>
 | 
				
			||||||
	</dependencies>
 | 
						</dependencies>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue