Пример #1
0
def player_medals(player, gametype):
    player_stats = get_stats(player, gametype)

    medal_result = {}

    medal_result['gold star'] = player_stats.get('first_place', 0)
    medal_result['silver star'] = player_stats.get('second_place', 0)
    medal_result['bronze star'] = player_stats.get('third_place', 0)
    medal_result['chocolate star'] = player_stats.get('last_place', 0)
    medal_result['purple heart'] = player_stats.get('purple', 0)
    medal_result['eternal heart'] = player_stats.get('no death', 0)

    return {'results': medal_result,
            'medals_list': medals_list}
Пример #2
0
def player_badges(player, gametype):
    player_stats = get_stats(player, gametype)
    kills, _, items = get_player_stats(player)

    badge_result = dict([(x, 0) for x in badge_list])
    for badge, limits in badge_list.items():
        if badge in kills['weapon']:
            badge_result[badge] = 0
            for i, l in enumerate(limits):
                if kills['weapon'][badge] > l:
                    badge_result[badge] = i + 1
        elif badge in items:
            badge_result[badge] = 0
            for i, l in enumerate(limits):
                if items[badge] > l:
                    badge_result[badge] = i + 1
        elif badge == 'winner':
            badge_result[badge] = 0
            for i, l in enumerate(limits):
                if player_stats.get('first', 0) > l:
                    badge_result[badge] = i + 1

    return {'results': badge_result}