Пример #1
0
def filter_match_history(summoner, patch):
    #match_history = MatchHistory(summoner=summoner, begin_time=patch.start, end_time=patch.end, queue=Queue.ranked_solo.value)
    match_history = MatchHistory(summoner=summoner)
    match_history.filter(
        lambda match: match.creation > patch.start and match.creation < patch.
        end and match.queue is Queue.ranked_solo)
    return match_history
Пример #2
0
def filter_match_history(summoner, patch):
    end_time = patch.end
    if end_time is None:
        end_time = arrow.now()

    match_history = MatchHistory(summoner=summoner, queues = {Queue.ranked_solo_fives}, begin_time = patch.start, end_time = end_time)

    return match_history
def filter_match_history(summoner, patch):
    end_time = patch.end
    if end_time is None:
        end_time = arrow.now()
    match_history = MatchHistory(summoner=summoner,
                                 queues={queueType},
                                 begin_time=patch.start,
                                 end_time=end_time)
    return match_history
Пример #4
0
def filter_match_history(summoner, patch):
    end_time = patch.end
    if end_time is None:
        end_time = datetime.datetime.now()
    match_history = MatchHistory(summoner=summoner,
                                 region=summoner.region,
                                 queues={Queue.aram},
                                 begin_time=patch.start,
                                 end_time=end_time)
    return match_history
Пример #5
0
def fetchMatchHistory(name, region, stream_start_time):
    player = cass.Summoner(name=name, region=region)
    start_time = arrow.get(stream_start_time)
    end_time = arrow.now()
    match_history = MatchHistory(summoner=player,
                                 begin_time=start_time,
                                 end_time=end_time)

    match_data = []

    # OPEN matchCLip.json
    """
    with open('matchClip.json') as clip_record:    
        clips = json.load(clip_record)
    """
    for match in match_history:
        #print(match.id)
        p = match.participants[player]
        #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.account.id, p.summoner.region, p.participantstats.kills, p.participantstats.deaths, p.participantstats.assists)
        match_dict = {}
        try:
            match_dict.update({
                'match_id': match.id,
                'win': p.stats.win,
                'kills': p.stats.kills,
                'deaths': p.stats.deaths,
                'assists': p.stats.assists,
                'champion_id': p.champion.id,
                'champion_name': p.champion.name,
                'clips': clips[match.id]
            })
        except:
            match_dict.update({
                'match_id': match.id,
                'win': p.stats.win,
                'kills': p.stats.kills,
                'deaths': p.stats.deaths,
                'assists': p.stats.assists,
                'champion_id': p.champion.id,
                'champion_name': p.champion.name,
                'clips': ''
            })
        match_data.append(match_dict)
        print(match.id, p.stats.win, p.stats.kills, p.stats.deaths,
              p.stats.assists, p.champion.id, p.champion.name)
        #print(p.summoner.region, p.summoner.account.id, p.summoner.name, p.summoner.id, p.champion.id, p.ParticipantStatsData.kills)
    # CLOSE matchClip.json
    print(match_data)
    return match_data
Пример #6
0
 def load_summoner(self, summoner):
     summoner.load()
     start_time = config["match-filter"]["begin-time"]
     now = arrow.utcnow()
     if start_time < 0:
         start_time = now.shift(seconds=start_time)
     else:
         start_time = arrow.get(start_time)
     match_history = MatchHistory(summoner=summoner, queues=self.queues)
     for match in match_history:
         if(match.creation.to("UTC") > start_time):
             self.manager.add_match(match)
         else:
             break
Пример #7
0
def filterHistory(summoner, patch):
    # This is the timeframe we want to pull matches from, based ofn patch versions
    endTime = patch.end
    if endTime is None:
        endTime = arrow.now(
        )  # If there is an issue with the most recent patch, we'll go until current time
    try:
        matchHistory = MatchHistory(summoner=summoner,
                                    queues={Queue.ranked_flex_fives},
                                    begin_time=patch.start,
                                    end_time=endTime)
    except:
        print("Could not retrieve match history, retrying in 10s")
        time.sleep(10)
        filterHistory(summoner, patch)
    return matchHistory
Пример #8
0
def filter_match_history(summoner: Summoner, patch: Patch) -> MatchHistory:
    '''
    Filters the match history of a summoner to solo q matches and the specified patch

            Parameters:
                    summoner (Summoner): the summoner we want to filter the match history of
                    patch (Patch): the patch we want the filtered matches to be of

            Returns:
                match_history (MatchHistory): the filtered match history
    '''

    end_time: arrow.arrow.Arrow = patch.end
    if end_time is None:
        end_time = arrow.now()
    match_history: MatchHistory = MatchHistory(summoner=summoner, queues={Queue.ranked_solo_fives}, begin_time=patch.start, end_time=end_time)
    return match_history
begin_data = datetime.strptime("08/01/20 00:00", "%d/%m/%y %H:%M")
end_data = datetime.now()

players = {
    "faker": ["Hide on Bush"],
    # short_name: exact summoner name, list for more than one
}
for player_name, player_accounts in players.items():
    matchups: Dict[str, Matchup] = {}
    if os.path.isfile(f"{player_name}.csv"):
        continue
    for account in player_accounts:
        summoner = cass.get_summoner(name=account, region=Region.europe_west)
        match_history = MatchHistory(
            summoner=summoner,
            begin_time=arrow.get(begin_data.timestamp()),
            end_time=arrow.get(end_data.timestamp()),
            queues={Queue.ranked_solo_fives, Queue.ranked_flex_fives},
        )
        for match in match_history:
            participant = match.participants[account]
            if participant.champion.name in matchups.keys():
                matchups[participant.champion.name].update(
                    participant, match.duration)
            else:
                matchups[participant.champion.name] = Matchup(
                    participant, match.duration)
    df = pd.DataFrame([m.to_dict() for m in matchups.values()
                       ]).sort_values("games", ascending=False)
    df.to_csv(f"{player_name}.csv", index=False)