public async Task EventExampleAsync() { LCUApi = await LeagueClientApi.ConnectAsync(); GameFlowChanged += OnGameFlowChanged; LCUApi.EventHandler.Subscribe("/lol-gameflow/v1/gameflow-phase", GameFlowChanged); }
protected override async void OnEnable() { base.OnEnable(); api = await LeagueClientApi.ConnectAsync(); //await CreateLobbyAsync(); }
public static async Task InitializeClientAsync() { //LCU API Documentation: https://lcu.vivide.re/ Client = await LeagueClientApi.ConnectAsync(); Client.EventHandler.Subscribe("/lol-champ-select/v1/session", OnChampSelect); IsInitialized = true; }
protected async override void OnEnable() { base.OnEnable(); // Initialize a connection to the league client. api = await LeagueClientApi.ConnectAsync(); api.EventHandler.Subscribe("/lol-matchmaking/v1/ready-check", OnReadyCheck); }
public async void ChangeSummonerIcon(uint profileIconId) { // Initialize a connection to the league client. var api = await LeagueClientApi.ConnectAsync(); // Update the current summoner's profile icon var body = new { profileIconId }; var queryParameters = Enumerable.Empty <string>(); await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Put, "lol-summoner/v1/current-summoner/icon", queryParameters, body); }
async void DisenchantOwnedChampions() { var api = await LeagueClientApi.ConnectAsync(); foreach (var item in OwnedItems.Where(p => p.displayCategories == "CHAMPION")) { Console.WriteLine(item.itemDesc); //string res = await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Post, $"/lol-loot/v1/player-loot/CURRENCY_champion", new string[0], $"[{item.lootId}]"); string res = await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Post, $"/lol-loot/v1/recipes/CURRENCY_champion", new string[0], $"[\"{item.lootId}\"]"); } }
private async Task <LeagueClientApi> ConnectToClient() { Logging.Info("Connecting to League Client"); var stopwatch = Stopwatch.StartNew(); var api = await LeagueClientApi.ConnectAsync(); api.EventHandler.Subscribe("/lol-gameflow/v1/gameflow-phase", ClientStateChanged); api.EventHandler.Subscribe("/lol-champ-select/v1/session", ChampSelectChanged); api.EventHandler.Subscribe("/lol-champ-select/vi/sfx-notifications", ChampSelectSFXChanged); stopwatch.Stop(); State.Client.State.LeagueConntected(); Logging.Info($"Connected to League Client ({stopwatch.ElapsedMilliseconds} ms)."); return(api); }
private async void button1_Click(object sender, EventArgs e) { // Initialize a connection to the league client. var api = await LeagueClientApi.ConnectAsync(); // Update the current summoner's profile icon to 23. string request = @"{ customGameLobby: { configuration: { gameMode: 'PRACTICETOOL', gameMutator: '', mapId: 11, mutators: { id: 1 }, spectatorPolicy: 'NotAllowed', teamSize: 5 }, lobbyName: 'Practice Tool', lobbyPassword: null }, isCustom: true }"; JObject body = JObject.Parse(request); var queryParameters = Enumerable.Empty <string>(); try { await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Post, "/lol-lobby/v2/lobby", queryParameters, body); string messageBoxText = "A lobby has been created"; string caption = "INFO"; MessageBoxButton button = MessageBoxButton.OK; MessageBoxImage icon = MessageBoxImage.Information; System.Windows.MessageBox.Show(messageBoxText, caption, button, icon); } catch (Exception) { string messageBoxText = "There was an error"; string caption = "ERROR"; MessageBoxButton button = MessageBoxButton.OK; MessageBoxImage icon = MessageBoxImage.Error; System.Windows.MessageBox.Show(messageBoxText, caption, button, icon); System.Windows.Forms.Application.Exit(); } }
async Task <LootItem[]> GetItems() { var api = await LeagueClientApi.ConnectAsync(); try { string res = await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Get, "/lol-loot/v1/player-loot"); return(JsonConvert.DeserializeObject <LootItem[]>(res)); } catch (Exception ex) { Console.WriteLine(ex); return(new LootItem[0]); } }
async void DisenchantDuplicates() { var api = await LeagueClientApi.ConnectAsync(); foreach (var item in OwnedItems) { string body = JsonConvert.SerializeObject(item.lootId, Formatting.Indented); //string res = await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Post, $"/lol-loot/v1/recipes/{item.disenchantLootName}/craft", new string[0], $"[{item.lootId}]"); string res = await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Post, $"/lol-loot/v1/player-loot/CHAMPION_31/context-menu"); //string res = await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Get, $"/lol-loot/v1/recipes/initial-item/{lootId}", new string[0], $"[{item.lootId}]"); //Console.WriteLine(res); } }
public LeagueEnhancer() { Application.ApplicationExit += OnApplicationExit; LeagueClient = LeagueClientApi.ConnectAsync().GetAwaiter().GetResult(); // Register Services Services = new ServiceCollection() .AddSingleton(LeagueClient) .AddSingleton <ChampionSelectService>() .AddSingleton <NotificationService>() .AddSingleton <ChampionService>() .AddSingleton <QueueService>() .BuildServiceProvider(); // Initializing Console.WriteLine("Initializing..."); InitializeModules(); InitializeNotifyIcon(); }
private async void OnReadyCheck(object sender, LeagueEvent e) { ReadyCheckResponse?res; try { res = e?.Data?.ToObject <ReadyCheckResponse>(); } catch { return; } if (autoAccept && res?.playerResponse == PlayerResponse.None) { Console.WriteLine("Game found!"); var api = await LeagueClientApi.ConnectAsync(); await api.RequestHandler.GetJsonResponseAsync(HttpMethod.Post, "/lol-matchmaking/v1/ready-check/accept"); Console.WriteLine("Accepted Readycheck!"); } }