diff options
| author | Michael <[email protected]> | 2017-06-24 20:26:14 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-06-24 20:26:14 -0400 |
| commit | 4c63e5e41c55d41c0bcaa09f125299d4b1892ef6 (patch) | |
| tree | bf5da5cf46136de99b79fb2cd0f43283a711a62d /ShiftOS.WinForms | |
| parent | 4c7703c535eacb58375c872ea5cf9e733c9cf5d5 (diff) | |
| download | shiftos_thereturn-4c63e5e41c55d41c0bcaa09f125299d4b1892ef6.tar.gz shiftos_thereturn-4c63e5e41c55d41c0bcaa09f125299d4b1892ef6.tar.bz2 shiftos_thereturn-4c63e5e41c55d41c0bcaa09f125299d4b1892ef6.zip | |
mission commands
Diffstat (limited to 'ShiftOS.WinForms')
| -rw-r--r-- | ShiftOS.WinForms/MissionCommands.cs | 83 | ||||
| -rw-r--r-- | ShiftOS.WinForms/ShiftOS.WinForms.csproj | 2 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Stories/LegionStory.cs | 11 |
3 files changed, 94 insertions, 2 deletions
diff --git a/ShiftOS.WinForms/MissionCommands.cs b/ShiftOS.WinForms/MissionCommands.cs new file mode 100644 index 0000000..375c490 --- /dev/null +++ b/ShiftOS.WinForms/MissionCommands.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms +{ + [RequiresUpgrade("hacker101_breakingbonds_3")] + public static class MissionCommands + { + public static List<MissionAttribute> GetMissionsList() + { + var missions = new List<MissionAttribute>(); + foreach (var type in ReflectMan.Types) + { + foreach (var method in type.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) + { + var attrib = method.GetCustomAttributes(false).FirstOrDefault(x => x is MissionAttribute) as MissionAttribute; + if (attrib != null) + { + if (!Shiftorium.UpgradeInstalled(attrib.StoryID)) + { + missions.Add(attrib); + } + } + } + } + return missions; + } + + [Command("missions", description = "Lists all available missions.")] + public static void ShowAll() + { + ConsoleEx.ForegroundColor = ConsoleColor.Yellow; + ConsoleEx.Bold = true; + Console.WriteLine(" - Missions - "); + + var missions = GetMissionsList(); + + ConsoleEx.ForegroundColor = ConsoleColor.White; + ConsoleEx.Bold = false; + if(missions.Count == 0) + { + Console.WriteLine("No missions available. Check back later!"); + } + else + { + foreach(var mission in missions) + { + Console.WriteLine(); + Console.WriteLine(mission.Name); + Console.WriteLine("--------------------------"); + Console.WriteLine(); + Console.WriteLine(mission.Description); + Console.WriteLine(); + Console.WriteLine("assigner: " + mission.Assigner); + Console.WriteLine("reward: " + mission.CodepointAward + " Codepoints"); + Console.WriteLine("To start this mission, run:"); + ConsoleEx.Bold = true; + Console.WriteLine("startmission --id " + missions.IndexOf(mission)); + } + } + } + + [Command("startmission", description = "Starts the specified mission.")] + [RequiresArgument("id")] + public static void StartMission(Dictionary<string, object> args) + { + var id = Convert.ToInt32(args["id"].ToString()); + var missions = GetMissionsList(); + if (id < 0 || id >= missions.Count) + Console.WriteLine("Error: Mission ID not found."); + else + { + var mission = missions[id]; + Story.Start(mission.StoryID); + } + } + + } +} diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index a83bed1..570d049 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -357,7 +357,7 @@ <Compile Include="MainMenu\MainMenu.Designer.cs"> <DependentUpon>MainMenu.cs</DependentUpon> </Compile> - <Compile Include="MissionAttribute.cs" /> + <Compile Include="MissionCommands.cs" /> <Compile Include="Oobe.cs"> <SubType>Form</SubType> </Compile> diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 74e6ea6..a91b0b1 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -81,7 +81,7 @@ namespace ShiftOS.WinForms.Stories Story.Start("aiden_shiftnet2"); } - [Story("hacker101_breakingbonds_3")] + [Mission("hacker101_breakingbonds_3", "Breaking the Bonds", "It's time you've learned how to hack.", 500l, "hacker101")] public static void BreakingTheBonds_Outro() { Story.Context.AutoComplete = false; @@ -172,7 +172,16 @@ namespace ShiftOS.WinForms.Stories WriteLine("Oh yeah, one more thing... that virus scanner... you may want to scan any files that you transfer from other systems with it."); WriteLine("You never know what sorts of digital filth is hidden within such innocent-looking files."); WriteLine("ALWAYS scan before opening - because if you open a file containing malicious code, it'll get run. It's just how ShiftOS's kernel works."); + WriteLine("Oh yeah, one last thing. Things are going to start getting pretty open in the Digital Society.."); + WriteLine("Multiple people are going to want you to help them out with multiple things."); + WriteLine("I've written a little command-line utility that'll help you keep track of these missions and see how far you've gotten."); + WriteLine("Use the missions command to list out all the available missions, then use the startmission command to start one."); + WriteLine("When you complete a mission, you'll earn Codepoints depending on the mission."); + WriteLine("Allow me to demonstrate..."); Console.WriteLine("User has disconnected."); + + + Story.Context.MarkComplete(); TerminalBackend.PrefixEnabled = true; SaveSystem.SaveGame(); |
