public void finish() { OS.currentInstance.branchMissions.Clear(); if (!this.nextMission.Equals("NONE")) { string str = "Content/Missions/"; if (Settings.IsInExtensionMode) { str = ExtensionLoader.ActiveExtensionInfo.FolderPath + "/"; } ComputerLoader.loadMission(str + this.nextMission, false); OS.currentInstance.currentMission.ActivateSuppressedStartFunctionIfPresent(); } else { OS.currentInstance.currentMission = (ActiveMission)null; } if (this.endFunctionName != null) { MissionFunctions.runCommand(this.endFunctionValue, this.endFunctionName); } OS.currentInstance.saveGame(); if (!OS.currentInstance.multiplayer) { return; } OS.currentInstance.endMultiplayerMatch(true); }
public static SerializableAction DeserializeFromReader(XmlReader rdr) { SAStartScreenBleedEffect screenBleedEffect = new SAStartScreenBleedEffect(); if (rdr.MoveToAttribute("Delay")) { screenBleedEffect.Delay = rdr.ReadContentAsFloat(); } if (rdr.MoveToAttribute("DelayHost")) { screenBleedEffect.DelayHost = rdr.ReadContentAsString(); } if (rdr.MoveToAttribute("AlertTitle")) { screenBleedEffect.AlertTitle = ComputerLoader.filter(rdr.ReadContentAsString()); } if (rdr.MoveToAttribute("CompleteAction")) { screenBleedEffect.CompleteAction = rdr.ReadContentAsString(); } if (rdr.MoveToAttribute("TotalDurationSeconds")) { screenBleedEffect.TotalDurationSeconds = (float)rdr.ReadContentAsDouble(); } int content = (int)rdr.MoveToContent(); screenBleedEffect.ContentLines = ComputerLoader.filter(rdr.ReadElementContentAsString()); return((SerializableAction)screenBleedEffect); }
public static string TestMemoryInjectionOnLoadedComputer(ScreenManager screenMan, out int errorsAdded) { int num = 0; string str = ""; Computer computer = (Computer)ComputerLoader.loadComputer("Content/Tests/DLCTests/TestCompNoMemory.xml", false, false); if (computer.Memory != null) { ++num; str += "\r\nLoaded test comp for no memory does infact have memory somehow????\r\n"; } else { MemoryDumpInjector.InjectMemory("Content/Tests/DLCTests/InjectedMemory.xml", (object)computer); if (computer.Memory == null) { ++num; str += "\r\nInjecting memory into loaded comp failed!\r\n"; } else if (computer.Memory.DataBlocks.Count != 2) { ++num; str = str + "\r\nLoaded test comp reads in " + (object)computer.Memory.DataBlocks.Count + " data blocks in memory, instead of the expected 2"; } } errorsAdded = num; return(str); }
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 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 static SerializableAction DeserializeFromReader(XmlReader rdr) { SAAddIRCMessage saAddIrcMessage = new SAAddIRCMessage(); if (rdr.MoveToAttribute("Author")) { saAddIrcMessage.Author = ComputerLoader.filter(rdr.ReadContentAsString()); } if (rdr.MoveToAttribute("Delay")) { saAddIrcMessage.Delay = rdr.ReadContentAsFloat(); } if (rdr.MoveToAttribute("TargetComp")) { saAddIrcMessage.TargetComp = rdr.ReadContentAsString(); } int content = (int)rdr.MoveToContent(); saAddIrcMessage.Message = ComputerLoader.filter(rdr.ReadElementContentAsString()); if (string.IsNullOrWhiteSpace(saAddIrcMessage.TargetComp)) { throw new FormatException("Invalid Target Comp"); } if (string.IsNullOrWhiteSpace(saAddIrcMessage.Message)) { throw new FormatException("Invalid or Empty Message!"); } return((SerializableAction)saAddIrcMessage); }
public static string TestEduSafeFileFlags(ScreenManager screenMan, out int errorsAdded) { int num = 0; string str = ""; Settings.EducationSafeBuild = true; Computer computer1 = (Computer)ComputerLoader.loadComputer("Content/Tests/TestComputer.xml", false, false); Settings.EducationSafeBuild = false; Computer computer2 = (Computer)ComputerLoader.loadComputer("Content/Tests/TestComputer.xml", false, false); Folder folder1 = computer1.files.root.searchForFolder("testfolder"); Folder folder2 = computer2.files.root.searchForFolder("testfolder"); if (folder1.containsFile("eduUnsafeFile.txt") || !folder1.containsFile("eduSafeFile.txt") || !folder1.containsFile("eduSafeExplicit.txt") || !folder1.containsFile("eduSafeOnlyFile.txt")) { ++num; str += "\nError in Education File Flags - EDU Safe version has invalid file set"; } if (!folder2.containsFile("eduUnsafeFile.txt") || !folder2.containsFile("eduSafeFile.txt") || !folder2.containsFile("eduSafeExplicit.txt") || folder2.containsFile("eduSafeOnlyFile.txt")) { ++num; str += "\nError in Education File Flags - EDU Unsafe version has invalid file set"; } errorsAdded = num; return(str); }
public static void EndDLCSection(object osobj) { OS os = (OS)osobj; os.IsInDLCMode = false; os.mailicon.isEnabled = true; os.Flags.AddFlag("dlc_complete"); if (os.Flags.HasFlag("dlc_start_csec")) { os.Flags.AddFlag("dlc_complete_FromCSEC"); ComputerLoader.loadMission("Content/DLC/Missions/BaseGameConnectors/Missions/CSEC_DLC_EndEmail.xml", false); os.allFactions.setCurrentFaction("hub", os); os.homeNodeID = "mainHub"; os.homeAssetServerID = "mainHubAssets"; os.Flags.AddFlag("dlc_csec_end_facval:" + (object)os.currentFaction.playerValue); } else if (os.Flags.HasFlag("dlc_start_entropy")) { os.Flags.AddFlag("dlc_complete_FromEntropy"); ComputerLoader.loadMission("Content/DLC/Missions/BaseGameConnectors/Missions/Entropy_DLC_EndEmail.xml", false); os.allFactions.setCurrentFaction("entropy", os); os.homeNodeID = "entropy00"; os.homeAssetServerID = "entropy01"; } else { os.Flags.AddFlag("dlc_complete_FromUnknown"); ComputerLoader.loadMission("Content/DLC/Missions/BaseGameConnectors/Missions/Entropy_DLC_EndEmail.xml", false); os.allFactions.setCurrentFaction("entropy", os); os.homeNodeID = "entropy00"; os.homeAssetServerID = "entropy01"; } DLC1SessionUpgrader.ReDsicoverAllVisibleNodesInOSCache((object)os); }
public static SerializableAction DeserializeFromReader(XmlReader rdr) { SAAppendToFile saAppendToFile = new SAAppendToFile(); if (rdr.MoveToAttribute("Delay")) { saAppendToFile.Delay = rdr.ReadContentAsFloat(); } if (rdr.MoveToAttribute("DelayHost")) { saAppendToFile.DelayHost = rdr.ReadContentAsString(); } if (rdr.MoveToAttribute("TargetComp")) { saAppendToFile.TargetComp = rdr.ReadContentAsString(); } if (rdr.MoveToAttribute("TargetFolderpath")) { saAppendToFile.TargetFolderpath = rdr.ReadContentAsString(); } if (rdr.MoveToAttribute("TargetFilename")) { saAppendToFile.TargetFilename = rdr.ReadContentAsString(); } int content = (int)rdr.MoveToContent(); saAppendToFile.DataToAdd = ComputerLoader.filter(rdr.ReadElementContentAsString()); return((SerializableAction)saAppendToFile); }
public static void AccelerateSessionToDLCStart(object osObj) { OS os = (OS)osObj; os.Flags.AddFlag("TutorialComplete"); os.delayer.RunAllDelayedActions(); ThemeManager.setThemeOnComputer((object)os.thisComputer, "DLC/Themes/RiptideClassicTheme.xml"); ThemeManager.switchTheme((object)os, "DLC/Themes/RiptideClassicTheme.xml"); 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.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() => { Game1.getSingleton().IsMouseVisible = true; os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[22], "SSHCrack.exe")); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[21], "FTPBounce.exe")); os.thisComputer.files.root.folders[2].files.Add(new FileEntry(PortExploits.crackExeData[13], "eosDeviceScan.exe")); MissionFunctions.runCommand(7, "changeSong"); MusicManager.stop(); })); os.delayer.Post(ActionDelayer.Wait(56.0), (Action)(() => ComputerLoader.loadMission("Content/DLC/Missions/Demo/DLCDemoIntroMission1.xml", false))); }
public List <Computer> generateGameNodes() { var list = new List <Computer>(); var computer1 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/JMailServer.xml"); computer1.location = new Vector2(0.7f, 0.2f); mailServer = computer1; list.Add(computer1); var c1 = new Computer("boatmail.com", "65.55.72.183", new Vector2(0.6f, 0.9f), 4, 3, os); c1.idName = "boatmail"; c1.daemons.Add(new BoatMail(c1, "Boatmail", os)); c1.initDaemons(); list.Add(c1); var c2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/InternationalAcademicDatabase.xml"); var academicDatabaseDaemon = new AcademicDatabaseDaemon(c2, "Academic Databse", os); c2.daemons.Add(academicDatabaseDaemon); c2.initDaemons(); academicDatabaseDaemon.initFilesFromPeople(People.all); academicDatabase = c2; list.Add(c2); var computer2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubAssetsComp.xml"); list.Add(computer2); var ch = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubComp.xml"); os.delayer.Post(ActionDelayer.NextTick(), () => { ch.daemons.Add(new MissionHubServer(ch, "CSEC Contract Database", "CSEC", os)); ch.initDaemons(); }); list.Add(ch); computer2.location = ch.location + Corporation.getNearbyNodeOffset(ch.location, 1, 1, this); list.Add(new Computer("Cheater's Stash", "1337.1337.1337.1337", getRandomPosition(), 0, 2, os) { idName = "haxServer", files = { root = { files = { new FileEntry(PortExploits.crackExeData[PortExploits.portNums[0]], PortExploits.cracks[PortExploits.portNums[0]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[1]], PortExploits.cracks[PortExploits.portNums[1]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[2]], PortExploits.cracks[PortExploits.portNums[2]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[3]], PortExploits.cracks[PortExploits.portNums[3]]) } } } }); return(list); }
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 List <Computer> generateGameNodes() { List <Computer> computerList = new List <Computer>(); Computer computer1 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/JMailServer.xml", false, false); computer1.location = new Vector2(0.7f, 0.2f); this.mailServer = computer1; computerList.Add(computer1); Computer c1 = new Computer("boatmail.com", "65.55.72.183", new Vector2(0.6f, 0.9f), 4, (byte)3, this.os); c1.idName = "boatmail"; c1.daemons.Add((Daemon) new BoatMail(c1, "Boatmail", this.os)); c1.initDaemons(); computerList.Add(c1); Computer c2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/InternationalAcademicDatabase.xml", false, false); AcademicDatabaseDaemon academicDatabaseDaemon = new AcademicDatabaseDaemon(c2, "Academic Database", this.os); c2.daemons.Add((Daemon)academicDatabaseDaemon); c2.initDaemons(); this.academicDatabase = c2; computerList.Add(c2); Computer computer2 = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubAssetsComp.xml", false, false); computerList.Add(computer2); Computer ch = (Computer)ComputerLoader.loadComputer("Content/Missions/CoreServers/ContractHubComp.xml", false, false); this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() => { ch.daemons.Add((Daemon) new MissionHubServer(ch, "CSEC Contract Database", "CSEC", this.os)); ch.initDaemons(); })); computerList.Add(ch); computer2.location = ch.location + Corporation.getNearbyNodeOffset(ch.location, 1, 1, this, 0.0f, false); computerList.Add(new Computer("Cheater's Stash", "1337.1337.1337.1337", this.getRandomPosition(), 0, (byte)2, this.os) { idName = "haxServer", files = { root = { files = { new FileEntry(PortExploits.crackExeData[PortExploits.portNums[0]], PortExploits.cracks[PortExploits.portNums[0]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[1]], PortExploits.cracks[PortExploits.portNums[1]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[2]], PortExploits.cracks[PortExploits.portNums[2]]), new FileEntry(PortExploits.crackExeData[PortExploits.portNums[3]], PortExploits.cracks[PortExploits.portNums[3]]), this.GetProgramForNum(1433), this.GetProgramForNum(104), this.GetProgramForNum(9), this.GetProgramForNum(13), this.GetProgramForNum(10) } } } }); return(computerList); }
private void ProgressionSaveFixHacks() { if (!this.groupName.Equals("Entropy") || (this.missions.Count != 0 || !(this.os.currentFaction.idName == "entropy") || this.os.currentMission != null || this.os.Flags.HasFlag("ThemeHackTransitionAssetsAdded"))) { return; } ComputerLoader.loadMission("Content/Missions/Entropy/ThemeHackTransitionMission.xml", false); this.os.saveGame(); }
private void CompleteAndReturnToMenu() { this.os.Flags.AddFlag("Victory"); Programs.disconnect(new string[0], this.os); Computer computer = Programs.getComputer(this.os, "porthackHeart"); this.os.netMap.visibleNodes.Remove(this.os.netMap.nodes.IndexOf(computer)); computer.disabled = true; computer.daemons.Clear(); computer.ip = NetworkMap.generateRandomIP(); this.os.terminal.inputLocked = false; this.os.ram.inputLocked = false; this.os.netMap.inputLocked = false; this.os.DisableTopBarButtons = false; this.os.canRunContent = true; this.IsActive = false; ComputerLoader.loadMission("Content/Missions/CreditsMission.xml", false); this.os.threadedSaveExecute(false); MediaPlayer.IsRepeating = true; MusicManager.playSongImmediatley("Music\\Bit(Ending)"); if (Settings.isPirateBuild) { this.os.delayer.Post(ActionDelayer.Wait(15.0), (Action)(() => { try { ComputerLoader.loadMission("Content/Missions/CreditsMission_p.xml", false); } catch (Exception ex) { } })); } if (!Settings.sendsDLC1PromoEmailAtEnd) { return; } this.os.delayer.Post(ActionDelayer.Wait(30.0), (Action)(() => { try { string body = Utils.readEntireFile("Content/LocPost/DLCMessage.txt"); string subject = "Labyrinths"; string sender = "Matt Trobbiani"; string email = MailServer.generateEmail(subject, body, sender); MailServer daemon = this.os.netMap.mailServer.getDaemon(typeof(MailServer)) as MailServer; if (daemon == null) { return; } daemon.addMail(email, this.os.defaultUser.name); } catch (Exception ex) { } })); }
public void InitializeComputerValidatorTest(IRepository db) { _computerLoader = new ComputerLoader("", null, db) { Cpu = new CpuEntity(), Gpu = new GpuEntity(), Motherboard = new MotherBoardEntity(), Ram = new RamEntity(), PowerSupply = new PowerSupplyEntity(), }; }
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); }
public override void addValue(int value, object os) { var oldValue = playerValue; base.addValue(value, os); if (!valuePassedPoint(oldValue, 3)) { return; } ((OS)os).Flags.AddFlag("eosPathStarted"); ComputerLoader.loadMission("Content/Missions/Entropy/StartingSet/eosMissions/eosIntroDelayer.xml"); }
public static void ReloadExtensionNodes(object osobj) { OS os = (OS)osobj; ExtensionInfo activeExtensionInfo = ExtensionLoader.ActiveExtensionInfo; if (!Directory.Exists(activeExtensionInfo.FolderPath + "/Nodes")) { return; } Utils.ActOnAllFilesRevursivley(activeExtensionInfo.FolderPath + "/Nodes", (Action <string>)(filename => { if (!filename.EndsWith(".xml")) { return; } if (OS.TestingPassOnly) { try { Computer c = Computer.loadFromFile(filename); if (c != null) { ExtensionLoader.CheckAndAssignCoreServer(c, os); } } catch (Exception ex) { throw new FormatException(string.Format("COMPUTER LOAD ERROR:\nError loading computer \"{0}\"\nError: {1} - {2}", (object)filename, (object)ex.GetType().Name, (object)ex.Message), ex); } } else { Computer c = (Computer)ComputerLoader.loadComputer(filename, true, false); for (int index = 0; index < os.netMap.nodes.Count; ++index) { Computer node = os.netMap.nodes[index]; if (node.idName == c.idName) { c.location = node.location; c.adminIP = node.adminIP; c.ip = node.ip; c.highlightFlashTime = 1f; os.netMap.nodes[index] = c; break; } } if (c != null) { ExtensionLoader.CheckAndAssignCoreServer(c, os); } } })); }
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); }
public override void playerPassedValue(object os) { base.playerPassedValue(os); if (Settings.isAlphaDemoMode) { ComputerLoader.loadMission("Content/Missions/Entropy/EntropyMission3.xml"); } else { ((OS)os).delayer.Post(ActionDelayer.Wait(1.7), () => ComputerLoader.loadMission("Content/Missions/Entropy/ThemeHackTransitionMission.xml")); } }
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); }
public static void AddEmailToServer(this Hacknet.MailServer server, string sender = null, string recip = null, string subject = null, string body = null, bool dontFilter = false) { sender = dontFilter ? sender ?? "UNKNOWN" : ComputerLoader.filter(sender ?? "UNKNOWN"); recip = dontFilter || recip == null ? recip : ComputerLoader.filter(recip); subject = dontFilter ? subject ?? "UNKNOWN" : ComputerLoader.filter(subject ?? "UNKNOWN"); body = dontFilter ? body ?? "UNKNOWN" : ComputerLoader.filter(body ?? "UNKNOWN"); if (recip != null) { server.AddMailToServer(recip, Hacknet.MailServer.generateEmail(subject, body, sender)); } }
public void ForceStartBitMissions(object os) { ((OS)os).Flags.AddFlag("bitPathStarted"); ((OS)os).delayer.Post(ActionDelayer.Wait(1.6), (Action)(() => ComputerLoader.loadMission("Content/Missions/BitPath/BitAdv_Intro.xml", false))); Programs.getComputer((OS)os, "mainHubAssets").files.root.searchForFolder("bin").folders.Add(new Folder("Misc") { files = { new FileEntry(PortExploits.crackExeData[9], "Decypher.exe"), new FileEntry(PortExploits.crackExeData[10], "DECHead.exe"), new FileEntry(PortExploits.crackExeData[104], "KBT_PortTest.exe"), new FileEntry("Kellis BioTech medical port cycler - target 104-103.", "kbt_readme.txt") } }); this.SendNotification(os, LocaleTerms.Loc("Agent") + ",\n" + LocaleTerms.Loc("Additional resources have been added to the CSEC members asset pool, for your free use.") + " " + LocaleTerms.Loc("Find them in the misc folder on the asset server.") + "\n\n" + LocaleTerms.Loc("Thankyou") + ",\n -" + this.name, this.name + " " + LocaleTerms.Loc("Admins :: Asset Uploads")); }
public override void finish() { Tuple <string, int> t; if ((t = Interface.OnEnd(this)) != null) { addEndFunction(t.Item2, t.Item1); } var os = Utility.ClientOS; os.branchMissions.Clear(); if (nextMission.StartsWith("Pathfinder:", StringComparison.Ordinal)) { var id = nextMission.Substring(nextMission.IndexOf(':') + 1); os.currentMission = CreateInstance(id, new Dictionary <string, string>()); os.currentMission?.sendEmail(os); } else if (!nextMission.Equals("NONE")) { var str = "Content/Missions"; if (Settings.IsInExtensionMode) { str = ExtensionLoader.ActiveExtensionInfo.FolderPath; } ComputerLoader.loadMission(str + "/" + nextMission, false); } else { os.currentMission = null; } os.currentMission?.ActivateSuppressedStartFunctionIfPresent(); if (endFunctionName != null) { MissionFunctions.runCommand(endFunctionValue, endFunctionName); } os.saveGame(); if (os.multiplayer) { os.endMultiplayerMatch(true); } }
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; } }
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 AddAssetFunction, adding file: " + this.FileName); } Folder folderAtPath = Programs.getFolderAtPath(this.TargetFolderpath, os, computer.files.root, true); if (folderAtPath == null) { throw new NullReferenceException("Folder " + this.TargetFolderpath + " could not be found for AddAssetFunction, adding file: " + this.FileName); } FileEntry fileEntry = new FileEntry(ComputerLoader.filter(this.FileContents), this.FileName); folderAtPath.files.Add(fileEntry); }
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); }