private static string TestMission(string missionName, OS os) { var text = ""; try { var activeMission = (ActiveMission)ComputerLoader.readMission(missionName); var text2 = ""; for (var i = 0; i < activeMission.goals.Count; i++) { var text3 = activeMission.goals[i].TestCompletable(); if (text3 != null && text3.Length > 0) { object obj = text2; text2 = string.Concat(obj, missionName, " Goal[", i, "] ", activeMission.goals[i].ToString(), " :: ", text3, "\r\n"); } } if (text2.Length > 0) { text = text + text2 + "--------------\r\n"; } if (activeMission.nextMission != null && activeMission.nextMission.ToLower() != "none") { text += TestMission("Content/Missions/" + activeMission.nextMission, os); } } catch (Exception ex) { var text4 = text; text = string.Concat(text4, "Error Loading ", missionName, "\r\n", ex.ToString()); } return(text); }
public void RemoveMissionFromListings(string missionFilename) { List <ActiveMission> branchMissions = this.os.branchMissions; ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(Utils.GetFileLoadPrefix() + missionFilename); string key = (string)null; foreach (KeyValuePair <string, ActiveMission> listingMission in this.listingMissions) { if (listingMission.Value.reloadGoalsSourceFile == activeMission.reloadGoalsSourceFile) { key = listingMission.Key; break; } } if (key != null) { this.listingMissions.Remove(key); for (int index = 0; index < this.listingsFolder.files.Count; ++index) { if (this.listingsFolder.files[index].name.Contains("#" + key)) { this.listingsFolder.files.RemoveAt(index); --index; } } } this.os.branchMissions = branchMissions; }
public void addListingsForGroup() { List <ActiveMission> branchMissions = this.os.branchMissions; this.os.branchMissions = (List <ActiveMission>)null; bool flag = false; if (!this.NeedsCustomFolderLoad && this.groupName.ToLower().Equals("entropy")) { this.NeedsCustomFolderLoad = true; this.CustomFolderLoadPath = "Content/Missions/Entropy/StartingSet/"; flag = true; } if (this.NeedsCustomFolderLoad) { foreach (FileSystemInfo file in new DirectoryInfo(this.CustomFolderLoadPath).GetFiles("*.xml")) { string filename = this.CustomFolderLoadPath + file.Name; this.os.branchMissions = new List <ActiveMission>(); this.addMisison((ActiveMission)ComputerLoader.readMission(filename), false); } if (flag) { for (int index = 0; index < 2; ++index) { this.os.branchMissions = new List <ActiveMission>(); this.addMisison((ActiveMission)MissionGenerator.generate(2), false); } } } else if (this.groupName.ToLower().Equals("netedu")) { this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education4.0.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education2.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education3.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education1.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education4.1.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education5.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education6.xml"), false); } else if (this.groupName.ToLower().Equals("slashbot")) { this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews1.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews3.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews2.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews4.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews5.xml"), false); } else if (this.groupName.ToLower().Equals("kellis biotech")) { this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware1.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware2.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware3.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware4.xml"), false); this.addMisison((ActiveMission)ComputerLoader.readMission("Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware5.xml"), false); } this.os.branchMissions = branchMissions; }
public static object generate(int secutiryLevel) { int type = 0; if (secutiryLevel <= 3) { type = 0; } else { type = 0; if (Utils.flipCoin()) { type = 1; } } int index = (int)((double)(MissionGenerator.MissionLists[type].Count - 1) * Utils.random.NextDouble() + 0.5); string filename = MissionGenerator.MissionLists[type][index]; MissionGenerator.customKeysWereSet = false; MissionGenerationParser.Client = NameGenerator.generateName(); MissionGenerationParser.Other = "Unknown"; MissionGenerationParser.Target = NameGenerator.generateName(); ComputerLoader.MissionPreLoadComplete += (Action)(() => { Computer computer1 = (Computer)MissionGenerator.generateComputer(secutiryLevel, MissionGenerationParser.Target); Computer computer2; switch (type) { case 1: computer2 = MissionGenerator.addWebsiteChangeRequirements(computer1, OS.currentInstance); break; default: computer2 = MissionGenerator.addFileDeletionRequirements(computer1, OS.currentInstance); break; } computer2.idName = "Gen" + (object)MissionGenerator.generationCount; MissionGenerationParser.Comp = computer2.idName; OS.currentInstance.netMap.nodes.Add(computer2); }); ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(filename); ComputerLoader.MissionPreLoadComplete = (Action)null; activeMission.wasAutoGenerated = true; activeMission.genTarget = MissionGenerationParser.Comp; activeMission.genPath = MissionGenerationParser.Path; activeMission.genFile = MissionGenerationParser.File; activeMission.client = MissionGenerationParser.Client; activeMission.genTargetName = MissionGenerationParser.Target; activeMission.genOther = MissionGenerationParser.Other; ++MissionGenerator.generationCount; return((object)activeMission); }
private void acceptMission(ActiveMission mission, int index, string id) { this.os.currentMission = mission; ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(mission.reloadGoalsSourceFile); mission.sendEmail(this.os); mission.ActivateSuppressedStartFunctionIfPresent(); FileEntry file = this.listingsFolder.files[index]; this.listingsFolder.files.RemoveAt(index); this.listingArchivesFolder.files.Add(new FileEntry("Contract Archive:\nAccepted : " + DateTime.Now.ToString() + "\nUser : "******"\nActive Since : " + this.activeUserLoginTime.ToString() + "\n\n" + file.data, "Contract#" + id + "Archive")); this.listingMissions.Remove(id); }
private void loadInitialContracts() { var num = 0; foreach ( FileSystemInfo fileSystemInfo in new DirectoryInfo("Content/Missions/MainHub/FirstSet/").GetFiles("*.xml")) { addMission( (ActiveMission) ComputerLoader.readMission("Content/Missions/MainHub/FirstSet/" + fileSystemInfo.Name), false); ++num; } }
public static string TestMissionEndFucntion(string missionName, string expectedEndFunction, object os_obj) { string str = ""; if (!File.Exists(missionName)) { str = str + "Invalid Mission Path! : " + missionName + "\r\n"; } ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(missionName); if (activeMission.endFunctionName != expectedEndFunction) { str = str + "\r\nUnexpected end function in " + missionName + "\r\nExpected: " + expectedEndFunction + " -- found: " + activeMission.endFunctionName; } return(str); }
private void loadInitialContracts() { int num = 0; foreach (FileSystemInfo file in new DirectoryInfo(this.MissionSourceFolderPath).GetFiles("*.xml")) { string filename = this.MissionSourceFolderPath + file.Name; try { this.addMission((ActiveMission)ComputerLoader.readMission(filename), false, false, -1); } catch (Exception ex) { throw new FormatException("Error Loading Mission: " + filename, ex); } ++num; } }
private static string TestAllExtensionMissions(OS os, out int errorsAdded) { int errors = 0; string ret = ""; Utils.ActOnAllFilesRevursivley(ExtensionLoader.ActiveExtensionInfo.FolderPath + "/Missions", (Action <string>)(filename => { if (!filename.EndsWith(".xml")) { return; } if (OS.TestingPassOnly) { try { ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(filename); if (activeMission != null) { ExtensionTests.RuntimeLoadAdditionalErrors += ExtensionTests.TestExtensionMission((object)activeMission, filename, (object)os); } } catch (Exception ex) { ++errors; // ISSUE: variable of a compiler-generated type ExtensionTests.\u003C\u003Ec__DisplayClass1 cDisplayClass1_1 = this; // ISSUE: reference to a compiler-generated field string str1 = cDisplayClass1_1.ret + "Error Loading Mission: " + filename; // ISSUE: reference to a compiler-generated field cDisplayClass1_1.ret = str1; // ISSUE: variable of a compiler-generated type ExtensionTests.\u003C\u003Ec__DisplayClass1 cDisplayClass1_2 = this; // ISSUE: reference to a compiler-generated field string str2 = cDisplayClass1_2.ret + "\r\n\r\n" + Utils.GenerateReportFromExceptionCompact(ex) + "\r\n\r\n"; // ISSUE: reference to a compiler-generated field cDisplayClass1_2.ret = str2; } } })); errorsAdded = errors; return(ret); }
public static void SendStartingEmailForActiveExtensionNextFrame(object os_obj) { OS os = (OS)os_obj; if (!string.IsNullOrWhiteSpace(ExtensionLoader.ActiveExtensionInfo.StartingMissionPath)) { os.delayer.Post(ActionDelayer.NextTick(), (Action)(() => { ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(ExtensionLoader.ActiveExtensionInfo.FolderPath + "/" + ExtensionLoader.ActiveExtensionInfo.StartingMissionPath); os.currentMission = activeMission; activeMission.sendEmail(os); activeMission.ActivateSuppressedStartFunctionIfPresent(); os.saveGame(); })); } if (os.Flags.HasFlag("ExtensionFirstBootComplete")) { return; } os.Flags.AddFlag("ExtensionFirstBootComplete"); }
private void StartAssignment() { if (!this.AllAssignmentsComplete) { if (this.IsOnAssignment1) { this.PhaseTitle = "74.125.23.121"; this.PhaseSubtitle = LocaleTerms.Loc("Download Tools") + "\n" + LocaleTerms.Loc("Delete System Files"); } else { this.PhaseTitle = "216.239.32.181"; this.PhaseSubtitle = LocaleTerms.Loc("Adapt") + "\n" + LocaleTerms.Loc("Advance"); } this.State = this.IsOnAssignment1 ? DLCIntroExe.IntroState.OnMission1 : DLCIntroExe.IntroState.OnMission2; this.TimeInThisState = 0.0f; this.LoadedMission = (ActiveMission)ComputerLoader.readMission(this.IsOnAssignment1 ? this.assignment1MissionPath : this.assignment2MissionPath); } else { this.CompleteExecution(); } }
public override void Trigger(object os_obj) { OS os = (OS)os_obj; Computer computer = Programs.getComputer(os, this.TargetComp); if (computer == null) { throw new NullReferenceException("Computer " + this.TargetComp + " could not be found for SAAddMissionToHubServer Function, adding mission: " + this.MissionFilepath); } MissionHubServer daemon1 = computer.getDaemon(typeof(MissionHubServer)) as MissionHubServer; if (daemon1 != null) { daemon1.AddMissionToListings(Utils.GetFileLoadPrefix() + this.MissionFilepath, -1); } else { DLCHubServer daemon2 = computer.getDaemon(typeof(DLCHubServer)) as DLCHubServer; if (daemon2 != null) { daemon2.AddMission(Utils.GetFileLoadPrefix() + this.MissionFilepath, this.AssignmentTag, this.StartsComplete); } else { MissionListingServer daemon3 = computer.getDaemon(typeof(MissionListingServer)) as MissionListingServer; if (daemon3 == null) { throw new NullReferenceException("Computer " + this.TargetComp + " does not contain a MissionHubServer, MissionListingServer or DLCHubServer daemon for addMission function adding mission: " + this.MissionFilepath); } List <ActiveMission> branchMissions = os.branchMissions; ActiveMission m = (ActiveMission)ComputerLoader.readMission(Utils.GetFileLoadPrefix() + this.MissionFilepath); os.branchMissions = branchMissions; daemon3.addMisison(m, this.AssignmentTag.ToLower() == "top"); } } }
public override void draw(Rectangle bounds, SpriteBatch sb) { base.draw(bounds, sb); PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2), 0.28f, Color.Transparent, themeColor * 0.1f, sb, PatternDrawer.thinStripe); drawTopBar(bounds, sb); if (!hasSysfile()) { if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Exit", themeColor)) { os.display.command = "connect"; } PatternDrawer.draw( new Rectangle(bounds.X + 1, bounds.Y + 1 + 64, bounds.Width - 2, bounds.Height - 2 - 64), 1f, Color.Transparent, os.lockedColor, sb, PatternDrawer.errorTile); var num1 = bounds.X + 20; var num2 = bounds.Y + bounds.Height / 2 - 20; TextItem.doLabel(new Vector2(num1, num2), "CRITICAL ERROR", new Color?()); var num3 = num2 + 40; TextItem.doSmallLabel(new Vector2(num1, num3), "ERROR #4040408 - NULL_SYSFILE\nUnhandled Exception - IOException@L 2217 :R 28\nSystem Files Corrupted and/or Destroyed\nContact the System Administrator", new Color?()); } else { switch (state) { case 0: if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Exit", themeColor)) { os.display.command = "connect"; } sb.Draw(logo, new Rectangle(bounds.X + 30, bounds.Y + 115, 128, 128), Color.White); TextItem.doFontLabel(new Vector2(bounds.X + 40 + 128, bounds.Y + 115), groupName + " Group\nMessage Board", GuiData.font, new Color?(), bounds.Width - 40, 60f); if ( !Button.doButton(800004, bounds.X + 30, bounds.Y + bounds.Height / 2, 300, 40, "Login", themeColor)) { break; } startLogin(); state = 3; break; case 1: if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Exit", themeColor)) { os.display.command = "connect"; } var num4 = bounds.X + 10; var num5 = bounds.Y + topBar.Height + 50; logoRect.X = num4; logoRect.Y = num5; sb.Draw(logo, logoRect, Color.White); var x = num4 + (logoRect.Width + 5); TextItem.doLabel(new Vector2(x, num5), listingTitle, new Color?()); var y = num5 + 40; for (var index = 0; index < missions.Count; ++index) { if (hasListingFile(missions[index].postingTitle)) { if (Button.doButton(87654 + index, x, y, (int)(bounds.Width * 0.800000011920929), 30, missions[index].postingTitle, new Color?())) { state = 2; targetIndex = index; } y += 35; } } break; case 2: if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Back", themeColor)) { state = 1; } var num6 = 60; var num7 = 84; var destinationRectangle = new Rectangle(bounds.X + 30, bounds.Y + topBar.Height + num6, num7, num7); sb.Draw(logo, destinationRectangle, themeColor); var num8 = num6 + 30; TextItem.doFontLabel(new Vector2(bounds.X + 34 + num7, bounds.Y + topBar.Height + num8), missions[targetIndex].postingTitle, GuiData.font, new Color?(), bounds.Width - (36 + num7 + 6), 40f); var num9 = num8 + 40; PatternDrawer.draw( new Rectangle(destinationRectangle.X + destinationRectangle.Width + 2, bounds.Y + topBar.Height + num9 - 8, bounds.Width - (destinationRectangle.X - bounds.X + destinationRectangle.Width + 10), PatternDrawer.warningStripe.Height / 2), 1f, Color.Transparent, themeColor, sb, PatternDrawer.warningStripe); var num10 = num9 + 36; var text = Utils.SuperSmartTwimForWidth(missions[targetIndex].postingBody, bounds.Width - 60, GuiData.tinyfont); TextItem.doFontLabel(new Vector2(bounds.X + 30, bounds.Y + topBar.Height + num10), text, GuiData.tinyfont, new Color?(), bounds.Width, bounds.Height - num10 - topBar.Height - 10); var flag = os.currentFaction.idName.ToLower() == groupName.ToLower(); if (missionAssigner && os.currentMission == null && (flag && Button.doButton(800005, bounds.X + bounds.Width / 2 - 10, bounds.Y + bounds.Height - 35, bounds.Width / 2, 30, "Accept", os.highlightColor))) { os.currentMission = missions[targetIndex]; var activeMission = (ActiveMission)ComputerLoader.readMission(missions[targetIndex].reloadGoalsSourceFile); missions[targetIndex].sendEmail(os); missions[targetIndex].ActivateSuppressedStartFunctionIfPresent(); removeMission(targetIndex); state = 1; break; } if (missionAssigner && os.currentMission != null) { if (os.currentMission.wasAutoGenerated && Button.doButton(8000105, bounds.X + 6, bounds.Y + bounds.Height - 29, 210, 25, "Abandon Current Contract", os.lockedColor)) { os.currentMission = null; os.currentFaction.contractAbbandoned(os); } TextItem.doFontLabel(new Vector2(bounds.X + 10, bounds.Y + bounds.Height - 52), "Mission Unavaliable : " + (flag ? "Complete Existing Contracts" : "user ID Assigned to Different Faction "), GuiData.smallfont, new Color?(), bounds.Width - 20, 30f); break; } if (!missionAssigner || flag) { break; } TextItem.doFontLabel(new Vector2(bounds.X + 10, bounds.Y + bounds.Height - 52), "Mission Unavaliable : User ID Assigned to Different Faction ", GuiData.smallfont, new Color?(), bounds.Width - 20, 30f); break; case 3: doLoginDisplay(bounds, sb); break; } } }
public static void runCommand(int value, string name) { MissionFunctions.assertOS(); if (name.ToLower().Trim() == "none") { return; } if (name.Equals("addRank")) { if (!OS.TestingPassOnly || MissionFunctions.os.currentFaction != null) { MissionFunctions.os.currentFaction.addValue(value, (object)MissionFunctions.os); string email = MailServer.generateEmail(LocaleTerms.Loc("Contract Successful"), string.Format(Utils.readEntireFile("Content/LocPost/MissionCompleteEmail.txt"), (object)MissionFunctions.os.currentFaction.getRank(), (object)MissionFunctions.os.currentFaction.getMaxRank(), (object)MissionFunctions.os.currentFaction.name), MissionFunctions.os.currentFaction.name + " ReplyBot"); ((MailServer)MissionFunctions.os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, MissionFunctions.os.defaultUser.name); } else if (OS.DEBUG_COMMANDS && MissionFunctions.os.currentFaction == null) { MissionFunctions.os.write("----------"); MissionFunctions.os.write("----------"); MissionFunctions.os.write("ERROR IN FUNCTION 'addRank'"); MissionFunctions.os.write("Player is not assigned to a faction, so rank cannot be added!"); MissionFunctions.os.write("Make sure you have assigned a player a faction with the 'SetFaction' function before using this!"); MissionFunctions.os.write("----------"); MissionFunctions.os.write("----------"); } } else if (name.Equals("addRankSilent")) { if (OS.TestingPassOnly && MissionFunctions.os.currentFaction == null) { return; } MissionFunctions.os.currentFaction.addValue(value, (object)MissionFunctions.os); } else if (name.StartsWith("addFlags:")) { foreach (string flag in name.Substring("addFlags:".Length).Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries)) { MissionFunctions.os.Flags.AddFlag(flag); } CustomFaction currentFaction = MissionFunctions.os.currentFaction as CustomFaction; if (currentFaction == null) { return; } currentFaction.CheckForAllCustomActionsToRun((object)MissionFunctions.os); } else if (name.StartsWith("removeFlags:")) { string[] strArray = name.Substring("removeFlags:".Length).Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries); for (int index = 0; index < strArray.Length; ++index) { if (MissionFunctions.os.Flags.HasFlag(strArray[index])) { MissionFunctions.os.Flags.RemoveFlag(strArray[index]); } } CustomFaction currentFaction = MissionFunctions.os.currentFaction as CustomFaction; if (currentFaction == null) { return; } currentFaction.CheckForAllCustomActionsToRun((object)MissionFunctions.os); } else if (name.StartsWith("setFaction:")) { string newFaction = name.Substring("setFaction:".Length); bool flag = false; foreach (KeyValuePair <string, Faction> faction in MissionFunctions.os.allFactions.factions) { if (faction.Value.idName.ToLower() == newFaction.ToLower()) { MissionFunctions.os.allFactions.setCurrentFaction(newFaction, MissionFunctions.os); flag = true; break; } } if (!flag && OS.TestingPassOnly) { throw new NullReferenceException("Faction " + newFaction + "not found for setFaction action!"); } } else if (name.StartsWith("loadConditionalActions:")) { RunnableConditionalActions.LoadIntoOS(name.Substring("loadConditionalActions:".Length), (object)MissionFunctions.os); } else if (name.Equals("triggerThemeHackRevenge")) { MissionFunctions.os.delayer.Post(ActionDelayer.Wait(5.0), (Action)(() => { string email = MailServer.generateEmail(LocaleTerms.Loc("Are you Kidding me?"), Utils.readEntireFile("Content/LocPost/NaixEmail.txt"), "*****@*****.**"); ((MailServer)MissionFunctions.os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, MissionFunctions.os.defaultUser.name); MissionFunctions.os.delayer.Post(ActionDelayer.Wait(24.0), (Action)(() => { try { HackerScriptExecuter.runScript("HackerScripts/ThemeHack.txt", (object)MissionFunctions.os, (string)null, (string)null); } catch (Exception ex) { if (!Settings.recoverFromErrorsSilently) { throw ex; } MissionFunctions.os.write("CAUTION: UNSYNDICATED OUTSIDE CONNECTION ATTEMPT"); MissionFunctions.os.write("RECOVERED FROM CONNECTION SUBTERFUGE SUCCESSFULLY"); Console.WriteLine("Critical error loading hacker script - aborting"); } })); })); } else if (name.Equals("changeSong")) { switch (value) { case 2: MusicManager.transitionToSong("Music\\The_Quickening"); break; case 3: MusicManager.transitionToSong("Music\\TheAlgorithm"); break; case 4: MusicManager.transitionToSong("Music\\Ryan3"); break; case 5: MusicManager.transitionToSong("Music\\Bit(Ending)"); break; case 6: MusicManager.transitionToSong("Music\\Rico_Puestel-Roja_Drifts_By"); break; case 7: MusicManager.transitionToSong("Music\\out_run_the_wolves"); break; case 8: MusicManager.transitionToSong("Music\\Irritations"); break; case 9: MusicManager.transitionToSong("Music\\Broken_Boy"); break; case 10: MusicManager.transitionToSong("Music\\Ryan10"); break; case 11: MusicManager.transitionToSong("Music\\tetrameth"); break; default: MusicManager.transitionToSong("Music\\Revolve"); break; } } else if (name.Equals("entropyEndMissionSetup")) { MissionFunctions.runCommand(3, "changeSong"); Computer comp1 = MissionFunctions.findComp("corp0#IS"); Computer comp2 = MissionFunctions.findComp("corp0#MF"); Computer comp3 = MissionFunctions.findComp("corp0#BU"); FileEntry fileEntry1 = new FileEntry(Computer.generateBinaryString(5000), "HacknetOS.rar"); FileEntry fileEntry2 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Data.xnb"); FileEntry fileEntry3 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Content.xnb"); Folder folder1 = comp1.files.root.folders[2]; folder1.files.Add(fileEntry1); folder1.files.Add(fileEntry2); folder1.files.Add(fileEntry3); Folder folder2 = comp2.files.root.folders[2]; folder2.files.Add(fileEntry1); folder2.files.Add(fileEntry2); folder2.files.Add(fileEntry3); FileEntry fileEntry4 = new FileEntry(fileEntry1.data, fileEntry1.name + "_backup"); FileEntry fileEntry5 = new FileEntry(fileEntry2.data, fileEntry2.name + "_backup"); FileEntry fileEntry6 = new FileEntry(fileEntry3.data, fileEntry3.name + "_backup"); Folder folder3 = comp3.files.root.folders[2]; folder3.files.Add(fileEntry4); folder3.files.Add(fileEntry5); folder3.files.Add(fileEntry6); comp1.traceTime = Computer.BASE_TRACE_TIME * 7.5f; comp3.traceTime = Computer.BASE_TRACE_TIME * 7.5f; comp2.traceTime = Computer.BASE_TRACE_TIME * 7.5f; comp2.portsNeededForCrack = 3; comp1.portsNeededForCrack = 2; comp3.portsNeededForCrack = 2; Folder folder4 = MissionFunctions.findComp("entropy01").files.root.folders[2]; folder4.files.Add(new FileEntry(PortExploits.crackExeData[25], "SMTPoverflow.exe")); folder4.files.Add(new FileEntry(PortExploits.crackExeData[80], "WebServerWorm.exe")); } else if (name.Equals("entropyAddSMTPCrack")) { Folder folder = MissionFunctions.findComp("entropy01").files.root.folders[2]; bool flag = false; for (int index = 0; index < folder.files.Count; ++index) { if (folder.files[index].data == PortExploits.crackExeData[25] || folder.files[index].name == "SMTPoverflow.exe") { flag = true; } } if (!flag) { folder.files.Add(new FileEntry(PortExploits.crackExeData[25], Utils.GetNonRepeatingFilename("SMTPoverflow", ".exe", folder))); } MissionFunctions.os.Flags.AddFlag("ThemeHackTransitionAssetsAdded"); } else if (name.Equals("transitionToBitMissions")) { if (Settings.isDemoMode) { MissionFunctions.runCommand(6, "changeSong"); if (Settings.isPressBuildDemo) { ComputerLoader.loadMission("Content/Missions/Demo/PressBuild/DemoMission01.xml", false); } else { ComputerLoader.loadMission("Content/Missions/Demo/AvconDemo.xml", false); } } else { ComputerLoader.loadMission("Content/Missions/BitMission0.xml", false); } } else if (name.Equals("entropySendCSECInvite")) { MissionFunctions.os.delayer.Post(ActionDelayer.Wait(6.0), (Action)(() => ComputerLoader.loadMission("Content/Missions/MainHub/Intro/Intro01.xml", false))); } else if (name.Equals("hubBitSetComplete01")) { MissionFunctions.os.delayer.Post(ActionDelayer.Wait(4.0), (Action)(() => MissionFunctions.runCommand(1, "addRank"))); MissionFunctions.runCommand(3, "changeSong"); MissionFunctions.os.Flags.AddFlag("csecBitSet01Complete"); } else if (name.Equals("enTechEnableOfflineBackup")) { Programs.getComputer(MissionFunctions.os, "EnTechOfflineBackup"); MissionFunctions.os.Flags.AddFlag("VaporSequencerEnabled"); Folder folder1 = MissionFunctions.findComp("mainHubAssets").files.root.searchForFolder("bin"); Folder folder2 = folder1.searchForFolder("Sequencer"); if (folder2 == null) { folder2 = new Folder("Sequencer"); folder1.folders.Add(folder2); } if (folder2.searchForFile("Sequencer.exe") != null) { return; } folder2.files.Add(new FileEntry(PortExploits.crackExeData[17], "Sequencer.exe")); } else if (name.Equals("rudeNaixResponse")) { AchievementsManager.Unlock("rude_response", false); } else if (name.Equals("assignPlayerToHubServerFaction")) { MissionFunctions.os.allFactions.setCurrentFaction("hub", MissionFunctions.os); Computer computer = Programs.getComputer(MissionFunctions.os, "mainHub"); MissionHubServer daemon = (MissionHubServer)computer.getDaemon(typeof(MissionHubServer)); UserDetail userDetail = new UserDetail(MissionFunctions.os.defaultUser.name, "reptile", (byte)3); computer.addNewUser(computer.ip, userDetail); daemon.addUser(userDetail); MissionFunctions.os.homeNodeID = "mainHub"; MissionFunctions.os.homeAssetServerID = "mainHubAssets"; MissionFunctions.runCommand(3, "changeSong"); MissionFunctions.os.Flags.AddFlag("CSEC_Member"); AchievementsManager.Unlock("progress_csec", false); if (!MissionFunctions.os.HasLoadedDLCContent || !Settings.EnableDLC || MissionFunctions.os.Flags.HasFlag("dlc_complete")) { return; } daemon.AddMissionToListings("Content/DLC/Missions/BaseGameConnectors/Missions/CSEC_DLCConnectorIntro.xml", 1); } else if (name.Equals("assignPlayerToEntropyFaction")) { MissionFunctions.runCommand(6, "changeSong"); MissionFunctions.os.homeNodeID = "entropy00"; MissionFunctions.os.homeAssetServerID = "entropy01"; AchievementsManager.Unlock("progress_entropy", false); } else if (name.Equals("assignPlayerToLelzSec")) { MissionFunctions.os.homeNodeID = "lelzSecHub"; MissionFunctions.os.homeAssetServerID = "lelzSecHub"; MissionFunctions.os.Flags.AddFlag("LelzSec_Member"); AchievementsManager.Unlock("progress_lelz", false); } else if (name.Equals("lelzSecVictory")) { AchievementsManager.Unlock("secret_path_complete", false); } else if (name.Equals("demoFinalMissionEnd")) { MissionFunctions.os.exes.Clear(); PostProcessor.EndingSequenceFlashOutActive = true; PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f; MusicManager.stop(); MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => MissionFunctions.os.content.Load <SoundEffect>("Music/Ambient/spiral_gauge_down").Play())); MissionFunctions.os.delayer.Post(ActionDelayer.Wait(3.0), (Action)(() => { PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; MissionFunctions.os.ExitScreen(); MissionFunctions.os.ScreenManager.AddScreen((GameScreen) new DemoEndScreen()); })); } else if (name.Equals("demoFinalMissionEndDLC")) { if (!Settings.isDemoMode) { return; } MissionFunctions.os.exes.Clear(); PostProcessor.EndingSequenceFlashOutActive = true; PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f; MusicManager.stop(); MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.0), (Action)(() => MissionFunctions.os.content.Load <SoundEffect>("SFX/BrightFlash").Play())); MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.4), (Action)(() => MissionFunctions.os.content.Load <SoundEffect>("SFX/TraceKill").Play())); MissionFunctions.os.delayer.Post(ActionDelayer.Wait(1.6), (Action)(() => { MusicManager.playSongImmediatley("DLC/Music/DreamHead"); PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; MissionFunctions.os.ScreenManager.AddScreen((GameScreen) new DemoEndScreen() { StopsMusic = false, IsDLCDemoScreen = true }); MissionFunctions.os.ExitScreen(); })); } else if (name.Equals("demoFinalMissionStart")) { MissionFunctions.os.Flags.AddFlag("DemoSequencerEnabled"); MusicManager.transitionToSong("Music/Ambient/dark_drone_008"); } else if (name.Equals("CSECTesterGameWorldSetup")) { for (int index = 0; index < PortExploits.services.Count && index < 4; ++index) { MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]])); } for (int index = 0; index < 4; ++index) { Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), MissionFunctions.os.netMap.getRandomPosition(), 0, (byte)2, MissionFunctions.os); c.adminIP = MissionFunctions.os.thisComputer.adminIP; MissionFunctions.os.netMap.nodes.Add(c); MissionFunctions.os.netMap.discoverNode(c); } MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => { MissionFunctions.os.allFactions.setCurrentFaction("entropy", MissionFunctions.os); MissionFunctions.os.currentMission = (ActiveMission)null; MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy00")); MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy01")); })); } else if (name.Equals("EntropyFastFowardSetup")) { MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22])); MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21])); for (int index = 0; index < 3; ++index) { Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), MissionFunctions.os.netMap.getRandomPosition(), 0, (byte)2, MissionFunctions.os); c.adminIP = MissionFunctions.os.thisComputer.adminIP; MissionFunctions.os.netMap.nodes.Add(c); MissionFunctions.os.netMap.discoverNode(c); } MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => { MissionFunctions.os.allFactions.setCurrentFaction("entropy", MissionFunctions.os); MissionFunctions.os.currentMission = (ActiveMission)null; MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy00")); MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "entropy01")); Computer computer = Programs.getComputer(MissionFunctions.os, "entropy01"); UserDetail user = computer.users[0]; user.known = true; computer.users[0] = user; MissionFunctions.os.allFactions.factions[MissionFunctions.os.allFactions.currentFaction].playerValue = 2; MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => { MissionFunctions.os.Flags.AddFlag("eosPathStarted"); ComputerLoader.loadMission("Content/Missions/Entropy/StartingSet/eosMissions/eosIntroDelayer.xml", false); })); })); } else if (name.Equals("CSECFastFowardSetup")) { MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22])); MissionFunctions.os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21])); for (int index = 0; index < 3; ++index) { Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), MissionFunctions.os.netMap.getRandomPosition(), 0, (byte)2, MissionFunctions.os); c.adminIP = MissionFunctions.os.thisComputer.adminIP; MissionFunctions.os.netMap.nodes.Add(c); MissionFunctions.os.netMap.discoverNode(c); } MissionFunctions.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => { MissionFunctions.runCommand(0, "assignPlayerToHubServerFaction"); MissionFunctions.os.currentMission = (ActiveMission)null; MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "mainHub")); MissionFunctions.os.netMap.discoverNode(Programs.getComputer(MissionFunctions.os, "mainHubAssets")); Computer computer = Programs.getComputer(MissionFunctions.os, "mainHubAssets"); UserDetail user = computer.users[0]; user.known = true; computer.users[0] = user; })); } else if (name.Equals("csecAddTraceKill")) { Folder folder = MissionFunctions.findComp("mainHubAssets").files.root.searchForFolder("bin"); Folder f = folder.searchForFolder("TK"); if (f == null) { f = new Folder("TK"); folder.folders.Add(f); } f.files.Add(new FileEntry(FileEncrypter.EncryptString(PortExploits.crackExeData[12], "Vapor Trick Enc.", "NULL", "dx122DX", ".exe"), Utils.GetNonRepeatingFilename("TraceKill", ".dec", f))); MissionFunctions.os.Flags.AddFlag("bitPathStarted"); MissionFunctions.runCommand(10, "changeSong"); } else if (name.Equals("junebugComplete")) { Computer computer = Programs.getComputer(MissionFunctions.os, "pacemaker01"); if (computer != null) { HeartMonitorDaemon daemon = (HeartMonitorDaemon)computer.getDaemon(typeof(HeartMonitorDaemon)); if (daemon != null) { daemon.ForceStopBeepSustainSound(); } } MissionFunctions.runCommand(1, "addRank"); } else if (name.Equals("eosIntroMissionSetup")) { MissionFunctions.findComp("entropy01").files.root.searchForFolder("bin").files.Add(new FileEntry(PortExploits.crackExeData[13], "eosDeviceScan.exe")); MissionFunctions.os.delayer.Post(ActionDelayer.Wait(8.0), (Action)(() => { string email = MailServer.generateEmail("Fwd: eOS Stuff", Utils.readEntireFile("Content/Post/eosScannerMail.txt"), "vtfx", new List <string>((IEnumerable <string>) new string[1] { "note#%#" + LocaleTerms.Loc("eOS Security Basics") + "#%#" + Utils.readEntireFile("Content/LocPost/eOSNote.txt") })); ((MailServer)MissionFunctions.os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, MissionFunctions.os.defaultUser.name); MissionFunctions.os.saveGame(); })); MissionFunctions.runCommand(4, "changeSong"); MissionFunctions.os.saveGame(); } else if (name.Equals("eosIntroEndFunc")) { MissionFunctions.runCommand(1, "addRank"); MissionListingServer daemon = (MissionListingServer)MissionFunctions.findComp("entropy00").getDaemon(typeof(MissionListingServer)); List <ActiveMission> branchMissions = MissionFunctions.os.branchMissions; ActiveMission m = (ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/StartingSet/eosMissions/eosAddedMission.xml"); daemon.addMisison(m, false); MissionFunctions.os.branchMissions = branchMissions; } else if (name.Equals("changeSongDLC")) { switch (value) { case 2: MusicManager.transitionToSong("DLC\\Music\\snidelyWhiplash"); break; case 3: MusicManager.transitionToSong("DLC\\Music\\Slow_Motion"); break; case 4: MusicManager.transitionToSong("DLC\\Music\\World_Chase"); break; case 5: MusicManager.transitionToSong("DLC\\Music\\HOME_Resonance"); break; case 6: MusicManager.transitionToSong("DLC\\Music\\Remi_Finale"); break; case 7: MusicManager.transitionToSong("DLC\\Music\\RemiDrone"); break; case 8: MusicManager.transitionToSong("DLC\\Music\\DreamHead"); break; case 9: MusicManager.transitionToSong("DLC\\Music\\Userspacelike"); break; case 10: MusicManager.transitionToSong("DLC\\Music\\CrashTrack"); break; default: MusicManager.transitionToSong("DLC\\Music\\Remi2"); break; } } else if (name.Equals("scanAndStartDLCVenganceHack")) { Computer comp = MissionFunctions.findComp("dAttackTarget"); if (comp == null) { return; } Folder folder = comp.files.root.searchForFolder("log"); bool flag = false; for (int index = 0; index < folder.files.Count; ++index) { if (folder.files[index].data.Contains(MissionFunctions.os.thisComputer.ip)) { SARunFunction saRunFunction = new SARunFunction() { DelayHost = "dhs", FunctionName = "triggerDLCHackRevenge", FunctionValue = 1 }; ((DLCHubServer)Programs.getComputer(MissionFunctions.os, "dhs").getDaemon(typeof(DLCHubServer))).DelayedActions.AddAction((SerializableAction)saRunFunction, 16f); break; } } if (!flag) { MissionFunctions.runCommand(4, "changeSongDLC"); } } else if (name.Equals("triggerDLCHackRevenge")) { try { HackerScriptExecuter.runScript("DLC/ActionScripts/Hackers/SystemHack.txt", (object)MissionFunctions.os, (string)null, (string)null); } catch (Exception ex) { if (!Settings.recoverFromErrorsSilently) { throw ex; } MissionFunctions.os.write("CAUTION: UNSYNDICATED OUTSIDE CONNECTION ATTEMPT"); MissionFunctions.os.write("RECOVERED FROM CONNECTION SUBTERFUGE SUCCESSFULLY"); Console.WriteLine("Critical error loading hacker script - aborting\r\n" + Utils.GenerateReportFromException(ex)); } } else if (name.Equals("activateAircraftStatusOverlay")) { MissionFunctions.os.AircraftInfoOverlay.Activate(); MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true; } else if (name.Equals("activateAircraftStatusOverlayLabyrinthsMonitoring")) { MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true; } else if (name.Equals("deActivateAircraftStatusOverlay")) { MissionFunctions.os.AircraftInfoOverlay.IsActive = false; MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = false; MissionFunctions.os.Flags.AddFlag("AircraftInfoOverlayDeactivated"); } else if (name.Equals("defAttackAircraft")) { Computer computer = Programs.getComputer(MissionFunctions.os, "dair_crash"); Folder folder = computer.files.root.searchForFolder("FlightSystems"); for (int index = 0; index < folder.files.Count; ++index) { if (folder.files[index].name == "747FlightOps.dll") { folder.files.RemoveAt(index); break; } } ((AircraftDaemon)computer.getDaemon(typeof(AircraftDaemon))).StartReloadFirmware(); if (MissionFunctions.os.AircraftInfoOverlay.IsActive) { return; } MissionFunctions.os.AircraftInfoOverlay.Activate(); MissionFunctions.os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true; } else if (name.Equals("playAirlineCrashSongSequence")) { MusicManager.playSongImmediatley("DLC\\Music\\Remi_Finale"); MediaPlayer.IsRepeating = false; } else if (name.Equals("flashUI")) { MissionFunctions.os.warningFlash(); } else if (name.Equals("addRankSilent")) { MissionFunctions.os.currentFaction.addValue(value, (object)MissionFunctions.os); } else if (name.StartsWith("addRankFaction:")) { string str = name.Substring("addRankFaction:".Length); foreach (KeyValuePair <string, Faction> faction in MissionFunctions.os.allFactions.factions) { if (faction.Value.idName.ToLower() == str.ToLower()) { faction.Value.addValue(value, (object)MissionFunctions.os); break; } } } else if (name.StartsWith("setHubServer:")) { string str = name.Substring("setHubServer:".Length); MissionFunctions.os.homeNodeID = str; } else if (name.StartsWith("setAssetServer:")) { string str = name.Substring("setAssetServer:".Length); MissionFunctions.os.homeAssetServerID = str; } else if (name.StartsWith("playCustomSong:")) { string songName = Utils.GetFileLoadPrefix() + name.Substring("playCustomSong:".Length); if (songName.EndsWith(".ogg")) { songName = songName.Substring(0, songName.Length - ".ogg".Length); } if (songName.StartsWith("Content")) { songName = songName.Substring("Content/".Length); } else if (songName.StartsWith("Extensions")) { songName = "../" + songName; } MusicManager.transitionToSong(songName); } else if (name.StartsWith("playCustomSongImmediatley:")) { string songname = Utils.GetFileLoadPrefix() + name.Substring("playCustomSongImmediatley:".Length); if (songname.EndsWith(".ogg")) { songname = songname.Substring(0, songname.Length - ".ogg".Length); } if (songname.StartsWith("Content")) { songname = songname.Substring("Content/".Length); } else if (songname.StartsWith("Extensions")) { songname = "../" + songname; } MusicManager.playSongImmediatley(songname); } else { if (OS.TestingPassOnly && !string.IsNullOrWhiteSpace(name)) { throw new FormatException("No Command Function " + name); } if (MissionFunctions.ReportErrorInCommand != null) { MissionFunctions.ReportErrorInCommand("No command found for \"" + name + "\" with value \"" + (object)value + "\""); } } }
public void AddMissionToListings(string missionFilename) { addMission((ActiveMission)ComputerLoader.readMission(missionFilename), true); }
public void addListingsForGroup() { var list = os.branchMissions; os.branchMissions = null; if (groupName.ToLower().Equals("entropy")) { foreach ( FileSystemInfo fileSystemInfo in new DirectoryInfo("Content/Missions/Entropy/StartingSet/").GetFiles("*.xml")) { var filename = "Content/Missions/Entropy/StartingSet/" + fileSystemInfo.Name; os.branchMissions = new List <ActiveMission>(); addMisison((ActiveMission)ComputerLoader.readMission(filename)); } for (var index = 0; index < 2; ++index) { os.branchMissions = new List <ActiveMission>(); addMisison((ActiveMission)MissionGenerator.generate(2)); } } else if (groupName.ToLower().Equals("netedu")) { addMisison( (ActiveMission) ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education4.0.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education2.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education3.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education1.xml")); addMisison( (ActiveMission) ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education4.1.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education5.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Misc/EducationArticles/Education6.xml")); } else if (groupName.ToLower().Equals("slashbot")) { addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews1.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews3.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews2.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews4.xml")); addMisison( (ActiveMission)ComputerLoader.readMission("Content/Missions/Entropy/NewsArticles/EntropyNews5.xml")); } else if (groupName.ToLower().Equals("kellis biotech")) { addMisison( (ActiveMission) ComputerLoader.readMission( "Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware1.xml")); addMisison( (ActiveMission) ComputerLoader.readMission( "Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware2.xml")); addMisison( (ActiveMission) ComputerLoader.readMission( "Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware3.xml")); addMisison( (ActiveMission) ComputerLoader.readMission( "Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware4.xml")); addMisison( (ActiveMission) ComputerLoader.readMission( "Content/Missions/MainHub/PacemakerSet/HardwareArticles/Hardware5.xml")); } os.branchMissions = list; }
public static void runCommand(int value, string name) { assertOS(); if (name.Equals("addRank")) { os.currentFaction.addValue(value, os); var mail = MailServer.generateEmail("Contract Successful", "Congratulations,\nThe client of your recent contract has reported a success, and is pleased with your work.\n" + "You are now free to accept further contracts from the contact database.\n" + "\nYour Current Ranking is " + os.currentFaction.getRank() + " of " + os.currentFaction.getMaxRank() + ".\n" + "\nThankyou,\n -" + os.currentFaction.name, os.currentFaction.name + " ReplyBot"); ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name); } else if (name.StartsWith("addFlags:")) { foreach ( var flag in name.Substring("addFlags:".Length) .Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries)) os.Flags.AddFlag(flag); } if (name.Equals("triggerThemeHackRevenge")) os.delayer.Post(ActionDelayer.Wait(5.0), () => { var mail = MailServer.generateEmail("Are you Kidding me?", "Seriously?\n\n" + "You think you can just f**k with my stuff and leave without consequence? Did you think I wouldn't notice?\n" + "\nDid you think I wouldn't FIND you!?\n" + "\nYou're a pathetic scrit kiddie, you couldn't hack a f*****g honeypot without your precious buttons and scrollbars.\n" + "\nSay goodbye to your x-server, idiot." + "\n\nNaix", "*****@*****.**"); ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name); os.delayer.Post(ActionDelayer.Wait(24.0), () => { try { HackerScriptExecuter.runScript("ThemeHack.txt", os); } catch (Exception ex) { if (!Settings.recoverFromErrorsSilently) throw ex; os.write("CAUTION: UNSYNDICATED OUTSIDE CONNECTION ATTEMPT"); os.write("RECOVERED FROM CONNECTION SUBTERFUGE SUCCESSFULLY"); Console.WriteLine("Critical error loading hacker script - aborting"); } }); }); else if (name.Equals("changeSong")) { switch (value) { case 2: MusicManager.transitionToSong("Music\\The_Quickening"); break; case 3: MusicManager.transitionToSong("Music\\TheAlgorithm"); break; case 4: MusicManager.transitionToSong("Music\\Ryan3"); break; case 5: MusicManager.transitionToSong("Music\\Bit(Ending)"); break; case 6: MusicManager.transitionToSong("Music\\Rico_Puestel-Roja_Drifts_By"); break; case 7: MusicManager.transitionToSong("Music\\out_run_the_wolves"); break; case 8: MusicManager.transitionToSong("Music\\Irritations"); break; case 9: MusicManager.transitionToSong("Music\\Broken_Boy"); break; case 10: MusicManager.transitionToSong("Music\\Ryan10"); break; case 11: MusicManager.transitionToSong("Music\\tetrameth"); break; default: MusicManager.transitionToSong("Music\\Revolve"); break; } } else if (name.Equals("entropyEndMissionSetup")) { runCommand(3, "changeSong"); var comp1 = findComp("corp0#IS"); var comp2 = findComp("corp0#MF"); var comp3 = findComp("corp0#BU"); var fileEntry1 = new FileEntry(Computer.generateBinaryString(5000), "HacknetOS.rar"); var fileEntry2 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Data.xnb"); var fileEntry3 = new FileEntry(Computer.generateBinaryString(4000), "HacknetOS_Content.xnb"); var folder1 = comp1.files.root.folders[2]; folder1.files.Add(fileEntry1); folder1.files.Add(fileEntry2); folder1.files.Add(fileEntry3); var folder2 = comp2.files.root.folders[2]; folder2.files.Add(fileEntry1); folder2.files.Add(fileEntry2); folder2.files.Add(fileEntry3); var fileEntry4 = new FileEntry(fileEntry1.data, fileEntry1.name + "_backup"); var fileEntry5 = new FileEntry(fileEntry2.data, fileEntry2.name + "_backup"); var fileEntry6 = new FileEntry(fileEntry3.data, fileEntry3.name + "_backup"); var folder3 = comp3.files.root.folders[2]; folder3.files.Add(fileEntry4); folder3.files.Add(fileEntry5); folder3.files.Add(fileEntry6); comp1.traceTime = Computer.BASE_TRACE_TIME*7.5f; comp3.traceTime = Computer.BASE_TRACE_TIME*7.5f; comp2.traceTime = Computer.BASE_TRACE_TIME*7.5f; comp2.portsNeededForCrack = 3; comp1.portsNeededForCrack = 2; comp3.portsNeededForCrack = 2; var folder4 = findComp("entropy01").files.root.folders[2]; folder4.files.Add(new FileEntry(PortExploits.crackExeData[25], "SMTPoverflow.exe")); folder4.files.Add(new FileEntry(PortExploits.crackExeData[80], "WebServerWorm.exe")); } else if (name.Equals("entropyAddSMTPCrack")) { var f = findComp("entropy01").files.root.folders[2]; f.files.Add(new FileEntry(PortExploits.crackExeData[25], Utils.GetNonRepeatingFilename("SMTPoverflow", ".exe", f))); os.saveGame(); } else if (name.Equals("transitionToBitMissions")) { if (Settings.isDemoMode) { runCommand(6, "changeSong"); if (Settings.isPressBuildDemo) ComputerLoader.loadMission("Content/Missions/Demo/PressBuild/DemoMission01.xml"); else ComputerLoader.loadMission("Content/Missions/Demo/AvconDemo.xml"); } else ComputerLoader.loadMission("Content/Missions/BitMission0.xml"); } else if (name.Equals("entropySendCSECInvite")) os.delayer.Post(ActionDelayer.Wait(6.0), () => ComputerLoader.loadMission("Content/Missions/MainHub/Intro/Intro01.xml")); else if (name.Equals("hubBitSetComplete01")) { os.delayer.Post(ActionDelayer.Wait(4.0), () => runCommand(1, "addRank")); runCommand(3, "changeSong"); os.Flags.AddFlag("csecBitSet01Complete"); } else if (name.Equals("enTechEnableOfflineBackup")) { var computer = Programs.getComputer(os, "EnTechOfflineBackup"); Programs.getComputer(os, "EnTechMainframe").links.Add(os.netMap.nodes.IndexOf(computer)); os.Flags.AddFlag("VaporSequencerEnabled"); var folder1 = findComp("mainHubAssets").files.root.searchForFolder("bin"); var folder2 = folder1.searchForFolder("Sequencer"); if (folder2 == null) { folder2 = new Folder("Sequencer"); folder1.folders.Add(folder2); } if (folder2.searchForFile("Sequencer.exe") != null) return; folder2.files.Add(new FileEntry(PortExploits.crackExeData[17], "Sequencer.exe")); } else if (name.Equals("rudeNaixResponse")) AchievementsManager.Unlock("rude_response", false); else if (name.Equals("assignPlayerToHubServerFaction")) { os.allFactions.setCurrentFaction("hub", os); var computer = Programs.getComputer(os, "mainHub"); var missionHubServer = (MissionHubServer) computer.getDaemon(typeof (MissionHubServer)); var userDetail = new UserDetail(os.defaultUser.name, "reptile", 3); computer.addNewUser(computer.ip, userDetail); missionHubServer.addUser(userDetail); os.homeNodeID = "mainHub"; os.homeAssetServerID = "mainHubAssets"; runCommand(3, "changeSong"); os.Flags.AddFlag("CSEC_Member"); AchievementsManager.Unlock("progress_csec", false); } else if (name.Equals("assignPlayerToEntropyFaction")) { runCommand(6, "changeSong"); AchievementsManager.Unlock("progress_entropy", false); } else if (name.Equals("assignPlayerToLelzSec")) { os.homeNodeID = "lelzSecHub"; os.homeAssetServerID = "lelzSecHub"; os.Flags.AddFlag("LelzSec_Member"); AchievementsManager.Unlock("progress_lelz", false); } else if (name.Equals("lelzSecVictory")) AchievementsManager.Unlock("secret_path_complete", false); else if (name.Equals("demoFinalMissionEnd")) { os.exes.Clear(); PostProcessor.EndingSequenceFlashOutActive = true; PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f; MusicManager.stop(); os.delayer.Post(ActionDelayer.Wait(0.2), () => os.content.Load<SoundEffect>("Music/Ambient/spiral_gauge_down").Play()); os.delayer.Post(ActionDelayer.Wait(3.0), () => { PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; os.ExitScreen(); os.ScreenManager.AddScreen(new DemoEndScreen()); }); } else if (name.Equals("demoFinalMissionStart")) { os.Flags.AddFlag("DemoSequencerEnabled"); MusicManager.transitionToSong("Music/Ambient/dark_drone_008"); } else if (name.Equals("CSECTesterGameWorldSetup")) { for (var index = 0; index < PortExploits.services.Count && index < 4; ++index) os.thisComputer.files.root.folders[2].files.Add( new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]])); for (var index = 0; index < 4; ++index) { var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, 2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.delayer.Post(ActionDelayer.Wait(0.2), () => { os.allFactions.setCurrentFaction("entropy", os); os.currentMission = null; os.netMap.discoverNode(Programs.getComputer(os, "entropy00")); os.netMap.discoverNode(Programs.getComputer(os, "entropy01")); }); } else if (name.Equals("EntropyFastFowardSetup")) { os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21])); for (var index = 0; index < 3; ++index) { var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, 2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.delayer.Post(ActionDelayer.Wait(0.2), () => { os.allFactions.setCurrentFaction("entropy", os); os.currentMission = null; os.netMap.discoverNode(Programs.getComputer(os, "entropy00")); os.netMap.discoverNode(Programs.getComputer(os, "entropy01")); var computer = Programs.getComputer(os, "entropy01"); var userDetail = computer.users[0]; userDetail.known = true; computer.users[0] = userDetail; os.allFactions.factions[os.allFactions.currentFaction].playerValue = 2; os.delayer.Post(ActionDelayer.Wait(0.2), () => { os.Flags.AddFlag("eosPathStarted"); ComputerLoader.loadMission( "Content/Missions/Entropy/StartingSet/eosMissions/eosIntroDelayer.xml"); }); }); } else if (name.Equals("CSECFastFowardSetup")) { os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], PortExploits.cracks[22])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], PortExploits.cracks[21])); for (var index = 0; index < 3; ++index) { var c = new Computer("DebugShell" + index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, 2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.delayer.Post(ActionDelayer.Wait(0.2), () => { runCommand(0, "assignPlayerToHubServerFaction"); os.currentMission = null; os.netMap.discoverNode(Programs.getComputer(os, "mainHub")); os.netMap.discoverNode(Programs.getComputer(os, "mainHubAssets")); var computer = Programs.getComputer(os, "mainHubAssets"); var userDetail = computer.users[0]; userDetail.known = true; computer.users[0] = userDetail; }); } else if (name.Equals("csecAddTraceKill")) { var folder = findComp("mainHubAssets").files.root.searchForFolder("bin"); var f = folder.searchForFolder("TK"); if (f == null) { f = new Folder("TK"); folder.folders.Add(f); } f.files.Add( new FileEntry( FileEncrypter.EncryptString(PortExploits.crackExeData[12], "Vapor Trick Enc.", "NULL", "dx122DX", ".exe"), Utils.GetNonRepeatingFilename("TraceKill", ".dec", f))); os.Flags.AddFlag("bitPathStarted"); runCommand(10, "changeSong"); } else if (name.Equals("junebugComplete")) { var computer = Programs.getComputer(os, "pacemaker01"); if (computer != null) { var heartMonitorDaemon = (HeartMonitorDaemon) computer.getDaemon(typeof (HeartMonitorDaemon)); if (heartMonitorDaemon != null) heartMonitorDaemon.ForceStopBeepSustainSound(); } runCommand(1, "addRank"); } else if (name.Equals("eosIntroMissionSetup")) { findComp("entropy01") .files.root.searchForFolder("bin") .files.Add(new FileEntry(PortExploits.crackExeData[13], "eosDeviceScan.exe")); os.delayer.Post(ActionDelayer.Wait(8.0), () => { var mail = MailServer.generateEmail("Fwd: eOS Stuff", Utils.readEntireFile("Content/Post/eosScannerMail.txt"), "vtfx", new List<string>(new string[1] { "note#%#eOS Security Basics#%#" + ("1: Get admin access to a computer that you suspect has an eOS device sync'd to it\n" + "2: Run eosdevicescanner.exe\nto scan for paired devices and automatically open connection ports\n" + "3: connect to the revealed device\n" + "3: login with\nuser: \"admin\"\npassword: \"alpine\"\n\n" + "The password is the same for all eOS devices!") })); ((MailServer) os.netMap.mailServer.getDaemon(typeof (MailServer))).addMail(mail, os.defaultUser.name); }); runCommand(4, "changeSong"); os.saveGame(); } else { if (!name.Equals("eosIntroEndFunc")) return; runCommand(1, "addRank"); var missionListingServer = (MissionListingServer) findComp("entropy00").getDaemon(typeof (MissionListingServer)); var list = os.branchMissions; var m = (ActiveMission) ComputerLoader.readMission( "Content/Missions/Entropy/StartingSet/eosMissions/eosAddedMission.xml"); missionListingServer.addMisison(m); os.branchMissions = list; } }
public static bool ExecuteProgram(object os_object, string[] arguments) { OS os = (OS)os_object; string[] strArray = arguments; bool flag1 = true; if (strArray[0].ToLower().Equals("connect")) { Programs.connect(strArray, os); flag1 = false; } else if (strArray[0].Equals("disconnect") || strArray[0].Equals("dc")) { Programs.disconnect(strArray, os); } else if (strArray[0].Equals("ls") || strArray[0].Equals("dir")) { Programs.ls(strArray, os); } else if (strArray[0].Equals("cd")) { Programs.cd(strArray, os); } else if (strArray[0].Equals("cd..")) { strArray = new string[2] { "cd", ".." }; Programs.cd(strArray, os); } else if (strArray[0].Equals("cat") || strArray[0].Equals("more") || strArray[0].Equals("less")) { Programs.cat(strArray, os); } else if (strArray[0].Equals("exe")) { Programs.execute(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("probe") || strArray[0].Equals("nmap")) { Programs.probe(strArray, os); } else if (strArray[0].Equals("scp")) { Programs.scp(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("scan")) { Programs.scan(strArray, os); flag1 = false; } else if (strArray[0].Equals("rm") || strArray[0].Equals("del")) { Programs.rm(strArray, os); flag1 = false; } else if (strArray[0].Equals("mv")) { Programs.mv(strArray, os); flag1 = false; } else if (strArray[0].Equals("ps")) { Programs.ps(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("kill") || strArray[0].Equals("pkill")) { Programs.kill(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("reboot")) { Programs.reboot(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("opencdtray")) { Programs.opCDTray(strArray, os, true); flag1 = false; } else if (strArray[0].ToLower().Equals("closecdtray")) { Programs.opCDTray(strArray, os, false); flag1 = false; } else if (strArray[0].Equals("replace")) { Programs.replace2(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("analyze")) { Programs.analyze(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("solve")) { Programs.solve(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("clear")) { Programs.clear(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("upload") || strArray[0].Equals("up")) { Programs.upload(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("login")) { Programs.login(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("addnote")) { Programs.addNote(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals(":(){:|:&};:")) { ProgramRunner.ExecuteProgram((object)os, new string[1] { "forkbomb" }); } else if (strArray[0].ToLower().Equals("append")) { flag1 = false; string[] quoteSeperatedArgs = Utils.GetQuoteSeperatedArgs(strArray); Folder currentFolder = Programs.getCurrentFolder(os); if (quoteSeperatedArgs.Length > 1) { FileEntry fileEntry1 = currentFolder.searchForFile(quoteSeperatedArgs[1]); int num = 2; if (fileEntry1 == null) { fileEntry1 = currentFolder.searchForFile(os.display.commandArgs[1]); if (fileEntry1 == null) { os.write("Usage: append [FILENAME] [LINE TO APPEND]"); return(flag1); } os.write("No filename provided"); os.write("Assuming active flag file \"" + fileEntry1.name + "\" For editing"); if (strArray.Length == 1) { strArray = new string[2] { "append", fileEntry1.name } } ; else { strArray[1] = fileEntry1.name; } num = 1; } if (fileEntry1 != null) { string str1 = ""; for (int index = num; index < quoteSeperatedArgs.Length; ++index) { str1 = str1 + quoteSeperatedArgs[index] + " "; } FileEntry fileEntry2 = fileEntry1; string str2 = fileEntry2.data + "\n" + str1; fileEntry2.data = str2; flag1 = true; strArray[0] = "cat"; strArray[1] = fileEntry1.name; for (int index = 2; index < strArray.Length; ++index) { strArray[index] = ""; } Programs.cat(strArray, os); } } else { os.write("Usage: append [FILENAME] [LINE TO APPEND]"); return(flag1); } } else if (strArray[0].Equals("remline")) { FileEntry fileEntry = Programs.getCurrentFolder(os).searchForFile(strArray[1]); if (fileEntry != null) { int length = fileEntry.data.LastIndexOf('\n'); if (length < 0) { length = 0; } fileEntry.data = fileEntry.data.Substring(0, length); flag1 = true; strArray[0] = "cat"; for (int index = 2; index < strArray.Length; ++index) { strArray[index] = ""; } Programs.cat(strArray, os); } } else if (strArray[0].Equals("getString")) { Programs.getString(strArray, os); flag1 = false; } else if (strArray[0].ToLower().Equals("reloadtheme")) { FileEntry fileEntry = os.thisComputer.files.root.searchForFolder("sys").searchForFile("x-server.sys"); if (fileEntry != null) { OSTheme themeForDataString = ThemeManager.getThemeForDataString(fileEntry.data); ThemeManager.switchTheme((object)os, themeForDataString); } flag1 = false; } else if (strArray[0].Equals("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj")) { Programs.firstTimeInit(strArray, os, false); flag1 = false; } else if (strArray[0].Equals("chat")) { string message = "chat " + os.username + " "; for (int index = 1; index < strArray.Length; ++index) { message = message + strArray[index] + " "; } if (os.multiplayer) { os.sendMessage(message); } flag1 = false; } else if ((strArray[0].Equals("exitdemo") || strArray[0].Equals("resetdemo")) && Settings.isDemoMode) { MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped"); MainMenu mainMenu = new MainMenu(); os.ScreenManager.AddScreen((GameScreen)mainMenu); MainMenu.resetOS(); os.ExitScreen(); OS.currentInstance = (OS)null; flag1 = false; if (Settings.MultiLingualDemo) { LocaleActivator.ActivateLocale("zh-cn", Game1.getSingleton().Content); } } else if (strArray[0].Equals("fh") && OS.DEBUG_COMMANDS) { Programs.fastHack(strArray, os); flag1 = false; } else if (strArray[0].Equals("ra") && OS.DEBUG_COMMANDS) { Programs.revealAll(strArray, os); flag1 = false; } else if (strArray[0].Equals("deathseq") && OS.DEBUG_COMMANDS) { os.TraceDangerSequence.BeginTraceDangerSequence(); flag1 = false; } else if (strArray[0].Equals("testcredits") && OS.DEBUG_COMMANDS) { os.endingSequence.IsActive = true; flag1 = false; } else if (strArray[0].Equals("addflag") && OS.DEBUG_COMMANDS) { if (strArray.Length < 2) { os.write("\nFlag to add required\n"); } os.Flags.AddFlag(strArray[1]); flag1 = false; } else if (strArray[0].Equals("addTestEmails") && OS.DEBUG_COMMANDS) { for (int index = 0; index < 4; ++index) { ((MailServer)os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(MailServer.generateEmail("testEmail " + (object)index + " " + Utils.getRandomByte().ToString(), "test", "test"), os.defaultUser.name); } flag1 = false; } else if (strArray[0].Equals("dscan") && OS.DEBUG_COMMANDS) { if (strArray.Length < 2) { os.write("\nNode ID Required\n"); } bool flag2 = false; for (int index = 0; index < os.netMap.nodes.Count; ++index) { if (os.netMap.nodes[index].idName.ToLower().StartsWith(strArray[1].ToLower())) { os.netMap.discoverNode(os.netMap.nodes[index]); os.netMap.nodes[index].highlightFlashTime = 1f; flag2 = true; break; } } if (!flag2) { os.write("Node ID Not found"); } flag1 = false; } else if (strArray[0].Equals("revmany") && OS.DEBUG_COMMANDS) { for (int index1 = 0; index1 < 60; ++index1) { int index2; do { index2 = Utils.random.Next(os.netMap.nodes.Count); }while (os.netMap.nodes[index2].idName == "mainHub" || os.netMap.nodes[index2].idName == "entropy00" || os.netMap.nodes[index2].idName == "entropy01"); os.netMap.discoverNode(os.netMap.nodes[index2]); } os.netMap.lastAddedNode = os.thisComputer; os.homeAssetServerID = "dhsDrop"; os.homeNodeID = "dhs"; os.netMap.discoverNode(Programs.getComputer(os, "dhs")); os.netMap.discoverNode(Programs.getComputer(os, "dhsDrop")); flag1 = false; } else if (strArray[0].ToLower().Equals("reloadext") && OS.DEBUG_COMMANDS) { if (Settings.IsInExtensionMode) { ExtensionLoader.ReloadExtensionNodes((object)os); } flag1 = false; } else if (strArray[0].Equals("testsave") && OS.DEBUG_COMMANDS || strArray[0].Equals("save!(SJN!*SNL8vAewew57WewJdwl89(*4;;;&!)@&(ak'^&#@J3KH@!*")) { os.threadedSaveExecute(false); SettingsLoader.writeStatusFile(); flag1 = false; } else if (strArray[0].Equals("testload") && OS.DEBUG_COMMANDS) { flag1 = false; } else if (strArray[0].Equals("teststrikerhack") && OS.DEBUG_COMMANDS) { os.delayer.Post(ActionDelayer.Wait(3.0), (Action)(() => MissionFunctions.runCommand(1, "triggerDLCHackRevenge"))); flag1 = false; } else if (strArray[0].Equals("linkToCSECPostDLC") && OS.DEBUG_COMMANDS) { os.execute("dscan mainhub"); os.allFactions.setCurrentFaction("hub", os); os.currentFaction.playerValue = 2; os.Flags.AddFlag("dlc_complete"); os.Flags.AddFlag("dlc_csec_end_facval:0"); MissionFunctions.runCommand(1, "addRank"); flag1 = false; } else if (strArray[0].Equals("debug") && OS.DEBUG_COMMANDS) { int num = PortExploits.services.Count; if (strArray.Length > 1) { try { num = Convert.ToInt32(strArray[1]); } catch (Exception ex) { } } for (int index = 0; index < PortExploits.services.Count && index <= num; ++index) { os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[PortExploits.portNums[index]], PortExploits.cracks[PortExploits.portNums[index]])); } os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[9], PortExploits.cracks[9])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[10], PortExploits.cracks[10])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[11], PortExploits.cracks[11])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[12], PortExploits.cracks[12])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[13], PortExploits.cracks[13])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[14], PortExploits.cracks[14])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[15], PortExploits.cracks[15])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[16], PortExploits.cracks[16])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[17], PortExploits.cracks[17])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[31], PortExploits.cracks[31])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[33], PortExploits.cracks[33])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[34], PortExploits.cracks[34])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[35], PortExploits.cracks[35])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[36], PortExploits.cracks[36])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[37], PortExploits.cracks[37])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[38], PortExploits.cracks[38])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[39], PortExploits.cracks[39])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[41], PortExploits.cracks[41])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[554], PortExploits.cracks[554])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[40], PortExploits.cracks[40])); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.DangerousPacemakerFirmware, "KBT_TestFirmware.dll")); os.Flags.AddFlag("dechead"); os.Flags.AddFlag("decypher"); os.Flags.AddFlag("csecBitSet01Complete"); os.Flags.AddFlag("csecRankingS2Pass"); os.Flags.AddFlag("CSEC_Member"); os.Flags.AddFlag("bitPathStarted"); flag1 = false; for (int index = 0; index < 4; ++index) { Computer c = new Computer("DebugShell" + (object)index, NetworkMap.generateRandomIP(), os.netMap.getRandomPosition(), 0, (byte)2, os); c.adminIP = os.thisComputer.adminIP; os.netMap.nodes.Add(c); os.netMap.discoverNode(c); } os.netMap.discoverNode("practiceServer"); os.netMap.discoverNode("entropy00"); } else if (strArray[0].Equals("flash") && OS.DEBUG_COMMANDS) { os.traceTracker.start(40f); os.warningFlash(); flag1 = false; os.IncConnectionOverlay.Activate(); } else if (strArray[0].Equals("cycletheme") && OS.DEBUG_COMMANDS) { Action <OSTheme> ctheme = (Action <OSTheme>)(theme => ThemeManager.switchTheme((object)os, theme)); int next = 1; double delay = 1.2; Action cthemeAct = (Action)(() => { ctheme((OSTheme)next); next = (next + 1) % 7; }); cthemeAct += (Action)(() => os.delayer.Post(ActionDelayer.Wait(delay), cthemeAct)); cthemeAct(); } else if (strArray[0].Equals("testdlc") && OS.DEBUG_COMMANDS) { MissionFunctions.runCommand(0, "demoFinalMissionEndDLC"); flag1 = false; } else if (strArray[0].Equals("testircentries") && OS.DEBUG_COMMANDS) { DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer; for (int index = 0; index < 100; ++index) { daemon.IRCSystem.AddLog("Test", "Test Message\nMultiline\nMessage", (string)null); } flag1 = false; } else if (strArray[0].Equals("testirc") && OS.DEBUG_COMMANDS) { DLCHubServer daemon = Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer)) as DLCHubServer; daemon.IRCSystem.AddLog("Test", "Test Message", (string)null); daemon.IRCSystem.AddLog("Channel", "Test Message\nfrom channel", (string)null); flag1 = false; } else if (strArray[0].Equals("flashtest") && OS.DEBUG_COMMANDS) { if (!PostProcessor.dangerModeEnabled) { PostProcessor.dangerModeEnabled = true; PostProcessor.dangerModePercentComplete = 0.5f; } else { PostProcessor.dangerModeEnabled = false; PostProcessor.dangerModePercentComplete = 0.0f; } flag1 = false; } else if (strArray[0].Equals("dectest") && OS.DEBUG_COMMANDS) { string str1 = "this is a test message for the encrypter"; string str2 = FileEncrypter.EncryptString(str1, "header message", "1.2.3.4.5", "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass", (string)null); os.write(str1); os.write(" "); os.write(" "); os.write(str2); os.write(" "); os.write(" "); os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongpass")[2])); os.write(" "); os.write(FileEncrypter.MakeReplacementsForDisplay(FileEncrypter.DecryptString(str2, "wrongPass")[2] == null ? "NULL" : "CORRECT")); os.write(" "); } else if (strArray[0].Equals("test") && OS.DEBUG_COMMANDS) { ((DLCHubServer)Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer))).AddMission((ActiveMission)ComputerLoader.readMission("Content/DLC/Missions/Attack/AttackMission.xml"), (string)null, false); } else if (strArray[0].Equals("testtrace") && OS.DEBUG_COMMANDS) { MissionFunctions.runCommand(1, "triggerDLCHackRevenge"); } else if (strArray[0].Equals("testboot") && OS.DEBUG_COMMANDS) { os.BootAssitanceModule.IsActive = true; os.bootingUp = false; os.canRunContent = false; MusicManager.stop(); } else if (strArray[0].Equals("testhhbs") && OS.DEBUG_COMMANDS) { os.write(HostileHackerBreakinSequence.IsInBlockingHostileFileState((object)os) ? "BLOCKED" : "SAFE"); } else if (strArray[0].Equals("printflags") && OS.DEBUG_COMMANDS) { os.write(os.Flags.GetSaveString()); } else if (strArray[0].Equals("loseadmin") && OS.DEBUG_COMMANDS) { os.connectedComp.adminIP = os.connectedComp.ip; flag1 = false; } else if (strArray[0].Equals("runcmd") && OS.DEBUG_COMMANDS) { if (strArray.Length > 1) { string name = strArray[1]; int num = 0; if (strArray.Length > 2) { num = Convert.ToInt32(strArray[1]); } MissionFunctions.runCommand(num, name); } } else if (strArray[0].ToLower().Equals("runhackscript") && OS.DEBUG_COMMANDS) { if (strArray.Length > 1) { string scriptName = strArray[1]; try { HackerScriptExecuter.runScript(scriptName, (object)os, os.thisComputer.ip, os.thisComputer.ip); } catch (Exception ex) { os.write("Error launching script " + scriptName); os.write(Utils.GenerateReportFromExceptionCompact(ex)); } } } else if (strArray[0].Equals("MotIsTheBest") && OS.DEBUG_COMMANDS) { os.runCommand("probe"); os.runCommand("exe WebServerWorm 80"); os.runCommand("exe SSHcrack 22"); os.runCommand("exe SMTPoverflow 25"); os.runCommand("exe FTPBounce 21"); } else if (strArray[0].Equals("help") || strArray[0].Equals("Help") || strArray[0].Equals("?") || strArray[0].Equals("man")) { int page = 0; if (strArray.Length > 1) { try { page = Convert.ToInt32(strArray[1]); if (page > Helpfile.getNumberOfPages()) { os.write("Invalid Page Number - Displaying First Page"); page = 0; } } catch (FormatException ex) { os.write("Invalid Page Number"); } catch (OverflowException ex) { os.write("Invalid Page Number"); } } Helpfile.writeHelp(os, page); flag1 = false; } else { if (strArray[0] != "") { int num = ProgramRunner.AttemptExeProgramExecution(os, strArray); if (num == 0) { os.write("Execution failed"); } else if (num < 0) { os.write("No Command " + strArray[0] + " - Check Syntax\n"); } } flag1 = false; } if (flag1) { if (!os.commandInvalid) { os.display.command = strArray[0]; os.display.commandArgs = strArray; os.display.typeChanged(); } else { os.commandInvalid = false; } } return(flag1); }
public static object restoreMissionFromFile(string data, out int contractRegistryNumber) { var separator = new string[1] { " #%#\n" }; var strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries); string str1; var str2 = str1 = "unknown"; var str3 = str1; var str4 = str1; var str5 = str1; var str6 = str1; var str7 = str1; var str8 = str1; var filename = str1; var flag = false; int num1; var num2 = num1 = 0; for (var index = 0; index < strArray.Length; ++index) { if (!strArray[index].StartsWith("//")) { var line = strArray[index]; if (line.StartsWith("Code")) { filename = decodeString(getDataFromConfigLine(line, "= ")); } else if (line.StartsWith("Client")) { str8 = getDataFromConfigLine(line, "= "); } else if (line.StartsWith("Target")) { str7 = getDataFromConfigLine(line, "= "); } else if (line.StartsWith("E_TargetTrack")) { str6 = decodeString(getDataFromConfigLine(line, "= ")); } else if (line.StartsWith("E_TargetTaskData")) { str5 = decodeString(getDataFromConfigLine(line, "= ")); } else if (line.StartsWith("E_TargetTaskTrack")) { str4 = decodeString(getDataFromConfigLine(line, "= ")); } else if (line.StartsWith("E2_TargetTaskTrack_1")) { str3 = decodeString(getDataFromConfigLine(line, "= ")); } else if (line.StartsWith("E3_TargetTaskTrack_2")) { str2 = decodeString(getDataFromConfigLine(line, "= ")); } else if (line.StartsWith("E3_TargetTaskTrack_3")) { flag = getDataFromConfigLine(line, "= ") == "gen"; } else if (line.StartsWith("Rank")) { try { num2 = Convert.ToInt32(getDataFromConfigLine(line, "= ")); } catch (FormatException ex) { contractRegistryNumber = 0; } catch (OverflowException ex) { contractRegistryNumber = 0; } } else if (line.StartsWith("Difficulty")) { try { num1 = Convert.ToInt32(getDataFromConfigLine(line, "= ")); } catch (FormatException ex) { contractRegistryNumber = 0; } catch (OverflowException ex) { contractRegistryNumber = 0; } } } } MissionGenerationParser.Client = str8; MissionGenerationParser.Comp = str6; MissionGenerationParser.File = str5; MissionGenerationParser.Path = str4; var activeMission = (ActiveMission)ComputerLoader.readMission(filename); activeMission.genFile = str5; activeMission.genPath = str4; activeMission.genTarget = str6; activeMission.genTargetName = str3; activeMission.genOther = str2; activeMission.target = str7; activeMission.client = str8; activeMission.requiredRank = num2; activeMission.difficulty = num1; activeMission.wasAutoGenerated = flag; contractRegistryNumber = 1; return(activeMission); }
public static object load(XmlReader reader) { while (reader.Name != "mission") { reader.Read(); } reader.MoveToAttribute("next"); string next = reader.ReadContentAsString(); reader.MoveToAttribute("goals"); string filename = reader.ReadContentAsString(); if (reader.MoveToAttribute("genTarget")) { string str1 = reader.ReadContentAsString(); reader.MoveToAttribute("genFile"); string str2 = reader.ReadContentAsString(); reader.MoveToAttribute("genPath"); string str3 = reader.ReadContentAsString(); reader.MoveToAttribute("genTargetName"); string str4 = reader.ReadContentAsString(); reader.MoveToAttribute("genOther"); string str5 = reader.ReadContentAsString(); MissionGenerationParser.Comp = str1; MissionGenerationParser.File = str2; MissionGenerationParser.Path = str3; MissionGenerationParser.Target = str4; MissionGenerationParser.Other = str5; } reader.MoveToAttribute("activeChack"); int num1 = 0; if (reader.MoveToAttribute("reqRank")) { num1 = reader.ReadContentAsInt(); } bool flag = reader.ReadContentAsString().ToLower().Equals("true"); if (next == "NULL_MISSION") { return((object)null); } if (!Settings.IsInExtensionMode && !filename.StartsWith("Content")) { filename = "Content/" + filename; } List <MisisonGoal> _goals = new List <MisisonGoal>(); ActiveMission activeMission1 = new ActiveMission(new List <MisisonGoal>(), "NONE", new MailServer.EMailData("Unknown", "Unknown", "Unknown", new List <string>())); try { activeMission1 = (ActiveMission)ComputerLoader.readMission(filename); _goals = activeMission1.goals; flag = flag || activeMission1.activeCheck; } catch (Exception ex) { Utils.SendRealWorldEmail("Mission Load Error", "*****@*****.**", "Hacknet " + MainMenu.OSVersion + "\r\n" + Utils.GenerateReportFromException(ex)); } string sendr = "ERRORBOT"; string subj = "ERROR"; string bod = "ERROR :: MAIL LOAD FAILED"; while (reader.Name != "email" && reader.Name != "endFunc") { reader.Read(); } if (reader.Name.Equals("email")) { if (reader.MoveToAttribute("sender")) { sendr = Folder.deFilter(reader.ReadContentAsString()); } if (reader.MoveToAttribute("subject")) { subj = Folder.deFilter(reader.ReadContentAsString()); } int content = (int)reader.MoveToContent(); bod = Folder.deFilter(reader.ReadElementContentAsString()); } MailServer.EMailData _email = new MailServer.EMailData(sendr, bod, subj, activeMission1.email.attachments); ActiveMission activeMission2 = new ActiveMission(_goals, next, _email); activeMission2.activeCheck = flag; activeMission2.reloadGoalsSourceFile = filename; activeMission2.requiredRank = num1; while (reader.Name != "endFunc") { reader.Read(); } reader.MoveToAttribute("val"); int num2 = reader.ReadContentAsInt(); reader.MoveToAttribute("name"); string str6 = reader.ReadContentAsString(); activeMission2.endFunctionName = str6; activeMission2.endFunctionValue = num2; while (reader.Name != "posting") { reader.Read(); } reader.MoveToAttribute("title"); string str7 = Folder.deFilter(reader.ReadContentAsString()); int content1 = (int)reader.MoveToContent(); string str8 = Folder.deFilter(reader.ReadElementContentAsString()); activeMission2.postingTitle = str7; activeMission2.postingBody = str8; return((object)activeMission2); }
public override void draw(Rectangle bounds, SpriteBatch sb) { base.draw(bounds, sb); PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2), 0.28f, Color.Transparent, this.themeColor * 0.1f, sb, PatternDrawer.thinStripe); this.drawTopBar(bounds, sb); if (!this.hasSysfile()) { if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor))) { this.os.display.command = "connect"; } PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1 + 64, bounds.Width - 2, bounds.Height - 2 - 64), 1f, Color.Transparent, this.os.lockedColor, sb, PatternDrawer.errorTile); int num1 = bounds.X + 20; int num2 = bounds.Y + bounds.Height / 2 - 20; TextItem.doLabel(new Vector2((float)num1, (float)num2), LocaleTerms.Loc("CRITICAL ERROR"), new Color?()); int num3 = num2 + 40; TextItem.doSmallLabel(new Vector2((float)num1, (float)num3), "ERROR #4040408 - NULL_SYSFILE\nUnhandled Exception - IOException@L 2217 :R 28\nSystem Files Corrupted and/or Destroyed\nContact the System Administrator", new Color?()); } else { switch (this.state) { case 0: if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor))) { this.os.display.command = "connect"; } sb.Draw(this.logo, new Rectangle(bounds.X + 30, bounds.Y + 115, 128, 128), Color.White); string text1 = string.IsNullOrWhiteSpace(this.listingTitle) ? string.Format(LocaleTerms.Loc("{0} Group"), (object)this.groupName) + "\n" + LocaleTerms.Loc("Message Board") : this.listingTitle; TextItem.doFontLabel(new Vector2((float)(bounds.X + 40 + 128), (float)(bounds.Y + 115)), text1, GuiData.font, new Color?(), (float)(bounds.Width - 40), 60f, false); if (!Button.doButton(800004, bounds.X + 30, bounds.Y + bounds.Height / 2, 300, 40, LocaleTerms.Loc("Login"), new Color?(this.themeColor))) { break; } this.startLogin(); this.state = 3; break; case 1: if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor))) { this.os.display.command = "connect"; } int num4 = bounds.X + 10; int num5 = bounds.Y + this.topBar.Height + 50; this.logoRect.X = num4; this.logoRect.Y = num5; sb.Draw(this.logo, this.logoRect, Color.White); int x = num4 + (this.logoRect.Width + 5); TextItem.doLabel(new Vector2((float)x, (float)num5), this.listingTitle, new Color?()); int y = num5 + 40; for (int index = 0; index < this.missions.Count; ++index) { if (this.hasListingFile(this.missions[index].postingTitle)) { Rectangle rectangle = new Rectangle(x, y, (int)((double)bounds.Width * 0.800000011920929), 30); rectangle = Utils.InsetRectangle(rectangle, 1); rectangle.X += 12; rectangle.Width -= 12; if (this.missions[index].postingTitle.StartsWith("#")) { PatternDrawer.draw(rectangle, 1f, Color.Black * 1f, Color.DarkRed * 0.3f, sb, PatternDrawer.warningStripe); } if (Button.doButton(87654 + index, x, y, (int)((double)bounds.Width * 0.800000011920929), 30, this.missions[index].postingTitle, new Color?())) { this.state = 2; this.targetIndex = index; } y += 35; } } break; case 2: if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Back"), new Color?(this.themeColor))) { this.state = 1; } int num6 = 60; int num7 = 84; Rectangle destinationRectangle = new Rectangle(bounds.X + 30, bounds.Y + this.topBar.Height + num6, num7, num7); sb.Draw(this.logo, destinationRectangle, this.themeColor); int num8 = num6 + 30; TextItem.doFontLabel(new Vector2((float)(bounds.X + 34 + num7), (float)(bounds.Y + this.topBar.Height + num8)), this.missions[this.targetIndex].postingTitle, GuiData.font, new Color?(), (float)(bounds.Width - (36 + num7 + 6)), 40f, false); int num9 = num8 + 40; PatternDrawer.draw(new Rectangle(destinationRectangle.X + destinationRectangle.Width + 2, bounds.Y + this.topBar.Height + num9 - 8, bounds.Width - (destinationRectangle.X - bounds.X + destinationRectangle.Width + 10), PatternDrawer.warningStripe.Height / 2), 1f, Color.Transparent, this.themeColor, sb, PatternDrawer.warningStripe); int num10 = num9 + 36; string text2 = Utils.SuperSmartTwimForWidth(this.missions[this.targetIndex].postingBody, bounds.Width - 60, GuiData.tinyfont); if (this.TextRegion == null) { this.TextRegion = new ScrollableTextRegion(sb.GraphicsDevice); } this.TextRegion.Draw(new Rectangle(bounds.X + 30, bounds.Y + this.topBar.Height + num10, bounds.Width - 50, bounds.Height - num10 - this.topBar.Height - 10), text2, sb); bool flag = this.os.currentFaction != null && this.os.currentFaction.idName.ToLower() == this.groupName.ToLower(); if (this.missionAssigner && this.os.currentMission == null && flag && Button.doButton(800005, bounds.X + bounds.Width / 2 - 10, bounds.Y + bounds.Height - 35, bounds.Width / 2, 30, LocaleTerms.Loc("Accept"), new Color?(this.os.highlightColor))) { this.os.currentMission = this.missions[this.targetIndex]; ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(this.missions[this.targetIndex].reloadGoalsSourceFile); this.missions[this.targetIndex].sendEmail(this.os); this.missions[this.targetIndex].ActivateSuppressedStartFunctionIfPresent(); this.removeMission(this.targetIndex); this.state = 1; break; } if (this.missionAssigner && this.os.currentMission != null) { if (this.os.currentMission.wasAutoGenerated && Button.doButton(8000105, bounds.X + 6, bounds.Y + bounds.Height - 29, 210, 25, LocaleTerms.Loc("Abandon Current Contract"), new Color?(this.os.lockedColor))) { this.os.currentMission = (ActiveMission)null; this.os.currentFaction.contractAbbandoned((object)this.os); } TextItem.doFontLabel(new Vector2((float)(bounds.X + 10), (float)(bounds.Y + bounds.Height - 52)), LocaleTerms.Loc("Mission Unavailable") + " : " + (flag ? LocaleTerms.Loc("Complete Existing Contracts") : LocaleTerms.Loc("User ID Assigned to Different Faction") + " "), GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), 30f, false); break; } if (!this.missionAssigner || flag) { break; } TextItem.doFontLabel(new Vector2((float)(bounds.X + 10), (float)(bounds.Y + bounds.Height - 52)), LocaleTerms.Loc("Mission Unavailable") + " : " + LocaleTerms.Loc("User ID Assigned to Different Faction") + " ", GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), 30f, false); break; case 3: this.doLoginDisplay(bounds, sb); break; } } }
public static string TestMission(string missionName, object os_obj) { string str1 = ""; OS os = (OS)os_obj; if (TestSuite.TestedMissionNames.Contains(missionName)) { return(str1); } try { if (!File.Exists(missionName)) { str1 = str1 + "Invalid Mission Path! : " + missionName + "\r\n"; } ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(missionName); TestSuite.ActiveObjectID = missionName; string str2 = ""; for (int index = 0; index < activeMission.goals.Count; ++index) { string str3 = activeMission.goals[index].TestCompletable(); if (str3 != null && str3.Length > 0) { str2 = str2 + missionName + " Goal[" + (object)index + "] " + activeMission.goals[index].ToString() + " :: " + str3 + "\r\n"; } } try { if (!string.IsNullOrWhiteSpace(activeMission.startFunctionName)) { if (!Utils.CheckStringIsRenderable(activeMission.startFunctionName)) { str1 = str1 + "Mission " + missionName + " has unrenderable start function " + Utils.CleanStringToRenderable(activeMission.startFunctionName); } MissionFunctions.runCommand(activeMission.startFunctionValue, activeMission.startFunctionName); } if (!string.IsNullOrWhiteSpace(activeMission.endFunctionName)) { if (!Utils.CheckStringIsRenderable(activeMission.endFunctionName)) { str1 = str1 + "Mission " + missionName + " has unrenderable end function " + Utils.CleanStringToRenderable(activeMission.endFunctionName); } MissionFunctions.runCommand(activeMission.endFunctionValue, activeMission.endFunctionName); } string str3 = Directory.GetCurrentDirectory() + "/"; string fileLoadPrefix = Utils.GetFileLoadPrefix(); if (fileLoadPrefix == "Content/") { fileLoadPrefix += "Missions/"; } else if (!fileLoadPrefix.StartsWith("Extensions")) { str3 = ""; } string path = str3 + LocalizedFileLoader.GetLocalizedFilepath(fileLoadPrefix + activeMission.nextMission); if (!(activeMission.nextMission == "NONE") && !File.Exists(path)) { str1 = str1 + "\r\nNextMission Tag for mission \"" + missionName + "\" has nonexistent next mission path: " + activeMission.nextMission + "\r\n"; } } catch (Exception ex) { str1 = str1 + "Error running start or end mission function of mission: " + missionName + "\r\nStart Func: " + activeMission.startFunctionName + "\r\nEnd Func: " + activeMission.endFunctionName; str1 = str1 + "\r\n" + Utils.GenerateReportFromException(ex) + "\r\n"; } if (str2.Length > 0) { str1 = str1 + str2 + "--------------\r\n"; } TestSuite.TestedMissionNames.Add(missionName); string str4 = "Content/Missions/"; if (Settings.IsInExtensionMode) { str4 = ExtensionLoader.ActiveExtensionInfo.FolderPath + "/"; } List <ActiveMission> activeMissionList = new List <ActiveMission>(); for (int index = 0; index < os.branchMissions.Count; ++index) { activeMissionList.Add(os.branchMissions[index]); } if (activeMission.nextMission != null && activeMission.nextMission.ToLower() != "none") { str1 += TestSuite.TestMission(str4 + activeMission.nextMission, (object)os); } for (int index = 0; index < activeMissionList.Count; ++index) { string localizedFilepath = LocalizedFileLoader.GetLocalizedFilepath(activeMissionList[index].reloadGoalsSourceFile); if (!TestSuite.TestedMissionNames.Contains(localizedFilepath)) { Console.WriteLine("testing Branch Mission " + localizedFilepath); str1 += TestSuite.TestMission(localizedFilepath, (object)os); } } } catch (Exception ex) { str1 = str1 + "Error Loading " + missionName + "\r\n" + ex.ToString(); } return(str1); }
/* ActiveMission.load */ private static ActiveMission LoadMission(ElementInfo info) { string nextMission = info.Attributes.GetValue("next"); if (nextMission == "NULL_MISSION") { return(null); } string goalsFile = info.Attributes.GetValue("goals"); string genTarget = info.Attributes.GetValue("genTarget"); if (!string.IsNullOrWhiteSpace(genTarget)) { MissionGenerationParser.Comp = genTarget; MissionGenerationParser.File = info.Attributes.GetValue("genFile"); MissionGenerationParser.Path = info.Attributes.GetValue("genPath"); MissionGenerationParser.Target = info.Attributes.GetValue("genTargetName"); MissionGenerationParser.Other = info.Attributes.GetValue("genOther"); } if (!Settings.IsInExtensionMode && !goalsFile.StartsWith("Content", StringComparison.Ordinal)) { goalsFile = "Content/" + goalsFile; } ActiveMission initMission; try { initMission = (ActiveMission)ComputerLoader.readMission(goalsFile); } catch (Exception ex) { /* TODO: Error reporting */ initMission = new ActiveMission( new List <MisisonGoal>(), "NONE", new MailServer.EMailData("Unknown", "Unknown", "Unknown", new List <string>()) ); } string sender = "ERRORBOT"; string subject = "ERROR"; string body = "ERROR :: MAIL LOAD FAILED"; var mailData = info.Children.FirstOrDefault(e => e.Name == "email"); if (mailData != null) { sender = Folder.deFilter(mailData.Attributes.GetValue("sender")); subject = Folder.deFilter(mailData.Attributes.GetValue("subject")); body = Folder.deFilter(mailData.Value); } var loadedMission = new ActiveMission( initMission.goals, nextMission, new MailServer.EMailData(sender, body, subject, initMission.email.attachments) ) { /* "activeCheck" check originally botched... twice. */ activeCheck = info.Attributes.GetBool("activeCheck") || initMission.activeCheck, reloadGoalsSourceFile = goalsFile, requiredRank = info.Attributes.GetInt("reqRank", 0) }; var endFuncData = info.Children.FirstOrDefault(e => e.Name == "endFunc"); if (endFuncData == null) { /* TODO: Error reporting */ } loadedMission.endFunctionName = endFuncData.Attributes.GetValue("name"); loadedMission.endFunctionValue = endFuncData.Attributes.GetInt("val"); var postingData = info.Children.FirstOrDefault(e => e.Name == "posting"); if (postingData == null) { /* TODO: Error reporting */ } loadedMission.postingTitle = Folder.deFilter(postingData.Attributes.GetValue("title")); loadedMission.postingBody = Folder.deFilter(postingData.Value); return(loadedMission); }
public override void addValue(int value, object os) { int playerValue = this.playerValue; base.addValue(value, os); if (this.valuePassedPoint(playerValue, 3)) { ((OS)os).Flags.AddFlag("eosPathStarted"); ComputerLoader.loadMission("Content/Missions/Entropy/StartingSet/eosMissions/eosIntroDelayer.xml", false); } if (!this.valuePassedPoint(playerValue, 4)) { return; } if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed && ((OS)os).HasLoadedDLCContent) { try { Computer computer = Programs.getComputer((OS)os, "entropy00"); if (computer != null) { ; } ((MissionListingServer)computer.getDaemon(typeof(MissionListingServer))).addMisison((ActiveMission)ComputerLoader.readMission("Content/DLC/Missions/BaseGameConnectors/Missions/EntropyDLCConnectorIntro.xml"), true); Console.WriteLine("Injected Labyrinths transition mission to Entropy"); } catch (Exception ex) { Utils.AppendToErrorFile("Could not add in Labyrinths upgrade mission to entropy!\r\n\r\n" + Utils.GenerateReportFromException(ex)); } } }
public void AddMissionToListings(string missionFilename, int desiredIndex = -1) { this.addMission((ActiveMission)ComputerLoader.readMission(missionFilename), true, false, desiredIndex); }
public static Instance Load(XmlReader reader) { while (reader.Name != "moddedMission") { reader.Read(); } reader.MoveToAttribute("interfaceId"); var missionId = reader.ReadContentAsString(); if (!Handler.ContainsMission(missionId)) { return(null); } reader.MoveToAttribute("next"); var next = reader.ReadContentAsString().Replace('\\', '/'); reader.MoveToAttribute("storedObjects"); var storedObjectStr = reader.ReadContentAsString(); var storedObjects = new Dictionary <string, string>(); if (storedObjectStr.Length != 0) { foreach (var o in storedObjectStr.Split(' ')) { var i = o.IndexOf('|'); storedObjects[o.Remove(i)] = o.Substring(i + 1); } } if (reader.MoveToAttribute("genTarget")) { MissionGenerationParser.Comp = reader.ReadContentAsString(); reader.MoveToAttribute("genFile"); MissionGenerationParser.File = reader.ReadContentAsString(); reader.MoveToAttribute("genPath"); MissionGenerationParser.Path = reader.ReadContentAsString(); reader.MoveToAttribute("genTargetName"); MissionGenerationParser.Target = reader.ReadContentAsString(); reader.MoveToAttribute("genOther"); MissionGenerationParser.Other = reader.ReadContentAsString(); } reader.MoveToAttribute("activeCheck"); var activeCheck = reader.ReadContentAsString().ToLower().Equals("true"); Instance result = null; if (next != "NULL_MISSION") { var attachments = new List <string>(); if (next.IndexOf('/') != -1) { next = next.Substring(1); if (!Settings.IsInExtensionMode && !next.StartsWith("Content", StringComparison.Ordinal)) { next = "Content/" + next; } ActiveMission nextMission; try { nextMission = ComputerLoader.readMission(next) as ActiveMission; if (nextMission != null) { activeCheck = activeCheck || nextMission.activeCheck; attachments = nextMission.email.attachments; } } catch (Exception ex) { Console.WriteLine("Extension/Vanilla Mission " + next + " errored out: " + ex); } } else { next = next.Substring(next.IndexOf(':') + 1); var nextMission = CreateInstance(next, new Dictionary <string, string>()); if (nextMission != null) { activeCheck = activeCheck || nextMission.activeCheck; attachments = nextMission.email.attachments; } } var sender = "ERRORBOT"; var subject = "ERROR"; var body = "ERROR :: MAIL LOAD FAILED"; while (reader.Name != "email" || reader.Name != "endFunc") { reader.Read(); } if (reader.Name == "email") { if (reader.MoveToAttribute("sender")) { sender = Folder.deFilter(reader.ReadContentAsString()); } if (reader.MoveToAttribute("subject")) { subject = Folder.deFilter(reader.ReadContentAsString()); } reader.MoveToContent(); body = Folder.deFilter(reader.ReadContentAsString()); } result = CreateInstance(missionId, storedObjects, next, new MailServer.EMailData(sender, body, subject, attachments)); result.reloadGoalsSourceFile = next; while (reader.Name != "endFunc") { reader.Read(); } reader.MoveToAttribute("val"); result.endFunctionValue = reader.ReadContentAsInt(); reader.MoveToAttribute("name"); result.endFunctionName = reader.ReadContentAsString(); while (reader.Name != "posting") { reader.Read(); } reader.MoveToAttribute("title"); result.postingTitle = Folder.deFilter(reader.ReadContentAsString()); reader.MoveToContent(); result.postingBody = Folder.deFilter(reader.ReadContentAsString()); } return(result); }
public static string TestDLCProgression(ScreenManager screenMan, out int errorsAdded) { int errors = 0; string ret = ""; DLCTests.SetupTestingEnvironment(screenMan, (Action <OS, List <Computer> >)((os, comps) => { Console.WriteLine("Testing DLC Progression in " + Settings.ActiveLocale); SessionAccelerator.AccelerateSessionToDLCEND((object)os); if (Programs.getComputer(os, "dhsDrop").files.root.searchForFolder("home").searchForFile("p_SQL_399.gz") == null) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nExpo Grave Mission files not copied over to drop server! Mission Incompletable."; } if (!Programs.getComputer(os, "ds4_expo").ports.Contains(21)) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nExpo Grave Website does not have port 21 added! Mission Incompletable."; } Folder folder = Programs.getComputer(os, "ds3_mail").files.root.searchForFolder("mail").searchForFolder("accounts").searchForFolder("cornch1p"); if (folder == null) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nMagma Mailbox server for It Follows (set3) does not have account! in file, replace kburnaby with cornch1p to fix."; } else if (folder.searchForFolder("inbox").files.Count <= 0) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nMagma Mailbox server for It Follows (set3) does not have emails! in file, replace kburnaby with cornch1p to fix."; } CustomFaction fromFile = CustomFaction.ParseFromFile("Content/DLC/DLCFaction.xml"); if (fromFile.idName != "Bibliotheque") { ++errors; // ISSUE: variable of a compiler-generated type DLCTests.\u003C\u003Ec__DisplayClass7 cDisplayClass7 = this; // ISSUE: reference to a compiler-generated field string str = cDisplayClass7.ret + "\r\nHub Faction ID Name is wrong: " + fromFile.idName; // ISSUE: reference to a compiler-generated field cDisplayClass7.ret = str; } CustomFactionAction customAction = fromFile.CustomActions[6]; for (int index = 0; index < customAction.TriggerActions.Count; ++index) { SAAddConditionalActions triggerAction = customAction.TriggerActions[index] as SAAddConditionalActions; if (triggerAction != null && triggerAction.Filepath.Contains("PetsAcceptedActions")) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nHub Faction (stage 7) contains PetsAcceptedActions.xml loader - it should be only on the mission itself! Remove it!"; } } if (Programs.getComputer(os, "dPets_MF").name.ToLower().Contains("digipets")) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nNeopals server rename from DigiPets is not complete in this version! Fix it! Remember to do foldernames too.\r\n"; } bool flag = false; Computer computer = Programs.getComputer(os, "dMF_1_Misc"); for (int index = 0; index < computer.users.Count; ++index) { if (computer.users[index].name == "listen" && computer.users[index].pass == "4TL4S") { flag = true; } } if (!flag) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nAtlas server (MemForensics/Atlas) needs user listen w. pass 4TL4S\r\n"; } if (((ActiveMission)ComputerLoader.readMission("Content/DLC/Missions/Neopals/PetsMission1.xml")).email.body.Contains("DigiPoints")) { ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nNeopals missions references DigiPoints, where it should be NeoPoints! Remember to check the goals field!\r\n"; } if (Programs.getComputer(os, "dhsDrop").admin == null) { return; } ++errors; // ISSUE: reference to a compiler-generated field this.ret += "\r\nDLC Drop server has an admin - remove it with type=none. This stops the player being auto logged out.\r\n"; })); errorsAdded = errors; return(ret); }