예제 #1
0
    public void AttemptSolve()
    {
        NetworkDevice   device = TerminalNetwork.GetCurrentDevice();
        NetworkFirewall wall   = device.networkNode.FireWall;

        NetworkFirewall.FirewallLevel level = wall.GetNextClosedFirewall();
        int levelIndex = wall.GetNextClosedFirewallIndex();

        if (level.CurrentGuess == level.Password)
        {
            level.Unlocked = true;

            ModifyLevel(levelIndex, true);

            TerminalCore.AddMessage(
                string.Format("\t- Firewall Cracked:" + TerminalColourScheme.FormatText("{0}/{1}", TerminalStyle.INFO),
                              wall.GetSolvedLevels(),
                              wall.GetTotalLevels()
                              ));


            if (wall.GetSolvedLevels() == wall.GetTotalLevels())
            {
                TerminalCore.AddMessage(TerminalColourScheme.FormatText("\n\t- Firewall Broken.", TerminalStyle.WARNING) + TerminalColourScheme.FormatText("\n\tAccess Granted.", TerminalStyle.INFO));
            }
        }
        else
        {
            TerminalUI.ForceInput("solve ");
        }
    }
예제 #2
0
    public void SolveCommand(string[] args)
    {
        NetworkDevice   device = TerminalNetwork.GetCurrentDevice();
        NetworkFirewall wall   = device.networkNode.FireWall;

        NetworkFirewall.FirewallLevel level = wall.GetNextClosedFirewall();
        int levelIndex = wall.GetNextClosedFirewallIndex();

        if (args.Length > 0)
        {
            if (args[0].ToUpper() == level.Password.ToUpper())
            {
                TerminalCore.AddLoadingBar(0.5f, AttemptSolve, "\n\tAttempting Solution: " + level.Password, "\n\tSolution Accepted.");

                level.CurrentGuess = level.Password;
                return;
            }

            char   guess        = args[0].ToUpper()[0];
            char[] CurrentGuess = level.CurrentGuess.ToCharArray();
            for (int i = 0; i < level.Password.Length; i++)
            {
                if (level.Password.ToUpper()[i] == guess)
                {
                    CurrentGuess[i] = level.Password[i];
                }
            }

            level.CurrentGuess = new string(CurrentGuess);
            TerminalCore.AddMessage("");
            string[] array = level.CurrentGuess.ToCharArray().Select(a => a.ToString()).ToArray();
            array[0] = "\t - Guess: " + array[0];
            TerminalCore.AddLoadingBar(0.5f, AttemptSolve, array);
        }
    }