Skip to content

Commit

Permalink
Showing 2 changed files with 39 additions and 26 deletions.
Binary file modified GameData/RP-0/Plugins/RP0.dll
Binary file not shown.
65 changes: 39 additions & 26 deletions Source/Crew/CrewHandler.cs
Original file line number Diff line number Diff line change
@@ -653,40 +653,53 @@ protected void FixTooltip(KSP.UI.CrewListItem cli)
ttc.descriptionString += "\n\nRetires no earlier than " + KSPUtil.PrintDate(retTime, false);

// Training
HashSet<string> expiredProfs = new HashSet<string>();
bool found = false;
string trainingStr = "\n\nTraining:";
int lastFlight = pcm.flightLog.Last() == null ? 0 : pcm.flightLog.Last().flight;
foreach (FlightLog.Entry ent in pcm.flightLog.Entries)

string trainingStr = GetTrainingString(pcm);
if (!string.IsNullOrEmpty(trainingStr))
ttc.descriptionString += trainingStr;
}
}

protected string GetTrainingString(ProtoCrewMember pcm)
{
HashSet<string> expiredProfs = new HashSet<string>();
bool found = false;
string trainingStr = "\n\nTraining:";
int lastFlight = pcm.flightLog.Last() == null ? 0 : pcm.flightLog.Last().flight;
foreach (FlightLog.Entry ent in pcm.flightLog.Entries)
{
string pretty = GetPrettyCourseName(ent.type);
if (!string.IsNullOrEmpty(pretty))
{
string pretty = GetPrettyCourseName(ent.type);
if (!string.IsNullOrEmpty(pretty))
if (ent.type == "expired_TRAINING_proficiency")
{
found = true;
expiredProfs.Add(ent.target);
}
else
{
if (ent.type == "TRAINING_mission" && ent.flight != lastFlight)
continue;

if (ent.type == "expired_TRAINING_proficiency")
expiredProfs.Add(ent.target);
else
{
if (ent.type == "TRAINING_mission" && ent.flight != lastFlight)
continue;

trainingStr += "\n " + pretty + ent.target;
double exp = GetExpiration(pcm.name, ent);
if (exp > 0d)
trainingStr += ". Expires " + KSPUtil.PrintDate(exp, false);
}
found = true;
trainingStr += "\n " + pretty + ent.target;
double exp = GetExpiration(pcm.name, ent);
if (exp > 0d)
trainingStr += ". Expires " + KSPUtil.PrintDate(exp, false);
}
}
if (expiredProfs.Count > 0)
trainingStr += "\n Expired proficiencies:";
foreach (string s in expiredProfs)
trainingStr += "\n " + s;

if (found)
ttc.descriptionString += trainingStr;
}
if (expiredProfs.Count > 0)
trainingStr += "\n Expired proficiencies:";
foreach (string s in expiredProfs)
trainingStr += "\n " + s;

if (found)
return trainingStr;
else
return string.Empty;
}

protected double GetExpiration(string pcmName, FlightLog.Entry ent)
{
for (int i = expireTimes.Count; i-- > 0;)

0 comments on commit f5cc8c5

Please sign in to comment.