Tutorial: Making requests to Meraki Analytics in RiotBlossom
Added in 1.2.0Meraki Analytics is an LLC company that provides open-source projects for the Riot Games Developer Community. They are most known for Java orianna, Python cassiopeia, and lolstaticdata champion and item data generator.
Meraki provides a CDN serving the latest data generated by lolstaticdata. More information about their project's mission can be found in the linked Goals of the Project section.
In shortsies, Meraki static data aims to mediate between the data inaccuracies of DataDragon and the schema complexities of CommunityDragon.
You will learn how to:
- Fetch a champion
- Fetch an item
This code examples for this tutorial builds upon the tutorials overview!
Prerequisites
Fetch a champion
Fetching a champion from Meraki requires an associated key
identifier. This is
the same key found in DataDragon key
and CommunityDragon alias
analogs!
Okie dokie, let us try using the champion key for Ahri:
var champion = await client.MerakiAnalytics.GetChampionByKeyAsync("Ahri");
Console.WriteLine(champion);
The following should be displayed within the console:
Champion {
"Id": 103,
"Key": "Ahri",
"Name": "Ahri",
"Title": "the Nine-Tailed Fox",
"FullName": "",
"Icon": "http://ddragon.leagueoflegends.com/cdn/13.9.1/img/champion/Ahri.png",
"Resource": "MANA",
"AttackType": "RANGED",
"DamageType": null,
"Stats": {
"Health": {
"Flat": 590,
"Percent": 0,
"PerLevel": 96,
"PercentPerLevel": 0,
"PercentBase": 0,
"PercentBonus": 0
},
...
}
A champion key is not the same as the champion name. Wukong has the champion key of
MonkeyKing
, for example!An entire dictionary of champions from Meraki can also be fetched for caching purposes! <3
var champions = await client.MerakiAnalytics.GetChampionDictionaryAsync();
var champion = champions["MonkeyKing"];
Getting the champion dictionary fetches an abnormally large JSON file on call. This can be significant when caching is disabled!
Fetch an item
League of Legends shop items are also provided by Meraki!
How about getting some booties for item ID 1001
? ☆ ~(‘▽^人)
var item = await client.MerakiAnalytics.GetItemByIdAsync(1001);
Console.WriteLine(item);
This console should display the following infosies:
Item {
"Name": "Boots",
"Id": 1001,
"Tier": 1,
"Rank": [
"BOOTS"
],
"BuildsFrom": [],
"BuildsInto": [
3111,
3006,
3009,
3020,
3047,
3117,
3158
],
"SpecialRecipe": 0,
"NoEffects": true,
"Removed": false,
"RequiredChampion": "",
"RequiredAlly": "",
"Icon": "https://raw.communitydragon.org/13.9/plugins/rcp-be-lol-game-data/global/default/assets/items/icons2d/1001_class_t1_bootsofspeed.png",
"SimpleDescription": "Slightly increases Move Speed",
...
}
As always, caching is the totes better practice~*
var items = await client.MerakiAnalytics.GetItemDictionaryAsync();
var item = items[1001];
You have just learned how to fetch a champion and an item from Meraki Analytics in RiotBlossom!
Omega good job!