Exemple #1
0
def get_spectator_matches(df, champions_data):
    featured_matches = cass.get_featured_matches(region="EUW")
    starting_patch = Patch.from_str("9.16", region="EUW")

    for new_match in featured_matches:
        if new_match.queue.id == 420 and df[df['match_id'] ==
                                            new_match.id].shape[0] == 0:
            match = {'match_id': int(new_match.id)}
            participants = new_match.blue_team.participants + new_match.red_team.participants
            for (p, id) in zip(participants, range(1, 11)):
                current_summoner = Summoner(id=p.summoner.id, region="EUW")

                match[f'{id}_kda'], match[f'{id}_winrate'] = get_average_kda(
                    current_summoner, starting_patch,
                    new_match.creation.shift(minutes=-10), p.champion.id)

                cm = cass.get_champion_mastery(champion=p.champion.id,
                                               summoner=current_summoner,
                                               region="EUW")
                match[f'{id}_cm_points'] = int(cm.points)

                champion_data = champions_data[champions_data['name'] ==
                                               p.champion.name].winrate
                match[f'{id}_champion_winrate'] = champion_data.iloc[0]

            match_series = pd.Series(match)

            df = df.append(match_series, ignore_index=True)
            df.to_csv('spectator_data.csv', index=None, header=True)
Exemple #2
0
def get_spectator_matches():
    featured_matches = cass.get_featured_matches("NA")
    for match in featured_matches:
        print(match.region, match.id)

    match = featured_matches[0]
    a_summoner_name = match.blue_team.participants[0].summoner_name
    summoner = Summoner(name=a_summoner_name, region=match.region)
    current_match = summoner.current_match
    print(current_match.map)
def test_spectator():
    featured_matches = cass.get_featured_matches(region="NA")
    for match in featured_matches:
        match.region, match.id

    match = featured_matches[0]
    a_summoner_name = match.blue_team.participants[0].summoner.name
    match.queue
    summoner = Summoner(name=a_summoner_name, region=match.region)
    current_match = summoner.current_match
    current_match.map.name

    for participant in current_match.blue_team.participants:
        participant.summoner.name
def get_spectator_matches():
    featured_matches = cass.get_featured_matches(region="NA")
    for match in featured_matches:
        print(match.region, match.id)

    match = featured_matches[0]
    a_summoner_name = match.blue_team.participants[0].summoner.name
    print(match.queue)
    summoner = Summoner(name=a_summoner_name, region=match.region)
    current_match = summoner.current_match
    print(current_match.map.name)

    for participant in current_match.blue_team.participants:
        print(participant.summoner.name)
def test_spectator():
    featured_matches = cass.get_featured_matches(region="NA")
    for match in featured_matches:
        match.region, match.id

    match = featured_matches[0]
    a_summoner_name = match.blue_team.participants[0].summoner.name
    match.queue
    summoner = Summoner(name=a_summoner_name, region=match.region)
    current_match = summoner.current_match
    current_match.map.name

    for participant in current_match.blue_team.participants:
        participant.summoner.name