示例#1
0
def _respawn_victims(userid):
    """Respawn all victim's of the given userid."""
    victims = eliminated_players.pop(userid, [])
    if not len(victims):
        return
    if GunGameStatus.ROUND is GunGameRoundStatus.INACTIVE:
        return
    players = list()
    for victim in victims:
        player = player_dictionary.get(victim)
        if player is None:
            continue
        if player.team == 1:
            continue
        players.append(player)
        player.spawn()
    if players:
        message_manager.chat_message(
            'Elimination:Respawning', players[0].index,
            player='\x01, \x03'.join(
                map(
                    attrgetter('name'),
                    players
                )
            )
        )
示例#2
0
    def find_team_leader(self, leveler=None, old_level=None, disconnect=False):
        team_players = {
            player.level: player for player in player_dictionary.values()
            if player.team == self.number
        }
        if not team_players:
            self.leader = None
            return
        self.leader = team_players[max(team_players.keys())]

        if disconnect:
            message_manager.chat_message(
                message='TeamWork:Leader:Disconnect',
                index=self.index,
                team_name=self.name,
                level=self.leader_level,
            )
            return

        if leveler is None or old_level is None:
            return

        if self.leader_level is not None and self.leader_level < old_level:
            message_manager.chat_message(
                message='TeamWork:Leader:Decrease',
                index=self.index,
                player=leveler.name,
                team_name=self.name,
                level=self.leader_level,
            )
示例#3
0
 def send_level_message(self):
     if self.leader_level is None:
         return
     message_manager.chat_message(
         message='TeamWork:TeamLevel',
         index=self.index,
         team_name=self.name,
         level=self.leader_level,
         weapon=weapon_order_manager.active[self.leader_level].weapon,
     )
示例#4
0
 def leader(self, player):
     current = self._leader
     self._leader = player
     self.leader_userid = None if player is None else player.userid
     if current is None or player is None:
         team_levels[self.number] = 1
         return
     team_levels[self.number] = player.level
     if current.level < player.level or current.userid == player.userid:
         message_manager.chat_message(
             message='TeamWork:Leader:Increase',
             index=self.index,
             player=player.name,
             team_name=self.name,
             level=self.leader_level,
         )
示例#5
0
def _end_match(game_event):
    # Set the match status
    GunGameStatus.MATCH = GunGameMatchStatus.POST

    # Get the winning team information
    winning_team = teamwork_manager[game_event['winner']]

    # Send the winner messages
    message_manager.chat_message(
        index=winning_team.index,
        message='TeamWork:Winner:Long',
        team_name=winning_team.name,
    )
    for second in range(4):
        Delay(
            second,
            message_manager.center_message,
            kwargs={
                'message': 'TeamWork:Winner:Short',
                'team_name': winning_team.name,
            }
        )
    color = {2: RED, 3: BLUE}.get(winning_team, WHITE)
    message_manager.top_message(
        message='TeamWork:Winner:Short',
        color=color,
        team_name=winning_team.name,
    )

    # Play the winner sound
    winner_sound = sound_manager.play_sound('winner')

    # Set the dynamic chat time, if needed
    if dynamic_chat_time.get_bool():
        with suppress(MutagenError):
            ConVar('mp_chattime').set_float(winner_sound.duration)

    # End the match to move to the next map
    entity = Entity.find_or_create('game_end')
    entity.end_game()

    # Reset the teams
    _clear_team_dictionary()
示例#6
0
def _round_start(game_event):
    """Send the elimination info message."""
    message_manager.chat_message('Elimination:RoundInfo')