From d51bda2fc57ab24a9041d87f7103483ff38f5e07 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 1 Aug 2017 12:22:15 -0400 Subject: [PATCH] finish tutorials and add mission cmds --- ShiftOS.Frontend/Commands.cs | 67 ++++++++++++++++++++++ ShiftOS.Frontend/Stories/BeginTutorials.cs | 59 ++++++++++++++++++- ShiftOS_TheReturn/Story.cs | 7 --- 3 files changed, 125 insertions(+), 8 deletions(-) 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 { diff --git a/ShiftOS.Frontend/Stories/BeginTutorials.cs b/ShiftOS.Frontend/Stories/BeginTutorials.cs index 2356a1d..6cb4a08 100644 --- a/ShiftOS.Frontend/Stories/BeginTutorials.cs +++ b/ShiftOS.Frontend/Stories/BeginTutorials.cs @@ -41,8 +41,13 @@ namespace ShiftOS.Frontend.Stories if(text == "help") { position++; + } break; + case 2: + if (text == "status") + position++; + break; } }; TerminalBackend.CommandFinished += commandListener; @@ -77,10 +82,62 @@ namespace ShiftOS.Frontend.Stories TerminalBackend.PrintPrompt(); while (position == 1) Thread.Sleep(10); - + TerminalBackend.PrefixEnabled = false; + Thread.Sleep(1000); ctl.WriteLine(""); ctl.WriteLine("Any time you are unsure of a command to run, type the help command."); ctl.WriteLine("Now, try typing the \"status\" command to see your current system status."); + + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + while (position == 2) + Thread.Sleep(10); + Thread.Sleep(1000); + ctl.WriteLine(""); + ctl.WriteLine(""); + TerminalBackend.PrefixEnabled = false; + TerminalBackend.InStory = true; + ctl.WriteLine("As you can see, your system doesn't have much value within the Digital Society."); + Thread.Sleep(1000); + ctl.WriteLine($"You have {SaveSystem.CurrentSave.Codepoints} Codepoints - and {SaveSystem.CurrentSave.CountUpgrades()} system upgrades."); + ctl.WriteLine(""); + ctl.WriteLine(""); + Thread.Sleep(500); + ctl.WriteLine("Codepoints can be earned by completing objectives within ShiftOS or by playing minigames."); + Thread.Sleep(250); + ctl.WriteLine("When you have Codepoints, you can use them to buy system upgrades from the Shiftorium, to add new programs and enhancements to ShiftOS."); + Thread.Sleep(200); + ctl.WriteLine("Tasks that can give you Codepoints can be found using the missions command."); + Thread.Sleep(200); + ctl.WriteLine("You can start a mission using the startmission command, and specifying the mission ID as a command-line argument."); + Thread.Sleep(750); + ctl.WriteLine(" Careful. The user doesn't know how arguments work in ShiftOS."); + Thread.Sleep(490); + ctl.WriteLine("That reminds me... Command-line arguments are pretty easy in ShiftOS."); + Thread.Sleep(200); + ctl.WriteLine("Most commands don't require arguments at all, like \"help\", \"status\" and \"missions\". However, others like \"buy\" and \"close\" will."); + Thread.Sleep(200); + ctl.WriteLine("Most commands that require arguments will take the implicit syntax, i.e \"open pong\"."); + Thread.Sleep(200); + ctl.WriteLine("Others will require the explicit syntax, for example \"fileskimmer --dir 0:/home\"."); + Thread.Sleep(200); + ctl.WriteLine("And others will accept both, for example \"inject ftpwn --port 21\"."); + Thread.Sleep(200); + ctl.WriteLine("When you run a command and you have forgotten to supply its arguments, the Shell will tell you which arguments you are missing."); + Thread.Sleep(200); + ctl.WriteLine("If the Shell says you are missing an \"id\" argument, you can pass it using either the implicit syntax, i.e \"command value\", or the explicit syntax, i.e \"command --id value\". Both will be accepted by the command interpreter."); + Thread.Sleep(200); + ctl.WriteLine("However, for other arguments, the explicit syntax is required - the command interpreter won't be able to tell what argument you're supplying data to if you use the implicit syntax, and thus it will assume you are supplying data for the \"id\" argument."); + Thread.Sleep(1000); + ctl.WriteLine(" Basic system usage tutorial complete."); + Thread.Sleep(500); + ctl.WriteLine(" 200 Codepoints earned."); + SaveSystem.CurrentSave.Codepoints += 200; + SaveSystem.SaveGame(); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.InStory = false; + Story.Context.MarkComplete(); + TerminalBackend.PrintPrompt(); } } } diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index 48cf70d..c62d3bd 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -199,13 +199,6 @@ namespace ShiftOS.Engine Debug.Print("No such story: " + stid); #endif } - - [Obsolete("Please use Story.Start() in tandem with [StoryAttribute].")] - public static void RunFromInternalResource(string resource_id) - { - } - - } [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]