コード例 #1
0
        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)));
        }
コード例 #2
0
        public static void AccelerateSessionToDLCEND(object osObj)
        {
            OS os = (OS)osObj;

            os.Flags.AddFlag("TutorialComplete");
            os.delayer.RunAllDelayedActions();
            os.allFactions.setCurrentFaction("Bibliotheque", os);
            os.IsInDLCMode = true;
            ThemeManager.setThemeOnComputer((object)os.thisComputer, "DLC/Themes/RiptideThemeStandard.xml");
            ThemeManager.switchTheme((object)os, "DLC/Themes/RiptideThemeStandard.xml");
            os.netMap.discoverNode(Programs.getComputer(os, "dhs"));
            MissionFunctions.runCommand(0, "setFaction:Bibliotheque");
            DLCHubServer daemon = (DLCHubServer)Programs.getComputer(os, "dhs").getDaemon(typeof(DLCHubServer));
            int          num    = 11;

            for (int index = 0; index < num; ++index)
            {
                MissionFunctions.runCommand(1, "addRankSilent");
                if (index + 1 < num)
                {
                    os.delayer.RunAllDelayedActions();
                    daemon.DelayedActions.InstantlyResolveAllActions((object)os);
                    daemon.ClearAllActiveMissions();
                }
            }
            SessionAccelerator.AddProgramToComputer(os.thisComputer, 6881);
            SessionAccelerator.AddProgramToComputer(os.thisComputer, 211);
            SessionAccelerator.AddProgramToComputer(os.thisComputer, 31);
            SessionAccelerator.AddProgramToComputer(os.thisComputer, 443);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 public void Update(float dt)
 {
     this.flashInTimeLeft = Math.Max(0.0f, this.flashInTimeLeft - dt);
     this.timeElapsed    += dt;
     if (!this.IsMonitoringDLCEndingCases)
     {
         return;
     }
     if (this.CrashingAircraft != null)
     {
         if (this.CrashingAircraft.IsInCriticalFirmwareFailure)
         {
             this.TargetHasStartedCrashing = true;
             this.IsInPostSaveState        = false;
             double totalSeconds = MediaPlayer.PlayPosition.TotalSeconds;
             double num1         = 1.0 / (131.0 / 60.0);
             double num2         = num1 * 4.0;
             double num3         = num1 * 2.0;
             double num4         = totalSeconds < 58.0 ? 999.0 : (totalSeconds < 117.0 ? num2 : num3);
             if ((totalSeconds + num1 / 2.0) % num4 < num1 / 4.0)
             {
                 this.os.warningFlash();
             }
         }
         else if (this.TargetHasStartedCrashing)
         {
             if (!this.os.Flags.HasFlag("DLC_PlaneResult"))
             {
                 RunnableConditionalActions.LoadIntoOS("DLC/ActionScripts/FinaleSaveActions.xml", (object)this.os);
                 this.os.Flags.AddFlag("DLC_PlaneSaveResponseTriggered");
                 this.os.Flags.AddFlag("DLC_PlaneResult");
             }
             if (!this.CrashingAircraft.IsInCriticalDescent() && !MediaPlayer.IsRepeating)
             {
                 MusicManager.FADE_TIME = 6f;
                 MusicManager.transitionToSong("DLC/Music/RemiDrone");
                 MediaPlayer.IsRepeating = true;
                 this.os.delayer.Post(ActionDelayer.Wait(2.0), (Action)(() => this.AircraftSaveSound.Play()));
                 this.IsInPostSaveState = true;
             }
         }
     }
     else if (this.TargetHasStartedCrashing)
     {
         if (this.SecondaryAircraft == null || this.SecondaryAircraft.IsInCriticalFirmwareFailure)
         {
             if (!this.os.Flags.HasFlag("DLC_PlaneResult"))
             {
                 RunnableConditionalActions.LoadIntoOS("DLC/ActionScripts/FinaleDoubleCrashActions.xml", (object)this.os);
                 this.os.Flags.AddFlag("DLC_DoubleCrashResponseTriggered");
                 this.os.Flags.AddFlag("DLC_PlaneResult");
             }
         }
         else if (!this.os.Flags.HasFlag("DLC_PlaneResult"))
         {
             RunnableConditionalActions.LoadIntoOS("DLC/ActionScripts/FinaleCrashActions.xml", (object)this.os);
             this.os.Flags.AddFlag("DLC_PlaneCrashedResponseTriggered");
             this.os.Flags.AddFlag("DLC_PlaneResult");
         }
         if (MusicManager.currentSongName != "DLC\\Music\\CrashTrack")
         {
             MusicManager.playSongImmediatley("DLC\\Music\\CrashTrack");
             MediaPlayer.IsRepeating = false;
         }
     }
     if (!MediaPlayer.IsRepeating && MediaPlayer.State != MediaState.Playing && !this.IsInPostSaveState)
     {
         MusicManager.FADE_TIME = 6f;
         MissionFunctions.runCommand(7, "changeSongDLC");
         MediaPlayer.IsRepeating = true;
     }
 }
コード例 #5
0
ファイル: ExtensionTests.cs プロジェクト: hochladen/Hacknet
        public static string TestExtensionMission(object mission, string filepath, object os)
        {
            string        str1          = "";
            ActiveMission activeMission = (ActiveMission)mission;
            string        str2          = File.ReadAllText(filepath);
            string        str3          = str1 + ExtensionTests.TestTagisClosed("missionEnd", str2) + ExtensionTests.TestTagisClosed("missionStart", str2) + ExtensionTests.TestTagisClosed("nextMission", str2) + ExtensionTests.TestTagisClosed("goals", str2) + ExtensionTests.TestTagisClosed("email", str2) + ExtensionTests.TestTagisClosed("sender", str2) + ExtensionTests.TestTagisClosed("subject", str2) + ExtensionTests.TestTagisClosed("body", str2) + ExtensionTests.TestTagisClosed("attachments", str2);

            if (!str2.Contains("</attachments>"))
            {
                str3 = str3 + "File does not contain attachments tag at the end of the email! It needs to be there!" + "\r\n";
            }
            int count = Regex.Matches(str2, "<goal ").Count;

            if (activeMission.goals.Count != count && activeMission.goals.Count < count)
            {
                string str4 = str3 + "File defines some goals that are not being correctly parsed in! (" + (object)activeMission.goals.Count + " loaded vs " + (object)count + " in file)" + "\r\nCheck your syntax and tags! Valid Goals:\r\n";
                for (int index = 0; index < activeMission.goals.Count; ++index)
                {
                    str4 = str4 + "\r\n" + activeMission.goals[index].ToString().Replace("Hacknet.Mission.", "");
                }
                str3 = str4 + "\r\n";
            }
            if (string.IsNullOrWhiteSpace(activeMission.startFunctionName) && str2.Contains("<missionStart"))
            {
                str3 = str3 + "File contains missionStart, but it's not being correctly parsed in. It might be out of order in the file." + "\r\n";
            }
            if (activeMission.startFunctionName != null)
            {
                try
                {
                    if (!activeMission.startFunctionName.Contains("addRank"))
                    {
                        MissionFunctions.runCommand(activeMission.startFunctionValue, activeMission.startFunctionName);
                    }
                }
                catch (Exception ex)
                {
                    str3 = str3 + "Error running start function " + activeMission.startFunctionName + "\r\n" + Utils.GenerateReportFromException(ex);
                }
            }
            if (string.IsNullOrWhiteSpace(activeMission.endFunctionName) && str2.Contains("<missionEnd"))
            {
                str3 = str3 + "File contains missionEnd, but it's not being correctly parsed in. It might be out of order in the file." + "\r\n";
            }
            if (activeMission.endFunctionName != null)
            {
                try
                {
                    if (!activeMission.endFunctionName.Contains("addRank"))
                    {
                        MissionFunctions.runCommand(activeMission.endFunctionValue, activeMission.endFunctionName);
                    }
                }
                catch (Exception ex)
                {
                    str3 = str3 + "Error running end function " + activeMission.endFunctionName + "\r\n" + Utils.GenerateReportFromException(ex);
                }
            }
            string str5 = TestSuite.TestMission(ExtensionLoader.ActiveExtensionInfo.FolderPath + "/" + ExtensionLoader.ActiveExtensionInfo.StartingMissionPath, os);

            if (!string.IsNullOrWhiteSpace(str5))
            {
                str3 += str5;
            }
            if (str3.Length > 1)
            {
                return("Mission Errors for " + filepath.Replace("\\", "/") + ":\r\n" + str3);
            }
            return("");
        }
コード例 #6
0
        static MissionLoader()
        {
            EventManager.onPluginUnload += OnPluginUnload;

            executor.RegisterExecutor("mission", (exec, info) =>
            {
                hasMissionTag       = true;
                mission.activeCheck = info.Attributes.GetBool("activeCheck");
                mission.ShouldIgnoreSenderVerification = info.Attributes.GetBool("shouldIgnoreSenderVerification");
            });
            executor.RegisterExecutor("mission.goals.goal", (exec, info) => mission.goals.Add(LoadGoal(info)), ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.missionStart", (exec, info) =>
            {
                var function = info.Content ?? throw new FormatException("missionStart with no mission function!");
                var val      = info.Attributes.GetInt("val", 1);
                if (info.Attributes.GetBool("suppress", Settings.IsInExtensionMode))
                {
                    mission.addStartFunction(val, function);
                }
                else
                {
                    MissionFunctions.runCommand(val, function);
                }
            }, ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.missionEnd", (exec, info) =>
            {
                mission.addEndFunction(info.Attributes.GetInt("val", 1), info.Content ?? throw new FormatException("missionEnd with no mission function!"));
            }, ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.nextMission", (exec, info) =>
            {
                mission.willSendEmail = !info.Attributes.GetBool("IsSilent", false);
                mission.nextMission   = info.Content ?? "NONE";
            }, ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.branchMissions.branch", (exec, info) =>
            {
                var filePrefix      = Settings.IsInExtensionMode ? ExtensionLoader.ActiveExtensionInfo.FolderPath + "/" : "Content/Missions/";
                var currentMission  = mission;
                var currentBranches = branches;
                mission             = null;
                branches            = null;
                exec.SaveState();
                currentBranches.Add(LoadContentMission(filePrefix + info.Content));
                exec.PopState();
                mission  = currentMission;
                branches = currentBranches;
            }, ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.branchMissions", (exec, info) => OS.currentInstance.branchMissions = branches, ParseOption.FireOnEnd);
            executor.RegisterExecutor("mission.posting", (exec, info) =>
            {
                mission.postingTitle = info.Attributes.GetString("title", "UNKNOWN").Filter();
                mission.postingBody  = info.Content ?? "UNKNOWN";
                mission.postingAcceptFlagRequirements = info.Attributes.GetString("reqs").Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries);
                mission.requiredRank = info.Attributes.GetInt("requiredRank");
                mission.difficulty   = info.Attributes.GetInt("difficulty");
                mission.client       = info.Attributes.GetString("client").Filter();
                mission.target       = info.Attributes.GetString("target").Filter();
            }, ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.email.sender", (exec, info) => mission.email.sender   = info.Content.Filter(), ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.email.subject", (exec, info) => mission.email.subject = info.Content.Filter(), ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.email.body", (exec, info) => mission.email.body       = info.Content.Filter(), ParseOption.ParseInterior);
            executor.RegisterExecutor("mission.email.attachments.link", (exec, info) =>
            {
                var comp = ComputerLookup.FindById(info.Attributes.GetString("comp"));
                if (comp != null)
                {
                    mission.email.attachments.Add($"link#%#{comp.name}#%#{comp.ip}");
                }
            });
            executor.RegisterExecutor("mission.email.attachments.account", (exec, info) =>
            {
                var comp = info.Attributes.GetComp("comp");
                mission.email.attachments.Add(
                    $"account#%#{comp.name}#%#{comp.ip}#%#{info.Attributes.GetString("user", "UNKNOWN").Filter()}#%#{info.Attributes.GetString("pass", "UNKNOWN").Filter()}"
                    );
            });
            executor.RegisterExecutor("mission.email.attachments.note", (exec, info) =>
            {
                mission.email.attachments.Add($"note#%#{info.Attributes.GetString("title", "Data").Filter()}#%#{info.Content.Filter()}");
            }, ParseOption.ParseInterior);
        }
コード例 #7
0
        internal static void LoadContentForModExtensionListener(OSLoadContentEvent e)
        {
            if (Extension.Handler.ActiveInfo == null)
            {
                return;
            }
            e.IsCancelled = true;
            var os = e.OS;

            if (os.canRunContent)
            {
                // setup for proper game function
                Settings.slowOSStartup     = false;
                Settings.initShowsTutorial = false;
                os.initShowsTutorial       = false;
                // replacing OS.LoadContent
                os.delayer = new ActionDelayer();
                ComputerLoader.init(os);
                os.content  = e.OS.ScreenManager.Game.Content;
                os.username = (os.SaveUserAccountName ?? (Settings.isConventionDemo ? Settings.ConventionLoginName : Environment.UserName));
                os.username = FileSanitiser.purifyStringForDisplay(os.username);
                var compLocation = new Vector2(0.1f, 0.5f);
                if (os.multiplayer && !os.isServer)
                {
                    compLocation = new Vector2(0.8f, 0.8f);
                }
                os.ramAvaliable         = os.totalRam;
                os.thisComputer         = new Computer(os.username + " PC", Utility.GenerateRandomIP(), compLocation, 5, 4, os);
                os.thisComputer.adminIP = os.thisComputer.ip;
                os.thisComputer.idName  = "playerComp";
                os.thisComputer.Memory  = new MemoryContents();
                os.GibsonIP             = Utility.GenerateRandomIP();
                UserDetail value = os.thisComputer.users[0];
                value.known = true;
                os.thisComputer.users[0] = value;
                os.defaultUser           = new UserDetail(os.username, "password", 1);
                os.defaultUser.known     = true;
                ThemeManager.setThemeOnComputer(os.thisComputer, OSTheme.HacknetBlue);
                if (os.multiplayer)
                {
                    os.thisComputer.addMultiplayerTargetFile();
                    os.sendMessage("newComp #" + os.thisComputer.ip + "#" + compLocation.X +
                                   "#" + compLocation.Y + "#" + 5 + "#" + os.thisComputer.name);
                    os.multiplayerMissionLoaded = false;
                }
                if (!OS.WillLoadSave)
                {
                    People.init();
                }
                os.modules  = new List <Module>();
                os.exes     = new List <ExeModule>();
                os.shells   = new List <ShellExe>();
                os.shellIPs = new List <string>();
                Viewport viewport = os.ScreenManager.GraphicsDevice.Viewport;
                int      num2     = 205;
                var      num3     = (int)((viewport.Width - RamModule.MODULE_WIDTH - 6) * 0.44420000000000004);
                var      num4     = (int)((viewport.Width - RamModule.MODULE_WIDTH - 6) * 0.5558);
                int      height   = viewport.Height - num2 - OS.TOP_BAR_HEIGHT - 6;
                os.terminal = new Terminal(new Rectangle(viewport.Width - 2 - num3,
                                                         OS.TOP_BAR_HEIGHT,
                                                         num3,
                                                         viewport.Height - OS.TOP_BAR_HEIGHT - 2), os)
                {
                    name = "TERMINAL"
                };
                os.modules.Add(os.terminal);
                os.netMap = new NetworkMap(new Rectangle(RamModule.MODULE_WIDTH + 4,
                                                         viewport.Height - num2 - 2,
                                                         num4 - 1,
                                                         num2), os)
                {
                    name = "netMap v1.7"
                };
                os.modules.Add(os.netMap);
                os.display = new DisplayModule(new Rectangle(RamModule.MODULE_WIDTH + 4,
                                                             OS.TOP_BAR_HEIGHT,
                                                             num4 - 2,
                                                             height), os)
                {
                    name = "DISPLAY"
                };
                os.modules.Add(os.display);
                os.ram = new RamModule(new Rectangle(2,
                                                     OS.TOP_BAR_HEIGHT,
                                                     RamModule.MODULE_WIDTH,
                                                     os.ramAvaliable + RamModule.contentStartOffset), os)
                {
                    name = "RAM"
                };
                os.modules.Add(os.ram);
                foreach (var m in os.modules.ToArray())
                {
                    m.LoadContent();
                }
                if (os.allFactions == null)
                {
                    os.allFactions = new AllFactions();
                    os.allFactions.init();
                }
                bool flag = false;
                if (!OS.WillLoadSave)
                {
                    os.netMap.nodes.Insert(0, os.thisComputer);
                    os.netMap.visibleNodes.Add(0);
                    MusicManager.loadAsCurrentSong(os.IsDLCConventionDemo ? "Music\\out_run_the_wolves" : "Music\\Revolve");
                    os.LanguageCreatedIn = Settings.ActiveLocale;
                }
                else
                {
                    os.loadSaveFile();
                    flag = true;
                    Settings.initShowsTutorial = false;
                    SaveFixHacks.FixSavesWithTerribleHacks(os);
                }
                var computer = new Computer("JMail Email Server", Utility.GenerateRandomIP(), new Vector2(0.8f, 0.2f), 6, 1, os)
                {
                    idName = "jmail"
                };
                computer.daemons.Add(new MailServer(computer, "JMail", os));
                MailServer.shouldGenerateJunk = false;
                computer.users.Add(new UserDetail(os.defaultUser.name, "mailpassword", 2));
                computer.initDaemons();
                os.netMap.nodes.Add(computer);
                os.netMap.mailServer = computer;
                os.topBar            = new Rectangle(0, 0, viewport.Width, OS.TOP_BAR_HEIGHT - 1);
                os.crashModule       = new CrashModule(new Rectangle(0, 0, os.ScreenManager.GraphicsDevice.Viewport.Width, os.ScreenManager.GraphicsDevice.Viewport.Height), os);
                os.crashModule.LoadContent();
                Settings.IsInExtensionMode = false; // little hack to prevent intro text module ctor from throwing nullref
                os.introTextModule         = new IntroTextModule(new Rectangle(0, 0, os.ScreenManager.GraphicsDevice.Viewport.Width, os.ScreenManager.GraphicsDevice.Viewport.Height), os)
                {
                    complete = true,
                    text     = new string[] { "" }
                };
                os.introTextModule.LoadContent();
                Settings.IsInExtensionMode = true; // hack end
                os.traceTracker            = new TraceTracker(os);
                os.IncConnectionOverlay    = new IncomingConnectionOverlay(os);
                os.scanLines           = os.content.Load <Texture2D>("ScanLines");
                os.cross               = os.content.Load <Texture2D>("Cross");
                os.cog                 = os.content.Load <Texture2D>("Cog");
                os.saveIcon            = os.content.Load <Texture2D>("SaveIcon");
                os.beepSound           = os.content.Load <SoundEffect>("SFX/beep");
                os.mailicon            = new MailIcon(os, new Vector2(0f, 0f));
                os.mailicon.pos.X      = viewport.Width - os.mailicon.getWidth() - 2;
                os.hubServerAlertsIcon = new HubServerAlertsIcon(os.content, "dhs",
                                                                 new string[] { "@channel", "@" + os.defaultUser.name }
                                                                 );
                os.hubServerAlertsIcon.Init(os);
                if (os.HasLoadedDLCContent)
                {
                    os.AircraftInfoOverlay = new AircraftInfoOverlay(os);
                }
                SAChangeAlertIcon.UpdateAlertIcon(os);
                os.introTextModule.complete |= (flag || !Settings.slowOSStartup);
                if (!flag)
                {
                    MusicManager.playSong();
                }
                os.inputEnabled        = true;
                os.isLoaded            = true;
                os.fullscreen          = new Rectangle(0, 0, os.ScreenManager.GraphicsDevice.Viewport.Width, os.ScreenManager.GraphicsDevice.Viewport.Height);
                os.TraceDangerSequence = new TraceDangerSequence(os.content, os.ScreenManager.SpriteBatch, os.fullscreen, os);
                os.endingSequence      = new EndingSequenceModule(os.fullscreen, os);
                if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed)
                {
                    os.BootAssitanceModule = new BootCrashAssistanceModule(os.fullscreen, os);
                }
                if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed && HostileHackerBreakinSequence.IsInBlockingHostileFileState(os))
                {
                    os.rebootThisComputer();
                    os.BootAssitanceModule.ShouldSkipDialogueTypeout = true;
                }
                else
                {
                    if (Settings.EnableDLC && HostileHackerBreakinSequence.IsFirstSuccessfulBootAfterBlockingState(os))
                    {
                        HostileHackerBreakinSequence.ReactToFirstSuccesfulBoot(os);
                        os.rebootThisComputer();
                    }
                    if (!OS.TestingPassOnly)
                    {
                        os.runCommand("connect " + os.thisComputer.ip);
                    }
                    var folder2 = os.thisComputer.files.root.searchForFolder("sys");
                    if (folder2.searchForFile("Notes_Reopener.bat") != null)
                    {
                        os.runCommand("notes");
                    }
                }
                if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed && os.HasLoadedDLCContent)
                {
                    bool flag4 = false;
                    if (!os.Flags.HasFlag("AircraftInfoOverlayDeactivated"))
                    {
                        flag4 |= os.Flags.HasFlag("AircraftInfoOverlayActivated");
                        if (!flag4)
                        {
                            var  c       = Programs.getComputer(os, "dair_crash");
                            var  folder3 = c.files.root.searchForFolder("FlightSystems");
                            bool flag5   = false;
                            for (int i = 0; i < folder3.files.Count; i++)
                            {
                                flag5 |= folder3.files[i].name == "747FlightOps.dll";
                            }
                            var aircraftDaemon = (AircraftDaemon)c.getDaemon(typeof(AircraftDaemon));
                            if (!flag5 && !os.Flags.HasFlag("DLC_PlaneResult"))
                            {
                                flag4 = true;
                            }
                        }
                    }
                    if (flag4)
                    {
                        var c = Programs.getComputer(os, "dair_crash");
                        var aircraftDaemon = (AircraftDaemon)c.getDaemon(typeof(AircraftDaemon));
                        aircraftDaemon.StartReloadFirmware();
                        aircraftDaemon.StartUpdating();
                        os.AircraftInfoOverlay.Activate();
                        os.AircraftInfoOverlay.IsMonitoringDLCEndingCases = true;
                        MissionFunctions.runCommand(0, "playAirlineCrashSongSequence");
                    }
                }
            }
            else if (os.multiplayer)
            {
                os.initializeNetwork();
            }
            os.Flags.AddFlag("FirstAlertComplete");
            os.IsInDLCMode       = false;
            os.ShowDLCAlertsIcon = false;

            if (OS.WillLoadSave)
            {
                Stream stream = null;
                if (e.OS.ForceLoadOverrideStream != null && OS.TestingPassOnly)
                {
                    stream = e.OS.ForceLoadOverrideStream;
                }
                else
                {
                    stream = SaveFileManager.GetSaveReadStream(e.OS.SaveGameUserName);
                }
                Extension.Handler.LoadExtension(Extension.Handler.ActiveInfo.Id);
                Extension.Handler.ActiveInfo.OnLoad(e.OS, stream);
            }
            else
            {
                Extension.Handler.CanRegister = true;
                Extension.Handler.ActiveInfo.OnConstruct(e.OS);
                Extension.Handler.CanRegister = false;
            }
        }
コード例 #8
0
        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);
        }