async def new(ctx): message = "Champions in 'new players rotation':```css\n" list = cass.get_champions() for champion in list: if cass.Champion(name=champion.name).free_to_play_new_players is True: message = message + str(champion.name) + "\t" await ctx.send(message + "```")
async def free(ctx): message = "Champions in 'weekly free rotation':```css\n" list = cass.get_champions() for champion in list: if cass.Champion(name=champion.name).free_to_play is True: message = message + str(champion.name) + "\t" await ctx.send(message + "```")
def test_champion_and_champions_return_same_data(): champions = cassiopeia.get_champions(region="NA") champion = champions[0] from_get_champion = cassiopeia.get_champion(champion.name, region="NA") assert champion == from_get_champion
def test_returns_correct_type(): champion = cassiopeia.get_champion(CHAMP_NAME, region="NA") champions = cassiopeia.get_champions(region="NA") assert isinstance(champion, cassiopeia.Champion) assert isinstance(champions, SearchableList) assert all(isinstance(c, cassiopeia.Champion) for c in champions)
def collectItemUsage(): matchesList = collectMatches() # Start by creating dictionaries of every spell, item, rune, and champion names try: itemUsage = { champion.name: [{ spell.name: 0 for spell in kass.get_summoner_spells(region="NA") }, {item.name: 0 for item in kass.get_items(region="NA")}, {rune.name: 0 for rune in kass.get_runes(region="NA")}] for champion in kass.get_champions(region="NA") } except Warning as err: print(err) for match in matchesList: for player in match.participants: currWin = player.stats.win if (currWin): # Only care if there was a win for the champion currChamp = player.champion.name if player.summoner_spell_d.name in itemUsage[currChamp][0]: itemUsage[currChamp][0][player.summoner_spell_d.name] += 1 if player.summoner_spell_f.name in itemUsage[currChamp][0]: itemUsage[currChamp][0][player.summoner_spell_f.name] += 1 for item in player.stats.items: if item is not None and item.name in itemUsage[currChamp][ 1]: itemUsage[currChamp][1][item.name] += 1 for rune in player.runes: if rune is not None and rune.name in itemUsage[currChamp][ 2]: itemUsage[currChamp][2][rune.name] += 1 return itemUsage
def test_champion_and_champions_return_same_data(): champions = cassiopeia.get_champions() champ = champions[0] from_get_champion = cassiopeia.get_champion(champ.name) assert champ.__dict__ == from_get_champion.__dict__
def get_data(filename=None): # If the value for a role is 0, that is somewhat noticeable in comparison to e.g. 0.1 == 10% # That means when we do the calculation, if the value for e.g. Support for e.g. Lux is value is really low but non-zero, # and Mid for Lux is very high in comparison to Corki (who has Support==0), then Corki will be assigned as support and Lux # as mid. By setting all 0's to -1, this ensures a champion never gets placed in a role they never play. # However, champion.gg only seems to record play rates above 10%, so we should distribute the unaccounted for data over # all the undefined roles. champions = cass.get_champions(region="NA") champion_roles = {} for champion in champions: champion.championgg.load() d = {role: champion.championgg[role].play_rate for role in champion.championgg.roles} champion_roles[champion.id] = d for champion, play_rates in champion_roles.items(): count_missing = 0 total_missing = 1. for role in Role: if role not in play_rates: count_missing += 1 else: total_missing -= champion_roles[champion][role] missing_per_uncounted_role = total_missing / count_missing for role in Role: if role not in play_rates: play_rates[role] = -1. + missing_per_uncounted_role return champion_roles
def test_champion_and_champions_return_same_data(): champions = cassiopeia.get_champions(region="NA") champion = champions[0] from_get_champion = cassiopeia.get_champion(champion.name, region="NA") assert champion == from_get_champion
def test_returns_correct_type(): champion = cassiopeia.get_champion(CHAMP_NAME, region="NA") champions = cassiopeia.get_champions(region="NA") assert isinstance(champion, cassiopeia.Champion) assert isinstance(champions, SearchableList) assert all(isinstance(c, cassiopeia.Champion) for c in champions)
def full_matchups_table(command): counts = collections.defaultdict( lambda: collections.defaultdict(lambda: collections.defaultdict(int))) champion_list = sorted(cass.get_champions(), key=lambda c: c.name) pipeline = command.match_filtering_flags.filter_steps() for match in command.db.matches.aggregate(pipeline): for participant_as in match['participants']: for participant_against in match['participants']: if participant_as['side'] == participant_against['side']: continue stats = counts[participant_as['championId']][ participant_against['championId']] stats['games_played'] += 1 stats['wins'] += participant_as['stats']['win'] table = [] for champ_as in champion_list: row = collections.OrderedDict() row['Champ As vs. Against'] = champ_as.name for champ_against in champion_list: stats = counts[champ_as.id][champ_against.id] if not stats.get('games_played'): row[champ_against.name] = '-' else: win_rate = float(stats['wins']) / stats['games_played'] row[champ_against. name] = f'{stats["wins"]} / {stats["games_played"]} ({100 * win_rate:.3f})' table.append(row) return table
def champ_from_skins() -> Question: champ: Champion = random.choice(riotapi.get_champions()) skins: str = censor_name( '\n'.join([f'- "{skin.name}"' for skin in champ.skins[1:]]), *champ.name.split()) return Question("Which champion's skins are these?", skins, champ.name)
def test_returns_correct_type(): champ = cassiopeia.get_champion(CHAMP_NAME) all_champs = cassiopeia.get_champions() assert isinstance(champ, cassiopeia.Champion) assert isinstance(all_champs, SearchableList) assert all(isinstance(c, cassiopeia.Champion) for c in all_champs)
def champ_from_splash() -> Question: champ: Champion = random.choice(riotapi.get_champions()) # skins[0] is the classic skin skin: Skin = random.choice(champ.skins[1:]) return Question("Which skin is this?", None, skin.name).set_image(url=skin.loading_image_url)
def test_masteries_contains_all_champions(): champions = cassiopeia.get_champions(region="NA") summoner = cassiopeia.get_summoner(name=SUMMONER_NAME, region="NA") champ_masteries = cassiopeia.get_champion_masteries(summoner=summoner.id, region="NA") for cm in champ_masteries: assert cm.champion in champions for champion in champions: assert champion in champ_masteries
def champ_from_spell() -> Question: champ: Champion = random.choice(riotapi.get_champions()) spell: ChampionSpell = random.choice(champ.spells) return Question(f"Which champion has an ability called '{spell.name}'?", None, champ.name, extra=f" ({spell.keyboard_key.name})")
def title_from_champ() -> Question: champ: Champion = random.choice(riotapi.get_champions()) def remove_the(text: str) -> str: return text[3:].strip() if text.lower().startswith("the") else text return Question(f"What is {champ.name}'s title?", None, champ.title, modifier=remove_the)\ .set_thumbnail(url=util.get_image_link(champ.image))
def get_champion_by_name(name: str) -> Tuple[Optional[Champion], int]: """Get a champion by name with fuzzy search. Args: name: Name of champion Returns: Tuple[Optional[Champion], int]: Second element represents the query score (how close it is to the actual value). """ return get_by_name(name, riotapi.get_champions())
def spell_from_desc() -> Question: champ: Champion = random.choice(riotapi.get_champions()) spell: ChampionSpell = random.choice(champ.spells) desc: str = censor_name(util.SANITIZER.handle(spell.description), champ.name, spell.name) return Question("What's the name of this spell?", desc, spell.name, extra=f" ({champ.name} {spell.keyboard_key.name})") \ .set_thumbnail(url=util.get_image_link(spell.image_info))
def test_masteries_contains_all_champions(): champions = cassiopeia.get_champions(region="NA") summoner = cassiopeia.get_summoner(name=SUMMONER_NAME, region="NA") champ_masteries = cassiopeia.get_champion_masteries(summoner=summoner.id, region="NA") for cm in champ_masteries: assert cm.champion in champions for champion in champions: assert champion in champ_masteries
def test_searchable_champion_names(): champions = cassiopeia.get_champions(region="NA") names = [champion.name for champion in champions] for name in names: champion = champions.find(name) assert champion.name == name champion = champions[name] assert champion.name == name
def _run_impl(self, args): if len(args) != 1: return self.print_invalid_usage() summoner_names = args[0].split(',') summoners = [] for name in summoner_names: if not name: print('Summoner name cannot be empty.') return try: summoners.append(cass.Summoner(name=name).load()) except datapipelines.common.NotFoundError: print(f'Summoner "{name}" not found.') return summoners.sort(key=lambda s: s.name) pipeline = self.match_filtering_flags.filter_steps() + [ {'$project': {'participants': True}}, {'$unwind': '$participants'}, {'$match': {'participants.accountId': {'$in': [summoner.account_id for summoner in summoners]}}}, {'$group': {'_id': {'championId': '$participants.championId', 'accountId': '$participants.accountId'}, 'champ_damage': {'$max': '$participants.stats.totalDamageDealtToChampions'}, }}, ] # yapf: disable results = {(result['_id']['championId'], result['_id']['accountId']): result for result in self.db.matches.aggregate(pipeline)} global_pipeline = self.match_filtering_flags.filter_steps() + [ {'$project': {'participants': True}}, {'$unwind': '$participants'}, {'$group': {'_id': {'championId': '$participants.championId'}, 'games_played': {'$sum': 1}, 'champ_damage': {'$max': '$participants.stats.totalDamageDealtToChampions'}, }}, ] # yapf: disable global_results = { result['_id']['championId']: result for result in self.db.matches.aggregate(global_pipeline) } champion_list = cass.get_champions() champ_id_to_name = {champ.id: champ.name for champ in champion_list} table = [] for champ_id, champ_name in sorted(champ_id_to_name.items(), key=lambda t: t[1]): row = collections.OrderedDict({'Champion': champ_name}) for summoner in summoners: row[summoner.name] = self.format_result( results.get((champ_id, summoner.account_id))) row['Global Avg'] = self.format_result( global_results.get(champ_id)) table.append(row) self.table_output_flags.output_table(table)
def test_searchable_champion_names(): champions = cassiopeia.get_champions(region="NA") names = [champion.name for champion in champions] for name in names: champion = champions.find(name) assert champion.name == name champion = champions[name] assert champion.name == name
def test_readme(): summoner = cass.get_summoner(name="Kalturi", region="NA") "{name} is a level {level} summoner on the {region} server.".format(name=summoner.name, level=summoner.level, region=summoner.region) champions = cass.get_champions(region="NA") random_champion = random.choice(champions) "He enjoys playing champions such as {name}.".format(name=random_champion.name) challenger_league = cass.get_challenger_league(queue=cass.Queue.ranked_solo_fives, region="NA") best_na = challenger_league[0].summoner "He's not as good as {name} at League, but probably a better python programmer!".format(name=best_na.name)
def test_readme(): summoner = cass.get_summoner(name="Kalturi", region="NA") "{name} is a level {level} summoner on the {region} server.".format(name=summoner.name, level=summoner.level, region=summoner.region) champions = cass.get_champions(region="NA") random_champion = random.choice(champions) "He enjoys playing champions such as {name}.".format(name=random_champion.name) challenger_league = cass.get_challenger_league(queue=cass.Queue.ranked_solo_fives, region="NA") best_na = challenger_league[0].summoner "He's not as good as {name} at League, but probably a better python programmer!".format(name=best_na.name)
def print_newest_match(name: str, account: int, id: int, region: str): # Notice how this function never makes a call to the summoner endpoint because we provide all the needed data! summoner = Summoner(name=name, account=account, id=id, region=region) # A MatchHistory is a lazy list, meaning it's elements only get loaded as-needed. # match_history = cass.get_match_history(summoner, seasons={Season.season_7}, queues={Queue.ranked_solo_fives}) match_history = summoner.match_history match_history(seasons={Season.season_7}, queues={Queue.ranked_solo_fives}) # Load the entire match history by iterating over all its elements so that we know how long it is. # Unfortunately since we are iterating over the match history and accessing the summoner's champion for each match, # we need to know what version of the static data the champion should have. To avoid pulling many different # static data versions, we will instead create a {champion_id -> champion_name} mapping and just access the champion's # ID from the match data (which it provides directly). champion_id_to_name_mapping = {champion.id: champion.name for champion in cass.get_champions(region=region)} played_champions = Counter() for match in match_history: champion_id = match.participants[summoner.name].champion.id champion_name = champion_id_to_name_mapping[champion_id] played_champions[champion_name] += 1 print("Length of match history:", len(match_history)) # Print the aggregated champion results print("Top 10 champions {} played:".format(summoner.name)) for champion_name, count in played_champions.most_common(10): print(champion_name, count) print() match = match_history[0] print('Match ID:', match.id) p = match.participants[summoner] print("\nSince the match was created from a matchref, we only know one participant:") #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account.id, p.summoner.name, p.summoner.id, p.champion.id) print("\nNow pull the full match data by iterating over all the participants:") for p in match.participants: #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account.id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon) print("\nIterate over all the participants again and note that the data is not repulled:") for p in match.participants: #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account.id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon) print("\nBlue team won?", match.blue_team.win) print("Red team won?", match.red_team.win) print("Participants on blue team:") for p in match.blue_team.participants: print(p.summoner.name)
def print_newest_match(name: str, region: str): summoner = Summoner(name = name, region = region) match_history = summoner.match_history match_history(seasons= {Season.season_9}, queues= {Queue.ranked_solo_fives}) champion_id_to_name_mapping = {champion.id: champion.name for champion in cass.get_champions(region=region)} played_champions = Counter() for match in match_history: champion_id = match.participants[summoner.name].champion.id champion_name = champion_id_to_name_mapping[champion_id] played_champions[champion_name] += 1 print("Length of match history:", len(match_history)) print("Top 10 champions {} played:".format(summoner.name)) for champion_name, count in played_champions.most_common(10): print(champion_name, count) print() match = match_history[0] print('Match ID:', match.id) p = match.participants[summoner] print("\nSince the match was created from a matchref, we only know one participant:") #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id) print("\nNow pull the full match data by iterating over all the participants:") for p in match.participants: #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon, p.runes.keystone.name) print("\nIterate over all the participants again and note that the data is not repulled:") for p in match.participants: #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon, p.runes.keystone.name) print("\nBlue team won?", match.blue_team.win) print("Red team won?", match.red_team.win) print("Participants on blue team:") for p in match.blue_team.participants: print(p.summoner.name, p.champion.name) # Print keystone and the stat runes for each player/champion for p in match.participants: print(p.champion.name, p.runes.keystone.name, *[r.name for r in p.stat_runes])
def print_newest_match(name: str, region: str): # Notice how this function never makes a call to the summoner endpoint because we provide all the needed data! summoner = Summoner(name=name, region=region) # A MatchHistory is a lazy list, meaning it's elements only get loaded as-needed. # match_history = cass.get_match_history(summoner=summoner, seasons={Season.season_8}, queues={Queue.ranked_solo_fives}) match_history = summoner.match_history match_history(seasons={Season.season_8}, queues={Queue.ranked_solo_fives}) # Load the entire match history by iterating over all its elements so that we know how long it is. # Unfortunately since we are iterating over the match history and accessing the summoner's champion for each match, # we need to know what version of the static data the champion should have. To avoid pulling many different # static data versions, we will instead create a {champion_id -> champion_name} mapping and just access the champion's # ID from the match data (which it provides directly). champion_id_to_name_mapping = {champion.id: champion.name for champion in cass.get_champions(region=region)} played_champions = Counter() for match in match_history: champion_id = match.participants[summoner.name].champion.id champion_name = champion_id_to_name_mapping[champion_id] played_champions[champion_name] += 1 print("Length of match history:", len(match_history)) # Print the aggregated champion results print("Top 10 champions {} played:".format(summoner.name)) for champion_name, count in played_champions.most_common(10): print(champion_name, count) print() match = match_history[0] print('Match ID:', match.id) p = match.participants[summoner] print("\nSince the match was created from a matchref, we only know one participant:") #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id) print("\nNow pull the full match data by iterating over all the participants:") for p in match.participants: #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon, p.runes.keystone.name) print("\nIterate over all the participants again and note that the data is not repulled:") for p in match.participants: #print(p.summoner.name, 'playing', p.champion.name) print(p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon, p.runes.keystone.name) print("\nBlue team won?", match.blue_team.win) print("Red team won?", match.red_team.win) print("Participants on blue team:") for p in match.blue_team.participants: print(p.summoner.name)
def _load_skins() -> Dict[str, SkinInfo]: with open("data/skins.json", "r") as f: data: Dict[str, Tuple[str, str]] = json.load(f) skins: Dict[str, SkinInfo] = {} for champ in riotapi.get_champions(): for skin in champ.skins: name = skin.name if skin.name != "default" else f"Classic {champ.name}" price, date = data.get(str(skin.id), (None, None)) currency = "Gemstones" if price and price == 10 else "RP" # SEND HELP skins[name] = SkinInfo(champ, skin, price, currency, date) return skins
def load_all(self, refresh: bool = False): # Save refresh variable so we don't have to pass it into every method self.refresh = refresh if refresh: cassiopeia.configuration.settings.clear_sinks() cassiopeia.configuration.settings.expire_sinks() # Open the download popup, start downloading data and updating the # progress bar as we go progress_popup = hinter.ui.progress.Progress( 0, 'Downloading and processing: Champions') cassiopeia.get_champions() progress_popup.update(70, 'Downloading and processing: Items') cassiopeia.get_items() progress_popup.update(80, 'Downloading and processing: Maps') cassiopeia.get_maps() progress_popup.update(81, 'Downloading and processing: Spells') cassiopeia.get_summoner_spells() progress_popup.update(82, 'Downloading and processing: Runes') cassiopeia.get_runes() progress_popup.update(85, 'Downloading and processing: Rank icons') self.load_rank_icons(refresh) # Inform user data refresh completed, wait, then close the popup progress_popup.update(100, 'Data refresh complete! Window will close') time.sleep(3) progress_popup.close() # Do not update again until this is called, refresh data loaded checks self.refresh = False
def results(): region = "NA" try: summoner_name = str(request.args.getlist('search')[0]) except: summoner_name = "Olysia" cass.set_riot_api_key(os.environ.get("RIOTAPI_KEY", "None")) champion_id_to_name_mapping = { champion.id: champion.name for champion in cass.get_champions(region=region) } # Get summoner summoner = Summoner(name=summoner_name, region=region) # Get Match match_history = summoner.match_history match = match_history[0] # Get items for champion from Match champion_id = match.participants[summoner.name].champion.id champ_img = match.participants[summoner.name].champion.image.url champion_name = champion_id_to_name_mapping[champion_id] items = match.participants[summoner.name].stats.items itemUrls = [] for item in items: # We want to get picture if item is not None: print(item.name) itemUrl = item.image.url itemUrls.append(itemUrl) else: itemUrl = 'static/none.png' itemUrls.append(itemUrl) # display items and champion picture on page return render_template('results.html', url_champ=champ_img, champ_name=champion_name, url_img1=itemUrls[0], url_img2=itemUrls[1], url_img3=itemUrls[2], url_img4=itemUrls[3], url_img5=itemUrls[4], url_img6=itemUrls[5])
def main(): patch = cass.Patch.latest(region="NA") query = """query ($region: String, $language: String, $queue: Int, $tier: String, $role: String, $patch: String) {{ lolChampionsListOverview(region: $region, language: $language, queue: $queue, tier: $tier, role: $role, patch: $patch) {{ champion_id champion {{ name key }} role tier stats {{ winRate pickRate banRate games }} }} }} &variables={{"language":"en","role":"ALL","region":"world","queue":420,"tier":"PLATINUM_PLUS","patch":"{patch}"}} """.format(patch=patch.name) data = requests.get("https://flash.blitz.gg/graphql?query=" + urllib.parse.quote(query, safe="/()=&")).json()["data"]["lolChampionsListOverview"] role_name_map = {"TOP": "TOP", "JUNGLE": "JUNGLE", "MID": "MIDDLE", "ADC": "BOTTOM", "SUPPORT": "UTILITY"} final = {} for datum in data: id = datum["champion_id"] role = role_name_map[datum["role"]] final[id] = { role: { "playRate": datum["stats"]["pickRate"], "winRate": datum["stats"]["winRate"], "banRate": datum["stats"]["banRate"], } } for champion in cass.get_champions(region="NA"): if champion.id not in final: final[champion.id] = {} final = {"data": final, "patch": patch.name} filename = "/home/meraki/code/meraki/Data/champion-rates/rates.json" with open(filename, "w") as f: json.dump(final, f)
def _run_impl(self, args): if len(args) != 0: return self.print_invalid_usage() champ_stats = collections.defaultdict( lambda: dict(games_played=0, top_dmg=0, pct_of_top_dmg=[])) pipeline = self.match_filtering_flags.filter_steps() for match in self.db.matches.aggregate(pipeline): each_dmg = [ p['stats']['totalDamageDealtToChampions'] for p in match['participants'] ] highest_dmg = max(each_dmg) for participant in match['participants']: champ_stats[participant['championId']]['games_played'] += 1 dmg = participant['stats']['totalDamageDealtToChampions'] champ_stats[ participant['championId']]['pct_of_top_dmg'].append( float(dmg) / highest_dmg) if dmg == highest_dmg: champ_stats[participant['championId']]['top_dmg'] += 1 champion_list = cass.get_champions() champ_id_to_name = {champ.id: champ.name for champ in champion_list} table = [] for champ_id, champ_name in sorted(champ_id_to_name.items(), key=lambda t: t[1]): if champ_stats[champ_id]['games_played'] > 0: most_dmg_games = f'{100.0 * champ_stats[champ_id]["top_dmg"] / champ_stats[champ_id]["games_played"] :.3f}%' relative_top_dmg = f'{100.0 * statistics.mean(champ_stats[champ_id]["pct_of_top_dmg"]) :.3f}%' else: most_dmg_games = '-' relative_top_dmg = '-' table.append( collections.OrderedDict([ ('Champion', champ_name), ('Games Played', champ_stats[champ_id]['games_played']), ('Highest Damage Games', most_dmg_games), ('Average Relative Top Damage', relative_top_dmg), ])) self.table_output_flags.output_table(table)
def get_summ(summ="Fodder1969", region="NA"): cass.set_riot_api_key( "RGAPI-18f8d037-17c8-4add-b6b5-0eac3011adb0" ) # This overrides the value set in your configuration/settings. cass.set_default_region("NA") output = {} summoner = cass.get_summoner(name=summ) output[ 'summoner'] = "{name} is a level {level} summoner on the {region} server.".format( name=summoner.name, level=summoner.level, region=summoner.region) champions = cass.get_champions() mastery_champions = summoner.champion_masteries.filter( lambda cm: cm.level >= 6) output['champ'] = "He enjoys playing champions such as {name}.".format( name=[cm.champion.name for cm in mastery_champions]) return output
def get_champions(): champions = cass.get_champions(region="NA") for champion in champions: print( f"{champion.name}: {[role for role in champion.championgg.roles.keys()]}" ) print() lux = Champion(name="Lux", id=99, region="NA") print(lux.name) print(lux.championgg.elo) print(lux.championgg.patch) # Lux mid vs. Lux support win rates print(lux.championgg[RoleGG.middle].win_rate) print(lux.championgg[RoleGG.support].win_rate) # Print a bunch of data print(lux.championgg[RoleGG.support].play_rate) print(lux.championgg[RoleGG.support].play_rate_by_role) print(lux.championgg[RoleGG.support].ban_rate) print(lux.championgg[RoleGG.support].games_played) print(lux.championgg[RoleGG.support].damage_composition) print(lux.championgg[RoleGG.support].kills) print(lux.championgg[RoleGG.support].total_damage_taken) print(lux.championgg[RoleGG.support].neutral_minions_killed_in_team_jungle) print(lux.championgg[RoleGG.support].assists) print( lux.championgg[RoleGG.support].neutral_minions_killed_in_enemy_jungle) print(lux.championgg[RoleGG.support].gold_earned) print(lux.championgg[RoleGG.support].deaths) print(lux.championgg[RoleGG.support].minions_killed) print(lux.championgg[RoleGG.support].total_healed) # Get matchup data for Lux mid # (This takes a minute to run the first time but is ~ instantaneous thereafter) for matchup in lux.championgg[RoleGG.middle].matchups: if matchup.nmatches > 100: print( f"{matchup.enemy.champion.name}: {round(matchup.winrate*100)}% ({matchup.nmatches} matches analyzed)" )
def test_match(): name = "Kalturi" account = 34718348 id = 21359666 region = "NA" summoner = Summoner(name=name, account=account, id=id, region=region) match_history = cass.get_match_history(summoner, queues={Queue.ranked_solo_fives}) match_history = summoner.match_history match_history(seasons={Season.season_7}, queues={Queue.ranked_solo_fives}) champion_id_to_name_mapping = {champion.id: champion.name for champion in cass.get_champions(region=region)} played_champions = Counter() for match in match_history: champion_id = match.participants[summoner.name].champion.id champion_name = champion_id_to_name_mapping[champion_id] played_champions[champion_name] += 1 for champion_name, count in played_champions.most_common(10): champion_name, count match = match_history[0] match.id p = match.participants[summoner] p.id, p.summoner.region, p.summoner.account.id, p.summoner.name, p.summoner.id, p.champion.id for p in match.participants: p.id, p.summoner.region, p.summoner.account.id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon for p in match.participants: p.id, p.summoner.region, p.summoner.account.id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon match.blue_team.win match.red_team.win for p in match.blue_team.participants: p.summoner.name
def test_match(): name = "Kalturi" region = "NA" summoner = Summoner(name=name, region=region) match_history = cass.get_match_history(summoner, queues={Queue.ranked_solo_fives}) match_history = summoner.match_history match_history(seasons={Season.season_7}, queues={Queue.ranked_solo_fives}) champion_id_to_name_mapping = {champion.id: champion.name for champion in cass.get_champions(region=region)} played_champions = Counter() for match in match_history: champion_id = match.participants[summoner.name].champion.id champion_name = champion_id_to_name_mapping[champion_id] played_champions[champion_name] += 1 for champion_name, count in played_champions.most_common(10): champion_name, count match = match_history[0] match.id p = match.participants[summoner] p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id for p in match.participants: p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon for p in match.participants: p.id, p.summoner.region, p.summoner.account_id, p.summoner.name, p.summoner.id, p.champion.id, p.team.first_dragon match.blue_team.win match.red_team.win for p in match.blue_team.participants: p.summoner.name
def test_release_dates(): champions = cassiopeia.get_champions(region="NA") for champion in champions: champion.release_date
def _init_champions(all_champions=None): if not all_champions: all_champions = cass.get_champions() Build._champions_by_id = {champion.id: Champion(champion) for champion in all_champions} Build._champions_by_name = {champion.name: champion for _, champion in Build._champions_by_id.items()}