-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
106 lines (78 loc) · 3.29 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from colorama.ansi import Fore
from lcu_driver import Connector
import requests
import re, json
import webbrowser
import colorama
import pyautogui
import sys
from time import sleep
from os import system
titlea = "LCU API ABUSER"
system("title "+titlea)
init = True
colorama.init()
CURRENT_SUMMONER = '/lol-summoner/v1/current-summoner'
CURRNET_RUNE_PAGE = '/lol-perks/v1/currentpage'
CURRENT_STATE = '/lol-gameflow/v1/gameflow-phase'
MATCH_READY = '/lol-matchmaking/v1/ready-check/accept'
SUMMONER_DATA = '/lol-summoner/v1/summoners/'
BANPICK_PHASE_DATA = '/lol-champ-select/v1/session'
connector = Connector()
def focusOn():
list = pyautogui.getWindowsWithTitle('FireFox')
if len(list) == 0 :
for i in range(4):
sleep(1)
print('. ',end='')
sys.exit()
else:
browser = list[0]
if browser.isMinimized == True:
browser.restore() #run
print("Focused onto your Browser.")
else:
pass
async def fowMultiSearch(connection):
summonerList = ""
matching = await connection.request('get', BANPICK_PHASE_DATA)
matchingData = await matching.json()
teamCount = len(matchingData["myTeam"])
for i in range(teamCount):
summonerId = matchingData["myTeam"][i]["summonerId"]
if summonerId != 0:
summoners = await connection.request('get', SUMMONER_DATA + str(summonerId))
summonerData = await summoners.json()
summonerName = summonerData["displayName"]
summonerList = summonerList + summonerName + ","
print(summonerList[:-1])
region = await connection.request('get', '/riotclient/get_region_locale')
reg1 = await region.json()
regs = (f"{reg1['region']}")
lregs= regs.lower()
print(lregs)
url = "https://porofessor.gg/pregame/" + lregs + "/" + summonerList[:-1]
webbrowser.open(url)
focusOn()
@connector.ready
async def connect(connection):
print(colorama.Fore.LIGHTGREEN_EX+'Connected into LCU API.\n')
print(colorama.Fore.LIGHTCYAN_EX + 'Auto-Accept' + colorama.Fore.LIGHTMAGENTA_EX + ' = ' + colorama.Fore.LIGHTGREEN_EX + 'Activated\n' + colorama.Fore.LIGHTCYAN_EX + 'Auto-porofessors teammates in champ-select' + colorama.Fore.LIGHTMAGENTA_EX + ' = ' + colorama.Fore.LIGHTGREEN_EX + 'Activated' + colorama.Fore.RESET)
summoner = await connection.request('get', CURRENT_SUMMONER)
if summoner.status == 200:
summonerData = await summoner.json()
print(colorama.Fore.LIGHTCYAN_EX + f"Logged into: " + colorama.Fore.LIGHTGREEN_EX + f"{summonerData['displayName']}" + colorama.Fore.RESET + "\n")
@connector.close
async def disconnect(_):
await connector.stop()
@connector.ws.register(CURRENT_SUMMONER, event_types=('UPDATE',))
async def summoner_changed(connection, event):
print.info(f'Summoner [{event.data["displayName"]}] detected.')
@connector.ws.register(CURRENT_STATE, event_types=('UPDATE',))
async def state_changed(connection, event):
print(f'Now state updated to {event.data}')
if event.data == 'ReadyCheck':
await connection.request('post', MATCH_READY)
if event.data == 'ChampSelect':
await fowMultiSearch(connection)
connector.start()