private void connection_OnLogin(object sender, string username, string ipAddress)
        {
            new Thread((ThreadStart)(async() =>
            {
                updateStatus("Connecting...", Accountname);
                this.RegisterNotifications();
                this.loginPacket = await this.connection.GetLoginDataPacketForUser();
                if (loginPacket.AllSummonerData == null)
                {
                    Random rnd = new Random();
                    String summonerName = Accountname;
                    if (summonerName.Length > 16)
                    {
                        summonerName = summonerName.Substring(0, 12) + new Random().Next(1000, 9999).ToString();
                    }
                    LoLLauncher.RiotObjects.Platform.Summoner.AllSummonerData sumData = await connection.CreateDefaultSummoner(summonerName);
                    loginPacket.AllSummonerData = sumData;
                    updateStatus("Created Summonername " + summonerName, Accountname);
                }
                sumLevel = loginPacket.AllSummonerData.SummonerLevel.Level;
                string sumName = loginPacket.AllSummonerData.Summoner.Name;
                double sumId = loginPacket.AllSummonerData.Summoner.SumId;
                rpBalance = loginPacket.RpBalance;
                if (sumLevel > Program.maxLevel || sumLevel == Program.maxLevel)
                {
                    connection.Disconnect();
                    updateStatus("Summoner: " + sumName + " is already max level.", Accountname);
                    updateStatus("Log into new account.", Accountname);
                    Program.lognNewAccount();
                    return;
                }
                if (rpBalance == 400.0 && Program.buyBoost)
                {
                    updateStatus("Buying XP Boost", Accountname);
                    try
                    {
                        Task t = new Task(buyBoost);
                        t.Start();
                    }
                    catch (Exception exception)
                    {
                        updateStatus("Couldn't buy RP Boost.\n" + exception, Accountname);
                    }
                }
                if (sumLevel < 3.0 && queueType == QueueTypes.NORMAL_5x5)
                {
                    this.updateStatus("Need to be Level 3 before NORMAL_5x5 queue.", Accountname);
                    this.updateStatus("Joins Co-Op vs AI (Beginner) queue until 3", Accountname);
                    queueType = QueueTypes.BEGINNER_BOT;
                    actualQueueType = QueueTypes.NORMAL_5x5;
                }
                else if (sumLevel < 6.0 && queueType == QueueTypes.ARAM)
                {
                    this.updateStatus("Need to be Level 6 before ARAM queue.", Accountname);
                    this.updateStatus("Joins Co-Op vs AI (Beginner) queue until 6", Accountname);
                    queueType = QueueTypes.BEGINNER_BOT;
                    actualQueueType = QueueTypes.ARAM;
                }
                else if (sumLevel < 7.0 && queueType == QueueTypes.NORMAL_3x3)
                {
                    this.updateStatus("Need to be Level 7 before NORMAL_3x3 queue.", Accountname);
                    this.updateStatus("Joins Co-Op vs AI (Beginner) queue until 7", Accountname);
                    queueType = QueueTypes.BEGINNER_BOT;
                    actualQueueType = QueueTypes.NORMAL_3x3;
                }

                /* Should be randomize the summonericon on every login,
                 * but only works with extra icons, so it crashes if you only got the standards.
                 * double[] ids = new double[Convert.ToInt32(sumId)];
                 * string icons = await connection.GetSummonerIcons(ids);
                 * List<int> availableIcons = new List<int> { };
                 * var random = new Random();
                 * foreach (var id in icons)
                 * {
                 *  availableIcons.Add(Convert.ToInt32(id));
                 *  Console.WriteLine("[DEBUG]: Added Icon: " + id);
                 * }
                 * int index = random.Next(availableIcons.Count);
                 * Console.WriteLine(" | Random Icon: " + index);
                 * int randomIcon = availableIcons[index];
                 * Console.WriteLine(" | Choose from List: " + randomIcon);
                 * await connection.UpdateProfileIconId(randomIcon);*/
                updateStatus("Đăng nhập : " + loginPacket.AllSummonerData.Summoner.Name + " @ level " + loginPacket.AllSummonerData.SummonerLevel.Level, Accountname);
                availableChampsArray = await connection.GetAvailableChampions();
                LoLLauncher.RiotObjects.Team.Dto.PlayerDTO player = await connection.CreatePlayer();
                if (this.loginPacket.ReconnectInfo != null && this.loginPacket.ReconnectInfo.Game != null)
                {
                    this.connection_OnMessageReceived(sender, (object)this.loginPacket.ReconnectInfo.PlayerCredentials);
                }
                else
                {
                    this.connection_OnMessageReceived(sender, (object)new EndOfGameStats());
                }
            })).Start();
        }
Ejemplo n.º 2
0
 private void connection_OnLogin(object sender, string username, string ipAddress)
 {
     new Thread((ThreadStart)(async() =>
     {
         updateStatus("Connecting...", Accountname);
         loginPacket = await connection.GetLoginDataPacketForUser();
         if (loginPacket.AllSummonerData == null)
         {
             Random rnd = new Random();
             String summonerName = Accountname;
             if (summonerName.Length > 16)
             {
                 summonerName = summonerName.Substring(0, 11) + new Random().Next(1000, 9999).ToString();
             }
             updateStatus("Create Summoner: " + summonerName, Accountname);
             await connection.CreateDefaultSummoner(summonerName);
         }
         await connection.Subscribe("bc", loginPacket.AllSummonerData.Summoner.AcctId);
         await connection.Subscribe("cn", loginPacket.AllSummonerData.Summoner.AcctId);
         await connection.Subscribe("gn", loginPacket.AllSummonerData.Summoner.AcctId);
         sumLevel = loginPacket.AllSummonerData.SummonerLevel.Level;
         sumName = loginPacket.AllSummonerData.Summoner.Name;
         sumId = loginPacket.AllSummonerData.Summoner.SumId;
         rpBalance = loginPacket.RpBalance;
         if (sumLevel > parent.maxLevel || sumLevel == parent.maxLevel)
         {
             connection.Disconnect();
             updateStatus("Summoner: " + sumName + " is already max level.", Accountname);
             updateStatus("Log into new account.", Accountname);
             parent.lognNewAccount();
             return;
         }
         if (sumLevel < 3.0 && queueType == QueueTypes.NORMAL_5x5)
         {
             this.updateStatus("Need to be Level 3 before NORMAL_5x5 queue.", Accountname);
             this.updateStatus("Joins Co-Op vs AI (Beginner) queue until 3", Accountname);
             queueType = QueueTypes.BEGINNER_BOT;
             actualQueueType = QueueTypes.NORMAL_5x5;
         }
         else if (sumLevel < 6.0 && queueType == QueueTypes.ARAM)
         {
             this.updateStatus("Need to be Level 6 before ARAM queue.", Accountname);
             this.updateStatus("Joins Co-Op vs AI (Beginner) queue until 6", Accountname);
             queueType = QueueTypes.BEGINNER_BOT;
             actualQueueType = QueueTypes.ARAM;
         }
         else if (sumLevel < 7.0 && queueType == QueueTypes.NORMAL_3x3)
         {
             this.updateStatus("Need to be Level 7 before NORMAL_3x3 queue.", Accountname);
             this.updateStatus("Joins Co-Op vs AI (Beginner) queue until 7", Accountname);
             queueType = QueueTypes.BEGINNER_BOT;
             actualQueueType = QueueTypes.NORMAL_3x3;
         }
         if ((loginPacket.AllSummonerData.Summoner.ProfileIconId == -1 || loginPacket.AllSummonerData.Summoner.ProfileIconId == 1))
         {
             double[] ids = new double[Convert.ToInt32(sumId)];
             string icons = await connection.GetSummonerIcons(ids);
             List <int> availableIcons = new List <int> {
             };
             var random = new Random();
             for (int i = 0; i < 29; i++)
             {
                 availableIcons.Add(i);
             }
             foreach (var id in icons)
             {
                 availableIcons.Add(Convert.ToInt32(id));
             }
             int index = random.Next(availableIcons.Count);
             int randomIcon = availableIcons[index];
             await connection.UpdateProfileIconId(randomIcon);
         }
         if (rpBalance == 400.0 && parent.buyBoost && sumLevel < 5)
         {
             updateStatus("Buying XP Boost", Accountname);
             try
             {
                 Task t = new Task(buyBoost);
                 t.Start();
             }
             catch (Exception exception)
             {
                 updateStatus("Couldn't buy RP Boost.\n" + exception, Accountname);
             }
         }
         updateStatus("Logged in as " + loginPacket.AllSummonerData.Summoner.Name + " @ level " + loginPacket.AllSummonerData.SummonerLevel.Level, Accountname);
         availableChampsArray = await connection.GetAvailableChampions();
         PlayerDTO player = await connection.CreatePlayer();
         if (loginPacket.ReconnectInfo != null && loginPacket.ReconnectInfo.Game != null)
         {
             connection_OnMessageReceived(sender, (object)loginPacket.ReconnectInfo.PlayerCredentials);
         }
         else
         {
             connection_OnMessageReceived(sender, (object)new EndOfGameStats());
         }
     })).Start();
 }
Ejemplo n.º 3
0
        void connection_OnLogin(object sender, string username, string ipAddress)
        {
            new Thread(async delegate()
            {
                RegisterNotifications();
                loginPacket = await connection.GetLoginDataPacketForUser();
                //

                /*FileSystemWatcher watcher = new FileSystemWatcher();
                 * watcher.Path = @"..\Common\";
                 * watcher.Filter = "summoner_" + loginPacket.AllSummonerData.Summoner.Name + "_finished.txt";
                 * watcher.NotifyFilter = NotifyFilters.LastAccess |
                 *       NotifyFilters.LastWrite |
                 *       NotifyFilters.FileName |
                 *       NotifyFilters.DirectoryName;
                 * watcher.Created += watcher_Created;
                 * watcher.EnableRaisingEvents = true;*/
                if (loginPacket.AllSummonerData == null)
                {
                    Random rnd          = new Random();
                    String summonerName = username;
                    if (summonerName.Length > 16)
                    {
                        summonerName = summonerName.Substring(0, 12) + new Random().Next(1000, 9999).ToString();
                    }
                    LoLLauncher.RiotObjects.Platform.Summoner.AllSummonerData sumData = await connection.CreateDefaultSummoner(summonerName);
                    loginPacket.AllSummonerData = sumData;
                }
                updateStatus("Logged in on " + loginPacket.AllSummonerData.Summoner.Name);
                updateStatus("Starting at lvl " + loginPacket.AllSummonerData.SummonerLevel.Level);
                if (loginPacket.AllSummonerData.SummonerLevel.Level < 6 && queueType == QueueTypes.ARAM)
                {
                    updateStatus("Need to lvl up before ARAM. Defaulting to intro bots");
                    queueType = QueueTypes.INTRO_BOT;
                }
                updateStatus("Starting with " + loginPacket.IpBalance + "ip");
                LoLLauncher.RiotObjects.Platform.Matchmaking.GameQueueConfig[] availableQueues = await connection.GetAvailableQueues();
                //LoLLauncher.RiotObjects.Platform.Summoner.Boost.SummonerActiveBoostsDTO boosts = await connection.GetSumonerActiveBoosts();
                //LoLLauncher.RiotObjects.Platform.Leagues.Client.Dto.SummonerLeagueItemAndProgresssDTO leaguePosProg = await connection.GetMyLeaguePositionsAndProgress();
                availableChampsArray = await connection.GetAvailableChampions();
                LoLLauncher.RiotObjects.Platform.Summoner.Runes.SummonerRuneInventory sumRuneInven   = await connection.GetSummonerRuneInventory(loginPacket.AllSummonerData.Summoner.SumId);
                LoLLauncher.RiotObjects.Platform.Leagues.Client.Dto.SummonerLeagueItemsDTO leaguePos = await connection.GetMyLeaguePositions();
                object preferences = await connection.LoadPreferencesByKey("KEY BINDINGS", 1, false);
                LoLLauncher.RiotObjects.Platform.Summoner.Masterybook.MasteryBookDTO masteryBook = await connection.GetMasteryBook(loginPacket.AllSummonerData.Summoner.SumId);
                LoLLauncher.RiotObjects.Team.Dto.PlayerDTO player = await connection.CreatePlayer();

                if (loginPacket.ReconnectInfo != null && loginPacket.ReconnectInfo.Game != null)
                {
                    updateStatus("Reconnecting to game");
                    connection_OnMessageReceived(sender, loginPacket.ReconnectInfo.PlayerCredentials);
                }
                else
                {
                    if (queueType == QueueTypes.CUSTOM)
                    {
                        CreatePracticeGame();
                    }
                    else
                    {
                        LoLLauncher.RiotObjects.Platform.Statistics.EndOfGameStats eog = new LoLLauncher.RiotObjects.Platform.Statistics.EndOfGameStats();
                        connection_OnMessageReceived(sender, eog);
                    }
                }
            }).Start();
        }
Ejemplo n.º 4
0
        private void connection_OnLogin(object sender, string username, string ipAddress)
        {
            new Thread(async() =>
            {
                App.gameMask.findAndKillHflWindow(info.username, info.region.ToString());

                loginDataPacket = await connection.GetLoginDataPacketForUser();

                #region createSummoner
                if (loginDataPacket.AllSummonerData == null)
                {
                    Random random       = new Random();
                    string summonerName = info.username;
                    if (summonerName.Length > 16)
                    {
                        summonerName = summonerName.Substring(0, 12) + new Random().Next(1000, 9999).ToString();
                    }
                    await connection.CreateDefaultSummoner(summonerName);
                    updateStatus(msgStatus.INFO, "Created Summoner: " + summonerName);
                }
                #endregion

                loginDataPacket = await connection.GetLoginDataPacketForUser();

                #region registerMessages
                await connection.Subscribe("bc", loginDataPacket.AllSummonerData.Summoner.AcctId);
                await connection.Subscribe("cn", loginDataPacket.AllSummonerData.Summoner.AcctId);
                await connection.Subscribe("gn", loginDataPacket.AllSummonerData.Summoner.AcctId);
                #endregion

                #region ackDialogBusterWarning
                await connection.ackLeaverBusterWarning();
                await connection.callPersistenceMessaging(new SimpleDialogMessageResponse()
                {
                    AccountID = loginDataPacket.AllSummonerData.Summoner.SumId,
                    MsgID     = loginDataPacket.AllSummonerData.Summoner.SumId,
                    Command   = "ack"
                });
                #endregion

                #region fetchSummonerData
                info.summonerId     = loginDataPacket.AllSummonerData.Summoner.SumId;
                info.currentLevel   = loginDataPacket.AllSummonerData.SummonerLevel.Level;
                info.currentIp      = loginDataPacket.IpBalance;
                info.expToNextLevel = loginDataPacket.AllSummonerData.SummonerLevel.ExpToNextLevel;;
                info.currentXp      = loginDataPacket.AllSummonerData.SummonerLevelAndPoints.ExpPoints;
                info.currentRp      = loginDataPacket.RpBalance;
                info.summonerName   = loginDataPacket.AllSummonerData.Summoner.Name;
                myChampions         = await connection.GetAvailableChampions();
                await connection.CreatePlayer();
                sessionManager.smurfStart(info.username, info.region, info.currentXp, info.currentIp, info.currentLevel, info.expToNextLevel);
                updateStatus(msgStatus.INFO, "Logged in as " + info.summonerName + " @ level " + info.currentLevel);
                #endregion

                #region checkReconnectState
                if (loginDataPacket.ReconnectInfo != null && loginDataPacket.ReconnectInfo.Game != null)
                {
                    connection_OnMessageReceived(sender, loginDataPacket.ReconnectInfo.PlayerCredentials);
                    return;
                }
                #endregion

                #region startSoloSequence
                if (type == RotationType.SmurfDone)
                {
                    if (info.desiredLevel <= loginDataPacket.AllSummonerData.SummonerLevel.Level)
                    {
                        connection.Disconnect();
                        return;
                    }
                }

                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";
                }
                updateStatus(msgStatus.INFO, QueueType.ToString());
                if (QueueType != 0)
                {
                    matchParams.QueueIds = new int[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;
                                }
                            }
                        }

                        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(); ->Visual Timer
                            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();
                            }
                        }
                    }
                }
                #endregion
            }).Start();
        }
Ejemplo n.º 5
0
        private void connection_OnLogin(object sender, string username, string ipAddress)
        {
            Logger.Push("Smurf logged in, ready to queue", "info", this.username);
            smurf.updateTimer(15);

            new Thread((ThreadStart)(async() =>
            {
                loginPacket = await connection.GetLoginDataPacketForUser();
                this.RegisterNotifications();
                if (loginPacket.AllSummonerData == null)
                {
                    Random rnd = new Random();
                    String summonerName = username;
                    if (summonerName.Length > 16)
                    {
                        summonerName = summonerName.Substring(0, 12) + new Random().Next(1000, 9999).ToString();
                    }
                    LoLLauncher.RiotObjects.Platform.Summoner.AllSummonerData sumData = await connection.CreateDefaultSummoner(summonerName);
                    loginPacket.AllSummonerData = sumData;

                    Logger.Push("Smurf summoner name updated as" + summonerName, "success", this.username);
                }
                currentLevel = loginPacket.AllSummonerData.SummonerLevel.Level;
                currentExp = loginPacket.AllSummonerData.SummonerLevelAndPoints.ExpPoints;
                toNextLevel = loginPacket.AllSummonerData.SummonerLevel.ExpToNextLevel;
                dynamicSummonerName = loginPacket.AllSummonerData.Summoner.Name;
                summonerId = loginPacket.AllSummonerData.Summoner.SumId;
                rpBalance = loginPacket.RpBalance;
                updateSmurfInfo();

                if (currentLevel >= desiredLevel)
                {
                    Logger.Push("Smurfing is done, smurf is level: " + (int)currentLevel, "success", this.username);
                    if (!smurf.groupMember)
                    {
                        connection.Disconnect();
                    }
                }

                if (rpBalance == 400.0 && App.Client.UserData.Settings.BuyBoost)
                {
                    Logger.Push("Buying xp boost", "info", this.username);
                    try
                    {
                        Task t = new Task(buyBoost);
                        t.Start();
                    }
                    catch (Exception exception)
                    {
                        Logger.Push("Failed to buy xp boost", "warning", this.username);
                    }
                }

                availableChampsArray = await connection.GetAvailableChampions();
                LoLLauncher.RiotObjects.Team.Dto.PlayerDTO player = await connection.CreatePlayer();

                if (this.loginPacket.ReconnectInfo != null && this.loginPacket.ReconnectInfo.Game != null)
                {
                    this.connection_OnMessageReceived(sender, (object)this.loginPacket.ReconnectInfo.PlayerCredentials); //Oyun varsa reconnect paketini yonlendir
                }
                else
                {
                    if (!smurf.groupMember)
                    {
                        this.joinQueue();
                    }
                    else
                    {
                        if (smurf.isHost)
                        {
                            this.createLobby();
                        }
                        else
                        {
                            Logger.Push("Requesting host to invite me.", "info", this.username);
                            smurf.hostCallback.inviteMe(summonerId);
                            smurf.updateTimer(15);
                        }
                    }
                }
            })).Start();
        }