コード例 #1
0
ファイル: cmdlib.py プロジェクト: fizek/source_addons
    def registerClientCommand(self,
                              name,
                              callback,
                              description,
                              auth_capability=None,
                              auth_recommendedlevel=None,
                              auth_fail_callback=None):
        """ Registers a client command to the callback function with the option of authorization services """
        self._validateAuthCapability(name, auth_capability,
                                     auth_recommendedlevel, 'client')

        self._validateCallback(callback)
        if not auth_fail_callback is None:
            self._validateCallback(auth_fail_callback)

        name = str(name).lower()
        if es.exists('clientcommand', name):
            raise NameError, "'%s' is in use as a client command" % name

        es.regclientcmd(name, '_cmdlib/client', description)
        cmd = self.client_commands[name] = PlayerCommand(name, callback)

        if not auth_capability is None and not auth_recommendedlevel is None:
            cmd.setPermission(auth_capability,
                              permissionToInteger(auth_recommendedlevel),
                              auth_fail_callback)
コード例 #2
0
def load():
    dbg( '')
    dbg( 'XS: Loading...')
    if not callable(getattr(popuplib,'easylist',None)):
        es.dbgmsg(0,'XS: Popuplib version too old! Please update!')
        es.unload('extendedstats')
        return
    loadPackages()
    loadAddons()
    fillDatabase()
    loadToplist()
    saycommands[re.compile('\A%s%s' % (scfg.say_command_prefix,scfg.command_help))] = cmd_help
    es.addons.registerSayFilter(sayfilter)
    es.regclientcmd(scfg.command_help,'extendedstats/cmd_help')
    loadCVARS()
    loadMenus()
    es.regcmd('xs_resetlog','extendedstats/resetlog')
    #es.regcmd('xs_cleandb','extendedstats/cleandb')
    es.regcmd('xs_checkversion','extendedstats/checkversion')
    es.regcmd('xs_cfgsync','extendedstats/cfgsync')
    es.regcmd('xs_dbsync','extendedstats/dbsync')
    es.server.queuecmd('es_load extendedstats/events/%s' % (game))
    dbg('XS: Registered methods:')
    for method in methods:
        dbg( '    %s' % method)
    dcfg.sync()
    dbg('XS: Loaded successfully (%s)' % (info.version))
    dbg(' ')
コード例 #3
0
ファイル: pyunittest.py プロジェクト: StarsGame/source_addons
 def setUp(self):
   # lets suppress some noise
   debug = es.ServerVar("eventscripts_debug")
   olddebug = int(debug)
   if int(debug) == 0:
     debug.set(-1)
   es.regcmd("pycommand", "pyunittest/cmdtest_run", "Stuff")
   debug.set(olddebug)
   es.regsaycmd("pycommand","pyunittest/cmdtest_run", "Stuff")
   es.regclientcmd("pycommand","pyunittest/cmdtest_run", "Stuff")
コード例 #4
0
 def setUp(self):
     # lets suppress some noise
     debug = es.ServerVar("eventscripts_debug")
     olddebug = int(debug)
     if int(debug) == 0:
         debug.set(-1)
     es.regcmd("pycommand", "pyunittest/cmdtest_run", "Stuff")
     debug.set(olddebug)
     es.regsaycmd("pycommand", "pyunittest/cmdtest_run", "Stuff")
     es.regclientcmd("pycommand", "pyunittest/cmdtest_run", "Stuff")
コード例 #5
0
ファイル: block_crash.py プロジェクト: tsuehpsyde/SourceKills
def load():
    #hooking the commands, not sure if ma_timeleft and ma_nextmap are actually necessary
    es.regclientcmd('timeleft', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regclientcmd('ma_timeleft', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regclientcmd('nextmap', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regclientcmd('ma_nextmap', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regclientcmd('listmaps', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regsaycmd('ff', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regsaycmd('@timeleft', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regsaycmd('@nextmap', 'block_crash/watch_console', 'test to block channel overflow exploit')
    es.regsaycmd('@listmaps', 'block_crash/watch_console', 'test to block channel overflow exploit')
コード例 #6
0
def registerCommand(command,addonname,callback,clientcommand=True,saycommand=True):
    global addoncommands, reggedccmd, reggedscmd, cmdhelp, uniquecommands
    uniquecommands.append(command)
    if clientcommand:
        es.regclientcmd(command,'extendedstats/addonCommandListener')
        addoncommands[command] = callback
        reggedccmd.append(command)
        dbg( 'XS: Registered clientcommand %s for %s' % (command,addonname))
    if saycommand:
        command = scfg.say_command_prefix + command
        saycommands[re.compile('%s(\s|\Z)' % RESafe(command))] = callback
        reggedscmd.append(command)
        dbg( 'XS: Registered saycommand %s for %s' % (command,addonname))
コード例 #7
0
ファイル: cmdlib.py プロジェクト: StarsGame/source_addons
   def registerClientCommand(self, name, callback, description, auth_capability=None, auth_recommendedlevel=None, auth_fail_callback=None):
      """ Registers a client command to the callback function with the option of authorization services """
      self._validateAuthCapability(name, auth_capability, auth_recommendedlevel, 'client')

      self._validateCallback(callback)
      if not auth_fail_callback is None:
         self._validateCallback(auth_fail_callback)

      name = str(name).lower()
      if es.exists('clientcommand', name): raise NameError, "'%s' is in use as a client command" % name

      es.regclientcmd(name, '_cmdlib/client', description)
      cmd = self.client_commands[name] = PlayerCommand(name, callback)

      if not auth_capability is None and not auth_recommendedlevel is None:
         cmd.setPermission(auth_capability, permissionToInteger(auth_recommendedlevel), auth_fail_callback)
コード例 #8
0
def load():
    es.regclientcmd("zdebug", "ztricks-debug/toggledebug")
    es.regclientcmd("zdebugline", "ztricks-debug/toggleline")
    msg("loaded")
コード例 #9
0
ファイル: myraces.py プロジェクト: kamikazekuh/WCS_077_Remake
def load():
    cmdlib.registerServerCommand("wcs_myracemenu", wcrm,
                                 "wcschangerace_Menu_Handler")
    es.regclientcmd('myraces', 'tools/myraces/myracecmd', '')
    es.regsaycmd('myraces', 'tools/myraces/myracecmd', '')
コード例 #10
0
def regclientcmd(argv):
  if es.exists('clientcommand', argv[0]):
    raise ValueError, 'command %s already exists' % argv[0]
  es.regclientcmd(*argv[:3])
コード例 #11
0
def regclientcmd(argv):
    if es.exists('clientcommand', argv[0]):
        raise ValueError('command %s already exists' % argv[0])
    es.regclientcmd(*argv[:3])
コード例 #12
0
def load():

    #wcsusers
    es.regclientcmd('spendskills', 'wcs/wcsusers/wcs_spendskills', '')
    es.regclientcmd('playerinfo', 'wcs/wcsusers/wcs_playerinfo', '')
    es.regclientcmd('resetskills', 'wcs/wcsusers/wcs_resetskills', '')
    es.regclientcmd('showskills', 'wcs/wcsusers/wcs_showskills', '')
    es.regclientcmd('showcredits', 'wcs/wcsusers/wcs_showcredits', '')

    #wcstop
    es.regclientcmd('wcstop', 'wcs/wcstop10/wcs_showtop10', '')
    es.regclientcmd('showtop10', 'wcs/wcstop10/wcs_showtop10', '')

    #wcsshop
    es.regclientcmd('shopmenu', 'wcs/wcsshop/wcs_shopmenu', '')
    es.regclientcmd('shopinfo', 'wcs/wcsshop/wcs_showshopinfo', '')

    #wcsraces
    es.regclientcmd('changerace', 'wcs/wcsraces/wcs_changerace', '')
    es.regclientcmd('raceinfo', 'wcs/wcsraces/sraceinfo', '')

    #wcsfunctions
    es.regclientcmd('wcshelp', 'wcs/wcsfunctions/wcs_help', '')
    es.regclientcmd('warcraft', 'wcs/wcsfunctions/wcs_help', '')
    es.regclientcmd('feedback', 'wcs/wcsfunctions/wcs_feedback', '')
    es.regclientcmd('wcsmenu', 'wcs/wcsfunctions/wcs_wcsmenu', '')
    es.regclientcmd('wcs', 'wcs/wcsfunctions/wcs_wcsmenu', '')

    #wcsxp
    es.regclientcmd('showxp', 'wcs/wcsfunctions/wcsxp/wcs_showxp', '')