Compare commits

...

2 commits

Author SHA1 Message Date
amevarashi
5dcca34ee7 1.1.1.1 2022-10-09 14:26:31 +05:00
amevarashi
85dcfd538c Fix history window crashing from a modded passion 2022-10-09 14:16:22 +05:00
5 changed files with 35 additions and 10 deletions

View file

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

Binary file not shown.

View file

@ -1,4 +1,6 @@
using UnityEngine;
using RimWorld;
using System;
using UnityEngine;
using Verse;
namespace RJWSexperience.SexHistory
@ -47,11 +49,31 @@ namespace RJWSexperience.SexHistory
Texture2D.linearGrayTexture //? = 20
};
public static readonly Texture2D[] PassionBG = new Texture2D[]
private static readonly Texture2D[] PassionBG = new Texture2D[]
{
Texture2D.blackTexture, //None = 0,
SolidColorMaterials.NewSolidColorTexture(0.800f, 0.800f, 0.800f, 1.0f), //Minor = 1,
SolidColorMaterials.NewSolidColorTexture(1.000f, 0.875f, 0.000f, 1.0f) //Major = 2,
SolidColorMaterials.NewSolidColorTexture(0.800f, 0.800f, 0.800f, 1.0f), //Minor = 1, Gray
SolidColorMaterials.NewSolidColorTexture(1.000f, 0.875f, 0.000f, 1.0f), //Major = 2, Golden
Texture2D.blackTexture, // VSE Apathy = 3
SolidColorMaterials.NewSolidColorTexture(0.500f, 0.875f, 0.000f, 1.0f), //VSE Natural = 4, Light Green
SolidColorMaterials.NewSolidColorTexture(1.000f, 0.375f, 0.000f, 1.0f), //VSE Critical = 5, Reddish
};
public static Texture2D GetPassionBG(Passion? passion)
{
int passionIndex = (int)(passion ?? 0);
// Vanilla Skills Expanded adds new passion levels
if (passionIndex < 0)
{
passionIndex = 0;
}
else if (passionIndex >= PassionBG.Length)
{
passionIndex = 0;
}
return PassionBG[passionIndex];
}
}
}

View file

@ -408,7 +408,7 @@ namespace RJWSexperience.SexHistory.UI
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.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_drive_stat)));
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))
{
@ -458,12 +458,12 @@ namespace RJWSexperience.SexHistory.UI
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.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
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.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
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))
@ -473,7 +473,7 @@ namespace RJWSexperience.SexHistory.UI
p = pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_satisfaction);
tmp = listmain.GetRect(FONTHEIGHT);
FillableBarLabeled(tmp, String.Format(xxx.sex_satisfaction.LabelCap.CapitalizeFirst() + ": {0:P2}", p), p / 2, HistoryUtility.Satisfaction, Texture2D.blackTexture);
FillableBarLabeled(tmp, String.Format(xxx.sex_satisfaction.LabelCap + ": {0:P2}", p), p / 2, HistoryUtility.Satisfaction, Texture2D.blackTexture);
listmain.Gap(1f);
if (Mouse.IsOver(tmp))
{
@ -483,7 +483,7 @@ namespace RJWSexperience.SexHistory.UI
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.CapitalizeFirst()}: {pawn.GetSexStat():P2}", HistoryUtility.PassionBG[(int)(skill?.passion ?? 0)]);
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()));

View file

@ -1,3 +1,6 @@
Version 1.1.1.1
- Fix sex history window crashing for a pawns with a modded passion
Version 1.1.1.0
- Fix def error when loading game without RJW Cum mod