Exemplo n.º 1
0
    def __init__(self, tick, values):
        BaseEvent.__init__(self, tick, values, 2)

        self.team = model_mgr.get_team(values[0])
        self.value = int(values[1])

        event_mgr.get_history(self.team).add_event(self)
Exemplo n.º 2
0
    def __init__(self, tick, values):
        BaseEvent.__init__(self, tick, values, 2)

        self.team = model_mgr.get_team(values[0])
        self.condition_id = values[1]

        event_mgr.get_history(self.team).add_event(self)
Exemplo n.º 3
0
    def on_death(self, e):

        # Get the commander for the player's team
        team = model_mgr.get_team(e.player.team_id)
        commander = model_mgr.get_player(team.commander_id)

        # Give a point to the commander
        self.results[commander] += 1
Exemplo n.º 4
0
    def __init__(self, tick, values):
        BaseEvent.__init__(self, tick, values, 2)

        self.player = model_mgr.get_player_by_name(values[0])
        self.team = model_mgr.get_team(values[1])

        event_mgr.get_history(self.player).add_event(self)
        event_mgr.get_history(self.team).add_event(self)
Exemplo n.º 5
0
    def get_team(self, id):
        '''
        Provides details for a specific team based on the given team identifier.

        Args:
           id (string): The unique identifier of a team.

        Returns:
            team (object): Detailed information for a specific team.
        '''

        # Get the model for the requested team
        team = model_mgr.get_team(id)
        if not team: raise cherrypy.HTTPError(404)

        # Get the stats for the requested team
        team_stats = stat_mgr.get_team_stats(team)

        # Build a list of column descriptors
        columns = [{
            'name': 'Players',
            'data': 'player'
        }, {
            'name': 'Score',
            'data': 'number',
            'sorted': False
        }, {
            'name': 'Kills',
            'data': 'number'
        }, {
            'name': 'Deaths',
            'data': 'number'
        }]

        # Build a list of team statistics
        rows = list()
        for player in team_stats.players:
            if player != models.players.EMPTY:
                object_stats = team_stats.players[player]
                player_tuple = {
                    'id': player.id,
                    'name': player.name,
                    'photo': player.photo_s
                }
                rows.append([
                    player_tuple, object_stats.score, object_stats.kills,
                    object_stats.deaths
                ])

        # Sort the results by score
        rows.sort(key=lambda r: r[1], reverse=True)

        return {
            'id': team.id,
            'name': team.name,
            'columns': columns,
            'rows': rows
        }
Exemplo n.º 6
0
    def on_squad(self, e):

        # Make sure the squad is associated with a team
        if e.squad != models.squads.EMPTY:
            team = model_mgr.get_team(e.player.team_id)
            team.squad_ids.add(e.squad.id)

        # Update the squad for the player
        self._update_squad(e.player, e.squad)
Exemplo n.º 7
0
    def on_squad(self, e):

        # Make sure the squad is associated with a team
        if e.squad != models.squads.EMPTY:
            team = model_mgr.get_team(e.player.team_id)
            team.squad_ids.add(e.squad.id)

        # Update the squad for the player
        self._update_squad(e.player, e.squad)
Exemplo n.º 8
0
    def on_kill(self, e):

        # Ignore team kills and suicides
        if not e.valid_kill:
            return

        # Get the commander for the attacker's team
        team = model_mgr.get_team(e.attacker.team_id)
        commander = model_mgr.get_player(team.commander_id)

        # Give a point to the commander
        self.results[commander] += 1
Exemplo n.º 9
0
    def on_kill(self, e):

        # Ignore team kills and suicides
        if not e.valid_kill:
            return

        # Get the commander for the attacker's team
        team = model_mgr.get_team(e.attacker.team_id)
        commander = model_mgr.get_player(team.commander_id)

        # Give a point to the commander
        self.results[commander] += 1
Exemplo n.º 10
0
    def on_death(self, e):

        # Get the team for the player
        player_team = model_mgr.get_team(e.player.team_id)
        team_stats = stat_mgr.get_team_stats(player_team)

        # Increment the total team deaths
        team_stats.deaths += 1

        # Increment the player deaths
        if not e.player in team_stats.players:
            team_stats.players[e.player] = TeamItemStats()
        team_stats.players[e.player].deaths += 1
Exemplo n.º 11
0
    def __init__(self, tick, values):
        BaseEvent.__init__(self, tick, values, 4)

        # Pre-process - Make sure the control point model exists in the manager
        self.control_point = model_mgr.add_control_point(
                model_mgr.get_game().map_id + values[1],
                event_mgr.parse_pos(values[1]))
        self.trigger_id = values[0]
        self.status = values[2]
        self.team = model_mgr.get_team(values[3])

        event_mgr.get_history(self.control_point).add_event(self)
        event_mgr.get_history(self.team).add_event(self)
Exemplo n.º 12
0
    def on_score(self, e):

        # Get the team for the player
        player_team = model_mgr.get_team(e.player.team_id)
        team_stats = stat_mgr.get_team_stats(player_team)

        # Increment the total team score
        team_stats.score += e.value

        # Increment score count for the player
        if not e.player in team_stats.players:
            team_stats.players[e.player] = TeamItemStats()
        team_stats.players[e.player].score += e.value
Exemplo n.º 13
0
    def on_score(self, e):

        # Get the team for the player
        player_team = model_mgr.get_team(e.player.team_id)
        team_stats = stat_mgr.get_team_stats(player_team)

        # Increment the total team score
        team_stats.score += e.value

        # Increment score count for the player
        if not e.player in team_stats.players:
            team_stats.players[e.player] = TeamItemStats()
        team_stats.players[e.player].score += e.value
Exemplo n.º 14
0
    def on_death(self, e):

        # Get the team for the player
        player_team = model_mgr.get_team(e.player.team_id)
        team_stats = stat_mgr.get_team_stats(player_team)

        # Increment the total team deaths
        team_stats.deaths += 1

        # Increment the player deaths
        if not e.player in team_stats.players:
            team_stats.players[e.player] = TeamItemStats()
        team_stats.players[e.player].deaths += 1
Exemplo n.º 15
0
    def on_kill(self, e):

        # Ignore suicides and team kills
        if not e.valid_kill:
            return

        # Get the team for the attacker
        attacker_team = model_mgr.get_team(e.attacker.team_id)
        team_stats = stat_mgr.get_team_stats(attacker_team)

        # Increment the total team kills
        team_stats.kills += 1

        # Increment the attacker kills
        if not e.attacker in team_stats.players:
            team_stats.players[e.attacker] = TeamItemStats()
        team_stats.players[e.attacker].kills += 1
Exemplo n.º 16
0
    def on_score(self, e):
        player_stats = stat_mgr.get_player_stats(e.player)

        # Get the last known kit for the player
        # Player may be dead and would not have a kit
        player_kit = event_mgr.get_last_kit(e.player)

        # Get the current map
        current_game = model_mgr.get_game()
        current_map = model_mgr.get_map(current_game.map_id)

        # Get the team for the player
        player_team = model_mgr.get_team(e.player.team_id)

        # Increment score count for the player
        player_stats.score += e.value
        player_stats.score_total += e.value

        # Calculate the player rank based on score
        if player_stats.score >= 40:
            player_stats.rank = 4
        elif player_stats.score >= 30:
            player_stats.rank = 3
        elif player_stats.score >= 20:
            player_stats.rank = 2
        elif player_stats.score >= 10:
            player_stats.rank = 1

        # Increment the kit score for the player
        if not player_kit in player_stats.kits:
            player_stats.kits[player_kit] = PlayerItemStats()
        player_stats.kits[player_kit].score += e.value

        # Increment the map score for the player
        if not current_map in player_stats.maps:
            player_stats.maps[current_map] = PlayerItemStats()
        player_stats.maps[current_map].score += e.value

        # Increment the team score for the player
        if not player_team in player_stats.teams:
            player_stats.teams[player_team] = PlayerItemStats()
        player_stats.teams[player_team].score += e.value

        # Calculate the overall place of each player
        self._update_place()
        self._update_place_overall()
Exemplo n.º 17
0
    def on_score(self, e):
        player_stats = stat_mgr.get_player_stats(e.player)

        # Get the last known kit for the player
        # Player may be dead and would not have a kit
        player_kit = event_mgr.get_last_kit(e.player)

        # Get the current map
        current_game = model_mgr.get_game()
        current_map = model_mgr.get_map(current_game.map_id)

        # Get the team for the player
        player_team = model_mgr.get_team(e.player.team_id)

        # Increment score count for the player
        player_stats.score += e.value
        player_stats.score_total += e.value

        # Calculate the player rank based on score
        if player_stats.score >= 40:
            player_stats.rank = 4
        elif player_stats.score >= 30:
            player_stats.rank = 3
        elif player_stats.score >= 20:
            player_stats.rank = 2
        elif player_stats.score >= 10:
            player_stats.rank = 1

        # Increment the kit score for the player
        if not player_kit in player_stats.kits:
            player_stats.kits[player_kit] = PlayerItemStats()
        player_stats.kits[player_kit].score += e.value

        # Increment the map score for the player
        if not current_map in player_stats.maps:
            player_stats.maps[current_map] = PlayerItemStats()
        player_stats.maps[current_map].score += e.value

        # Increment the team score for the player
        if not player_team in player_stats.teams:
            player_stats.teams[player_team] = PlayerItemStats()
        player_stats.teams[player_team].score += e.value

        # Calculate the overall place of each player
        self._update_place()
        self._update_place_overall()
Exemplo n.º 18
0
    def on_kill(self, e):

        # Ignore suicides and team kills
        if not e.valid_kill:
            return

        # Get the team for the attacker
        attacker_team = model_mgr.get_team(e.attacker.team_id)
        team_stats = stat_mgr.get_team_stats(attacker_team)

        # Increment the total team kills
        team_stats.kills += 1

        # Increment the attacker kills
        if not e.attacker in team_stats.players:
            team_stats.players[e.attacker] = TeamItemStats()
        team_stats.players[e.attacker].kills += 1
Exemplo n.º 19
0
    def on_kill(self, e):

        # Ignore team kills and suicides
        if not e.valid_kill:
            return

        team = model_mgr.get_team(e.victim.team_id)

        if e.attacker not in self.teams:
            self.teams[e.attacker] = collections.Counter()
        counter = self.teams[e.attacker]
        counter[team] += 1

        if not e.attacker in self.results:
            self.results[e.attacker] = AwardResult(0, team)
        result = self.results[e.attacker]

        if counter[team] > result.kills:
            result.kills = counter[team]
Exemplo n.º 20
0
    def on_kill(self, e):

        # Ignore team kills and suicides
        if not e.valid_kill:
            return

        team = model_mgr.get_team(e.victim.team_id)

        if e.attacker not in self.teams:
            self.teams[e.attacker] = collections.Counter()
        counter = self.teams[e.attacker]
        counter[team] += 1

        if not e.attacker in self.results:
            self.results[e.attacker] = AwardResult(0, team)
        result = self.results[e.attacker]

        if counter[team] > result.kills:
            result.kills = counter[team]
Exemplo n.º 21
0
    def get_team(self, id):
        """
        Provides details for a specific team based on the given team identifier.

        Args:
           id (string): The unique identifier of a team.

        Returns:
            team (object): Detailed information for a specific team.
        """

        # Get the model for the requested team
        team = model_mgr.get_team(id)
        if not team:
            raise cherrypy.HTTPError(404)

        # Get the stats for the requested team
        team_stats = stat_mgr.get_team_stats(team)

        # Build a list of column descriptors
        columns = [
            {"name": "Players", "data": "player"},
            {"name": "Score", "data": "number", "sorted": False},
            {"name": "Kills", "data": "number"},
            {"name": "Deaths", "data": "number"},
        ]

        # Build a list of team statistics
        rows = list()
        for player in team_stats.players:
            if player != models.players.EMPTY:
                object_stats = team_stats.players[player]
                player_tuple = {"id": player.id, "name": player.name, "photo": player.photo_s}
                rows.append([player_tuple, object_stats.score, object_stats.kills, object_stats.deaths])

        # Sort the results by score
        rows.sort(key=lambda r: r[1], reverse=True)

        return {"id": team.id, "name": team.name, "columns": columns, "rows": rows}
Exemplo n.º 22
0
    def _update_team(self, player, team):

        # Check whether the team needs to be updated
        if player.team_id and player.team_id == team.id:
            return

        # Remove the player from the previous team
        if player.team_id:
            old_team = model_mgr.get_team(player.team_id)
            if old_team:
                old_team.player_ids.remove(player.id)
                if old_team.commander_id == player.id:
                    old_team.commander_id = None
                    player.commander = False

        # Add the player to the new team
        if team != models.teams.EMPTY:
            team.player_ids.add(player.id)

        # Update the team for the player
        if team == models.teams.EMPTY:
            player.team_id = None
        else:
            player.team_id = team.id
Exemplo n.º 23
0
    def _update_team(self, player, team):

        # Check whether the team needs to be updated
        if player.team_id and player.team_id == team.id:
            return

        # Remove the player from the previous team
        if player.team_id:
            old_team = model_mgr.get_team(player.team_id)
            if old_team:
                old_team.player_ids.remove(player.id)
                if old_team.commander_id == player.id:
                    old_team.commander_id = None
                    player.commander = False

        # Add the player to the new team
        if team != models.teams.EMPTY:
            team.player_ids.add(player.id)

        # Update the team for the player
        if team == models.teams.EMPTY:
            player.team_id = None
        else:
            player.team_id = team.id
Exemplo n.º 24
0
    def on_kill(self, e):
        self.victims[e.victim] = e

        victim_stats = stat_mgr.get_player_stats(e.victim)
        attacker_stats = stat_mgr.get_player_stats(e.attacker)

        # Get the last known kit for the attacker
        # Attacker may be dead and may not have an active kit
        attacker_kit = event_mgr.get_last_kit(e.attacker)

        # Get the team and vehicle for the attacker
        attacker_team = model_mgr.get_team(e.attacker.team_id)
        attacker_vehicle = model_mgr.get_vehicle(e.attacker.vehicle_id)

        # Get the current game and map
        current_game = model_mgr.get_game()
        current_map = model_mgr.get_map(current_game.map_id)

        # Check whether the kill was actually a suicide
        if e.suicide:
            attacker_stats.suicides += 1
            attacker_stats.suicides_total += 1
            return

        # Check whether the kill was actually a teammate
        if e.team_kill:
            victim_stats.team_killed += 1
            victim_stats.team_killed_total += 1
            attacker_stats.team_kills += 1
            attacker_stats.team_kills_total += 1
            return

        # Store the vehicle of the victim for future use
        if e.victim.vehicle_id:
            self.vehicles[e.victim] = e.victim.vehicle_id

        # Increment wound count for the victim
        victim_stats.wounds += 1
        victim_stats.wounds_total += 1

        # Increment enemy wound count for the victim
        if not e.attacker in victim_stats.enemies:
            victim_stats.enemies[e.attacker] = PlayerItemStats()
        victim_stats.enemies[e.attacker].wounds += 1

        # Increment kill count for the attacker
        attacker_stats.kills += 1
        attacker_stats.kills_total += 1

        # Update kill streaks for the attacker
        attacker_stats.kills_streak += 1
        if attacker_stats.kills_streak > attacker_stats.kills_streak_max:
            attacker_stats.kills_streak_max = attacker_stats.kills_streak
        attacker_stats.deaths_streak = 0
        if attacker_stats.kills_streak == 5:
            attacker_stats.kills_5 += 1
            attacker_stats.kills_5_total += 1
        elif attacker_stats.kills_streak == 10:
            attacker_stats.kills_10 += 1
            attacker_stats.kills_10_total += 1

        # Update kill ratio for the attacker
        if attacker_stats.deaths == 0:
            attacker_stats.kills_ratio = 1.0
        else:
            attacker_stats.kills_ratio = round(float(attacker_stats.kills)
                    / float(attacker_stats.deaths), 2)
        if attacker_stats.deaths_total == 0:
            attacker_stats.kills_ratio_total = 1.0
        else:
            attacker_stats.kills_ratio_total = round(float(attacker_stats.kills_total)
                    / float(attacker_stats.deaths_total), 2)

        # Increment the enemy kill count for the attacker
        if not e.victim in attacker_stats.enemies:
            attacker_stats.enemies[e.victim] = PlayerItemStats()
        attacker_stats.enemies[e.victim].kills += 1

        # Increment the kit kill count for the attacker
        if not attacker_kit in attacker_stats.kits:
            attacker_stats.kits[attacker_kit] = PlayerItemStats()
        attacker_stats.kits[attacker_kit].kills += 1

        # Increment the map kill count for the attacker
        if not current_map in attacker_stats.maps:
            attacker_stats.maps[current_map] = PlayerItemStats()
        attacker_stats.maps[current_map].kills += 1

        # Increment the vehicle kill count for the attacker
        if not attacker_vehicle in attacker_stats.vehicles:
            attacker_stats.vehicles[attacker_vehicle] = PlayerItemStats()
        attacker_stats.vehicles[attacker_vehicle].kills += 1

        # Increment the team kill count for the attacker
        if not attacker_team in attacker_stats.teams:
            attacker_stats.teams[attacker_team] = PlayerItemStats()
        attacker_stats.teams[attacker_team].kills += 1

        # Increment the weapon kill count for the attacker
        if not e.weapon in attacker_stats.weapons:
            attacker_stats.weapons[e.weapon] = PlayerWeaponStats()
        attacker_stats.weapons[e.weapon].kills += 1
Exemplo n.º 25
0
    def on_death(self, e):
        player_stats = stat_mgr.get_player_stats(e.player)

        # Get the last known kit for the player
        # Player will no longer have an active kit at this point
        player_kit = event_mgr.get_last_kit(e.player)

        # Get the team and weapon for the player
        player_team = model_mgr.get_team(e.player.team_id)
        player_weapon = model_mgr.get_weapon(e.player.weapon_id)

        # Get the vehicle used by the player
        vehicle_id = None
        if e.player in self.vehicles:
            vehicle_id = self.vehicles[e.player]
            del self.vehicles[e.player]
        player_vehicle = model_mgr.get_vehicle(vehicle_id)

        # Get the current game and map
        current_game = model_mgr.get_game()
        current_map = model_mgr.get_map(current_game.map_id)

        # Increment death count for the player
        player_stats.deaths += 1
        player_stats.deaths_total += 1

        # Update death streaks for the player
        player_stats.deaths_streak += 1
        if player_stats.deaths_streak > player_stats.deaths_streak_max:
            player_stats.deaths_streak_max = player_stats.deaths_streak
        player_stats.kills_streak = 0

        # Update kill ratio for the player
        player_stats.kills_ratio = round(float(player_stats.kills)
                / float(player_stats.deaths), 2)
        player_stats.kills_ratio_max = round(float(player_stats.kills_total)
                / float(player_stats.deaths_total), 2)

        # Increment the enemy death count for the player
        if e.player in self.victims:
            kill_event = self.victims[e.player]
            if kill_event and kill_event.valid_kill:
                if not kill_event.attacker in player_stats.enemies:
                    player_stats.enemies[kill_event.attacker] = PlayerItemStats()
                player_stats.enemies[kill_event.attacker].deaths += 1

        # Increment the kit death count for the player
        if not player_kit in player_stats.kits:
            player_stats.kits[player_kit] = PlayerItemStats()
        player_stats.kits[player_kit].deaths += 1

        # Increment the map death count for the player
        if not current_map in player_stats.maps:
            player_stats.maps[current_map] = PlayerItemStats()
        player_stats.maps[current_map].deaths += 1

        # Increment the team death count for the player
        if not player_team in player_stats.teams:
            player_stats.teams[player_team] = PlayerItemStats()
        player_stats.teams[player_team].deaths += 1

        # Increment the vehicle death count for the player
        if not player_vehicle in player_stats.vehicles:
            player_stats.vehicles[player_vehicle] = PlayerItemStats()
        player_stats.vehicles[player_vehicle].deaths += 1

        # Increment the weapon death count for the player
        if not player_weapon in player_stats.weapons:
            player_stats.weapons[player_weapon] = PlayerWeaponStats()
        player_stats.weapons[player_weapon].deaths += 1

        # Reset all the temporary accuracy values
        self._update_accuracy(e.player)

        # Stop active timers
        player_stats.commander_time.stop(e.tick)
        player_stats.leader_time.stop(e.tick)
        player_stats.play_time.stop(e.tick)
        player_stats.squad_time.stop(e.tick)

        # Start the spectator timer
        player_stats.spec_time.start(e.tick)
Exemplo n.º 26
0
    def on_death(self, e):
        player_stats = stat_mgr.get_player_stats(e.player)

        # Get the last known kit for the player
        # Player will no longer have an active kit at this point
        player_kit = event_mgr.get_last_kit(e.player)

        # Get the team and weapon for the player
        player_team = model_mgr.get_team(e.player.team_id)
        player_weapon = model_mgr.get_weapon(e.player.weapon_id)

        # Get the vehicle used by the player
        vehicle_id = None
        if e.player in self.vehicles:
            vehicle_id = self.vehicles[e.player]
            del self.vehicles[e.player]
        player_vehicle = model_mgr.get_vehicle(vehicle_id)

        # Get the current game and map
        current_game = model_mgr.get_game()
        current_map = model_mgr.get_map(current_game.map_id)

        # Increment death count for the player
        player_stats.deaths += 1
        player_stats.deaths_total += 1

        # Update death streaks for the player
        player_stats.deaths_streak += 1
        if player_stats.deaths_streak > player_stats.deaths_streak_max:
            player_stats.deaths_streak_max = player_stats.deaths_streak
        player_stats.kills_streak = 0

        # Update kill ratio for the player
        player_stats.kills_ratio = round(
            float(player_stats.kills) / float(player_stats.deaths), 2)
        player_stats.kills_ratio_max = round(
            float(player_stats.kills_total) / float(player_stats.deaths_total),
            2)

        # Increment the enemy death count for the player
        if e.player in self.victims:
            kill_event = self.victims[e.player]
            if kill_event and kill_event.valid_kill:
                if not kill_event.attacker in player_stats.enemies:
                    player_stats.enemies[
                        kill_event.attacker] = PlayerItemStats()
                player_stats.enemies[kill_event.attacker].deaths += 1

        # Increment the kit death count for the player
        if not player_kit in player_stats.kits:
            player_stats.kits[player_kit] = PlayerItemStats()
        player_stats.kits[player_kit].deaths += 1

        # Increment the map death count for the player
        if not current_map in player_stats.maps:
            player_stats.maps[current_map] = PlayerItemStats()
        player_stats.maps[current_map].deaths += 1

        # Increment the team death count for the player
        if not player_team in player_stats.teams:
            player_stats.teams[player_team] = PlayerItemStats()
        player_stats.teams[player_team].deaths += 1

        # Increment the vehicle death count for the player
        if not player_vehicle in player_stats.vehicles:
            player_stats.vehicles[player_vehicle] = PlayerItemStats()
        player_stats.vehicles[player_vehicle].deaths += 1

        # Increment the weapon death count for the player
        if not player_weapon in player_stats.weapons:
            player_stats.weapons[player_weapon] = PlayerWeaponStats()
        player_stats.weapons[player_weapon].deaths += 1

        # Reset all the temporary accuracy values
        self._update_accuracy(e.player)

        # Stop active timers
        player_stats.commander_time.stop(e.tick)
        player_stats.leader_time.stop(e.tick)
        player_stats.play_time.stop(e.tick)
        player_stats.squad_time.stop(e.tick)

        # Start the spectator timer
        player_stats.spec_time.start(e.tick)
Exemplo n.º 27
0
    def on_kill(self, e):
        self.victims[e.victim] = e

        victim_stats = stat_mgr.get_player_stats(e.victim)
        attacker_stats = stat_mgr.get_player_stats(e.attacker)

        # Get the last known kit for the attacker
        # Attacker may be dead and may not have an active kit
        attacker_kit = event_mgr.get_last_kit(e.attacker)

        # Get the team and vehicle for the attacker
        attacker_team = model_mgr.get_team(e.attacker.team_id)
        attacker_vehicle = model_mgr.get_vehicle(e.attacker.vehicle_id)

        # Get the current game and map
        current_game = model_mgr.get_game()
        current_map = model_mgr.get_map(current_game.map_id)

        # Check whether the kill was actually a suicide
        if e.suicide:
            attacker_stats.suicides += 1
            attacker_stats.suicides_total += 1
            return

        # Check whether the kill was actually a teammate
        if e.team_kill:
            victim_stats.team_killed += 1
            victim_stats.team_killed_total += 1
            attacker_stats.team_kills += 1
            attacker_stats.team_kills_total += 1
            return

        # Store the vehicle of the victim for future use
        if e.victim.vehicle_id:
            self.vehicles[e.victim] = e.victim.vehicle_id

        # Increment wound count for the victim
        victim_stats.wounds += 1
        victim_stats.wounds_total += 1

        # Increment enemy wound count for the victim
        if not e.attacker in victim_stats.enemies:
            victim_stats.enemies[e.attacker] = PlayerItemStats()
        victim_stats.enemies[e.attacker].wounds += 1

        # Increment kill count for the attacker
        attacker_stats.kills += 1
        attacker_stats.kills_total += 1

        # Update kill streaks for the attacker
        attacker_stats.kills_streak += 1
        if attacker_stats.kills_streak > attacker_stats.kills_streak_max:
            attacker_stats.kills_streak_max = attacker_stats.kills_streak
        attacker_stats.deaths_streak = 0
        if attacker_stats.kills_streak == 5:
            attacker_stats.kills_5 += 1
            attacker_stats.kills_5_total += 1
        elif attacker_stats.kills_streak == 10:
            attacker_stats.kills_10 += 1
            attacker_stats.kills_10_total += 1

        # Update kill ratio for the attacker
        if attacker_stats.deaths == 0:
            attacker_stats.kills_ratio = 1.0
        else:
            attacker_stats.kills_ratio = round(
                float(attacker_stats.kills) / float(attacker_stats.deaths), 2)
        if attacker_stats.deaths_total == 0:
            attacker_stats.kills_ratio_total = 1.0
        else:
            attacker_stats.kills_ratio_total = round(
                float(attacker_stats.kills_total) /
                float(attacker_stats.deaths_total), 2)

        # Increment the enemy kill count for the attacker
        if not e.victim in attacker_stats.enemies:
            attacker_stats.enemies[e.victim] = PlayerItemStats()
        attacker_stats.enemies[e.victim].kills += 1

        # Increment the kit kill count for the attacker
        if not attacker_kit in attacker_stats.kits:
            attacker_stats.kits[attacker_kit] = PlayerItemStats()
        attacker_stats.kits[attacker_kit].kills += 1

        # Increment the map kill count for the attacker
        if not current_map in attacker_stats.maps:
            attacker_stats.maps[current_map] = PlayerItemStats()
        attacker_stats.maps[current_map].kills += 1

        # Increment the vehicle kill count for the attacker
        if not attacker_vehicle in attacker_stats.vehicles:
            attacker_stats.vehicles[attacker_vehicle] = PlayerItemStats()
        attacker_stats.vehicles[attacker_vehicle].kills += 1

        # Increment the team kill count for the attacker
        if not attacker_team in attacker_stats.teams:
            attacker_stats.teams[attacker_team] = PlayerItemStats()
        attacker_stats.teams[attacker_team].kills += 1

        # Increment the weapon kill count for the attacker
        if not e.weapon in attacker_stats.weapons:
            attacker_stats.weapons[e.weapon] = PlayerWeaponStats()
        attacker_stats.weapons[e.weapon].kills += 1