-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame
48 lines (34 loc) · 1.23 KB
/
game
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
import fire
from riotwatcher import TftWatcher, LolWatcher
from rich import print
from rich import pretty
riot_api_key = 'RGAPI-06dd63db-9a07-4a26-aef4-4a44ac21f7dc'
tft_watcher = TftWatcher(riot_api_key)
lol_watcher = LolWatcher(riot_api_key)
tagline = 'NA1'
region = 'na1'
count = int(20)
start = int(0)
placements = []
def match_hist(player_name):
me = lol_watcher.summoner.by_name(region, player_name)
puuid = me.get('puuid')
match_list = tft_watcher.match.by_puuid(region, puuid, count, start)
match_index = start
while match_index < 5:
game_stats = tft_watcher.match.by_id(region, match_list[match_index])
info_dict = game_stats.get('info')
participant_list = info_dict.get('participants')
metadata = game_stats.get('metadata')
puuid_list = metadata.get("participants")
player_number = 0
for index, player in enumerate(puuid_list):
if player == puuid:
player_number = index
break
place = participant_list[player_number].get('placement')
placements.append(place)
match_index += 1
print("This player's recent 5 placements are", placements)
if __name__ == '__main__':
fire.Fire(match_hist)