private async void PlayRanked(int button) { Close?.Invoke(this, new EventArgs()); switch (button) { case 0: try { var mmp = new MatchMakerParams { QueueIds = new[] { selected.ID } }; queue = await Queue.Create(mmp); queue.QueuePopped += Queue_QueuePopped; queue.QueueCancelled += Queue_QueueCancelled; SetInQueue(true); } catch { } break; case 1: //TODO Ranked Duo Lobby var lobby = QueueLobby.CreateLobby(selected.ID); LoLClient.QueueManager.JoinLobby(lobby); break; } }
private async void QueueButton_Click(object sender, RoutedEventArgs e) { //to queue if (InQueue == false) { LastSender = (Button)sender; GameQueueConfig config = (GameQueueConfig)LastSender.Tag; //Make TeamBuilder Work for solo if (config.Id != 61) { if (Queues.Contains(config.Id)) { return; } Queues.Add(config.Id); MatchMakerParams parameters = new MatchMakerParams(); parameters.QueueIds = new Int32[] { Convert.ToInt32(config.Id) }; Client.QueueId = config.Id; Client.PVPNet.AttachToQueue(parameters, new SearchingForMatchNotification.Callback(EnteredQueue)); } else if (config.Id == 61) { LobbyStatus Lobby = await Client.PVPNet.createArrangedTeamLobby(Convert.ToInt32(config.Id)); Client.ClearPage(typeof(TeamBuilderPage)); Client.SwitchPage(new TeamBuilderPage(false, Lobby)); } return; } else if (InQueue == true) { InQueue = false; await LeaveAllQueues(); } }
public async Task StartQueue() { switch (loop.CurrentType) { case PlayLoopType.STANDARD: var mmp = new MatchMakerParams { InvitationId = lastLobbyStatus.InvitationId, QueueIds = new List <int> { loop.CurrentQueueId }, Team = lastLobbyStatus.Members.Select(m => m.SummonerId).ToList() }; var search = await this.session.MatchmakingService.AttachToQueue(mmp); session.HandleMessage(search); OnSearchingForMatch(search); break; case PlayLoopType.DRAFT: var result = await this.session.TeambuilderDraftService.StartMatchmaking(); session.HandleMessage(result); break; } }
#pragma warning disable 4014 private void StartGameButton_Click(object sender, RoutedEventArgs e) { if (!inQueue) { MatchMakerParams parameters = new MatchMakerParams(); parameters.Languages = null; QueueIds = new List <int>(); QueueIds.Add(queueId); parameters.QueueIds = (makeRanked ? new int[] { 4 } : QueueIds.ToArray()); parameters.InvitationId = CurrentLobby.InvitationID; parameters.TeamId = null; parameters.LastMaestroMessage = null; List <int> InviteList = new List <int>(); foreach (Member stats in CurrentLobby.Members) { int GameInvitePlayerList = Convert.ToInt32(stats.SummonerId); InviteList.Add(GameInvitePlayerList); } parameters.Team = InviteList; Client.PVPNet.AttachTeamToQueue(parameters, new SearchingForMatchNotification.Callback(EnteredQueue)); } else { Client.PVPNet.PurgeFromQueues(); setStartButtonText("Start Game"); inQueue = false; Client.GameStatus = "outOfGame"; Client.SetChatHover(); } }
#pragma warning disable 4014 private void StartGameButton_Click(object sender, RoutedEventArgs e) { if (!inQueue) { var parameters = new MatchMakerParams(); parameters.Languages = null; QueueIds = new List <int>(); QueueIds.Add(queueId); parameters.QueueIds = (makeRanked ? new[] { 4 } : QueueIds.ToArray()); parameters.InvitationId = CurrentLobby.InvitationID; parameters.TeamId = null; parameters.LastMaestroMessage = null; var InviteList = new List <int>(); foreach (Member stats in CurrentLobby.Members) { int GameInvitePlayerList = Convert.ToInt32(stats.SummonerId); InviteList.Add(GameInvitePlayerList); } parameters.Team = InviteList; Client.PVPNet.AttachTeamToQueue(parameters, EnteredQueue); } else { Client.PVPNet.PurgeFromQueues(); setStartButtonText("Start Game"); inQueue = false; Client.GameStatus = "outOfGame"; Client.SetChatHover(); Dispatcher.Invoke(() => { Client.inQueueTimer.Visibility = Visibility.Hidden; }); } }
private async void TeamQueueButton_Click(object sender, RoutedEventArgs e) { //To leave all other queues await LeaveAllQueues(); InQueue = false; LastSender = (Button)sender; GameQueueConfig config = (GameQueueConfig)LastSender.Tag; //Make Teambuilder work for duo if (config.Id != 61 && config.TypeString != "BOT") { if (Queues.Contains(config.Id)) { return; } Queues.Add(config.Id); MatchMakerParams parameters = new MatchMakerParams(); parameters.QueueIds = new Int32[] { Convert.ToInt32(config.Id) }; Client.GameQueue = Convert.ToInt32(config.Id); LobbyStatus Lobby = await Client.PVPNet.createArrangedTeamLobby(Convert.ToInt32(config.Id)); Client.ClearPage(typeof(TeamQueuePage)); Client.SwitchPage(new TeamQueuePage(Lobby.InvitationID, Lobby)); } else if (config.TypeString == "BOT") { } else { LobbyStatus Lobby = await Client.PVPNet.createArrangedTeamLobby(Convert.ToInt32(config.Id)); Client.SwitchPage(new TeamBuilderPage(true, Lobby)); } }
private void OnLobbyStatus(object lobbyStatus) { if (_inQueue) { return; } var status = lobbyStatus as LobbyStatus; var players = Globals.Configuration.Dominion ? 10 : 6; if (Globals.Configuration.Dominion3v3) { players = 6; } if (Globals.Configuration.MaxBots == 1) { players = 1; } if (Globals.Configuration.CoopVsAI) { _lobbyStatus = status; players = 5; } if (status.Owner.SummonerName == _account.Username && !_inQueue && status.Members.Length != players) { Log.Write("[{2}] Waiting on bots to join {0}/{1}", status.Members.Length, players, _account.Username); return; } if (status.Members.Length == players && Master && !Globals.Configuration.CoopVsAI && _currentGame != null) { Log.Write("[{0}] Starting Champion Select! ({1}/{2} players)", _account.Username, players, status.Members.Length); _client.StartChampionSelect(_currentGame.id, _currentGame.optimisticLock); return; } lock (_queueLock) { if (Globals.Configuration.CoopVsAI && status.Members.Length == players && Master && !_inQueue && status.InvitedPlayers.Length == players) { var mmp = new MatchMakerParams(); mmp.InvitationId = _lobbyStatus.InvitationID; mmp.QueueIds = new Int32[1] { (int)_queueId }; mmp.BotDifficulty = "MEDIUM"; mmp.Team = new List <int>(); status.Members.ForEach(m => mmp.Team.Add((int)m.SummonerId)); Log.Write("Attaching to queue"); var attachTask = _client.attachTeamToQueue(mmp); _inQueue = true; } } }
public async Task <SearchingForMatchNotification> AttachToQueue(MatchMakerParams matchMakerParams) { int Id = Invoke("matchmakerService", "attachToQueue", new object[] { matchMakerParams.GetBaseTypedObject() }); while (!results.ContainsKey(Id)) { await Task.Delay(10); } TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); SearchingForMatchNotification result = new SearchingForMatchNotification(messageBody); results.Remove(Id); return(result); }
//public override async Task CreateLobby(int id) { // var service = new GameInvitationService(session); // var lobby = await service.CreateArrangedTeamLobby(id); // if (lobby == null) throw new Exception("???"); // OnLobbyStatus(lobby); //} public override async Task StartQueue() { var mmp = new MatchMakerParams { InvitationId = lastLobbyStatus.InvitationId, QueueIds = new List <int> { loop.QueueId }, Team = lastLobbyStatus.Members.Select(m => m.SummonerId).ToList() }; var search = await this.session.MatchmakingService.AttachToQueue(mmp); session.HandleMessage(search); OnSearchingForMatch(search); }
public async void AntiBuster(MatchMakerParams matchParams) { //Thx to mah niggah Everance //who made this possible if (QueueFlag) { Console.Out.WriteLine("Something wrong with smurf list"); connection.Disconnect(); } else { this.updateStatus("You are leaver busted.", Accountname); connection.Disconnect(); } }
public virtual async void StartQueue() { if (!IsCaptain) { return; } var mmp = new MatchMakerParams { InvitationId = lobbyStatus.InvitationID, QueueIds = new[] { QueueID }, Team = Members.Select(m => (int)m.SummonerID).ToList() }; var search = await RiotServices.MatchmakerService.AttachTeamToQueue(mmp); OnQueueEntered(search); }
public async Task AttachToQueue(dynamic args) { int[] numArray; long[] numArray1; numArray = (args.queueIds != (dynamic)null ? (int[])args.queueIds : new int[0]); int[] numArray2 = numArray; numArray1 = (args.summonerIds != (dynamic)null ? (long[])args.summonerIds : new long[0]); long[] numArray3 = numArray1; RiotAccount riotAccount = JsApiService.RiotAccount; MatchMakerParams matchMakerParam = new MatchMakerParams() { BotDifficulty = "MEDIUM", InvitationId = (string)args.inviteId, QueueIds = numArray2.ToList<int>(), Team = numArray3.ToList<long>() }; await riotAccount.InvokeAsync<SearchingForMatchNotification>("matchmakerService", "attachTeamToQueues", matchMakerParam); }
public async Task <SearchingForMatchNotification> AttachToLowPriorityQueue(MatchMakerParams matchMakerParams, string accessToken) { TypedObject to = new TypedObject(null); to.Add("LEAVER_BUSTER_ACCESS_TOKEN", accessToken); int Id = Invoke("matchmakerService", "attachToQueue", new object[] { matchMakerParams.GetBaseTypedObject(), to }); while (!results.ContainsKey(Id)) { await Task.Delay(10); } TypedObject messageBody = results[Id].GetTO("data").GetTO("body"); SearchingForMatchNotification result = new SearchingForMatchNotification(messageBody); results.Remove(Id); return(result); }
public async void AntiBuster(MatchMakerParams matchParams) { //Thx to mah niggah Everance //who made this possible if (QueueFlag) { Console.WriteLine( "Something went wrong, couldn't enter queue. Check accounts.txt for correct queue type."); connection.Disconnect(); Environment.Exit(0); } else { this.updateStatus("Sorry, you're leavebusted :/ use LuxBot instead.", Accountname); connection.Disconnect(); } }
public async Task <SearchingForMatchNotification> AttachToLowPriorityQueue(MatchMakerParams matchMakerParams, string accessToken) { TypedObject typedObject = new TypedObject(null); typedObject.Add("LEAVER_BUSTER_ACCESS_TOKEN", accessToken); int key = this.Invoke("matchmakerService", "attachToQueue", new object[] { matchMakerParams.GetBaseTypedObject(), typedObject }); while (!this.results.ContainsKey(key)) { await Task.Delay(10); } TypedObject tO = this.results[key].GetTO("data").GetTO("body"); SearchingForMatchNotification result = new SearchingForMatchNotification(tO); this.results.Remove(key); return(result); }
private async void QueueButton_Click(object sender, RoutedEventArgs e) { if (isInGame()) { return; } //to queue if (InQueue == false) { LastSender = (Button)sender; var config = (GameQueueConfig)LastSender.Tag; //Make TeamBuilder Work for solo if (config.Id != 61) { if (Queues.Contains(config.Id)) { return; } Queues.Add(config.Id); var parameters = new MatchMakerParams(); parameters.QueueIds = new[] { Convert.ToInt32(config.Id) }; Client.QueueId = config.Id; Client.PVPNet.AttachToQueue(parameters, EnteredQueue); } else if (config.Id == 61) { LobbyStatus Lobby = await Client.PVPNet.createArrangedTeamLobby(config.Id); Client.ClearPage(typeof(TeamBuilderPage)); Client.SwitchPage(new TeamBuilderPage(false, Lobby)); } } if (InQueue) { InQueue = false; Client.GameStatus = "outOfGame"; Client.SetChatHover(); await LeaveAllQueues(); } }
#pragma warning disable 4014 private async void StartGameButton_Click(object sender, RoutedEventArgs e) { if (!inQueue) { parameters = new MatchMakerParams(); parameters.Languages = null; QueueIds = new List <int>(); QueueIds.Add(queueId); parameters.QueueIds = (QueueIds.ToArray()); parameters.InvitationId = CurrentLobby.InvitationID; parameters.TeamId = null; parameters.LastMaestroMessage = null; var InviteList = new List <int>(); foreach (Member stats in CurrentLobby.Members) { int GameInvitePlayerList = Convert.ToInt32(stats.SummonerId); InviteList.Add(GameInvitePlayerList); } parameters.Team = InviteList; parameters.TeamId = selectedTeamId; parameters.BotDifficulty = botDifficulty; EnteredQueue(await RiotCalls.AttachTeamToQueue(parameters)); } else { RiotCalls.PurgeFromQueues(); setStartButtonText("Start Game"); inQueue = false; Client.GameStatus = "outOfGame"; Client.SetChatHover(); Dispatcher.Invoke(() => { Client.inQueueTimer.Visibility = Visibility.Hidden; TeamListView.Opacity = 1D; }); } }
private static async void RoomMessageHandler(object sender, object message) { //Our group already finished? if (System.IO.File.Exists("Logs/" + hostName + ".gfinished")) { System.Environment.Exit(0); } //Console.WriteLine(groupSplitted); try { if (((MessageReceivedEventArgs)message).Body is RtmpSharp.IO.AsObject) { if (!groupSplitted) { return; } //Convert object RtmpSharp.IO.AsObject asnObject = ((MessageReceivedEventArgs)message).Body as AsObject; if (asnObject.TypeName == "com.riotgames.platform.gameinvite.contract.InvitationRequest" && Client.botType == "BOT") { String InvitationState = asnObject["invitationState"] as String; if (InvitationState != "ACTIVE") { return; } String InvitationId = asnObject["invitationId"] as String; //Join them :)! try { Console.WriteLine("Accepting Invitation"); await RiotCalls.Accept(InvitationId); } catch (Exception e) { Console.WriteLine("INVITATION: " + e.Message); return; } return; } if (Client.botType == "HOST" || Client.botType == "HOST2") { RtmpSharp.IO.AsObject lobbyStatus = asnObject; //Check if 5 Invitations got sent RtmpSharp.IO.AMF3.ArrayCollection invitees = lobbyStatus["invitees"] as RtmpSharp.IO.AMF3.ArrayCollection; //if (invitees.Count != 5) //{ // await InvitePlayers(); //} //Check if 5 Players are in lobby RtmpSharp.IO.AMF3.ArrayCollection members = lobbyStatus["members"] as RtmpSharp.IO.AMF3.ArrayCollection; if (members.Count == 5) { //Wait and attach to queue Thread.Sleep(1500); MatchMakerParams matchParams = new MatchMakerParams(); matchParams.Languages = null; matchParams.BotDifficulty = "EASY"; matchParams.Team = new List <int>(); for (int i = 0; i < members.Count; ++i) { RtmpSharp.IO.AsObject memberObj = members[i] as RtmpSharp.IO.AsObject; //Console.WriteLine(memberObj["summonerId"]); matchParams.Team.Add(Convert.ToInt32(memberObj["summonerId"])); } matchParams.QueueIds = new int[] { 25 }; matchParams.InvitationId = lobbyStatus["invitationId"] as String; await RiotCalls.AttachTeamToQueue(matchParams); Console.WriteLine("Attached to Queue"); } } } else if (message.GetType() == typeof(GameDTO) || ((MessageReceivedEventArgs)message).Body.GetType() == typeof(GameDTO)) { GameDTO dto = null; try { if (message.GetType() == typeof(GameDTO)) { dto = message as GameDTO; } else { dto = ((MessageReceivedEventArgs)message).Body as GameDTO; } } catch (Exception e) { Console.WriteLine("Ignoring => Convert (object to GameDTO)"); return; } //Console.WriteLine(dto.GameState + ":" + groupSplitted); //Game Popup? if (dto.GameState == "JOINING_CHAMP_SELECT" && !acceptedGame) { try { await RiotCalls.AcceptPoppedGame(true); } catch (Exception e) { } acceptedGame = true; return; } //Host left room? follow him! //if (Client.botType == "BOT" && dto.GameState == "TEAM_SELECT") //{ // bool leaveRoom = false; // if (groupSplitted) // { // if (lvlGroupType == "ZERO") // { // if (dto.OwnerSummary.SummonerInternalName != hostName) // leaveRoom = true; // } // if (lvlGroupType == "ONE") // { // if (dto.OwnerSummary.SummonerInternalName != hostNameTwo) // leaveRoom = true; // } // } // else // { // if (dto.OwnerSummary.SummonerInternalName != hostName) // leaveRoom = true; // } // if (leaveRoom) // { // Console.WriteLine("Host left the game, follow him!"); // restart(); // } //} if (dto.GameState == "TEAM_SELECT" && !groupSplitted) { List <Participant> AllParticipants = new List <Participant>(dto.TeamOne.ToArray()); AllParticipants.AddRange(dto.TeamTwo); //Console.WriteLine("Player joined the game! " + AllParticipants.Count.ToString() + "/10"); gameState = "TEAM_SELECT"; if (Client.botType == "HOST") { int playerRoomCount = 10; if (AllParticipants.Count == playerRoomCount) // 10/5 Players joined? { Thread.Sleep(1500); await RiotCalls.StartChampionSelection(dto.Id, dto.OptimisticLock); Console.WriteLine("Room started!"); gameState = "CHAMP_SELECT"; } } } //Something failed if (dto.GameState.Contains("FAILED")) { Console.WriteLine("FATAL: " + dto.GameState); restart(); } //Roomstate changed if (dto.GameState == "TEAM_SELECT" && gameState == "CHAMP_SELECT") { gameState = "TEAM_SELECT"; Console.WriteLine("Unknown player left the room!"); //restart(); } //Selecting Champion etc. if (dto.GameState == "CHAMP_SELECT" || dto.GameState == "PRE_CHAMP_SELECT") { inInviteLobby = false; gameState = "CHAMP_SELECT"; if (!Client.selectedChampion) { Client.selectedChampion = true; gameState = "CHAMP_SELECT"; //Signal to the server we are in champion select try { await RiotCalls.SetClientReceivedGameMessage(dto.Id, "CHAMP_SELECT_CLIENT"); globalDto = dto; } catch (Exception e) { Console.WriteLine("Ignoring => " + e.Message); } try { await RiotCalls.ChampionSelectCompleted(); Console.WriteLine("Selected Champion and Locked"); //await RiotCalls.ChampionSelectCompleted(); //Console.WriteLine("[2]Selected Champion and Locked"); } catch (Exception e) { Console.WriteLine("Locking in error: " + e.Message); } } } //Game ended if (dto.GameState == "TERMINATED" || dto.GameState == "TERMINATED_IN_ERROR") { gameStarted = false; acceptedGame = false; gameState = "LOBBY"; AllSummonerData summonerData = null; summonerData = await RiotCalls.GetAllSummonerDataByAccount(Client.PlayerSession.AccountSummary.AccountId); lastSummonerData = summonerData; if (Client.botType == "HOST") { try { System.IO.File.Delete("Logs/Rooms/" + hostName + ".roomID"); } catch (Exception elol) { } } Console.WriteLine(DateTime.Now.ToString("HH:mm:ss tt") + " end"); Console.WriteLine("Level " + summonerData.SummonerLevel.Level.ToString() + " " + summonerData.SummonerLevelAndPoints.ExpPoints.ToString() + "/" + summonerData.SummonerLevel.ExpToNextLevel.ToString()); //Remove GAMEEND file try { System.IO.File.Delete("Logs/" + lastSummonerData.Summoner.SumId.ToString() + ".GAMEEND"); } catch (Exception) { } if (summonerData.SummonerLevel.Level == 3) { Console.WriteLine("Buying EXP Boost!"); BuyExpBoost(await RiotCalls.GetStoreUrl()); } if ((botLevelLimit == "LEVEL_5" && summonerData.SummonerLevel.Level >= 5) || (botLevelLimit == "LEVEL_10" && summonerData.SummonerLevel.Level >= 10) || (botLevelLimit == "LEVEL_30" && summonerData.SummonerLevel.Level >= 30)) { System.IO.File.WriteAllText(@"Logs/" + userName + ".finished", "1"); } dynamic infoFile = Config.Load("Logs/AccountInfo/" + userName + ".info"); infoFile.Info.Level = summonerData.SummonerLevel.Level; infoFile.Info.ExpBalance = summonerData.SummonerLevelAndPoints.ExpPoints.ToString() + "/" + summonerData.SummonerLevel.ExpToNextLevel.ToString(); infoFile.Save(); infoFile = null; //Wait 5 Seconds for observerThreads! //Thread.Sleep(5000); //Make sure observerThread gets terminated //try //{ // observerThread.Abort(); //} //catch (Exception) //{ } doRoomStuff(); //Start Loop again } } } catch (Exception e) { Console.WriteLine("FAK:" + e.Message); restart(); } }
public SearchingForMatchNotification attachToQueue(MatchMakerParams matchParams) { return((new InternalCallContext <SearchingForMatchNotification>(AttachToQueueInternal, new object[] { matchParams })).Execute()); }
private async void AttachToQueue() { 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) { this.updateStatus("In Queue: " + queueType.ToString(), Accountname); } 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; } } else if (failure.ReasonFailed == "LEAVER_BUSTER_TAINTED_WARNING") { //updateStatus("Please login on your LoL Client and type I Agree to the message that comes up.", Accountname); await connection.ackLeaverBusterWarning(); await connection.callPersistenceMessaging(new SimpleDialogMessageResponse() { AccountID = loginPacket.AllSummonerData.Summoner.SumId, MsgID = loginPacket.AllSummonerData.Summoner.SumId, Command = "ack" }); connection_OnMessageReceived(null, (object)new EndOfGameStats()); } } if (String.IsNullOrEmpty(m_accessToken)) { // Queue dodger or something else } else { updateStatus("Waiting out leaver buster: " + m_leaverBustedPenalty / 1000 / (float)60 + " minutes!", Accountname); System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(m_leaverBustedPenalty)); m = await connection.AttachToLowPriorityQueue(matchParams, m_accessToken); if (m.PlayerJoinFailures == null) { this.updateStatus("Succesfully joined lower priority queue!", Accountname); } else { this.updateStatus("There was an error in joining lower priority queue.\nDisconnecting.", Accountname); connection.Disconnect(); parent.lognNewAccount(); } } } }
public Task <SearchingForMatchNotification> AttachTeamToQueue(MatchMakerParams matchMakerParams, AsObject token) { return(this.InvokeAsync <SearchingForMatchNotification>("matchmakerService", "attachTeamToQueue", (object)matchMakerParams, (object)token)); }
/// 37.) public void AttachToQueue(MatchMakerParams matchMakerParams, SearchingForMatchNotification.Callback callback) { SearchingForMatchNotification cb = new SearchingForMatchNotification(callback); InvokeWithCallback("matchmakerService", "attachToQueue", new object[] { matchMakerParams.GetBaseTypedObject() }, cb); }
private async void AttachToQueue() { MatchMakerParams matchMakerParams = new MatchMakerParams(); if (this.queueType == QueueTypes.INTRO_BOT) { matchMakerParams.BotDifficulty = "INTRO"; } else if (this.queueType == QueueTypes.BEGINNER_BOT) { matchMakerParams.BotDifficulty = "EASY"; } else if (this.queueType == QueueTypes.MEDIUM_BOT) { matchMakerParams.BotDifficulty = "MEDIUM"; } if (this.sumLevel == 3.0 && this.actualQueueType == QueueTypes.NORMAL_5x5) { this.queueType = this.actualQueueType; } else if (this.sumLevel == 6.0 && this.actualQueueType == QueueTypes.ARAM) { this.queueType = this.actualQueueType; } else if (this.sumLevel == 7.0 && this.actualQueueType == QueueTypes.NORMAL_3x3) { this.queueType = this.actualQueueType; } matchMakerParams.QueueIds = new int[] { (int)this.queueType }; SearchingForMatchNotification searchingForMatchNotification = await this.connection.AttachToQueue(matchMakerParams); if (searchingForMatchNotification.PlayerJoinFailures == null) { this.updateStatus("In Queue: " + this.queueType.ToString(), this.Accountname); } else { foreach (QueueDodger current in searchingForMatchNotification.PlayerJoinFailures) { if (current.ReasonFailed == "LEAVER_BUSTED") { this.m_accessToken = current.AccessToken; if (current.LeaverPenaltyMillisRemaining > this.m_leaverBustedPenalty) { this.m_leaverBustedPenalty = current.LeaverPenaltyMillisRemaining; } } else if (current.ReasonFailed == "LEAVER_BUSTER_TAINTED_WARNING") { await this.connection.ackLeaverBusterWarning(); await this.connection.callPersistenceMessaging(new SimpleDialogMessageResponse { AccountID = this.loginPacket.AllSummonerData.Summoner.SumId, MsgID = this.loginPacket.AllSummonerData.Summoner.SumId, Command = "ack" }); this.connection_OnMessageReceived(null, new EndOfGameStats()); } } if (!string.IsNullOrEmpty(this.m_accessToken)) { this.updateStatus("Waiting out leaver buster: " + (float)(this.m_leaverBustedPenalty / 1000) / 60f + " minutes!", this.Accountname); Thread.Sleep(TimeSpan.FromMilliseconds((double)this.m_leaverBustedPenalty)); searchingForMatchNotification = await this.connection.AttachToLowPriorityQueue(matchMakerParams, this.m_accessToken); if (searchingForMatchNotification.PlayerJoinFailures == null) { this.updateStatus("Succesfully joined lower priority queue!", this.Accountname); } else { this.updateStatus("There was an error in joining lower priority queue.\nDisconnecting.", this.Accountname); this.connection.Disconnect(); this.parent.lognNewAccount(); } } } }
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(); } } } } }
/// <summary> /// Attaches a premade team to a queue /// </summary> /// <param name="MatchMakerParams">The parameters for the queue</param> /// <returns>Returns a notification to tell you if it was successful</returns> public static Task <SearchingForMatchNotification> AttachTeamToQueue(MatchMakerParams matchMakerParams) { return(InvokeAsync <SearchingForMatchNotification>("matchmakerService", "attachTeamToQueue", matchMakerParams)); }
private async void EnterQueue() { MatchMakerParams matchParams = new MatchMakerParams(); //Set BotParams if (queueType == QueueTypes.BOT_INTO) { matchParams.BotDifficulty = "INTRO"; } else if (queueType == QueueTypes.BOT_BEGINNER) { matchParams.BotDifficulty = "EASY"; } else if (queueType == QueueTypes.BOT_MEDIUM) { matchParams.BotDifficulty = "MEDIUM"; } else if (queueType == QueueTypes.BOT_3x3) //TT Map { matchParams.BotDifficulty = "EASY"; } //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; } else if (sumLevel == 10 && actualQueueType == QueueTypes.TT_HEXAKILL) { queueType = actualQueueType; } matchParams.QueueIds = new Int32[1] { (int)queueType }; SearchingForMatchNotification m = await connection.AttachToQueue(matchParams); if (m.PlayerJoinFailures == null) { Tools.ConsoleMessage("In Queue: " + queueType.ToString() + " as " + loginPacket.AllSummonerData.Summoner.Name + ".", ConsoleColor.Cyan); } 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; } } else if (failure.ReasonFailed == "LEAVER_BUSTER_TAINTED_WARNING") { await connection.ackLeaverBusterWarning(); await connection.callPersistenceMessaging(new SimpleDialogMessageResponse() { AccountID = loginPacket.AllSummonerData.Summoner.SumId, MsgID = loginPacket.AllSummonerData.Summoner.SumId, Command = "ack" }); connection_OnMessageReceived(null, (object)new EndOfGameStats()); } } if (String.IsNullOrEmpty(m_accessToken)) { // Queue dodger or something else } else { Tools.ConsoleMessage("Waiting leaver buster time: " + m_leaverBustedPenalty / 1000 / (float)60 + " minutes!", ConsoleColor.White); System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(m_leaverBustedPenalty)); m = await connection.AttachToLowPriorityQueue(matchParams, m_accessToken); if (m.PlayerJoinFailures == null) { Tools.ConsoleMessage("Joined lower priority queue! as " + loginPacket.AllSummonerData.Summoner.Name + ".", ConsoleColor.Cyan); } else { Tools.ConsoleMessage("There was an error in joining lower priority queue.\nDisconnecting.", ConsoleColor.White); connection.Disconnect(); } } } }
public async void connection_OnMessageReceived(object sender, object message) { if (message is GameDTO) { GameDTO game = message as GameDTO; switch (game.GameState) { case "CHAMP_SELECT": if (this.firstTimeInLobby) { QueueFlag = true; firstTimeInLobby = false; updateStatus("In Champion Select", Accountname); object obj = await connection.SetClientReceivedGameMessage(game.Id, "CHAMP_SELECT_CLIENT"); if (queueType != QueueTypes.ARAM) { if (Program.championId != "" && Program.championId != "RANDOM") { int Spell1; int Spell2; if (!Program.rndSpell) { Spell1 = Enums.spellToId(Program.spell1); Spell2 = Enums.spellToId(Program.spell2); } else { var random = new Random(); var spellList = new List <int> { 13, 6, 7, 10, 1, 11, 21, 12, 3, 14, 2, 4 }; int index = random.Next(spellList.Count); int index2 = random.Next(spellList.Count); int randomSpell1 = spellList[index]; int randomSpell2 = spellList[index2]; if (randomSpell1 == randomSpell2) { int index3 = random.Next(spellList.Count); randomSpell2 = spellList[index3]; } Spell1 = Convert.ToInt32(randomSpell1); Spell2 = Convert.ToInt32(randomSpell2); } await connection.SelectSpells(Spell1, Spell2); await connection.SelectChampion(Enums.championToId(Program.championId)); await connection.ChampionSelectCompleted(); } else if (Program.championId == "RANDOM") { int Spell1; int Spell2; if (!Program.rndSpell) { Spell1 = Enums.spellToId(Program.spell1); Spell2 = Enums.spellToId(Program.spell2); } else { var random = new Random(); var spellList = new List <int> { 13, 6, 7, 10, 1, 11, 21, 12, 3, 14, 2, 4 }; int index = random.Next(spellList.Count); int index2 = random.Next(spellList.Count); int randomSpell1 = spellList[index]; int randomSpell2 = spellList[index2]; if (randomSpell1 == randomSpell2) { int index3 = random.Next(spellList.Count); randomSpell2 = spellList[index3]; } Spell1 = Convert.ToInt32(randomSpell1); Spell2 = Convert.ToInt32(randomSpell2); } await connection.SelectSpells(Spell1, Spell2); var randAvailableChampsArray = availableChampsArray.Shuffle(); await connection.SelectChampion(randAvailableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId); await connection.ChampionSelectCompleted(); } else { int Spell1; int Spell2; if (!Program.rndSpell) { Spell1 = Enums.spellToId(Program.spell1); Spell2 = Enums.spellToId(Program.spell2); } else { var random = new Random(); var spellList = new List <int> { 13, 6, 7, 10, 1, 11, 21, 12, 3, 14, 2, 4 }; int index = random.Next(spellList.Count); int index2 = random.Next(spellList.Count); int randomSpell1 = spellList[index]; int randomSpell2 = spellList[index2]; if (randomSpell1 == randomSpell2) { int index3 = random.Next(spellList.Count); randomSpell2 = spellList[index3]; } Spell1 = Convert.ToInt32(randomSpell1); Spell2 = Convert.ToInt32(randomSpell2); } await connection.SelectSpells(Spell1, Spell2); await connection.SelectChampion(availableChampsArray.First(champ => champ.Owned || champ.FreeToPlay).ChampionId); await connection.ChampionSelectCompleted(); } } break; } else { break; } case "POST_CHAMP_SELECT": firstTimeInLobby = false; this.updateStatus("(Post Champ Select)", Accountname); break; case "PRE_CHAMP_SELECT": this.updateStatus("(Pre Champ Select)", Accountname); break; case "GAME_START_CLIENT": this.updateStatus("Game client ran", Accountname); break; case "GameClientConnectedToServer": this.updateStatus("Client connected to the server", Accountname); break; case "IN_QUEUE": this.updateStatus("In Queue", Accountname); QueueFlag = true; break; case "TERMINATED": this.updateStatus("Re-entering queue", Accountname); this.firstTimeInQueuePop = true; break; case "JOINING_CHAMP_SELECT": if (this.firstTimeInQueuePop && game.StatusOfParticipants.Contains("1")) { this.updateStatus("Accepted Queue", Accountname); this.firstTimeInQueuePop = false; this.firstTimeInLobby = true; object obj = await this.connection.AcceptPoppedGame(true); break; } else { break; } case "LEAVER_BUSTED": this.updateStatus("Leave busted", Accountname); break; } } else if (message is PlayerCredentialsDto) { string str = Enumerable.Last <string>((IEnumerable <string>)Enumerable.OrderBy <string, DateTime>(Directory.EnumerateDirectories((this.ipath ?? "") + "RADS\\solutions\\lol_game_client_sln\\releases\\"), (Func <string, DateTime>)(f => new DirectoryInfo(f).CreationTime))) + "\\deploy\\"; LoLLauncher.RiotObjects.Platform.Game.PlayerCredentialsDto credentials = message as PlayerCredentialsDto; System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.CreateNoWindow = false; startInfo.WorkingDirectory = str; startInfo.FileName = "League of Legends.exe"; startInfo.Arguments = "\"8394\" \"LoLLauncher.exe\" \"\" \"" + credentials.ServerIp + " " + credentials.ServerPort + " " + credentials.EncryptionKey + " " + credentials.SummonerId + "\""; updateStatus("Launching League of Legends", Accountname); new Thread((ThreadStart)(() => { exeProcess = Process.Start(startInfo); exeProcess.Exited += exeProcess_Exited; while (exeProcess.MainWindowHandle == IntPtr.Zero) { ; } exeProcess.PriorityClass = ProcessPriorityClass.Idle; exeProcess.EnableRaisingEvents = true; })).Start(); } else if (!(message is GameNotification) && !(message is SearchingForMatchNotification)) { if (message is EndOfGameStats) { EndOfGameStats msg = message as EndOfGameStats; LoLLauncher.RiotObjects.Platform.Matchmaking.MatchMakerParams matchParams = new LoLLauncher.RiotObjects.Platform.Matchmaking.MatchMakerParams(); if (queueType == QueueTypes.INTRO_BOT) { matchParams.BotDifficulty = "INTRO"; } else if (queueType == QueueTypes.BEGINNER_BOT) { matchParams.BotDifficulty = "EASY"; } else if (queueType == QueueTypes.MEDIUM_BOT) { matchParams.BotDifficulty = "MEDIUM"; } 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 }; LoLLauncher.RiotObjects.Platform.Matchmaking.SearchingForMatchNotification m = await connection.AttachToQueue(matchParams); if (m.PlayerJoinFailures == null) { this.updateStatus("In Queue: " + queueType.ToString(), Accountname); } else { try { updateStatus( "Couldn't enter Q - " + m.PlayerJoinFailures.Summoner.Name + " : " + m.PlayerJoinFailures.ReasonFailed, Accountname); } catch (Exception) { mMParams = matchParams; AntiBuster(mMParams); } } } else { if (message.ToString().Contains("EndOfGameStats")) { EndOfGameStats eog = new EndOfGameStats(); connection_OnMessageReceived(sender, eog); exeProcess.Exited -= exeProcess_Exited; exeProcess.Kill(); Thread.Sleep(500); if (exeProcess.Responding) { Process.Start("taskkill /F /IM \"League of Legends.exe\""); } loginPacket = await this.connection.GetLoginDataPacketForUser(); archiveSumLevel = sumLevel; sumLevel = loginPacket.AllSummonerData.SummonerLevel.Level; if (sumLevel != archiveSumLevel) { levelUp(); } } } } }
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); } } } }
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(); }
private async void QueueButton_Click(object sender, RoutedEventArgs e) { if (IsInGame()) { return; } //to queue bool Join = InQueue; LastSender = (Button)sender; if (InQueue == false) { var settings = (QueueButtonConfig)LastSender.Tag; var config = (GameQueueConfig)settings.GameQueueConfig; //Make TeamBuilder Work for solo if (config.TypeString.Contains("BOT")) { if (Queues.Contains(config.Id)) { return; } Queues.Add(config.Id); var parameters = new MatchMakerParams { QueueIds = new[] { Convert.ToInt32(config.Id) }, BotDifficulty = settings.BotLevel }; Client.QueueId = config.Id; param = parameters; EnteredQueue(await RiotCalls.AttachToQueue(parameters)); } else if (config.Id != 61) { if (Queues.Contains(config.Id)) { return; } Queues.Add(config.Id); var parameters = new MatchMakerParams { QueueIds = new[] { Convert.ToInt32(config.Id) } }; Client.QueueId = config.Id; param = parameters; EnteredQueue(await RiotCalls.AttachToQueue(parameters)); } else if (config.Id == 61) { LobbyStatus lobby = await RiotCalls.CreateArrangedTeamLobby(config.Id); Client.ClearPage(typeof(TeamBuilderPage)); Client.SwitchPage(new TeamBuilderPage(false, lobby)); } } if (!Join) { return; } if (t.Enabled) { t.Stop(); t.Close(); } await Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => LastSender.Content = "Queue (Beta)")); InQueue = false; Client.GameStatus = "outOfGame"; Client.SetChatHover(); await LeaveAllQueues(); }
/// <summary> /// Attaches to a queue /// </summary> /// <param name="matchMakerParams">The parameters for the queue</param> /// <returns>Returns a notification to tell you if it was successful</returns> public Task <SearchingForMatchNotification> AttachToQueue(MatchMakerParams matchMakerParams) { return(InvokeAsync <SearchingForMatchNotification>("attachToQueue", matchMakerParams)); }