Exemple #1
0
def handicapUpdate():
    # Get the handicap level
    handicapLevel = getLevelAboveLowest()

    # Updating players
    for userid in getLowestLevelUsers():
        # Get the player
        ggPlayer = Player(userid)

        # If the lowest level players are below the handicap level, continue
        if ggPlayer.level < handicapLevel:
            # Set player level
            ggPlayer.level = handicapLevel

            # Tell the player that their level was adjusted
            ggPlayer.msg('LevelLowest', {'level': handicapLevel}, prefix=True)

            # Play the update sound
            ggPlayer.playsound('handicap')
Exemple #2
0
def handicap(userid, from_player_activate):
    # Did the request come from player_activate? (for legacy mode only)
    if from_player_activate:

        # Use legacy mode?
        if int(gg_handicap_legacy_mode):

            # Disallow reconnecting players?
            if int(gg_handicap_no_reconnect) and handicap_players[userid][1]:
                return

        # Stop here if we are not using legacy mode
        else:
            return

    # This must be a bot, they get goofy sometimes
    if userid not in handicap_players:
        handicap_players[userid] = [False, False]

    # Has the player joined a team this map?
    elif handicap_players[userid][0]:

        # Reconnecting player?
        if handicap_players[userid][1]:

            # Stop here if no reconnections allowed
            if int(gg_handicap_no_reconnect):
                return

            # Set the player's reconnecting status to no, so they don't get
            # a new weapon while switching teams
            handicap_players[userid][1] = False

        # Stop here, player isn't reconnecting
        else:
            return

    # Get the player
    ggPlayer = Player(userid)

    # Get the level of the lowest level player other than himself?
    if gg_handicap == 1:
        handicapLevel = getLevelAboveUser(userid)

    # Get the average level of the players other than himself?
    elif gg_handicap == 2:
        handicapLevel = getAverageLevel(userid)

    # Max level for joining for the first time?
    if handicapLevel > int(gg_handicap_max) > 1:
        handicapLevel = int(gg_handicap_max)

    # If their level is below the handicap level, set them to it
    if ggPlayer.level < handicapLevel:
        ggPlayer.level = handicapLevel

        # Tell the player that their level was adjusted
        ggPlayer.msg('LevelLowest', {'level': handicapLevel}, prefix=True)

    # Record the player joined a team this map
    handicap_players[userid][0] = True