public static SearchMatchResult SearchMatch() { using (var request = CreateRequest()) { string response = request.Post(SearchURL).ToString(); if (response == string.Empty) { return(SearchMatchResult.Ok); } else { SearchMatchResult result = SearchMatchResult.Unknown; dynamic obj = JsonConvert.DeserializeObject(response); string message = obj.message; switch (message) { case "GATEKEEPER_RESTRICTED": result = SearchMatchResult.GatekeeperRestricted; break; case "QUEUE_NOT_ENABLED": result = SearchMatchResult.QueueNotEnabled; break; case "INVALID_LOBBY": result = SearchMatchResult.InvalidLobby; break; default: Logger.Write("Unknown search match result : " + obj.message, MessageState.WARNING); break; } return(result); } } }
private void ProcessMatch() { bot.log("Searching match..."); bot.wait(3000); SearchMatchResult result = client.searchMatch(); while (result != SearchMatchResult.Ok) { switch (result) { case SearchMatchResult.GatekeeperRestricted: bot.warn("Cannot search match. Queue dodge timer. Retrying in 20 seconds."); bot.wait(1000 * 20); break; case SearchMatchResult.QueueNotEnabled: client.createLobby(QueueType); bot.warn("Cannot search match. Creating lobby..."); bot.wait(1000 * 10); break; case SearchMatchResult.InvalidLobby: bot.warn("Cannot search match. Client not ready. Retrying in 10 seconds."); bot.wait(1000 * 10); break; } result = client.searchMatch(); } bool isMatchFound = false; while (!isMatchFound) { isMatchFound = client.isMatchFound(); bot.wait(1000); } while (client.getGameflowPhase() != GameflowPhaseEnum.ChampSelect) { client.acceptMatch(); bot.wait(1000); } bot.log("Match found."); //bot.wait(30000); //client.Ban(); GameflowPhaseEnum currentPhase = client.getGameflowPhase(); int i = 0; int mslimit = 40; while (currentPhase != GameflowPhaseEnum.InProgress && i < mslimit) { if (currentPhase != GameflowPhaseEnum.ChampSelect) { bot.log("Game was dodged, finding match...."); ProcessMatch(); return; } bot.wait(100); client.LockIn(); bot.wait(100); currentPhase = client.getGameflowPhase(); i++; } bot.log("Matchmaking finished"); bot.wait(2000); bot.executePattern("GameOn"); bot.wait(2000); bot.log("\n"); bot.wait(2000); bot.log("\n"); bot.wait(2000); bot.log("\n"); bot.wait(2000); bot.log("\n"); }
private void ProcessMatch() { bot.log("Searching match..."); bot.wait(3000); SearchMatchResult result = client.searchMatch(); while (result != SearchMatchResult.Ok) { switch (result) { case SearchMatchResult.GatekeeperRestricted: bot.warn("Cannot search match. Queue dodge timer. Retrying in 20 seconds."); bot.wait(1000 * 20); break; case SearchMatchResult.QueueNotEnabled: client.createLobby(QueueType); bot.warn("Cannot search match. Creating lobby..."); bot.wait(1000 * 10); break; case SearchMatchResult.InvalidLobby: bot.warn("Cannot search match. Client not ready. Retrying in 10 seconds."); bot.wait(1000 * 10); break; } result = client.searchMatch(); } bool isMatchFound = false; while (!isMatchFound) { isMatchFound = client.isMatchFound(); bot.wait(1000); } while (client.getGameflowPhase() != GameflowPhaseEnum.ChampSelect) { client.acceptMatch(); bot.wait(1000); } bot.log("Match founded."); bot.wait(1500); // bool picked = false; int championIndex = 0; while (!picked) { if (championIndex > Champions.Length - 1) { bot.warn("Unable to continue. No more champions to pick"); return; } ChampionPickResult pickResult = client.pickChampion(Champions[championIndex]); switch (pickResult) { case ChampionPickResult.Ok: bot.log(Champions[championIndex] + " picked successfully"); picked = true; break; case ChampionPickResult.ChampionNotOwned: bot.warn("Error the request champion is not owned."); break; case ChampionPickResult.ChampionPicked: bot.warn("Someone already pick your champion"); break; default: break; } championIndex++; bot.wait(1000); } bot.log("Waiting...."); GameflowPhaseEnum currentPhase = client.getGameflowPhase(); while (currentPhase != GameflowPhaseEnum.InProgress) { if (currentPhase != GameflowPhaseEnum.ChampSelect) { bot.log("Game was dodged, finding match...."); ProcessMatch(); return; } bot.wait(1000); currentPhase = client.getGameflowPhase(); } bot.executePattern("Coop"); }
public override void Execute() { bot.log("Waiting for league client process..."); bot.waitProcessOpen(CLIENT_PROCESS_NAME); bot.initialize(); bot.centerProcess(CLIENT_PROCESS_NAME); while (!client.loadSummoner()) { bot.warn("Unable to load summoner. Retrying in 10 seconds."); bot.wait(1000); } bot.log("Summoner loaded " + client.summoner.displayName); client.createLobby(QueueType); bot.log("Searching match..."); SearchMatchResult result = client.searchMatch(); while (result != SearchMatchResult.Ok) { switch (result) { case SearchMatchResult.GatekeeperRestricted: bot.warn("Cannot search match. Queue dodge timer. Retrying in 10 seconds."); break; case SearchMatchResult.QueueNotEnabled: client.createLobby(QueueType); bot.warn("Cannot search match. Creating lobby..."); break; case SearchMatchResult.InvalidLobby: bot.warn("Cannot search match. Client not ready. Retrying in 10 seconds."); break; } bot.wait(1000 * 10); result = client.searchMatch(); } bool isMatchFound = false; while (!isMatchFound) { isMatchFound = client.isMatchFound(); bot.wait(1000); } while (!client.isInChampSelect()) { client.acceptMatch(); bot.wait(1000); } bot.log("Match founded."); bot.wait(5000); bool picked = false; int championIndex = 0; while (!picked) { if (championIndex > Champions.Length - 1) { bot.warn("Unable to continue. No more champions to pick"); return; } ChampionPickResult pickResult = client.pickChampion(Champions[championIndex]); switch (pickResult) { case ChampionPickResult.Ok: bot.log(Champions[championIndex] + "picked successfully."); picked = true; break; case ChampionPickResult.ChampionNotOwned: bot.log("Error the request champion is not owned."); break; case ChampionPickResult.ChampionPicked: bot.log("Someone already pick your champ!"); break; default: break; } championIndex++; bot.wait(1000); } bot.executePattern("Coop"); }