def hostage_rescued(event_var):
    # Get the player instance
    ggPlayer = Player(event_var['userid'])

    # Increment player rescues
    ggPlayer.hostage_rescued += 1

    # Enough hostages rescued to level player up?
    if ggPlayer.hostage_rescued >= int(gg_hostage_rescued_rescues):

        # Reset hostage rescued counter
        ggPlayer.hostage_rescued = 0

        # The number of levels we will level up the player
        levels = 1

        # If they shouldn't be skipping their current level, stop here
        if (not int(gg_hostage_rescued_skip_nade)
          and ggPlayer.weapon == 'hegrenade') or (
          not int(gg_hostage_rescued_skip_knife)
          and ggPlayer.weapon == 'knife'):
            msg(ggPlayer.userid, 'CannotSkipLevel_ByRescuing',
                {'level': ggPlayer.weapon})
            return

        # Loop through weapons of the levels we plan to level the player past
        for weapon in getLevelupList(ggPlayer.level,
          ggPlayer.level + int(gg_hostage_rescued_levels)):
            # If gg_hostage_rescued_skip_knife or gg_hostage_rescued_skip_nade
            # are disabled, make sure the player will not skip that level
            if (not int(gg_hostage_rescued_skip_knife)
              and weapon == 'knife') or (
              not int(gg_hostage_rescued_skip_nade)
              and weapon == 'hegrenade'):
                msg(ggPlayer.userid, 'CannotSkipLevel_ByRescuing',
                    {'level': weapon})
                break

            # Add to the number of levels they will gain
            levels += 1

        ggPlayer.levelup(levels, 0, 'hostage_rescued')
Exemple #2
0
def hostage_rescued(event_var):
    # Get the player instance
    ggPlayer = Player(event_var['userid'])

    # Increment player rescues
    ggPlayer.hostage_rescued += 1

    # Enough hostages rescued to level player up?
    if ggPlayer.hostage_rescued >= int(gg_hostage_rescued_rescues):

        # Reset hostage rescued counter
        ggPlayer.hostage_rescued = 0

        # The number of levels we will level up the player
        levels = 1

        # If they shouldn't be skipping their current level, stop here
        if (not int(gg_hostage_rescued_skip_nade) and ggPlayer.weapon
                == 'hegrenade') or (not int(gg_hostage_rescued_skip_knife)
                                    and ggPlayer.weapon == 'knife'):
            msg(ggPlayer.userid, 'CannotSkipLevel_ByRescuing',
                {'level': ggPlayer.weapon})
            return

        # Loop through weapons of the levels we plan to level the player past
        for weapon in getLevelupList(
                ggPlayer.level,
                ggPlayer.level + int(gg_hostage_rescued_levels)):
            # If gg_hostage_rescued_skip_knife or gg_hostage_rescued_skip_nade
            # are disabled, make sure the player will not skip that level
            if (not int(gg_hostage_rescued_skip_knife) and weapon
                    == 'knife') or (not int(gg_hostage_rescued_skip_nade)
                                    and weapon == 'hegrenade'):
                msg(ggPlayer.userid, 'CannotSkipLevel_ByRescuing',
                    {'level': weapon})
                break

            # Add to the number of levels they will gain
            levels += 1

        ggPlayer.levelup(levels, 0, 'hostage_rescued')