hexcore

Last updated:

0 purchases

hexcore Image
hexcore Images
Add to Cart

Description:

hexcore

Hexcore #

A Flutter package which provides an interface to the League of Legends Client API (LCU API) and LCU Socket connection.
Usage #
Use Hexcore.create to create a new instance of Hexcore
Hexcore hexcore = await Hexcore.create();

await hexcore.connectToClient();
copied to clipboard
At the moment that Hexcore connect to the client, it will watch the League Client state. If the player closes the client, the package will wait until the player reopen it.
Hexcore has three states:

initial: When the instance of Hexcore is created.
searchingClientPath: When Hexcore is searching for the League Client path at the player's PC.
waiting: Hexcore already found the League Client Path, and now is waiting for the player to open the game or trying to connect to it.
connected: Hexcore is connected and ready to go.

Hexcore has a ValueNotifier that notifies about the state of the connection, so you can use an AnimatedContainer to build according to it's state.
...
AnimatedBuilder(
animation: hexcore.status,
builder: (BuildContext context, Widget? child) {
if (hexcore.status.value == HexcoreStatus.waiting) {
return const Center(
child: CircularProgressIndicator(),
);
} else {
return const Center(
child: Text('Hexcore is ready!');
);
}
},
);
...
copied to clipboard
Send custom notification #
With hexcore you can send notification throw the League Client.
await hexcore.sendCustomNotification(
title: 'Hexcore notification',
details: 'Hello World',
iconUrl: 'https://some_url_here',
backgroundUrl: 'https://some_url_here',
);
copied to clipboard
Create and join a custom lobby #
This method create and insert the current player in a custom lobby.
await hexcore.createCustomMatch(
lobbyName: 'Custom game #1',
lobbyPassword: 'hexcore_123',
);
copied to clipboard
List custom lobbys #
List all the available custom matches, so you can get the information you need to join a match.
List<Map<String,dynamic>> matches = await hexcore.listCustomMatches();
copied to clipboard
Join custom match #
Use this method when you need to join a match. You can get the id of the match at listCustomMatches method.
await hexcore.joinCustomMatch(
id: 'lobby_id',
password: 'lobby_password'
);

copied to clipboard
HexcoreSocket Usage #
In this package you can also find an interface for the LCU Socket connection, where you can subscribe and listen to events emitted by LCU.
Create an instance and use HexcoreSocket.connect to connect.
❗ You need to connect to the LCU using Hexcore.connectToClient before trying the socket connection. ❗
HexcoreSocket hexcoreSocket = HexcoreSocket();

await hexcoreSocket.connect();
copied to clipboard
Subscribing to LCU Events. #
To subscribe to new events you need to call the method add.
hexcoreSocket.add('[5, "OnJsonApiEvent"]');
copied to clipboard
In this example you subscribe to all LCU Events. Here you can understand more about LCU Events.
Handling Events #
Use listen method to create a StreamSubscription to handle the events that has been subscribed.
hexcoreSocket.listen((event){
print(event);
});
copied to clipboard
Additional information #
You may need to override the badCertificateCallback in way to send requests to the League Client, there is a example:
HttpOverrides.global = MyHttpOverrides();

class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.