Esempio n. 1
0
        public async void connection_OnMessageReceived(object sender, object message)
        {
            if (message is GameDTO)
            {
                GameDTO game = message as GameDTO;
                switch (game.GameState)
                {
                case "START_REQUESTED":
                    break;

                case "FAILED_TO_START":
                    parent.updateStatus(msgStatus.ERROR, "Failed to Start", Accountname);
                    break;

                case "CHAMP_SELECT":
                    firstTimeInCustom   = true;
                    firstTimeInQueuePop = true;
                    if (firstTimeInLobby)
                    {
                        firstTimeInLobby = false;
                        updateStatus("In Champion Select", Accountname);
                        object obj = await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");

                        if (queueType != QueueTypes.ARAM)
                        {
                            if (parent.championToPick != "" && parent.championToPick != "RANDOM")
                            {
                                int Spell1;
                                int Spell2;
                                if (!parent.randomSpell)
                                {
                                    Spell1 = Enums.spellToId(parent.spell1);
                                    Spell2 = Enums.spellToId(parent.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(parent.championToPick));

                                await connection.ChampionSelectCompleted();
                            }
                            else if (parent.championToPick == "RANDOM")
                            {
                                int Spell1;
                                int Spell2;
                                if (!parent.randomSpell)
                                {
                                    Spell1 = Enums.spellToId(parent.spell1);
                                    Spell2 = Enums.spellToId(parent.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();
                                await connection.SelectChampion(randAvailableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId);

                                await connection.ChampionSelectCompleted();
                            }
                            else
                            {
                                int Spell1;
                                int Spell2;
                                if (!parent.randomSpell)
                                {
                                    Spell1 = Enums.spellToId(parent.spell1);
                                    Spell2 = Enums.spellToId(parent.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(availableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId);

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

                case "POST_CHAMP_SELECT":
                    firstTimeInLobby = false;
                    if (firstTimeInPostChampSelect)
                    {
                        firstTimeInPostChampSelect = false;
                        updateStatus("(Post Champ Select)", Accountname);
                    }
                    break;

                case "IN_QUEUE":
                    updateStatus("In Queue", Accountname);
                    break;

                case "TERMINATED":
                    updateStatus("Re-entering queue", Accountname);
                    firstTimeInPostChampSelect = true;
                    firstTimeInQueuePop        = true;
                    break;

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

                        break;
                    }
                    else
                    {
                        break;
                    }

                default:
                    updateStatus("[DEFAULT]" + game.GameStateString, Accountname);
                    break;
                }
            }
            else if (message.GetType() == typeof(TradeContractDTO))
            {
                var tradeDto = message as TradeContractDTO;
                if (tradeDto == null)
                {
                    return;
                }
                switch (tradeDto.State)
                {
                case "PENDING":
                {
                    if (tradeDto != null)
                    {
                        await connection.AcceptTrade(tradeDto.RequesterInternalSummonerName, (int)tradeDto.RequesterChampionId);
                    }
                }
                break;
                }
                return;
            }
            else if (message is PlayerCredentialsDto)
            {
                firstTimeInPostChampSelect = true;
                PlayerCredentialsDto dto       = message as PlayerCredentialsDto;
                ProcessStartInfo     startInfo = new ProcessStartInfo();
                startInfo.CreateNoWindow   = false;
                startInfo.WorkingDirectory = FindLoLExe();
                startInfo.FileName         = "League of Legends.exe";
                startInfo.Arguments        = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + dto.ServerIp + " " +
                                             dto.ServerPort + " " + dto.EncryptionKey + " " + dto.SummonerId + "\"";
                updateStatus("Launching League of Legends\n", Accountname);

                new Thread(() =>
                {
                    exeProcess         = Process.Start(startInfo);
                    exeProcess.Exited += new EventHandler(exeProcess_Exited);
                    while (exeProcess.MainWindowHandle == IntPtr.Zero)
                    {
                    }
                    exeProcess.PriorityClass       = ProcessPriorityClass.Idle;
                    exeProcess.EnableRaisingEvents = true;
                    //Thread.Sleep(1000);
                }).Start();
            }
            else if (message is EndOfGameStats)
            {
                if (exeProcess != null)
                {
                    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();
                    }
                }
                AttachToQueue();
            }
        }
Esempio n. 2
0
        private async void connection_OnMessageReceived(object sender, object message)
        {
            if (message is GameDTO)
            {
                GameDTO game = message as GameDTO;
                Console.WriteLine("Message Type:" + game.GameState);
                switch (game.GameState)
                {
                case "START_REQUESTED":
                    break;

                case "FAILED_TO_START":
                    Console.WriteLine("Failed to Start!");
                    break;

                case "CHAMP_SELECT":
                    firstTimeInCustom   = true;
                    firstTimeInQueuePop = true;
                    if (firstTimeInLobby)
                    {
                        firstTimeInLobby = false;
                        object obj = await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");

                        if (QueueType != QueueTypes.ARAM)
                        {
                            int Spell1;
                            int Spell2;
                            var random    = new Random();
                            var spellList = new List <int> {
                                13, 6, 7, 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 = myChampions.Shuffle();
                            await connection.SelectChampion(randAvailableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId);

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

                case "PRE_CHAMP_SELECT":
                    updateStatus(msgStatus.INFO, "Champion selection in progress");
                    break;

                case "POST_CHAMP_SELECT":
                    firstTimeInLobby = false;
                    if (firstTimeInPostChampSelect)
                    {
                        firstTimeInPostChampSelect = false;
                        updateStatus(msgStatus.INFO, "Champion selection is done, waiting for game to start");
                        break;
                    }
                    else
                    {
                        break;
                    }

                case "IN_QUEUE":
                    updateStatus(msgStatus.INFO, "In Queue");
                    break;

                case "TERMINATED":
                    updateStatus(msgStatus.INFO, "Re-entering queue");
                    firstTimeInPostChampSelect = true;
                    firstTimeInQueuePop        = true;
                    break;

                case "JOINING_CHAMP_SELECT":
                    if (firstTimeInQueuePop && game.StatusOfParticipants.Contains("1"))
                    {
                        updateStatus(msgStatus.INFO, "Accepted Queue");
                        firstTimeInQueuePop = false;
                        firstTimeInLobby    = true;
                        object obj = await connection.AcceptPoppedGame(true);

                        break;
                    }
                    else
                    {
                        break;
                    }

                default:
                    updateStatus(msgStatus.INFO, "[DEFAULT]" + game.GameStateString);
                    break;
                }
            }
            else if (message.GetType() == typeof(TradeContractDTO))
            {
                TradeContractDTO tradeDto = message as TradeContractDTO;
                if (tradeDto != null)
                {
                    switch (tradeDto.State)
                    {
                    case "PENDING":
                        if (tradeDto != null)
                        {
                            object obj = await connection.AcceptTrade(tradeDto.RequesterInternalSummonerName, (int)tradeDto.RequesterChampionId);

                            break;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else if (message is PlayerCredentialsDto)
            {
                firstTimeInPostChampSelect = true;
                PlayerCredentialsDto dto       = message as PlayerCredentialsDto;
                ProcessStartInfo     startInfo = new ProcessStartInfo();
                startInfo.WorkingDirectory = FindLoLExe();
                startInfo.FileName         = "League of Legends.exe";
                startInfo.Arguments        = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + dto.ServerIp + " " +
                                             dto.ServerPort + " " + dto.EncryptionKey + " " + dto.SummonerId + "\"";
                updateStatus(msgStatus.INFO, "Launching League of Legends");

                new Thread(() =>
                {
                    exeProcess = Process.Start(startInfo);
                    exeProcess.EnableRaisingEvents = true;
                    exeProcess.Exited += new EventHandler(exeProcess_Exited);
                    while (exeProcess.MainWindowHandle == IntPtr.Zero)
                    {
                    }
                    Console.WriteLine(exeProcess.MainWindowTitle);
                    Thread.Sleep(1000);
                    App.gameMask.addGame(info.username, info.region.ToString(), exeProcess);
                }).Start();
            }
            else if (!(message is GameNotification) && !(message is SearchingForMatchNotification))
            {
                if (message is EndOfGameStats)
                {
                    object obj4 = await connection.ackLeaverBusterWarning();

                    object obj5 = await connection.callPersistenceMessaging(new SimpleDialogMessageResponse()
                    {
                        AccountID = loginDataPacket.AllSummonerData.Summoner.SumId,
                        MsgID     = loginDataPacket.AllSummonerData.Summoner.SumId,
                        Command   = "ack"
                    });

                    MatchMakerParams matchParams = new MatchMakerParams();
                    checkAndUpdateQueueType();
                    if (QueueType == QueueTypes.INTRO_BOT)
                    {
                        matchParams.BotDifficulty = "INTRO";
                    }
                    else if (QueueType == QueueTypes.BEGINNER_BOT)
                    {
                        matchParams.BotDifficulty = "EASY";
                    }
                    else if (QueueType == QueueTypes.MEDIUM_BOT)
                    {
                        matchParams.BotDifficulty = "MEDIUM";
                    }
                    if (QueueType != 0)
                    {
                        matchParams.QueueIds = new Int32[1] {
                            (int)QueueType
                        };
                        SearchingForMatchNotification m = await connection.AttachToQueue(matchParams);

                        if (m.PlayerJoinFailures == null)
                        {
                            updateStatus(msgStatus.INFO, "In Queue: " + QueueType.ToString());
                        }
                        else
                        {
                            foreach (var failure in m.PlayerJoinFailures)
                            {
                                if (failure.ReasonFailed == "LEAVER_BUSTED")
                                {
                                    m_accessToken = failure.AccessToken;
                                    if (failure.LeaverPenaltyMillisRemaining > m_leaverBustedPenalty)
                                    {
                                        m_leaverBustedPenalty = failure.LeaverPenaltyMillisRemaining;
                                    }
                                }
                                Console.WriteLine("Start Failed:" + failure.ReasonFailed);
                            }

                            if (string.IsNullOrEmpty(m_accessToken))
                            {
                                foreach (var failure in m.PlayerJoinFailures)
                                {
                                    updateStatus(msgStatus.INFO, "Dodge Remaining Time: " + Convert.ToString((failure.DodgePenaltyRemainingTime / 1000 / (float)60)).Replace(",", ":") + "...");
                                }
                            }
                            else
                            {
                                double minutes = m_leaverBustedPenalty / 1000 / (float)60;
                                updateStatus(msgStatus.INFO, "Waiting out leaver buster: " + minutes + " minutes!");
                                t = TimeSpan.FromMinutes((int)minutes);
                                //Tick(); -> Enable to get visual time remaining
                                Thread.Sleep(TimeSpan.FromMilliseconds(m_leaverBustedPenalty));
                                m = await connection.AttachToLowPriorityQueue(matchParams, m_accessToken);

                                if (m.PlayerJoinFailures == null)
                                {
                                    updateStatus(msgStatus.INFO, "Succesfully joined lower priority queue!");
                                }
                                else
                                {
                                    updateStatus(msgStatus.ERROR, "There was an error in joining lower priority queue.\nDisconnecting.");
                                    connection.Disconnect();
                                }
                            }
                        }
                    }
                }
                else if (message.ToString().Contains("EndOfGameStats"))
                {
                    EndOfGameStats eog = new EndOfGameStats();
                    exeProcess.Exited -= new EventHandler(exeProcess_Exited);
                    exeProcess.Kill();
                    Thread.Sleep(500);
                    if (exeProcess.Responding)
                    {
                        Process.Start("taskkill /F /IM \"League of Legends.exe\"");
                    }
                    loginDataPacket = await connection.GetLoginDataPacketForUser();

                    if (type == RotationType.SmurfDone)
                    {
                        if (info.desiredLevel > loginDataPacket.AllSummonerData.SummonerLevel.Level)
                        {
                            connection_OnMessageReceived(sender, eog);
                        }
                        else
                        {
                            connection.Disconnect();
                        }
                    }
                    else
                    {
                        connection_OnMessageReceived(sender, eog);
                    }
                }
            }
        }
Esempio n. 3
0
        public async void connection_OnMessageReceived(object sender, object message)
        {
            if (message is GameDTO)
            {
                GameDTO game = message as GameDTO;
                switch (game.GameState)
                {
                case "CHAMP_SELECT":
                    firstTimeInCustom   = true;
                    firstTimeInQueuePop = true;
                    if (firstTimeInLobby)
                    {
                        firstTimeInLobby = false;
                        updateStatus("In Champion Select", Accountname);
                        await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");

                        if (queueType != QueueTypes.ARAM)
                        {
                            if (Core.championId != "")
                            {
                                await connection.SelectChampion(Enums.championToId(Core.championId));

                                await connection.ChampionSelectCompleted();
                            }
                            else
                            {
                                await connection.SelectChampion(availableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId);

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

                case "POST_CHAMP_SELECT":
                    firstTimeInLobby = false;
                    updateStatus("(Post Champ Select)", Accountname);
                    break;

                case "PRE_CHAMP_SELECT":
                    updateStatus("(Pre Champ Select)", Accountname);
                    break;

                case "GAME_START_CLIENT":
                    updateStatus("Game client ran", Accountname);
                    break;

                case "GameClientConnectedToServer":
                    updateStatus("Client connected to the server", Accountname);
                    break;

                case "IN_QUEUE":
                    updateStatus("In Queue", Accountname);
                    break;

                case "TERMINATED":
                    updateStatus("Re-entering queue", Accountname);
                    firstTimeInQueuePop = true;
                    break;

                case "JOINING_CHAMP_SELECT":
                    if (firstTimeInQueuePop)
                    {
                        updateStatus("Queue popped", Accountname);
                        if (game.StatusOfParticipants.Contains("1"))
                        {
                            updateStatus("Accepted Queue", Accountname);
                            firstTimeInQueuePop = false;
                            firstTimeInLobby    = true;
                            await connection.AcceptPoppedGame(true);
                        }
                    }
                    break;
                }
            }
            else if (message is PlayerCredentialsDto)
            {
                PlayerCredentialsDto dto = message as PlayerCredentialsDto;
                if (!HasLaunchedGame)
                {
                    HasLaunchedGame = true;
                    new Thread((ThreadStart)(() =>
                    {
                        LaunchGame(dto);
                        Thread.Sleep(3000);
                    })).Start();
                }
            }
            else if (!(message is GameNotification) && !(message is SearchingForMatchNotification))
            {
                if (message is EndOfGameStats)
                {
                    MatchMakerParams matchParams = new MatchMakerParams();
                    //Set BotParams
                    if (queueType == QueueTypes.INTRO_BOT)
                    {
                        matchParams.BotDifficulty = "INTRO";
                    }
                    else if (queueType == QueueTypes.BEGINNER_BOT)
                    {
                        matchParams.BotDifficulty = "EASY";
                    }
                    else if (queueType == QueueTypes.MEDIUM_BOT)
                    {
                        matchParams.BotDifficulty = "MEDIUM";
                    }
                    //Check if is available to join queue.
                    if (sumLevel == 3 && actualQueueType == QueueTypes.NORMAL_5x5)
                    {
                        queueType = actualQueueType;
                    }
                    else if (sumLevel == 6 && actualQueueType == QueueTypes.ARAM)
                    {
                        queueType = actualQueueType;
                    }
                    else if (sumLevel == 7 && actualQueueType == QueueTypes.NORMAL_3x3)
                    {
                        queueType = actualQueueType;
                    }
                    matchParams.QueueIds = new Int32[1] {
                        (int)queueType
                    };
                    SearchingForMatchNotification m = await connection.AttachToQueue(matchParams);

                    if (m.PlayerJoinFailures == null)
                    {
                        updateStatus("In Queue: " + queueType.ToString(), Accountname);
                    }
                    else
                    {
                        updateStatus("Couldn't enter Queue! Please contact us @ volibot.com", Accountname);
                    }
                }
                else
                {
                    if (message.ToString().Contains("EndOfGameStats"))
                    {
                        EndOfGameStats eog = new EndOfGameStats();
                        connection_OnMessageReceived(sender, eog);
                        exeProcess.Kill();
                        loginPacket = await this.connection.GetLoginDataPacketForUser();

                        archiveSumLevel = sumLevel;
                        sumLevel        = loginPacket.AllSummonerData.SummonerLevel.Level;
                        if (sumLevel != archiveSumLevel)
                        {
                            levelUp();
                        }
                    }
                }
            }
        }
        public async void connection_OnMessageReceived(object sender, object message)
        {
            if (message.ToString().Contains("LobbyStatus"))
            {
                String metaData = (String)((TypedObject)message)["gameMetaData"];
                Match  match    = Regex.Match(metaData, "gameId\":([0-9]+),");
                if (match.Success)
                {
                    string gameId = match.Groups[1].Value;
                    await connection.SwitchTeams(Convert.ToDouble(gameId));
                }
            }
            else if (message is LoLLauncher.RiotObjects.Platform.Game.GameDTO)
            {
                LoLLauncher.RiotObjects.Platform.Game.GameDTO game = message as LoLLauncher.RiotObjects.Platform.Game.GameDTO;
                switch (game.GameState)
                {
                case "IDLE":
                    break;

                case "TEAM_SELECT":

                    if (firstTimeInCustom)
                    {
                        updateStatus("Entering champion selection");
                        await connection.StartChampionSelection(game.Id, game.OptimisticLock);

                        firstTimeInCustom = false;
                    }
                    break;

                case "CHAMP_SELECT":
                    firstTimeInCustom   = true;
                    firstTimeInQueuePop = true;
                    if (firstTimeInLobby)
                    {
                        firstTimeInLobby = false;
                        updateStatus("Champion Select - Waiting for game to start");
                        await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");

                        if (queueType != QueueTypes.ARAM)
                        {
                            await connection.SelectChampion(availableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId);

                            await connection.ChampionSelectCompleted();
                        }
                    }
                    break;

                case "POST_CHAMP_SELECT":
                    break;

                case "PRE_CHAMP_SELECT":
                    break;

                case "START_REQUESTED":
                    break;

                case "GAME_START_CLIENT":
                    break;

                case "GameClientConnectedToServer":
                    break;

                case "IN_PROGRESS":
                    break;

                case "IN_QUEUE":
                    break;

                case "POST_GAME":
                    break;

                case "TERMINATED":
                    if (queueType == QueueTypes.CUSTOM)
                    {
                        CreatePracticeGame();
                    }
                    else
                    {
                        updateStatus("Re-entering queue due to someone dodging");
                        firstTimeInQueuePop = true;
                    }
                    break;

                case "TERMINATED_IN_ERROR":
                    break;

                case "CHAMP_SELECT_CLIENT":
                    break;

                case "GameReconnect":
                    break;

                case "GAME_IN_PROGRESS":
                    break;

                case "JOINING_CHAMP_SELECT":
                    if (firstTimeInQueuePop)
                    {
                        updateStatus("Queue popped");
                        if (game.StatusOfParticipants.Contains("1"))
                        {
                            updateStatus("Accepted Queue");
                            firstTimeInQueuePop = false;
                            firstTimeInLobby    = true;
                            await connection.AcceptPoppedGame(true);
                        }
                    }
                    break;

                case "WAITING":
                    break;

                case "DISCONNECTED":
                    break;

                default:
                    break;
                }
            }
            else if (message is LoLLauncher.RiotObjects.Platform.Game.PlayerCredentialsDto)
            {
                LoLLauncher.RiotObjects.Platform.Game.PlayerCredentialsDto credentials = message as LoLLauncher.RiotObjects.Platform.Game.PlayerCredentialsDto;
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.CreateNoWindow   = false;
                startInfo.WorkingDirectory = installPath;
                startInfo.FileName         = "League of Legends.exe";
                startInfo.Arguments        = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + credentials.ServerIp + " " +
                                             credentials.ServerPort + " " + credentials.EncryptionKey + " " + credentials.SummonerId + "\"";
                updateStatus("Playing League of Legends");
                new Thread(() =>
                {
                    exeProcess = System.Diagnostics.Process.Start(startInfo);
                    while (exeProcess.MainWindowHandle == IntPtr.Zero)
                    {
                    }
                    Thread.Sleep(1000);
                    SetParent(exeProcess.MainWindowHandle, panelHandle);
                    MoveWindow(exeProcess.MainWindowHandle, 0, 0, 600, 400, true);
                }).Start();
            }
            else if (message is LoLLauncher.RiotObjects.Platform.Game.Message.GameNotification)
            {
            }
            else if (message is LoLLauncher.RiotObjects.Platform.Matchmaking.SearchingForMatchNotification)
            {
            }
            else if (message is LoLLauncher.RiotObjects.Platform.Statistics.EndOfGameStats)
            {
                if (queueType == QueueTypes.CUSTOM)
                {
                    CreatePracticeGame();
                }
                else
                {
                    updateStatus("Joining Queue");
                    LoLLauncher.RiotObjects.Platform.Matchmaking.MatchMakerParams matchParams = new LoLLauncher.RiotObjects.Platform.Matchmaking.MatchMakerParams();
                    if (queueType == QueueTypes.INTRO_BOT)
                    {
                        matchParams.BotDifficulty = "INTRO";
                    }
                    else if (queueType == QueueTypes.BEGINNER_BOT)
                    {
                        matchParams.BotDifficulty = "EASY";
                    }
                    else if (queueType == QueueTypes.MEDIUM_BOT)
                    {
                        matchParams.BotDifficulty = "MEDIUM";
                    }
                    matchParams.QueueIds = new Int32[1] {
                        (int)queueType
                    };
                    LoLLauncher.RiotObjects.Platform.Matchmaking.SearchingForMatchNotification m = await connection.AttachToQueue(matchParams);

                    if (m.PlayerJoinFailures == null)
                    {
                        updateStatus("Joined Queue");
                    }
                    else
                    {
                        updateStatus("Couldn't enter Q - " + m.PlayerJoinFailures.Summoner.Name + " : " + m.PlayerJoinFailures.ReasonFailed);
                    }
                }
            }
            else
            {
                if (message.ToString().Contains("EndOfGameStats"))
                {
                    exeProcess.Kill();
                    LoLLauncher.RiotObjects.Platform.Statistics.EndOfGameStats eog = new LoLLauncher.RiotObjects.Platform.Statistics.EndOfGameStats();
                    connection_OnMessageReceived(sender, eog);
                }
            }
        }