Esempio n. 1
0
 public override void Killed()
 {
     base.Killed();
     if (this.state == ExtensionSequencerExe.SequencerExeState.Active)
     {
         this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() =>
         {
             this.os.addExe((ExeModule) new ExtensionSequencerExe(this.bounds, this.os, new string[0])
             {
                 state = this.state,
                 stateTimer = this.stateTimer,
                 bounds = this.bounds,
                 oldSongName = this.oldSongName,
                 nodeeffects = this.nodeeffects,
                 ramCost = this.ramCost
             });
         }));
     }
     else
     {
         this.os.netMap.DimNonConnectedNodes = false;
         this.os.runCommand("disconnect");
         if (this.targetComp != null)
         {
             this.os.netMap.visibleNodes.Remove(this.os.netMap.nodes.IndexOf(this.targetComp));
         }
     }
 }
Esempio n. 2
0
        public override void disconnectionDetected(Computer c, OS os)
        {
            base.disconnectionDetected(c, os);
            double time = 20.0 * Utils.random.NextDouble();

            os.delayer.Post(ActionDelayer.Wait(time), (Action)(() =>
            {
                if (os.connectedComp != null && !(os.connectedComp.ip != c.ip))
                {
                    return;
                }
                for (int index = 0; index < c.ports.Count; ++index)
                {
                    c.closePort(c.ports[index], "LOCAL_ADMIN");
                }
                if (this.ResetsPassword)
                {
                    c.setAdminPassword(PortExploits.getRandomPassword());
                }
                c.adminIP = c.ip;
                if (c.firewall != null)
                {
                    c.firewall.solved = false;
                    c.firewall.resetSolutionProgress();
                }
            }));
        }
Esempio n. 3
0
        private void StartFullDLCTest()
        {
            this.ExitScreen();
            MainMenu.resetOS();
            if (!Settings.soundDisabled)
            {
                this.ScreenManager.playAlertSound();
            }
            OS     os       = new OS();
            string username = "******";

            SaveFileManager.AddUser(username, "test");
            string fileNameForUsername = SaveFileManager.GetSaveFileNameForUsername(username);

            os.IsDLCConventionDemo = true;
            os.Flags.AddFlag("TutorialComplete");
            Settings.EnableDLC         = true;
            Settings.initShowsTutorial = false;
            os.SaveGameUserName        = fileNameForUsername;
            os.SaveUserAccountName     = username;
            os.initShowsTutorial       = false;
            this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
            SessionAccelerator.AccelerateSessionToDLCStart((object)os);
            os.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() => Game1.getSingleton().IsMouseVisible = true));
        }
Esempio n. 4
0
        public static void ReDsicoverAllVisibleNodesInOSCache(object osobj)
        {
            OS    os   = (OS)osobj;
            float num1 = 0.0f;
            float num2 = 8f;
            float num3 = num2 / (float)os.netMap.nodes.Count;

            string[] strArray = os.PreDLCVisibleNodesCache.Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries);
            for (int index = 0; index < strArray.Length; ++index)
            {
                try
                {
                    int nIndex = Convert.ToInt32(strArray[index]);
                    os.delayer.Post(ActionDelayer.Wait((double)num1), (Action)(() =>
                    {
                        os.netMap.visibleNodes.Add(nIndex);
                        os.netMap.nodes[nIndex].highlightFlashTime = 1f;
                        SFX.addCircle(os.netMap.nodes[nIndex].getScreenSpacePosition(), Utils.AddativeWhite * 0.4f, 70f);
                    }));
                    os.delayer.Post(ActionDelayer.Wait((double)num2), (Action)(() => SFX.addCircle(os.netMap.nodes[nIndex].getScreenSpacePosition(), Utils.AddativeWhite * 0.3f, 30f)));
                }
                catch (FormatException ex)
                {
                    Console.WriteLine("Error restoring node " + (object)index);
                }
                num1 += num3;
                os.PreDLCVisibleNodesCache = "";
            }
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 private void doFolderGui(int width, int height, int indexOffset, Folder f, int recItteration)
 {
     for (var i = 0; i < f.folders.Count; ++i)
     {
         if (Button.doButton(300000 + i + indexOffset, x, y, width, height, "/" + f.folders[i].name, new Color?()))
         {
             var num = 0;
             for (var index = 0; index < os.navigationPath.Count - recItteration; ++index)
             {
                 Action action = () => os.runCommand("cd ..");
                 if (num > 0)
                 {
                     os.delayer.Post(ActionDelayer.Wait(num * 1.0), action);
                 }
                 else
                 {
                     action();
                 }
                 ++num;
             }
             Action action1 = () => os.runCommand("cd " + f.folders[i].name);
             if (num > 0)
             {
                 os.delayer.Post(ActionDelayer.Wait(num * 1.0), action1);
             }
             else
             {
                 action1();
             }
         }
         y += height + 2;
         x += 30;
         if (os.navigationPath.Count - 1 >= recItteration && os.navigationPath[recItteration] == i)
         {
             doFolderGui(width - 30, height, indexOffset + 10000 * (i + 1), f.folders[i], recItteration + 1);
         }
         x -= 30;
     }
     for (var index1 = 0; index1 < f.files.Count; ++index1)
     {
         if (Button.doButton(400000 + index1 + indexOffset / 2 + (index1 + 1) * indexOffset, x, y, width, height,
                             f.files[index1].name, new Color?()))
         {
             for (var index2 = 0; index2 < os.navigationPath.Count - recItteration; ++index2)
             {
                 os.runCommand("cd ..");
             }
             os.runCommand("cat " + f.files[index1].name);
         }
         y += height + 2;
     }
     if (f.folders.Count != 0 || f.files.Count != 0)
     {
         return;
     }
     TextItem.doFontLabel(new Vector2(x, y), "-Empty-", GuiData.tinyfont, new Color?(), width, height);
     y += height + 2;
 }
Esempio n. 7
0
 private void doFolderGui(int width, int height, int indexOffset, Folder f, int recItteration)
 {
     for (int i = 0; i < f.folders.Count; ++i)
     {
         if (Button.doButton(300000 + i + indexOffset, this.x, this.y, width, height, "/" + f.folders[i].name, new Color?()))
         {
             int num = 0;
             for (int index = 0; index < this.os.navigationPath.Count - recItteration; ++index)
             {
                 Action action = (Action)(() => this.os.runCommand("cd .."));
                 if (num > 0)
                 {
                     this.os.delayer.Post(ActionDelayer.Wait((double)num * 1.0), action);
                 }
                 else
                 {
                     action();
                 }
                 ++num;
             }
             Action action1 = (Action)(() => this.os.runCommand("cd " + f.folders[i].name));
             if (num > 0)
             {
                 this.os.delayer.Post(ActionDelayer.Wait((double)num * 1.0), action1);
             }
             else
             {
                 action1();
             }
         }
         this.y += height + 2;
         this.x += 30;
         if (this.os.navigationPath.Count - 1 >= recItteration && this.os.navigationPath[recItteration] == i)
         {
             this.doFolderGui(width - 30, height, indexOffset + 10000 * (i + 1), f.folders[i], recItteration + 1);
         }
         this.x -= 30;
     }
     for (int index1 = 0; index1 < f.files.Count; ++index1)
     {
         if (Button.doButton(400000 + index1 + indexOffset / 2 + (index1 + 1) * indexOffset, this.x, this.y, width, height, f.files[index1].name, new Color?()))
         {
             for (int index2 = 0; index2 < this.os.navigationPath.Count - recItteration; ++index2)
             {
                 this.os.runCommand("cd ..");
             }
             this.os.runCommand("cat " + f.files[index1].name);
         }
         this.y += height + 2;
     }
     if (f.folders.Count != 0 || f.files.Count != 0)
     {
         return;
     }
     TextItem.doFontLabel(new Vector2((float)this.x, (float)this.y), "-" + LocaleTerms.Loc("Empty") + "-", GuiData.tinyfont, new Color?(), (float)width, (float)height, false);
     this.y += height + 2;
 }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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)
                {
                }
            }));
        }
Esempio n. 10
0
 private void MoveToActiveState()
 {
     state                          = SequencerExeState.Active;
     stateTimer                     = 0.0f;
     targetRamUse                   = BASE_RAM_COST;
     os.warningFlashTimer           = OS.WARNING_FLASH_TIME;
     os.netMap.DimNonConnectedNodes = true;
     os.netMap.discoverNode(targetComp);
     os.runCommand("connect " + targetComp.ip);
     os.delayer.Post(ActionDelayer.Wait(0.05), () => os.runCommand("probe"));
 }
Esempio n. 11
0
 private void PlayerLostToTraceTimer()
 {
     this.os.runCommand("dc");
     this.os.runCommand("clear");
     this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() =>
     {
         this.os.write("-----------------\n\nKT_OVERRIDE_RECOVERY: " + LocaleTerms.Loc("Critical Error - resetting.") + "\n\n----------------");
         this.State = DLCIntroExe.IntroState.AssignMission1;
         this.TimeInThisState = 0.0f;
     }));
 }
Esempio n. 12
0
 public void BreakHeart()
 {
     PlayingHeartbreak       = true;
     os.terminal.inputLocked = true;
     os.netMap.inputLocked   = true;
     os.ram.inputLocked      = true;
     os.DisableTopBarButtons = true;
     MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped");
     SpinDownEffect.Play();
     os.delayer.Post(ActionDelayer.Wait(18.0), () => glowSoundEffect.Play());
 }
Esempio n. 13
0
 private void PrepateToClearCorpusOnNavigateAway()
 {
     this.os.delayer.Post(ActionDelayer.Wait(this.os.lastGameTime.ElapsedGameTime.TotalSeconds * 1.999), (Action)(() =>
     {
         if (!(this.os.display.command != this.name))
         {
             return;
         }
         this.corpus = (Corpus)null;
     }));
 }
Esempio n. 14
0
        public virtual void showSourcePressed()
        {
            var str   = "";
            var count = Programs.getNavigationPathAtPath("", os, root).Count;

            for (var index = 0; index < count; ++index)
            {
                str += "../";
            }
            os.runCommand("cd " + (str + "web"));
            os.delayer.Post(ActionDelayer.Wait(0.1), () => os.runCommand("cat " + lastLoadedFile.name));
        }
Esempio n. 15
0
 public override void Update(float t)
 {
     base.Update(t);
     elapsedTime += t;
     if (elapsedTime < BLUESCREEN_TIME / 4.0)
     {
         state = 0;
     }
     else if (elapsedTime < (double)BLUESCREEN_TIME)
     {
         state = 1;
     }
     else if (elapsedTime < BLUESCREEN_TIME + (double)BLACK_TIME)
     {
         state = 2;
     }
     else if (elapsedTime < BLUESCREEN_TIME + (double)BLACK_TIME + BOOT_TIME + bootTextErrorDelay)
     {
         state          = 3;
         bootTextTimer -= t;
         if (bootTextTimer <= 0.0)
         {
             bootTextTimer = bootTextDelay - (float)Utils.random.NextDouble() * bootTextDelay +
                             (float)Utils.random.NextDouble() * bootTextDelay;
             ++bootTextCount;
             if (bootTextCount >= bootText.Length - 1)
             {
                 bootTextCount = bootText.Length - 1;
             }
             if (bootText[bootTextCount].Equals(" "))
             {
                 bootTextTimer = bootTextDelay * 12f;
             }
             if (bootText[bootTextCount].StartsWith("ERROR:"))
             {
                 bootTextTimer = bootTextDelay * 29f;
                 os.thisComputer.bootupTick((float)-(bootTextDelay * 42.0));
                 bootTextErrorDelay += bootTextDelay * 42f;
             }
         }
         if (hasPlayedBeep)
         {
             return;
         }
         beep.Play(0.5f, 0.5f, 0.0f);
         os.delayer.Post(ActionDelayer.Wait(0.1), () => beep.Play(0.5f, 0.5f, 0.0f));
         hasPlayedBeep = true;
     }
     else
     {
         state = 2;
     }
 }
Esempio n. 16
0
 private void RollCredits()
 {
     IsInCredits = true;
     speechinstance.Stop();
     Settings.soundDisabled = false;
     elapsedTime            = 0.0f;
     os.delayer.Post(ActionDelayer.Wait(1.0), () =>
     {
         MusicManager.playSongImmediatley("Music\\Bit(Ending)");
         MediaPlayer.IsRepeating = false;
         AchievementsManager.Unlock("progress_complete", false);
     });
 }
Esempio n. 17
0
        public override void disconnectionDetected(Computer c, OS os)
        {
            base.disconnectionDetected(c, os);
            for (var index = 0; index < c.ports.Count; ++index)
            {
                c.closePort(c.ports[index], "LOCAL_ADMIN");
            }
            if (c.firewall != null)
            {
                c.firewall.resetSolutionProgress();
                c.firewall.solved = false;
            }
            if (c.hasProxy)
            {
                c.proxyActive        = true;
                c.proxyOverloadTicks = c.startingOverloadTicks;
            }
            var    time   = 20.0 * Utils.random.NextDouble();
            Action action = () =>
            {
                if (os.connectedComp != null && !(os.connectedComp.ip != c.ip))
                {
                    return;
                }
                for (var index = 0; index < c.ports.Count; ++index)
                {
                    c.closePort(c.ports[index], "LOCAL_ADMIN");
                }
                if (ResetsPassword)
                {
                    c.setAdminPassword(PortExploits.getRandomPassword());
                }
                c.adminIP = c.ip;
                if (c.firewall == null)
                {
                    return;
                }
                c.firewall.resetSolutionProgress();
            };

            if (IsSuper)
            {
                action();
            }
            else
            {
                os.delayer.Post(ActionDelayer.Wait(time), action);
            }
        }
Esempio n. 18
0
 internal static void loadCustomThemeBackground(OS os, string imagePathName)
 {
     if (imagePathName == ThemeManager.customBackgroundImageLoadPath)
     {
         ThemeManager.backgroundImage = ThemeManager.lastLoadedCustomBackground;
     }
     else
     {
         if (ThemeManager.backgroundNeedsDisposal)
         {
             Texture2D oldBackground = ThemeManager.backgroundImage;
             os.delayer.Post(ActionDelayer.NextTick(), (Action)(() => oldBackground.Dispose()));
         }
         if (string.IsNullOrWhiteSpace(imagePathName))
         {
             ThemeManager.backgroundImage = (Texture2D)null;
         }
         else
         {
             string path = Utils.GetFileLoadPrefix() + imagePathName;
             if (!File.Exists(path))
             {
                 path = "Content/" + imagePathName;
             }
             if (File.Exists(path))
             {
                 try
                 {
                     using (FileStream fileStream = File.OpenRead(path))
                     {
                         ThemeManager.backgroundImage         = Texture2D.FromStream(GuiData.spriteBatch.GraphicsDevice, (Stream)fileStream);
                         ThemeManager.backgroundNeedsDisposal = true;
                     }
                     ThemeManager.lastLoadedCustomBackground    = ThemeManager.backgroundImage;
                     ThemeManager.customBackgroundImageLoadPath = imagePathName;
                 }
                 catch (Exception ex)
                 {
                     ThemeManager.backgroundImage = (Texture2D)null;
                 }
             }
             else
             {
                 ThemeManager.backgroundImage = (Texture2D)null;
             }
         }
     }
 }
Esempio n. 19
0
        public virtual void showSourcePressed()
        {
            string str   = "";
            int    count = Programs.getNavigationPathAtPath("", this.os, this.root).Count;

            for (int index = 0; index < count; ++index)
            {
                str += "../";
            }
            this.os.runCommand("cd " + (str + "web"));
            if (this.lastLoadedFile == null)
            {
                return;
            }
            this.os.delayer.Post(ActionDelayer.Wait(0.1), (Action)(() => this.os.runCommand("cat " + this.lastLoadedFile.name)));
        }
Esempio n. 20
0
 public void BreakHeart()
 {
     if (this.os.TraceDangerSequence.IsActive)
     {
         this.os.TraceDangerSequence.CancelTraceDangerSequence();
     }
     this.os.RequestRemovalOfAllPopups();
     this.PlayingHeartbreak       = true;
     this.os.terminal.inputLocked = true;
     this.os.netMap.inputLocked   = true;
     this.os.ram.inputLocked      = true;
     this.os.DisableTopBarButtons = true;
     MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped");
     this.SpinDownEffect.Play();
     this.os.delayer.Post(ActionDelayer.Wait(18.0), (Action)(() => this.glowSoundEffect.Play()));
 }
Esempio n. 21
0
 public override void initFiles()
 {
     this.root                  = new Folder("ContractHub");
     this.missionsFolder        = new Folder("Contracts");
     this.listingsFolder        = new Folder("Listings");
     this.listingArchivesFolder = new Folder("Archives");
     this.missionsFolder.folders.Add(this.listingsFolder);
     this.missionsFolder.folders.Add(this.listingArchivesFolder);
     this.usersFolder = new Folder("Users");
     this.root.folders.Add(this.missionsFolder);
     this.root.folders.Add(this.usersFolder);
     this.root.files.Add(this.generateConfigFile());
     this.root.files.Add(new FileEntry(Computer.generateBinaryString(1024), "net64.sys"));
     this.populateUserList();
     this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() => this.loadInitialContracts()));
     this.comp.files.root.folders.Add(this.root);
 }
Esempio n. 22
0
        private void CompleteMailPhaseOut()
        {
            this.os.DisableEmailIcon = true;
            SFX.addCircle(this.os.mailicon.pos + new Vector2(20f, 6f), Utils.AddativeRed * 0.8f, 100f);
            for (int index = 0; index < 12; ++index)
            {
                this.os.delayer.Post(ActionDelayer.Wait((double)index / 7.0), (Action)(() => SFX.addCircle(this.os.mailicon.pos + new Vector2(20f, 6f), Utils.AddativeRed * 0.8f, 400f)));
            }
            Vector2 mailIconPos = this.os.mailicon.pos;

            this.explosion.Explode(1500, new Vector2(-0.1f, 3.241593f), mailIconPos, 1f, 8f, 100f, 1600f, 1000f, 1200f, 3f, 7f);
            this.os.delayer.Post(ActionDelayer.Wait(0.1), (Action)(() => this.explosion.Explode(100, new Vector2(-0.1f, 3.241593f), mailIconPos, 1f, 6f, 100f, 1300f, 1000f, 1300f, 3f, 7f)));
            this.BreakSound.Play();
            this.os.topBarIconsColor = this.originalTopBarIconsColor;
            PostProcessor.EndingSequenceFlashOutActive             = false;
            PostProcessor.EndingSequenceFlashOutPercentageComplete = 0.0f;
            this.os.terminal.reset();
        }
Esempio n. 23
0
        public static void AddNoteToOS(string note, OS os, bool isRecursiveSelfAdd = false)
        {
            for (var index = 0; index < os.exes.Count; ++index)
            {
                var notesExe = os.exes[index] as NotesExe;
                if (notesExe != null)
                {
                    notesExe.AddNote(note);
                    return;
                }
            }
            if (!isRecursiveSelfAdd)
            {
                os.runCommand("notes");
            }
            Action action = () => AddNoteToOS(note, os, true);

            os.delayer.Post(ActionDelayer.NextTick(), action);
        }
 public void DisconnectTarget()
 {
     this.os.execute("disconnect");
     this.os.display.command = "connectiondenied";
     this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() => this.os.display.command = "connectiondenied"));
     this.os.write(" ");
     this.os.write(" ");
     this.os.write("------------------------------");
     this.os.write("------------------------------");
     this.os.write(" ");
     this.os.write("---  " + LocaleTerms.Loc("CONNECTION ERROR") + "  ---");
     this.os.write(" ");
     this.os.write(LocaleTerms.Loc("Message from Server:"));
     this.os.write(string.Format(LocaleTerms.Loc("Whitelist Authenticator denied connection from IP {0}"), (object)this.os.thisComputer.ip));
     this.os.write(" ");
     this.os.write("------------------------------");
     this.os.write("------------------------------");
     this.os.write(" ");
 }
Esempio n. 25
0
        private IEnumerator <ActionDelayer.Condition> generateOutputPass(int pass, OS os, Computer target)
        {
            target.firewallAnalysisInProgress = true;
            os.write(string.Format(LocaleTerms.Loc("Firewall Analysis Pass {0}"), (object)this.analysisPasses) + "\n");
            yield return(ActionDelayer.Wait(0.03));

            os.write("--------------------");
            yield return(ActionDelayer.Wait(0.03));

            string preceedeString      = "     ";
            double secondsDelayPerLine = 0.08 + 0.06 * (double)pass + (double)this.additionalDelay;

            for (int i = 0; i < this.solutionLength; ++i)
            {
                os.write(preceedeString + this.generateOutputLine(i));
                yield return(ActionDelayer.Wait(secondsDelayPerLine));
            }
            os.write("--------------------\n");
            target.firewallAnalysisInProgress = false;
        }
Esempio n. 26
0
        private IEnumerator <ActionDelayer.Condition> generateOutputPass(int pass, OS os, Computer target)
        {
            target.firewallAnalysisInProgress = true;
            os.write("Firewall Analysis Pass " + analysisPasses + "\n");
            yield return(ActionDelayer.Wait(0.03));

            os.write("--------------------");
            yield return(ActionDelayer.Wait(0.03));

            var preceedeString      = "     ";
            var secondsDelayPerLine = 0.08 + 0.06 * pass + additionalDelay;

            for (var i = 0; i < solutionLength; ++i)
            {
                os.write(preceedeString + generateOutputLine(i));
                yield return(ActionDelayer.Wait(secondsDelayPerLine));
            }
            os.write("--------------------\n");
            target.firewallAnalysisInProgress = false;
        }
Esempio n. 27
0
 public override void Killed()
 {
     base.Killed();
     if (this.State == DLCIntroExe.IntroState.NotStarted || this.State == DLCIntroExe.IntroState.Exiting)
     {
         return;
     }
     this.os.delayer.Post(ActionDelayer.NextTick(), (Action)(() =>
     {
         DLCIntroExe dlcIntroExe = new DLCIntroExe(this.bounds, this.os, new string[0])
         {
             State = this.State, TimeInThisState = this.TimeInThisState, LoadedMission = this.LoadedMission, IsOnAssignment1 = this.IsOnAssignment1, AllAssignmentsComplete = this.AllAssignmentsComplete, MissionIsComplete = this.MissionIsComplete, PhaseTitle = this.PhaseTitle, PhaseSubtitle = this.PhaseSubtitle
         };
         if (this.OSTraceTimerOverrideActive)
         {
             this.os.traceCompleteOverrideAction = (Action)null;
             this.os.traceCompleteOverrideAction += new Action(dlcIntroExe.PlayerLostToTraceTimer);
         }
         this.os.addExe((ExeModule)dlcIntroExe);
     }));
 }
Esempio n. 28
0
 public override void Completed()
 {
     base.Completed();
     IsComplete = true;
     if (targetComp.attatchedDeviceIDs != null)
     {
         var strArray = targetComp.attatchedDeviceIDs.Split(Utils.commaDelim,
                                                            StringSplitOptions.RemoveEmptyEntries);
         var num = 0.0f;
         for (var index = 0; index < strArray.Length; ++index)
         {
             var device = Programs.getComputer(os, strArray[index]);
             if (device != null)
             {
                 Action action = () =>
                 {
                     os.netMap.discoverNode(device);
                     var loc = os.netMap.GetNodeDrawPos(device.location) +
                               new Vector2(os.netMap.bounds.X, os.netMap.bounds.Y) +
                               new Vector2(NetworkMap.NODE_SIZE / 2);
                     SFX.addCircle(loc, os.highlightColor, 120f);
                     os.delayer.Post(ActionDelayer.Wait(0.2), () => SFX.addCircle(loc, os.highlightColor, 80f));
                     os.delayer.Post(ActionDelayer.Wait(0.4), () => SFX.addCircle(loc, os.highlightColor, 65f));
                     os.write("eOS Device \"" + device.name + "\" opened for connection at " + device.ip);
                     ResultTitles.Add(device.name);
                     ResultBodies.Add(device.ip + " " + device.location + "\n" + Guid.NewGuid());
                 };
                 os.delayer.Post(ActionDelayer.Wait(num), action);
                 ++num;
                 ++devicesFound;
             }
         }
     }
     if (devicesFound != 0)
     {
         return;
     }
     isError = true;
 }
Esempio n. 29
0
 private void RollCredits()
 {
     if (this.os.TraceDangerSequence.IsActive)
     {
         this.os.TraceDangerSequence.CancelTraceDangerSequence();
     }
     this.IsInCredits = true;
     if (this.speechinstance != null)
     {
         this.speechinstance.Stop();
     }
     Settings.soundDisabled = false;
     this.elapsedTime       = 0.0f;
     this.os.delayer.Post(ActionDelayer.Wait(1.0), (Action)(() =>
     {
         MusicManager.playSongImmediatley("Music\\Bit(Ending)");
         MediaPlayer.IsRepeating = false;
         AchievementsManager.Unlock("progress_complete", false);
     }));
     PostProcessor.dangerModeEnabled         = false;
     PostProcessor.dangerModePercentComplete = 0.0f;
 }
        internal static void Execute(object osobj, Computer source, Computer target)
        {
            Console.WriteLine("Breakin Started!");
            PostProcessor.EndingSequenceFlashOutActive             = true;
            PostProcessor.EndingSequenceFlashOutPercentageComplete = 1f;
            OS       os  = (OS)osobj;
            DateTime now = DateTime.Now;

            os.Flags.AddFlag("startupBreakinTrapActivated");
            os.threadedSaveExecute(true);
            HostileHackerBreakinSequence.CopyHostileFileToLocalSystem();
            Console.WriteLine("Copied files to local system...");
            double totalSeconds = (DateTime.Now - now).TotalSeconds;
            double time         = totalSeconds <= 3.0 ? 4.0 - totalSeconds : 1.5;

            os.delayer.Post(ActionDelayer.Wait(time), (Action)(() =>
            {
                PostProcessor.EndingSequenceFlashOutActive = false;
                PostProcessor.EndingSequenceFlashOutPercentageComplete = 0.0f;
                os.thisComputer.crash(source.ip);
            }));
        }
Esempio n. 31
0
 public override void LoadContent()
 {
     if (canRunContent)
     {
         delayer = new ActionDelayer();
         ComputerLoader.init(this);
         content = ScreenManager.Game.Content;
         username = SaveUserAccountName == null
             ? (Settings.isConventionDemo ? Settings.ConventionLoginName : Environment.UserName)
             : SaveUserAccountName;
         username = FileSanitiser.purifyStringForDisplay(username);
         var compLocation = new Vector2(0.1f, 0.5f);
         if (multiplayer && !isServer)
             compLocation = new Vector2(0.8f, 0.8f);
         ramAvaliable = totalRam;
         var str = !multiplayer || !isServer ? NetworkMap.generateRandomIP() : NetworkMap.generateRandomIP();
         thisComputer = new Computer(username + " PC", NetworkMap.generateRandomIP(), compLocation, 5, 4, this);
         thisComputer.adminIP = thisComputer.ip;
         thisComputer.idName = "playerComp";
         var folder = thisComputer.files.root.searchForFolder("home");
         folder.folders.Add(new Folder("stash"));
         folder.folders.Add(new Folder("misc"));
         var userDetail = thisComputer.users[0];
         userDetail.known = true;
         thisComputer.users[0] = userDetail;
         defaultUser = new UserDetail(username, "password", 1);
         defaultUser.known = true;
         var theme = OSTheme.HacknetBlue;
         if (Settings.isConventionDemo)
         {
             var num = Utils.random.NextDouble();
             if (num < 0.33)
                 theme = OSTheme.HacknetMint;
             else if (num < 0.66)
                 theme = OSTheme.HackerGreen;
         }
         ThemeManager.setThemeOnComputer(thisComputer, theme);
         if (multiplayer)
         {
             thisComputer.addMultiplayerTargetFile();
             sendMessage("newComp #" + thisComputer.ip + "#" + compLocation.X + "#" + compLocation.Y +
                         "#" + 5 + "#" + thisComputer.name);
             multiplayerMissionLoaded = false;
         }
         if (!WillLoadSave)
             People.init();
         modules = new List<Module>();
         exes = new List<ExeModule>();
         shells = new List<ShellExe>();
         shellIPs = new List<string>();
         var viewport = ScreenManager.GraphicsDevice.Viewport;
         var width1 = RamModule.MODULE_WIDTH;
         var height1 = 205;
         var width2 = (int) ((viewport.Width - width1 - 6)*0.4442);
         var num1 = (int) ((viewport.Width - width1 - 6)*0.5558);
         var height2 = viewport.Height - height1 - TOP_BAR_HEIGHT - 6;
         terminal =
             new Terminal(
                 new Rectangle(viewport.Width - 2 - width2, TOP_BAR_HEIGHT, width2,
                     viewport.Height - TOP_BAR_HEIGHT - 2), this);
         terminal.name = "TERMINAL";
         modules.Add(terminal);
         netMap = new NetworkMap(new Rectangle(width1 + 4, viewport.Height - height1 - 2, num1 - 1, height1),
             this);
         netMap.name = "netMap v1.7";
         modules.Add(netMap);
         display = new DisplayModule(new Rectangle(width1 + 4, TOP_BAR_HEIGHT, num1 - 2, height2), this);
         display.name = "DISPLAY";
         modules.Add(display);
         ram =
             new RamModule(
                 new Rectangle(2, TOP_BAR_HEIGHT, width1, ramAvaliable + RamModule.contentStartOffset), this);
         ram.name = "RAM";
         modules.Add(ram);
         for (var index = 0; index < modules.Count; ++index)
             modules[index].LoadContent();
         for (var index = 0; index < 2; ++index)
         {
             if (isServer || !multiplayer)
                 thisComputer.links.Add(index);
             else
                 thisComputer.links.Add(netMap.nodes.Count - 1 - index);
         }
         var flag1 = false;
         if (!WillLoadSave)
         {
             netMap.nodes.Insert(0, thisComputer);
             netMap.visibleNodes.Add(0);
             MusicManager.loadAsCurrentSong("Music\\Revolve");
         }
         else
         {
             loadSaveFile();
             flag1 = true;
             Settings.initShowsTutorial = false;
         }
         if (!multiplayer && !flag1)
         {
             MailServer.shouldGenerateJunk = false;
             netMap.mailServer.addNewUser(thisComputer.ip, defaultUser);
         }
         mailicon = new MailIcon(this, new Vector2(0.0f, 0.0f));
         mailicon.pos.X = viewport.Width - mailicon.getWidth() - 2;
         topBar = new Rectangle(0, 0, viewport.Width, TOP_BAR_HEIGHT - 1);
         crashModule =
             new CrashModule(
                 new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                     ScreenManager.GraphicsDevice.Viewport.Height), this);
         crashModule.LoadContent();
         introTextModule =
             new IntroTextModule(
                 new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                     ScreenManager.GraphicsDevice.Viewport.Height), this);
         introTextModule.LoadContent();
         traceTracker = new TraceTracker(this);
         IncConnectionOverlay = new IncomingConnectionOverlay(this);
         if (allFactions == null)
         {
             allFactions = new AllFactions();
             allFactions.init();
         }
         currentFaction = allFactions.factions[allFactions.currentFaction];
         scanLines = content.Load<Texture2D>("ScanLines");
         cross = content.Load<Texture2D>("Cross");
         cog = content.Load<Texture2D>("Cog");
         saveIcon = content.Load<Texture2D>("SaveIcon");
         beepSound = content.Load<SoundEffect>("SFX/beep");
         if (!multiplayer & !flag1)
             loadMissionNodes();
         if (!flag1)
             MusicManager.playSong();
         if (flag1 || !Settings.slowOSStartup)
         {
             initShowsTutorial = false;
             introTextModule.complete = true;
         }
         inputEnabled = true;
         isLoaded = true;
         fullscreen = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
             ScreenManager.GraphicsDevice.Viewport.Height);
         TraceDangerSequence = new TraceDangerSequence(content, ScreenManager.SpriteBatch, fullscreen, this);
         endingSequence = new EndingSequenceModule(fullscreen, this);
         var flag2 = Settings.slowOSStartup && !flag1;
         var flag3 = Settings.osStartsWithTutorial && (!flag1 || !Flags.HasFlag("TutorialComplete"));
         if (flag2)
         {
             rebootThisComputer();
             if (!Settings.initShowsTutorial)
                 return;
             display.visible = false;
             ram.visible = false;
             netMap.visible = false;
             terminal.visible = true;
         }
         else if (flag3)
         {
             display.visible = false;
             ram.visible = false;
             netMap.visible = false;
             terminal.visible = true;
             terminal.reset();
             Settings.initShowsTutorial = true;
             initShowsTutorial = true;
             if (TestingPassOnly)
                 return;
             execute("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj Init");
         }
         else
         {
             if (!TestingPassOnly)
                 runCommand("connect " + thisComputer.ip);
             if (thisComputer.files.root.searchForFolder("sys").searchForFile("Notes_Reopener.bat") == null)
                 return;
             runCommand("notes");
         }
     }
     else
     {
         if (!multiplayer)
             return;
         initializeNetwork();
     }
 }