Giter VIP home page Giter VIP logo

lcu-sharp's People

Contributors

bryanhitc avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lcu-sharp's Issues

It needs System.Runtime 5.0.0.0

I can't add the LeagueApi to the Project. This is the error CS1705 Assembly 'LCUSharp' with identity 'LCUSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I tried installing the latest runtime but didn't work.

Stack Overflow Exception while the league client is starting

Hey, it takes quite a few steps to reproduce but it should still be fairly common

  1. Connect to League via ConnectAsync.
  2. Add a Disconnect Event Handler to the API
  3. In the Disconnect Handler initiate ConnectAsync or ReconnectAsync
  4. Close the League Client
  5. Open the League Client

In the first few seconds where the client isnt fully ready EnsureConnectionAsync will then spam the LCU with requests, it still connects but a short time after it will succumb to stack overflow.

I put a bandaid fix on this by increasing the delay on exception to 5000ms, which does work but its just that: a bandaid.

WaitForProcessAsync needs to wait for processes[0].MainModule != null

A few times I've seen an exception in WaitForProcessAsync on Process.MainModule.FileName, where this code is reached while MainModule is still null (it gets set milliseconds later).

Updating the if (processes.Length > 0) to if (processes.Length > 0 && processes[0].MainModule != null) should fix it.

Event problem

`public event EventHandler GameFlowChanged;
private readonly TaskCompletionSource _work = new TaskCompletionSource(false);

public async Task EventExampleAsync()
{
// Initialize a connection to the league client.
var api = await LeagueClientApi.ConnectAsync();
Console.WriteLine("Connected!");

// Register game flow event.
GameFlowChanged += OnGameFlowChanged;
api.EventHandler.Subscribe("/lol-gameflow/v1/gameflow-phase", GameFlowChanged);

// Wait until work is complete.
await _work.Task;
Console.WriteLine("Done.");

}

private void OnGameFlowChanged(object sender, LeagueEvent e)
{
var result = e.Data.ToString();
var state = string.Empty;

switch (result)
{
    case "None":
        state = "main menu";
        break;
    case "Lobby":
        state = "lobby";
        break;
    case "ChampSelect":
        state = "champ select";
        break;
    case "GameStart":
        state = "game started";
        break;
    case "InProgress":
        state = "game";
        break;
    case "WaitingForStats":
        state = "waiting for stats";
        break;
    default:
        state = $"unknown state: {result}";
        break;
}

// Print new state and set work to complete.
Console.WriteLine($"Status update: Entered {state}.");
_work.SetResult(true);

}`

I see Connected, but when i switch of game, it don't print anything

Nugget Package

I tried to import the dll dependency to my project, but doesn't work as expected. Could u create a nugget package of this API?

Fix inconsistencies between handlers

There are some inconsistencies between some of the handlers regarding their implementation and how they are initialized in the RiotClient. These should be fixed.

Add README event listening example

Is your feature request related to a problem? Please describe.
Currently, the README doesn't demonstrate how to listen to web socket events triggered by the league client.

Describe the solution you'd like
Outline a clear example of how to use the ILeagueEventHandler.

Fix connection failure when client is initially closed

Describe the bug
When trying to connect to the league client, the API will wait until the process and lockfile are detected before doing so. This results in successfully parsing the lockfile for the auth token and client port when the client is already open.

However, if the API tries to connect before opening the client, there's a chance that the client hasn't established the web socket server when this API detects both the process and lockfile. This results in an unsuccessful connection to the web socket server, which can only be fixed by instantiating a new ILeagueClientApi after the client is open. This is unacceptable.

To Reproduce
Steps to reproduce the behavior:

  1. Make sure the league client is completely closed (no processes running).
  2. Attempt to connect to the client via await LeagueClientApi.ConnectAsync().
  3. Open the client.
  4. You'll either observe event capturing or the lack of it.

The connection to the client's web socket server should complete and be successful before completing the Task, therefore, the latter is not acceptable.

Expected behavior
await LeagueClientApi.ConnectAsync() will successfully connect to the client's web socket server before completing.

subscribe function

When using the 'subscribe' feature, if there is no response from the subscribed event for about a minute, the 'subscribe' functionality will stop.

Lock file location can not be read from process when Lol run in Admin mode

Describe the bug
If you start LOL via run as administrator, getting the MainModule of the process raises an exception. It turns out Riot has a page telling users to run in administrator mode. Our first beta tester was doing this (on advice of a coach).

If there's another way to reliably get the current folder to read the lockfile from (I tried it hardcoded), then the LCU API works correctly.

Hardcoding the lockfile path isn't a good solution though, as the user may have installed Lol in a different location.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.