Skip to content

AoshiW/Kunc.RiotGames

Repository files navigation

Kunc.RiotGames

Kunc.RiotGames is a collection of libraries to help you work with the RiotGames API, and things like DDragon, LCU , etc.

TODO

Packages

All packages are available through NuGet.

Package NuGet Description
Kunc.RiotGames.Core Nuget Core package for other packages.
Kunc.RiotGames.Api Nuget Client for the Riot Games API.
Kunc.RiotGames.Lol.DataDragon Nuget Simple client for League of Legends DataDragon.
Kunc.RiotGames.Lol.GameClient Nuget Simple client for League of Legends Game Client API
Kunc.RiotGames.Lol.LeagueClientUpdate Nuget Simple client for interacting with the League of Legends LCU.
Kunc.RiotGames.Lor.DeckCodes Nuget Encode/Decode Legends of Runeterra decks to/from simple strings.
Kunc.RiotGames.Lor.GameClient Nuget Simple client for Legends of Runeterra Game Client API

How to Use

var api = RiotGamesApi.Create(x => x.ApiKey = "RGAPI-...");
var lolDataDragon = LolDataDragon.Create();
string bigRegion = Regions.EUROPE;
string smallRegion = Regions.EUN1;
var riotId = "AoshiW#IRON";

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.Id);
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}");
}

Output:

Account: AoshiW#IRON
Region: eun1
Level: 591

Rank:
Cherry: Unranked
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

Disclaimer

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.