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(); }
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(); }