コード例 #1
0
 private static void TaskTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (Tasks.Count >= 1)
     {
         var _task = Tasks[currentID];
         if (RemoveTask(currentID))
         {
             var nextTask = Tasks.Values.ToArray()[0];
             currentID = nextTask.id;
             ChangeTask(nextTask.type);
             if (_task.type == "bm" && Tasks.Count > 0)
             {
                 BotSettings.leaveBM    = true;
                 BotSettings.autoJoinBM = false;
             }
             if (_task.type == "raid" && Tasks.Count > 0)
             {
                 BotSettings.leaveBM      = true;
                 BotSettings.autoJoinRaid = false;
             }
             BotMethods.WriteLine("Finished Task. Starting " + Tasks[currentID].type + " Task.");
             Thread.Sleep(100);
         }
     }
     else
     {
         StopTaskSystem();
         if (BotSettings.tasksDoneLogout)
         {
             BotMethods.WriteLine("Finished all Tasks. Logging out.");
             BotLogic.StopBotThread();
             var point = Bot.MoveToCorner();
             BotMethods.MoveTo(point.X, point.Y);
             var counter = 60;
             Thread.Sleep(555);
             while (Account.Route.Count >= 3 && !Account.IsSunk && counter > 0)
             {
                 if (point.X == Account.Position.X && point.Y == Account.Position.Y)
                 {
                     break;
                 }
                 Thread.Sleep(1000);
                 counter--;
             }
             Thread.Sleep(new Random().Next(175, 385));
             BotMethods.Logout(0);
             LogginOut = true;
             while (Server.Connected)
             {
                 Thread.Sleep(100);
             }
             BotCalculator.StopThreads();
             BotMethods.WriteLine("Succesfully logged out.");
             return;
         }
         BotMethods.WriteLine("Finished all Tasks. Returning to default Settings.");
     }
 }
コード例 #2
0
        public void LicenseThread()
        {
            var _restartCounter = 0;

IL_BEGIN:
            try
            {
                while (true)
                {
                    try
                    {
                        this.Authenticate();
                        var versionflag = CheckVersion();
                        if (!versionflag)
                        {
                            if (!Bot.Running && !BotLogic.OnAttackRunning && !BotSession.logginIn && !BotSession.loggedIn)
                            {
                                if (MessageBox.Show("A new version is available!\nDo you wish to visit the download-area now?", "New Version!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                                {
                                    Process.Start("https://www.elitepvpers.com/forum/seafight/4222822-release-boxybot.html");
                                }
                            }
                            BotMethods.WriteLine("A newer Version is available!");
                        }
                        if (status == "-4")
                        {
                            BotMethods.WriteLine("License Suspended!");
                            MessageBox.Show("Your License has been suspended!", "License suspended!");
                            Account.gClass = null;
                        }
                        else if (status == "-3")
                        {
                            BotMethods.WriteLine(string.Join("", new string[]
                            {
                                HelpTools.FromByteToString(32),
                                HelpTools.FromByteToString(45),
                                HelpTools.FromByteToString(32),
                                HelpTools.FromByteToString(76),
                                HelpTools.FromByteToString(105),
                                HelpTools.FromByteToString(99),
                                HelpTools.FromByteToString(101),
                                HelpTools.FromByteToString(110),
                                HelpTools.FromByteToString(115),
                                HelpTools.FromByteToString(01),
                                HelpTools.FromByteToString(32),
                                HelpTools.FromByteToString(69),
                                HelpTools.FromByteToString(120),
                                HelpTools.FromByteToString(112),
                                HelpTools.FromByteToString(105),
                                HelpTools.FromByteToString(114),
                                HelpTools.FromByteToString(101),
                                HelpTools.FromByteToString(100),
                                HelpTools.FromByteToString(33),
                            }));
                            try
                            {
                                if (Bot.Running)
                                {
                                    BotLogic.StopBotThread();
                                }
                                if (BotLogic.OnAttackRunning)
                                {
                                    BotLogic.StoponAttackThrad();
                                }
                            }
                            catch (Exception ex)
                            {
                                BotMethods.WriteLine("Could not shutdown Bot-Threads!\n" + ex);
                            }
                            Bot.Running = false;
                            BotLogic.OnAttackRunning = false;
                            Account.gClass           = null;
                            if (MessageBox.Show("Your License has expired!\nDo you want to buy a new one?", "License Expired!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                            {
                                Form1.form1.ShowPaymentForm();
                            }
                            Account.gClass = null;
                        }
                        else if (status == "-1")
                        {
                            BotMethods.WriteLine("There was an internal Server Error!\nPlease check your internet connection!\nRetrying in 3min!");
                            Account.gClass = null;
                        }
                        else if (status == "1")
                        {
                            if (Account.gClass == null)
                            {
                                Account.gClass = new UserInitMessage();
                            }
                        }
                        var ts = (validUntil - DateTime.Now);
                        if (ts.TotalHours < 25.0)
                        {
                            if (HelpTools.IsVirtualMachine())
                            {
                                try
                                {
                                    BotCalculator.StopThreads();
                                    if (Bot.Running)
                                    {
                                        BotLogic.StopBotThread();
                                    }
                                    if (BotLogic.OnAttackRunning)
                                    {
                                        BotLogic.StoponAttackThrad();
                                    }
                                }
                                catch (Exception)
                                {
                                }
                                Bot.Running = false;
                                BotLogic.OnAttackRunning = false;
                                Account.gClass           = null;
                                if (MessageBox.Show("This program does not work on a Virtual Machine unless you own a Premium License!", "VM Detected!", MessageBoxButtons.OK, MessageBoxIcon.Error) != DialogResult.None)
                                {
                                    Application.Exit();
                                    Process.GetCurrentProcess().Kill();
                                }
                            }
                        }
                        Thread.Sleep(180000);
                    }
                    catch (Exception ex)
                    {
                        BotMethods.WriteLine("There was an error while checking License!\nRetrying in a few seconds!\n" + ex.Message);
                        Thread.Sleep(50000);
                    }
                }
            } catch (Exception ex)
            {
                BotMethods.WriteLine("Restarting License-Thread, reason: " + ex.Message);
                _restartCounter++;
                if (_restartCounter > 14)
                {
                    MessageBox.Show("There seems to be an error with the License-Thread!\nReason: " + ex + "\nPlease report this!\nThe Bot will now stop!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                    Process.GetCurrentProcess().Kill();
                }
                goto IL_BEGIN;
            }
        }