Compare commits

...

37 Commits

Author SHA1 Message Date
amevarashi 37927f19b3
Merge pull request #12 from Angedore/virginityadditionalremovers
additional sex acts remove the virginity trait
2024-04-30 13:09:57 +05:00
Angedore 25a4e0786c - fisting removes the virginity of the receiving virgin female partner 2023-12-03 12:24:42 +01:00
Angedore b6d34be263 - configurable virginity removal for male/male for anal sex
- configurable virginity removal for female/female scissoring sex
- added double penetration to actions for virginity removal
2023-12-03 12:24:28 +01:00
amevarashi 190c6fc3d6 Fixed some labels in SexStatusWindow not respecting custom fonts 2023-10-28 12:58:02 +05:00
amevarashi 4265e3c3e1 1.4.1.3 2023-10-03 22:14:07 +05:00
amevarashi 9e21992d9b Prisoners use buckets to clean themselves 2023-10-03 21:52:39 +05:00
amevarashi cfee907258 Migrate SDK projects 2023-09-26 19:48:30 +05:00
amevarashi 814f35772e 1.4.1.2 2023-07-24 20:52:53 +05:00
amevarashi 57fe883be0 Fix IsVirgin check 2023-07-24 20:47:56 +05:00
amevarashi ffe6a9b7f7 More of reusing objects in SexStatusViewModel 2023-07-24 20:47:00 +05:00
amevarashi bed83e1eca 1.4.1.1 2023-07-09 14:29:02 +05:00
amevarashi 5138e11cb2 Started reusing objects in SexStatusViewModel 2023-07-09 12:02:20 +05:00
amevarashi 4e44d42c4f Marked Sex History button shrinkable and lowered its UI order 2023-07-09 09:55:13 +05:00
amevarashi 2c225a2d41 Fixed exception when pawn uses a bucket 2023-07-09 09:49:51 +05:00
amevarashi 811162875d Updated Rimworld refs version 2023-07-08 20:12:08 +05:00
amevarashi cc4e36e3ce 1.4.1.0 2023-07-02 13:03:15 +05:00
amevarashi e3c712572d Added sex skill icons for VRE - Android and VRE - Genie 2023-07-02 13:02:40 +05:00
amevarashi e300cc5077
Merge pull request #11 from yiyuandian/master
Add ChineseSimplified Translations
2023-07-02 12:49:49 +05:00
yiyuandian 64e7ff15e1 add chinese translation
补充其它中文翻译
2023-05-14 17:54:19 +08:00
yiyuandian 2a7532d305 add chinese translation
补充其它中文翻译
2023-05-14 17:40:08 +08:00
yiyuandian 1774f80730 部分翻译 2023-05-13 00:00:20 +08:00
yiyuandian e46d1c93e4 修改错字 Modify typos
敬业→精液 dedicated→semen
2023-05-06 21:57:02 +08:00
yiyuandian b64f78c6c2 文本修改 2023-05-06 21:52:26 +08:00
amevarashi 3ef5faf86b 1.1.4.0 2023-04-22 12:35:52 +05:00
amevarashi cd9647f999 Simplified GetAdjacentBuilding methods 2023-04-21 20:52:32 +05:00
amevarashi ab485c677f Simplified virginity checks
Updated names in the SexHistoryComp
2023-04-21 20:19:37 +05:00
amevarashi 67c2328ad6 Change VariousDefOf to RsDefOf
Fix some IDE messages
2023-04-17 16:34:35 +05:00
amevarashi 8a48d2e463 Optimized Ate Cum thought 2023-04-17 14:17:07 +05:00
amevarashi cdc79acfa3 Refactored/optimized SexStatusWindow 2023-04-16 12:09:50 +05:00
amevarashi e9ca084680 1.1.3.0 2023-03-25 19:35:58 +05:00
amevarashi 50f48bdeb5 Fixed #7 masturbation counted as sex with a partner
Updated selection of place near bucket to masturbate
2023-03-25 19:33:47 +05:00
amevarashi 6bb4c091d4 Removed HideGizmoWithRJW setting 2023-03-25 14:17:47 +05:00
amevarashi f363ed6c49 Removed GetGizmos patch. CompGetGizmosExtra now works for non-colonists! 2023-03-24 23:06:24 +05:00
amevarashi 9e0a461db3 Use Prepare instead DoConditionalPatch 2023-03-24 20:56:21 +05:00
amevarashi 8d49addd63 New settings handling 2023-03-24 20:22:54 +05:00
amevarashi fed4b54915 Fixed GetAdjacentBuildings error when called at map edge 2023-03-24 17:32:34 +05:00
amevarashi e37f45399e Added pawn.Spawned check before spawning blood filth 2022-11-12 10:45:17 +05:00
74 changed files with 2201 additions and 1541 deletions

Binary file not shown.

View File

@ -15,12 +15,12 @@
</li>
<li>
<label>ate cum</label>
<description>Tastes bad and stinky.</description>
<description>It's stinky and tastes bad.</description>
<baseMoodEffect>-2</baseMoodEffect>
</li>
<li>
<label>ate cum</label>
<description>Tastes bad. But i liked it.</description>
<description>Tastes bad. But I liked it.</description>
<baseMoodEffect>1</baseMoodEffect>
</li>
<li>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>RJWSexperience</identifier>
<version>1.1.2.1</version>
<version>1.4.1.3</version>
<dependencies>
<li>RimJobWorld >= 5.3.0</li>
</dependencies>

16
CHANGELOG.md Normal file
View File

@ -0,0 +1,16 @@
### 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

View File

@ -5,7 +5,7 @@
<NumofEatenCum.description>我吃了多少次精液。</NumofEatenCum.description>
<Lust.label>色欲</Lust.label>
<Lust.description>我多</Lust.description>
<Lust.description>我多淫荡</Lust.description>
</LanguageData>

View File

@ -5,7 +5,7 @@
<GatheredCum.description>收集起来的精液</GatheredCum.description>
<UsedCondom.label>用过的套套</UsedCondom.label>
<UsedCondom.description>装满了敬业的套套。嗯!真好吃!</UsedCondom.description>
<UsedCondom.description>装满了精液的套套。嗯!真好吃!</UsedCondom.description>
</LanguageData>

View File

@ -2,14 +2,73 @@
<LanguageData>
<RS_Mod_Title>RJW 性经验</RS_Mod_Title>
<Lust>性欲</Lust>
<!-- Sex status screen -->
<!-- 统计 -->
<RSTotalGatheredCum>总获得精液量: </RSTotalGatheredCum>
<RS_LostVirgin>{1}夺走了{0}的处女.</RS_LostVirgin>
<RS_Best_Sextype>最佳做爱姿势</RS_Best_Sextype>
<RS_Recent_Sextype>最近做爱姿势</RS_Recent_Sextype>
<RS_Sex_Partners>炮友</RS_Sex_Partners>
<RS_Cum_Swallowed>吞下精液量</RS_Cum_Swallowed>
<RS_Selected_Partner>所选性伴侣信息</RS_Selected_Partner>
<RS_Sex_Info>{0}: {1} 次</RS_Sex_Info>
<RS_SAT_AVG>比率: {0}</RS_SAT_AVG>
<RS_Sex_Count>做爱次数: </RS_Sex_Count>
<RS_Orgasms>高潮次数: </RS_Orgasms>
<RS_Recent_Sex_Partner>最近做爱对象</RS_Recent_Sex_Partner>
<RS_Recent_Sex_Partner_ToolTip>最近做爱对象.</RS_Recent_Sex_Partner_ToolTip>
<RS_First_Sex_Partner>第一次做爱对象</RS_First_Sex_Partner>
<RS_First_Sex_Partner_ToolTip>第一次做爱的对象.</RS_First_Sex_Partner_ToolTip>
<RS_Most_Sex_Partner>最多次做爱对象</RS_Most_Sex_Partner>
<RS_Most_Sex_Partner_ToolTip>做了最多次的对象.</RS_Most_Sex_Partner_ToolTip>
<RS_Best_Sex_Partner>最舒适的做爱对象</RS_Best_Sex_Partner>
<RS_Best_Sex_Partner_ToolTip>做爱时最舒服的对象.</RS_Best_Sex_Partner_ToolTip>
<RS_VirginsTaken>夺走处女数</RS_VirginsTaken>
<RS_TotalSexHad>总做爱次数</RS_TotalSexHad>
<RS_TotalSexHad_ToolTip>做爱次数.</RS_TotalSexHad_ToolTip>
<RS_Raped>被强奸: </RS_Raped>
<RS_RapedMe>强奸了我: </RS_RapedMe>
<RS_Sex_History>性爱历史</RS_Sex_History>
<RS_Statistics>做爱统计</RS_Statistics>
<RS_PartnerList>炮友列表</RS_PartnerList>
<RS_Sexuality>性欲</RS_Sexuality>
<RS_BeenRaped>被谁强奸</RS_BeenRaped>
<RS_RapedSomeone>强奸了谁</RS_RapedSomeone>
<RS_PreferRace>钟爱种族</RS_PreferRace>
<RS_Bestiality>兽交</RS_Bestiality>
<RS_Interspecies>异种</RS_Interspecies>
<RS_Normal>正常</RS_Normal>
<RS_Necrophile>恋尸癖</RS_Necrophile>
<RS_SexSkill>性技</RS_SexSkill>
<RS_NumofTimes></RS_NumofTimes>
<RS_Ago>以前</RS_Ago>
<RS_LastSex>上次做爱</RS_LastSex>
<RS_HadBestSexDaysAgo>最爱性伴侣 {0}.</RS_HadBestSexDaysAgo>
<RS_PawnLockDesc>锁定显示的小人.\n\n非锁定状态下,窗口显示内容将会自动切换到选择的小人</RS_PawnLockDesc>
<RSOption_1_Label>开启随机性记录</RSOption_1_Label>
<RSOption_1_Desc>随机化小人的性记录。</RSOption_1_Desc>
<!-- Settings tab labels -->
<!-- 设置-选项卡标题 -->
<RSTabLabelMain>主要</RSTabLabelMain>
<RSTabLabelHistory>做爱记录</RSTabLabelHistory>
<RSTabLabelDebug>调试</RSTabLabelDebug>
<!-- Mod settings: Main -->
<!-- mod设置: 主体设置 -->
<RSOption_2_Label>色欲值的影响</RSOption_2_Label>
<RSOption_2_Desc>设置色欲值对性冲动的影响。</RSOption_2_Desc>
<RSOption_8_Label>限制欲望</RSOption_8_Label>
<RSOption_8_Desc>设置欲望的限制。\n如果欲望的绝对值接近或大于这个值欲望将不太可能改变。</RSOption_8_Desc>
<RSOption_MaxSingleLustChange_Label>每种做爱的最大性欲变化值</RSOption_MaxSingleLustChange_Label>
<RSOption_MaxSingleLustChange_Desc>设置一次性行为可以改变多少性欲</RSOption_MaxSingleLustChange_Desc>
<RSOption_SexCanFillBuckets_Label>精液能装桶</RSOption_SexCanFillBuckets_Label>
<RSOption_SexCanFillBuckets_Desc>如果在精液桶附近进行了乳交、足交、打手枪将填满它</RSOption_SexCanFillBuckets_Desc>
<!-- Mod settings: Sex records -->
<!-- mod设置: 做爱记录 -->
<RSOption_1_Label>开启随机性记录</RSOption_1_Label>
<RSOption_1_Desc>随机化小人的性记录。</RSOption_1_Desc>
<RSOption_3_Label>最大色欲值偏差</RSOption_3_Label>
<RSOption_3_Desc>设置色欲的最大偏差。根据平均值的不同,色欲值可能为负。</RSOption_3_Desc>
<RSOption_3_Desc>设置色欲的最大偏差。&#10;根据平均值的不同,色欲值可能为负。</RSOption_3_Desc>
<RSOption_4_Label>平均色欲值</RSOption_4_Label>
<RSOption_4_Desc>设置色欲值的均值。</RSOption_4_Desc>
<RSOption_5_Label>最大性交次数偏差</RSOption_5_Label>
@ -18,5 +77,69 @@
<RSOption_6_Desc>设置平均每年的性交次数</RSOption_6_Desc>
<RSOption_7_Label>允许奴隶被强奸获得性经验</RSOption_7_Label>
<RSOption_7_Desc>奴隶被强奸获得性经验</RSOption_7_Desc>
<RSOption_9_Label>最小可做爱年龄</RSOption_9_Label>
<RSOption_9_Desc>设置最小的可以做爱的年龄.&#10;此值与RJW的最低性年龄无关。仅用于生成记录.</RSOption_9_Desc>
<RSOption_10_Label>处女比例</RSOption_10_Label>
<RSOption_10_Desc>不分年龄设置处女概率.</RSOption_10_Desc>
<RSOption_MinSexableFromLifestage_Label>最小可做爱年龄阶段</RSOption_MinSexableFromLifestage_Label>
<RSOption_MinSexableFromLifestage_Desc>仅用于生成记录. 在生命第一阶段即可生成做爱记录. 更适合长寿种族</RSOption_MinSexableFromLifestage_Desc>
<RSOption_EnableBastardRelation_Label>启用野种</RSOption_EnableBastardRelation_Label>
<RSOption_EnableBastardRelation_Desc>单亲或亲生父母非婚姻关系(或还未结婚)的小孩将被视作野种</RSOption_EnableBastardRelation_Desc>
<RSOption_EnableSexHistory_Label>[Caution] 启用做爱历史*</RSOption_EnableSexHistory_Label>
<RSOption_EnableSexHistory_Desc>* 重启游戏生效\n\n启用性记录窗口, information collection for the said window and save/load of this information. Also enables sex partners count in the pawn's records.\n\n[Caution] 禁用此项将导致之前已保存的记录也会丢失。</RSOption_EnableSexHistory_Desc>
<RSOption_HideGizmoWhenDrafted_Label>征召时隐藏性历史菜单</RSOption_HideGizmoWhenDrafted_Label>
<RSOption_HideGizmoWhenDrafted_Desc>隐藏当前所选的小人的性历史功能</RSOption_HideGizmoWhenDrafted_Desc>
<!-- Mod settings: Debug -->
<!-- mod设置——debug -->
<RSOption_Debug_Label>调试</RSOption_Debug_Label>
<RSOption_Debug_Desc>启用调试日志</RSOption_Debug_Desc>
<Button_ResetToDefault>重置为默认</Button_ResetToDefault>
<!-- Sex types -->
<!-- 做爱姿势 -->
<Vaginal>阴道</Vaginal>
<Anal>菊花</Anal>
<Oral>吞精</Oral>
<Masturbation>自慰</Masturbation>
<DoublePenetration>双插</DoublePenetration>
<Boobjob>乳交</Boobjob>
<Handjob>手交</Handjob>
<Footjob>足交</Footjob>
<Fingering>指交</Fingering>
<Scissoring>磨豆腐</Scissoring>
<MutualMasturbation>相互自慰</MutualMasturbation>
<Fisting>拳交</Fisting>
<MechImplant>机械</MechImplant>
<Rimming>舔肛</Rimming>
<Fellatio>口交</Fellatio>
<Cunnilingus>舔阴</Cunnilingus>
<Sixtynine>69式</Sixtynine>
<!-- Sexuality -->
<!-- 性取向 -->
<None></None>
<Asexual>无性恋</Asexual>
<Pansexual>泛性恋</Pansexual>
<Heterosexual>异性恋</Heterosexual>
<MostlyHeterosexual>主要是异性恋</MostlyHeterosexual>
<LeaningHeterosexual>双性恋,倾向异性恋</LeaningHeterosexual>
<Bisexual>双性恋</Bisexual>
<LeaningHomosexual>双性恋,倾向同性恋</LeaningHomosexual>
<MostlyHomosexual>主要是同性恋</MostlyHomosexual>
<Homosexual>同性恋</Homosexual>
<!-- Misc -->
<!-- 杂项 -->
<Lust>性欲</Lust>
<Unknown>未知</Unknown>
<Incest>乱伦</Incest>
<!-- Order mode -->
<!-- 排序规则 -->
<RS_PONormal>无序</RS_PONormal>
<RS_PoRecent>时间</RS_PoRecent>
<RS_PoMost>次数</RS_PoMost>
<RS_PoName>名字</RS_PoName>
</LanguageData>

View File

@ -43,6 +43,7 @@
<RS_Ago>ago</RS_Ago>
<RS_LastSex>last sex</RS_LastSex>
<RS_HadBestSexDaysAgo>Had best sex {0}.</RS_HadBestSexDaysAgo>
<RS_PawnLockDesc>Lock displayed pawn.\n\nWhen unlocked, window will automatically switch to a currently selected pawn.</RS_PawnLockDesc>
<!-- Settings tab labels -->
<RSTabLabelMain>Main</RSTabLabelMain>
@ -84,8 +85,10 @@
<RSOption_EnableSexHistory_Desc>* Needs a game restart\n\nEnables Sex History window, information collection for the said window and save/load of this information. Also enables sex partners count in the pawn's records.\n\n[Caution] Disabling this mid save will result in the loss of previously collected histories.</RSOption_EnableSexHistory_Desc>
<RSOption_HideGizmoWhenDrafted_Label>Hide Sex History button when drafted</RSOption_HideGizmoWhenDrafted_Label>
<RSOption_HideGizmoWhenDrafted_Desc>Hides Sex History Gizmo for currently drafted pawns</RSOption_HideGizmoWhenDrafted_Desc>
<RSOption_HideGizmoWithRJW_Label>Hide Sex History button with RJW designators</RSOption_HideGizmoWithRJW_Label>
<RSOption_HideGizmoWithRJW_Desc>Hides Sex History Gizmo if RJW designators are hidden</RSOption_HideGizmoWithRJW_Desc>
<RSOption_VirginityCheck_M2M_Label>Remove virginity with anal sex (for male/male sex)</RSOption_VirginityCheck_M2M_Label>
<RSOption_VirginityCheck_M2M_Desc>Remove virginity with anal sex (for male/male sex)</RSOption_VirginityCheck_M2M_Desc>
<RSOption_VirginityCheck_F2F_Label>Remove virginity with scissoring sex (for female/female sex)</RSOption_VirginityCheck_F2F_Label>
<RSOption_VirginityCheck_F2F_Desc>Remove virginity with scissoring sex (for female/female sex)</RSOption_VirginityCheck_F2F_Desc>
<!-- Mod settings: Debug -->
<RSOption_Debug_Label>Debug</RSOption_Debug_Label>

View File

@ -10,6 +10,8 @@
<li>/</li>
<li>1.4</li>
<li IfModActive="vanillaexpanded.skills">Mod Compatibility/Vanilla Skills Expanded</li>
<li IfModActive="vanillaracesexpanded.android">Mod Compatibility/Vanilla Races Expanded - Android</li>
<li IfModActive="vanillaracesexpanded.genie">Mod Compatibility/Vanilla Races Expanded - Genie</li>
<li IfModActive="rjw.cum">Mod Compatibility/RJW Cum</li>
</v1.4>
</loadFolders>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThinkTreeDef>
<defName>CleanSelfWithBucket</defName>
<insertTag>Humanlike_PostDuty</insertTag>
<insertPriority>100</insertPriority>
<thinkRoot Class="ThinkNode_Priority">
<subNodes>
<li Class="ThinkNode_ConditionalPrisoner">
<leaveJoinableLordIfIssuesJob>true</leaveJoinableLordIfIssuesJob>
<subNodes>
<li Class="RJWSexperienceCum.JobGiver_CleanSelfWithBucket"/>
</subNodes>
</li>
</subNodes>
</thinkRoot>
</ThinkTreeDef>
</Defs>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -1,64 +1,50 @@
using UnityEngine;
using Verse;
using Verse;
using RJWSexperience.Settings;
namespace RJWSexperience
{
public class Configurations : ModSettings, ITab
public class Configurations : ModSettings
{
public string Label => Keyed.TabLabelMain;
public const int CurrentSettingsVersion = 1;
// Defaults
public const float LustEffectPowerDefault = 0.5f;
public const bool EnableBastardRelationDefault = true;
public const float LustLimitDefault = SettingsTabHistory.MaxLustDeviationDefault / 3f;
public const float MaxSingleLustChangeDefault = 0.5f;
public const bool SexCanFillBucketsDefault = false;
public const bool selectionLockedDefault = false;
public readonly SettingHandle<float> LustEffectPower = new SettingHandle<float>("LustEffectPower", 0.5f);
public readonly SettingHandle<bool> EnableBastardRelation = new SettingHandle<bool>("EnableBastardRelation", true);
public readonly SettingHandle<float> LustLimit = new SettingHandle<float>("LustLimit", 150f);
public readonly SettingHandle<float> MaxSingleLustChange = new SettingHandle<float>("maxSingleLustChange", 1f);
public readonly SettingHandle<bool> SexCanFillBuckets = new SettingHandle<bool>("SexCanFillBuckets", false);
// Private attributes
private float lustEffectPower = LustEffectPowerDefault;
private bool enableBastardRelation = EnableBastardRelationDefault;
private float lustLimit = LustLimitDefault;
private float maxSingleLustChange = MaxSingleLustChangeDefault;
private bool sexCanFillBuckets = SexCanFillBucketsDefault;
private bool selectionLocked = selectionLockedDefault;
private SettingsTabHistory history = SettingsTabHistory.CreateDefault();
private SettingsTabDebug debug = new SettingsTabDebug();
public readonly SettingHandle<bool> EnableRecordRandomizer = new SettingHandle<bool>("EnableRecordRandomizer", true);
public readonly SettingHandle<float> MaxLustDeviation = new SettingHandle<float>("MaxLustDeviation", 200f);
public readonly SettingHandle<float> AvgLust = new SettingHandle<float>("AvgLust", 0f);
public readonly SettingHandle<float> MaxSexCountDeviation = new SettingHandle<float>("MaxSexCountDeviation", 90f);
public readonly SettingHandle<float> SexPerYear = new SettingHandle<float>("SexPerYear", 30f);
public readonly SettingHandle<bool> MinSexableFromLifestage = new SettingHandle<bool>("MinSexableFromLifestage", true);
public readonly SettingHandle<float> MinSexablePercent = new SettingHandle<float>("MinSexablePercent", 0.2f);
public readonly SettingHandle<float> VirginRatio = new SettingHandle<float>("VirginRatio", 0.01f);
public readonly SettingHandle<bool> SlavesBeenRapedExp = new SettingHandle<bool>("SlavesBeenRapedExp", true);
public readonly SettingHandle<bool> EnableSexHistory = new SettingHandle<bool>("EnableSexHistory", true);
public readonly SettingHandle<bool> HideGizmoWhenDrafted = new SettingHandle<bool>("HideGizmoWhenDrafted", true);
//Public read-only properties
public float LustEffectPower => lustEffectPower;
public bool EnableBastardRelation => enableBastardRelation;
public float LustLimit => lustLimit;
public float MaxSingleLustChange => maxSingleLustChange;
public bool SexCanFillBuckets => sexCanFillBuckets;
public SettingsTabHistory History => history;
public SettingsTabDebug Debug => debug;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S2292:Trivial properties should be auto-implemented", Justification = "Can't scribe property")]
public bool SelectionLocked { get => selectionLocked; set => selectionLocked = value; }
public readonly SettingHandle<bool> VirginityCheck_M2M_Anal = new SettingHandle<bool>("VirginityCheck_M2M_Anal", true);
public readonly SettingHandle<bool> VirginityCheck_F2F_Scissoring = new SettingHandle<bool>("VirginityCheck_F2F_Scissoring", false);
public readonly SettingHandle<bool> DevMode = new SettingHandle<bool>("DevMode", false);
public void ResetToDefault()
{
lustEffectPower = LustEffectPowerDefault;
enableBastardRelation = EnableBastardRelationDefault;
lustLimit = LustLimitDefault;
maxSingleLustChange = MaxSingleLustChangeDefault;
sexCanFillBuckets = SexCanFillBucketsDefault;
}
public readonly SettingHandle<bool> SelectionLocked = new SettingHandle<bool>("SelectionLocked", false);
public override void ExposeData()
{
SettingsContainer history = SettingsContainer.CreateHistoryContainer(this);
int version = CurrentSettingsVersion;
Scribe_Values.Look(ref version, "SettingsVersion", 0);
Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault);
Scribe_Values.Look(ref enableBastardRelation, "EnableBastardRelation", EnableBastardRelationDefault);
Scribe_Values.Look(ref lustLimit, "LustLimit", LustLimitDefault);
Scribe_Values.Look(ref maxSingleLustChange, "maxSingleLustChange", MaxSingleLustChangeDefault);
Scribe_Values.Look(ref selectionLocked, "SelectionLocked", selectionLockedDefault);
Scribe_Values.Look(ref sexCanFillBuckets, "SexCanFillBuckets", SexCanFillBucketsDefault);
Scribe_Deep.Look(ref history, "History");
Scribe_Deep.Look(ref debug, "Debug");
LustEffectPower.Scribe();
EnableBastardRelation.Scribe();
LustLimit.Scribe();
MaxSingleLustChange.Scribe();
SelectionLocked.Scribe();
SexCanFillBuckets.Scribe();
DevMode.Scribe();
Scribe_Deep.Look(ref history, "History", history.Handles);
base.ExposeData();
if (Scribe.mode != LoadSaveMode.LoadingVars)
@ -66,41 +52,9 @@ namespace RJWSexperience
if (history == null)
{
history = new SettingsTabHistory();
// Previously history settings were in Configurations. Direct call to try read old data
history.ExposeData();
SettingsContainer.CreateHistoryContainer(this).ExposeData();
}
if (debug == null)
{
debug = new SettingsTabDebug();
debug.Reset();
}
}
public void DoTabContents(Rect inRect)
{
const float lineHeight = SettingsWidgets.lineHeight;
Listing_Standard listmain = new Listing_Standard();
listmain.maxOneColumn = true;
listmain.Begin(inRect);
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_2_Label + " x" + lustEffectPower, Keyed.Option_2_Desc, ref lustEffectPower, 0f, 2f, 0.01f);
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_8_Label + " " + lustLimit, Keyed.Option_8_Desc, ref lustLimit, 0f, 5000f, 1f);
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_MaxSingleLustChange_Label + " " + maxSingleLustChange, Keyed.Option_MaxSingleLustChange_Desc, ref maxSingleLustChange, 0f, 10f, 0.05f);
listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
listmain.CheckboxLabeled(Keyed.Option_SexCanFillBuckets_Label, ref sexCanFillBuckets, Keyed.Option_SexCanFillBuckets_Desc);
if (SexperienceMod.Settings.Debug.DevMode)
LustUtility.DrawGraph(listmain.GetRect(300f));
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
{
ResetToDefault();
}
listmain.End();
}
}
}

View File

@ -39,11 +39,11 @@ namespace RJWSexperience // Used in Menstruation with this namespace
stringBuilder.Append(Keyed.RSTotalGatheredCum).AppendFormat("{0:0.##}ml", totalGathered);
if (SexperienceMod.Settings.Debug.DevMode)
if (SexperienceMod.Settings.DevMode)
{
stringBuilder.AppendLine();
stringBuilder.AppendLine($"[Debug] stored: {StoredStackCount}");
stringBuilder.Append($"[Debug] storedDecimalRemainder: {storedDecimalRemainder}");
stringBuilder.Append("[Debug] stored: ").Append(StoredStackCount).AppendLine();
stringBuilder.Append("[Debug] storedDecimalRemainder: ").Append(storedDecimalRemainder);
}
return stringBuilder.ToString();
@ -51,7 +51,7 @@ namespace RJWSexperience // Used in Menstruation with this namespace
public void AddCum(float amount)
{
AddCum(amount, VariousDefOf.GatheredCum);
AddCum(amount, RsDefOf.Thing.GatheredCum);
}
public void AddCum(float amount, ThingDef cumDef)
@ -69,7 +69,7 @@ namespace RJWSexperience // Used in Menstruation with this namespace
cum.stackCount = num;
if (cum.stackCount > 0 && !GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res))
{
FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num);
FilthMaker.TryMakeFilth(PositionHeld, Map, RsDefOf.Thing.FilthCum, num);
}
storedDecimalRemainder -= num;
}

View File

@ -125,7 +125,7 @@ namespace RJWSexperience.Cum
const float allOf = 1000f;
log.Message($"FeedCum({pawn.NameShortColored}, {amount})");
Thing cum = ThingMaker.MakeThing(VariousDefOf.GatheredCum);
Thing cum = ThingMaker.MakeThing(RsDefOf.Thing.GatheredCum);
cum.stackCount = (int)Math.Ceiling(amount);
log.Message($"Created a stack of {cum.stackCount} cum");
cum.Ingested(pawn, allOf);
@ -145,14 +145,15 @@ namespace RJWSexperience.Cum
if (!sexFillsCumbuckets)
return;
IEnumerable<Building_CumBucket> buckets = props.pawn.GetAdjacentBuildings<Building_CumBucket>();
// Enumerable throws System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
List<Building_CumBucket> buckets = props.pawn.GetAdjacentBuildings<Building_CumBucket>().ToList();
if (buckets?.EnumerableCount() > 0)
if (buckets?.Count > 0)
{
var initialCum = CumUtility.GetCumVolume(props.pawn);
var initialCum = GetCumVolume(props.pawn);
foreach (Building_CumBucket bucket in buckets)
{
bucket.AddCum(initialCum / buckets.EnumerableCount());
bucket.AddCum(initialCum / buckets.Count);
}
}
}

View File

@ -6,7 +6,7 @@ namespace RJWSexperience.Cum.FilterWorkers
{
public override bool Matches(Thing t)
{
return IsCum(t) || IsFoodWithCum(t);
return IsCum(t.def) || IsFoodWithCum(t);
}
}
}

View File

@ -10,20 +10,18 @@ namespace RJWSexperience.Cum.FilterWorkers
return def.IsIngestible && def.IsProcessedFood;
}
protected bool IsCum(Thing t) => IsCum(t.def);
protected bool IsCum(ThingDef t) => t == VariousDefOf.GatheredCum;
protected bool IsCum(ThingDef t) => t == RsDefOf.Thing.GatheredCum;
protected bool IsFoodWithCum(Thing food)
{
CompIngredients compIngredients = food.TryGetComp<CompIngredients>();
if (compIngredients == null)
if (compIngredients?.ingredients == null)
return false;
foreach (ThingDef ingredient in compIngredients.ingredients)
for (int i = 0; i < compIngredients.ingredients.Count; i++)
{
if (IsCum(ingredient))
if (IsCum(compIngredients.ingredients[i]))
return true;
}

View File

@ -6,7 +6,7 @@ namespace RJWSexperience.Cum.FilterWorkers
{
public override bool Matches(Thing t)
{
return !IsCum(t) && !IsFoodWithCum(t);
return !IsCum(t.def) && !IsFoodWithCum(t);
}
}
}

View File

@ -12,8 +12,8 @@ namespace RJWSexperience.Cum
{
int amount = ingested.stackCount * (int)unitAmount;
Logs.LogManager.GetLogger<IngestionOutcomeDoer_RecordEatenCum, Logs.DebugLogProvider>().Message($"Record {pawn.NameShortColored} eating {amount} ml of cum");
pawn.records.Increment(VariousDefOf.NumofEatenCum);
pawn.records.AddTo(VariousDefOf.AmountofEatenCum, amount);
pawn.records.Increment(RsDefOf.Record.NumofEatenCum);
pawn.records.AddTo(RsDefOf.Record.AmountofEatenCum, amount);
}
}
}

View File

@ -17,7 +17,7 @@ namespace RJWSexperience.Cum.Interactions
if (context.Internals.Submissive.Parts.Penises.Any())
return GetForCumAddict(context.Internals.Dominant.Pawn);
if (AddictionUtility.IsAddicted(context.Internals.Submissive.Pawn, VariousDefOf.Cum))
if (AddictionUtility.IsAddicted(context.Internals.Submissive.Pawn, RsDefOf.Chemical.Cum))
return GetForPartner();
return Enumerable.Empty<Weighted<LewdablePartKind>>();
@ -28,7 +28,7 @@ namespace RJWSexperience.Cum.Interactions
if (context.Internals.Dominant.Parts.Penises.Any())
return GetForCumAddict(context.Internals.Submissive.Pawn);
if (AddictionUtility.IsAddicted(context.Internals.Dominant.Pawn, VariousDefOf.Cum))
if (AddictionUtility.IsAddicted(context.Internals.Dominant.Pawn, RsDefOf.Chemical.Cum))
return GetForPartner();
return Enumerable.Empty<Weighted<LewdablePartKind>>();
@ -42,7 +42,7 @@ namespace RJWSexperience.Cum.Interactions
var log = LogManager.GetLogger<CumAddictPartKindUsageRule, DebugLogProvider>();
log.Message($"Called for {pawn.NameShortColored}");
if (!(pawn.needs?.TryGetNeed(VariousDefOf.Chemical_Cum) is Need_Chemical cumNeed))
if (!(pawn.needs?.TryGetNeed(RsDefOf.Need.Chemical_Cum) is Need_Chemical cumNeed))
yield break;
log.Message($"{pawn.NameShortColored} is cum addict, current desire level: {cumNeed.CurCategory}");

View File

@ -1,39 +1,17 @@
using RimWorld;
namespace RJWSexperience // Change in namespace will lead to save incompatibility
namespace RJWSexperience // Change in namespace will lead to save incompatibility
{
public class Thought_AteCum : Thought_Recordbased
{
public override int CurStageIndex
protected override void UpdateCurStage()
{
get
if (pawn?.health?.hediffSet?.HasHediff(RsDefOf.Hediff.CumAddiction) ?? false)
{
if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false)
return def.stages.Count - 1;
return base.CurStageIndex;
SetForcedStage(def.stages.Count - 1);
}
}
public override bool TryMergeWithExistingMemory(out bool showBubble)
{
ThoughtHandler thoughts = pawn.needs.mood.thoughts;
if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
else
{
Thought_AteCum thought_Memory = (Thought_AteCum)thoughts.memories.OldestMemoryInGroup(this);
if (thought_Memory != null)
{
showBubble = thought_Memory.age > thought_Memory.def.DurationTicks / 2;
thought_Memory.Merged();
return true;
}
base.UpdateCurStage();
}
showBubble = true;
return false;
}
protected virtual void Merged()
{
age = 0;
}
}
}

View File

@ -8,9 +8,9 @@ namespace RJWSexperience
public static class DebugToolsSexperience
{
[DebugAction("RJW Sexperience", "Reset pawn's record", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
private static void ResetRecords(Pawn p)
public static void ResetRecords(Pawn p)
{
Trait virgin = p.story?.traits?.GetTrait(VariousDefOf.Virgin);
Trait virgin = p.story?.traits?.GetTrait(RsDefOf.Trait.Virgin);
if (virgin != null) p.story.traits.RemoveTrait(virgin);
ResetRecord(p, true);
if (ResetRecord(p, false))
@ -19,7 +19,7 @@ namespace RJWSexperience
}
[DebugAction("RJW Sexperience", "Reset pawn's record(virgin)", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
private static void ResetRecordsZero(Pawn p)
public static void ResetRecordsZero(Pawn p)
{
ResetRecord(p, true);
Virginity.TraitHandler.AddVirginTrait(p);
@ -27,60 +27,59 @@ namespace RJWSexperience
}
[DebugAction("RJW Sexperience", "Reset lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
private static void ResetLust(Pawn p)
public static void ResetLust(Pawn p)
{
float lust = RecordRandomizer.RandomizeLust(p);
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + lust);
}
[DebugAction("RJW Sexperience", "Set lust to 0", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
private static void SetLust(Pawn p)
public static void SetLust(Pawn p)
{
p.records.SetTo(VariousDefOf.Lust, 0);
p.records.SetTo(RsDefOf.Record.Lust, 0);
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: 0");
}
[DebugAction("RJW Sexperience", "Add 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
private static void AddLust(Pawn p)
public static void AddLust(Pawn p)
{
p.records.AddTo(VariousDefOf.Lust, 10);
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
p.records.AddTo(RsDefOf.Record.Lust, 10);
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(RsDefOf.Record.Lust));
}
[DebugAction("RJW Sexperience", "Subtract 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
private static void SubtractLust(Pawn p)
public static void SubtractLust(Pawn p)
{
p.records.AddTo(VariousDefOf.Lust, -10);
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
p.records.AddTo(RsDefOf.Record.Lust, -10);
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(RsDefOf.Record.Lust));
}
private static bool ResetRecord(Pawn pawn, bool allzero)
{
if (!allzero)
{
if (SexperienceMod.Settings.History.EnableRecordRandomizer && xxx.is_human(pawn))
if (SexperienceMod.Settings.EnableRecordRandomizer && xxx.is_human(pawn))
{
return RecordRandomizer.Randomize(pawn);
}
}
else
{
pawn.records.SetTo(VariousDefOf.Lust, 0);
pawn.records.SetTo(VariousDefOf.NumofEatenCum, 0);
pawn.records.SetTo(VariousDefOf.AmountofEatenCum, 0);
pawn.records.SetTo(VariousDefOf.VaginalSexCount, 0);
pawn.records.SetTo(VariousDefOf.AnalSexCount, 0);
pawn.records.SetTo(VariousDefOf.OralSexCount, 0);
pawn.records.SetTo(VariousDefOf.BlowjobCount, 0);
pawn.records.SetTo(VariousDefOf.CunnilingusCount, 0);
pawn.records.SetTo(VariousDefOf.GenitalCaressCount, 0);
pawn.records.SetTo(VariousDefOf.HandjobCount, 0);
pawn.records.SetTo(VariousDefOf.FingeringCount, 0);
pawn.records.SetTo(VariousDefOf.FootjobCount, 0);
pawn.records.SetTo(VariousDefOf.MiscSexualBehaviorCount, 0);
pawn.records.SetTo(VariousDefOf.SexPartnerCount, 0);
pawn.records.SetTo(VariousDefOf.OrgasmCount, 0);
pawn.records.SetTo(RsDefOf.Record.Lust, 0);
pawn.records.SetTo(RsDefOf.Record.NumofEatenCum, 0);
pawn.records.SetTo(RsDefOf.Record.AmountofEatenCum, 0);
pawn.records.SetTo(RsDefOf.Record.VaginalSexCount, 0);
pawn.records.SetTo(RsDefOf.Record.AnalSexCount, 0);
pawn.records.SetTo(RsDefOf.Record.OralSexCount, 0);
pawn.records.SetTo(RsDefOf.Record.BlowjobCount, 0);
pawn.records.SetTo(RsDefOf.Record.CunnilingusCount, 0);
pawn.records.SetTo(RsDefOf.Record.GenitalCaressCount, 0);
pawn.records.SetTo(RsDefOf.Record.HandjobCount, 0);
pawn.records.SetTo(RsDefOf.Record.FingeringCount, 0);
pawn.records.SetTo(RsDefOf.Record.FootjobCount, 0);
pawn.records.SetTo(RsDefOf.Record.MiscSexualBehaviorCount, 0);
pawn.records.SetTo(RsDefOf.Record.SexPartnerCount, 0);
pawn.records.SetTo(RsDefOf.Record.OrgasmCount, 0);
pawn.records.SetTo(xxx.CountOfBeenRapedByAnimals, 0);
pawn.records.SetTo(xxx.CountOfBeenRapedByHumanlikes, 0);
pawn.records.SetTo(xxx.CountOfBeenRapedByInsects, 0);

View File

@ -13,7 +13,7 @@ namespace RJWSexperience
return false;
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
if (relations.EnumerableNullOrEmpty())
if (relations == null)
return false;
foreach (PawnRelationDef relation in relations)
@ -27,71 +27,54 @@ namespace RJWSexperience
public static float GetSexStat(this Pawn pawn)
{
if (xxx.is_human(pawn) && !pawn.Dead)
return pawn.GetStatValue(VariousDefOf.SexAbility);
return pawn.GetStatValue(RsDefOf.Stat.SexAbility);
return 1.0f;
}
public static T GetAdjacentBuilding<T>(this Pawn pawn) where T : Building
{
if (!pawn.Spawned)
return null;
EdificeGrid edifice = pawn.Map.edificeGrid;
if (edifice[pawn.Position] is T building)
return building;
foreach (IntVec3 pos in GenAdjFast.AdjacentCells8Way(pawn.Position))
{
if (edifice[pos] is T adjBuilding)
return adjBuilding;
}
return null;
}
public static T GetAdjacentBuilding<T>(this Pawn pawn) where T : Building => GetAdjacentBuildings<T>(pawn).FirstOrFallback();
public static IEnumerable<T> GetAdjacentBuildings<T>(this Pawn pawn) where T : Building
{
var results = new List<T>();
if (!pawn.Spawned)
return results;
yield break;
EdificeGrid edifice = pawn.Map.edificeGrid;
if (edifice[pawn.Position] is T building)
results.Add(building);
yield return building;
foreach (IntVec3 pos in GenAdjFast.AdjacentCells8Way(pawn.Position))
{
if (edifice[pos] is T adjBuilding)
results.Add(adjBuilding);
if (pos.InBounds(pawn.Map) && edifice[pos] is T adjBuilding)
yield return adjBuilding;
}
return results;
}
/// <summary>
/// If the pawn is virgin, return true.
/// Check if the pawn is virgin
/// </summary>
public static bool IsVirgin(this Pawn pawn)
{
return pawn.records.GetValue(VariousDefOf.VaginalSexCount) == 0;
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
}
/// <summary>
/// If pawn is virgin, lose his/her virginity.
/// Remove virginity if pawn is virgin and announce it
/// </summary>
public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props)
public static void TryRemoveVirginity(this Pawn pawn, Pawn partner, SexProps props)
{
if (props?.sexType != xxx.rjwSextype.Vaginal)
return;
int? removedDegree = Virginity.TraitHandler.RemoveVirginTrait(pawn);
if (pawn.IsVirgin())
if (SexperienceMod.Settings.EnableSexHistory && pawn.IsVirgin())
{
pawn.TryGetComp<SexHistory.SexHistoryComp>()?.RecordFirst(partner, props);
if (removedDegree != null)
Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
pawn.TryGetComp<SexHistory.SexHistoryComp>()?.RecordFirst(partner);
}
if (removedDegree != null)
if (removedDegree != null && removedDegree != Virginity.TraitDegree.FemaleAfterSurgery)
{
Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
RJWUtility.ThrowVirginHistoryEvent(pawn, partner, props, (int)removedDegree);
}
}
}
}

View File

@ -19,11 +19,22 @@ namespace RJWSexperience.ExtensionMethods
public static bool IsBestiality(this SexProps props)
{
if (props.partner != null)
if (props.hasPartner())
{
return props.pawn.IsAnimal() ^ props.partner.IsAnimal();
}
return false;
}
/// <summary>
/// Get a not-so-unique ID. Same interaction between the same partners will return same ID
/// </summary>
public static int GetTempId(this SexProps props)
{
return props.pawn.GetHashCode() ^
(props.partner?.GetHashCode() ?? 0) ^
props.dictionaryKey.GetHashCode() ^
(props.isReceiver ? 0 : 1);
}
}
}

View File

@ -16,7 +16,6 @@ namespace RJWSexperience
{
var har = new Harmony("RJW_Sexperience");
har.PatchAll(Assembly.GetExecutingAssembly());
Pawn_GetGizmos.DoConditionalPatch(har);
InjectIntoRjwInteractionServices();
}

View File

@ -9,12 +9,14 @@ namespace RJWSexperience
public static class Keyed
{
public static string RS_LostVirgin(string pawn, string partner) => "RS_LostVirgin".Translate(pawn.Colorize(Color.yellow), partner.Colorize(Color.yellow));
public static string RS_Sex_Info(string sextype, string sexcount) => "RS_Sex_Info".Translate(sextype, sexcount);
public static string RS_SAT_AVG(string avgsat) => "RS_SAT_AVG".Translate(avgsat);
public static string RS_SexInfo(string sextype, int sexcount) => string.Format(RS_Sex_Info, sextype, sexcount);
public static string RS_SatAVG(float avgsat) => string.Format(RS_SAT_AVG, avgsat.ToStringPercent());
public static string RS_HadBestSexDaysAgo(string days) => "RS_HadBestSexDaysAgo".Translate(days);
public static readonly string Mod_Title = "RS_Mod_Title".Translate();
public static readonly string RSTotalGatheredCum = "RSTotalGatheredCum".Translate();
public static readonly string RS_Sex_Info = "RS_Sex_Info".Translate();
public static readonly string RS_SAT_AVG = "RS_SAT_AVG".Translate();
public static readonly string RS_Best_Sextype = "RS_Best_Sextype".Translate();
public static readonly string RS_Recent_Sextype = "RS_Recent_Sextype".Translate();
public static readonly string RS_Sex_Partners = "RS_Sex_Partners".Translate();
@ -51,7 +53,8 @@ namespace RJWSexperience
public static readonly string RS_SexSkill = "RS_SexSkill".Translate();
public static readonly string RS_NumofTimes = "RS_NumofTimes".Translate();
public static readonly string RS_Ago = "RS_Ago".Translate();
public static readonly string RS_LastSex = "RS_LastSex".Translate();
public static readonly string RS_LastSex = "RS_LastSex".Translate().CapitalizeFirst();
public static readonly string RS_PawnLockDesc = "RS_PawnLockDesc".Translate();
[MayRequireRoyalty] public static readonly string Slave = "Slave".Translate();
public static readonly string TabLabelMain = "RSTabLabelMain".Translate();
@ -95,6 +98,10 @@ namespace RJWSexperience
public static readonly string Option_HideGizmoWithRJW_Label = "RSOption_HideGizmoWithRJW_Label".Translate();
public static readonly string Option_HideGizmoWithRJW_Desc = "RSOption_HideGizmoWithRJW_Desc".Translate();
public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();
public static readonly string Option_VirginityCheck_M2M_Label = "RSOption_VirginityCheck_M2M_Label".Translate();
public static readonly string Option_VirginityCheck_M2M_Desc = "RSOption_VirginityCheck_M2M_Desc".Translate();
public static readonly string Option_VirginityCheck_F2F_Label = "RSOption_VirginityCheck_F2F_Label".Translate();
public static readonly string Option_VirginityCheck_F2F_Desc = "RSOption_VirginityCheck_F2F_Desc".Translate();
public static string Translate(this PartnerOrderMode mode)
{

View File

@ -4,6 +4,6 @@ namespace RJWSexperience.Logs
{
public class DebugLogProvider : ILogProvider
{
public bool IsActive => SexperienceMod.Settings.Debug.DevMode;
public bool IsActive => SexperienceMod.Settings.DevMode;
}
}

View File

@ -74,7 +74,7 @@ namespace RJWSexperience
public static void UpdateLust(SexProps props, float satisfaction, float baseSatisfaction)
{
float? lust = props.pawn.records?.GetValue(VariousDefOf.Lust);
float? lust = props.pawn.records?.GetValue(RsDefOf.Record.Lust);
if (lust == null)
return;
@ -97,7 +97,7 @@ namespace RJWSexperience
return;
LogManager.GetLogger<DebugLogProvider>("LustUtility").Message($"{props.pawn.NameShortColored}'s lust changed by {lustDelta} (from {lust})");
props.pawn.records.AddTo(VariousDefOf.Lust, lustDelta);
props.pawn.records.AddTo(RsDefOf.Record.Lust, lustDelta);
}
private static float LustIncrementFactor(float lust)

View File

@ -0,0 +1,37 @@
/*using HarmonyLib;
using System.Xml;
using Verse;
namespace RJWSexperience.Patches
{
public static class ConditionalDefLoad
{
public static void DoPatch()
{
Harmony harmony = new Harmony("RJW_SexperienceXmlLoad");
harmony.Patch(AccessTools.Method(typeof(DirectXmlLoader), nameof(DirectXmlLoader.DefFromNode)), new HarmonyMethod(typeof(ConditionalDefLoad), nameof(ConditionalDefLoad.Prefix)));
}
public static bool Prefix(XmlNode node, LoadableXmlAsset loadingAsset, ref Def __result)
{
if (node.NodeType != XmlNodeType.Element)
{
return true;
}
var settingName = node.Attributes?["RsLoadFlag"]?.Value;
if (settingName.NullOrEmpty())
{
return true;
}
if (SexperienceMod.Settings.GetValue<bool>(settingName))
{
__result = null;
return false;
}
return true;
}
}
}*/

View File

@ -11,19 +11,20 @@ namespace RJWSexperience
{
static DefInjection()
{
if (SexperienceMod.Settings.History.EnableSexHistory)
if (SexperienceMod.Settings.EnableSexHistory)
InjectRaces();
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Roslynator", "RCS1146:Use conditional access.", Justification = "race != null is needed")]
private static void InjectRaces()
{
IEnumerable<ThingDef> PawnDefs = DefDatabase<ThingDef>.AllDefs.Where(x => x.race != null && !x.race.IsMechanoid);
if (PawnDefs.EnumerableNullOrEmpty())
return;
CompProperties comp = new CompProperties(typeof(SexHistoryComp));
CompProperties compProperties = new CompProperties(typeof(SexHistoryComp));
foreach (ThingDef def in PawnDefs)
def.comps.Add(comp);
def.comps.Add(compProperties);
LogManager.GetLogger<DebugLogProvider>("StaticConstructorOnStartup").Message($"Injected SexHistoryComp into {PawnDefs.Count()} pawn Defs");
}

View File

@ -1,52 +0,0 @@
using HarmonyLib;
using RJWSexperience.Logs;
using RJWSexperience.SexHistory;
using System.Collections.Generic;
using System.Reflection;
using Verse;
namespace RJWSexperience
{
public static class Pawn_GetGizmos
{
private static Settings.SettingsTabHistory Settings => SexperienceMod.Settings.History;
public static void DoConditionalPatch(Harmony harmony)
{
if (!Settings.EnableSexHistory)
return;
MethodInfo original = typeof(Pawn).GetMethod(nameof(Pawn.GetGizmos));
MethodInfo postfix = typeof(Pawn_GetGizmos).GetMethod(nameof(Pawn_GetGizmos.Postfix));
harmony.Patch(original, postfix: new HarmonyMethod(postfix));
LogManager.GetLogger<DebugLogProvider>(nameof(Pawn_GetGizmos)).Message("Applied conditional patch to Pawn.GetGizmos()");
}
public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance)
{
if (Settings.HideGizmoWhenDrafted && __instance.Drafted)
return;
if (Find.Selector.NumSelected > 1)
return;
if (Settings.HideGizmoWithRJW && !rjw.RJWSettings.show_RJW_designation_box)
return;
SexHistoryComp history = __instance.TryGetComp<SexHistoryComp>();
if (history == null)
return;
__result = AddHistoryGizmo(history.Gizmo, __result);
}
private static IEnumerable<Gizmo> AddHistoryGizmo(Gizmo historyGizmo, IEnumerable<Gizmo> gizmos)
{
foreach (Gizmo gizmo in gizmos)
yield return gizmo;
yield return historyGizmo;
}
}
}

View File

@ -5,12 +5,13 @@ using RJWSexperience.Cum;
using RJWSexperience.Logs;
using RJWSexperience.SexHistory;
using System;
using System.Collections.Generic;
using UnityEngine;
using Verse;
namespace RJWSexperience
{
[HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")]
[HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")] // Despite the name, called every tick
public static class RJW_Patch_Orgasm
{
public static void Postfix(JobDriver_Sex __instance)
@ -19,17 +20,17 @@ namespace RJWSexperience
{
if (__instance.Sexprops.isRape && __instance.Sexprops.isReceiver)
{
__instance.pawn?.skills?.Learn(VariousDefOf.Sex, 0.05f, true);
__instance.pawn?.skills?.Learn(RsDefOf.Skill.Sex, 0.05f, true);
}
else
{
__instance.pawn?.skills?.Learn(VariousDefOf.Sex, 0.35f, true);
__instance.pawn?.skills?.Learn(RsDefOf.Skill.Sex, 0.35f, true);
}
}
}
}
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))] // Actual on orgasm method
public static class RJW_Patch_SatisfyPersonal
{
private const float base_sat_per_fuck = 0.4f;
@ -43,9 +44,9 @@ namespace RJWSexperience
{
LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
CumUtility.FillCumBuckets(props);
props.pawn.records?.Increment(VariousDefOf.OrgasmCount);
if (SexperienceMod.Settings.History.EnableSexHistory && props.partner != null)
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSatisfaction(props.partner, props, satisfaction);
props.pawn.records?.Increment(RsDefOf.Record.OrgasmCount);
if (SexperienceMod.Settings.EnableSexHistory && props.hasPartner())
props.pawn.TryGetComp<SexHistoryComp>()?.RecordOrgasm(props.partner, props, satisfaction);
}
}
@ -63,7 +64,7 @@ namespace RJWSexperience
{
public static void Postfix(Pawn pawn)
{
SkillRecord sexskill = pawn.skills.GetSkill(VariousDefOf.Sex);
SkillRecord sexskill = pawn.skills.GetSkill(RsDefOf.Skill.Sex);
if (sexskill != null)
{
sexskill.passion = Passion.Major;
@ -80,7 +81,7 @@ namespace RJWSexperience
{
RJWUtility.UpdateSextypeRecords(props);
if (!SexperienceMod.Settings.History.EnableSexHistory || props.partner == null)
if (!SexperienceMod.Settings.EnableSexHistory || !props.hasPartner())
return;
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);
@ -93,10 +94,43 @@ namespace RJWSexperience
{
public static void Postfix(JobDriver_SexBaseInitiator __instance)
{
if (__instance.Partner != null)
if (__instance.Sexprops.hasPartner())
{
__instance.pawn.PoptheCherry(__instance.Partner, __instance.Sexprops);
__instance.Partner.PoptheCherry(__instance.pawn, __instance.Sexprops);
// remove hetero virginity
if((__instance.Sexprops.sexType == xxx.rjwSextype.Vaginal || __instance.Sexprops.sexType == xxx.rjwSextype.DoublePenetration))
{
__instance.pawn.TryRemoveVirginity(__instance.Partner, __instance.Sexprops);
__instance.Partner.TryRemoveVirginity(__instance.pawn, __instance.Sexprops);
} else if(__instance.Sexprops.sexType == xxx.rjwSextype.Fisting)
{
//check if receiver is a virgin female..
Pawn receiver = __instance.Sexprops.IsInitiator() ? __instance.Partner : __instance.pawn;
if (receiver != null && receiver.gender == Gender.Female && receiver.IsVirgin())
{
Pawn initiator = __instance.Sexprops.IsInitiator() ? __instance.pawn : __instance.Partner;
receiver.TryRemoveVirginity(initiator, __instance.Sexprops);
}
}
else
{
// check if both pawn are male -> anal used as alternative virginity remover
if(SexperienceMod.Settings.VirginityCheck_M2M_Anal &&
__instance.Sexprops.sexType == xxx.rjwSextype.Anal
&& __instance.pawn.gender == Gender.Male && __instance.Partner.gender == Gender.Male)
{
__instance.pawn.TryRemoveVirginity(__instance.Partner, __instance.Sexprops);
__instance.Partner.TryRemoveVirginity(__instance.pawn, __instance.Sexprops);
}
// check if both pawn are female -> scissoring used as alternative virginity remover
if(SexperienceMod.Settings.VirginityCheck_F2F_Scissoring &&
__instance.Sexprops.sexType == xxx.rjwSextype.Scissoring
&& __instance.pawn.gender == Gender.Female && __instance.Partner.gender == Gender.Female)
{
__instance.pawn.TryRemoveVirginity(__instance.Partner, __instance.Sexprops);
__instance.Partner.TryRemoveVirginity(__instance.pawn, __instance.Sexprops);
}
}
}
}
}
@ -107,13 +141,11 @@ namespace RJWSexperience
/// <summary>
/// If masturbation and current map has a bucket, return location near the bucket
/// </summary>
/// <param name="pawn"></param>
/// <param name="partner"></param>
/// <param name="__result"></param>
/// <returns></returns>
/// <param name="__result">The place to stand near a bucket</param>
/// <returns>Run original method</returns>
public static bool Prefix(Pawn pawn, Pawn partner, ref IntVec3 __result)
{
if (partner != null)
if (partner != null && partner != pawn)
return true; // Not masturbation
var log = LogManager.GetLogger<DebugLogProvider>("RJW_Patch_CasualSex_Helper_FindSexLocation");
@ -129,13 +161,51 @@ namespace RJWSexperience
if (bucket == null)
{
log.Message("Bucket not found");
log.Message("404 Bucket not found");
return true;
}
__result = bucket.RandomAdjacentCell8Way();
log.Message($"Bucket location: {__result}");
return false;
Room bucketRoom = bucket.GetRoom();
List<IntVec3> cellsAroundBucket = GenAdjFast.AdjacentCells8Way(bucket.Position);
IntVec3 doorNearBucket = IntVec3.Invalid;
foreach (IntVec3 cell in cellsAroundBucket.InRandomOrder())
{
if (!cell.Standable(bucket.Map))
{
log.Message($"Discarded {cell}: not standable");
continue;
}
if (cell.GetRoom(bucket.Map) != bucketRoom)
{
if (cell.GetDoor(bucket.Map) != null)
{
doorNearBucket = cell;
}
else
{
log.Message($"Discarded {cell}: different room");
}
continue;
}
__result = cell;
log.Message($"Masturbate at location: {__result}");
return false;
}
if (doorNearBucket != IntVec3.Invalid)
{
__result = doorNearBucket;
log.Message($"No proper place found, go jack off in the doorway: {__result}");
return false;
}
log.Message($"Failed to find situable location near the bucket at {bucket.Position}");
return true;
}
}

View File

@ -16,7 +16,7 @@ namespace RJWSexperience
bool doVirginTrait = true;
if (SexperienceMod.Settings.History.EnableRecordRandomizer && __result.DevelopmentalStage != DevelopmentalStage.Newborn && xxx.is_human(__result))
if (SexperienceMod.Settings.EnableRecordRandomizer && __result.DevelopmentalStage != DevelopmentalStage.Newborn && xxx.is_human(__result))
doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result);
if (doVirginTrait)
@ -32,11 +32,11 @@ namespace RJWSexperience
if (!pawn.relations.DirectRelationExists(PawnRelationDefOf.Parent, newMother))
return;
Trait virgin = newMother.story?.traits?.GetTrait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleVirgin);
Trait virgin = newMother.story?.traits?.GetTrait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleVirgin);
if (virgin != null)
{
newMother.story.traits.RemoveTrait(virgin);
newMother.story.traits.GainTrait(new Trait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleAfterSurgery));
newMother.story.traits.GainTrait(new Trait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleAfterSurgery));
}
}
}

View File

@ -1,102 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9C728E06-573B-4B04-A07F-ACBF60CB424D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net472</TargetFramework>
<RootNamespace>RJWSexperience</RootNamespace>
<AssemblyName>RJWSexperience</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Assemblies\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\1.4\Assemblies\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Company>amevarashi</Company>
<Optimize>True</Optimize>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.4.*</Version>
</PackageReference>
<PackageReference Include="Lib.Harmony">
<Version>2.*</Version>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="RJW">
<HintPath>..\..\..\rjw\1.4\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Compile Include="Cum\Building_Cumbucket.cs" />
<Compile Include="Configurations.cs" />
<Compile Include="Cum\CumUtility.cs" />
<Compile Include="DebugAction.cs" />
<Compile Include="ExtensionMethods\PawnExtensions.cs" />
<Compile Include="ExtensionMethods\SexPropsExtensions.cs" />
<Compile Include="Cum\FilterWorkers\SpecialThingFilterWorker_CumBase.cs" />
<Compile Include="Cum\FilterWorkers\SpecialThingFilterWorker_NoCum.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Harmony.cs" />
<Compile Include="Cum\IngestionOutcomeDoer_RecordEatenCum.cs" />
<Compile Include="Cum\Interactions\CumAddictPartKindUsageRule.cs" />
<Compile Include="Logs\DebugLogProvider.cs" />
<Compile Include="Logs\LogManager.cs" />
<Compile Include="LustUtility.cs" />
<Compile Include="Patches\DefInjection.cs" />
<Compile Include="Patches\GetGizmos.cs" />
<Compile Include="Virginity\Recipe_HymenSurgery.cs" />
<Compile Include="Settings\SettingsTabHistory.cs" />
<Compile Include="Settings\SettingsTabDebug.cs" />
<Compile Include="Settings\IResettable.cs" />
<Compile Include="Settings\ITab.cs" />
<Compile Include="Settings\SettingsWidgets.cs" />
<Compile Include="SexHistory\RecordRandomizer.cs" />
<Compile Include="RJWUtility.cs" />
<Compile Include="SexHistory\HistoryUtility.cs" />
<Compile Include="SexHistory\SexHistoryComp.cs" />
<Compile Include="SexHistory\SexPartnerHistoryRecord.cs" />
<Compile Include="PawnRelationWorker_Bastard.cs" />
<Compile Include="Keyed.cs" />
<Compile Include="Patches\Rimworld_Patch.cs" />
<Compile Include="Patches\RJW_Patch.cs" />
<Compile Include="SexperienceMod.cs" />
<Compile Include="Cum\FilterWorkers\SpecialThingFilterWorker_Cum.cs" />
<Compile Include="StatParts.cs" />
<Compile Include="Thoughts\ThoughtDefExtension_StageFromRecord.cs" />
<Compile Include="Cum\Thought_AteCum.cs" />
<Compile Include="Thoughts\Thought_Recordbased.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SexHistory\UI\RJWUIUtility.cs" />
<Compile Include="SexHistory\UI\SexStatus.cs" />
<Compile Include="Utility.cs" />
<Compile Include="VariousDefOf.cs" />
<Compile Include="Virginity\TraitDegree.cs" />
<Compile Include="Virginity\TraitHandler.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.4.3524</Version>
</PackageReference>
<PackageReference Include="Lib.Harmony">
<Version>2.2.2</Version>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -3,6 +3,7 @@ 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;
@ -11,10 +12,12 @@ namespace RJWSexperience
{
public static class RJWUtility
{
private static readonly rjw.Modules.Shared.Logs.ILog s_log = LogManager.GetLogger<DebugLogProvider>("RJWUtility");
/// <summary>
/// For ideo patch
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "All parameters are needed for the ideology patch")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "All parameters are needed for the ideology patch")]
public static void ThrowVirginHistoryEvent(Pawn exVirgin, Pawn partner, SexProps props, int degree)
{
//for non-ideo
@ -57,52 +60,52 @@ namespace RJWSexperience
{
case xxx.rjwSextype.Vaginal:
case xxx.rjwSextype.Scissoring:
IncreaseSameRecords(pawn, partner, VariousDefOf.VaginalSexCount);
IncreaseSameRecords(pawn, partner, RsDefOf.Record.VaginalSexCount);
break;
case xxx.rjwSextype.Anal:
IncreaseSameRecords(pawn, partner, VariousDefOf.AnalSexCount);
IncreaseSameRecords(pawn, partner, RsDefOf.Record.AnalSexCount);
break;
case xxx.rjwSextype.Oral:
case xxx.rjwSextype.Fellatio:
if (Genital_Helper.has_penis_fertile(giver) || Genital_Helper.has_penis_infertile(giver))
{
IncreaseRecords(giver, receiver, VariousDefOf.OralSexCount, VariousDefOf.BlowjobCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.OralSexCount, RsDefOf.Record.BlowjobCount);
}
else if (Genital_Helper.has_penis_fertile(receiver) || Genital_Helper.has_penis_infertile(receiver))
{
IncreaseRecords(giver, receiver, VariousDefOf.BlowjobCount, VariousDefOf.OralSexCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.BlowjobCount, RsDefOf.Record.OralSexCount);
}
break;
case xxx.rjwSextype.Sixtynine:
IncreaseSameRecords(pawn, partner, VariousDefOf.OralSexCount);
IncreaseSameRecords(pawn, partner, RsDefOf.Record.OralSexCount);
RecordDef recordpawn, recordpartner;
if (Genital_Helper.has_penis_fertile(pawn) || Genital_Helper.has_penis_infertile(pawn))
{
recordpartner = VariousDefOf.BlowjobCount;
recordpartner = RsDefOf.Record.BlowjobCount;
}
else
{
recordpartner = VariousDefOf.CunnilingusCount;
recordpartner = RsDefOf.Record.CunnilingusCount;
}
if (Genital_Helper.has_penis_fertile(partner) || Genital_Helper.has_penis_infertile(partner))
{
recordpawn = VariousDefOf.BlowjobCount;
recordpawn = RsDefOf.Record.BlowjobCount;
}
else
{
recordpawn = VariousDefOf.CunnilingusCount;
recordpawn = RsDefOf.Record.CunnilingusCount;
}
IncreaseRecords(pawn, partner, recordpawn, recordpartner);
break;
case xxx.rjwSextype.Cunnilingus:
if (Genital_Helper.has_vagina(giver))
{
IncreaseRecords(giver, receiver, VariousDefOf.OralSexCount, VariousDefOf.CunnilingusCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.OralSexCount, RsDefOf.Record.CunnilingusCount);
}
else if (Genital_Helper.has_vagina(receiver))
{
IncreaseRecords(giver, receiver, VariousDefOf.CunnilingusCount, VariousDefOf.OralSexCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.CunnilingusCount, RsDefOf.Record.OralSexCount);
}
break;
case xxx.rjwSextype.Masturbation:
@ -110,29 +113,29 @@ namespace RJWSexperience
case xxx.rjwSextype.Handjob:
if (Genital_Helper.has_penis_fertile(giver) || Genital_Helper.has_penis_infertile(giver))
{
IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.HandjobCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.GenitalCaressCount, RsDefOf.Record.HandjobCount);
}
else
{
IncreaseRecords(giver, receiver, VariousDefOf.HandjobCount, VariousDefOf.GenitalCaressCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.HandjobCount, RsDefOf.Record.GenitalCaressCount);
}
break;
case xxx.rjwSextype.Fingering:
case xxx.rjwSextype.Fisting:
if (Genital_Helper.has_vagina(giver))
{
IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.FingeringCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.GenitalCaressCount, RsDefOf.Record.FingeringCount);
}
else
{
IncreaseRecords(giver, receiver, VariousDefOf.FingeringCount, VariousDefOf.GenitalCaressCount);
IncreaseRecords(giver, receiver, RsDefOf.Record.FingeringCount, RsDefOf.Record.GenitalCaressCount);
}
break;
case xxx.rjwSextype.Footjob:
IncreaseSameRecords(pawn, partner, VariousDefOf.FootjobCount);
IncreaseSameRecords(pawn, partner, RsDefOf.Record.FootjobCount);
break;
default:
IncreaseSameRecords(pawn, partner, VariousDefOf.MiscSexualBehaviorCount);
IncreaseSameRecords(pawn, partner, RsDefOf.Record.MiscSexualBehaviorCount);
break;
}
}
@ -153,22 +156,29 @@ namespace RJWSexperience
// Moved this method back because of Menstruation
public static Building_CumBucket FindClosestBucket(this Pawn pawn)
{
List<Building> buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket bucket && bucket.StoredStackCount < VariousDefOf.GatheredCum.stackLimit);
if (buckets.NullOrEmpty())
List<Building> 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");
return null;
}
Dictionary<Building, float> targets = new Dictionary<Building, float>();
for (int i = 0; i < buckets.Count; i++)
{
if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None))
if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.Some))
{
targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position));
}
}
if (!targets.NullOrEmpty())
if (targets.Count > 0)
{
return (Building_CumBucket)targets.MinBy(x => x.Value).Key;
}
else
{
s_log.Message("FindClosestBucket: No reachable buckets");
}
return null;
}
}

View File

@ -0,0 +1,78 @@
using RimWorld;
using Verse;
namespace RJWSexperience
{
public static class RsDefOf
{
[DefOf]
public static class Record
{
public static readonly RecordDef NumofEatenCum;
public static readonly RecordDef AmountofEatenCum;
public static readonly RecordDef Lust;
public static readonly RecordDef VaginalSexCount;
public static readonly RecordDef AnalSexCount;
public static readonly RecordDef OralSexCount;
public static readonly RecordDef BlowjobCount;
public static readonly RecordDef CunnilingusCount;
public static readonly RecordDef GenitalCaressCount;
public static readonly RecordDef HandjobCount;
public static readonly RecordDef FingeringCount;
public static readonly RecordDef FootjobCount;
public static readonly RecordDef MiscSexualBehaviorCount;
public static readonly RecordDef SexPartnerCount;
public static readonly RecordDef OrgasmCount;
}
[DefOf]
public static class Skill
{
public static readonly SkillDef Sex;
}
[DefOf]
public static class Thing
{
public static readonly ThingDef GatheredCum;
public static readonly ThingDef FilthCum;
}
[DefOf]
public static class Chemical
{
public static readonly ChemicalDef Cum;
}
[DefOf]
public static class Need
{
public static readonly NeedDef Chemical_Cum;
}
[DefOf]
public static class Trait
{
public static readonly TraitDef Virgin;
}
[DefOf]
public static class KeyBinding
{
public static readonly KeyBindingDef OpenSexStatistics;
}
[DefOf]
public static class Stat
{
public static readonly StatDef SexAbility;
}
[DefOf]
public static class Hediff
{
public static readonly HediffDef CumAddiction;
public static readonly HediffDef CumTolerance;
}
}
}

View File

@ -1,6 +1,6 @@
namespace RJWSexperience.Settings
{
internal interface IResettable
public interface IResettable
{
void Reset();
}

View File

@ -0,0 +1,7 @@
namespace RJWSexperience.Settings
{
public interface ISettingHandle : IResettable
{
void Scribe();
}
}

View File

@ -0,0 +1,35 @@
using Verse;
namespace RJWSexperience.Settings
{
public class SettingHandle<T> : ISettingHandle
{
public T Value { get; set; }
public readonly string XmlLabel;
public readonly T DefaultValue;
public SettingHandle(string xmlLabel, T defaultValue)
{
XmlLabel = xmlLabel;
DefaultValue = defaultValue;
Value = defaultValue;
}
public void Reset()
{
Value = DefaultValue;
}
public void Scribe()
{
T value = Value;
Scribe_Values.Look(ref value, XmlLabel, DefaultValue);
Value = value;
}
public static implicit operator T(SettingHandle<T> settingHandle)
{
return settingHandle.Value;
}
}
}

View File

@ -0,0 +1,40 @@
using System.Collections.Generic;
using Verse;
namespace RJWSexperience.Settings
{
public class SettingsContainer : IExposable
{
public List<ISettingHandle> Handles { get; }
public SettingsContainer(List<ISettingHandle> handles)
{
Handles = handles;
}
public void ExposeData()
{
foreach (ISettingHandle setting in Handles)
{
setting.Scribe();
}
}
public static SettingsContainer CreateHistoryContainer(Configurations settings) => new SettingsContainer(new List<ISettingHandle> {
settings.EnableRecordRandomizer,
settings.MaxLustDeviation,
settings.AvgLust,
settings.MaxSexCountDeviation,
settings.SexPerYear,
settings.MinSexableFromLifestage,
settings.MinSexablePercent,
settings.VirginRatio,
settings.SlavesBeenRapedExp,
settings.EnableSexHistory,
settings.HideGizmoWhenDrafted,
settings.VirginityCheck_M2M_Anal,
settings.VirginityCheck_F2F_Scissoring
}
);
}
}

View File

@ -0,0 +1,30 @@
using System.Collections.Generic;
using UnityEngine;
namespace RJWSexperience.Settings
{
public abstract class SettingsTab : ITab, IResettable
{
protected readonly List<ISettingHandle> tabSettings;
protected readonly Configurations settings;
public string Label { get; protected set; }
protected SettingsTab(Configurations settings, string label, List<ISettingHandle> tabSettings)
{
this.settings = settings;
Label = label;
this.tabSettings = tabSettings;
}
public void Reset()
{
foreach (ISettingHandle setting in tabSettings)
{
setting.Reset();
}
}
public abstract void DoTabContents(Rect inRect);
}
}

View File

@ -1,36 +1,18 @@
using UnityEngine;
using System.Collections.Generic;
using UnityEngine;
using Verse;
namespace RJWSexperience.Settings
{
public class SettingsTabDebug : IExposable, IResettable, ITab
public class SettingsTabDebug : SettingsTab
{
public string Label => Keyed.TabLabelDebug;
public SettingsTabDebug(Configurations settings) : base(settings, Keyed.TabLabelDebug, new List<ISettingHandle> { settings.DevMode }) { }
// Defaults
public const bool DevModeDefault = false;
// Private attributes
private bool devMode;
//Public read-only properties
public bool DevMode => devMode;
public void Reset()
{
devMode = DevModeDefault;
}
public void ExposeData()
{
Scribe_Values.Look(ref devMode, "DevMode", DevModeDefault);
}
public void DoTabContents(Rect inRect)
public override void DoTabContents(Rect inRect)
{
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(inRect);
listmain.CheckboxLabeled(Keyed.Option_Debug_Label, ref devMode, Keyed.Option_Debug_Desc);
listmain.CheckboxLabeled(Keyed.Option_Debug_Label, settings.DevMode, Keyed.Option_Debug_Desc);
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
{

View File

@ -1,133 +1,73 @@
using RimWorld;
using System.Collections.Generic;
using UnityEngine;
using Verse;
namespace RJWSexperience.Settings
{
public class SettingsTabHistory : IExposable, IResettable, ITab
public class SettingsTabHistory : SettingsTab
{
public string Label => Keyed.TabLabelHistory;
public SettingsTabHistory(Configurations settings) : base(
settings,
Keyed.TabLabelHistory,
new List<ISettingHandle> {
settings.EnableRecordRandomizer,
settings.MaxLustDeviation,
settings.AvgLust,
settings.MaxSexCountDeviation,
settings.SexPerYear,
settings.MinSexableFromLifestage,
settings.MinSexablePercent,
settings.VirginRatio,
settings.SlavesBeenRapedExp,
settings.EnableSexHistory,
settings.HideGizmoWhenDrafted,
settings.VirginityCheck_M2M_Anal,
settings.VirginityCheck_F2F_Scissoring
}
) { }
// Defaults
public const bool EnableStatRandomizerDefault = true;
public const float MaxLustDeviationDefault = 400f;
public const float AvgLustDefault = 0f;
public const float MaxSexCountDeviationDefault = 90f;
public const float SexPerYearDefault = 30f;
public const bool MinSexableFromLifestageDefault = true;
public const float MinSexablePercentDefault = 0.2f;
public const float VirginRatioDefault = 0.01f;
public const bool SlavesBeenRapedExpDefault = true;
public const bool EnableSexHistoryDefault = true;
public const bool HideGizmoWhenDraftedDefault = true;
public const bool HideGizmoWithRJWDefault = true;
// Private attributes
private bool enableRecordRandomizer = EnableStatRandomizerDefault;
private float maxLustDeviation = MaxLustDeviationDefault;
private float avgLust = AvgLustDefault;
private float maxSexCountDeviation = MaxSexCountDeviationDefault;
private float sexPerYear = SexPerYearDefault;
private bool minSexableFromLifestage = MinSexableFromLifestageDefault;
private float minSexablePercent = MinSexablePercentDefault;
private float virginRatio = VirginRatioDefault;
private bool slavesBeenRapedExp = SlavesBeenRapedExpDefault;
private bool enableSexHistory = EnableSexHistoryDefault;
private bool hideGizmoWhenDrafted = HideGizmoWhenDraftedDefault;
private bool hideGizmoWithRJW = HideGizmoWithRJWDefault;
//Public read-only properties
public bool EnableRecordRandomizer => enableRecordRandomizer;
public float MaxLustDeviation => maxLustDeviation;
public float AvgLust => avgLust;
public float MaxSexCountDeviation => maxSexCountDeviation;
public float SexPerYear => sexPerYear;
public bool MinSexableFromLifestage => minSexableFromLifestage;
public float MinSexablePercent => minSexablePercent;
public float VirginRatio => virginRatio;
public bool SlavesBeenRapedExp => slavesBeenRapedExp;
public bool EnableSexHistory => enableSexHistory;
public bool HideGizmoWhenDrafted => hideGizmoWhenDrafted;
public bool HideGizmoWithRJW => hideGizmoWithRJW;
public static SettingsTabHistory CreateDefault()
{
SettingsTabHistory history = new SettingsTabHistory();
history.Reset();
return history;
}
public void Reset()
{
enableRecordRandomizer = EnableStatRandomizerDefault;
maxLustDeviation = MaxLustDeviationDefault;
avgLust = AvgLustDefault;
maxSexCountDeviation = MaxSexCountDeviationDefault;
sexPerYear = SexPerYearDefault;
minSexableFromLifestage = MinSexableFromLifestageDefault;
minSexablePercent = MinSexablePercentDefault;
virginRatio = VirginRatioDefault;
slavesBeenRapedExp = SlavesBeenRapedExpDefault;
enableSexHistory = EnableSexHistoryDefault;
hideGizmoWhenDrafted = HideGizmoWhenDraftedDefault;
hideGizmoWithRJW = HideGizmoWithRJWDefault;
}
public void ExposeData()
{
Scribe_Values.Look(ref enableRecordRandomizer, "EnableRecordRandomizer", EnableStatRandomizerDefault);
Scribe_Values.Look(ref maxLustDeviation, "MaxLustDeviation", MaxLustDeviationDefault);
Scribe_Values.Look(ref avgLust, "AvgLust", AvgLustDefault);
Scribe_Values.Look(ref maxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviationDefault);
Scribe_Values.Look(ref sexPerYear, "SexPerYear", SexPerYearDefault);
Scribe_Values.Look(ref minSexableFromLifestage, "MinSexableFromLifestage", MinSexableFromLifestageDefault);
Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault);
Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault);
Scribe_Values.Look(ref slavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExpDefault);
Scribe_Values.Look(ref enableSexHistory, "EnableSexHistory", EnableSexHistoryDefault);
Scribe_Values.Look(ref hideGizmoWhenDrafted, "HideGizmoWhenDrafted", HideGizmoWhenDraftedDefault);
Scribe_Values.Look(ref hideGizmoWithRJW, "HideGizmoWithRJW", HideGizmoWithRJWDefault);
}
public void DoTabContents(Rect inRect)
public override void DoTabContents(Rect inRect)
{
const float lineHeight = SettingsWidgets.lineHeight;
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(inRect);
listmain.CheckboxLabeled(Keyed.Option_1_Label, ref enableRecordRandomizer, Keyed.Option_1_Desc);
if (enableRecordRandomizer)
listmain.CheckboxLabeled(Keyed.Option_1_Label, settings.EnableRecordRandomizer, Keyed.Option_1_Desc);
if (settings.EnableRecordRandomizer)
{
float sectionHeight = 12f;
if (!minSexableFromLifestage)
if (!settings.MinSexableFromLifestage)
sectionHeight += 2f;
Listing_Standard section = listmain.BeginSection(lineHeight * sectionHeight);
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_3_Label + " " + maxLustDeviation, Keyed.Option_3_Desc, ref maxLustDeviation, 0f, 2000f, 1f);
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_4_Label + " " + avgLust, Keyed.Option_4_Desc, ref avgLust, -1000f, 1000f, 1f);
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_5_Label + " " + maxSexCountDeviation, Keyed.Option_5_Desc, ref maxSexCountDeviation, 0f, 2000f, 1f);
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_6_Label + " " + sexPerYear, Keyed.Option_6_Desc, ref sexPerYear, 0f, 2000f, 1f);
section.SliderOption(Keyed.Option_3_Label + " {0}", Keyed.Option_3_Desc, settings.MaxLustDeviation, new FloatRange(0f, 1000f), 1f);
section.SliderOption(Keyed.Option_4_Label + " {0}", Keyed.Option_4_Desc, settings.AvgLust, new FloatRange(-200f, 200f), 1f);
section.SliderOption(Keyed.Option_5_Label + " {0}", Keyed.Option_5_Desc, settings.MaxSexCountDeviation, new FloatRange(0f, 1000f), 1f);
section.SliderOption(Keyed.Option_6_Label + " {0}", Keyed.Option_6_Desc, settings.SexPerYear, new FloatRange(0f, 2000f), 1f);
section.CheckboxLabeled(Keyed.Option_MinSexableFromLifestage_Label, ref minSexableFromLifestage, Keyed.Option_MinSexableFromLifestage_Desc);
section.CheckboxLabeled(Keyed.Option_MinSexableFromLifestage_Label, settings.MinSexableFromLifestage, Keyed.Option_MinSexableFromLifestage_Desc);
if (!minSexableFromLifestage)
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), $"{Keyed.Option_9_Label} {minSexablePercent:P1} {ThingDefOf.Human.race.lifeExpectancy * minSexablePercent} human years", Keyed.Option_9_Desc, ref minSexablePercent, 0, 1, 0.001f);
if (!settings.MinSexableFromLifestage)
section.SliderOption($"{Keyed.Option_9_Label} {{0:P1}} {ThingDefOf.Human.race.lifeExpectancy * settings.MinSexablePercent} human years", Keyed.Option_9_Desc, settings.MinSexablePercent, FloatRange.ZeroToOne, 0.001f);
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), $"{Keyed.Option_10_Label} {virginRatio:P1}", Keyed.Option_10_Desc, ref virginRatio, 0f, 1f, 0.001f);
section.CheckboxLabeled(Keyed.Option_7_Label, ref slavesBeenRapedExp, Keyed.Option_7_Desc);
section.SliderOption(Keyed.Option_10_Label + " {0:P1}", Keyed.Option_10_Desc, settings.VirginRatio, FloatRange.ZeroToOne, 0.001f);
section.CheckboxLabeled(Keyed.Option_7_Label, settings.SlavesBeenRapedExp, Keyed.Option_7_Desc);
listmain.EndSection(section);
}
listmain.CheckboxLabeled(Keyed.Option_EnableSexHistory_Label, ref enableSexHistory, Keyed.Option_EnableSexHistory_Desc);
listmain.CheckboxLabeled(Keyed.Option_EnableSexHistory_Label, settings.EnableSexHistory, Keyed.Option_EnableSexHistory_Desc);
if (enableSexHistory)
if (settings.EnableSexHistory)
{
listmain.CheckboxLabeled(Keyed.Option_HideGizmoWhenDrafted_Label, ref hideGizmoWhenDrafted, Keyed.Option_HideGizmoWhenDrafted_Desc);
listmain.CheckboxLabeled(Keyed.Option_HideGizmoWithRJW_Label, ref hideGizmoWithRJW, Keyed.Option_HideGizmoWithRJW_Desc);
listmain.CheckboxLabeled(Keyed.Option_HideGizmoWhenDrafted_Label, settings.HideGizmoWhenDrafted, Keyed.Option_HideGizmoWhenDrafted_Desc);
}
listmain.CheckboxLabeled(Keyed.Option_VirginityCheck_M2M_Label, settings.VirginityCheck_M2M_Anal, Keyed.Option_VirginityCheck_M2M_Desc);
listmain.CheckboxLabeled(Keyed.Option_VirginityCheck_F2F_Label, settings.VirginityCheck_F2F_Scissoring, Keyed.Option_VirginityCheck_F2F_Label);
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
{

View File

@ -0,0 +1,45 @@
using System.Collections.Generic;
using UnityEngine;
using Verse;
namespace RJWSexperience.Settings
{
public class SettingsTabMain : SettingsTab
{
public SettingsTabMain(Configurations settings) : base(
settings,
Keyed.TabLabelMain,
new List<ISettingHandle> {
settings.LustEffectPower,
settings.EnableBastardRelation,
settings.LustLimit,
settings.MaxSingleLustChange,
settings.SexCanFillBuckets,
settings.VirginityCheck_M2M_Anal,
settings.VirginityCheck_F2F_Scissoring
}
) { }
public override void DoTabContents(Rect inRect)
{
Listing_Standard listmain = new Listing_Standard { maxOneColumn = true };
listmain.Begin(inRect);
listmain.SliderOption(Keyed.Option_2_Label + " x{0}", Keyed.Option_2_Desc, settings.LustEffectPower, new FloatRange(0f, 2f), 0.01f);
listmain.SliderOption(Keyed.Option_8_Label + " {0}", Keyed.Option_8_Desc, settings.LustLimit, new FloatRange(0f, 500f), 1f);
listmain.SliderOption(Keyed.Option_MaxSingleLustChange_Label + " {0}", Keyed.Option_MaxSingleLustChange_Desc, settings.MaxSingleLustChange, new FloatRange(0f, 10f), 0.05f);
listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, settings.EnableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
listmain.CheckboxLabeled(Keyed.Option_SexCanFillBuckets_Label, settings.SexCanFillBuckets, Keyed.Option_SexCanFillBuckets_Desc);
listmain.CheckboxLabeled(Keyed.Option_VirginityCheck_M2M_Label, settings.VirginityCheck_M2M_Anal, Keyed.Option_VirginityCheck_M2M_Desc);
listmain.CheckboxLabeled(Keyed.Option_VirginityCheck_F2F_Label, settings.VirginityCheck_F2F_Scissoring, Keyed.Option_VirginityCheck_F2F_Desc);
if (settings.DevMode)
LustUtility.DrawGraph(listmain.GetRect(300f));
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
{
Reset();
}
listmain.End();
}
}
}

View File

@ -7,30 +7,39 @@ namespace RJWSexperience.Settings
{
public const float lineHeight = 24f;
public static void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, float min, float max)
public static void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, FloatRange range)
{
Rect textfieldRect = new Rect(rect.xMax - 100f, rect.y, 100f, rect.height);
string valuestr = value.ToString();
Widgets.Label(rect, label);
Widgets.TextFieldNumeric(textfieldRect, ref value, ref valuestr, min, max);
Widgets.TextFieldNumeric(textfieldRect, ref value, ref valuestr, range.TrueMin, range.TrueMax);
Widgets.DrawHighlightIfMouseover(rect);
TooltipHandler.TipRegion(rect, tooltip);
}
public static void SliderOption(Rect doublerect, string label, string tooltip, ref float value, float min, float max, float roundTo)
public static void SliderOption(this Listing_Standard outList, string label, string tooltip, SettingHandle<float> handle, FloatRange range, float roundTo)
{
// Slider was fighting with textfield for "correct" decimals. Causes a repeating slider move sound
float fieldValue = value;
float sliderValue = value;
float fieldValue = handle.Value;
float sliderValue = handle.Value;
float minChange = roundTo / 10f;
LabelwithTextfield(doublerect.TopHalf(), label, tooltip, ref fieldValue, min, max);
sliderValue = Widgets.HorizontalSlider(doublerect.BottomHalf(), sliderValue, min, max, roundTo: roundTo);
string formattedLabel = string.Format(label, handle.Value);
if (Mathf.Abs(fieldValue - value) > minChange)
value = fieldValue;
LabelwithTextfield(outList.GetRect(lineHeight), formattedLabel, tooltip, ref fieldValue, range);
sliderValue = Widgets.HorizontalSlider_NewTemp(outList.GetRect(lineHeight), sliderValue, range.TrueMin, range.TrueMax, roundTo: roundTo);
if (Mathf.Abs(fieldValue - handle.Value) > minChange)
handle.Value = fieldValue;
else
value = sliderValue;
handle.Value = sliderValue;
}
public static void CheckboxLabeled(this Listing_Standard outList, string label, SettingHandle<bool> handle, string tooltip)
{
bool value = handle.Value;
outList.CheckboxLabeled(label, ref value, tooltip);
handle.Value = value;
}
}
}

View File

@ -1,5 +1,4 @@
using RimWorld;
using System;
using UnityEngine;
using Verse;

View File

@ -11,7 +11,7 @@ namespace RJWSexperience.SexHistory
{
private static readonly rjw.Modules.Shared.Logs.ILog log = LogManager.GetLogger<DebugLogProvider>("RecordRandomizer");
private static Settings.SettingsTabHistory Settings => SexperienceMod.Settings.History;
private static Configurations Settings => SexperienceMod.Settings;
public static bool Randomize(Pawn pawn)
{
@ -95,8 +95,8 @@ namespace RJWSexperience.SexHistory
minValue = float.MinValue;
value = Mathf.Clamp(value, minValue, float.MaxValue);
float recordvalue = pawn.records.GetValue(VariousDefOf.Lust);
pawn.records.AddTo(VariousDefOf.Lust, value - recordvalue);
float recordvalue = pawn.records.GetValue(RsDefOf.Record.Lust);
pawn.records.AddTo(RsDefOf.Record.Lust, value - recordvalue);
return value;
}
@ -145,7 +145,7 @@ namespace RJWSexperience.SexHistory
totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithHumanlikes, avgsex, deviation);
if (totalSexCount > 0)
pawn.records.AddTo(VariousDefOf.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7)));
pawn.records.AddTo(RsDefOf.Record.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7)));
return totalSexCount;
}
@ -170,67 +170,67 @@ namespace RJWSexperience.SexHistory
Gender prefer = PreferredGender(pawn);
int sex = (int)(totalsex * RJWPreferenceSettings.vaginal / totalweight);
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.VaginalSexCount, sex);
pawn.records.AddTo(RsDefOf.Record.VaginalSexCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.anal / totalweight);
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.AnalSexCount, sex);
pawn.records.AddTo(RsDefOf.Record.AnalSexCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.fellatio / totalweight);
totalsex -= sex;
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.BlowjobCount, sex);
else pawn.records.AddTo(VariousDefOf.OralSexCount, sex);
if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.BlowjobCount, sex);
else pawn.records.AddTo(RsDefOf.Record.OralSexCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.cunnilingus / totalweight);
totalsex -= sex;
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.OralSexCount, sex);
else pawn.records.AddTo(VariousDefOf.CunnilingusCount, sex);
if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.OralSexCount, sex);
else pawn.records.AddTo(RsDefOf.Record.CunnilingusCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.rimming / totalweight);
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
pawn.records.AddTo(RsDefOf.Record.MiscSexualBehaviorCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.double_penetration / totalweight) / 2;
totalsex -= sex;
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.VaginalSexCount, sex);
pawn.records.AddTo(VariousDefOf.AnalSexCount, sex);
pawn.records.AddTo(RsDefOf.Record.VaginalSexCount, sex);
pawn.records.AddTo(RsDefOf.Record.AnalSexCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.breastjob / totalweight);
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
pawn.records.AddTo(RsDefOf.Record.MiscSexualBehaviorCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.handjob / totalweight);
totalsex -= sex;
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.HandjobCount, sex);
else pawn.records.AddTo(VariousDefOf.GenitalCaressCount, sex);
if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.HandjobCount, sex);
else pawn.records.AddTo(RsDefOf.Record.GenitalCaressCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.fingering / totalweight);
totalsex -= sex;
if (prefer == Gender.Female) pawn.records.AddTo(VariousDefOf.FingeringCount, sex);
else pawn.records.AddTo(VariousDefOf.GenitalCaressCount, sex);
if (prefer == Gender.Female) pawn.records.AddTo(RsDefOf.Record.FingeringCount, sex);
else pawn.records.AddTo(RsDefOf.Record.GenitalCaressCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.mutual_masturbation / totalweight);
totalsex -= sex;
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.HandjobCount, sex);
else pawn.records.AddTo(VariousDefOf.FingeringCount, sex);
pawn.records.AddTo(VariousDefOf.GenitalCaressCount, sex);
if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.HandjobCount, sex);
else pawn.records.AddTo(RsDefOf.Record.FingeringCount, sex);
pawn.records.AddTo(RsDefOf.Record.GenitalCaressCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.footjob / totalweight);
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.FootjobCount, sex);
pawn.records.AddTo(RsDefOf.Record.FootjobCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.scissoring / totalweight);
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
pawn.records.AddTo(RsDefOf.Record.MiscSexualBehaviorCount, sex);
sex = (int)(totalsex * RJWPreferenceSettings.fisting / totalweight);
totalsex -= sex;
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
pawn.records.AddTo(RsDefOf.Record.MiscSexualBehaviorCount, sex);
pawn.records.AddTo(VariousDefOf.OralSexCount, totalsex);
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.BlowjobCount, totalsex);
else pawn.records.AddTo(VariousDefOf.CunnilingusCount, totalsex);
pawn.records.AddTo(RsDefOf.Record.OralSexCount, totalsex);
if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.BlowjobCount, totalsex);
else pawn.records.AddTo(RsDefOf.Record.CunnilingusCount, totalsex);
}
private static Gender PreferredGender(Pawn pawn)

View File

@ -6,11 +6,14 @@ using Verse;
namespace RJWSexperience.SexHistory
{
/// <summary>
/// Stores pawn's sex history and handles its updates
/// </summary>
public class SexHistoryComp : ThingComp
{
public const int ARRLEN = 20;
protected Dictionary<string, SexPartnerHistoryRecord> histories = new Dictionary<string, SexPartnerHistoryRecord>();
protected Dictionary<string, SexPartnerHistoryRecord> partnerRecords = new Dictionary<string, SexPartnerHistoryRecord>();
protected string first = "";
protected bool dirty = true;
protected xxx.rjwSextype recentSex = xxx.rjwSextype.None;
@ -43,15 +46,14 @@ namespace RJWSexperience.SexHistory
protected int bestSexTickAbsCache = 0;
public Gizmo Gizmo { get; private set; }
public SexPartnerHistoryRecord GetFirstPartnerHistory => histories.TryGetValue(first);
public SexPartnerHistoryRecord GetMostPartnerHistory
public Pawn ParentPawn => parent as Pawn;
public SexPartnerHistoryRecord FirstPartnerRecord => partnerRecords.TryGetValue(first);
public SexPartnerHistoryRecord MostPartnerRecord
{
get
{
Update();
return histories.TryGetValue(mostPartnerCache);
return partnerRecords.TryGetValue(mostPartnerCache);
}
}
public xxx.rjwSextype MostSextype
@ -70,13 +72,13 @@ namespace RJWSexperience.SexHistory
return mostSatSextypeCache;
}
}
public SexPartnerHistoryRecord GetRecentPartnersHistory => histories.TryGetValue(recentPartner);
public SexPartnerHistoryRecord GetBestSexPartnerHistory
public SexPartnerHistoryRecord RecentPartnerRecord => partnerRecords.TryGetValue(recentPartner);
public SexPartnerHistoryRecord BestSexPartnerRecord
{
get
{
Update();
return histories.TryGetValue(bestPartnerCache);
return partnerRecords.TryGetValue(bestPartnerCache);
}
}
public float TotalSexHad
@ -88,27 +90,20 @@ namespace RJWSexperience.SexHistory
}
}
public int VirginsTaken => virginsTaken;
public List<SexPartnerHistoryRecord> PartnerList
public IEnumerable<SexPartnerHistoryRecord> PartnerList
{
get
{
List<SexPartnerHistoryRecord> res = null;
IEnumerable<SexPartnerHistoryRecord> res = Enumerable.Empty<SexPartnerHistoryRecord>();
Update();
if (!histories.NullOrEmpty())
if (!partnerRecords.NullOrEmpty())
{
res = histories.Values.ToList();
res = partnerRecords.Values;
}
return res;
}
}
public int PartnerCount
{
get
{
if (histories == null) histories = new Dictionary<string, SexPartnerHistoryRecord>();
return histories.Count;
}
}
public int PartnerCount => partnerRecords?.Count ?? 0;
public int IncestuousCount => incestuous;
public int RapedCount
{
@ -158,7 +153,6 @@ namespace RJWSexperience.SexHistory
public int FirstSexTickAbs => firstSexTickAbs;
public int MostSexTickAbs => mostSexTickAbsCache;
public int BestSexTickAbs => bestSexTickAbsCache;
public Pawn PreferRacePawn
{
get
@ -184,9 +178,9 @@ namespace RJWSexperience.SexHistory
public int GetSextypeRecentTickAbs(int sextype) => sextypeRecentTickAbs[sextype];
public float GetAVGSat(int index)
public float GetAVGSat(int sextype)
{
float res = sextypeSat[index] / sextypeCount[index];
float res = sextypeSat[sextype] / sextypeCount[sextype];
return float.IsNaN(res) ? 0f : res;
}
@ -211,7 +205,7 @@ namespace RJWSexperience.SexHistory
sextyperecenttickabssave = new List<int>();
}
Scribe_Collections.Look(ref histories, "histories", LookMode.Value, LookMode.Deep);
Scribe_Collections.Look(ref partnerRecords, "histories", LookMode.Value, LookMode.Deep);
Scribe_Values.Look(ref first, "first", string.Empty);
Scribe_Values.Look(ref recentSex, "recentsex", xxx.rjwSextype.None);
Scribe_Values.Look(ref recentSat, "recentsat", 0);
@ -226,8 +220,8 @@ namespace RJWSexperience.SexHistory
Scribe_Collections.Look(ref sextypesatsave, "sextypesatsave", LookMode.Value);
Scribe_Collections.Look(ref sextyperecenttickabssave, "sextyperecenttickabssave", LookMode.Value);
if (histories == null)
histories = new Dictionary<string, SexPartnerHistoryRecord>();
if (partnerRecords == null)
partnerRecords = new Dictionary<string, SexPartnerHistoryRecord>();
if (Scribe.mode == LoadSaveMode.LoadingVars)
{
@ -235,7 +229,7 @@ namespace RJWSexperience.SexHistory
sextypeSat = sextypesatsave?.ToArray() ?? new float[ARRLEN];
sextypeRecentTickAbs = sextyperecenttickabssave?.ToArray() ?? new int[ARRLEN];
foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in histories)
foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in partnerRecords)
{
element.Value.PartnerID = element.Key;
}
@ -245,55 +239,53 @@ namespace RJWSexperience.SexHistory
public void RecordSex(Pawn partner, SexProps props)
{
Pawn pawn = parent as Pawn;
RecordFirst(partner, props);
GetPartnerRecord(partner)?.RecordSex(props);
SexPartnerHistoryRecord partnerRecord = GetPartnerRecord(partner);
partnerRecord.RecordSex(props);
recentPartner = partner.ThingID;
recentSex = props.sexType;
sextypeCount[(int)props.sexType]++;
sextypeRecentTickAbs[(int)props.sexType] = GenTicks.TicksAbs;
if (partner.IsIncest(pawn)) incestuous++;
if (partnerRecord.Incest) incestuous++;
if (partner.Dead) corpsefuck++;
if (props.IsBestiality()) bestiality++;
else if (pawn.def != partner.def) interspecies++;
else if (ParentPawn.def != partner.def) interspecies++;
dirty = true;
}
public void RecordSatisfaction(Pawn partner, SexProps props, float satisfaction)
public void RecordOrgasm(Pawn partner, SexProps props, float satisfaction)
{
RecordFirst(partner, props);
GetPartnerRecord(partner)?.RecordSatisfaction(props, satisfaction);
GetPartnerRecord(partner).RecordOrgasm(props.sexType, satisfaction);
recentSat = satisfaction;
sextypeSat[(int)props.sexType] += satisfaction;
sextypeSat[(int)props.sexType] += satisfaction; // Several orgasmsms in one sex are messing with this
dirty = true;
}
public void RecordFirst(Pawn partner, SexProps props)
/// <summary>
/// Record first partner and time of sex. No checks are performed, the caller should make sure it is the first time.
/// </summary>
/// <param name="partner"></param>
public void RecordFirst(Pawn partner)
{
if (VirginCheck() && props.sexType == xxx.rjwSextype.Vaginal)
{
first = partner.ThingID;
SexHistoryComp history = partner.TryGetComp<SexHistoryComp>();
firstSexTickAbs = GenTicks.TicksAbs;
history?.TakeSomeonesVirgin(parent as Pawn);
}
first = partner.ThingID;
firstSexTickAbs = GenTicks.TicksAbs;
partner.TryGetComp<SexHistoryComp>()?.TakeSomeonesVirgin(ParentPawn);
}
/// <summary>
/// Retrive an existing partner record or add a new one. Increments SexPartnerCount when new record is added
/// </summary>
protected SexPartnerHistoryRecord GetPartnerRecord(Pawn partner)
{
string partnerId = partner.ThingID;
if (histories.TryGetValue(partnerId, out SexPartnerHistoryRecord record))
if (partnerRecords.TryGetValue(partnerId, out SexPartnerHistoryRecord record))
{
return record;
}
SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(parent as Pawn));
histories.Add(partnerId, newRecord);
if (parent is Pawn pawn)
{
pawn.records.Increment(VariousDefOf.SexPartnerCount);
}
SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(ParentPawn));
partnerRecords.Add(partnerId, newRecord);
ParentPawn.records.Increment(RsDefOf.Record.SexPartnerCount);
return newRecord;
}
@ -330,7 +322,7 @@ namespace RJWSexperience.SexHistory
Dictionary<ThingDef, int> racetotalsat = new Dictionary<ThingDef, int>();
List<Pawn> allpartners = new List<Pawn>();
foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in histories)
foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in partnerRecords)
{
SexPartnerHistoryRecord h = element.Value;
@ -388,9 +380,9 @@ namespace RJWSexperience.SexHistory
mostPartnerCache = mostID;
bestPartnerCache = bestID;
recentSexTickAbsCache = histories.TryGetValue(recentPartner)?.RecentSexTickAbs ?? 0;
mostSexTickAbsCache = histories.TryGetValue(mostPartnerCache)?.RecentSexTickAbs ?? 0;
bestSexTickAbsCache = histories.TryGetValue(bestPartnerCache)?.BestSexTickAbs ?? 0;
recentSexTickAbsCache = partnerRecords.TryGetValue(recentPartner)?.RecentSexTickAbs ?? 0;
mostSexTickAbsCache = partnerRecords.TryGetValue(mostPartnerCache)?.RecentSexTickAbs ?? 0;
bestSexTickAbsCache = partnerRecords.TryGetValue(bestPartnerCache)?.BestSexTickAbs ?? 0;
racetotalsat.Clear();
allpartners.Clear();
@ -416,12 +408,15 @@ namespace RJWSexperience.SexHistory
#endregion Cache update
protected bool VirginCheck()
public override IEnumerable<Gizmo> CompGetGizmosExtra()
{
if (histories.TryGetValue(first) != null) return false;
if (SexperienceMod.Settings.HideGizmoWhenDrafted && ParentPawn.Drafted)
yield break;
Pawn pawn = parent as Pawn;
return pawn?.IsVirgin() == true;
if (Find.Selector.NumSelected > 1)
yield break;
yield return Gizmo;
}
public override void Initialize(CompProperties props)
@ -433,11 +428,10 @@ namespace RJWSexperience.SexHistory
defaultLabel = Keyed.RS_Sex_History,
icon = HistoryUtility.HistoryIcon,
defaultIconColor = HistoryUtility.HistoryColor,
hotKey = VariousDefOf.OpenSexStatistics,
action = delegate
{
UI.SexStatusWindow.ToggleWindow(parent as Pawn, this);
}
hotKey = RsDefOf.KeyBinding.OpenSexStatistics,
shrinkable = true,
Order = 5,
action = () => UI.SexStatusWindow.ToggleWindow(this)
};
}
}

View File

@ -1,6 +1,5 @@
using rjw;
using RJWSexperience.ExtensionMethods;
using System.Collections.Generic;
using Verse;
namespace RJWSexperience.SexHistory
@ -105,13 +104,13 @@ namespace RJWSexperience.SexHistory
recentSexTickAbs = GenTicks.TicksAbs;
}
public void RecordSatisfaction(SexProps props, float satisfaction)
public void RecordOrgasm(xxx.rjwSextype sextype, float satisfaction)
{
orgasms++;
if (satisfaction > bestSatisfaction)
{
bestSextype = props.sexType;
bestSextype = sextype;
bestSatisfaction = satisfaction;
bestSexTickAbs = GenTicks.TicksAbs;
}
@ -131,33 +130,5 @@ namespace RJWSexperience.SexHistory
}
partner = Find.WorldPawns.AllPawnsAliveOrDead.Find(x => x.ThingID.Equals(partnerID));
}
#region OrderComparers
public class RecentOrderComparer : IComparer<SexPartnerHistoryRecord>
{
public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
{
return y.RecentSexTickAbs.CompareTo(x.RecentSexTickAbs);
}
}
public class MostOrderComparer : IComparer<SexPartnerHistoryRecord>
{
public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
{
return y.TotalSexCount.CompareTo(x.TotalSexCount);
}
}
public class NameOrderComparer : IComparer<SexPartnerHistoryRecord>
{
public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
{
return x.Label.CompareTo(y.Label);
}
}
#endregion OrderComparers
}
}

View File

@ -0,0 +1,51 @@
using UnityEngine;
using Verse;
namespace RJWSexperience.SexHistory.UI
{
public class BarInfo
{
private string _label;
private float _fillPercent;
private string _labelRight;
public string Label
{
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;
}
public BarInfo(Texture2D fillTexture)
{
_label = "";
_fillPercent = 0f;
FillTexture = fillTexture;
Tooltip = default;
_labelRight = "";
Border = null;
}
}
}

View File

@ -0,0 +1,93 @@
using RimWorld;
using rjw;
using UnityEngine;
using Verse;
namespace RJWSexperience.SexHistory.UI
{
public class InfoCard
{
private readonly Pawn _pawn;
private readonly string _tooltipLabel;
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)
{
Label = label;
_pawn = pawn;
_tooltipLabel = tooltipLabel;
BestSextype = new BarInfo();
PortraitInfo = new PartnerPortraitInfo(_pawn);
}
public void UpdatePartnerRecord(SexPartnerHistoryRecord partnerRecord)
{
PartnerRecord = partnerRecord;
PortraitInfo.UpdatePartnerRecord(partnerRecord);
if (partnerRecord == null)
{
Name = Keyed.Unknown;
SexCount = Keyed.RS_Sex_Count + "?";
Orgasms = Keyed.RS_Orgasms + "?";
Relations = string.Empty;
Tooltip = default;
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)
{
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.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();
}
}
}

View File

@ -0,0 +1,18 @@
namespace RJWSexperience.SexHistory.UI
{
public enum PartnerOrderMode
{
Normal = 0,
Recent = 1,
Most = 2,
Name = 3
};
public static class PartnerOrderModeExtension
{
public static PartnerOrderMode Next(this PartnerOrderMode mode)
{
return (PartnerOrderMode)(((int)mode + 1) % 4);
}
}
}

View File

@ -0,0 +1,48 @@
using RimWorld;
using System;
using UnityEngine;
using Verse;
namespace RJWSexperience.SexHistory.UI
{
public class PartnerPortraitInfo
{
private readonly Pawn _pawn;
public SexPartnerHistoryRecord PartnerRecord { get; private set; }
public bool Lover { get; private set; }
public Func<Vector2, Texture> PortraitGetter { get; private set; }
public PartnerPortraitInfo(Pawn pawn)
{
_pawn = pawn;
}
public PartnerPortraitInfo(Pawn pawn, SexPartnerHistoryRecord partnerRecord)
{
_pawn = pawn;
UpdatePartnerRecord(partnerRecord);
}
public void UpdatePartnerRecord(SexPartnerHistoryRecord partnerRecord)
{
PartnerRecord = partnerRecord;
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);
}
else if (partnerRecord?.Race?.uiIcon != null)
{
PortraitGetter = (_) => partnerRecord.Race.uiIcon;
Lover = false;
}
else
{
PortraitGetter = (_) => HistoryUtility.UnknownPawn;
Lover = false;
}
}
}
}

View File

@ -0,0 +1,61 @@
using System;
using UnityEngine;
namespace RJWSexperience.SexHistory.UI
{
public class 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<Vector2, Texture> PortraitGetter { get; private set; }
public PreferedRaceCard(SexHistoryComp sexHistory)
{
_sexHistory = sexHistory;
}
public void Update()
{
if (_sexHistory.PreferRace == null)
{
PreferRaceLabel = Keyed.None;
PreferRaceTypeLabel = null;
SexCount = null;
BarInfo.Label = null;
BarInfo.FillPercent = 0f;
PortraitGetter = (_) => HistoryUtility.UnknownPawn;
return;
}
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.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;
}
else
{
PreferRaceTypeLabel = Keyed.RS_Interspecies;
BarInfo.Label = Keyed.RS_SexInfo(Keyed.RS_Interspecies, _sexHistory.InterspeciesCount);
BarInfo.FillPercent = _sexHistory.InterspeciesCount / 100f;
}
}
else
{
PreferRaceTypeLabel = null;
BarInfo.Label = null;
BarInfo.FillPercent = 0f;
}
}
}
}

View File

@ -1,101 +0,0 @@
using RimWorld;
using rjw;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using Verse;
namespace RJWSexperience.SexHistory.UI
{
public static class RJWUIUtility
{
public const float FONTHEIGHT = 22f;
public const float CARDHEIGHT = 110f;
public const float LISTPAWNSIZE = 100f;
public const float BASESAT = 0.40f;
public const float ICONSIZE = 30f;
public static void DrawQuirk(this Rect rect, Pawn pawn)
{
List<Quirk> quirks = Quirk.All.FindAll(x => pawn.Has(x));
string quirkstr = quirks.Select(x => x.Key).ToCommaList();
string tooltip = "";
Widgets.Label(rect, "Quirks".Translate() + quirkstr);
if (Mouse.IsOver(rect))
{
if (quirks.NullOrEmpty())
{
tooltip = "NoQuirks".Translate();
}
else
{
StringBuilder stringBuilder = new StringBuilder();
foreach (var q in quirks)
{
stringBuilder.AppendLine(q.Key.Colorize(Color.yellow));
stringBuilder.AppendLine(q.LocaliztionKey.Translate(pawn.Named("pawn")).AdjustedFor(pawn).Resolve());
stringBuilder.AppendLine("");
}
tooltip = stringBuilder.ToString().TrimEndNewlines();
}
Widgets.DrawHighlight(rect);
}
TooltipHandler.TipRegion(rect, tooltip);
}
public static void DrawSexuality(this Rect rect, CompRJW comp)
{
if (comp != null)
{
string sexuality = Keyed.Sexuality[(int)comp.orientation];
Widgets.Label(rect, Keyed.RS_Sexuality + ": " + sexuality);
Widgets.DrawHighlightIfMouseover(rect);
}
}
public static string GetRelationsString(this Pawn pawn, Pawn otherpawn)
{
if (otherpawn != null)
{
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
if (!relations.EnumerableNullOrEmpty()) return relations.Select(x => x.GetGenderSpecificLabel(otherpawn)).ToCommaList().CapitalizeFirst();
}
return "";
}
public static void DrawBorder(this Rect rect, Texture border, float thickness = 1f)
{
GUI.DrawTexture(new Rect(rect.x, rect.y, rect.width, thickness), border);
GUI.DrawTexture(new Rect(rect.x + rect.width - thickness, rect.y, thickness, rect.height), border);
GUI.DrawTexture(new Rect(rect.x, rect.y + rect.height - thickness, rect.width, thickness), border);
GUI.DrawTexture(new Rect(rect.x, rect.y, thickness, rect.height), border);
}
public static string GetStatExplanation(Pawn pawn, StatDef stat, float val)
{
if (!pawn.Dead)
return stat.description + "\n" + stat.Worker.GetExplanationFull(StatRequest.For(pawn), ToStringNumberSense.Undefined, val);
return "Dead".Translate();
}
public static string GetSexDays(int absticks, bool printUnknown = false)
{
if (absticks != 0)
return GenDate.ToStringTicksToDays(GenTicks.TicksAbs - absticks) + " " + Keyed.RS_Ago;
else if (printUnknown)
return Keyed.Unknown;
return "";
}
public static Texture GetRaceIcon(Pawn pawn, Vector2 size)
{
if (pawn != null)
return PortraitsCache.Get(pawn, size, Rot4.South, default, 1, true, true, false, false);
return HistoryUtility.UnknownPawn;
}
}
}

View File

@ -1,654 +0,0 @@
using RimWorld;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
using Verse.Sound;
namespace RJWSexperience.SexHistory.UI
{
public enum PartnerOrderMode
{
Normal = 0,
Recent = 1,
Most = 2,
Name, MaxValue = 3
};
public static class PartnerOrderModeExtension
{
public static PartnerOrderMode Next(this PartnerOrderMode mode)
{
return (PartnerOrderMode)(((int)mode + 1) % ((int)PartnerOrderMode.MaxValue + 1));
}
}
public class SexStatusWindow : Window
{
public const float WINDOW_WIDTH = 900f;
public const float WINDOW_HEIGHT = 600f;
public const float FONTHEIGHT = RJWUIUtility.FONTHEIGHT;
public const float CARDHEIGHT = RJWUIUtility.CARDHEIGHT;
public const float LISTPAWNSIZE = RJWUIUtility.LISTPAWNSIZE;
public const float BASESAT = RJWUIUtility.BASESAT;
public const float ICONSIZE = RJWUIUtility.ICONSIZE;
public static readonly int[] Sextype =
{
(int)xxx.rjwSextype.Vaginal,
(int)xxx.rjwSextype.Anal,
(int)xxx.rjwSextype.Oral,
(int)xxx.rjwSextype.Fellatio,
(int)xxx.rjwSextype.Cunnilingus,
(int)xxx.rjwSextype.DoublePenetration,
(int)xxx.rjwSextype.Boobjob,
(int)xxx.rjwSextype.Handjob,
(int)xxx.rjwSextype.Footjob,
(int)xxx.rjwSextype.Fingering,
(int)xxx.rjwSextype.Scissoring,
(int)xxx.rjwSextype.MutualMasturbation,
(int)xxx.rjwSextype.Fisting,
(int)xxx.rjwSextype.Rimming,
(int)xxx.rjwSextype.Sixtynine
};
protected Pawn pawn;
protected SexPartnerHistoryRecord selectedPawn;
protected SexHistoryComp history;
protected CompRJW rjwcomp;
protected List<SexPartnerHistoryRecord> partnerList;
protected PartnerOrderMode orderMode;
private static GUIStyle fontStyleCenter;
private static GUIStyle fontStyleRight;
private static GUIStyle fontStyleLeft;
private static GUIStyle boxStyle;
private static GUIStyle buttonStyle;
private static Vector2 LastWindowPosition { get; set; }
private Vector2 scroll;
private static void InitStyles()
{
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 };
}
public SexStatusWindow(Pawn pawn, SexHistoryComp history)
{
this.pawn = pawn;
this.history = history;
this.selectedPawn = null;
this.rjwcomp = pawn.TryGetComp<CompRJW>();
this.partnerList = history?.PartnerList;
orderMode = PartnerOrderMode.Recent;
SortPartnerList(orderMode);
soundClose = SoundDefOf.CommsWindow_Close;
absorbInputAroundWindow = false;
forcePause = false;
preventCameraMotion = false;
draggable = true;
doCloseX = true;
}
protected override void SetInitialSizeAndPosition()
{
base.SetInitialSizeAndPosition();
if (LastWindowPosition == Vector2.zero)
return;
windowRect.x = LastWindowPosition.x;
windowRect.y = LastWindowPosition.y;
}
public override Vector2 InitialSize => new Vector2(WINDOW_WIDTH, WINDOW_HEIGHT);
public override void PreOpen()
{
base.PreOpen();
InitStyles();
}
public override void PreClose()
{
base.PreClose();
LastWindowPosition = windowRect.position;
}
public override void DoWindowContents(Rect inRect)
{
if (!SexperienceMod.Settings.SelectionLocked)
{
List<Pawn> selected = Find.Selector.SelectedPawns;
if (selected.Count == 1)
{
Pawn p = selected.First();
if (p != pawn)
{
SexHistoryComp h = p.TryGetComp<SexHistoryComp>();
if (h != null) ChangePawn(p, h);
}
}
}
DrawSexStatus(inRect, history);
}
public static void ToggleWindow(Pawn pawn, SexHistoryComp history)
{
SexStatusWindow window = (SexStatusWindow)Find.WindowStack.Windows.FirstOrDefault(x => x.GetType() == typeof(SexStatusWindow));
if (window != null)
{
if (window.pawn != pawn)
{
SoundDefOf.TabOpen.PlayOneShotOnCamera();
window.ChangePawn(pawn, history);
}
}
else
{
Find.WindowStack.Add(new SexStatusWindow(pawn, history));
}
}
public void ChangePawn(Pawn pawn, SexHistoryComp history)
{
List<Pawn> selected = Find.Selector.SelectedPawns;
if (!selected.NullOrEmpty())
{
foreach (Pawn p in selected)
{
Find.Selector.Deselect(p);
}
}
this.pawn = pawn;
this.history = history;
this.selectedPawn = null;
this.rjwcomp = pawn.TryGetComp<CompRJW>();
this.partnerList = history?.PartnerList;
if (!pawn.DestroyedOrNull() && Find.CurrentMap == pawn.Map) Find.Selector.Select(pawn);
SortPartnerList(orderMode);
}
public void SortPartnerList(PartnerOrderMode mode)
{
if (partnerList.NullOrEmpty()) return;
switch (mode)
{
default:
partnerList = history?.PartnerList;
break;
case PartnerOrderMode.Recent:
partnerList.Sort(new SexPartnerHistoryRecord.RecentOrderComparer());
break;
case PartnerOrderMode.Most:
partnerList.Sort(new SexPartnerHistoryRecord.MostOrderComparer());
break;
case PartnerOrderMode.Name:
partnerList.Sort(new SexPartnerHistoryRecord.NameOrderComparer());
break;
}
}
/// <summary>
/// Main contents
/// </summary>
protected void DrawSexStatus(Rect mainrect, SexHistoryComp history)
{
float sectionwidth = mainrect.width / 3;
Rect leftRect = new Rect(mainrect.x, mainrect.y, sectionwidth, mainrect.height);
Rect centerRect = new Rect(mainrect.x + sectionwidth, mainrect.y, sectionwidth, mainrect.height);
Rect rightRect = new Rect(mainrect.x + (sectionwidth * 2), mainrect.y, sectionwidth, mainrect.height);
if (history != null)
{
//Left section
DrawBaseSexInfoLeft(leftRect.ContractedBy(4f));
//Center section
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), history.parent as Pawn);
//Right section
DrawBaseSexInfoRight(rightRect.ContractedBy(4f));
}
}
protected void DrawInfoWithPortrait(Rect rect, SexPartnerHistoryRecord history, string tooltip = "")
{
Widgets.DrawMenuSection(rect);
string str = tooltip;
Rect portraitRect = new Rect(rect.x, rect.y, rect.height - FONTHEIGHT, rect.height - FONTHEIGHT);
Rect nameRect = new Rect(rect.x + portraitRect.width, rect.y, rect.width - portraitRect.width, FONTHEIGHT);
Rect sexinfoRect = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT, rect.width - portraitRect.width, FONTHEIGHT);
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 (history != null)
{
if (history.Incest) str += " - " + Keyed.Incest;
Pawn partner = history.Partner;
DrawPawn(portraitRect, history);
Widgets.DrawHighlightIfMouseover(portraitRect);
if (Widgets.ButtonInvisible(portraitRect))
{
SexHistoryComp pawnhistory = partner?.TryGetComp<SexHistoryComp>();
if (pawnhistory != null)
{
ChangePawn(partner, pawnhistory);
SoundDefOf.Click.PlayOneShotOnCamera();
}
else
{
SoundDefOf.ClickReject.PlayOneShotOnCamera();
}
}
string rapeInfo = "";
if (history.Raped > 0) rapeInfo += Keyed.RS_Raped + history.Raped + " ";
if (history.RapedMe > 0) rapeInfo += Keyed.RS_RapedMe + history.RapedMe;
GUI.Label(nameRect, partner?.Name?.ToStringFull ?? history.Label.CapitalizeFirst(), fontStyleLeft);
GUI.Label(sexinfoRect, Keyed.RS_Sex_Count + history.TotalSexCount + " " + rapeInfo, fontStyleLeft);
GUI.Label(sexinfoRect2, Keyed.RS_Orgasms + history.OrgasmCount, fontStyleLeft);
GUI.Label(sexinfoRect2, pawn.GetRelationsString(partner) + " ", fontStyleRight);
float p = history.BestSatisfaction / BASESAT;
FillableBarLabeled(bestsexRect, String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)history.BestSextype]), p / 2, HistoryUtility.SextypeColor[(int)history.BestSextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
if (history.IamFirst)
str += "\n" + Keyed.RS_LostVirgin(history.Label, pawn.LabelShort);
if (history.BestSexTickAbs != 0)
str += "\n" + Keyed.RS_HadBestSexDaysAgo(history.BestSexElapsedTicks.ToStringTicksToDays() + " " + Keyed.RS_Ago);
TooltipHandler.TipRegion(rect, str);
}
else
{
Widgets.DrawTextureFitted(portraitRect, HistoryUtility.UnknownPawn, 1.0f);
Widgets.Label(nameRect, Keyed.Unknown);
Widgets.Label(sexinfoRect, Keyed.RS_Sex_Count + "?");
Widgets.Label(sexinfoRect2, Keyed.RS_Orgasms + "?");
FillableBarLabeled(bestsexRect, String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)xxx.rjwSextype.None]), 0, Texture2D.linearGrayTexture, Texture2D.blackTexture);
}
}
protected void DrawSexInfoCard(Rect rect, SexPartnerHistoryRecord history, string label, string tooltip, string rightlabel = "")
{
Rect labelRect = new Rect(rect.x, rect.y, rect.width, FONTHEIGHT);
Rect infoRect = new Rect(rect.x, rect.y + FONTHEIGHT, rect.width, rect.height - FONTHEIGHT);
GUI.Label(labelRect, label, fontStyleLeft);
GUI.Label(labelRect, rightlabel, fontStyleRight);
DrawInfoWithPortrait(infoRect, history, tooltip);
}
/// <summary>
/// Right section
/// </summary>
protected void DrawBaseSexInfoRight(Rect rect)
{
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(rect.ContractedBy(4f));
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetRecentPartnersHistory, Keyed.RS_Recent_Sex_Partner, Keyed.RS_Recent_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.RecentSexTickAbs));
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetFirstPartnerHistory, Keyed.RS_First_Sex_Partner, Keyed.RS_First_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.FirstSexTickAbs));
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetMostPartnerHistory, Keyed.RS_Most_Sex_Partner, Keyed.RS_Most_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.MostSexTickAbs));
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetBestSexPartnerHistory, Keyed.RS_Best_Sex_Partner, Keyed.RS_Best_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.BestSexTickAbs));
GUI.Label(listmain.GetRect(FONTHEIGHT), Keyed.RS_PreferRace, fontStyleLeft);
DrawPreferRace(listmain.GetRect(66f + 15f));
listmain.GetRect(15f);
listmain.End();
}
protected void DrawPreferRace(Rect rect)
{
Widgets.DrawMenuSection(rect);
Rect portraitRect = new Rect(rect.x, rect.y, rect.height - 15f, rect.height - 15f);
Rect infoRect1 = new Rect(rect.x + portraitRect.width, rect.y, rect.width - portraitRect.width, FONTHEIGHT);
Rect infoRect2 = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT, rect.width - portraitRect.width, FONTHEIGHT);
Rect infoRect3 = new Rect(rect.x + portraitRect.width, rect.y + (FONTHEIGHT * 2), rect.width - portraitRect.width - 2f, FONTHEIGHT);
if (history.PreferRace != null)
{
Widgets.DrawTextureFitted(portraitRect, RJWUIUtility.GetRaceIcon(history.PreferRacePawn, portraitRect.size), 1.0f);
GUI.Label(infoRect1, history.PreferRace?.label.CapitalizeFirst() ?? Keyed.None, fontStyleLeft);
GUI.Label(infoRect2, Keyed.RS_Sex_Count + history.PreferRaceSexCount, fontStyleLeft);
if (history.PreferRace != pawn.def)
{
if (history.PreferRace.race.Animal ^ pawn.def.race.Animal)
{
GUI.Label(infoRect1, Keyed.RS_Bestiality + " ", fontStyleRight);
FillableBarLabeled(infoRect3, Keyed.RS_Sex_Info(Keyed.RS_Bestiality, history.BestialityCount.ToString()), history.BestialityCount / 100f, Texture2D.linearGrayTexture, Texture2D.blackTexture);
}
else
{
GUI.Label(infoRect1, Keyed.RS_Interspecies + " ", fontStyleRight);
FillableBarLabeled(infoRect3, Keyed.RS_Sex_Info(Keyed.RS_Interspecies, history.InterspeciesCount.ToString()), history.InterspeciesCount / 100f, Texture2D.linearGrayTexture, Texture2D.blackTexture);
}
}
}
else
{
Widgets.DrawTextureFitted(portraitRect, HistoryUtility.UnknownPawn, 1.0f);
GUI.Label(infoRect1, Keyed.None, fontStyleLeft);
}
}
/// <summary>
/// Center section
/// </summary>
protected void DrawBaseSexInfoCenter(Rect rect, Pawn pawn)
{
Rect portraitRect = new Rect(rect.x + (rect.width / 4), rect.y, rect.width / 2, rect.width / 1.5f);
Rect nameRect = new Rect(portraitRect.x, portraitRect.yMax - (FONTHEIGHT * 2), portraitRect.width, FONTHEIGHT * 2);
Rect infoRect = new Rect(rect.x, rect.y + portraitRect.height, rect.width, rect.height - portraitRect.height);
Rect lockRect = new Rect(portraitRect.xMax - ICONSIZE, portraitRect.y, ICONSIZE, ICONSIZE);
Rect tmp;
if (Mouse.IsOver(portraitRect))
{
Configurations settings = SexperienceMod.Settings;
Texture lockicon = settings.SelectionLocked ? HistoryUtility.Locked : HistoryUtility.Unlocked;
Widgets.DrawTextureFitted(lockRect, lockicon, 1.0f);
if (Widgets.ButtonInvisible(lockRect))
{
SoundDefOf.Click.PlayOneShotOnCamera();
settings.SelectionLocked = !settings.SelectionLocked;
}
}
GUI.Box(portraitRect, "", boxStyle);
Widgets.DrawTextureFitted(portraitRect, PortraitsCache.Get(pawn, portraitRect.size, Rot4.South, default, 1, true, true, false, false), 1.0f);
Widgets.DrawHighlightIfMouseover(portraitRect);
if (Widgets.ButtonInvisible(portraitRect))
{
SoundDefOf.Click.PlayOneShotOnCamera();
selectedPawn = null;
}
GUI.Box(nameRect, "", boxStyle);
GUI.Label(nameRect.TopHalf(), pawn.Name?.ToStringFull ?? pawn.Label, fontStyleCenter);
if (pawn.story != null) GUI.Label(nameRect.BottomHalf(), pawn.ageTracker.AgeBiologicalYears + ", " + pawn.story.Title, fontStyleCenter);
else GUI.Label(nameRect.BottomHalf(), pawn.ageTracker.AgeBiologicalYears + ", " + pawn.def.label, fontStyleCenter);
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(infoRect);
listmain.Gap(20f);
float p;
Trait virginity = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
if (virginity != null && virginity.Degree != Virginity.TraitDegree.FemaleAfterSurgery)
{
tmp = listmain.GetRect(FONTHEIGHT);
GUI.color = Color.red;
GUI.Box(tmp, "", boxStyle);
GUI.color = Color.white;
GUI.Label(tmp, virginity.Label, fontStyleCenter);
}
else
{
p = history.TotalSexHad;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_TotalSexHad + ": {0:0} ({1:0})", p, pawn.records.GetValue(xxx.CountOfSex)), p / 100, HistoryUtility.TotalSex, Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", history.AVGSat)));
}
listmain.Gap(1f);
tmp = listmain.GetRect(FONTHEIGHT);
p = pawn.records.GetValue(VariousDefOf.Lust);
FillableBarLabeled(tmp, String.Format(Keyed.Lust + ": {0:0.00}", p), Mathf.Clamp01(p.Normalization(-SexperienceMod.Settings.LustLimit * 3, SexperienceMod.Settings.LustLimit * 3)), HistoryUtility.Slaanesh, Texture2D.blackTexture, null, String.Format(xxx.sex_drive_stat.LabelCap + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_drive_stat)));
listmain.Gap(1f);
if (Mouse.IsOver(tmp))
{
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.sex_drive_stat, pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_drive_stat)));
}
p = history.GetBestSextype(out xxx.rjwSextype sextype) / BASESAT;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", p)));
listmain.Gap(1f);
p = history.GetRecentSextype(out sextype) / BASESAT;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Recent_Sextype + ": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
listmain.Gap(1f);
if (history.IncestuousCount < history.CorpseFuckCount)
{
p = history.CorpseFuckCount;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Necrophile + ": {0}", p), p / 50, HistoryUtility.Nurgle, Texture2D.blackTexture);
listmain.Gap(1f);
}
else
{
p = history.IncestuousCount;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.Incest + ": {0}", p), p / 50, HistoryUtility.Nurgle, Texture2D.blackTexture);
listmain.Gap(1f);
}
p = pawn.records.GetValue(VariousDefOf.AmountofEatenCum);
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Cum_Swallowed + ": {0} mL, {1} " + Keyed.RS_NumofTimes, p, pawn.records.GetValue(VariousDefOf.NumofEatenCum)), p / 1000, Texture2D.linearGrayTexture, Texture2D.blackTexture);
listmain.Gap(1f);
Hediff addiction = pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumAddiction)
?? pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumTolerance);
if (addiction != null)
{
p = addiction.Severity;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), $"{addiction.Label}: {p.ToStringPercent()}", p, Texture2D.linearGrayTexture, Texture2D.blackTexture, addiction.GetTooltip(pawn, false));
}
else
{
listmain.GetRect(FONTHEIGHT);
}
listmain.Gap(1f);
p = history.RapedCount;
tmp = listmain.GetRect(FONTHEIGHT);
if (p < history.BeenRapedCount)
{
p = history.BeenRapedCount;
FillableBarLabeled(tmp, String.Format(Keyed.RS_BeenRaped + ": {0}", p), p / 50, Texture2D.grayTexture, Texture2D.blackTexture, null, String.Format(xxx.vulnerability_stat.LabelCap + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
listmain.Gap(1f);
}
else
{
FillableBarLabeled(tmp, String.Format(Keyed.RS_RapedSomeone + ": {0}", p), p / 50, HistoryUtility.Khorne, Texture2D.blackTexture, null, String.Format(xxx.vulnerability_stat.LabelCap + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
listmain.Gap(1f);
}
if (Mouse.IsOver(tmp))
{
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.vulnerability_stat, pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
}
p = pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_satisfaction);
tmp = listmain.GetRect(FONTHEIGHT);
FillableBarLabeled(tmp, String.Format(xxx.sex_satisfaction.LabelCap + ": {0:P2}", p), p / 2, HistoryUtility.Satisfaction, Texture2D.blackTexture);
listmain.Gap(1f);
if (Mouse.IsOver(tmp))
{
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.sex_satisfaction, pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_satisfaction)));
}
SkillRecord skill = pawn.skills?.GetSkill(VariousDefOf.Sex);
p = skill?.Level ?? 0;
tmp = listmain.GetRect(FONTHEIGHT);
FillableBarLabeled(tmp, $"{Keyed.RS_SexSkill}: {p}, {skill?.xpSinceLastLevel / skill?.XpRequiredForLevelUp:P2}", p / 20, HistoryUtility.Tzeentch, Texture2D.blackTexture, null, $"{VariousDefOf.SexAbility.LabelCap}: {pawn.GetSexStat():P2}", HistoryUtility.GetPassionBG(skill?.passion));
if (Mouse.IsOver(tmp))
{
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, VariousDefOf.SexAbility, pawn.GetSexStat()));
}
listmain.Gap(1f);
if (selectedPawn != null) DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), selectedPawn, Keyed.RS_Selected_Partner, Keyed.RS_Selected_Partner, RJWUIUtility.GetSexDays(selectedPawn.RecentSexTickAbs));
else DrawExtraInfo(listmain.GetRect(CARDHEIGHT));
listmain.End();
}
protected void DrawExtraInfo(Rect rect)
{
Widgets.DrawMenuSection(rect);
Rect inRect = rect.ContractedBy(4f);
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(inRect);
listmain.Gap(4f);
listmain.GetRect(FONTHEIGHT).DrawSexuality(rjwcomp);
listmain.Gap(1f);
listmain.GetRect(FONTHEIGHT * 3f).DrawQuirk(pawn);
listmain.End();
}
/// <summary>
/// Left section
/// </summary>
protected void DrawBaseSexInfoLeft(Rect rect)
{
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(rect);
float p;
//Sex statistics
GUI.Label(listmain.GetRect(FONTHEIGHT), " " + Keyed.RS_Statistics, fontStyleLeft);
listmain.Gap(1f);
float maxSatisfaction = history.GetBestSextype(out _);
if (maxSatisfaction == 0f) maxSatisfaction = BASESAT;
for (int i = 0; i < Sextype.Length; i++)
{
int sexindex = Sextype[i];
float relativeSat = history.GetAVGSat(sexindex) / maxSatisfaction;
p = history.GetAVGSat(sexindex) / BASESAT;
string label = Keyed.RS_Sex_Info(Keyed.Sextype[sexindex], history.GetSexCount(sexindex).ToString());
Rect tmpRect = listmain.GetRect(FONTHEIGHT);
FillableBarLabeled(tmpRect, label, relativeSat, HistoryUtility.SextypeColor[sexindex], Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", p)));
if (Mouse.IsOver(tmpRect))
{
TooltipHandler.TipRegion(tmpRect, Keyed.RS_LastSex.CapitalizeFirst() + ": " + RJWUIUtility.GetSexDays(history.GetSextypeRecentTickAbs(Sextype[i]), true));
}
listmain.Gap(1f);
}
p = history.PartnerCount;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", p, pawn.records.GetValue(VariousDefOf.SexPartnerCount)), p / 50, HistoryUtility.Partners, Texture2D.blackTexture);
listmain.Gap(1f);
p = history.VirginsTaken;
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_VirginsTaken + ": {0:0}", p), p / 100, HistoryUtility.Partners, Texture2D.blackTexture);
listmain.Gap(1f);
//Partner list
Rect listLabelRect = listmain.GetRect(FONTHEIGHT);
Rect sortbtnRect = new Rect(listLabelRect.xMax - 80f, listLabelRect.y, 80f, listLabelRect.height);
GUI.Label(listLabelRect, " " + Keyed.RS_PartnerList, fontStyleLeft);
if (Widgets.ButtonText(sortbtnRect, orderMode.Translate()))
{
SoundDefOf.Click.PlayOneShotOnCamera();
orderMode = orderMode.Next();
SortPartnerList(orderMode);
}
listmain.Gap(1f);
Rect scrollRect = listmain.GetRect(CARDHEIGHT + 1f);
GUI.Box(scrollRect, "", buttonStyle);
if (!partnerList.NullOrEmpty())
{
Rect listRect = new Rect(scrollRect.x, scrollRect.y, LISTPAWNSIZE * partnerList.Count, scrollRect.height - 30f);
Widgets.ScrollHorizontal(scrollRect, ref scroll, listRect);
Widgets.BeginScrollView(scrollRect, ref scroll, listRect);
DrawPartnerList(listRect, partnerList);
Widgets.EndScrollView();
}
listmain.End();
}
protected void DrawPartnerList(Rect rect, List<SexPartnerHistoryRecord> partnerList)
{
Rect pawnRect = new Rect(rect.x, rect.y, LISTPAWNSIZE, LISTPAWNSIZE);
for (int i = 0; i < partnerList.Count; i++)
{
Rect labelRect = new Rect(pawnRect.x, pawnRect.yMax - FONTHEIGHT, pawnRect.width, FONTHEIGHT);
DrawPawn(pawnRect, partnerList[i]);
Widgets.DrawHighlightIfMouseover(pawnRect);
GUI.Label(labelRect, partnerList[i].Label, fontStyleCenter);
if (Widgets.ButtonInvisible(pawnRect))
{
selectedPawn = partnerList[i];
SoundDefOf.Click.PlayOneShotOnCamera();
}
if (partnerList[i] == selectedPawn)
{
Widgets.DrawHighlightSelected(pawnRect);
}
pawnRect.x += LISTPAWNSIZE;
}
}
protected void DrawPawn(Rect rect, SexPartnerHistoryRecord history)
{
if (history != null)
{
bool drawheart = false;
Rect iconRect = new Rect(rect.x + (rect.width * 3 / 4), rect.y, rect.width / 4, rect.height / 4);
Texture img = HistoryUtility.UnknownPawn;
if (history.IamFirst)
{
GUI.color = HistoryUtility.HistoryColor;
Widgets.DrawTextureFitted(rect, HistoryUtility.FirstOverlay, 1.0f);
GUI.color = Color.white;
}
if (history.Partner != null)
{
img = PortraitsCache.Get(history.Partner, rect.size, Rot4.South, default, 1, true, true, false, false);
drawheart = LovePartnerRelationUtility.LovePartnerRelationExists(pawn, history.Partner);
}
else if (history.Race?.uiIcon != null)
{
img = history.Race.uiIcon;
}
if (history.Incest)
{
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Incest, 1.0f);
iconRect.x -= iconRect.width;
}
Widgets.DrawTextureFitted(rect, img, 1.0f);
if (drawheart)
{
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Heart, 1.0f);
iconRect.x -= iconRect.width;
}
}
}
public static void FillableBarLabeled(Rect rect, string label, float fillPercent, Texture2D filltexture, Texture2D bgtexture, string tooltip = null, string rightlabel = "", Texture2D border = null)
{
Widgets.FillableBar(rect, Math.Min(fillPercent, 1.0f), filltexture, bgtexture, true);
GUI.Label(rect, " " + label.CapitalizeFirst(), fontStyleLeft);
GUI.Label(rect, rightlabel.CapitalizeFirst() + " ", fontStyleRight);
Widgets.DrawHighlightIfMouseover(rect);
if (tooltip != null) TooltipHandler.TipRegion(rect, tooltip);
if (border != null)
{
rect.DrawBorder(border, 2f);
}
}
}
}

View File

@ -0,0 +1,351 @@
using RimWorld;
using rjw;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using Verse;
namespace RJWSexperience.SexHistory.UI
{
public sealed class SexStatusViewModel
{
private static readonly int[] Sextype =
{
(int)xxx.rjwSextype.Vaginal,
(int)xxx.rjwSextype.Anal,
(int)xxx.rjwSextype.Oral,
(int)xxx.rjwSextype.Fellatio,
(int)xxx.rjwSextype.Cunnilingus,
(int)xxx.rjwSextype.DoublePenetration,
(int)xxx.rjwSextype.Boobjob,
(int)xxx.rjwSextype.Handjob,
(int)xxx.rjwSextype.Footjob,
(int)xxx.rjwSextype.Fingering,
(int)xxx.rjwSextype.Scissoring,
(int)xxx.rjwSextype.MutualMasturbation,
(int)xxx.rjwSextype.Fisting,
(int)xxx.rjwSextype.Rimming,
(int)xxx.rjwSextype.Sixtynine
};
private readonly SexHistoryComp _history;
private readonly CompRJW _rjwComp;
private int _validUntilTick;
public SexStatusViewModel(SexHistoryComp history, PartnerOrderMode mode)
{
_history = history;
_rjwComp = history.ParentPawn.TryGetComp<CompRJW>();
SetPartnerOrder(mode);
Name = Pawn.Name?.ToStringFull ?? Pawn.Label;
if (Pawn.story != null)
{
AgeAndTitle = Pawn.ageTracker.AgeBiologicalYears + ", " + Pawn.story.Title;
}
else
{
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<InfoCard> InfoCards { get; } = new List<InfoCard>();
public InfoCard SelectedPartnerCard { get; }
public PreferedRaceCard PreferedRaceCard { get; }
public List<BarInfo> SexTypes { get; } = new List<BarInfo>();
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 string VirginLabel { get; private set; }
public string SexualityLabel { get; private set; }
public string QuirksLabel { get; private set; }
public TipSignal QuirksTooltip { get; private set; }
public SexPartnerHistoryRecord SelectedPartner { get; private set; }
public IEnumerable<PartnerPortraitInfo> Partners { get; private set; }
public void Update()
{
if (Find.TickManager.TicksGame <= _validUntilTick)
{
return;
}
UpdateInfoCards();
UpdateBars();
UpdateQuirks();
UpdateVirginAndSexuality();
PreferedRaceCard.Update();
int tickRateMultiplier = (int)Find.TickManager.TickRateMultiplier;
if (tickRateMultiplier == 0) // Paused
{
_validUntilTick = Find.TickManager.TicksGame;
return;
}
_validUntilTick = Find.TickManager.TicksGame + (60 * tickRateMultiplier);
}
private void UpdateInfoCards()
{
InfoCard recentSexPartner = InfoCards[0];
recentSexPartner.LastSexTime = UIUtility.GetSexDays(_history.RecentSexTickAbs);
recentSexPartner.UpdatePartnerRecord(_history.RecentPartnerRecord);
InfoCard firstSexPartner = InfoCards[1];
firstSexPartner.LastSexTime = UIUtility.GetSexDays(_history.FirstSexTickAbs);
firstSexPartner.UpdatePartnerRecord(_history.FirstPartnerRecord);
InfoCard mostSexPartner = InfoCards[2];
mostSexPartner.LastSexTime = UIUtility.GetSexDays(_history.MostSexTickAbs);
mostSexPartner.UpdatePartnerRecord(_history.MostPartnerRecord);
InfoCard bestSexPartner = InfoCards[3];
bestSexPartner.LastSexTime = UIUtility.GetSexDays(_history.BestSexTickAbs);
bestSexPartner.UpdatePartnerRecord(_history.BestSexPartnerRecord);
if (SelectedPartner != null)
{
UpdateSelectedPartnerCard();
}
}
private void UpdateBars()
{
float maxSatisfaction = _history.GetBestSextype(out _);
if (maxSatisfaction == 0f)
{
maxSatisfaction = UIUtility.BASESAT;
}
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);
}
PartnerCount.Label = string.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", _history.PartnerCount, Pawn.records.GetValue(RsDefOf.Record.SexPartnerCount));
PartnerCount.FillPercent = _history.PartnerCount / 50f;
VirginsTaken.Label = string.Format(Keyed.RS_VirginsTaken + ": {0:0}", _history.VirginsTaken);
VirginsTaken.FillPercent = _history.VirginsTaken / 100f;
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);
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();
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);
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();
Necro.Label = string.Format(Keyed.RS_Necrophile + ": {0}", _history.CorpseFuckCount);
Necro.FillPercent = _history.CorpseFuckCount / 50f;
Incest.Label = string.Format(Keyed.Incest + ": {0}", _history.IncestuousCount);
Incest.FillPercent = _history.IncestuousCount / 50f;
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;
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;
}
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;
BeenRaped.Label = string.Format(Keyed.RS_BeenRaped + ": {0}", _history.BeenRapedCount);
BeenRaped.FillPercent = _history.BeenRapedCount / 50f;
BeenRaped.Tooltip = vulnerabilityTip;
BeenRaped.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);
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);
}
private void UpdateQuirks()
{
List<Quirk> quirks = Quirk.All.FindAll(x => Pawn.Has(x));
string quirkstr = quirks.Select(x => x.Key).ToCommaList();
QuirksLabel = "Quirks".Translate() + quirkstr;
if (quirks.NullOrEmpty())
{
QuirksTooltip = "NoQuirks".Translate();
}
else
{
QuirksTooltip = new TipSignal(() =>
{
StringBuilder stringBuilder = new StringBuilder();
foreach (Quirk q in quirks)
{
stringBuilder.AppendLine(q.Key.Colorize(Color.yellow));
stringBuilder.AppendLine(q.LocaliztionKey.Translate(Pawn.Named("pawn")).AdjustedFor(Pawn).Resolve());
stringBuilder.AppendLine("");
}
return stringBuilder.ToString().TrimEndNewlines();
}, "Quirks".GetHashCode());
}
}
private void UpdateVirginAndSexuality()
{
Trait virginity = Pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin);
if (virginity != null && virginity.Degree != Virginity.TraitDegree.FemaleAfterSurgery)
{
VirginLabel = virginity.Label;
}
else
{
VirginLabel = null;
}
if (_rjwComp != null)
{
SexualityLabel = Keyed.RS_Sexuality + ": " + Keyed.Sexuality[(int)_rjwComp.orientation];
}
}
public void SetPartnerOrder(PartnerOrderMode mode)
{
if (_history == null)
{
return;
}
var partners = _history.PartnerList.Select(x => new PartnerPortraitInfo(Pawn, x));
switch (mode)
{
default:
Partners = partners;
break;
case PartnerOrderMode.Recent:
Partners = partners.OrderBy(x => x.PartnerRecord.RecentSexTickAbs);
break;
case PartnerOrderMode.Most:
Partners = partners.OrderBy(x => x.PartnerRecord.TotalSexCount);
break;
case PartnerOrderMode.Name:
Partners = partners.OrderBy(x => x.PartnerRecord.Label);
break;
}
}
public void SetSelectedPartner(SexPartnerHistoryRecord sexPartner)
{
SelectedPartner = sexPartner;
UpdateSelectedPartnerCard();
}
private void UpdateSelectedPartnerCard()
{
SelectedPartnerCard.UpdatePartnerRecord(SelectedPartner);
if (SelectedPartner == null)
{
SelectedPartnerCard.LastSexTime = null;
}
else
{
SelectedPartnerCard.LastSexTime = UIUtility.GetSexDays(SelectedPartner.RecentSexTickAbs);
}
}
private float GetStatValue(StatDef statDef) => Pawn.Dead ? 0f : Pawn.GetStatValue(statDef);
private TipSignal GetStatTooltip(StatDef stat, float val)
{
if (!Pawn.Dead)
{
return new TipSignal(
textGetter: () => stat.description + "\n\n" + stat.Worker.GetExplanationFull(StatRequest.For(Pawn), ToStringNumberSense.Undefined, val),
uniqueId: stat.GetHashCode());
}
return "Dead".Translate();
}
}
}

View File

@ -0,0 +1,491 @@
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
using Verse.Sound;
namespace RJWSexperience.SexHistory.UI
{
public class SexStatusWindow : Window
{
public const float WINDOW_WIDTH = 900f;
public const float WINDOW_HEIGHT = 600f;
public const float FONTHEIGHT = UIUtility.FONTHEIGHT;
public const float CARDHEIGHT = UIUtility.CARDHEIGHT;
public const float LISTPAWNSIZE = UIUtility.LISTPAWNSIZE;
public const float BASESAT = UIUtility.BASESAT;
public const float ICONSIZE = UIUtility.ICONSIZE;
private static GUIStyle boxStyle;
private static GUIStyle buttonStyle;
private SexStatusViewModel _context;
protected PartnerOrderMode orderMode;
private static Vector2 LastWindowPosition { get; set; }
private Vector2 scroll;
private static void InitStyles()
{
if (boxStyle != null)
{
return;
}
GUIStyleState boxStyleState = GUI.skin.textArea.normal;
GUIStyleState buttonStyleState = GUI.skin.button.normal;
boxStyle = new GUIStyle(GUI.skin.textArea) { hover = boxStyleState, onHover = boxStyleState, onNormal = boxStyleState };
buttonStyle = new GUIStyle(GUI.skin.button) { hover = buttonStyleState, onHover = buttonStyleState, onNormal = buttonStyleState };
}
public SexStatusWindow(SexHistoryComp history)
{
orderMode = PartnerOrderMode.Recent;
_context = new SexStatusViewModel(history, orderMode);
soundClose = SoundDefOf.CommsWindow_Close;
absorbInputAroundWindow = false;
forcePause = false;
preventCameraMotion = false;
draggable = true;
doCloseX = true;
}
protected override void SetInitialSizeAndPosition()
{
base.SetInitialSizeAndPosition();
if (LastWindowPosition == Vector2.zero)
return;
windowRect.x = LastWindowPosition.x;
windowRect.y = LastWindowPosition.y;
}
public override Vector2 InitialSize => new Vector2(WINDOW_WIDTH, WINDOW_HEIGHT);
public override void PreOpen()
{
base.PreOpen();
InitStyles();
}
public override void PreClose()
{
base.PreClose();
LastWindowPosition = windowRect.position;
}
public override void DoWindowContents(Rect inRect)
{
if (!SexperienceMod.Settings.SelectionLocked)
{
List<Pawn> selectedPawns = Find.Selector.SelectedPawns;
if (selectedPawns.Count == 1)
{
Pawn selectedPawn = selectedPawns[0];
if (selectedPawn != _context.Pawn)
{
SexHistoryComp h = selectedPawn.TryGetComp<SexHistoryComp>();
if (h != null) ChangePawn(h);
}
}
}
_context.Update();
DrawSexStatus(inRect);
}
public static void ToggleWindow(SexHistoryComp history)
{
SexStatusWindow window = Find.WindowStack.WindowOfType<SexStatusWindow>();
if (window != null)
{
if (window._context.Pawn != history.ParentPawn)
{
window.ChangePawn(history);
}
}
else
{
Find.WindowStack.Add(new SexStatusWindow(history));
}
}
public void ChangePawn(SexHistoryComp history)
{
Find.Selector.ClearSelection();
_context = new SexStatusViewModel(history, orderMode);
if (!_context.Pawn.DestroyedOrNull() && Find.CurrentMap == _context.Pawn.Map)
{
Find.Selector.Select(_context.Pawn);
}
}
/// <summary>
/// Main contents
/// </summary>
protected void DrawSexStatus(Rect mainrect)
{
float sectionwidth = mainrect.width / 3;
Rect leftRect = new Rect(mainrect.x, mainrect.y, sectionwidth, mainrect.height);
Rect centerRect = new Rect(mainrect.x + sectionwidth, mainrect.y, sectionwidth, mainrect.height);
Rect rightRect = new Rect(mainrect.x + (sectionwidth * 2), mainrect.y, sectionwidth, mainrect.height);
//Left section
DrawBaseSexInfoLeft(leftRect.ContractedBy(4f));
//Center section
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), _context.Pawn);
//Right section
DrawBaseSexInfoRight(rightRect.ContractedBy(4f));
}
protected void DrawInfoWithPortrait(Rect rect, InfoCard context)
{
Widgets.DrawMenuSection(rect);
Rect portraitRect = new Rect(rect.x, rect.y, rect.height - FONTHEIGHT, rect.height - FONTHEIGHT);
Rect nameRect = new Rect(rect.x + portraitRect.width, rect.y, rect.width - portraitRect.width, FONTHEIGHT);
Rect sexinfoRect = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT, rect.width - portraitRect.width, FONTHEIGHT);
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)
{
DrawPartnerPortrait(portraitRect, context.PortraitInfo);
Widgets.DrawHighlightIfMouseover(portraitRect);
if (Widgets.ButtonInvisible(portraitRect))
{
SexHistoryComp partnerHistory = context.PartnerRecord.Partner?.TryGetComp<SexHistoryComp>();
if (partnerHistory != null)
{
ChangePawn(partnerHistory);
SoundDefOf.Click.PlayOneShotOnCamera();
}
else
{
SoundDefOf.ClickReject.PlayOneShotOnCamera();
}
}
Text.Anchor = TextAnchor.MiddleRight;
Widgets.Label(sexinfoRect2, context.Relations + " ");
GenUI.ResetLabelAlign();
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);
}
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();
DrawInfoWithPortrait(infoRect, context);
}
/// <summary>
/// Right section
/// </summary>
protected void DrawBaseSexInfoRight(Rect rect)
{
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(rect.ContractedBy(4f));
foreach(InfoCard infoCard in _context.InfoCards)
{
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), infoCard);
}
Text.Anchor = TextAnchor.MiddleLeft;
listmain.Label(Keyed.RS_PreferRace);
GenUI.ResetLabelAlign();
DrawPreferRace(listmain.GetRect(66f + 15f), _context.PreferedRaceCard);
listmain.End();
}
protected void DrawPreferRace(Rect rect, PreferedRaceCard preferedRaceCard)
{
Widgets.DrawMenuSection(rect);
rect.SplitVertically(rect.height - 15f, out Rect portraitRect, out Rect infoRect);
portraitRect.height = portraitRect.width;
Rect infoRect1 = new Rect(infoRect.x, infoRect.y, infoRect.width, FONTHEIGHT);
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);
Text.Anchor = TextAnchor.MiddleLeft;
Widgets.Label(infoRect1, preferedRaceCard.PreferRaceLabel);
if (preferedRaceCard.SexCount != null)
{
Widgets.Label(infoRect2, preferedRaceCard.SexCount);
}
GenUI.ResetLabelAlign();
if (preferedRaceCard.PreferRaceTypeLabel != null)
{
Text.Anchor = TextAnchor.MiddleRight;
Widgets.Label(infoRect1, preferedRaceCard.PreferRaceTypeLabel + " ");
}
if (preferedRaceCard.BarInfo.Label != null)
{
UIUtility.FillableBarLabeled(infoRect3, preferedRaceCard.BarInfo);
}
}
/// <summary>
/// Center section
/// </summary>
protected void DrawBaseSexInfoCenter(Rect rect, Pawn pawn)
{
Rect portraitRect = new Rect(rect.x + (rect.width / 4), rect.y, rect.width / 2, rect.width / 1.5f);
Rect nameRect = new Rect(portraitRect.x, portraitRect.yMax - (FONTHEIGHT * 2), portraitRect.width, FONTHEIGHT * 2);
Rect infoRect = rect.BottomPartPixels(rect.height - portraitRect.height - 20f);
if (Mouse.IsOver(portraitRect))
{
Rect lockRect = new Rect(portraitRect.xMax - ICONSIZE, portraitRect.y, ICONSIZE, ICONSIZE);
Configurations settings = SexperienceMod.Settings;
Texture lockIcon = settings.SelectionLocked ? HistoryUtility.Locked : HistoryUtility.Unlocked;
Widgets.DrawTextureFitted(lockRect, lockIcon, 1.0f);
TooltipHandler.TipRegion(lockRect, Keyed.RS_PawnLockDesc);
if (Widgets.ButtonInvisible(lockRect))
{
SoundDefOf.Click.PlayOneShotOnCamera();
settings.SelectionLocked.Value = !settings.SelectionLocked.Value;
}
}
GUI.Box(portraitRect, "", boxStyle);
Widgets.DrawTextureFitted(portraitRect, PortraitsCache.Get(pawn, portraitRect.size, Rot4.South, default, 1, true, true, false, false), 1.0f);
if (_context.SelectedPartner != null)
{
Widgets.DrawHighlightIfMouseover(portraitRect);
if (Widgets.ButtonInvisible(portraitRect))
{
SoundDefOf.Click.PlayOneShotOnCamera();
_context.SetSelectedPartner(null);
}
}
GUI.Box(nameRect, "", boxStyle);
Text.Anchor = TextAnchor.MiddleCenter;
Widgets.Label(nameRect.TopHalf(), _context.Name);
Widgets.Label(nameRect.BottomHalf(), _context.AgeAndTitle);
GenUI.ResetLabelAlign();
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(infoRect);
if (_context.VirginLabel != null)
{
Rect tmp = listmain.GetRect(FONTHEIGHT);
GUI.color = Color.red;
GUI.Box(tmp, "", boxStyle);
GUI.color = Color.white;
Text.Anchor = TextAnchor.MiddleCenter;
Widgets.Label(tmp, _context.VirginLabel);
GenUI.ResetLabelAlign();
listmain.Gap(1f);
}
else
{
listmain.FillableBarLabeled(_context.TotalSex);
}
listmain.FillableBarLabeled(_context.Lust);
listmain.FillableBarLabeled(_context.BestSextype);
listmain.FillableBarLabeled(_context.RecentSextype);
if (_context.Incest.FillPercent < _context.Necro.FillPercent)
{
listmain.FillableBarLabeled(_context.Necro);
}
else
{
listmain.FillableBarLabeled(_context.Incest);
}
listmain.FillableBarLabeled(_context.ConsumedCum);
if (_context.CumHediff.Label != "")
{
listmain.FillableBarLabeled(_context.CumHediff);
}
else
{
listmain.Gap(FONTHEIGHT + 1f);
}
if (_context.Raped.FillPercent < _context.BeenRaped.FillPercent)
{
listmain.FillableBarLabeled(_context.BeenRaped);
}
else
{
listmain.FillableBarLabeled(_context.Raped);
}
listmain.FillableBarLabeled(_context.SexSatisfaction);
listmain.FillableBarLabeled(_context.SexSkill);
if (_context.SelectedPartner != null)
{
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), _context.SelectedPartnerCard);
}
else
{
DrawExtraInfo(listmain.GetRect(CARDHEIGHT));
}
listmain.End();
}
/// <summary>
/// Sexuality and quirks
/// </summary>
protected void DrawExtraInfo(Rect rect)
{
Widgets.DrawMenuSection(rect);
Rect inRect = rect.ContractedBy(4f);
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(inRect);
listmain.Gap(4f);
Rect sexualityRect = listmain.GetRect(FONTHEIGHT);
if (_context.SexualityLabel != null)
{
Widgets.Label(sexualityRect, _context.SexualityLabel);
Widgets.DrawHighlightIfMouseover(sexualityRect);
}
listmain.Gap(1f);
Rect quirkRect = listmain.GetRect(FONTHEIGHT * 3f);
Widgets.Label(quirkRect, _context.QuirksLabel);
Widgets.DrawHighlightIfMouseover(quirkRect);
TooltipHandler.TipRegion(quirkRect, _context.QuirksTooltip);
listmain.End();
}
/// <summary>
/// Left section
/// </summary>
protected void DrawBaseSexInfoLeft(Rect rect)
{
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(rect);
//Sex statistics
Text.Anchor = TextAnchor.MiddleLeft;
listmain.Label(" " + Keyed.RS_Statistics);
GenUI.ResetLabelAlign();
listmain.Gap(1f);
for (int i = 0; i < _context.SexTypes.Count; i++)
{
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();
if (Widgets.ButtonText(sortbtnRect, orderMode.Translate()))
{
SoundDefOf.Click.PlayOneShotOnCamera();
orderMode = orderMode.Next();
_context.SetPartnerOrder(orderMode);
}
listmain.Gap(1f);
Rect scrollRect = listmain.GetRect(CARDHEIGHT + 1f);
GUI.Box(scrollRect, "", buttonStyle);
if (!_context.Partners.EnumerableNullOrEmpty())
{
Rect listRect = new Rect(scrollRect.x, scrollRect.y, LISTPAWNSIZE * _context.Partners.Count(), scrollRect.height - 30f);
Widgets.ScrollHorizontal(scrollRect, ref scroll, listRect);
Widgets.BeginScrollView(scrollRect, ref scroll, listRect);
DrawPartnerList(listRect, _context.Partners);
Widgets.EndScrollView();
}
listmain.End();
}
/// <summary>
/// Partners at the bottom of the left section
/// </summary>
protected void DrawPartnerList(Rect rect, IEnumerable<PartnerPortraitInfo> partners)
{
Rect pawnRect = new Rect(rect.x, rect.y, LISTPAWNSIZE, LISTPAWNSIZE);
foreach (PartnerPortraitInfo partner in partners)
{
Rect labelRect = new Rect(pawnRect.x, pawnRect.yMax - FONTHEIGHT, pawnRect.width, FONTHEIGHT);
DrawPartnerPortrait(pawnRect, partner);
Widgets.DrawHighlightIfMouseover(pawnRect);
Text.Anchor = TextAnchor.MiddleCenter;
Widgets.Label(labelRect, partner.PartnerRecord.Label);
GenUI.ResetLabelAlign();
if (Widgets.ButtonInvisible(pawnRect))
{
_context.SetSelectedPartner(partner.PartnerRecord);
SoundDefOf.Click.PlayOneShotOnCamera();
}
if (partner.PartnerRecord == _context.SelectedPartner)
{
Widgets.DrawHighlightSelected(pawnRect);
}
pawnRect.x += LISTPAWNSIZE;
}
}
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);
if (context.PartnerRecord.IamFirst)
{
GUI.color = HistoryUtility.HistoryColor;
Widgets.DrawTextureFitted(rect, HistoryUtility.FirstOverlay, 1.0f);
GUI.color = Color.white;
}
if (context.PartnerRecord.Incest)
{
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Incest, 1.0f);
iconRect.x -= iconRect.width;
}
Widgets.DrawTextureFitted(rect, img, 1.0f);
if (context.Lover)
{
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Heart, 1.0f);
}
}
}
}

View File

@ -0,0 +1,80 @@
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Contexts;
using UnityEngine;
using Verse;
namespace RJWSexperience.SexHistory.UI
{
public static class UIUtility
{
public const float FONTHEIGHT = 22f;
public const float CARDHEIGHT = 110f;
public const float LISTPAWNSIZE = 100f;
public const float BASESAT = 0.40f;
public const float ICONSIZE = 30f;
public static string GetRelationsString(this Pawn pawn, Pawn otherpawn)
{
if (otherpawn != null)
{
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
if (!relations.EnumerableNullOrEmpty())
return relations.Select(x => x.GetGenderSpecificLabel(otherpawn)).ToCommaList().CapitalizeFirst();
}
return "";
}
public static void DrawBorder(this Rect rect, Texture border, float thickness = 1f)
{
GUI.DrawTexture(new Rect(rect.x, rect.y, rect.width, thickness), border);
GUI.DrawTexture(new Rect(rect.x + rect.width - thickness, rect.y, thickness, rect.height), border);
GUI.DrawTexture(new Rect(rect.x, rect.y + rect.height - thickness, rect.width, thickness), border);
GUI.DrawTexture(new Rect(rect.x, rect.y, thickness, rect.height), border);
}
public static string GetSexDays(int absticks, bool printUnknown = false)
{
if (absticks != 0)
return GenDate.ToStringTicksToDays(GenTicks.TicksAbs - absticks) + " " + Keyed.RS_Ago;
else if (printUnknown)
return Keyed.Unknown;
return "";
}
public static Texture GetRaceIcon(Pawn pawn, Vector2 size)
{
if (pawn != null)
return PortraitsCache.Get(pawn, size, Rot4.South, default, 1, true, true, false, false);
return HistoryUtility.UnknownPawn;
}
public static void FillableBarLabeled(Rect rect, BarInfo context)
{
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 != "")
{
Text.Anchor = TextAnchor.MiddleRight;
Widgets.Label(labelRect, context.LabelRight);
}
GenUI.ResetLabelAlign();
Widgets.DrawHighlightIfMouseover(rect);
TooltipHandler.TipRegion(rect, context.Tooltip);
if (context.Border != null)
{
rect.DrawBorder(context.Border, 2f);
}
}
public static void FillableBarLabeled(this Listing_Standard list, BarInfo context)
{
FillableBarLabeled(list.GetRect(FONTHEIGHT), context);
list.Gap(1f);
}
}
}

View File

@ -7,8 +7,7 @@ namespace RJWSexperience
{
public class SexperienceMod : Mod
{
private static Configurations settings;
public static Configurations Settings { get => settings; }
public static Configurations Settings { get; private set; }
public ITab CurrentTab { get; private set; }
@ -16,8 +15,7 @@ namespace RJWSexperience
public SexperienceMod(ModContentPack content) : base(content)
{
settings = GetSettings<Configurations>();
CurrentTab = settings;
Settings = GetSettings<Configurations>();
tabRecords = new List<TabRecord>();
}
@ -34,13 +32,15 @@ namespace RJWSexperience
{
List<ITab> tabs = new List<ITab>
{
settings,
settings.History,
settings.Debug
new SettingsTabMain(Settings),
new SettingsTabHistory(Settings),
new SettingsTabDebug(Settings),
};
foreach (ITab tab in tabs)
tabRecords.Add(new TabRecord(tab.Label, delegate { this.CurrentTab = tab; }, delegate { return this?.CurrentTab == tab; }));
CurrentTab = tabs[0];
}
public override void DoSettingsWindowContents(Rect inRect)

View File

@ -24,7 +24,7 @@ namespace RJWSexperience
val *= GetLustFactor(pawn);
}
protected float GetLustFactor(Pawn pawn) => LustUtility.GetLustFactor(pawn.records.GetValue(VariousDefOf.Lust));
protected float GetLustFactor(Pawn pawn) => LustUtility.GetLustFactor(pawn.records.GetValue(RsDefOf.Record.Lust));
}
/// <summary>

View File

@ -5,11 +5,51 @@ using Verse;
namespace RJWSexperience
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public class ThoughtDefExtension_StageFromRecord : DefModExtension
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
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 int GetStageIndex(Pawn pawn)
{
float value = pawn?.records?.GetValue(recordDef) ?? 0f;
for (int i = minimumValueforStage.Count - 1; i > 0; i--)
{
if (minimumValueforStage[i] < value)
{
return i;
}
}
return 0;
}
public override IEnumerable<string> ConfigErrors()
{
foreach (string error in base.ConfigErrors())
{
yield return error;
}
if (recordDef == null)
{
yield return "<recordDef> is null";
}
if (minimumValueforStage.NullOrEmpty())
{
yield return "<minimumValueforStage> should have an entry for every stage";
}
for (int i = 0; i < minimumValueforStage.Count - 1; i++)
{
if (minimumValueforStage[i] > minimumValueforStage[i + 1])
{
yield return "Values in <minimumValueforStage> should be ordered from the lowest to the highest";
}
}
}
}
}

View File

@ -1,39 +1,28 @@
using RimWorld;
using System.Collections.Generic;
using Verse;
namespace RJWSexperience
{
/// <summary>
/// Thought class using record.
/// Thought class that uses record to select active stage
/// </summary>
public class Thought_Recordbased : Thought_Memory
{
private ThoughtDefExtension_StageFromRecord extension;
protected ThoughtDefExtension_StageFromRecord Extension => extension ?? (extension = def.GetModExtension<ThoughtDefExtension_StageFromRecord>());
protected ThoughtDefExtension_StageFromRecord Extension
/// <summary>
/// This method is called for every thought right after the pawn is assigned
/// </summary>
public override bool TryMergeWithExistingMemory(out bool showBubble)
{
get
{
if (extension == null)
extension = def.GetModExtension<ThoughtDefExtension_StageFromRecord>();
return extension;
}
UpdateCurStage();
return base.TryMergeWithExistingMemory(out showBubble);
}
protected RecordDef RecordDef => Extension.recordDef;
protected List<float> MinimumValueforStage => Extension.minimumValueforStage;
public override int CurStageIndex
protected virtual void UpdateCurStage()
{
get
{
float value = pawn?.records?.GetValue(RecordDef) ?? 0f;
for (int i = MinimumValueforStage.Count - 1; i > 0; i--)
{
if (MinimumValueforStage[i] < value) return i;
}
return 0;
}
SetForcedStage(Extension.GetStageIndex(pawn));
}
}
}

View File

@ -1,37 +0,0 @@
using RimWorld;
using Verse;
namespace RJWSexperience
{
[DefOf]
public static class VariousDefOf
{
public static readonly RecordDef NumofEatenCum;
public static readonly RecordDef AmountofEatenCum;
public static readonly RecordDef Lust;
public static readonly RecordDef VaginalSexCount;
public static readonly RecordDef AnalSexCount;
public static readonly RecordDef OralSexCount;
public static readonly RecordDef BlowjobCount;
public static readonly RecordDef CunnilingusCount;
public static readonly RecordDef GenitalCaressCount;
public static readonly RecordDef HandjobCount;
public static readonly RecordDef FingeringCount;
public static readonly RecordDef FootjobCount;
public static readonly RecordDef MiscSexualBehaviorCount;
public static readonly RecordDef SexPartnerCount;
public static readonly RecordDef OrgasmCount;
public static readonly SkillDef Sex;
public static readonly ThingDef CumBucket;
public static readonly ThingDef GatheredCum;
public static readonly ThingDef FilthCum;
public static readonly ChemicalDef Cum;
public static readonly NeedDef Chemical_Cum;
public static readonly TraitDef Virgin;
public static readonly KeyBindingDef OpenSexStatistics;
public static readonly StatDef SexAbility;
public static readonly HediffDef CumAddiction;
public static readonly HediffDef CumTolerance;
}
}

View File

@ -26,14 +26,10 @@ namespace RJWSexperience.Virginity
if (billDoer == null)
return;
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[]
{
billDoer,
pawn
});
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn);
TraitHandler.AddVirginTrait(pawn);
}
private static bool HasHymen(Pawn pawn) => pawn.story?.traits?.GetTrait(VariousDefOf.Virgin)?.Degree > 0;
private static bool HasHymen(Pawn pawn) => pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin)?.Degree > 0;
}
}

View File

@ -1,5 +1,4 @@
using RimWorld;
using rjw;
using Verse;
namespace RJWSexperience.Virginity
@ -17,7 +16,7 @@ namespace RJWSexperience.Virginity
{
if (Rand.Chance(hymenSurgeryChance))
{
Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true);
pawn.story.traits.GainTrait(virgin);
}
return;
@ -36,24 +35,28 @@ namespace RJWSexperience.Virginity
int degree = TraitDegree.MaleVirgin;
if (pawn.gender == Gender.Female)
degree = TraitDegree.FemaleVirgin;
Trait virgin = new Trait(VariousDefOf.Virgin, degree, true);
Trait virgin = new Trait(RsDefOf.Trait.Virgin, degree, true);
pawn.story.traits.GainTrait(virgin);
}
else if (pawn.gender == Gender.Female)
{
Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true);
pawn.story.traits.GainTrait(virgin);
}
}
/// <summary>
/// Remove virginity trait and spawn blood filth if applicable
/// </summary>
/// <returns>Degree of the removed trait</returns>
public static int? RemoveVirginTrait(Pawn pawn)
{
Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
Trait virgin = pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin);
if (virgin == null)
return null;
int degree = virgin.Degree;
if (pawn.gender == Gender.Female && degree > 0 && !pawn.Dead)
if (pawn.gender == Gender.Female && degree > 0 && pawn.Spawned && !pawn.Dead)
{
FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelShort, 1, FilthSourceFlags.Pawn);
}

View File

@ -0,0 +1,27 @@
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);
}
}
}

View File

@ -1,55 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net472</TargetFramework>
<RootNamespace>RJWSexperienceCum</RootNamespace>
<AssemblyName>RJWSexperienceCum</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Mod Compatibility\RJW Cum\Assemblies\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Company>amevarashi</Company>
<Optimize>True</Optimize>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Compile Include="JobDefOf.cs" />
<Compile Include="ThingDefOf.cs" />
<Compile Include="JobDriver_CleanSelfWithBucket.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="HediffDefOf.cs" />
<Compile Include="WorkGiver_CleanSelfWithBucket.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.4.3524</Version>
<Version>1.4.*</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="RJW">
<HintPath>..\..\..\rjw\1.4\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RJWSexperience\RJWSexperience.csproj">
<Project>{9c728e06-573b-4b04-a07f-acbf60cb424d}</Project>
@ -57,5 +31,4 @@
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,3 +1,16 @@
Version 1.1.4.0
- Optimized SexStatusWindow
- Optimized Ate Cum thought
- Optimized? cum food filter
- Simplified virginity checks code
- Simplified bucket selection code
Version 1.1.3.0
- Removed "Hide Sex History button with RJW designators" setting
- Fixed error with pawn masturbated on the map border
- Fixed counting self as a sex partner
- Fixed patch on FindSexLocation returning location in walls
Version 1.1.2.1
- Fixed 1.3 assembly