aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/Commands.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-03 19:28:35 -0400
committerMichael <[email protected]>2017-04-03 19:28:35 -0400
commit9566b4b062ad0f10832584c65457ef6505b097ab (patch)
tree20a11842ea6e71b26941624af7f50f4ed29cdf19 /ShiftOS_TheReturn/Commands.cs
parentf43f6fe17d054f83c686b552201d6b4bfc83524d (diff)
downloadshiftos_thereturn-9566b4b062ad0f10832584c65457ef6505b097ab.tar.gz
shiftos_thereturn-9566b4b062ad0f10832584c65457ef6505b097ab.tar.bz2
shiftos_thereturn-9566b4b062ad0f10832584c65457ef6505b097ab.zip
Categorize the Shiftorium
Diffstat (limited to 'ShiftOS_TheReturn/Commands.cs')
-rw-r--r--ShiftOS_TheReturn/Commands.cs57
1 files changed, 54 insertions, 3 deletions
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs
index 73a7e2d..9f85a25 100644
--- a/ShiftOS_TheReturn/Commands.cs
+++ b/ShiftOS_TheReturn/Commands.cs
@@ -535,7 +535,7 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
{
Console.WriteLine($@"Information for {upgrade}:
-{upg.Name} - {upg.Cost} Codepoints
+{upg.Category}: {upg.Name} - {upg.Cost} Codepoints
------------------------------------------------------
{upg.Description}
@@ -553,15 +553,66 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}");
return false;
}
}
+
+ [Command("categories")]
+ public static bool ListCategories()
+ {
+ foreach(var cat in Shiftorium.GetCategories())
+ {
+ Console.WriteLine($"{cat} - {Shiftorium.GetAvailable().Where(x=>x.Category==cat).Count()} upgrades");
+ }
+ return true;
+ }
+
[Command("list")]
- public static bool ListAll()
+ public static bool ListAll(Dictionary<string, object> args)
{
try
{
+ bool showOnlyInCategory = false;
+
+ string cat = "Other";
+
+ if (args.ContainsKey("cat"))
+ {
+ showOnlyInCategory = true;
+ cat = args["cat"].ToString();
+ }
+
Dictionary<string, int> upgrades = new Dictionary<string, int>();
int maxLength = 5;
- foreach (var upg in Shiftorium.GetAvailable())
+ IEnumerable<ShiftoriumUpgrade> upglist = Shiftorium.GetAvailable();
+ if (showOnlyInCategory)
+ {
+ if (Shiftorium.IsCategoryEmptied(cat))
+ {
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine("Shiftorium Query Error");
+ Console.WriteLine();
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.Gray;
+ Console.WriteLine("Either there are no upgrades in the category \"" + cat + "\" or the category was not found.");
+ return true;
+ }
+ upglist = Shiftorium.GetAvailable().Where(x => x.Category == cat);
+ }
+
+
+ if(upglist.Count() == 0)
+ {
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine("No upgrades available!");
+ Console.WriteLine();
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.Gray;
+ Console.WriteLine("You have installed all available upgrades for your system. Please check back later for more.");
+ return true;
+
+ }
+ foreach (var upg in upglist)
{
if (upg.ID.Length > maxLength)
{