From 6cd08950141761599f517ed8c7794d3b15679af7 Mon Sep 17 00:00:00 2001 From: League of Poro Date: Wed, 8 Dec 2021 21:20:43 +0100 Subject: [PATCH] Initial commit --- .gitignore | 3 ++ README.md | 31 +++++++++++++++++ porolobby.py | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 4 files changed, 124 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 porolobby.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d8de6d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +out/ +icon.ico +__pycache__/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c41670e --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# PoroLobby + +PoroLobby creates 5v5 Practice Tool with bots in League of Legends. + +## How to use (Windows) + +Video guide: +(WILL BE ADDED) + +1. Download `PoroLobby.zip` file from Releases section. Or just click this link. +2. Extract the archive and go to the extracted `PoroLobby` folder +2. Start League of Legends and log in +3. Run the `porolobby.exe` - the lobby will be created and filled with easy bots +4. Start the game and ENJOY! + +### Advanced users (Win/Mac/Linux) + +If you know Python, there's no need to run the exe file. Clone this repo, install requirements with `pip` and run `porolobby.py`. +This method should work for all platforms. + +## Disclaimer + +Use of this tool should not be bannable by Riot Games. That said, League of Poro provides no guarantee whatsoever. Use at your own risk! + +## License + +This tool is distributed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) + +## Endorsement + +PoroLobby isn’t endorsed by Riot Games and doesn’t reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc. \ No newline at end of file diff --git a/porolobby.py b/porolobby.py new file mode 100644 index 0000000..dbbb199 --- /dev/null +++ b/porolobby.py @@ -0,0 +1,89 @@ +#! python3 + +from lcu_driver import Connector + +connector = Connector() + +# Creates 5v5 Practice Tool +async def createLobby(connection): + data = { + "customGameLobby": { + "configuration": { + "gameMode": "PRACTICETOOL", + "gameMutator": "", + "gameServerRegion": "", + "mapId": 11, + "mutators": { + "id": 1 + }, + "spectatorPolicy": "AllAllowed", + "teamSize": 5, + }, + "lobbyName": "League of Poro's Practice Tool", + "lobbyPassword": "" + }, + "isCustom": True, + } + # make the request to switch the lobby + lobby = await connection.request('post', '/lol-lobby/v2/lobby', data=data) + + # if HTTP status code is 200 the lobby was created successfully + if lobby.status == 200: + print('The lobby was created correctly') + else: + print('Whops, Yasuo died again.') + + +# Contacts LCU API to add bots +async def executeAddBot(connection, data): + res = await connection.request('post', '/lol-lobby/v1/lobby/custom/bots', data=data) + if res.status == 204: + print('Bot added') + else: + print('Whops, Yasuo died again.') + +# Selects which bots to add and adds them to an existing lobby +async def addBots(connection): + ids = [1, 3, 8, 10, 11] + + # add bots to the player's team + for id in ids[:4]: + data = { + "botDifficulty": "EASY", + "championId": id, + "teamId": "100" + } + await executeAddBot(connection, data) + + # add bots to the opposite team + for id in ids: + data = { + "botDifficulty": "EASY", + "championId": id, + "teamId": "200" + } + await executeAddBot(connection, data) + + +# fired when LCU API is ready to be used +@connector.ready +async def connect(connection): + print('LCU API is ready to be used.') + + # check if the user is already logged into his account + summoner = await connection.request('get', '/lol-summoner/v1/current-summoner') + if summoner.status != 200: + print('Please login into your account.') + else: + print('Switching the lobby type.') + await createLobby(connection) + await addBots(connection) + + +# fired when League Client is closed (or disconnected from websocket) +@connector.close +async def disconnect(_): + print('The client have been closed!') + +# starts the connector +connector.start() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d97edb9 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +lcu-driver \ No newline at end of file