aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/MissionCommands.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-06-25 13:43:14 -0400
committerMichael <[email protected]>2017-06-25 13:43:14 -0400
commit8e19c8599975685410d7508b150f811dc3991f4a (patch)
tree83dcf614806a32651221f6c7426d60fa8dc0332c /ShiftOS.WinForms/MissionCommands.cs
parent4c63e5e41c55d41c0bcaa09f125299d4b1892ef6 (diff)
downloadshiftos_thereturn-8e19c8599975685410d7508b150f811dc3991f4a.tar.gz
shiftos_thereturn-8e19c8599975685410d7508b150f811dc3991f4a.tar.bz2
shiftos_thereturn-8e19c8599975685410d7508b150f811dc3991f4a.zip
another mission
Diffstat (limited to 'ShiftOS.WinForms/MissionCommands.cs')
-rw-r--r--ShiftOS.WinForms/MissionCommands.cs37
1 files changed, 35 insertions, 2 deletions
diff --git a/ShiftOS.WinForms/MissionCommands.cs b/ShiftOS.WinForms/MissionCommands.cs
index 375c490..d295392 100644
--- a/ShiftOS.WinForms/MissionCommands.cs
+++ b/ShiftOS.WinForms/MissionCommands.cs
@@ -20,9 +20,12 @@ namespace ShiftOS.WinForms
var attrib = method.GetCustomAttributes(false).FirstOrDefault(x => x is MissionAttribute) as MissionAttribute;
if (attrib != null)
{
- if (!Shiftorium.UpgradeInstalled(attrib.StoryID))
+ if (Shiftorium.UpgradeAttributesUnlocked(method))
{
- missions.Add(attrib);
+ if (!Shiftorium.UpgradeInstalled(attrib.StoryID))
+ {
+ missions.Add(attrib);
+ }
}
}
}
@@ -62,6 +65,36 @@ namespace ShiftOS.WinForms
Console.WriteLine("startmission --id " + missions.IndexOf(mission));
}
}
+
+ Console.WriteLine();
+
+ Console.WriteLine("Story progress:");
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.Cyan;
+ double percentage = GetMissionPercentage() * 100;
+ Console.WriteLine(percentage.ToString("#.##") + "%");
+ }
+
+ public static double GetMissionPercentage()
+ {
+ int missionsFound = 0;
+ int missionsComplete = 0;
+ foreach(var type in ReflectMan.Types)
+ {
+ foreach (var mth in type.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
+ {
+ var missionAttrib = mth.GetCustomAttributes(false).FirstOrDefault(x => x is MissionAttribute) as MissionAttribute;
+ if (missionAttrib != null)
+ {
+ missionsFound++;
+ if (Shiftorium.UpgradeInstalled(missionAttrib.StoryID))
+ missionsComplete++;
+ }
+
+ }
+ }
+ double percentage = (double)missionsComplete / (double)missionsFound;
+ return percentage;
}
[Command("startmission", description = "Starts the specified mission.")]