示例#1
0
 private bool Handle5()
 {
     if (Solution == null || Position == Solution.Length)
     {
         return(false);
     }
     Button5.AddInteractionPunch(0.2f);
     Handle(5);
     return(false);
 }
    public IEnumerator ProcessTwitchCommand(string cmd)
    {
        if (Solution == null || Position >= Solution.Length)
        {
            yield break;
        }
        cmd = cmd.ToLowerInvariant();

        int cut;

        if (cmd.StartsWith("submit "))
        {
            cut = 7;
        }
        else if (cmd.StartsWith("press "))
        {
            cut = 6;
        }
        else
        {
            yield return("sendtochaterror Use either 'submit' or 'press' followed by a number sequence.");

            yield break;
        }

        List <int> digits = new List <int>();

        char[] strSplit = cmd.Substring(cut).ToCharArray();
        foreach (char c in strSplit)
        {
            if (!"0123456789 ,".Contains(c))
            {
                yield return("sendtochaterror Invalid character in number sequence: '" + c + "'.\nValid characters are 0-9, space, and comma.");

                yield break;
            }

            int d = GetDigit(c);
            if (d != -1)
            {
                digits.Add(d);
            }
        }
        if (digits.Count == 0)
        {
            yield break;
        }
        if (digits.Count > (Solution.Length - Position))
        {
            yield return("sendtochaterror Too many digits submitted.");

            yield break;
        }

        int progress = BombInfo.GetSolvedModuleNames().Where(x => !ignoredModules.Contains(x)).Count();

        if (progress < Solution.Length)
        {
            yield return("Forget Me Not");

            yield return("sendtochat DansGame A little early, don't you think?");

            Handle(digits[0]);
            yield break;
        }
        yield return("Forget Me Not");

        yield return("sendtochat PogChamp Here we go!");

        yield return("multiple strikes"); //Needed for fake solve.

        SolveType solve = pickSolveType(digits.Count, Solution.Length - Position);

        foreach (int d in digits)
        {
            Button5.AddInteractionPunch(0.2f);
            bool valid = Handle(d);
            if (!valid)
            {
                if (solve == SolveType.REGULAR && BombInfo.GetTime() >= 45 && Random.value > 0.95)
                {
                    yield return(new WaitForSeconds(2));

                    yield return("sendtochat Kreygasm We did it reddit!");

                    yield return(new WaitForSeconds(1));

                    yield return("sendtochat Kappa Nope, just kidding.");
                }
                else
                {
                    yield return("sendtochat DansGame This isn't correct...");
                }
                yield return("sendtochat Correct digits entered: " + Position);

                break;
            }
            if (Position >= Solution.Length)
            {
                yield return("sendtochat Kreygasm We did it reddit!");

                break;
            }

            if (getMusicToggle(solve, Position, digits.Count, Solution.Length - Position))
            {
                yield return("toggle waiting music");
            }
            yield return(new WaitForSeconds(getDelay(solve, Position, digits.Count, Solution.Length - Position)));
        }
        yield return("end multiple strikes");

        yield break;
    }