probably fix setting wrong runes?
This commit is contained in:
parent
f77210b588
commit
7ffda41ba3
60
main.py
60
main.py
@ -7,6 +7,7 @@ token = 0
|
|||||||
page = 0
|
page = 0
|
||||||
userid = 0
|
userid = 0
|
||||||
champ = 0
|
champ = 0
|
||||||
|
lane = "default"
|
||||||
|
|
||||||
urllib3.disable_warnings()
|
urllib3.disable_warnings()
|
||||||
|
|
||||||
@ -85,54 +86,36 @@ def delete_tinyrunes():
|
|||||||
def wait_for_chara():
|
def wait_for_chara():
|
||||||
global champ
|
global champ
|
||||||
done = False
|
done = False
|
||||||
state = 0 # 0 = waiting for champ select,
|
print("ready to grab you some runes~")
|
||||||
# 1 = waiting for champ pick
|
|
||||||
# 2 = waiting for lock in,
|
|
||||||
print("waiting for you to enter champion select...!")
|
|
||||||
while (not done):
|
while (not done):
|
||||||
champselect = local_req("get", "lol-champ-select/v1/session")
|
champselect = local_req("get", "lol-champ-select/v1/session")
|
||||||
if (state == 0):
|
if ("myTeam" in champselect):
|
||||||
if ("errorCode" in champselect):
|
for member in champselect["myTeam"]:
|
||||||
#wait to enter champ select...
|
if (member["summonerId"] == userid and member["championId"] != 0):
|
||||||
pass
|
if (member["championId"] != champ):
|
||||||
elif ("myTeam" in champselect):
|
|
||||||
state = 1
|
|
||||||
print("waiting for you to pick a champion...!")
|
|
||||||
else:
|
|
||||||
print("?????? what is going on")
|
|
||||||
if (state == 1):
|
|
||||||
if ("errorCode" in champselect):
|
|
||||||
state = 0
|
|
||||||
print("oh! i guess you got kicked out of champ select... back to the start~")
|
|
||||||
else:
|
|
||||||
for member in champselect["myTeam"]:
|
|
||||||
if (member["summonerId"] == userid and member["championId"] != 0):
|
|
||||||
print("okay! i'll wait for everyone to lock in, and then go grab your runes~")
|
|
||||||
state = 2
|
|
||||||
if (state == 2):
|
|
||||||
if ("errorCode" in champselect):
|
|
||||||
state = 0
|
|
||||||
print("oh! i guess you got kicked out of champ select... back to the start~")
|
|
||||||
elif (champselect["timer"]["phase"] == "FINALIZATION"):
|
|
||||||
print("everyones locked in, i'll go fetch your runes!")
|
|
||||||
for member in champselect["myTeam"]:
|
|
||||||
if (member["summonerId"] == userid):
|
|
||||||
champ = member["championId"]
|
champ = member["championId"]
|
||||||
return
|
gettem_runes()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
def gettem_runes():
|
def gettem_runes():
|
||||||
print("fetching the runes...")
|
print(f"setting runes for champ {champ}")
|
||||||
roons = requests.get(f"https://axe.lolalytics.com/mega/?ep=rune&p=d&v=1&cid={champ}&lane=default").json()
|
roons = requests.get(f"https://axe.lolalytics.com/mega/?ep=rune&p=d&v=1&cid={champ}&lane={lane}").json()
|
||||||
|
if not "summary" in roons and lane != "default":
|
||||||
|
print(f"{lane} runes not found, trying default")
|
||||||
|
roons = requests.get(f"https://axe.lolalytics.com/mega/?ep=rune&p=d&v=1&cid={champ}&lane=default").json()
|
||||||
|
if not "summary" in roons:
|
||||||
|
print("runes not found, giving up :(")
|
||||||
|
sys.exit()
|
||||||
roon = roons["summary"]["runes"]["pick"]["set"]
|
roon = roons["summary"]["runes"]["pick"]["set"]
|
||||||
pag = roons["summary"]["runes"]["pick"]["page"]
|
pag = roons["summary"]["runes"]["pick"]["page"]
|
||||||
pri = 8000 + 100 * pag["pri"]
|
pri = [8000, 8100, 8200, 8400, 8300][pag["pri"]]
|
||||||
sub = 8000 + 100 * pag["sec"]
|
sub = [8000, 8100, 8200, 8400, 8300][pag["sec"]]
|
||||||
sel = [*roon["pri"], *roon["sec"], *roon["mod"]]
|
sel = [*roon["pri"], *roon["sec"], *roon["mod"]]
|
||||||
print("setting the runes...")
|
print(f"setting the runes...")
|
||||||
delete_tinyrunes()
|
delete_tinyrunes()
|
||||||
|
print(pri,sel,sub)
|
||||||
make_tinyrunes(pri, sel, sub)
|
make_tinyrunes(pri, sel, sub)
|
||||||
print("all ready! glhf <3")
|
print("ready!")
|
||||||
|
|
||||||
def local_req(type, url, data = ""):
|
def local_req(type, url, data = ""):
|
||||||
if type == "post":
|
if type == "post":
|
||||||
@ -152,5 +135,4 @@ def local_req(type, url, data = ""):
|
|||||||
get_port_and_token()
|
get_port_and_token()
|
||||||
setup_user_id()
|
setup_user_id()
|
||||||
setup_tinyrunes_page()
|
setup_tinyrunes_page()
|
||||||
wait_for_chara()
|
wait_for_chara()
|
||||||
gettem_runes()
|
|
Loading…
Reference in New Issue
Block a user