Exemple #1
0
    private IEnumerator TwitchHandleForcedSolve()
    {
        if (!Interact.isActive)
        {
            SubModuleSelectable.OnInteract();
        }
        while (!Interact.isActive)
        {
            yield return(true);
        }

        if (!Interact.isSubmitting)
        {
            SubModuleSelectable.OnInteract();
        }
        while (!Interact.isSubmitting || Interact.isRotating || (Interact.Dimension == 10 && Interact.GetPreciseLastDigitOfTimer > 9.75f))
        {
            yield return(true);
        }

        int[][] answer = Interact.GetAnswer(ZenModeActive);
        for (int i = 0; i < answer.Length; i++)
        {
            while (Interact.GetLastDigitOfTimer != (Interact.Dimension > 10 ? 19 : 9) || (Interact.GetPreciseLastDigitOfTimer > 9.125f && Interact.Dimension == 10))
            {
                yield return(true);
            }

            for (int j = 0; j < answer[i].Length; j++)
            {
                while (Interact.GetLastDigitOfTimer != answer[i][j])
                {
                    yield return(null);
                }
                SubModuleSelectable.OnInteract();
            }
        }

        while (!IsSolved)
        {
            yield return(true);
        }
    }
Exemple #2
0
#pragma warning restore 414

    private IEnumerator ProcessTwitchCommand(string command)
    {
        string[] split = command.Split();

        if (Regex.IsMatch(split[0], @"^\s*succumb\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            SubModuleSelectable.OnInteract();
        }

        else if (Regex.IsMatch(split[0], @"^\s*settings\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            yield return(@"sendtochat NOTE, SETTINGS CANNOT BE CHANGED AFTER MODULE INITIATION! | !{1} set 3-12 (Sets dimension count, in Normal/Time mode you may not start with less than 9) | !{1} spin <#> (Sets rotation count, in Normal/Time mode you may not start with less than 3, sets the amount of rotations) | !1 stay (Toggle: Keeps each sphere's colors as they rotate rather than updating based on position) | !{1} stretch (Toggle: Only affects dimensions not divisible by 3, stretches the X, Y, and Z planes to fit the module, however it causes some axes to become exaggerated) | !{1} springiness (Toggle: Uses InOutBounce ease, do not use on serious TP bombs)");
        }

        else if (Regex.IsMatch(split[0], @"^\s*spin\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            split = split.Skip(1).ToArray();
            byte n;

            if (Interact.Dimension != 0)
            {
                yield return("sendtochaterror Since the module has been activated at least once, this value can no longer change.");
            }

            else if (split.Length != 1)
            {
                yield return("sendtochaterror " + (split.Length == 0 ? "No arguments are specified. Expected: 0-5." : "Too many arguments are specified. Expected: 0-100."));
            }

            else if (!byte.TryParse(split[0], out n))
            {
                yield return("sendtochaterror The argument must be a number.");
            }

            else if (!ZenModeActive && n > 5)
            {
                yield return("sendtochaterror You cannot exceed 5 rotations in normal/time mode, what are you, a lunatic?");
            }

            else if (!ZenModeActive && n < 3 && !Application.isEditor)
            {
                yield return("sendtochaterror You cannot change the module to be lower than 3 rotations on Normal/Time mode.");
            }

            else
            {
                rotation = n;
                yield return("sendtochat This module now activates with " + n + (n == 1 ? " rotation." : " rotations."));
            }
        }

        else if (Regex.IsMatch(split[0], @"^\s*stretch\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            if (Interact.Dimension != 0)
            {
                yield return("sendtochaterror Since the module has been activated at least once, this value can no longer change.");
            }

            else
            {
                stretchToFit = !stretchToFit;
                yield return("sendtochat The module will" + (stretchToFit ? " " : " not ") + "stretch the X, Y, and Z planes individually.");
            }
        }

        else if (Regex.IsMatch(split[0], @"^\s*stay\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            if (Interact.Dimension != 0)
            {
                yield return("sendtochaterror Since the module has been activated at least once, this value can no longer change.");
            }

            else
            {
                colorAssist = !colorAssist;
                yield return("sendtochat The module will" + (colorAssist ? " " : " not ") + "maintain the colors of each sphere.");
            }
        }

        else if (Regex.IsMatch(split[0], @"^\s*springiness\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            if (Interact.Dimension != 0)
            {
                yield return("sendtochaterror Since the module has been activated at least once, this value can no longer change.");
            }

            else
            {
                isUsingBounce          = !isUsingBounce;
                Interact.isUsingBounce = isUsingBounce;
                yield return("sendtochat The module will" + (isUsingBounce ? " " : " not ") + "alter the sphere's movements.");
            }
        }

        else if (Regex.IsMatch(split[0], @"^\s*set\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            split = split.Skip(1).ToArray();
            int n;

            if (Interact.Dimension != 0)
            {
                yield return("sendtochaterror Since the module has been activated at least once, this value can no longer change.");
            }

            else if (split.Length != 1)
            {
                yield return("sendtochaterror " + (split.Length == 0 ? "No arguments are specified. Expected: 3-12." : "Too many arguments are specified. Expected: 3-12."));
            }

            else if (!int.TryParse(split[0], out n))
            {
                yield return("sendtochaterror The argument must be a number.");
            }

            else if (n < 3 || n > 12)
            {
                yield return("sendtochaterror The number of dimensions specified is not supported.");
            }

            else if (!ZenModeActive && n < 9 && !Application.isEditor)
            {
                yield return("sendtochaterror You cannot change the module to be lower than 9 dimensions on Normal/Time mode.");
            }

            else
            {
                dimensionOverride = n;
                yield return("sendtochat This module now activates with " + n + " dimensions.");
            }
        }

        else if (Regex.IsMatch(split[0], @"^\s*submit\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant))
        {
            yield return(null);

            split = split.Skip(1).ToArray();
            int p;

            if (!Interact.isActive)
            {
                yield return("sendtochaterror The module isn't active. Use the \"succumb\" command.");
            }

            else if (!Interact.isSubmitting)
            {
                yield return("sendtochaterror The module isn't in submission. Use the \"succumb\" command.");
            }

            else if (split.Length == 0)
            {
                yield return("sendtochaterror Digits are expected to be provided as well. Expected: 0 to " + (Interact.Dimension - 1) + ".");
            }

            else if (split.Any(s => !int.TryParse(s, out p)))
            {
                yield return("sendtochaterror At least one of the arguments are not digits. Expected: 0 to " + (Interact.Dimension - 1) + ".");
            }

            else if (split.Any(s => int.Parse(s) >= Interact.Dimension))
            {
                yield return("sendtochaterror At least one of the arguments exceeded the amount of dimensions. Expected: 0 to " + (Interact.Dimension - 1) + ".");
            }

            else
            {
                int[] times = split.Select(s => int.Parse(s)).ToArray();

                if (times.Length == Interact.Dimension)
                {
                    if (Interact.startingSphere.Select((a, n) => a.Value != Interact.AnchorSphere.ElementAt(n).Value).All(b => !b))
                    {
                        yield return("solve");

                        yield return("awardpointsonsolve " + AwardPoints());
                    }

                    else
                    {
                        yield return("strike");
                    }
                }
                for (int i = 0; i < times.Length; i++)
                {
                    while (Interact.GetLastDigitOfTimer != times[i] || (Interact.Dimension == 10 && Interact.GetPreciseLastDigitOfTimer >= 9.75f))
                    {
                        yield return(true);
                    }
                    SubModuleSelectable.OnInteract();
                }
            }
        }
    }