def minions_per_game(name): urls = history.gen_urls(name) minions = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: minions[item['gameId']] = item['participants'][0]['stats']['totalMinionsKilled'] return minions
def cc_per_game(name): urls = history.gen_urls(name) cc = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: cc[item['gameId']] = round(float(item['participants'][0]['stats']['totalTimeCrowdControlDealt'])/60.,2) return cc
def duration(name): urls = history.gen_urls(name) duration = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: duration[item['gameId']] = round(float(item['gameDuration'])/60.,2) return duration
def winloss(name): urls = history.gen_urls(name) win_loss = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: win_loss[item['gameId']] = item['participants'][0]['stats']['win'] return win_loss
def gameids(name): urls = history.gen_urls(name) ids = [] for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: ids.append(item['gameId']) return ids
def champions(name): ids = pickle.load(open('champions.p','rb')) urls = history.gen_urls(name) champs = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: champs[item['gameId']] = ids[str(item['participants'][0]['championId'])] return champs
def overall_kda(name): urls = history.gen_urls(name) KDA = {'kills': 0, 'assists': 0, 'deaths': 0} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: KDA['kills'] = KDA['kills'] + item['participants'][0]['stats']['kills'] KDA['deaths'] = KDA['deaths'] + item['participants'][0]['stats']['deaths'] KDA['assists'] = KDA['assists'] + item['participants'][0]['stats']['assists'] return KDA
def turrets_inhibitors_per_game(name): urls = history.gen_urls(name) turrets_inhibitors = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: per_game = {} per_game['turrets'] = item['participants'][0]['stats']['turretKills'] per_game['inhibitors'] = item['participants'][0]['stats']['inhibitorKills'] turrets_inhibitors[item['gameId']] = per_game return turrets_inhibitors
def vision_per_game(name): urls = history.gen_urls(name) vision = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: vision_game = {} vision_game['placed'] = item['participants'][0]['stats']['wardsPlaced'] vision_game['killed'] = item['participants'][0]['stats']['wardsKilled'] vision[item['gameId']] = vision_game return vision
def gold_per_game(name): urls = history.gen_urls(name) gold = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: game_gold = {} game_gold['goldEarned'] = item['participants'][0]['stats']['goldEarned'] game_gold['goldSpent'] = item['participants'][0]['stats']['goldSpent'] gold[item['gameId']] = game_gold return gold
def role_and_lane(name): urls = history.gen_urls(name) rolelane = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: game = {} game['role'] = item['participants'][0]['timeline']['role'] game['lane'] = item['participants'][0]['timeline']['lane'] rolelane[item['gameId']] = game return rolelane
def neutrals_per_game(name): urls = history.gen_urls(name) neutrals = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: per_game = {} # blue side - baron, red side - dragon per_game['total'] = item['participants'][0]['stats']['neutralMinionsKilled'] per_game['team jungle'] = item['participants'][0]['stats']['neutralMinionsKilledTeamJungle'] per_game['enemy jungle'] = item['participants'][0]['stats']['neutralMinionsKilledEnemyJungle'] neutrals[item['gameId']] = per_game return neutrals
def damage_taken_per_game(name): urls = history.gen_urls(name) damage = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: per_game = {} per_game['total'] = item['participants'][0]['stats']['totalDamageTaken'] per_game['magic'] = item['participants'][0]['stats']['magicalDamageTaken'] per_game['physical'] = item['participants'][0]['stats']['physicalDamageTaken'] per_game['true'] = item['participants'][0]['stats']['trueDamageTaken'] damage[item['gameId']] = per_game return damage
def perten_per_game(name): urls = history.gen_urls(name) diffs = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: per_game = {} per_game['cs per 10'] = item['participants'][0]['timeline']['creepsPerMinDeltas'] if 'csDiffPerMinDeltas' in item['participants'][0]['timeline'].keys(): per_game['cs diff per 10'] = item['participants'][0]['timeline']['csDiffPerMinDeltas'] else: per_game['cs diff per 10'] = "No enemy laner" diffs[item['gameId']] = per_game return diffs
def kda_per_game(name): urls = history.gen_urls(name) KDA = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: game_kda = {} game_kda['assists'] = item['participants'][0]['stats']['assists'] game_kda['deaths'] = item['participants'][0]['stats']['deaths'] game_kda['kills'] = item['participants'][0]['stats']['kills'] if game_kda['deaths'] != 0: game_kda['kda'] = round(float(game_kda['kills'] + game_kda['assists'])/float(game_kda['deaths']),2) else: # need to tweek this game_kda['kda'] = round(float(game_kda['kills'] + game_kda['assists']),2) KDA[item['gameId']] = game_kda return KDA
def kills_per_game(name): urls = history.gen_urls(name) kills = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: kills_game = {} # consecutive kills before death kills_game['largest spree'] = item['participants'][0]['stats']['largestKillingSpree'] # largest number of kills in a period of time kills_game['largest multikill'] = item['participants'][0]['stats']['largestMultiKill'] kills_game['killingsprees'] = item['participants'][0]['stats']['killingSprees'] kills_game['double'] = item['participants'][0]['stats']['doubleKills'] kills_game['triple'] = item['participants'][0]['stats']['tripleKills'] kills_game['quadra'] = item['participants'][0]['stats']['quadraKills'] kills_game['penta'] = item['participants'][0]['stats']['pentaKills'] kills[item['gameId']] = kills_game return kills
def firsts(name): urls = history.gen_urls(name) first = {} for i in range(0,len(urls)): data = history.data_gen(urls[i]) for item in data['games']['games']: per_game = {} per_game['first kill'] = item['participants'][0]['stats']['firstBloodKill'] # i think the API is broken. no one ever has first blood assist # per_game['first kill assist'] = item['participants'][0]['stats']['firstBloodAssist'] per_game['first turret'] = item['participants'][0]['stats']['firstTowerKill'] per_game['first turret assist']= item['participants'][0]['stats']['firstTowerAssist'] # for some reason, firstinhibitorkill/assist disappear when you put the data in a for loop. idk why. # if you manually do data[0], data[1], etc. it shows up, but not in a for loop # per_game['first inhibitor'] = item['participants'][0]['stats']['firstInhibitorKill'] # per_game['first inhibitor assist'] = item['participants'][0]['stats']['firstInhibitorAssist'] first[item['gameId']] = per_game return first