Exemple #1
0
        /// <summary>
        /// Verifies that the in-game settings are correct
        /// </summary>
        /// <param name="config">Config to compare against</param>
        /// <returns>How many settings were missed</returns>
        public static int VerifyFlipped(RushConfig config)
        {
            //Loads the data from file
            Data.LoadRotMGData();

            int missedCount = 0;

            for (int i = 0; i < Data.debuffSettings.Length; i++)
            {
                if (Data.debuffSettings[i] != config.debuffs[i])
                {
                    missedCount++;
                }
            }

            for (int i = 0; i < Data.otherSettings.Length; i++)
            {
                if (Data.otherSettings[i] != config.others[i])
                {
                    missedCount++;
                }
            }

            return(missedCount);
        }
 /// <summary>
 /// Loads the config from the rushConfigs if it exists
 /// </summary>
 private void LoadConfig()
 {
     //If the config exists
     if (Data.rushConfigs[globalIndex - offset] != null)
     {
         //Set the config and refresh the screen
         config = Data.rushConfigs[globalIndex - offset];
         ConfigToScreen();
     }
     else
     {
         //Create a new config
         config = new RushConfig();
         Data.rushConfigs[globalIndex - offset] = config;
         //Store the default values to the new config
         ScreenToConfig();
     }
 }
Exemple #3
0
        /// <summary>
        /// Attempts to change the given settings, attempts 3 times
        /// </summary>
        /// <param name="config">The config to try to change to</param>
        /// <param name="depth">Attempt count</param>
        private static void FlipSettings(RushConfig config, int depth = 0)
        {
            //After 3 attempts, throw an error
            if (depth >= 3)
            {
                Console.WriteLine("Unable to flip settings properly, check your options key.", Console.logTypes.ERROR);
                return;
            }

            bool settingsOpen = false;
            int  currentTab   = -1;

            //Runs through each debuff setting
            for (int i = 0; i < Data.debuffSettings.Length; i++)
            {
                //If the settings are different
                if (Data.debuffSettings[i] != config.debuffs[i])
                {
                    //If you haven't already opened the settings menu, do so
                    if (!settingsOpen)
                    {
                        settingsOpen = true;
                        Data.window.OpenSettings();
                    }

                    //If you're not already on the proper tab, switch
                    if (currentTab != 0)
                    {
                        currentTab = 0;
                        Data.window.SettingsTab(Info.headerNames.Debuffs);
                    }

                    //Toggle the debuff
                    Data.window.ClickDebuff(i);
                }
            }

            //Run through each other setting
            for (int i = 0; i < Data.otherSettings.Length; i++)
            {
                if (Data.otherSettings[i] != config.others[i])
                {
                    //If you haven't already opened the settings menu, do so
                    if (!settingsOpen)
                    {
                        settingsOpen = true;
                        Data.window.OpenSettings();
                    }

                    //Done this way to allow for settings to jump around
                    //Checks which tab the setting should be and changes to it
                    if (Array.IndexOf(new int[1] {
                        0
                    }, i) != -1)
                    {
                        if (currentTab != 1)
                        {
                            currentTab = 1;
                            Data.window.SettingsTab(Info.headerNames.Visual);
                        }
                    }
                    else if (Array.IndexOf(new int[4] {
                        1, 2, 3, 4
                    }, i) != -1)
                    {
                        if (currentTab != 2)
                        {
                            currentTab = 2;
                            Data.window.SettingsTab(Info.headerNames.World);
                        }
                    }

                    //Clicks the setting
                    Data.window.ClickOther(i);
                }
            }

            //Closes the settings
            Data.window.CloseSettings();

            //Sleep to let the settings save to file
            Thread.Sleep(400);

            //Count how many missed
            int missedCount = VerifyFlipped(config);

            //Retry if missed any
            if (missedCount > 0)
            {
                Console.WriteLine("Missed " + missedCount + " flips, retrying!", Console.logTypes.WARN);
                FlipSettings(config, depth + 1);
                return;
            }
        }