示例#1
0
 def onLoadConfig(self):
     self._plugin_config = PluginConfig(self)
     # load configuration
     self._plugin_config.load_settings(self._default_settings, 'settings',
                                       self._settings)
     self._plugin_config.load_settings(
         default_settings=self._default_punisher_settings,
         section='punisher',
         to_settings=self._punisher_settings)
     # backup servermessage
     if self._settings['change servermessage']:
         try:
             _old_servermessage = self.console.getCvar('serverMessage')
             self._old_servermessage = _old_servermessage if _old_servermessage is not None else ''
         except CommandFailedError, err:
             self.error('Failed to get vars.serverMessage')
 def onLoadConfig(self):
     self._plugin_config = PluginConfig(self)
     # load configuration
     self._plugin_config.load_settings(self._default_settings, 'settings', self._settings)
     self._plugin_config.load_settings(default_settings=self._default_punisher_settings, section='punisher',
                                       to_settings=self._punisher_settings)
     # backup servermessage
     if self._settings['change servermessage']:
         try:
             _old_servermessage = self.console.getCvar('serverMessage')
             self._old_servermessage = _old_servermessage if _old_servermessage is not None else ''
         except CommandFailedError, err:
             self.error('Failed to get vars.serverMessage')
示例#3
0
class Weaponlimiterbf3Plugin(Plugin):

    MAP_NAME_BY_ID = None
    GAME_MODES_NAMES = None
    MAP_ID_BY_NAME = None
    GAME_MODES_BY_MAP_ID = None
    WEAPON_NAMES_BY_ID = None
    _adminPlugin = None
    _wpl_is_active = None
    _messages = {}
    _default_messages = {
        'servermessage':
        'This game uses weapons limits. Use !weaponlimits to show forbidden weapons.',
        'weaponlimiter_enabled':
        'WeaponLimiter for that round activated!',
        'weaponlimiter_disabled':
        'Weaponlimiter disabled! All Weapons allowed.',
        'warn_message':
        'You used a forbidden weapon! ^7!forbidden_weapons show the list of forbidden weapons',
        'forbidden_message':
        'Forbidden Weapons are: %s',
        'allowed_message':
        'Allowed Weapons: %s',
        'extra_warning_message':
        'You have %(victim)s killed with a %(weapon)s. This weapon is forbidden!',
    }
    _plugin_config = None
    # general settings
    _settings = {}
    _default_settings = {
        'autostartup': False,
        'config_strategy': ('mapname', 'gametype'),
        'anounce_limits_on_first_spawn': True,
        'self_kill_counter': 1,
        'change servermessage': False,
        'display_extra_msg': 'message',
        'yell_duration': 10,
    }
    # settings for players punishment
    _punisher_settings = {}
    _default_punisher_settings = {
        'kill_player': False,
        'warn_player': True,
    }
    # wpl dont work on:
    _disable_on_gamemode = ['GunMaster0']
    _mapconfig = {}
    _mapconfig_template = {}
    _old_servermessage = None

    def onLoadConfig(self):
        self._plugin_config = PluginConfig(self)
        # load configuration
        self._plugin_config.load_settings(self._default_settings, 'settings',
                                          self._settings)
        self._plugin_config.load_settings(
            default_settings=self._default_punisher_settings,
            section='punisher',
            to_settings=self._punisher_settings)
        # backup servermessage
        if self._settings['change servermessage']:
            try:
                _old_servermessage = self.console.getCvar('serverMessage')
                self._old_servermessage = _old_servermessage if _old_servermessage is not None else ''
            except CommandFailedError, err:
                self.error('Failed to get vars.serverMessage')

        # Load messages
        for key in self.config.options('messages'):
            self._messages[key] = self.config.get('messages', key, True)

        self._weaponlimiter_enabled_msg = self.config.get(
            'messages', 'weaponlimiter_enabled')
        self.cmd_weaponlimiter_wlist_text = self.config.get(
            'messages', 'warn_message')
class Weaponlimiterbf3Plugin(Plugin):

    MAP_NAME_BY_ID = None
    GAME_MODES_NAMES = None
    MAP_ID_BY_NAME = None
    GAME_MODES_BY_MAP_ID = None
    WEAPON_NAMES_BY_ID = None
    _adminPlugin = None
    _wpl_is_active = None
    _messages = {}
    _default_messages = {
        'servermessage': 'This game uses weapons limits. Use !weaponlimits to show forbidden weapons.',
        'weaponlimiter_enabled': 'WeaponLimiter for that round activated!',
        'weaponlimiter_disabled': 'Weaponlimiter disabled! All Weapons allowed.',
        'warn_message': 'You used a forbidden weapon! ^7!forbidden_weapons show the list of forbidden weapons',
        'forbidden_message': 'Forbidden Weapons are: %s',
        'allowed_message': 'Allowed Weapons: %s',
        'extra_warning_message': 'You have %(victim)s killed with a %(weapon)s. This weapon is forbidden!',
    }
    _plugin_config = None
    # general settings
    _settings = {}
    _default_settings = {
        'autostartup': False,
        'config_strategy': ('mapname', 'gametype'),
        'anounce_limits_on_first_spawn': True,
        'self_kill_counter': 1,
        'change servermessage': False,
        'display_extra_msg': 'message',
        'yell_duration': 10,
    }
    # settings for players punishment
    _punisher_settings = {}
    _default_punisher_settings = {
        'kill_player': False,
        'warn_player': True,
    }
    # wpl dont work on:
    _disable_on_gamemode = ['GunMaster0']
    _mapconfig = {}
    _mapconfig_template = {}
    _old_servermessage = None

    def onLoadConfig(self):
        self._plugin_config = PluginConfig(self)
        # load configuration
        self._plugin_config.load_settings(self._default_settings, 'settings', self._settings)
        self._plugin_config.load_settings(default_settings=self._default_punisher_settings, section='punisher',
                                          to_settings=self._punisher_settings)
        # backup servermessage
        if self._settings['change servermessage']:
            try:
                _old_servermessage = self.console.getCvar('serverMessage')
                self._old_servermessage = _old_servermessage if _old_servermessage is not None else ''
            except CommandFailedError, err:
                self.error('Failed to get vars.serverMessage')

        # Load messages
        for key in self.config.options('messages'):
            self._messages[key] = self.config.get('messages', key, True)

        self._weaponlimiter_enabled_msg = self.config.get('messages', 'weaponlimiter_enabled')
        self.cmd_weaponlimiter_wlist_text = self.config.get('messages', 'warn_message')