Created
October 17, 2023 22:04
-
-
Save bangingheads/e1e5f6aa9ee9ca74d84edc8874d04a59 to your computer and use it in GitHub Desktop.
Show skin shards for champion's without a skin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pprint import pprint | |
from lcu_driver import Connector | |
import requests | |
import easygui | |
connector = Connector() | |
@connector.ready | |
async def connect(connection): | |
version = requests.get("https://ddragon.leagueoflegends.com/api/versions.json").json()[0] | |
ddragon = requests.get(f"https://ddragon.leagueoflegends.com/cdn/{version}/data/en_US/championFull.json").json() | |
champs = ddragon['keys'] | |
summ = await connection.request('get', "/lol-summoner/v1/current-summoner") | |
summ = await summ.json() | |
summ_id = summ['summonerId'] | |
ownership = { | |
champ: { | |
"owned": False, | |
"skins": 0, | |
"unlockable": [] | |
} for champ in champs.keys() | |
} | |
for champ_id in champs.keys(): | |
champ_data = await connection.request('get', f"/lol-champions/v1/inventories/{summ_id}/champions/{champ_id}") | |
if champ_data.status != 200: | |
continue | |
champ_data = await champ_data.json() | |
ownership[champ_id]['owned'] = champ_data['ownership']['owned'] | |
if champ_data['ownership']['owned']: | |
for skin in champ_data['skins']: | |
if skin['ownership']['owned'] and skin['isBase'] != True: | |
ownership[champ_id]['skins'] += 1 | |
loots = await connection.request('get', f"/lol-loot/v1/player-loot") | |
loots = await loots.json() | |
for loot in loots: | |
if loot['displayCategories'] == "SKIN": | |
champ = str(loot['storeItemId'])[:-3] | |
if loot['parentItemStatus'] == "OWNED" and ownership[champ]['skins'] == 0: | |
ownership[champ]['unlockable'].append(loot['itemDesc']) | |
display = "" | |
for key, data in ownership.items(): | |
if data['owned'] == True and data['skins'] == 0 and len(data['unlockable']) > 0: | |
display += ddragon['data'][ddragon['keys'][key]]['name'] + "\n" + "\n".join(data['unlockable']) + "\n\n" | |
easygui.msgbox(display, title="Champions With 0 Skins That Can Unlock", ok_button="Go Unlock Some Skins!") | |
connector.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment