bryanhitc / lcu-sharp Goto Github PK
View Code? Open in Web Editor NEWAn API wrapper for the League of Legends client.
License: MIT License
An API wrapper for the League of Legends client.
License: MIT License
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.
Hey, it takes quite a few steps to reproduce but it should still be fairly common
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.
Implement process-control endpoint actions.
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.
`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
Implement riotclient endpoint actions.
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?
There are some inconsistencies between some of the handlers regarding their implementation and how they are initialized in the RiotClient. These should be fixed.
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
.
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:
await LeagueClientApi.ConnectAsync()
.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.
When using the 'subscribe' feature, if there is no response from the subscribed event for about a minute, the 'subscribe' functionality will stop.
Implement a WebSocket event handler so it's possible to subscribe to events.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.