probably fix setting wrong runes?
This commit is contained in:
parent
f77210b588
commit
7ffda41ba3
58
main.py
58
main.py
@ -7,6 +7,7 @@ token = 0
|
||||
page = 0
|
||||
userid = 0
|
||||
champ = 0
|
||||
lane = "default"
|
||||
|
||||
urllib3.disable_warnings()
|
||||
|
||||
@ -85,54 +86,36 @@ def delete_tinyrunes():
|
||||
def wait_for_chara():
|
||||
global champ
|
||||
done = False
|
||||
state = 0 # 0 = waiting for champ select,
|
||||
# 1 = waiting for champ pick
|
||||
# 2 = waiting for lock in,
|
||||
print("waiting for you to enter champion select...!")
|
||||
print("ready to grab you some runes~")
|
||||
while (not done):
|
||||
champselect = local_req("get", "lol-champ-select/v1/session")
|
||||
if (state == 0):
|
||||
if ("errorCode" in champselect):
|
||||
#wait to enter champ select...
|
||||
pass
|
||||
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):
|
||||
if ("myTeam" in champselect):
|
||||
for member in champselect["myTeam"]:
|
||||
if (member["summonerId"] == userid and member["championId"] != 0):
|
||||
if (member["championId"] != champ):
|
||||
champ = member["championId"]
|
||||
return
|
||||
gettem_runes()
|
||||
time.sleep(1)
|
||||
|
||||
def gettem_runes():
|
||||
print("fetching the runes...")
|
||||
roons = requests.get(f"https://axe.lolalytics.com/mega/?ep=rune&p=d&v=1&cid={champ}&lane=default").json()
|
||||
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={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"]
|
||||
pag = roons["summary"]["runes"]["pick"]["page"]
|
||||
pri = 8000 + 100 * pag["pri"]
|
||||
sub = 8000 + 100 * pag["sec"]
|
||||
pri = [8000, 8100, 8200, 8400, 8300][pag["pri"]]
|
||||
sub = [8000, 8100, 8200, 8400, 8300][pag["sec"]]
|
||||
sel = [*roon["pri"], *roon["sec"], *roon["mod"]]
|
||||
print("setting the runes...")
|
||||
print(f"setting the runes...")
|
||||
delete_tinyrunes()
|
||||
print(pri,sel,sub)
|
||||
make_tinyrunes(pri, sel, sub)
|
||||
print("all ready! glhf <3")
|
||||
print("ready!")
|
||||
|
||||
def local_req(type, url, data = ""):
|
||||
if type == "post":
|
||||
@ -153,4 +136,3 @@ get_port_and_token()
|
||||
setup_user_id()
|
||||
setup_tinyrunes_page()
|
||||
wait_for_chara()
|
||||
gettem_runes()
|
Loading…
Reference in New Issue
Block a user