コード例 #1
0
        public void netscan()
        {
            Console.WriteLine("==================== NETSCAN ====================");
            Console.WriteLine("Computer(s) on the network:");
            int    temp = GameInstance.randomNumber(3, 10);
            string ip;
            string ipLocation;

            for (int i = 0; i < temp; i++)
            {
                ip         = GameInstance.ipGenerator();
                ipLocation = aiSaveLocation + "/" + ip + "/";
                if (Directory.Exists(ipLocation))
                {
                    Console.WriteLine(ip + "|..........|FireWall Level: " + AIManager.aiFirewallLevel(ipLocation));
                }
                else
                {
                    AIManager.generateAI(ip);
                }
                Console.WriteLine(ip + "|..........|FireWall Level: " + AIManager.aiFirewallLevel(ipLocation));
            }
            Console.WriteLine("");
        }//scan network for ip addresses, if found new ip create new ai with that ip
コード例 #2
0
        public AI(string address, bool loadAI, string path)
        {
            if (loadAI == true)
            {
                if (Directory.Exists(savesForAi + "/" + address + "/"))
                {
                    ip = address;
                    string[] saves = Directory.GetFiles(path + "/" + address + "/");
                    try
                    {
                        for (int i = 0; i <= saves.Length; i++)//load each save into memory
                        {
                            switch (i)
                            {
                            case 0:
                                Bitcoin = Convert.ToInt32(HaxNet.loadGame(saves[i]));
                                break;

                            case 1:
                                Cracker = Convert.ToDouble(HaxNet.loadGame(saves[i]));
                                break;

                            case 2:
                                Firewall = Convert.ToDouble(HaxNet.loadGame(saves[i]));
                                break;

                            case 3:
                                health = Convert.ToInt32(HaxNet.loadGame(saves[i]));
                                break;

                            case 4:
                                AiName = HaxNet.loadGame(saves[i]);
                                break;

                            case 5:
                                OperatingSystem = Convert.ToDouble(HaxNet.loadGame(saves[i]));
                                break;

                            case 6:
                                Scanner = Convert.ToDouble(HaxNet.loadGame(saves[i]));
                                break;

                            case 7:
                                AiTitle = HaxNet.loadGame(saves[i]);
                                break;

                            default:
                                Console.Write(".");
                                break;
                            }
                        }
                    }
                    catch
                    {
                        Console.WriteLine("Error! Save files corrupted!");//if one or more save files throws an exception
                        string t = Console.ReadLine();
                        GameInstance.resetAll();
                        GameInstance.close();
                    }
                    Console.WriteLine("");
                }
                else
                {
                    Console.WriteLine("Error: connection to [{0}] lost.", ip);
                }
            }
            else
            {
                Console.WriteLine("...");
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: nathanielbunch/HaxNET
        static void Main(string[] args)
        {
            Console.Title = "<<<<<HaxNET>>>>>";                     //title for game window
            Directory.CreateDirectory(Player.SaveLocation);         //create save directory
            SpeechSynthesizer talk       = new SpeechSynthesizer(); //just in case if the program needs speech synthesis
            GameInstance      HaxNet     = new GameInstance();      //make new game process, set window height/size 500, 500
            CommandManager    HaxCommand = new CommandManager();    //add new manager for sorting out user-commands

            Animation.studioAnimation();                            //play studio animation
            Animation.startupAnimation();

            string command;//initialize game variable


instructionLoop:
            Console.WriteLine("");
            Console.WriteLine("Welcome to HaxNET, the PC hacking simulation platform."); //make players feel welcome
            Console.Write("Do you need instruction? (y/n): ");                           //ask if they need some instruction
            command = Console.ReadLine();
            if (command == "y")
            {
                HaxCommand.instruct();
                goto start;
            }
            else
            if (command == "n")
            {
                goto start;
            }
            else
            {
                Console.WriteLine("Error! Incorrect char entered");
            }
            goto instructionLoop;


start:                                    //begin doing interesting stuff
            command = "";
            Animation.loadingAnimation(); //play the game loading animation
            if (HaxNet.SaveCheck())       //check for a save file
            {
                goto yesSave;
            }
            else
            {
                goto noSave;
            }


noSave:
            Console.WriteLine("No user save found!");//begin new game if no save files found
            Console.WriteLine("Beginning new game....");
            Console.WriteLine("-----------------------------------------------------------");
            Console.Write("Please type a username: "******"-----------------------------------------------------------");
            Player.savePlayer();
            goto MainLoop;


yesSave:
            Console.WriteLine("Done save check.");//load the saved game
            try
            {
                string[] loadfiles = new string[] { Player.BitcoinSave, Player.CrackerSave, Player.FireWallSave, Player.HealthSave, Player.OsSave, Player.PlayerNameSave, Player.PlayerTitleSave, Player.ScannerSave, Player.XpSave, Player.DownloadSpeedSave, Player.UploadSpeedSave, Player.ConnectionSave, Player.IpAddressSave }; //get save file locations
                for (int i = 0; i <= loadfiles.Length; i++)                                                                                                                                                                                                                                                                           //load each save into memory
                {
                    switch (i)
                    {
                    case 0:
                        Player.Bitcoin = Convert.ToInt32(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 1:
                        Player.Cracker = Convert.ToInt32(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 2:
                        Player.Firewall = Convert.ToDouble(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 3:
                        Player.Health = Convert.ToInt32(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 4:
                        Player.OperatingSystem = Convert.ToDouble(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 5:
                        Player.PlayerName = HaxNet.loadGame(loadfiles[i]);
                        break;

                    case 6:
                        Player.PlayerTitle = HaxNet.loadGame(loadfiles[i]);
                        break;

                    case 7:
                        Player.Scanner = Convert.ToDouble(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 8:
                        Player.Xp = Convert.ToDouble(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 9:
                        Player.Downspeed = Convert.ToDouble(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 10:
                        Player.UpSpeed = Convert.ToDouble(HaxNet.loadGame(loadfiles[i]));
                        break;

                    case 11:
                        Player.ConnectionStatus = HaxNet.loadGame(loadfiles[i]);
                        break;

                    case 12:
                        Player.IpAddress = HaxNet.loadGame(loadfiles[i]);
                        break;

                    default:
                        Console.WriteLine("Done.");
                        break;
                    }
                }
            }
            catch
            {
                Console.WriteLine("Error! Save files corrupted!");//if one or more save files throws an exception
                string t = Console.ReadLine();
                GameInstance.resetAll();
                GameInstance.close();
            }
            Console.WriteLine("done");
            goto MainLoop;


MainLoop:   //finally! the main game processes!
            Player.savePlayer();
            if (HaxNet.checkForloseGame(Player.Health) == true)
            {
                Animation.loseGame();
                Player.savePlayer();
                GameInstance.resetAll();
                GameInstance.close();
            }
            else
            {
                Console.Write(Player.PlayerName + "@hax.net>");
            }
            command = Console.ReadLine();
            if (Player.Viruses > 0)
            {
                for (int i = 0; i < Animation.defaultTime * Player.Viruses; i++)
                {
                }
            }
            Logic.aiLogic();
            string[] commandArgs = command.Split(' ');//check if more than one argument entered
            var      e           = from s in commandArgs
                                   select s;
            int c = e.Count();

            if (c > 1)     //if more than one argument
            {
                if (c > 2) //if three arguments
                {
                    Console.WriteLine("Too many arguments for this command!");
                }
                else
                if (c == 2)    //if two arguments
                {
                    HaxCommand.action(commandArgs[0], commandArgs[1]);
                }
                else//if more than three arguments
                {
                    Console.WriteLine("Command not found!");
                }
            }
            else
            {
                HaxCommand.action(command); //else take normal action
            }
            goto MainLoop;                  //loop
        }
コード例 #4
0
        }//display how much virtual disk space the user is using

        public void gameExit()//exit the game
        {
            Player.savePlayer();
            GameInstance.close();
        }
コード例 #5
0
ファイル: AIManager.cs プロジェクト: nathanielbunch/HaxNET
        }//find firewall level of selected ai

        public static string generateAIName()
        {
            int    namelength = GameInstance.randomNumber(5, 12);
            int    character;
            string name = "";

            for (int i = 0; i < namelength; i++)
            {
                character = GameInstance.randomNumber(1, 27);
                switch (character)
                {
                case 1:
                    name += "a";
                    break;

                case 2:
                    name += "b";
                    break;

                case 3:
                    name += "c";
                    break;

                case 4:
                    name += "d";
                    break;

                case 5:
                    name += "e";
                    break;

                case 6:
                    name += "f";
                    break;

                case 7:
                    name += "g";
                    break;

                case 8:
                    name += "h";
                    break;

                case 9:
                    name += "i";
                    break;

                case 10:
                    name += "j";
                    break;

                case 11:
                    name += "k";
                    break;

                case 12:
                    name += "l";
                    break;

                case 13:
                    name += "m";
                    break;

                case 14:
                    name += "n";
                    break;

                case 15:
                    name += "o";
                    break;

                case 16:
                    name += "p";
                    break;

                case 17:
                    name += "q";
                    break;

                case 18:
                    name += "r";
                    break;

                case 19:
                    name += "s";
                    break;

                case 20:
                    name += "t";
                    break;

                case 21:
                    name += "u";
                    break;

                case 22:
                    name += "v";
                    break;

                case 23:
                    name += "w";
                    break;

                case 24:
                    name += "x";
                    break;

                case 25:
                    name += "y";
                    break;

                case 26:
                    name += "z";
                    break;

                default:
                    name += "_";
                    break;
                }
            }
            return(name);
        }//generate a name for ai player NOTE: name does not follow standard english rules!