All Projects → stirante → lol-client-java-api

stirante / lol-client-java-api

Licence: GPL-3.0 License
Simple library which provides access to internal League of Legends Client API.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to lol-client-java-api

league-connect
🔌 Promise-based NodeJS interface to the League of Legends Client APIs
Stars: ✭ 92 (+80.39%)
Mutual labels:  league-of-legends, league
LeagueReplayParser
C# library which can read some data from a .rofl file, and start a replay in the client. (no longer actively maintained)
Stars: ✭ 20 (-60.78%)
Mutual labels:  league-of-legends, league
Mecha
🚀 Debugger and plugin loader for the League of Legends client
Stars: ✭ 48 (-5.88%)
Mutual labels:  league-of-legends, league
lol-pick-ban-ui
Web-Based UI to display the league of legends champ select in esports tournaments.
Stars: ✭ 181 (+254.9%)
Mutual labels:  league-of-legends, league
LeagueAPI
League of Legends API & Data Framework in Swift
Stars: ✭ 50 (-1.96%)
Mutual labels:  league-of-legends, league
KBotExt
Application that sends custom requests to League of Legends LCU api
Stars: ✭ 86 (+68.63%)
Mutual labels:  league-of-legends, league
league-bot
A League of Legends bot to level up accounts. For best results use the settings required settings in the code/README. This bot is designed for Windows computers.
Stars: ✭ 19 (-62.75%)
Mutual labels:  league-of-legends, league
MindCorpViewer
League Of Legends Model Viewer
Stars: ✭ 19 (-62.75%)
Mutual labels:  league-of-legends
league-toolkit
⚙️ A set of additional options for the updated League of Legends client.
Stars: ✭ 20 (-60.78%)
Mutual labels:  league-of-legends
game apis
This repository is for integrating with different apis to allow you to pull player or game data
Stars: ✭ 24 (-52.94%)
Mutual labels:  league-of-legends
Riot-Games-API-Developer-Assets
Riot Games API Developer Assets!
Stars: ✭ 23 (-54.9%)
Mutual labels:  league-of-legends
trophy-hunter
Trophy Hunter is a League of Legends companion app for the Overwolf store
Stars: ✭ 21 (-58.82%)
Mutual labels:  league-of-legends
LoL-TFT-Champion-Masking
League Of Legends - Teamfight Tactics Champion Masking
Stars: ✭ 23 (-54.9%)
Mutual labels:  league-of-legends
legendary-rune-maker
An automation app for League of Legends
Stars: ✭ 75 (+47.06%)
Mutual labels:  league-of-legends
league-lazy-event
💤 Provides a LazyListener for use with League\Event which allows for lazy fetching of actual listeners.
Stars: ✭ 14 (-72.55%)
Mutual labels:  league
kernel
A plug & play Riot API proxy server
Stars: ✭ 28 (-45.1%)
Mutual labels:  league-of-legends
onetricks.net
(WIP) kayn-powered (typescript node.js) ReasonReact app presenting you a dashboard of high ELO one trick ponies in League of Legends
Stars: ✭ 13 (-74.51%)
Mutual labels:  league-of-legends
ChromaLeague
Java open-source Razer Chroma keyboard integration for League of Legends
Stars: ✭ 34 (-33.33%)
Mutual labels:  league-of-legends
FantasyPremierLeague.py
⚽ Statistics for your mini leagues.
Stars: ✭ 123 (+141.18%)
Mutual labels:  league
Sentinel
👀 Native notifications for League of Legends
Stars: ✭ 38 (-25.49%)
Mutual labels:  league

lol-client-java-api

Build Status lol-client-java-api

Simple library which provides access to internal League of Legends Client API.

Disclaimer

This product is not endorsed, certified or otherwise approved in any way by Riot Games, Inc. or any of its affiliates.

Requirements

lol-client-java-api requires at least Java 8 and works only on Windows.

Setup

This project is available on Jitpack

Gradle

Add Jitpack to your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the project as a dependency:

dependencies {
	compile 'com.github.stirante:lol-client-java-api:1.2.3'
}

Maven

Add Jitpack as a repository:

<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>

Add the project as a dependency:

<dependency>
    <groupId>com.github.stirante</groupId>
    <artifactId>lol-client-java-api</artifactId>
    <version>1.2.3</version>
</dependency>

Snapshots

Snapshots of all the latest changes are available in my personal nexus repository.

<repositories>
    <repository>
        <id>stirante-nexus-snapshots</id>
        <url>https://nexus.stirante.com/repository/maven-snapshots/</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.stirante</groupId>
    <artifactId>lol-client-java-api</artifactId>
    <version>1.2.4-SNAPSHOT</version>
</dependency>

Usage

This library depends on League of Legends client and requires it to be open while using this API.

package examples;

import com.stirante.lolclient.ClientApi;
import com.stirante.lolclient.ClientConnectionListener;
import generated.LolChampionsCollectionsChampion;
import generated.LolChampionsCollectionsChampionSkin;
import generated.LolSummonerSummoner;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SkinListExample {

    private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("dd-MM-yyyy");

    /**
     * Simple example, which show all owned champions and skins (with purchase date)
     */
    public static void main(String[] args) {
        //Initialize API
        ClientApi api = new ClientApi();
        api.addClientConnectionListener(new ClientConnectionListener() {
            @Override
            public void onClientConnected() {
                try {
                    //Check if user is logged in
                    if (!api.isAuthorized()) {
                        System.out.println("Not logged in!");
                        return;
                    }
                    //Get current summoner
                    LolSummonerSummoner summoner = api.executeGet("/lol-summoner/v1/current-summoner", LolSummonerSummoner.class).getResponseObject();
                    //Get champion collection of summoner
                    LolChampionsCollectionsChampion[] champions = api.executeGet(
                            "/lol-champions/v1/inventories/" + summoner.summonerId + "/champions",
                            LolChampionsCollectionsChampion[].class).getResponseObject();
                    for (LolChampionsCollectionsChampion champion : champions) {
                        if (champion.ownership.owned) {
                            System.out.println(champion.name + " purchased on " +
                                    FORMATTER.format(new Date(champion.ownership.rental.purchaseDate)));
                            for (LolChampionsCollectionsChampionSkin skin : champion.skins) {
                                if (!skin.isBase && skin.ownership.owned) {
                                    System.out.println("\t" + skin.name + " purchased on " +
                                            FORMATTER.format(new Date(skin.ownership.rental.purchaseDate)));
                                }
                            }
                        }
                    }
                    api.stop();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onClientDisconnected() {

            }
        });
    }
}

This library is still under development and lacks many features. Right now to access them, use these methods.

package examples;

import com.stirante.lolclient.ClientApi;
import com.stirante.lolclient.ClientConnectionListener;
import generated.LolChatUserResource;

import java.io.IOException;

public class DirectAccessExample {

    /**
     * Simple example, which shows how to access API directly
     */
    public static void main(String[] args) {
        //Initialize API
        ClientApi api = new ClientApi();
        //Add listener, which will notify us about client connection available
        api.addClientConnectionListener(new ClientConnectionListener() {
            @Override
            public void onClientConnected() {
                try {
                    //Get current user chat info
                    ApiResponse<LolChatUserResource> user =
                            api.executeGet("/lol-chat/v1/me", LolChatUserResource.class);
                    //Print status message
                    System.out.println(user.getRawResponse());
                    api.stop();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onClientDisconnected() {

            }
        });
    }
}

All possible paths can be found in api.getSwaggerJson() or api.getOpenapiJson(). (In order to enable this, you need to add enable_swagger: true to Riot Games\League of Legends\RADS\projects\league_client\releases\<latest version>\deploy\system.yaml)

All classes in generated package were generated from OpenAPI JSON. To regenerate all classes, run League of Legends client with access to swagger and run

mvn clean compile exec:java

All examples are in examples package.

Library contains very simple command line interface which can be used like this

java -jar lol-client-java-api.jar -p PATH -m METHOD

Example:

java -jar lol-client-java-api.jar -p rso-auth/v1/authorization -m GET

Library also allows for listening to events from League of Legends client

package examples;

import com.stirante.lolclient.ClientApi;
import com.stirante.lolclient.ClientConnectionListener;
import com.stirante.lolclient.ClientWebSocket;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class WebSocketExample {

    private static ClientWebSocket socket;

    /**
     * Simple example showing how to receive websocket events from client
     */
    public static void main(String[] args) throws Exception {
        //Initialize API
        ClientApi api = new ClientApi();
        api.addClientConnectionListener(new ClientConnectionListener() {
            @Override
            public void onClientConnected() {
                System.out.println("Client connected");
                try {
                    //open web socket
                    socket = api.openWebSocket();
                    //add event handler, which prints every received event
                    socket.setSocketListener(new ClientWebSocket.SocketListener() {
                        @Override
                        public void onEvent(ClientWebSocket.Event event) {
                            System.out.println(event);
                        }

                        @Override
                        public void onClose(int code, String reason) {
                            System.out.println("Socket closed, reason: " + reason);
                        }
                    });
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onClientDisconnected() {
                System.out.println("Client disconnected");
                socket.close();
            }
        });
        //close socket when user enters something into console
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        reader.readLine();
        api.stop();
        socket.close();
    }

}

Live game API

Since version 1.2.0, this api allows for requesting live game data. The example is in src/main/java/examples/IngameApiExample.java. To check how it's working, run this example while in game.

A generated documentation can be found here (not generated by me).

Generated models for live game API are in generated.live package (It's not very useful right now, because the schema in the documentation is lacking. I hope it will be added in the future).

Contributing

All contributions are appreciated. If you would like to contribute to this project, please send a pull request.

Contact

Have a suggestion, complaint, or question? Open an issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].