Skip to content

Commit

Permalink
[Preg][KK/S] Add setting to always hide/show status indicators
Browse files Browse the repository at this point in the history
Closes #48
  • Loading branch information
ManlyMarco committed May 3, 2023
1 parent b07420c commit 9e69262
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 18 deletions.
47 changes: 34 additions & 13 deletions src/Core_Pregnancy_KK/Data/PregnancyDataUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,7 @@ public static HeroineStatus GetCharaStatus(this SaveData.CharaData chara, Pregna
{
if (pregData == null) pregData = heroine.GetPregnancyData();

// Check if she wants to tell //todo need to ask in talk scene
#if KK
if (heroine.intimacy >= 80 ||
heroine.hCount >= 5 ||
heroine.parameter.attribute.bitch && heroine.favor > 50 ||
(heroine.isGirlfriend || heroine.favor >= 90) &&
(!heroine.isVirgin || heroine.hCount >= 2 || heroine.intimacy >= 40))
#else
if (heroine.relation >= 3 ||
heroine.hCount >= 5 ||
heroine.parameter.attribute.bitch && heroine.favor > 50 ||
heroine.isGirlfriend && (heroine.favor >= 90 || heroine.hCount >= 2))
#endif
if (CanShowStatus(heroine))
{
var pregnancyWeek = pregData.Week;
if (pregnancyWeek > 0)
Expand Down Expand Up @@ -103,6 +91,39 @@ public static HeroineStatus GetCharaStatus(this SaveData.CharaData chara, Pregna
return HeroineStatus.Unknown;
}

private static bool CanShowStatus(SaveData.Heroine heroine)
{
// todo add option to ask in talk scene?
switch (PregnancyPlugin.StatusDisplay.Value)
{
case PregnancyPlugin.StatusDisplayCondition.Always:
return true;
case PregnancyPlugin.StatusDisplayCondition.Normal:
#if KK
return heroine.intimacy >= 80 ||
heroine.hCount >= 5 ||
heroine.parameter.attribute.bitch && heroine.favor > 50 ||
(heroine.isGirlfriend || heroine.favor >= 90) &&
(!heroine.isVirgin || heroine.hCount >= 2 || heroine.intimacy >= 40);
#else
return heroine.relation >= 3 ||
heroine.hCount >= 5 ||
heroine.parameter.attribute.bitch && heroine.favor > 50 ||
heroine.isGirlfriend && (!heroine.isVirgin || heroine.hCount >= 2 || heroine.favor >= 120);
#endif
case PregnancyPlugin.StatusDisplayCondition.OnlyGirlfriend:
#if KK
return heroine.isGirlfriend && (!heroine.isVirgin || heroine.hCount >= 2 || heroine.intimacy >= 40);
#else
return heroine.isGirlfriend && (!heroine.isVirgin || heroine.hCount >= 2 || heroine.favor >= 120);
#endif
case PregnancyPlugin.StatusDisplayCondition.Never:
return false;
default:
throw new ArgumentOutOfRangeException();
}
}

internal static IEnumerable<ChaFileControl> GetRelatedChaFiles(this SaveData.CharaData character)
{
var chafiles =
Expand Down
17 changes: 16 additions & 1 deletion src/Core_Pregnancy_KK/PregnancyPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ namespace KK_Pregnancy
public partial class PregnancyPlugin : BaseUnityPlugin
{
public const string GUID = "KK_Pregnancy";
public const string Version = "2.7.1";
public const string Version = "2.8.0";

public static ConfigEntry<bool> ConceptionEnabled { get; private set; }
public static ConfigEntry<float> FertilityOverride { get; private set; }
public static ConfigEntry<bool> AnalConceptionEnabled { get; private set; }
public static ConfigEntry<bool> ShowPregnancyIconEarly { get; private set; }
public static ConfigEntry<StatusDisplayCondition> StatusDisplay { get; private set; }
public static ConfigEntry<int> PregnancyProgressionSpeed { get; private set; }
public static ConfigEntry<bool> HSceneMenstrIconOverride { get; private set; }

Expand Down Expand Up @@ -70,6 +71,12 @@ private void Start()
"By default pregnancy status icon in class roster is shown after a few days or weeks (the character had a chance to do the test or noticed something is wrong).\n" +
"Turning this on will always make the icon show up at the end of the current day.");

StatusDisplay = Config.Bind("General", "When to reveal Risky/Safe/Pregnant status", StatusDisplayCondition.Normal,
"Always: You can immediately see the status of all characters.\n" +
"Normal: You can only see status of characters you are reasonably close with.\n" +
"Only Girlfriend: You can only see status of your girlfriends (other requirements might also apply).\n" +
"Never: The status is always shown as Unknown.");

HSceneMenstrIconOverride = Config.Bind("General", "Use custom safe/risky icons in H Scenes", true,
"Replaces the standard safe/risky indicators with custom indicators that can also show pregnancy and unknown status. " +
"If the status is unknown you will have to listen for the voice cues instead.\nChanges take effect after game restart.");
Expand Down Expand Up @@ -136,5 +143,13 @@ internal static PregnancyCharaController GetEffectController(SaveData.Heroine he
{
return heroine?.chaCtrl != null ? heroine.chaCtrl.GetComponent<PregnancyCharaController>() : null;
}

public enum StatusDisplayCondition
{
Always,
Normal,
OnlyGirlfriend,
Never
}
}
}
16 changes: 14 additions & 2 deletions src/KKS_Pregnancy/GUI/PregnancyGui.StatusIcons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,21 @@ private static void OnGUI()
switch (status)
{
case HeroineStatus.Unknown:
GUILayout.Label("This character didn't tell you their risky day schedule yet.");
GUILayout.Label("This character didn't tell you their risky day schedule.");
GUILayout.FlexibleSpace();
GUILayout.Label("Become closer to learn it!");
switch (PregnancyPlugin.StatusDisplay.Value)
{
default:
case PregnancyPlugin.StatusDisplayCondition.Normal:
GUILayout.Label("Become closer to learn it!");
break;
case PregnancyPlugin.StatusDisplayCondition.OnlyGirlfriend:
GUILayout.Label("Become close lovers to learn it!");
break;
case PregnancyPlugin.StatusDisplayCondition.Never:
GUILayout.Label("All schedules are forced to be hidden by the \"When to reveal status\" setting.");
break;
}
break;

case HeroineStatus.OnLeave:
Expand Down
16 changes: 14 additions & 2 deletions src/KK_Pregnancy/GUI/PregnancyGui.StatusIcons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,21 @@ private void OnGUI()
switch (status)
{
case HeroineStatus.Unknown:
GUILayout.Label("This character didn't tell you their risky day schedule yet.");
GUILayout.Label("This character didn't tell you their risky day schedule.");
GUILayout.FlexibleSpace();
GUILayout.Label("Become closer to learn it!");
switch (PregnancyPlugin.StatusDisplay.Value)
{
default:
case PregnancyPlugin.StatusDisplayCondition.Normal:
GUILayout.Label("Become closer to learn it!");
break;
case PregnancyPlugin.StatusDisplayCondition.OnlyGirlfriend:
GUILayout.Label("Become close lovers to learn it!");
break;
case PregnancyPlugin.StatusDisplayCondition.Never:
GUILayout.Label("All schedules are forced to be hidden by the \"When to reveal status\" setting.");
break;
}
break;

case HeroineStatus.OnLeave:
Expand Down

0 comments on commit 9e69262

Please sign in to comment.