def player_stats(p, stage): reply = None player_name = PLAYERS.get(p.lower(), p).lower() if stage == 0: # show stats for all stages for player in STATS: if player['name'].lower() == player_name: reply = PLAYER_RESPONSE.format( player['name'], player['role'].title(), TEAMS.get(player['team'], player['team']), player['eliminations_avg_per_10m'], player['deaths_avg_per_10m'], player['hero_damage_avg_per_10m'], player['healing_avg_per_10m'], player['ultimates_earned_avg_per_10m'], player['final_blows_avg_per_10m'], player['time_played_total'] / 60 / 60) + FOOTER break else: for player in STAGE_STATS[stage - 1]: if player['name'].lower() == player_name: reply = PLAYER_RESPONSE.format( player['name'] + ' in Stage ' + str(stage), player['role'].title(), TEAMS.get(player['team'], player['team']), player['eliminations_avg_per_10m'], player['deaths_avg_per_10m'], player['hero_damage_avg_per_10m'], player['healing_avg_per_10m'], player['ultimates_earned_avg_per_10m'], player['final_blows_avg_per_10m'], player['time_played_total'] / 60 / 60) + FOOTER break return reply
def player_comparison(p1, p2, stage): reply = None player1, player2 = None, None player1_name = PLAYERS.get(p1.lower(), p1).lower() player2_name = PLAYERS.get(p2.lower(), p2).lower() if stage == 0: for player in STATS: if player['name'].lower() == player1_name: player1_name = player['name'] player1 = player if player['name'].lower() == player2_name: player2_name = player['name'] player2 = player else: for player in STAGE_STATS[stage - 1]: if player['name'].lower() == player1_name: player1_name = player['name'] player1 = player if player['name'].lower() == player2_name: player2_name = player['name'] player2 = player if player1 is not None and player2 is not None: reply = COMPARISON_RESPONSE.format( player1_name, player2_name + ' in Stage ' + str(stage), player1_name, player1['role'].title(), TEAMS.get(player1['team'], player1['team']), player2_name, player2['role'].title(), TEAMS.get(player2['team'], player2['team']), player1_name, player2_name, player1['eliminations_avg_per_10m'], player2['eliminations_avg_per_10m'], player1['deaths_avg_per_10m'], player2['deaths_avg_per_10m'], player1['hero_damage_avg_per_10m'], player2['hero_damage_avg_per_10m'], player1['healing_avg_per_10m'], player2['healing_avg_per_10m'], player1['ultimates_earned_avg_per_10m'], player2['ultimates_earned_avg_per_10m'], player1['final_blows_avg_per_10m'], player2['final_blows_avg_per_10m'], player1['time_played_total'] / 60 / 60, player2['time_played_total'] / 60 / 60) + FOOTER return reply