Пример #1
0
        public void SimulateStartedGame()
        {
            PlayerCredentialsDto startedGame = new PlayerCredentialsDto()
            {
                /*
                 * EncryptionKey = "fake",
                 * GameId = 125432223.0,
                 * LastSelectedSkinIndex = 0,
                 * ServerIp = "59.100.95.227",
                 * Observer = false,
                 * SummonerId = 222908.0,
                 * ObserverServerIp = "192.64.169.29",
                 * DataVersion = 0,
                 * HandshakeToken = "fake",
                 * PlayerId = 20006292.0,
                 * ServerPort = 5129,
                 * ObserverServerPort = 8088,
                 * SummonerName = "Snowl",
                 * ObserverEncryptionKey = "fake",
                 * ChampionId = 133
                 */
            };

            MessageReceived(startedGame);
        }
Пример #2
0
        internal static void LaunchGame()
        {
            string GameDirectory = Location;

            var p = new System.Diagnostics.Process();

            p.StartInfo.WorkingDirectory = GameDirectory;
            p.StartInfo.FileName         = Path.Combine(GameDirectory, "League of Legends.exe");
            p.Exited += p_Exited;
            p.StartInfo.Arguments = "\"8394\" \"" + RootLocation + "LoLLauncher.exe" + "\" \"" + "\" \"" +
                                    CurrentGame.ServerIp + " " +
                                    CurrentGame.ServerPort + " " +
                                    CurrentGame.EncryptionKey + " " +
                                    CurrentGame.SummonerId + "\"";
            p.Start();
            MainWin.Visibility = Visibility.Hidden;
            MainWin.Hide();
            string ObserverServerIp;
            double GameId;
            string InternalName;
            string ObserverEncryptionKey;

            PlayerCredentialsDto replaydata = CurrentGame;

            ObserverServerIp      = replaydata.ObserverServerIp;
            GameId                = replaydata.GameId;
            InternalName          = Region.InternalName;
            ObserverEncryptionKey = replaydata.ObserverEncryptionKey;
            Autorecorder          = new JustUltedProj.Logic.Replays.ReplayRecorder(ObserverServerIp, (Int32)GameId, InternalName, ObserverEncryptionKey);
        }
Пример #3
0
        private static void ChampSelectHandler(object sender, object message)
        {
            //Launching the Game
            if (((MessageReceivedEventArgs)message).Body.GetType() == typeof(PlayerCredentialsDto))
            {
                //Wait 5 Secs uh yeah!
                Thread.Sleep(5000);

                PlayerCredentialsDto dto = ((MessageReceivedEventArgs)message).Body as PlayerCredentialsDto;
                runningGameDto = dto;

                //if (Client.botType != "HOST" && lastSummonerData.SummonerLevelAndPoints.SummonerLevel >= 10 && botLevelLimit != "LEVEL_30")
                //{
                //    Console.WriteLine("Ignoring game due to we reached LVL_10 :))!");
                //    return;
                //}

                inInviteLobby = false;
                StartClient(dto);

                //observerThread = new Thread(CheckForReconnect);
                //observerThread.Start();

                //if (botLevelLimit == "LEVEL_30")
                //    Task.Run(async () => await CheckForReconnect());
            }
        }
Пример #4
0
        public async void Launch(PlayerCredentialsDto playerCredentialsDto)
        {
            _playerCredentialsDto = playerCredentialsDto;
            _ignite = new IgniteClient(playerCredentialsDto);

            //Console.WriteLine("{0} {1} {2} {3}", playerCredentialsDto.serverIp, playerCredentialsDto.serverPort, playerCredentialsDto.encryptionKey, playerCredentialsDto.summonerId);
            //return;
            new System.Threading.Tasks.Task(() => _ignite.Start()).Start();
            var timer = new Timer();

            timer.Interval = TimeSpan.FromMinutes(5).TotalMilliseconds;
            timer.Elapsed += (s, e) =>
            {
                if (!_ignite.Connected)
                {
                    Flash.Log.Write("[{0}] Time out reached.", playerCredentialsDto.summonerName);
                    _ignite.Exit();
                    _ignite = new IgniteClient(_playerCredentialsDto);
                    new System.Threading.Tasks.Task(() => _ignite.Start()).Start();
                    return;
                }
                (s as Timer).Stop();
            };

            timer.Start();
        }
 public static Task StartGame(string realmId, PlayerCredentialsDto game)
 {
   if (game == null)
     return (Task) Task.FromResult<bool>(true);
   JsApiService.Push("game:reconnect", (object) null);
   return GameMaestroService.RunLeagueOfLegends(realmId, string.Format("\"56471\" \"wintermint-delegator\" \"wintermint-delegator\" \"{0} {1} {2} {3}\"", (object) game.ServerIp, (object) game.ServerPort, (object) game.EncryptionKey, (object) game.SummonerId));
 }
Пример #6
0
 private void Game_GameStarted(object sender, PlayerCredentialsDto creds)
 {
     ChampSelectCompleted?.Invoke(this, new EventArgs());
     Session.Current.Credentials = creds;
     Session.Current.JoinGame();
     Dispose();
 }
Пример #7
0
        public static void StartClient(PlayerCredentialsDto dto)
        {
            System.IO.File.Delete("Logs/Rooms/" + hostName + ".roomID");

            //Start our ClientEmu with Params
            var process = new System.Diagnostics.Process();

            process.StartInfo                = new ProcessStartInfo();
            process.StartInfo.FileName       = "ClientEmu.exe";
            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.WindowStyle    = ProcessWindowStyle.Minimized;
            process.StartInfo.ErrorDialog    = false;

            process.StartInfo.Arguments = dto.ServerIp + " " +
                                          dto.ServerPort + " " +
                                          dto.EncryptionKey + " " +
                                          dto.SummonerId + " " +
                                          Client.botType + " " +
                                          userName + " ";

            if (botLevelLimit == "LEVEL_30" && !groupSplitted) // CHANGE TO LEVEL_30
            {
                process.StartInfo.Arguments += "LEVEL_10";     //Need this to fake dominion! CHANGE TO LEVEL_10
            }
            //else if (botLevelLimit == "LEVEL_10")
            //    process.StartInfo.Arguments += "LEVEL_30";
            else
            {
                process.StartInfo.Arguments += botLevelLimit;
            }

            if (process.Start() == false)
            {
                Console.WriteLine("Could no start ClientEmu.exe!");
            }

            Console.WriteLine(DateTime.Now.ToString("HH:mm:ss tt") + " started");
            RiotCalls.SetClientReceivedGameMessage(globalDto.Id, "GAME_START_CLIENT");
            //RiotCalls.SetClientReceivedGameMessage(globalDto.Id, "GameClientConnectedToServer");
            //Client.RtmpConnection.MessageReceived -= ChampSelectHandler;

            acceptedGame = false;
            gameStarted  = true;

            //try
            //{
            //    System.IO.File.Delete("Logs/Rooms/" + hostName + ".invitationlist");
            //}
            //catch (Exception e)
            //{ }

            //try
            //{
            //    System.IO.File.Delete("Logs/Rooms/" + hostNameTwo + ".invitationlist");
            //}
            //catch (Exception e)
            //{ }
        }
 public static async Task<bool> TryStartGame(string realmId, PlayerCredentialsDto game)
 {
   bool flag;
   try
   {
     await GameMaestroService.StartGame(realmId, game);
     flag = true;
   }
   catch
   {
     flag = false;
   }
   return flag;
 }
Пример #9
0
 public IgniteClient(PlayerCredentialsDto credentials)
 {
     _credentials = credentials;
     _callbacks   = new Dictionary <PacketCommand, OnPacket>()
     {
         { PacketCommand.Batch, OnBatchPacket },
         { PacketCommand.KeyCheck, OnKeyCheck },
         { PacketCommand.World_SendGameNumber, OnWorldSendGameNumber },
         { PacketCommand.S2C_QueryStatusAns, OnQueryStatusAns },
         { PacketCommand.S2C_SynchVersion, OnSyncVersionAns },
         { PacketCommand.S2C_HeroSpawn, OnHeroSpawn },
         { PacketCommand.S2C_MinionSpawn, OnMinionSpawn },
         { PacketCommand.S2C_RemoveVisionBuff, OnRemoveVisionBuff }
         //        {PacketCommand.S2C_EndGame, OnExitGame}
     };
     _capturePoints = new List <uint>();
 }
Пример #10
0
        internal override bool HandleMessage(MessageReceivedEventArgs args)
        {
            GameDTO game = args.Body as GameDTO;
            PlayerCredentialsDto creds = args.Body as PlayerCredentialsDto;

            if (game != null)
            {
                GotGameData(game);
                return(true);
            }
            else if (creds != null)
            {
                OnGameStart(creds);
                return(true);
            }

            return(false);
        }
Пример #11
0
        public void LaunchGame(PlayerCredentialsDto CurrentGame)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.CreateNoWindow   = false;
            startInfo.WorkingDirectory = FindLoLExe();
            startInfo.FileName         = "League of Legends.exe";
            startInfo.Arguments        = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + CurrentGame.ServerIp + " " +
                                         CurrentGame.ServerPort + " " + CurrentGame.EncryptionKey + " " + CurrentGame.SummonerId + "\"";
            updateStatus("Playing League of Legends", Accountname);
            new Thread(() =>
            {
                exeProcess = Process.Start(startInfo);
                while (exeProcess.MainWindowHandle == IntPtr.Zero)
                {
                }
                Thread.Sleep(1000);
            }).Start();
        }
Пример #12
0
        private static void CountdownTimer_Tick(object sender, EventArgs e)
        {
            string ObserverServerIp;
            double GameId;
            string InternalName;
            string ObserverEncryptionKey;

            PlayerCredentialsDto replaydata = new PlayerCredentialsDto();

            ObserverServerIp      = replaydata.ObserverServerIp;
            GameId                = replaydata.GameId;
            InternalName          = Region.InternalName;
            ObserverEncryptionKey = replaydata.ObserverEncryptionKey;
            if (ReplayTimer.Interval == 0)
            {
                ReplayTimer.Stop();
                Autorecorder = new LegendaryClient.Logic.Replays.AutoReplayRecorder(ObserverServerIp, GameId, InternalName, ObserverEncryptionKey);
            }
        }
Пример #13
0
        internal static void LaunchGame()
        {
            string GameDirectory = Location;

            var p = new System.Diagnostics.Process();

            p.StartInfo.WorkingDirectory = GameDirectory;
            p.StartInfo.FileName         = Path.Combine(GameDirectory, "League of Legends.exe");
            p.Exited += p_Exited;
            p.StartInfo.Arguments = "\"8394\" \"" + RootLocation + "LoLLauncher.exe" + "\" \"" + "\" \"" +
                                    CurrentGame.ServerIp + " " +
                                    CurrentGame.ServerPort + " " +
                                    CurrentGame.EncryptionKey + " " +
                                    CurrentGame.SummonerId + "\"";
            p.Start();
            string ObserverServerIp;
            double GameId;
            string InternalName;
            string ObserverEncryptionKey;

            if (File.Exists(Path.Combine(ExecutingDirectory, "Replays", "ReplayRecorder.exe")))
            {
                PlayerCredentialsDto replaydata = CurrentGame;
                ObserverServerIp      = replaydata.ObserverServerIp;
                GameId                = replaydata.GameId;
                InternalName          = Region.InternalName;
                ObserverEncryptionKey = replaydata.ObserverEncryptionKey;
                System.Timers.Timer timer = new System.Timers.Timer();
                timer.Interval = 5000;
                timer.Elapsed += (o, e) =>
                {
                    var x = new System.Diagnostics.Process();
                    x.StartInfo.WorkingDirectory = ExecutingDirectory;
                    x.StartInfo.FileName         = Path.Combine(ExecutingDirectory, "Replays", "ReplayRecorder.exe");
                    x.StartInfo.Arguments        = "\"" + ExecutingDirectory + "\" \"" + GameId + "\" \"" + ObserverEncryptionKey + "\" \"" +
                                                   InternalName + "\" \"" + ObserverServerIp + "\"";
                    x.Start();
                    timer.Stop();
                };
                timer.Start();
            }
        }
Пример #14
0
 private bool OnPlayerCredentials(PlayerCredentialsDto creds)
 {
     return(false);
 }
Пример #15
0
        internal void JoinGame(PlayerCredentialsDto creds)
        {
            string str = $"{creds.ServerIp} {creds.ServerPort} {creds.EncryptionKey} {creds.SummonerId}";

            Launch(str);
        }
Пример #16
0
        /// <summary>
        /// Main logic behind Champion Select
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="message"></param>
        private void ChampSelect_OnMessageReceived(object sender, object message)
        {
            if (message.GetType() == typeof(GameDTO))
            {
                #region In Champion Select

                GameDTO ChampDTO = message as GameDTO;
                LatestDto = ChampDTO;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
                {
                    //Allow all champions to be selected (reset our modifications)
                    ListViewItem[] ChampionArray = new ListViewItem[ChampionSelectListView.Items.Count];
                    ChampionSelectListView.Items.CopyTo(ChampionArray, 0);
                    foreach (ListViewItem y in ChampionArray)
                    {
                        y.IsHitTestVisible = true;
                        y.Opacity          = 1;
                    }

                    //Push all teams into one array to save a foreach call (looks messy)
                    List <Participant> AllParticipants = new List <Participant>(ChampDTO.TeamOne.ToArray());
                    AllParticipants.AddRange(ChampDTO.TeamTwo);
                    foreach (Participant p in AllParticipants)
                    {
                        if (p is PlayerParticipant)
                        {
                            PlayerParticipant play = (PlayerParticipant)p;
                            //If it is our turn to pick
                            if (play.PickTurn == ChampDTO.PickTurn)
                            {
                                if (play.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId)
                                {
                                    ChampionSelectListView.IsHitTestVisible = true;
                                    ChampionSelectListView.Opacity          = 1;
                                    GameStatusLabel.Content = "Your turn to pick!";
                                    break;
                                }
                            }
                        }
                        //Otherwise block selection of champions unless in dev mode
                        if (!DevMode)
                        {
                            ChampionSelectListView.IsHitTestVisible = false;
                            ChampionSelectListView.Opacity          = 0.5;
                        }
                        GameStatusLabel.Content = "Waiting for others to pick...";
                    }

                    //Champion select was cancelled
                    if (ChampDTO.GameState == "TEAM_SELECT")
                    {
                        if (CountdownTimer != null)
                        {
                            CountdownTimer.Stop();
                        }
                        FixChampSelect();
                        FakePage fakePage = new FakePage();
                        fakePage.Content  = LobbyContent;
                        Client.SwitchPage(fakePage);
                        return;
                    }
                    else if (ChampDTO.GameState == "PRE_CHAMP_SELECT")
                    {
                        //Banning phase. Enable banning phase and this will render only champions for ban
                        BanningPhase = true;
                        PurpleBansLabel.Visibility   = Visibility.Visible;
                        BlueBansLabel.Visibility     = Visibility.Visible;
                        BlueBanListView.Visibility   = Visibility.Visible;
                        PurpleBanListView.Visibility = Visibility.Visible;
                        GameStatusLabel.Content      = "Bans are on-going";
                        counter = configType.BanTimerDuration - 3;

                        #region Render Bans
                        BlueBanListView.Items.Clear();
                        PurpleBanListView.Items.Clear();
                        foreach (var x in ChampDTO.BannedChampions)
                        {
                            Image champImage  = new Image();
                            champImage.Height = 58;
                            champImage.Width  = 58;
                            champImage.Source = champions.GetChampion(x.ChampionId).icon;
                            if (x.TeamId == 100)
                            {
                                BlueBanListView.Items.Add(champImage);
                            }
                            else
                            {
                                PurpleBanListView.Items.Add(champImage);
                            }

                            foreach (ListViewItem y in ChampionArray)
                            {
                                if ((int)y.Tag == x.ChampionId)
                                {
                                    ChampionSelectListView.Items.Remove(y);
                                    //Remove from arrays
                                    foreach (ChampionDTO PlayerChamps in ChampList.ToArray())
                                    {
                                        if (x.ChampionId == PlayerChamps.ChampionId)
                                        {
                                            ChampList.Remove(PlayerChamps);
                                            break;
                                        }
                                    }

                                    foreach (ChampionBanInfoDTO BanChamps in ChampionsForBan.ToArray())
                                    {
                                        if (x.ChampionId == BanChamps.ChampionId)
                                        {
                                            ChampionsForBan.Remove(BanChamps);
                                            break;
                                        }
                                    }
                                }
                            }
                        }

                        #endregion Render Bans
                    }
                    else if (ChampDTO.GameState == "CHAMP_SELECT")
                    {
                        //Picking has started. If pickturn has changed reset timer
                        LastPickTurn = ChampDTO.PickTurn;
                        BanningPhase = false;
                    }
                    else if (ChampDTO.GameState == "POST_CHAMP_SELECT")
                    {
                        //Post game has started. Allow trading
                        CanTradeWith            = await Client.PVPNet.GetPotentialTraders();
                        HasLockedIn             = true;
                        GameStatusLabel.Content = "All players have picked!";
                        if (configType != null)
                        {
                            counter = configType.PostPickTimerDuration - 2;
                        }
                        else
                        {
                            counter = 10;
                        }
                    }
                    else if (ChampDTO.GameState == "START_REQUESTED")
                    {
                        GameStatusLabel.Content = "The game is about to start!";
                        DodgeButton.IsEnabled   = false; //Cannot dodge past this point!
                        counter = 1;
                    }
                    else if (ChampDTO.GameState == "TERMINATED")
                    {
                        //TODO
                    }

                    #region Display players

                    BlueListView.Items.Clear();
                    PurpleListView.Items.Clear();
                    int i           = 0;
                    bool PurpleSide = false;

                    //Aram hack, view other players champions & names (thanks to Andrew)
                    List <PlayerChampionSelectionDTO> OtherPlayers = new List <PlayerChampionSelectionDTO>(ChampDTO.PlayerChampionSelections.ToArray());
                    bool AreWePurpleSide = false;

                    foreach (Participant participant in AllParticipants)
                    {
                        Participant tempParticipant = participant;
                        i++;
                        ChampSelectPlayer control = new ChampSelectPlayer();
                        //Cast AramPlayers as PlayerParticipants. This removes reroll data
                        if (tempParticipant is AramPlayerParticipant)
                        {
                            tempParticipant = new PlayerParticipant(tempParticipant.GetBaseTypedObject());
                        }

                        if (tempParticipant is PlayerParticipant)
                        {
                            PlayerParticipant player   = tempParticipant as PlayerParticipant;
                            control.PlayerName.Content = player.SummonerName;

                            foreach (PlayerChampionSelectionDTO selection in ChampDTO.PlayerChampionSelections)
                            {
                                #region Disable picking selected champs

                                foreach (ListViewItem y in ChampionArray)
                                {
                                    if ((int)y.Tag == selection.ChampionId)
                                    {
                                        y.IsHitTestVisible = false;
                                        y.Opacity          = 0.5;
                                        if (configType != null)
                                        {
                                            if (configType.DuplicatePick)
                                            {
                                                y.IsHitTestVisible = true;
                                                y.Opacity          = 1;
                                            }
                                        }
                                    }
                                }

                                #endregion Disable picking selected champs

                                if (selection.SummonerInternalName == player.SummonerInternalName)
                                {
                                    //Clear our teams champion selection for aram hack
                                    OtherPlayers.Remove(selection);
                                    control = RenderPlayer(selection, player);
                                    //If we have locked in render skin select
                                    if (HasLockedIn && selection.SummonerInternalName == Client.LoginPacket.AllSummonerData.Summoner.InternalName && !DevMode)
                                    {
                                        if (PurpleSide)
                                        {
                                            AreWePurpleSide = true;
                                        }
                                        RenderLockInGrid(selection);
                                        if (player.PointSummary != null)
                                        {
                                            LockInButton.Content = string.Format("Reroll ({0}/{1})", player.PointSummary.CurrentPoints, player.PointSummary.PointsCostToRoll);
                                            if (player.PointSummary.NumberOfRolls > 0)
                                            {
                                                LockInButton.IsEnabled = true;
                                            }
                                            else
                                            {
                                                LockInButton.IsEnabled = false;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else if (tempParticipant is ObfuscatedParticipant)
                        {
                            control.PlayerName.Content = "Summoner " + i;
                        }
                        else if (tempParticipant is BotParticipant)
                        {
                            BotParticipant bot                   = tempParticipant as BotParticipant;
                            string botChamp                      = bot.SummonerName.Split(' ')[0]; //Why is this internal name rito?
                            champions botSelectedChamp           = champions.GetChampion(botChamp);
                            PlayerParticipant part               = new PlayerParticipant();
                            PlayerChampionSelectionDTO selection = new PlayerChampionSelectionDTO();
                            selection.ChampionId                 = botSelectedChamp.id;
                            part.SummonerName                    = botSelectedChamp.displayName + " bot";
                            control = RenderPlayer(selection, part);
                        }
                        else
                        {
                            control.PlayerName.Content = "Unknown Summoner";
                        }
                        //Display purple side if we have gone through our team
                        if (i > ChampDTO.TeamOne.Count)
                        {
                            i          = 0;
                            PurpleSide = true;
                        }

                        if (!PurpleSide)
                        {
                            BlueListView.Items.Add(control);
                        }
                        else
                        {
                            PurpleListView.Items.Add(control);
                        }
                    }

                    //Do aram hack!
                    if (OtherPlayers.Count > 0)
                    {
                        if (AreWePurpleSide)
                        {
                            BlueListView.Items.Clear();
                        }
                        else
                        {
                            PurpleListView.Items.Clear();
                        }

                        foreach (PlayerChampionSelectionDTO hackSelection in OtherPlayers)
                        {
                            ChampSelectPlayer control = new ChampSelectPlayer();
                            PlayerParticipant player  = new PlayerParticipant();
                            player.SummonerName       = hackSelection.SummonerInternalName;
                            control = RenderPlayer(hackSelection, player);

                            if (AreWePurpleSide)
                            {
                                BlueListView.Items.Add(control);
                            }
                            else
                            {
                                PurpleListView.Items.Add(control);
                            }
                        }
                    }

                    #endregion Display players
                }));

                #endregion In Champion Select
            }
            else if (message.GetType() == typeof(PlayerCredentialsDto))
            {
                #region Launching Game

                PlayerCredentialsDto dto = message as PlayerCredentialsDto;
                Client.CurrentGame = dto;

                if (!HasLaunchedGame)
                {
                    HasLaunchedGame = true;
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                    {
                        if (CountdownTimer != null)
                        {
                            CountdownTimer.Stop();
                        }
                        QuitCurrentGame();
                    }));
                    Client.LaunchGame();
                }

                #endregion Launching Game
            }
            else if (message.GetType() == typeof(TradeContractDTO))
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    TradeContractDTO TradeDTO = message as TradeContractDTO;
                    if (TradeDTO.State == "PENDING")
                    {
                        PlayerTradeControl.Visibility = System.Windows.Visibility.Visible;
                        PlayerTradeControl.Tag        = TradeDTO;
                        PlayerTradeControl.AcceptButton.Visibility = System.Windows.Visibility.Visible;
                        PlayerTradeControl.DeclineButton.Content   = "Decline";

                        champions MyChampion = champions.GetChampion((int)TradeDTO.ResponderChampionId);
                        PlayerTradeControl.MyChampImage.Source  = MyChampion.icon;
                        PlayerTradeControl.MyChampLabel.Content = MyChampion.displayName;
                        champions TheirChampion = champions.GetChampion((int)TradeDTO.RequesterChampionId);
                        PlayerTradeControl.TheirChampImage.Source  = TheirChampion.icon;
                        PlayerTradeControl.TheirChampLabel.Content = TheirChampion.displayName;
                        PlayerTradeControl.RequestLabel.Content    = string.Format("{0} wants to trade!", TradeDTO.RequesterInternalSummonerName);
                    }
                    else if (TradeDTO.State == "CANCELED" || TradeDTO.State == "DECLINED" || TradeDTO.State == "BUSY")
                    {
                        PlayerTradeControl.Visibility = System.Windows.Visibility.Hidden;

                        NotificationPopup pop = new NotificationPopup(ChatSubjects.INVITE_STATUS_CHANGED,
                                                                      string.Format("{0} has {1} this trade", TradeDTO.RequesterInternalSummonerName, TradeDTO.State));

                        if (TradeDTO.State == "BUSY")
                        {
                            pop.NotificationTextBox.Text = string.Format("{0} is currently busy", TradeDTO.RequesterInternalSummonerName);
                        }

                        pop.Height = 200;
                        pop.OkButton.Visibility = System.Windows.Visibility.Visible;
                        pop.HorizontalAlignment = HorizontalAlignment.Right;
                        pop.VerticalAlignment   = VerticalAlignment.Bottom;
                        Client.NotificationGrid.Children.Add(pop);//*/
                    }
                }));
            }
        }
Пример #17
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);
                    }
                }
            }
        }
Пример #18
0
        public async void connection_OnMessageReceived(object sender, object message)
        {
            if (message is GameDTO)
            {
                GameDTO gameDTO = message as GameDTO;
                string  gameState;
                switch (gameState = gameDTO.GameState)
                {
                case "START_REQUESTED":
                    return;

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

                case "CHAMP_SELECT":
                {
                    this.firstTimeInCustom   = true;
                    this.firstTimeInQueuePop = true;
                    if (!this.firstTimeInLobby)
                    {
                        return;
                    }
                    this.firstTimeInLobby = false;
                    this.updateStatus("In Champion Select", this.Accountname);
                    await this.connection.SetClientReceivedGameMessage(gameDTO.Id, "CHAMP_SELECT_CLIENT");

                    if (this.queueType == QueueTypes.ARAM)
                    {
                        return;
                    }
                    if (this.parent.championToPick != "" && this.parent.championToPick != "RANDOM")
                    {
                        int spellOneId;
                        int spellTwoId;
                        if (!this.parent.randomSpell)
                        {
                            spellOneId = Enums.spellToId(this.parent.spell1);
                            spellTwoId = Enums.spellToId(this.parent.spell2);
                        }
                        else
                        {
                            Random     random = new Random();
                            List <int> list   = new List <int>
                            {
                                13,
                                6,
                                7,
                                10,
                                1,
                                11,
                                21,
                                12,
                                3,
                                14,
                                2,
                                4
                            };
                            int index  = random.Next(list.Count);
                            int index2 = random.Next(list.Count);
                            int num2   = list[index];
                            int num3   = list[index2];
                            if (num2 == num3)
                            {
                                int index3 = random.Next(list.Count);
                                num3 = list[index3];
                            }
                            spellOneId = Convert.ToInt32(num2);
                            spellTwoId = Convert.ToInt32(num3);
                        }
                        await this.connection.SelectSpells(spellOneId, spellTwoId);

                        await this.connection.SelectChampion(Enums.championToId(this.parent.championToPick));

                        await this.connection.ChampionSelectCompleted();

                        return;
                    }
                    if (this.parent.championToPick == "RANDOM")
                    {
                        int spellOneId2;
                        int spellTwoId2;
                        if (!this.parent.randomSpell)
                        {
                            spellOneId2 = Enums.spellToId(this.parent.spell1);
                            spellTwoId2 = Enums.spellToId(this.parent.spell2);
                        }
                        else
                        {
                            Random     random2 = new Random();
                            List <int> list2   = new List <int>
                            {
                                13,
                                6,
                                7,
                                10,
                                1,
                                11,
                                21,
                                12,
                                3,
                                14,
                                2,
                                4
                            };
                            int index4 = random2.Next(list2.Count);
                            int index5 = random2.Next(list2.Count);
                            int num4   = list2[index4];
                            int num5   = list2[index5];
                            if (num4 == num5)
                            {
                                int index6 = random2.Next(list2.Count);
                                num5 = list2[index6];
                            }
                            spellOneId2 = Convert.ToInt32(num4);
                            spellTwoId2 = Convert.ToInt32(num5);
                        }
                        await this.connection.SelectSpells(spellOneId2, spellTwoId2);

                        IEnumerable <ChampionDTO> source = this.availableChampsArray.Shuffle <ChampionDTO>();
                        await this.connection.SelectChampion(source.First((ChampionDTO champ) => champ.Owned || champ.FreeToPlay).ChampionId);

                        await this.connection.ChampionSelectCompleted();

                        return;
                    }
                    int spellOneId3;
                    int spellTwoId3;
                    if (!this.parent.randomSpell)
                    {
                        spellOneId3 = Enums.spellToId(this.parent.spell1);
                        spellTwoId3 = Enums.spellToId(this.parent.spell2);
                    }
                    else
                    {
                        Random     random3 = new Random();
                        List <int> list3   = new List <int>
                        {
                            13,
                            6,
                            7,
                            10,
                            1,
                            11,
                            21,
                            12,
                            3,
                            14,
                            2,
                            4
                        };
                        int index7 = random3.Next(list3.Count);
                        int index8 = random3.Next(list3.Count);
                        int num6   = list3[index7];
                        int num7   = list3[index8];
                        if (num6 == num7)
                        {
                            int index9 = random3.Next(list3.Count);
                            num7 = list3[index9];
                        }
                        spellOneId3 = Convert.ToInt32(num6);
                        spellTwoId3 = Convert.ToInt32(num7);
                    }
                    await this.connection.SelectSpells(spellOneId3, spellTwoId3);

                    await this.connection.SelectChampion(this.availableChampsArray.First((ChampionDTO champ) => champ.Owned || champ.FreeToPlay).ChampionId);

                    await this.connection.ChampionSelectCompleted();

                    return;
                }

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

                case "IN_QUEUE":
                    this.updateStatus("In Queue", this.Accountname);
                    return;

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

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

                        return;
                    }
                    return;
                }
                this.updateStatus("[DEFAULT]" + gameDTO.GameStateString, this.Accountname);
            }
            else if (message.GetType() == typeof(TradeContractDTO))
            {
                TradeContractDTO tradeContractDTO = message as TradeContractDTO;
                if (tradeContractDTO != null)
                {
                    string expr_CDE = tradeContractDTO.State;
                    if (expr_CDE != null && expr_CDE == "PENDING" && tradeContractDTO != null)
                    {
                        await this.connection.AcceptTrade(tradeContractDTO.RequesterInternalSummonerName, (int)tradeContractDTO.RequesterChampionId);
                    }
                }
            }
            else if (message is PlayerCredentialsDto)
            {
                this.firstTimeInPostChampSelect = true;
                PlayerCredentialsDto playerCredentialsDto = message as PlayerCredentialsDto;
                ProcessStartInfo     startInfo            = new ProcessStartInfo();
                startInfo.CreateNoWindow   = false;
                startInfo.WorkingDirectory = this.FindLoLExe();
                startInfo.FileName         = "League of Legends.exe";
                startInfo.Arguments        = string.Concat(new object[]
                {
                    "\"8394\" \"LoLLauncher.exe\" \"\" \"",
                    playerCredentialsDto.ServerIp,
                    " ",
                    playerCredentialsDto.ServerPort,
                    " ",
                    playerCredentialsDto.EncryptionKey,
                    " ",
                    playerCredentialsDto.SummonerId,
                    "\""
                });
                this.updateStatus("Launching League of Legends\n", this.Accountname);
                new Thread(delegate
                {
                    this.exeProcess         = Process.Start(startInfo);
                    this.exeProcess.Exited += new EventHandler(this.exeProcess_Exited);
                    while (this.exeProcess.MainWindowHandle == IntPtr.Zero)
                    {
                    }
                    this.exeProcess.PriorityClass       = ProcessPriorityClass.Idle;
                    this.exeProcess.EnableRaisingEvents = true;
                }).Start();
            }
            else if (message is EndOfGameStats)
            {
                if (this.exeProcess != null)
                {
                    this.exeProcess.Exited -= new EventHandler(this.exeProcess_Exited);
                    this.exeProcess.Kill();
                    Thread.Sleep(500);
                    if (this.exeProcess.Responding)
                    {
                        Process.Start("taskkill /F /IM \"League of Legends.exe\"");
                    }
                    this.loginPacket = await this.connection.GetLoginDataPacketForUser();

                    this.archiveSumLevel = this.sumLevel;
                    this.sumLevel        = this.loginPacket.AllSummonerData.SummonerLevel.Level;
                    if (this.sumLevel != this.archiveSumLevel)
                    {
                        this.levelUp();
                    }
                }
                this.AttachToQueue();
            }
        }
Пример #19
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();
                        }
                    }
                }
            }
        }
Пример #20
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();
            }
        }
Пример #21
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;
                        Tools.ConsoleMessage("You are in champion select.", ConsoleColor.White);
                        object obj = await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");

                        //select champion and spells for non ARAM  games
                        if (queueType != QueueTypes.ARAM)
                        {
                            int Spell1;
                            int Spell2;
                            if (!Program.randomSpell)
                            {
                                Spell1 = Enums.GetSpell(Program.spell1);
                                Spell2 = Enums.GetSpell(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);

                            string championPick   = "";
                            int    championPickID = 0;
                            int    champRand      = Generator.CreateRandom(1, 5);
                            switch (champRand)
                            {
                            case 1:
                                championPickID = Enums.GetChampion(Program.firstChampionPick);
                                championPick   = Program.firstChampionPick;
                                break;

                            case 2:
                                championPickID = Enums.GetChampion(Program.secondChampionPick);
                                championPick   = Program.secondChampionPick;
                                break;

                            case 3:
                                championPickID = Enums.GetChampion(Program.thirdChampionPick);
                                championPick   = Program.thirdChampionPick;
                                break;

                            case 4:
                                championPickID = Enums.GetChampion(Program.fourthChampionPick);
                                championPick   = Program.fourthChampionPick;
                                break;

                            case 5:
                                championPickID = Enums.GetChampion(Program.fifthChampionPick);
                                championPick   = Program.fifthChampionPick;
                                break;
                            }

                            await connection.SelectChampion(championPickID);

                            Tools.ConsoleMessage("Selected Champion: " + championPick.ToUpper(), ConsoleColor.DarkYellow);
                            await connection.ChampionSelectCompleted();
                        }

                        //select spells for ARAM
                        if (queueType == QueueTypes.ARAM)
                        {
                            int Spell1;
                            int Spell2;
                            if (!Program.randomSpell)
                            {
                                Spell1 = Enums.GetSpell(Program.spell1);
                                Spell2 = Enums.GetSpell(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.ChampionSelectCompleted();
                        }
                        break;
                    }
                    else
                    {
                        break;
                    }

                case "POST_CHAMP_SELECT":
                    firstTimeInLobby = false;
                    if (firstTimeInPostChampSelect)
                    {
                        firstTimeInPostChampSelect = false;
                        Tools.ConsoleMessage("Waiting for league of legends to respond.", ConsoleColor.White);
                    }
                    break;

                case "IN_QUEUE":
                    Tools.ConsoleMessage("You are now in queue.", ConsoleColor.White);
                    break;

                case "TERMINATED":
                    //Tools.ConsoleMessage("Re-entering queue.", ConsoleColor.White);
                    firstTimeInPostChampSelect = true;
                    firstTimeInQueuePop        = true;
                    break;

                case "LEAVER_BUSTED":
                    Tools.ConsoleMessage("You have leave buster.", ConsoleColor.White);
                    break;

                case "JOINING_CHAMP_SELECT":
                    if (firstTimeInQueuePop && game.StatusOfParticipants.Contains("1"))
                    {
                        Tools.ConsoleMessage("Match found and accepted.", ConsoleColor.White);
                        firstTimeInQueuePop = false;
                        firstTimeInLobby    = true;
                        object obj = await connection.AcceptPoppedGame(true);

                        break;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else if (message.GetType() == typeof(TradeContractDTO))
            {
                var tradeDto = message as TradeContractDTO;
                if (tradeDto == null)
                {
                    return;
                }
                switch (tradeDto.State)
                {
                case "PENDING":
                {
                    if (tradeDto != null)
                    {
                    }
                }
                break;
                }
                return;
            }
            else if (message is PlayerCredentialsDto)
            {
                firstTimeInPostChampSelect = true;
                PlayerCredentialsDto dto       = message as PlayerCredentialsDto;
                ProcessStartInfo     startInfo = new ProcessStartInfo();
                startInfo.CreateNoWindow   = false;
                startInfo.WorkingDirectory = GetLeagueClient();
                startInfo.FileName         = "League of Legends.exe";
                startInfo.Arguments        = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + dto.ServerIp + " " +
                                             dto.ServerPort + " " + dto.EncryptionKey + " " + dto.SummonerId + "\"";

                new Thread(() =>
                {
                    exeProcess         = Process.Start(startInfo);
                    exeProcess.Exited += new EventHandler(exeProcess_Exited);
                    while (exeProcess.MainWindowHandle == IntPtr.Zero)
                    {
                    }
                    if (Program.LOWPriority)
                    {
                        exeProcess.PriorityClass = ProcessPriorityClass.Idle;
                    }
                    else
                    {
                        exeProcess.PriorityClass = ProcessPriorityClass.High;
                    }

                    exeProcess.EnableRaisingEvents = true;
                    //Thread.Sleep(1000);
                }).Start();

                Tools.ConsoleMessage("Launching League of Legends.", ConsoleColor.White);
            }
            else if (!(message is GameNotification) && !(message is SearchingForMatchNotification))
            {
                if (message is EndOfGameStats)
                {
                    EnterQueue();
                }
                else
                {
                    if (message.ToString().Contains("EndOfGameStats"))
                    {
                        try
                        {
                            if (exeProcess != null)
                            {
                                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)
                                {
                                    OnLevelUp();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Tools.Log(ex.Message.ToString());
                        }
                    }
                }
            }
        }
Пример #22
0
 public static Task StartSpectatorGame(string realmId, string platformId, PlayerCredentialsDto game)
 {
     if (game == null)
     {
         return Task.FromResult<bool>(true);
     }
     JsApiService.Push("game:reconnect", null);
     object[] observerServerIp = new object[] { game.ObserverServerIp, game.ObserverServerPort, game.ObserverEncryptionKey, game.GameId, platformId };
     return GameMaestroService.RunLeagueOfLegends(realmId, string.Format("\"56471\" \"wintermint-delegator\" \"wintermint-delegator\" \"spectator {0}:{1} {2} {3} {4}\"", observerServerIp));
 }
Пример #23
0
 protected virtual void OnGameStart(PlayerCredentialsDto creds)
 {
     teamSelect?.Dispose();
     GameStarted?.Invoke(this, creds);
 }
Пример #24
0
        public async void OnMessageReceived(object sender, object message)
        {
            Debug.WriteLine("Calling message: " + message.GetType());

            #region Before Start
            if (message is ClientBeforeStart)
            {
                if (Packets.ReconnectInfo != null && Packets.ReconnectInfo.Game != null)
                {
                    OnMessageReceived(sender, (object)Packets.ReconnectInfo.PlayerCredentials);
                    return;
                }

                Client.Status("Successfully connected!", AccountName);
                Client.Accounts.Add(Packets);

                var playerCount         = Client.Accounts.Count();
                var lastConnectedPlayer = Client.Accounts.LastOrDefault();
                if (Account.Autoboost)
                {
                    BuyBoost();
                }

                if (lastConnectedPlayer == null)
                {
                    Console.WriteLine("Critical error!");
                    Controller.Restart();
                    return;
                }

                if (playerCount == _setting.MaxBots && lastConnectedPlayer.AllSummonerData.Summoner.SumId.Equals(SummonerId))
                {
                    Client.Status("Players connected! Creating lobby...", AccountName);
                    Timer createPremade = new Timer {
                        Interval = 3000, AutoReset = false
                    };
                    createPremade.Elapsed += (ek, eo) =>
                    {
                        createPremade.Stop();
                        OnMessageReceived(sender, (object)new CreateLobby());
                    };
                    createPremade.Start();
                    return;
                }
            }
            #endregion

            #region Creating lobby...
            if (message is CreateLobby)
            {
                if (!Controller.IsAvailable(SummonerQueue))
                {
                    Client.Status("QueueType is invalid or it is not supported!", AccountName);
                    return;
                }

                GameQueueConfig Game = new GameQueueConfig();
                Game.Id = SummonerQueue;

                if (_setting.Difficulty == "EASY" || _setting.Difficulty == "MEDIUM")
                {
                    Client.Lobby = await Connections.createArrangedBotTeamLobby(Game.Id, _setting.Difficulty);
                }
                else
                {
                    Client.Lobby = await Connections.createArrangedTeamLobby(Game.Id);
                }

                PlayerAcceptedInvite = true;
                Client.Status("Lobby created. Inviting players...", AccountName);

                if (Client.Accounts.Count == 1)
                {
                    OnMessageReceived(sender, Client.Lobby);
                    return;
                }

                foreach (var bot in Client.Accounts)
                {
                    if ((int)bot.AllSummonerData.Summoner.SumId != (int)SummonerId)
                    {
                        await Connections.Invite(bot.AllSummonerData.Summoner.SumId);
                    }
                }
            }
            #endregion

            #region Invite requested
            if (message is InvitationRequest)
            {
                var invitation = message as InvitationRequest;

                if (invitation.InvitationId == Client.Lobby.InvitationID && PlayerAcceptedInvite == false)
                {
                    Client.Lobby = await Connections.AcceptLobby(invitation.InvitationId);

                    PlayerAcceptedInvite = true;
                    Client.Status("Invitation accepted.", AccountName);
                    return;
                }
            }
            #endregion

            #region Lobby status
            if (message is LobbyStatus)
            {
                #region Ignore pls
                List <string> errors = new List <string>();
                if (Client.Lobby == null)
                {
                    errors.Add("NO!");
                }
                if (SummonerName != Client.Lobby.Owner.SummonerName)
                {
                    errors.Add("Trying to access LobbyStatus not as owner.");
                }
                if (Client.LobbyStatusWaiting)
                {
                    errors.Add("Currently waiting for all players.");
                }

                if (errors.Count > 0)
                {
                    Debug.WriteLine("-----------------------------");
                    Debug.WriteLine("LobbyStatus was terminated due following errors:");
                    foreach (var msg in errors)
                    {
                        Debug.WriteLine("        " + msg);
                    }
                    Debug.WriteLine("-----------------------------");
                    return;
                }
                #endregion

                if (Client.Lobby.Members.Count < _setting.MaxBots && !Client.LobbyStatusWaiting)
                {
                    Client.LobbyStatusWaiting = true;
                    while (Client.Lobby.Members.Count < _setting.MaxBots)
                    {
                        Thread.Sleep(100);
                    }
                }

                var lobbyInfo = Client.Lobby;
                Client.Status("Players are ready to start the game!", AccountName);

                #region Queue
                Client.LobbyGame.QueueIds = new Int32[1] {
                    (int)SummonerQueue
                };
                Client.LobbyGame.InvitationId  = lobbyInfo.InvitationID;
                Client.LobbyGame.Team          = lobbyInfo.Members.Select(stats => Convert.ToInt32(stats.SummonerId)).ToList();
                Client.LobbyGame.BotDifficulty = _setting.Difficulty;
                #endregion

                OnMessageReceived(sender, await Connections.AttachTeamToQueue(Client.LobbyGame));
                Client.Status("Game search initialized!", AccountName);
                return;
            }
            #endregion

            #region Game state
            if (message is GameDTO)
            {
                GameDTO game = message as GameDTO;
                switch (game.GameState)
                {
                case "CHAMP_SELECT":
                    if (FirstSelection)
                    {
                        break;
                    }

                    FirstSelection = true;
                    Client.Status("Champion select in.", AccountName);
                    await Connections.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT");

                    if (SummonerQueue != 65)
                    {
                        var hArray = HeroesArray.Shuffle();
                        await Connections.SelectChampion(hArray.First(hr => hr.FreeToPlay || hr.Owned || !hr.OwnedByYourTeam).ChampionId);

                        await Connections.ChampionSelectCompleted();
                    }

                    break;

                case "POST_CHAMP_SELECT":
                    FirstQueue = true;
                    //Client.Status("Post champion select.", AccountName);
                    break;

                case "PRE_CHAMP_SELECT":
                    break;

                case "GAME_START_CLIENT":
                    Client.Status("Lauching League of Legends.", AccountName);
                    break;

                case "GameClientConnectedToServer":
                    break;

                case "IN_QUEUE":
                    Client.Status("Waiting for game.", AccountName);
                    break;

                case "TERMINATED":
                    FirstQueue           = true;
                    PlayerAcceptedInvite = false;
                    Client.Status("Re-entering queue.", AccountName);
                    break;

                case "JOINING_CHAMP_SELECT":
                    if (FirstQueue)
                    {
                        Client.Status("Game accepted!", AccountName);
                        FirstQueue     = false;
                        FirstSelection = false;
                        try
                        {
                            await Connections.AcceptPoppedGame(true);
                        }
                        catch
                        {
                            RestartQueue(sender);
                        }
                        break;
                    }
                    break;

                case "LEAVER_BUSTED":
                    Client.Status("Leave Busted!", AccountName);
                    break;
                }
            }
            #endregion

            #region Starting game...
            if (message is PlayerCredentialsDto)
            {
                string gameLocation = Controller.GameClientLocation(_setting.GamePath);
                PlayerCredentialsDto credentials = message as PlayerCredentialsDto;
                ProcessStartInfo     startInfo   = new ProcessStartInfo();

                startInfo.CreateNoWindow   = false;
                startInfo.WorkingDirectory = gameLocation;
                startInfo.FileName         = "League of Legends.exe";
                startInfo.Arguments        = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + credentials.ServerIp + " " +
                                             credentials.ServerPort + " " + credentials.EncryptionKey + " " + credentials.SummonerId + "\"";
                Client.Status("Launching League of Legends", AccountName);



                new Thread((ThreadStart)(() =>
                {
                    while (Client.ClientDelay)
                    {
                        Thread.Sleep(100);
                    }

                    Client.ClientDelay = true;
                    LeagueProcess = Process.Start(startInfo);
                    LeagueProcess.Exited += LeagueProcess_Exited;
                    while (LeagueProcess.MainWindowHandle == IntPtr.Zero)
                    {
                        ;
                    }
                    LeagueProcess.PriorityClass = ProcessPriorityClass.Idle;
                    LeagueProcess.EnableRaisingEvents = true;
                    Timer clientDelay = new Timer {
                        AutoReset = false, Interval = Client.Delay
                    };
                    clientDelay.Elapsed += (o, args) =>
                    {
                        Client.ClientDelay = false;
                    };
                    clientDelay.Start();
                })).Start();
            }

            if (message is EndOfGameStats)
            {
                Client.Accounts.Clear();
                Client.LobbyStatusWaiting = false;

                // Process kill
                LeagueProcess.Exited -= LeagueProcess_Exited;

                while (LeagueProcess.Responding)
                {
                    LeagueProcess.Kill();
                    Thread.Sleep(500);
                }


                var msg = message as EndOfGameStats;
                Packets = await Connections.GetLoginDataPacketForUser();

                WebService.SetLevel(Account.Id, (int)Packets.AllSummonerData.SummonerLevel.Level);
                WebService.SetMoney(Account.Id, (int)Packets.IpBalance);


                if (SummonerLevel < Packets.AllSummonerData.SummonerLevel.Level)
                {
                    Client.Status("Level up! " + Packets.AllSummonerData.SummonerLevel.Level, AccountName);
                }

                // Player level limit
                if (MaxLevelReached((int)Packets.AllSummonerData.SummonerLevel.Level))
                {
                    // This player will not be added to lobby!
                    Client.Status("Maximum level reached!", AccountName);
                    return;
                }
                else if (Account.Autoboost)
                {
                    BuyBoost();
                }

                OnMessageReceived(sender, new ClientBeforeStart());
                return;
            }
            #endregion

            #region Searching for match
            if (message is SearchingForMatchNotification)
            {
                var result = message as SearchingForMatchNotification;

                if (result.PlayerJoinFailures != null)
                {
                    List <Tuple <string, int> > summoners = new List <Tuple <string, int> >();
                    string accessToken = null;
                    bool   penalty     = false;


                    foreach (var item in result.PlayerJoinFailures)
                    {
                        var x = new QueueDodger(item as TypedObject);
                        if (x.ReasonFailed == "LEAVER_BUSTED")
                        {
                            accessToken = x.AccessToken;
                            summoners.Add(new Tuple <string, int>(x.Summoner.Name, x.LeaverPenaltyMillisRemaining));
                            penalty = true;
                        }
                        else
                        {
                            Client.Status("Reason: " + x.ReasonFailed, AccountName);

                            return;
                        }
                    }

                    if (penalty)
                    {
                        Debug.WriteLine("Penalty timer.");
                        var timeWait = summoners.OrderByDescending(s => s.Item2).FirstOrDefault().Item2;
                        var time     = TimeSpan.FromMilliseconds(timeWait);
                        var players  = string.Join(",", summoners.Select(s => s.Item1).ToArray());
                        Debug.WriteLine("Time wait" + timeWait + "ms." + "Counted summoners: " + summoners.Count + "; Summoners: " + players);
                        Client.Status("Waiting " + time.Minutes + " mins to be able to join queue", AccountName);
                        Thread.Sleep(timeWait + 2999);

                        if (SummonerName == Client.Lobby.Owner.SummonerName)
                        {
                            OnMessageReceived(sender, await Connections.AttachToQueue(Client.LobbyGame, accessToken));
                        }
                    }
                }
            }
            #endregion
        }