Kunc.RiotGames
is a collection of libraries to help you work with the RiotGames API, and things like DDragon, LCU , etc.
Each package has its own README with more detailed information about its purpose and use. If you want to know more about each one of these, please refer to the packages list.
All packages are available through NuGet.
Package + README link | NuGet | Description |
---|---|---|
Kunc.RiotGames.Core |
Core package for other packages. | |
Kunc.RiotGames.Api |
Client for the Riot Games API. | |
Kunc.RiotGames.Lol.DataDragon |
Simple client for League of Legends DataDragon. | |
Kunc.RiotGames.Lol.GameClient |
Simple client for League of Legends Game Client API | |
Kunc.RiotGames.Lol.LeagueClientUpdate |
Simple client for interacting with the League of Legends LCU. | |
Kunc.RiotGames.Lor.DeckCodes |
Encode/Decode Legends of Runeterra decks to/from simple strings. | |
Kunc.RiotGames.Lor.GameClient |
Simple client for Legends of Runeterra Game Client API |
This example requires downloading 2 packages: Kunc.RiotGames.Api
and Kunc.RiotGames.Lol.DataDragon
using Kunc.RiotGames.Api;
using Kunc.RiotGames.Api.LolChampionMasteryV4;
using Kunc.RiotGames.Api.LolLeagueV4;
using Kunc.RiotGames.Api.LolSummonerV4;
using Kunc.RiotGames.Api.RiotAccountV1;
using Kunc.RiotGames.Lol.DataDragon;
using Kunc.RiotGames.Lol.DataDragon.Champion;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection()
.AddRiotGamesApi(x => x.ApiKey = "RGAPI-...")
.AddLolDataDragon()
.BuildServiceProvider();
var api = services.GetRequiredService<IRiotGamesApi>();
var lolDataDragon = services.GetRequiredService<ILolDataDragon>();
var riotId = "AoshiW#NULL";
string smallRegion = Regions.EUN1;
string bigRegion = Regions.EUROPE;
AccountDto? account = await api.RiotAccountV1.GetAccountByRiotIdAsync(bigRegion, riotId);
SummonerDto? summoner = await api.LolSummonerV4.GetSummonerByPuuidAsync(smallRegion, account!.Puuid);
Console.WriteLine($"Account: {account.GetRiotId()}");
Console.WriteLine($"Region: {smallRegion}");
Console.WriteLine($"Level: {summoner.Level}");
LeagueEntryDto[] entries = await api.LolLeagueV4.LeagueEntriesForSummonerAsync(smallRegion, summoner.Puuid);
Console.WriteLine();
Console.WriteLine($"Rank:");
foreach (var entry in entries)
{
Console.WriteLine($"{entry.QueueType}: {entry.ToRank()}");
}
const int count = 5;
ChampionMasteryDto[] masteries = await api.LolChampionMasteryV4.GetAllChampionMasteryEntriesAsync(smallRegion, account.Puuid);
Dictionary<string, ChampionBaseDto> champions = await lolDataDragon.GetChampionsBaseAsync("latest", "en_US");
Console.WriteLine();
Console.WriteLine($"Top {count} champions:");
foreach (var mastery in masteries.Take(count))
{
var champion = champions.First(c => c.Value.Key == mastery.ChampionId).Value;
Console.WriteLine($"{champion.Name,-13} Level:{mastery.ChampionLevel,3}, Points:{mastery.ChampionPoints,7}");
}
Example output:
Account: AoshiW#NULL
Region: eun1
Level: 591
Rank:
RankedFlexSR: Gold I 56LP
RankedSolo5x5: Gold II 86LP
Top 5 champions:
Zoe Level: 63, Points: 693502
Soraka Level: 40, Points: 443427
Heimerdinger Level: 29, Points: 335509
Cassiopeia Level: 12, Points: 144221
Morgana Level: 11, Points: 137580
Kunc.RiotGames
isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc.