Example #1
0
        private void BotMainLoop()
        {
            try
            {
                if (SettingsManager.settings.champ && !SettingsManager.settings.Initialize())
                {
                    checkChamp.Checked = false;
                    checkChamp.Enabled = false;
                }

                BoxOpener.SetBoxes();

                if (SettingsManager.settings.boxTime.CompareTo(DateTime.Now) > 0)
                {
                    Logger.Log("Next box opens at: " + SettingsManager.settings.boxTime.ToString());
                }

                while (toogleState == CheckState.Checked && toogleStartStop.Checked)
                {
                    if (BoxOpener.Run() == Messages.Restart)
                    {
                        Game.RestartProtocol();
                    }

                    if (Championship.Run() == Messages.Restart)
                    {
                        Game.RestartProtocol();
                        Championship.SetChamp();
                    }

                    if (QuickFight.Run(loops: 5) == Messages.Restart)
                    {
                        Game.RestartProtocol();
                    }

                    if (Hibernate.Run() == Messages.Hibernate)
                    {
                        toogleState      = CheckState.Indeterminate;
                        this.WindowState = FormWindowState.Minimized;
                    }
                }

                toogleState             = CheckState.Unchecked;
                toogleStartStop.Checked = false;
                sw.Stop();
                TimeSpan ts = sw.Elapsed;
                SettingsManager.currentStatistics.working += ts.TotalHours;
            }
            catch (Exception e)
            {
                Logger.Log("BotMainLoop Exception: " + e.Message, debug: true);
            }
        }