From d51bda2fc57ab24a9041d87f7103483ff38f5e07 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 1 Aug 2017 12:22:15 -0400 Subject: finish tutorials and add mission cmds --- ShiftOS.Frontend/Commands.cs | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'ShiftOS.Frontend/Commands.cs') diff --git a/ShiftOS.Frontend/Commands.cs b/ShiftOS.Frontend/Commands.cs index da1d1c1..5172d29 100644 --- a/ShiftOS.Frontend/Commands.cs +++ b/ShiftOS.Frontend/Commands.cs @@ -44,6 +44,73 @@ using ShiftOS.Engine; namespace ShiftOS.Frontend { + public static class MissionsCommands + { + [Command("startmission")] + [RequiresArgument("id")] + [RequiresUpgrade("tutorial1")] + public static void StartMission(Dictionary args) + { + string id = args["id"].ToString(); + try + { + if (!Shiftorium.UpgradeInstalled(id)) + { + Story.Start(id); + return; + } + Console.WriteLine("That mission has already been complete. You can't replay it."); + } + catch + { + Console.WriteLine("That mission could not be found. Try running missions for a list of available missions."); + } + } + + [Command("missions")] + [RequiresUpgrade("tutorial1")] + public static void Missions() + { + Console.WriteLine("Available missions"); + Console.WriteLine("==================="); + Console.WriteLine(); + bool found = false; + foreach (var type in ReflectMan.Types) + { + foreach(var mth in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) + { + var missionattrib = mth.GetCustomAttributes(false).FirstOrDefault(x => x is MissionAttribute) as MissionAttribute; + if(missionattrib != null) + { + found = true; + Console.WriteLine(); + Console.WriteLine($@"{missionattrib.Name} (id {missionattrib.StoryID}) +------------------------------------ + +assigner: {missionattrib.Assigner} +cp reward: {missionattrib.CodepointAward} + +{missionattrib.Description}"); + } + } + } + if(found == false) + { + Console.WriteLine(); + Console.WriteLine(@"No missions found. +------------------------------------ + +assigner: undefined +cp reward: [object Object] + +There are no missions available for you to complete. Please check back later for more!"); + + } + } + } + + + [TutorialLock] public static class TerminalCommands { -- cgit v1.2.3