#riot-games #riot #league #league-of-legends

lol-game-client-api

League of Legends local Game Client API

9 releases

Uses new Rust 2021

0.1.8 Jan 1, 2022
0.1.7 Jan 1, 2022
0.1.6 Dec 31, 2021

#74 in HTTP client

Download history 2/week @ 2022-03-08 29/week @ 2022-03-15 28/week @ 2022-03-22 2/week @ 2022-03-29 12/week @ 2022-04-05 2/week @ 2022-04-12 3/week @ 2022-04-19 64/week @ 2022-04-26 56/week @ 2022-05-03 139/week @ 2022-05-10 30/week @ 2022-05-17 47/week @ 2022-05-24 76/week @ 2022-05-31 20/week @ 2022-06-07 3/week @ 2022-06-14 6/week @ 2022-06-21

114 downloads per month

MIT license

25KB
584 lines

This crate aims to provide a Rust interface with the League of Legends Game Client API. The official doc can be found here.

The Game Client API is an API that is exposed by your local League of Legends Client, and should not be mistaken for the LoL API, for which there is already a great crate. The API allows you to get some informations about the ongoing game.

Content of the crate

There are currently three modules:

  • api which contains the GameClient and all it's methods that calls the API.
  • model which contains all the structures for the data that will be returned by the API.
  • event_listener which contains the definition of a trait to create structures that you can pass to start_listener to run a task that will periodically check for new Events and trigger callbacks accordingly. (you can see an example in examples/basic_listener)

How to use it

use lol_game_client_api::api::{GameClient, get_riot_root_certificate};
use tokio;

#[tokio::main]
async fn main() {
    let client = GameClient::new();
    let active_player = client.active_player().await.unwrap();
    
    println!("Stats Runes: {:?}", active_player.full_runes.stat_runes)
}

A more complete example can be found in the repo LoLCongratz. This is a small binary that plays a sound in a virtual audio cable each time a teammate makes a kill.

TODO

Currently, some variants are missing from enums (see model::DragonType for example).
Also, some endpoints are not working at all ( all the endpoints that require the summonerName as a GET param for example).
But all the structs to deserialize the response already exists, so this should not be too much work.

Disclaimer

I created this crate a morning, for a personnal project, so there may be some missing features, or it may not be up-to-date with the latest LoL client. In which case, I'd be delighted to see a contribution (being an issue or a PR) !

Dependencies

~5–14MB
~276K SLoC