How to set runes using LCU

In this Example I'm going to be using my C# Lib PoniLCU.


First of all let's set our LeagueClient properly.

LeagueClient leagueClient = new LeagueClient(credentials.cmd);

Before we dive into it, let's look at what runes are.

The client doesn't deal with the runes as the same as you do.
The client doesn't know what DarkHarvest is, it only knows of it by its id. Which in this case is 8128.

But, how did I know that? You can find a JSON of all runes data here.

To push runes to the client, you need to use the lol-perks plugin which you can find info about here.


How do we actually start pushing runes?

Unfortunately you can't just request PUT lol-perks/v1/currentpage you've seen at the website I mentioned.

The client won't show you your changes, and even if you tried to POST lol-perks/v1/pages which is the right endpoint, you will get an error if you have the max number of pages used.

How to do it then?

To do it you will need a sequence of requests.

  1. Get the current rune page
  2. Delete it by Id
  3. Create a new rune page

1 - Get the current rune page

By saying get the rune page, I mean to store data about it. But we are going to delete it, why should i store these data then?
Because when deleting a rune page you need to pass the id of the one you want to delete.
To get the current rune page you need to request GET /lol-perks/v1/currentpage.
In my lib the code will be

var data = await leagueClient.Request(requestMethod.get, "/lol-perks/v1/currentpage");

And to get the id from the JSON response look at here
Now we have the id which for this example we will use 123.


2 - Delete it by Id

Once we have the ID of the page we want to delete (current page in this case) we can delete it:

DELETE /lol-perks/v1/page/123
In my lib :

 await leagueClient.Request(requestMethod.delete, "/lol-perks/v1/pages/123");
 // Don't forget we assumed that id is 123, yours will be different 

3 - Create a new rune page

To create a new rune page we use POST "lol-perks/v1/pages" BUT with a body.

What do we need to include in the body?

All you need to specify in the body is

  • name
  • primaryStyleId Such as these :
  • subStyleId, which is basically the same as the above one but in the second tree
  • selectedPerkIds

As an example... for this page

  • primaryStyleId is the id of Precision
  • subStyleId is the id of Sorcery
  • selectedPerkIds are the inside perks(runes) (Press the attack, Triumph, Legend: Alacrity ....etc)

To make a body for this POST request, it should be like this:

{
    "name":"Ponita",
    "primaryStyleId":8300,
    "subStyleId":8400,     
    "selectedPerkIds": [8351,8313,8345,8347,8451,8444,5007,5002,5001],
    "current":true
}

This will create this rune page

In my lib its like this

  var body = "{\"name\":\"Ponita\", \"selectedPerkIds\": [8351,8313,8345,8347,8451,8444,5007,5002,5001], \"primaryStyleId\":8300, \"subStyleId\":8400, \"current\": true}";
  var request = await PoniLcu.Request(requestMethod.POST, "lol-perks/v1/pages", body);

As you might have noticed, selectedPerkIds is the inside runes and stats


I think that's all, if you still don't understand something feel free to ask ^-^

Credits: Ponita0