public async Task <Summoner> GetSummoner() { if (League == null) { League = await LeagueClient.Connect(); } try { var region = await League.MakeApiRequest(HttpMethod.Get, "/riotclient/get_region_locale"); var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result); Summoners sum = new Summoners(League); var player = await sum.GetCurrentSummoner(); if (player == null || player.SummonerId == null) { return(null); } Summoner user = new Summoner(); user.SummonerID = player.SummonerId.ToString(); user.SummonerName = player.DisplayName; user.Region = (Regions)Enum.Parse(typeof(Regions), locals.RegionRegion); return(user); } catch { return(null); } }
public async void JoinGame(long enemy, string match) { ILeagueClient league = await LeagueClient.Connect(); while (true) { var response = await league.MakeApiRequest(HttpMethod.Get, "/lol-lobby/v2/received-invitations"); var invites = JsonConvert.DeserializeObject <List <InviteModel> >(await response.Content.ReadAsStringAsync()); foreach (var item in invites) { if (item.FromSummonerId == enemy) { await league.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/received-invitations/" + item.InvitationId + "/accept"); System.Net.Http.HttpClient http = new System.Net.Http.HttpClient(); var data = await http.GetAsync("http://matchmakingapi.azurewebsites.net/oneVone/KillMatch?match=" + match); break; } } Thread.Sleep(100); } }
public FplChangeLeagueIdHandler(ISlackTeamRepository slackTeamRepository, ILeagueClient leagueClient, ISlackWorkSpacePublisher publisher, ILogger <FplChangeLeagueIdHandler> logger) { _slackTeamRepository = slackTeamRepository; _leagueClient = leagueClient; _publisher = publisher; _logger = logger; }
public Edit(ISlackTeamRepository teamRepo, ILeagueClient leagueClient, ITokenStore tokenStore, ISlackClientBuilder builder) { _teamRepo = teamRepo; _leagueClient = leagueClient; _tokenStore = tokenStore; _builder = builder; }
public FplStandingsCommandHandler(IOptions <FplbotOptions> options, IEnumerable <IPublisherBuilder> publishers, IGameweekClient gameweekClient, ILeagueClient leagueClient) { _options = options; _publishers = publishers; _gameweekClient = gameweekClient; _leagueClient = leagueClient; }
public CaptainsByGameWeek(IGlobalSettingsClient globalSettingsClient, ILeagueClient leagueClient, IEntryForGameweek entryForGameweek, ILogger <CaptainsByGameWeek> logger) { _globalSettingsClient = globalSettingsClient; _leagueClient = leagueClient; _entryForGameweek = entryForGameweek; _logger = logger; }
public async Task <Tuple <bool, int> > WatchMatch(Match match) { if (lc == null) { lc = await LeagueClient.Connect(); } RedChamp = ""; BlueChamp = ""; IsInGame = true; var summoner = await lc.GetSummonersModule().GetCurrentSummoner(); var dodged = await CheckForDodge(); bool result; if (dodged.Item1) { result = dodged.Item2; } else { result = await MatchParser(match, summoner); } var elo = await SaveMatchResult(result, match, summoner); return(new Tuple <bool, int>(result, elo)); }
public async Task JoinGame(string enemyId, string match) { bool matchAccepted = false; if (League == null) { League = await LeagueClient.Connect(); } while (!matchAccepted) { var response = await League.MakeApiRequest(HttpMethod.Get, "/lol-lobby/v2/received-invitations"); var invites = JsonConvert.DeserializeObject <List <InviteModel> >(await response.Content.ReadAsStringAsync()); foreach (var item in invites) { if (item.FromSummonerId == enemyId && item.State == "Pending") { await League.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/received-invitations/" + item.InvitationId + "/accept"); System.Net.Http.HttpClient http = new System.Net.Http.HttpClient(); matchAccepted = true; } } await Task.Delay(100); } }
public static ILoL CreateNew(ILeagueClient client) { KernelBase kernel = new StandardKernel(); BindNinject(kernel, client); return(kernel.Get <ILoL>()); }
public HelpEventHandler(IEnumerable <IHandleAppMentions> allHandlers, ISlackClientBuilder slackClientService, ISlackTeamRepository tokenStore, ILogger <HelpEventHandler> logger, ILeagueClient leagueClient) { _handlers = allHandlers; _slackClientService = slackClientService; _tokenStore = tokenStore; _logger = logger; _leagueClient = leagueClient; }
public GameweekStartedHandler(IGuildRepository repo, ILeagueClient leagueClient, ICaptainsByGameWeek captainsByGameweek, ITransfersByGameWeek transfersByGameweek, ILogger <GameweekStartedHandler> logger) { _repo = repo; _leagueClient = leagueClient; _logger = logger; _captainsByGameweek = captainsByGameweek; _transfersByGameweek = transfersByGameweek; }
public TeamDetailsIndex(ISlackTeamRepository teamRepo, ILogger <TeamDetailsIndex> logger, IOptions <OAuthOptions> slackAppOptions, ISlackClientBuilder builder, ILeagueClient leagueClient) { _teamRepo = teamRepo; _logger = logger; _slackAppOptions = slackAppOptions; _builder = builder; _leagueClient = leagueClient; }
public CaptainsByGameWeek(IOptions <FplbotOptions> options, IEntryClient entryClient, IPlayerClient playerClient, ILeagueClient leagueClient, IChipsPlayed chipsPlayed) { _options = options; _entryClient = entryClient; _playerClient = playerClient; _leagueClient = leagueClient; _chipsPlayed = chipsPlayed; }
public GameweekFinishedHandler(ISlackWorkSpacePublisher publisher, ISlackTeamRepository teamsRepo, ILeagueClient leagueClient, IGlobalSettingsClient settingsClient) { _publisher = publisher; _teamRepo = teamsRepo; _leagueClient = leagueClient; _settingsClient = settingsClient; }
public GameweekFinishedHandler(IGuildRepository repo, ILogger <GameweekFinishedHandler> logger, IGlobalSettingsClient settingsClient, ILeagueClient leagueClient) { _repo = repo; _logger = logger; _settingsClient = settingsClient; _leagueClient = leagueClient; }
public OAuthController(ILogger <OAuthController> logger, ISlackOAuthAccessClient oAuthAccessClient, ISlackTeamRepository slackTeamRepository, ILeagueClient leagueClient, IOptions <OAuthOptions> options, IMessageSession messageSession, IWebHostEnvironment env) { _logger = logger; _oAuthAccessClient = oAuthAccessClient; _slackTeamRepository = slackTeamRepository; _leagueClient = leagueClient; _options = options; _messageSession = messageSession; _env = env; }
public EntryIndexProvider( ILeagueClient leagueClient, IEntryClient entryClient, IVerifiedEntriesRepository verifiedEntriesRepository, ILogger <IndexProviderBase> logger, IOptions <SearchOptions> options) : base(leagueClient, logger) { _entryClient = entryClient; _verifiedEntriesRepository = verifiedEntriesRepository; _options = options.Value; }
public LeagueIndexProvider( ILeagueClient leagueClient, IEntryClient entryClient, IIndexBookmarkProvider indexBookmarkProvider, ILogger <IndexProviderBase> logger, IOptions <SearchOptions> options) : base(leagueClient, logger) { _entryClient = entryClient; _indexBookmarkProvider = indexBookmarkProvider; _logger = logger; _options = options.Value; }
public FplBotJoinedChannelHandler(ILogger <FplBotJoinedChannelHandler> logger, ISlackWorkSpacePublisher publisher, ISlackClientBuilder slackClientService, ISlackTeamRepository teamRepo, ILeagueClient leagueClient ) { _logger = logger; _publisher = publisher; _slackClientService = slackClientService; _teamRepo = teamRepo; _leagueClient = leagueClient; }
public TransfersByGameWeek( ILeagueClient leagueClient, IGlobalSettingsClient globalSettingsClient, ITransfersClient transfersClient, IEntryClient entryClient, ILogger <TransfersByGameWeek> logger) { _leagueClient = leagueClient; _globalSettingsClient = globalSettingsClient; _transfersClient = transfersClient; _entryClient = entryClient; _logger = logger; }
public GameweekEndedHandler(ISlackWorkSpacePublisher publisher, ISlackTeamRepository teamsRepo, ILeagueClient leagueClient, IGlobalSettingsClient gameweekClient, ILogger <GameweekEndedHandler> logger, IMediator mediator) { _publisher = publisher; _teamRepo = teamsRepo; _leagueClient = leagueClient; _gameweekClient = gameweekClient; _logger = logger; _mediator = mediator; }
public TransfersByGameWeek( IOptions <FplbotOptions> fplbotOptions, ILeagueClient leagueClient, IPlayerClient playerClient, ITransfersClient transfersClient, IEntryClient entryClient ) { _fplbotOptions = fplbotOptions.Value; _leagueClient = leagueClient; _playerClient = playerClient; _transfersClient = transfersClient; _entryClient = entryClient; }
public GameweekStartedHandler(ICaptainsByGameWeek captainsByGameweek, ITransfersByGameWeek transfersByGameweek, ISlackWorkSpacePublisher publisher, ISlackTeamRepository teamsRepo, ILeagueClient leagueClient, ILogger <GameweekStartedHandler> logger) { _captainsByGameweek = captainsByGameweek; _transfersByGameweek = transfersByGameweek; _publisher = publisher; _teamRepo = teamsRepo; _logger = logger; _leagueClient = leagueClient; }
public FplBotJoinedChannelHandler(ILogger <FplBotJoinedChannelHandler> logger, ISlackWorkSpacePublisher publisher, ISlackClientBuilder slackClientService, ISlackTeamRepository teamRepo, ILeagueClient leagueClient, IConfiguration configuration) { _logger = logger; _publisher = publisher; _slackClientService = slackClientService; _teamRepo = teamRepo; _leagueClient = leagueClient; _slackAppId = configuration["SlackAppId"]; }
public OverlayWindow(ILoL lol, ILeagueClient client, ITeamGuesser guesser) { this.LoL = lol; this.Client = client; this.Guesser = guesser; InitializeComponent(); this.DataContext = this; LockTimer = new Timer(1000); LockTimer.Elapsed += this.LockTimer_Elapsed; LockTimer.Start(); //client.Init(); }
public async Task CreateOneOnOneGame(string LobbyName, string enemyId) { if (League == null) { League = await LeagueClient.Connect(); } ApiObject api = new ApiObject(); var obj = api.createCustomGameOneOnOne(LobbyName); var response = await League.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby", obj); while (true) { if (response.StatusCode != System.Net.HttpStatusCode.OK) { obj = api.createCustomGameOneOnOne(LobbyName); response = League.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby", obj).Result; } else { break; } } var invites = new List <LobbyInvitation>(); invites.Add(new LobbyInvitation { ToSummonerId = enemyId }); await League.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v2/lobby/invitations", invites); bool AllIn = false; while (!AllIn) { LobbyPlayerInfo[] players = await League.MakeApiRequestAs <LobbyPlayerInfo[]>(HttpMethod.Get, "/lol-lobby/v2/lobby/members"); foreach (var item in players) { if (item.SummonerId == enemyId) { AllIn = true; } } } await League.MakeApiRequest(HttpMethod.Post, "/lol-lobby/v1/lobby/custom/start-champ-select", new StartGame()); }
public FplSearchHandler( ISearchService searchService, IGlobalSettingsClient globalSettingsClient, ISlackWorkSpacePublisher workSpacePublisher, ISlackTeamRepository slackTeamRepo, ILeagueClient leagueClient, IEntryClient entryClient, ILogger <FplSearchHandler> logger) { _searchService = searchService; _globalSettingsClient = globalSettingsClient; _workSpacePublisher = workSpacePublisher; _slackTeamRepo = slackTeamRepo; _leagueClient = leagueClient; _entryClient = entryClient; _logger = logger; }
public async Task <bool> CheckIfLeagueIsOpen() { try { League = await LeagueClient.Connect(); if (League != null) { League.LeagueClosed += () => CheckIfLeagueOpens.Invoke(); } } catch (Exception e) { return(false); } return(true); }
public static void BindNinject(IKernel kernel, ILeagueClient client) { kernel.Bind <ILoL>().To <LoL>(); kernel.Bind <IPluginManager>().To <PluginManager>(); kernel.Bind <IRiotClient>().To <RiotClient>(); kernel.Bind <IProcessControl>().To <ProcessControl>(); kernel.Bind <ILeagueClient>().ToConstant(client); kernel.Bind <IChampions>().To <Champions>(); kernel.Bind <IChampSelect>().To <ChampSelect>(); kernel.Bind <IChat>().To <Chat>(); kernel.Bind <IGameQueues>().To <GameQueues>(); kernel.Bind <IItemsSets>().To <ItemSets>(); kernel.Bind <ILobby>().To <Lobby>(); kernel.Bind <ILogin>().To <Login>(); kernel.Bind <IMaps>().To <Maps>(); kernel.Bind <IMatchmaking>().To <Matchmaking>(); kernel.Bind <IPerks>().To <Perks>(); kernel.Bind <ISummoner>().To <Summoner>(); }
public async Task <IActionResult> Index() { League = await LeagueClient.Connect(); var region = await League.MakeApiRequest(LCUSharp.HttpMethod.Get, "/riotclient/region-locale"); var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result); Summoners sum = new Summoners(League); var player = sum.GetCurrentSummoner(); Summoner user = new Summoner(); user.SummonerID = player.SummonerId.ToString(); user.SummonerName = player.DisplayName; user.Region = locals.RegionRegion; user.Role = "Test"; return(View(user)); }