コード例 #1
0
ファイル: RiotBot.cs プロジェクト: Acanguven/HFL-Remastered
 public void startProcessor(ProcessStartInfo startInfo)
 {
     processStarter = new Thread((ThreadStart)(() =>
     {
         exeProcess = Process.Start(startInfo);
         exeProcess.Exited += exeProcess_Exited;
         while (exeProcess.MainWindowHandle == IntPtr.Zero)
         {
             ;
         }
         exeProcess.PriorityClass = ProcessPriorityClass.Idle;
         exeProcess.EnableRaisingEvents = true;
         if (Settings.disableGpu)
         {
             App.gameContainer.Dispatcher.Invoke(new Action(() => {
                 App.gameContainer.addWindow(exeProcess, Accountname);
             }), DispatcherPriority.ContextIdle);
         }
         Thread.Sleep(3000);
         if (Settings.mInject)
         {
             BasicInject.Inject(exeProcess, Settings.dllPath);
         }
     }));
     processStarter.Start();
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: xxnbyy/SylantStrike
 static void startWatch_EventArrived(object sender, EventArrivedEventArgs e)
 {
     try
     {
         var proc = GetProcessInfo(e);
         if (processList.Contains(proc.ProcessName.ToLower()))
         {
             Console.ForegroundColor = ConsoleColor.Green;
             Console.WriteLine($" Injecting process {proc.ProcessName}({proc.PID}) with DLL {dllPath}");
             BasicInject.Inject(proc.PID, dllPath);
         }
     }
     catch (Exception ex)
     {
         Console.ForegroundColor = ConsoleColor.Yellow;
         Console.WriteLine(ex);
     }
 }
コード例 #3
0
ファイル: BotThread.cs プロジェクト: Acanguven/HFL-Remastered
        public void startProcessor(ProcessStartInfo startInfo)
        {
            var processStarter = new Thread((ThreadStart)(() =>
            {
                exeProcess = Process.Start(startInfo);
                exeProcess.Exited += exeProcess_Exited;
                while (exeProcess.MainWindowHandle == IntPtr.Zero)
                {
                    ;
                }
                exeProcess.PriorityClass = ProcessPriorityClass.Idle;
                exeProcess.EnableRaisingEvents = true;
                while (!BolManager.dllInjectionCompleted(exeProcess))
                {
                    Thread.Sleep(500);
                }
                Thread.Sleep(5000);
                if (App.Client.UserData.Settings.DisableGpu)
                {
                    App.gameContainer.Dispatcher.Invoke(new Action(() =>
                    {
                        App.gameContainer.addWindow(exeProcess, username, this.region.ToString());
                    }), DispatcherPriority.ContextIdle);
                }
                if (App.Client.UserData.Settings.ManualInjection && !m_disposed && false)
                {
                    string dllPath = Properties.Settings.Default.bolPath.Split(new string[] { "BoL Studio.exe" }, StringSplitOptions.None)[0] + "agent.dll";
                    BasicInject.Inject(exeProcess, dllPath);
                }

                SetWindowText(exeProcess.MainWindowHandle, username);
            }));

            processStarter.Start();
            smurf.updateTimer(60 * 60);
        }
コード例 #4
0
        public async void connection_OnMessageReceived(object sender, object message)
        {
            if (message is GameDTO)
            {
                GameDTO game = message as GameDTO;
                switch (game.GameState)
                {
                case "TEAM_SELECT":
                    int totalPlayers = game.TeamOne.Count + game.TeamTwo.Count;
                    this.updateStatus("In custom lobby, playerCount:" + totalPlayers, Accountname);
                    if (totalPlayers == 6 && game.OwnerSummary.AccountId == this.connection.AccountID())
                    {
                        await connection.StartChampionSelection(game.Id, game.OptimisticLock);
                    }
                    break;

                case "CHAMP_SELECT":
                    Program.QueueValid = true;
                    if (this.firstTimeInLobby)
                    {
                        QueueFlag        = true;
                        firstTimeInLobby = false;
                        updateStatus("In Champion Selection", Accountname);
                        object obj = await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");

                        if (queueType != QueueTypes.ARAM)
                        {
                            if (Program.championId != "" && Program.championId != "RANDOM")
                            {
                                int Spell1;
                                int Spell2;
                                if (!Program.rndSpell)
                                {
                                    Spell1 = Enums.spellToId(Program.spell1);
                                    Spell2 = Enums.spellToId(Program.spell2);
                                }
                                else
                                {
                                    var random    = new Random();
                                    var spellList = new List <int> {
                                        13, 6, 7, 10, 1, 11, 21, 12, 3, 14, 2, 4
                                    };

                                    int index  = random.Next(spellList.Count);
                                    int index2 = random.Next(spellList.Count);

                                    int randomSpell1 = spellList[index];
                                    int randomSpell2 = spellList[index2];

                                    if (randomSpell1 == randomSpell2)
                                    {
                                        int index3 = random.Next(spellList.Count);
                                        randomSpell2 = spellList[index3];
                                    }

                                    Spell1 = Convert.ToInt32(randomSpell1);
                                    Spell2 = Convert.ToInt32(randomSpell2);
                                }

                                await connection.SelectSpells(Spell1, Spell2);

                                await connection.SelectChampion(Enums.championToId(Program.championId));

                                await connection.ChampionSelectCompleted();
                            }
                            else if (Program.championId == "RANDOM")
                            {
                                int Spell1;
                                int Spell2;
                                if (!Program.rndSpell)
                                {
                                    Spell1 = Enums.spellToId(Program.spell1);
                                    Spell2 = Enums.spellToId(Program.spell2);
                                }
                                else
                                {
                                    var random    = new Random();
                                    var spellList = new List <int> {
                                        13, 6, 7, 10, 1, 11, 21, 12, 3, 14, 2, 4
                                    };

                                    int index  = random.Next(spellList.Count);
                                    int index2 = random.Next(spellList.Count);

                                    int randomSpell1 = spellList[index];
                                    int randomSpell2 = spellList[index2];

                                    if (randomSpell1 == randomSpell2)
                                    {
                                        int index3 = random.Next(spellList.Count);
                                        randomSpell2 = spellList[index3];
                                    }

                                    Spell1 = Convert.ToInt32(randomSpell1);
                                    Spell2 = Convert.ToInt32(randomSpell2);
                                }

                                await connection.SelectSpells(Spell1, Spell2);

                                var randAvailableChampsArray = availableChampsArray.Shuffle();
                                int randomAdc = randAvailableChampsArray.First(champ => (champ.Owned || champ.FreeToPlay) && (champ.ChampionId == 22 || champ.ChampionId == 51 || champ.ChampionId == 42 || champ.ChampionId == 119 || champ.ChampionId == 81 || champ.ChampionId == 104 || champ.ChampionId == 222 || champ.ChampionId == 429 || champ.ChampionId == 96 || champ.ChampionId == 236 || champ.ChampionId == 21 || champ.ChampionId == 133 || champ.ChampionId == 15 || champ.ChampionId == 18 || champ.ChampionId == 29 || champ.ChampionId == 110 || champ.ChampionId == 67)).ChampionId;
                                await connection.SelectChampion(randomAdc);


                                await connection.ChampionSelectCompleted();
                            }
                            else
                            {
                                int Spell1;
                                int Spell2;
                                if (!Program.rndSpell)
                                {
                                    Spell1 = Enums.spellToId(Program.spell1);
                                    Spell2 = Enums.spellToId(Program.spell2);
                                }
                                else
                                {
                                    var random    = new Random();
                                    var spellList = new List <int> {
                                        13, 6, 7, 10, 1, 11, 21, 12, 3, 14, 2, 4
                                    };

                                    int index  = random.Next(spellList.Count);
                                    int index2 = random.Next(spellList.Count);

                                    int randomSpell1 = spellList[index];
                                    int randomSpell2 = spellList[index2];

                                    if (randomSpell1 == randomSpell2)
                                    {
                                        int index3 = random.Next(spellList.Count);
                                        randomSpell2 = spellList[index3];
                                    }

                                    Spell1 = Convert.ToInt32(randomSpell1);
                                    Spell2 = Convert.ToInt32(randomSpell2);
                                }

                                await connection.SelectSpells(Spell1, Spell2);

                                var randAvailableChampsArray = availableChampsArray.Shuffle();
                                int randomAdc = randAvailableChampsArray.First(champ => (champ.Owned || champ.FreeToPlay) && (champ.ChampionId == 22 || champ.ChampionId == 51 || champ.ChampionId == 42 || champ.ChampionId == 119 || champ.ChampionId == 81 || champ.ChampionId == 104 || champ.ChampionId == 222 || champ.ChampionId == 429 || champ.ChampionId == 96 || champ.ChampionId == 236 || champ.ChampionId == 21 || champ.ChampionId == 133 || champ.ChampionId == 15 || champ.ChampionId == 18 || champ.ChampionId == 29 || champ.ChampionId == 110 || champ.ChampionId == 67)).ChampionId;

                                await connection.SelectChampion(randomAdc);

                                await connection.ChampionSelectCompleted();
                            }
                        }
                        break;
                    }
                    else
                    {
                        break;
                    }

                case "POST_CHAMP_SELECT":
                    firstTimeInLobby = false;
                    this.updateStatus("Last 10 seconds to start game", Accountname);
                    break;

                case "PRE_CHAMP_SELECT":
                    this.updateStatus("Last seconds to set champion", Accountname);
                    break;

                case "GAME_START_CLIENT":
                    this.updateStatus("In Game", Accountname);
                    break;

                case "GameClientConnectedToServer":
                    this.updateStatus("Connected to server", Accountname);
                    break;

                case "IN_QUEUE":
                    this.updateStatus("In Queue", Accountname);
                    QueueFlag = true;
                    break;

                case "TERMINATED":
                    this.updateStatus("Re entering to queue", Accountname);
                    this.firstTimeInQueuePop = true;
                    if (queueType == QueueTypes.CUSTOM)
                    {
                        CreatePracticeGame();
                    }
                    break;

                case "JOINING_CHAMP_SELECT":
                    if (this.firstTimeInQueuePop && game.StatusOfParticipants.Contains("1"))
                    {
                        this.updateStatus("Game accepted", Accountname);
                        this.firstTimeInQueuePop = false;
                        this.firstTimeInLobby    = true;
                        object obj = await this.connection.AcceptPoppedGame(true);

                        break;
                    }
                    else
                    {
                        break;
                    }

                case "LEAVER_BUSTED":
                    this.updateStatus("You are leaver busted", Accountname);
                    break;
                }
            }
            else if (message is PlayerCredentialsDto)
            {
                string str = Enumerable.Last <string>((IEnumerable <string>)Enumerable.OrderBy <string, DateTime>(Directory.EnumerateDirectories((this.ipath ?? "") + "RADS\\solutions\\lol_game_client_sln\\releases\\"), (Func <string, DateTime>)(f => new DirectoryInfo(f).CreationTime))) + "\\deploy\\";
                LoLLauncher.RiotObjects.Platform.Game.PlayerCredentialsDto credentials = message as PlayerCredentialsDto;
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.CreateNoWindow   = false;
                startInfo.WorkingDirectory = str;
                if (Program.replaceConfig)
                {
                    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                }
                startInfo.FileName  = "League of Legends.exe";
                startInfo.Arguments = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + credentials.ServerIp + " " +
                                      credentials.ServerPort + " " + credentials.EncryptionKey + " " + credentials.SummonerId + "\"";
                updateStatus("Starting Game", Accountname);
                new Thread((ThreadStart)(() =>
                {
                    exeProcess = Process.Start(startInfo);
                    exeProcess.Exited += exeProcess_Exited;
                    while (exeProcess.MainWindowHandle == IntPtr.Zero)
                    {
                        ;
                    }
                    exeProcess.PriorityClass = ProcessPriorityClass.Idle;
                    exeProcess.EnableRaisingEvents = true;
                    if (!Program.bolRunning)
                    {
                        Thread.Sleep(3000);
                        BasicInject.Inject(exeProcess, Program.dllPath);
                    }
                })).Start();
            }
            else if (!(message is GameNotification) && !(message is SearchingForMatchNotification))
            {
                if (message is EndOfGameStats)
                {
                    EndOfGameStats eog = message as EndOfGameStats;
                    this.joinQueue();
                }
                else
                {
                    if (message.ToString().Contains("EndOfGameStats"))
                    {
                        updateStatus("Game ending, calculating results", Accountname);
                        EndOfGameStats eog = new EndOfGameStats();
                        connection_OnMessageReceived(sender, eog);
                        exeProcess.Exited -= exeProcess_Exited;
                        exeProcess.Kill();
                        Thread.Sleep(500);
                        if (exeProcess.Responding)
                        {
                            Process.Start("taskkill /F /IM \"League of Legends.exe\"");
                        }
                        loginPacket = await this.connection.GetLoginDataPacketForUser();

                        archiveSumLevel = sumLevel;
                        sumLevel        = loginPacket.AllSummonerData.SummonerLevel.Level;
                        if (sumLevel != archiveSumLevel)
                        {
                            levelUp();
                        }
                    }
                }
            }
        }