Пример #1
0
        static void Main(string[] args)
        {
            Console.Title = "Summoning - Referrals of the Future";

            if (Type.GetType("Mono.Runtime") == null)
            {
                Console.WindowWidth = Console.BufferWidth = 128;
            }

            if (!File.Exists("key.bin"))
            {
                return;
            }

            Globals.Configuration = Config.Deserialize();
            Log.Initialize();
            Globals.LoadCryptKey();
            SummoningWebApi.AttemptAuth();

            Globals.Region = SummoningWebApi.FetchRegion();

            if (Globals.Region == null)
            {
                Globals.Region = BaseRegion.Get(Globals.Configuration.Region);
            }

            // Sanity check.
            var processes = System.Diagnostics.Process.GetProcesses().ToList();

#if !ENTRY
            if (!Directory.Exists(Globals.Configuration.GamePath))
            {
                Log.Error("League of legends could not be found! Please update your game config!");
                Console.ReadLine();
                return;
            }

            var latestVersion    = GetLatestVersion();
            var installedVersion = Globals.Configuration.GamePath.Substring(0, Globals.Configuration.GamePath.IndexOf("\\deploy"));
            installedVersion = installedVersion.Substring(installedVersion.LastIndexOf("\\") + 1);


            // wow this is hacky.
            if (!latestVersion.Equals(installedVersion))
            {
                Log.Error("League of legends is currently not up to date! Launching lol.launcher.admin.exe");

                var path = Globals.Configuration.GamePath;
                path = path.Substring(0, path.IndexOf("RADS"));

                var file = path + "\\lol.launcher.admin.exe";

                var p = new Process();
                p.StartInfo.WorkingDirectory = path + "\\";
                p.StartInfo.FileName         = file;
                //        p.Start();

                // Console.ReadLine();
                //  return;
            }
#endif


            try
            {
                foreach (var p in processes)
#if !ENTRY
                { if (p.ProcessName.Contains("League of Legends"))
                  {
                      p.Kill();
                  }
                }
#else
                { if (p.ProcessName.Contains("entry"))
                  {
                      p.Kill();
                  }
                }
#endif
            }
            catch { }

            if (Globals.Configuration.UseDatabase)
            {
                if (Globals.Configuration.Database.UseMySQL)
                {
                    DatabaseInstance = new Database();
                }
                else
                {
                    DatabaseInstance = new MSSQLDatabase();
                }

                if (!DatabaseInstance.ContainValidAccounts())
                {
                    Log.Error("No valid accounts are currently avaialble in the database!");
                    //      return;
                }
            }

/*            if (Globals.Configuration.MaxBots % 6 != 0 && (Globals.Configuration.Dominion && Globals.Configuration.MaxBots % 10 != 0) && (
 *              Globals.Configuration.CoopVsAI && Globals.Configuration.MaxBots % 5 != 0))
 *          {
 *              Log.Write("MaxBots must be a multiple of 6 or 10 if using dominion.");
 *              return;
 *          }*/

            new BotApi().Start();
            Log.Write("Loading accounts.");
            Accounts.Populate();


            var containerSize = Globals.Configuration.Dominion ? 10 : 6;
            if (Globals.Configuration.Dominion3v3)
            {
                containerSize = 6;
            }

            if (Globals.Configuration.CoopVsAI)
            {
                containerSize = 5;
            }

            if (Globals.Configuration.MaxBots == 1)
            {
                containerSize = 1;
            }

            Log.Write("Container Size: {0}", containerSize);
            Launch(containerSize);

            while (true)
            {
                Thread.Sleep(TimeSpan.FromMinutes(1));
                Bots.ForEach((container) =>
                {
                    container.Bots.ForEach((instance) =>
                    {
                        if (DateTime.Now - instance.LastAction >= TimeSpan.FromMinutes(20))
                        {
                            Restart();
                        }
                    });
                });
                SaveAccounts();
            }
        }