-
Notifications
You must be signed in to change notification settings - Fork 0
/
modes.py
111 lines (95 loc) · 4.72 KB
/
modes.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
107
108
109
110
111
from utilities import fetchConfig
from cdngen import assetsLink, defaultTileLink, tftImg, mapIcon, animatedSplashUrl
from time import time
async def updateInProgressRPC(currentChamp, mapData, mapIconData, queueData, gameData, internalName, displayName, connection, summonerId, discStrings, animatedSplashIds, RPC):
# TFT
if mapData["mapStringId"] == "TFT":
if fetchConfig("useSkinSplash"):
compData = (await (await connection.request('get', '/lol-cosmetics/v1/inventories/tft/companions')).json())["selectedLoadoutItem"]
RPC.update(details = f"{mapData['name']} ({queueData['description']})", \
large_image = tftImg(compData["loadoutsIcon"]), \
large_text = compData['name'], \
state = discStrings["inGame"], \
start = time(), \
buttons = ([{"label": "View Splash Art", "url": tftImg(compData["loadoutsIcon"])}] if fetchConfig("showViewArtButton") else None))
else:
RPC.update(details = f"{mapData['name']} ({queueData['description']})", \
large_image = mapIcon(mapIconData), \
large_text = mapData['name'], \
state = discStrings["inGame"], \
start = time())
# Swarm
elif mapData["id"] == 33:
# Swarm 2024 champs
champIdNames = {
3147: 92,
3151: 222,
3152: 89,
3153: 147,
3156: 233,
3157: 157,
3159: 893,
3678: 420,
3947: 498
}
champId = currentChamp[0]
tileLink = defaultTileLink(champId)
skinName = (await (await connection.request('get', f'/lol-champions/v1/inventories/{summonerId}/champions/{champIdNames[champId]}')).json())["name"]
RPC.update(details = f"{mapData['name']} (PvE)", \
large_image = tileLink, \
large_text = skinName, \
state = discStrings["inGame"], \
start = time())
# Others
else:
champId = currentChamp[0]
skinId = currentChamp[1] if fetchConfig("useSkinSplash") else champId * 1000
champSkins = await (await connection.request('get', f'/lol-champions/v1/inventories/{summonerId}/champions/{champId}/skins')).json()
for champSkin in champSkins:
_ok = False
for skinTier in champSkin["questSkinInfo"]["tiers"]:
if skinTier["id"] == skinId:
skinName = skinTier["name"]
animatedSplashLink = skinTier["collectionSplashVideoPath"]
if skinTier["isBase"]:
tileLink = defaultTileLink(champId)
else:
tileLinkraw = skinTier["tilePath"]
tileLink = assetsLink(tileLinkraw)
splashLink = assetsLink(skinTier["uncenteredSplashPath"])
_ok = True
break
if _ok: break
if champSkin["id"] == skinId:
skinName = champSkin["name"]
animatedSplashLink = champSkin["collectionSplashVideoPath"]
if champSkin["isBase"]:
tileLink = defaultTileLink(champId)
else:
tileLinkraw = champSkin["tilePath"]
tileLink = assetsLink(tileLinkraw)
splashLink = assetsLink(champSkin["uncenteredSplashPath"])
break
for chroma in champSkin["chromas"]:
if chroma["id"] == skinId:
skinName = champSkin["name"]
skinId = champSkin["id"]
animatedSplashLink = champSkin["collectionSplashVideoPath"]
if champSkin["isBase"]:
tileLink = defaultTileLink(champId)
else:
tileLinkraw = champSkin["tilePath"]
tileLink = assetsLink(tileLinkraw)
splashLink = assetsLink(champSkin["uncenteredSplashPath"])
_ok = True
break
if _ok: break
if animatedSplashLink and skinId in animatedSplashIds and fetchConfig("animatedSplash"):
tileLink = animatedSplashUrl(skinId)
splashLink = assetsLink(animatedSplashLink)
RPC.update(details = f"{mapData['name']} ({queueData['description']})", \
large_image = tileLink, \
large_text = skinName, \
state = discStrings["inGame"], \
start = time(),
buttons = ([{"label": "View Splash Art", "url": splashLink}] if fetchConfig("showViewArtButton") else None))