-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstacks.py
63 lines (46 loc) · 1.92 KB
/
stacks.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
from leagueapi import LolAPI
from secrets import API_KEY
api = LolAPI(API_KEY, 'americas')
homies = ['Mahat Magandalf', 'Dahlin', '4th Migo', 'Kabib Nurmagabob', 'Lacr3188', 'Eminems Sweater', 'GROBGOBGLOBGROD']
homies_puuid = [api.getPUUID(homie, 'NA1') for homie in homies]
def getStacks(matchJson):
"""specific match info"""
playerMetrics = []
gameMode = matchJson['info']['gameMode']
for p in matchJson['info']['participants']:
stats = {}
stats['puuid'] = p['puuid']
stats['summonerName'] = p['summonerName']
stats['championName'] = p['championName']
stats['totalDamageDealtToChampions'] = p['totalDamageDealtToChampions']
stats['kills'] = p['kills']
stats['deaths'] = p['deaths']
stats['assists'] = p['assists']
stats['win'] = p['win']
if p['perks']['styles'][0]['selections'][0]['perk'] == 8128:
stats['DH Damage'] = p['perks']['styles'][0]['selections'][0]['var1']
stats['DH Stacks'] = p['perks']['styles'][0]['selections'][0]['var2']
else:
stats['DH Stacks'] = None
stats['DH Damage'] = None
playerMetrics.append(stats)
return playerMetrics
puuid = api.getPUUID('Mahat Magandalf', 'NA1')
match_ids = api.getMatchIdList(puuid, 100)
winner = None
for match_id in match_ids:
match = api.getMatchInfo(match_id)
gameMode = match['info']['gameMode']
if gameMode != 'ARAM':
continue
stacksInfo = getStacks(match)
max_stacks = 0
for stacker in stacksInfo:
if stacker['DH Stacks'] is not None and stacker['DH Stacks'] >= max_stacks and stacker['puuid'] in homies_puuid:
if stacker['DH Stacks'] == max_stacks:
if stacker['totalDamageDealtToChampions'] < winner['totalDamageDealtToChampions']:
continue
winner = stacker
max_stacks = stacker['DH Stacks']
break
print(winner)