Ejemplo n.º 1
0
def init():
	global randkickAccess
	host.registerHandler('ProcessCommand', onCommand)
	
	# configuration
	config = host.config()
	randkickAccess = config.getInt("p_randkick_access", randkickAccess)
Ejemplo n.º 2
0
    def init(self):
        """Provides default initialisation."""

        # Load the configuration
        self.__config = self.mm.getModuleConfig(configDefaults)
        self.__banFileName = self.mm.configPath(
        ) + '/' + self.__config['banFilename']

        # Load the bans
        self.loadBans()

        # Register our base handlers
        host.registerGameStatusHandler(self.onGameStatusChanged)

        # Register our rcon command handlers
        self.mm.registerRconCmdHandler('bm', {
            'method': self.cmdExec,
            'subcmds': self.__cmds,
            'level': 1
        })

        if 0 == self.__state:
            host.registerHandler('PlayerDisconnect', self.onPlayerDisconnect,
                                 1)

        # Register your game handlers and provide any
        # other dynamic initialisation here

        # Update to the running state
        self.__state = 1
Ejemplo n.º 3
0
    def init(self):
        """Provides default initialisation."""

        # Load the configuration
        self.__config = self.mm.getModuleConfig(configDefaults)

        # Register your game handlers and provide any
        # other dynamic initialisation here

        if not bf2.g_debug:
            self.mm.info("Global python debugging is disabled")
            self.mm.info("To enable edit: python/bf2/__init__.py")
            self.mm.info("and set 'g_debug = 1'")
        else:
            self.mm.warn("Global python is enabled.")
            self.mm.warn(
                "This may have unexpected side effects and a performance impact!"
            )

        if not host.ss_getParam('ranked'):
            self.mm.error("This server is NOT ranked!")
        else:
            self.mm.info("This server is ranked!")
            if 0 == self.__state:
                # Register your host handlers here
                host.registerHandler('PlayerConnect', self.onPlayerConnect, 1)
                host.registerHandler('PlayerStatsResponse',
                                     self.onStatsResponse, 1)

            # Update to the running state
            self.__state = 1
Ejemplo n.º 4
0
Archivo: queue.py Proyecto: w3gh/pychop
def init():
    connect()

    if master:
        host.registerHandler('QueueChatCommand', onQueue, True)

    host.registerHandler('Update', onUpdate)
Ejemplo n.º 5
0
	def init( self ):
		"""Provides default initialisation."""

		# Load the configuration
		self.__config = self.mm.getModuleConfig( configDefaults )
		self.__admins = self.__config["admins"]
		self.__useAdminColorHack = self.__config["useAdminColorHack"]
		self.__msgNotAnAdmin = self.__config["msgNotAnAdmin"]
		self.__msgNameHacks = self.__config["msgNameHacks"]
		self.__chatPrefixes = self.__config["chatPrefixes"]
		self.__commands = self.__config["commands"]

		# Register your game handlers and provide any
		# other dynamic initialisation here

		if 0 == self.__state:
			# Register your host handlers here
			host.registerHandler("PlayerConnect", self.onPlayerConnect, 1)
			host.registerHandler("ChatMessage", self.onChatMessage, 1)

		# Register our rcon command handlers
		self.mm.registerRconCmdHandler( 'adm', { 'method': self.cmdExec, 'subcmds': self.__cmds, 'level': 1 } )

		# Update to the running state
		self.__state = 1
Ejemplo n.º 6
0
    def init(self):
        """Provides default initialisation."""

        # Load the configuration
        self.__config = self.mm.getModuleConfig(configDefaults)
        self.__maplists = self.__config["maplists"]
        self.__maplistPath = self.__config["maplistPath"]
        self.__force = self.__config["force"]
        self.__shuffle = self.__config["shuffle"]

        # Register your game handlers and provide any
        # other dynamic initialisation here

        if 0 == self.__state:
            # Register your host handlers here
            host.registerHandler("PlayerConnect", self.onPlayerConnect, 1)
            host.registerHandler("PlayerDisconnect", self.onPlayerDisconnect,
                                 1)
            host.registerGameStatusHandler(self.onGameStatusChanged)

        # Register our rcon command handlers
        # self.mm.registerRconCmdHandler( 'm', { 'method': self.cmdExec, 'subcmds': self.__cmds, 'level': 1 } ) # TODO: Disabled because see comment on top of the file

        # Update to the running state
        self.__state = 1
Ejemplo n.º 7
0
def init():
	connect()

	if master:
		host.registerHandler('QueueChatCommand', onQueue, True)
	
	host.registerHandler('Update', onUpdate)
Ejemplo n.º 8
0
def init():
	global pdb
	
	host.registerHandler('ProcessCommand', onCommand)
	
	pdb = PluginDB()
	pdb.dbconnect()
Ejemplo n.º 9
0
def init():
    global pdb

    host.registerHandler('ProcessCommand', onCommand)

    pdb = PluginDB()
    pdb.dbconnect()
Ejemplo n.º 10
0
def init():
	global pounceAccess
	host.registerHandler('UserJoined', onJoin)
	host.registerHandler('ProcessCommand', onCommand)
	
	# configuration
	config = host.config()
	pounceAccess = config.getInt("p_pounce_access", pounceAccess)
Ejemplo n.º 11
0
def init():
    global pounceAccess
    host.registerHandler('UserJoined', onJoin)
    host.registerHandler('ProcessCommand', onCommand)

    # configuration
    config = host.config()
    pounceAccess = config.getInt("p_pounce_access", pounceAccess)
Ejemplo n.º 12
0
def init():
	global pdb

	host.registerHandler('ProcessCommand', onCommand, True)
	
	pdb = PluginDB()
	print("[GETGAMES] Connecting to database...")
	pdb.dbconnect()
Ejemplo n.º 13
0
def init():
    global pdb

    host.registerHandler('ProcessCommand', onCommand, True)

    pdb = PluginDB()
    print("[GETGAMES] Connecting to database...")
    pdb.dbconnect()
Ejemplo n.º 14
0
def init():
	global controlAccess
	
	host.registerHandler('ProcessCommand', onCommand)
	host.registerHandler('ChatReceivedExtended', onTalk) # extended to distinguish between local chat and whispers
	
	# configuration
	config = host.config()
	controlAccess = config.getInt("p_copycat_access", controlAccess)
Ejemplo n.º 15
0
def init():
	global pdb

	host.registerHandler('ProcessCommand', onCommand)
	host.registerHandler('Update', onUpdate)
	
	pdb = PluginDB()
	pdb.notifyReady(dbReady)
	pdb.setPluginName("lottery")
Ejemplo n.º 16
0
def init():
    global pdb

    host.registerHandler('ProcessCommand', onCommand)
    host.registerHandler('Update', onUpdate)

    pdb = PluginDB()
    pdb.notifyReady(dbReady)
    pdb.setPluginName("lottery")
Ejemplo n.º 17
0
def init():
    global pdb
    host.registerHandler('ProcessCommand', onCommand)
    host.registerHandler('Update', onUpdate)

    if gqGamelist:
        pdb = PluginDB()
        pdb.dbconnect()

    refreshMaps()
Ejemplo n.º 18
0
def init():
    # Events
    host.registerHandler('PlayerConnect', onPlayerConnect, 1)
    host.registerGameStatusHandler(onGameStatusChanged)

    # Connect already connected players if reinitializing
    for p in bf2.playerManager.getPlayers():
        onPlayerConnect(p)

    if g_debug: print "unlocks.py[16]: Unlock module initialized"
Ejemplo n.º 19
0
def init():
	global pdb
	host.registerHandler('ProcessCommand', onCommand)
	host.registerHandler('Update', onUpdate)

	if gqGamelist:
		pdb = PluginDB()
		pdb.dbconnect()
	
	refreshMaps()
    def init(self):
        """Provides default initialisation."""
        self.__config = self.mm.getModuleConfig(configDefaults)

        if 0 == self.__state:
            host.registerHandler('PlayerChallenge', self.onPlayerChallenge, 1)
            host.registerHandler('PrePlayerConnect', self.onPrePlayerConnect,
                                 1)

        self.__state = 1
Ejemplo n.º 21
0
def init():
	# Events
	host.registerHandler('PlayerConnect', onPlayerConnect, 1)
	host.registerGameStatusHandler(onGameStatusChanged)
	
	# Connect already connected players if reinitializing
	for p in bf2.playerManager.getPlayers():
		onPlayerConnect(p)

	if g_debug: print "unlocks.py[16]: Unlock module initialized"
Ejemplo n.º 22
0
def init():
	global pdb, commandAccess

	host.registerHandler('ProcessCommand', onCommand, True)
	
	pdb = PluginDB()
	pdb.dbconnect()
	
	# configuration
	config = host.config()
	commandAccess = config.getInt("p_inactive_access", commandAccess)
Ejemplo n.º 23
0
def init():
	global minAccess, accessEnabled, accessBan
	
	host.registerHandler('UserJoined', onJoin)
	host.registerHandler('ProcessCommand', onCommand)
	
	# configuration
	config = host.config()
	minAccess = config.getInt("p_accesskick_minaccess", minAccess)
	accessEnabled = config.getBool("p_accesskick_enabled", accessEnabled)
	accessBan = config.getBool("p_accesskick_ban", accessBan)
Ejemplo n.º 24
0
def init():
    global controlAccess

    host.registerHandler('ProcessCommand', onCommand)
    host.registerHandler(
        'ChatReceivedExtended',
        onTalk)  # extended to distinguish between local chat and whispers

    # configuration
    config = host.config()
    controlAccess = config.getInt("p_copycat_access", controlAccess)
Ejemplo n.º 25
0
 def register(self, type, hook):
     hooks = self.hooks.get(type, [])
     hooks.append(hook)
     self.hooks[type] = hooks
     if DEBUG_HOOKS: print 'hookProxy: registered', hook, 'type', type
     
     if type not in self.registered:
         if DEBUG_HOOKS: print 'hookProxy: registered handler for', type
         hc = hookCaller(self, type)
         host.registerHandler(type, hc, 1)
         self.registered[type] = hc
Ejemplo n.º 26
0
def init():
    global pdb, commandAccess

    host.registerHandler('ProcessCommand', onCommand, True)

    pdb = PluginDB()
    pdb.dbconnect()

    # configuration
    config = host.config()
    commandAccess = config.getInt("p_inactive_access", commandAccess)
Ejemplo n.º 27
0
def init():
	# Events
	host.registerHandler('PlayerConnect', onPlayerConnect, 1)
	
	if bf2.serverSettings.getUseGlobalUnlocks():
		host.registerHandler('PlayerUnlocksResponse', onUnlocksResponse, 1)

	# Connect already connected players if reinitializing
	for p in bf2.playerManager.getPlayers():
		onPlayerConnect(p)

	if g_debug: print "Unlock module initialized"
Ejemplo n.º 28
0
def init():
    # events hook
    host.registerGameStatusHandler(onGameStatusChanged)
    if host.sgl_getIsAIGame() == 1:
        host.sh_setEnableCommander(1)
    else:
        host.sh_setEnableCommander(1)

    host.registerHandler("TimeLimitReached", onTimeLimitReached, 1)

    if g_debug:
        print "gpm_cq.py initialized"
Ejemplo n.º 29
0
def init():
    global minAccess, maxAccess, greetAccess, greetMessage

    host.registerHandler('UserJoined', onJoin)
    host.registerHandler('ProcessCommand', onCommand)

    # configuration
    config = host.config()
    greetAccess = config.getInt("p_greet_access", greetAccess)
    minAccess = config.getInt("p_greet_minaccess", minAccess)
    maxAccess = config.getInt("p_greet_maxaccess", maxAccess)
    greetMessage = config.getString("p_greet_message", greetMessage)
Ejemplo n.º 30
0
    def init( self ):
        if 0 == self._state:
            #host.registerHandler( 'EnterVehicle', self.onEnterVehicle, 1 )
            #host.registerHandler( 'PlayerScore', self.onScore, 1 )
            host.registerHandler( 'PlayerDeath', self.onDeath, 1 )
            if dev == True:
                host.registerHandler( 'ChatMessage', self.onChat, 1 )
            #host.registerHandler( 'PlayerSpawn', self.onPlayerSpawn, 1)
            #host.registerHandler( 'PlayerConnect', self.onPlayerConnect, 1)
            #host.registerHandler( 'PlayerDisconnect', self.onPlayerDisconnect, 1)
            host.registerGameStatusHandler(self.onGameStatusChanged) 
		# Update to the running state
        self._state = 1
Ejemplo n.º 31
0
def init():
    # events hook
    global g_plugin
    host.registerGameStatusHandler(onGameStatusChanged)
    if host.sgl_getIsAIGame() == 1:
        host.sh_setEnableCommander(1)
    else:
        host.sh_setEnableCommander(1)
        
    host.registerHandler('TimeLimitReached', onTimeLimitReached, 1)
    
    if g_debug: print "gpm_cq.py initialized"
    g_plugin = game.gameplayPlugin.pluginsystem()
Ejemplo n.º 32
0
    def init(self):
        if 0 == self._state:
            #host.registerHandler( 'EnterVehicle', self.onEnterVehicle, 1 )
            #host.registerHandler( 'PlayerScore', self.onScore, 1 )
            host.registerHandler('PlayerDeath', self.onDeath, 1)
            if dev == True:
                host.registerHandler('ChatMessage', self.onChat, 1)
            #host.registerHandler( 'PlayerSpawn', self.onPlayerSpawn, 1)
            #host.registerHandler( 'PlayerConnect', self.onPlayerConnect, 1)
            #host.registerHandler( 'PlayerDisconnect', self.onPlayerDisconnect, 1)
            host.registerGameStatusHandler(self.onGameStatusChanged)
# Update to the running state
        self._state = 1
Ejemplo n.º 33
0
def init():
	# Events

	if bf2.serverSettings.getUseGlobalRank():
	 	host.registerHandler('PlayerConnect', onPlayerConnect, 1)
		host.registerHandler('PlayerStatsResponse', onStatsResponse, 1)

	host.registerGameStatusHandler(onGameStatusChanged)
	
	# Connect already connected players if reinitializing
	for p in bf2.playerManager.getPlayers():
		onPlayerConnect(p)

	if g_debug: print "Rank module initialized"
Ejemplo n.º 34
0
def init():
    if g_debug: print "Initializing unlock module..."
    # Events
    host.registerHandler('PlayerConnect', onPlayerConnect, 1)

    # Added by Chump - for bf2statistics stats (plus de-indenting)
    #if bf2.serverSettings.getUseGlobalUnlocks():
    host.registerHandler('PlayerUnlocksResponse', onUnlocksResponse, 1)

    # Connect already connected players if reinitializing
    for p in bf2.playerManager.getPlayers():
        onPlayerConnect(p)

    if g_debug: print "Unlock module initialized"
Ejemplo n.º 35
0
def init():
    global pdb, controlAccess

    host.registerHandler("ProcessCommand", onCommand)
    host.registerHandler("Update", onUpdate)

    pdb = PluginDB()
    pdb.setPluginName("alarm")
    pdb.dbconnect()
    dbList()

    # configuration
    config = host.config()
    controlAccess = config.getInt("p_alarm_access", controlAccess)
Ejemplo n.º 36
0
def init():
    global pdb, controlAccess

    host.registerHandler('ProcessCommand', onCommand)
    host.registerHandler('Update', onUpdate)

    pdb = PluginDB()
    pdb.setPluginName("alarm")
    pdb.dbconnect()
    dbList()

    # configuration
    config = host.config()
    controlAccess = config.getInt("p_alarm_access", controlAccess)
Ejemplo n.º 37
0
def init():
	if g_debug: print "Initializing unlock module..."
	# Events
	host.registerHandler('PlayerConnect', onPlayerConnect, 1)

# Added by Chump - for bf2statistics stats (plus de-indenting)
	#if bf2.serverSettings.getUseGlobalUnlocks():
	host.registerHandler('PlayerUnlocksResponse', onUnlocksResponse, 1)

	# Connect already connected players if reinitializing
	for p in bf2.playerManager.getPlayers():
		onPlayerConnect(p)

	if g_debug: print "Unlock module initialized"
Ejemplo n.º 38
0
def init():
    # Events

    #if bf2.serverSettings.getUseGlobalRank():
    host.registerHandler('PlayerConnect', onPlayerConnect, 1)
    host.registerHandler('PlayerStatsResponse', onStatsResponse, 1)

    host.registerGameStatusHandler(onGameStatusChanged)

    # Connect already connected players if reinitializing
    for p in bf2.playerManager.getPlayers():
        onPlayerConnect(p)

    if g_debug: print "rank.py[24]: Rank module initialized"
Ejemplo n.º 39
0
    def init(self):
        """Provides default initialisation."""

        # Load the configuration
        self.__config = self.mm.getModuleConfig(configDefaults)

        # Register your game handlers and provide any
        # other dynamic initialisation here

        if 0 == self.__state:
            # Register your host handlers here
            host.registerHandler('PlayerSpawn', self.onPlayerSpawn, 1)

        # Update to the running state
        self.__state = 1
Ejemplo n.º 40
0
	def init( self ):
		"""Provides default initialisation."""

		# Load the configuration
		self.__config = self.mm.getModuleConfig( configDefaults )

		# Register your game handlers and provide any
		# other dynamic initialisation here

		if 0 == self.__state:
			# Register your host handlers here
			host.registerHandler( 'PlayerSpawn', self.onPlayerSpawn, 1 )

		# Update to the running state
		self.__state = 1
Ejemplo n.º 41
0
def init():
	global announceAccess, announceMessage, announceEnabled, announceInterval
	
	host.registerHandler('ProcessCommand', onCommand)
	host.registerHandler('Update', onUpdate)
	
	# configuration
	config = host.config()
	announceAccess = config.getInt("p_announce_access", announceAccess)
	
	announceMessage = config.getString("p_announce_message", announceMessage)
	
	if announceMessage:
		announceEnabled = True
		announceInterval = config.getInt("p_announce_interval", announceInterval)
Ejemplo n.º 42
0
def init():
	global afkTime, afkAccess, afkKick, afkExempt
	
	host.registerHandler('ProcessCommand', onCommand)
	host.registerHandler('ChatReceivedExtended', onTalk) # extended to distinguish between local chat and whispers
	host.registerHandler('Update', onUpdate)
	host.registerHandler('UserLeft', onLeave)
	host.registerHandler('UserJoined', onJoin)
	
	# configuration
	config = host.config()
	afkTime = config.getInt("p_afk_time", afkTime / 1000) * 1000
	afkAccess = config.getInt("p_afk_access", afkAccess)
	afkKick = config.getBool("p_afk_kick", afkKick)
	afkExempt = config.getInt("p_afk_exempt", afkExempt)
Ejemplo n.º 43
0
    def init(self):
        self.__config = self.mm.getModuleConfig(configDefaults)

        self.kickInterval = self.__config['kickInterval']
        self.msgInterval = self.__config['msgInterval']
        self.kickDelay = self.__config['kickDelay']
        self.prefixMsg = self.__config['prefixMsg']
        self.warningMsg = self.__config['warningMsg']
        self.enable_squadless_kick = self.__config['enable_squadless_kick']
        self.isPublicWarning = self.__config['isPublicWarning']

        if self.enable_squadless_kick == 1 and 0 == self.__state:
            host.registerHandler('PlayerSpawn', self.onPlayerSpawn)
            host.registerGameStatusHandler(self.onGameStatusChanged)

        self.__state = 1
Ejemplo n.º 44
0
    def init(self):
        """Provides default initialisation."""

        # Load the configuration
        self.__config = self.mm.getModuleConfig(configDefaults)

        # Load in the commands
        for line in self.__config['cmdBindings']:
            try:
                (aliases_str, cmd) = line.strip('"\' ').split(':', 1)
                self.__addCmd(None, aliases_str, cmd)
            except:
                self.mm.error("IGA: Invalid command binding '%s'" % line)

        # Load in the admins
        for line in self.__config['admins']:
            try:
                (admin, privs_str) = line.strip('"\' ').split(':', 1)
                self.__addAdmin(None, admin, privs_str)
            except:
                self.mm.error("IGA: Invalid admin '%s'" % line)

        # Load in the warnings
        for line in self.__config['warnings']:
            try:
                (aliases_str, warn) = line.split(':', 1)
                self.__addWarn(None, aliases_str, warn)
            except:
                self.mm.error("IGA: Invalid warning '%s'" % line)

        # Register your game handlers and provide any
        # other dynamic initialisation here
        self.mm.registerRconAuthHandler(self.inGameAuth, self.inGameAllowed)

        if 0 == self.__state:
            # Register your host handlers here
            host.registerHandler('ChatMessage', self.onChatMessage, 1)

        # Register our rcon command handlers
        self.mm.registerRconCmdHandler('iga', {
            'method': self.cmdExec,
            'subcmds': self.__cmds,
            'level': 1
        })

        # Update to the running state
        self.__state = 1
Ejemplo n.º 45
0
def init():
    # events hook
    global g_plugin
    host.registerGameStatusHandler(onGameStatusChanged)
    if host.sgl_getIsAIGame() == 1:
        host.sh_setEnableCommander(1)
    else:
        host.sh_setEnableCommander(1)
        
    host.registerHandler('TimeLimitReached', onTimeLimitReached, 1)
    
    # Reset ticket loss values
    game.gameplayPlugin.setDefaultTicketLossPerMin(1, game.gameplayPlugin.DEFAULT_TICKET_LOSS_PER_MIN)
    game.gameplayPlugin.setDefaultTicketLossPerMin(2, game.gameplayPlugin.DEFAULT_TICKET_LOSS_PER_MIN)
    
    if g_debug: print "gpm_cq.py initialized"
    g_plugin = game.gameplayPlugin.pluginsystem()
Ejemplo n.º 46
0
 def init():
 
    if g_debug or xlr_debug: print 'IDLEKICK: initializing IdleKick script'
    # Force at least 20 seconds between idle checks:
    if interval < 10: interval = 10
    # Print debug message if autokick is disabled:
    if autokick != 1:
       if g_debug or xlr_debug: print 'IDLEKICK: Idle autokick not enabled'
    
    # Autokick is enabled, so hook it up:
    else:
       if g_debug or xlr_debug: print 'IDLEKICK: Enabling kick for being idle. Max. checkfails = %s.' % (warnings)
 
       # Register 'PlayerConnect' callback:
       host.registerHandler('PlayerConnect', onPlayerConnect, 1)
       host.registerHandler('PlayerSpawn', onPlayerSpawn, 1)
       host.registerGameStatusHandler(onGameStatusChanged)
Ejemplo n.º 47
0
Archivo: afk.py Proyecto: w3gh/pychop
def init():
    global afkTime, afkAccess, afkKick, afkExempt

    host.registerHandler('ProcessCommand', onCommand)
    host.registerHandler(
        'ChatReceivedExtended',
        onTalk)  # extended to distinguish between local chat and whispers
    host.registerHandler('Update', onUpdate)
    host.registerHandler('UserLeft', onLeave)
    host.registerHandler('UserJoined', onJoin)

    # configuration
    config = host.config()
    afkTime = config.getInt("p_afk_time", afkTime / 1000) * 1000
    afkAccess = config.getInt("p_afk_access", afkAccess)
    afkKick = config.getBool("p_afk_kick", afkKick)
    afkExempt = config.getInt("p_afk_exempt", afkExempt)
Ejemplo n.º 48
0
	def init( self ):
		"""Provides default initialisation."""

		# Load the configuration
		self.__config = self.mm.getModuleConfig( configDefaults )

		# Register your game handlers and provide any
		# other dynamic initialisation here

		if 0 == self.__state:
			# Register your host handlers here
			host.registerHandler( 'PlayerSpawn', self.onPlayerSpawn, 1 )

		# Register our rcon command handlers
		self.mm.registerRconCmdHandler( 'sample', { 'method': self.cmdExec, 'subcmds': self.__cmds, 'level': 1 } )

		# Update to the running state
		self.__state = 1
Ejemplo n.º 49
0
def init():
	global OLDSCHOOL_LEVEL, PUNISH_METHOD, ANTICOMMANDER
	if OLDSCHOOL_LEVEL != 0:
		if ANTICOMMANDER == 1: host.registerHandler('ChangedCommander', onCommander, 1)
		if PUNISH_METHOD == 2: host.registerHandler('PlayerKilled', onPlayerKilled, 1)
		if PUNISH_METHOD == 0 or PUNISH_METHOD == 1 and OLDSCHOOL_LEVEL != 3: host.registerHandler('PlayerChangeWeapon', onPlayerChangeWeapon, 1)
		host.registerHandler('RemoteCommand', onRemoteCommand, 1)
		host.registerGameStatusHandler(onGameStatusChange)
		host.rcon_invoke('echo "bf2_oldschool.py by MisiekBest loaded"')
	else:
		host.rcon_invoke('echo "bf2_oldschool.py by MisiekBest loaded, script DISABLED by config!"')
Ejemplo n.º 50
0
	def init( self ):
		"""Provides default initialisation."""

		# Load the configuration
		self.__config = self.mm.getModuleConfig( configDefaults )

		# Load in the commands
		for line in self.__config['cmdBindings']:
			try:
				( aliases_str, cmd ) = line.strip( '"\' ' ).split( ':', 1 )
				self.__addCmd( None, aliases_str, cmd )
			except:
				self.mm.error( "IGA: Invalid command binding '%s'" % line )

		# Load in the admins
		for line in self.__config['admins']:
			try:
				( admin, privs_str ) = line.strip( '"\' ' ).split( ':', 1 )
				self.__addAdmin( None, admin, privs_str )
			except:
				self.mm.error( "IGA: Invalid admin '%s'" % line )

		# Load in the warnings
		for line in self.__config['warnings']:
			try:
				( aliases_str, warn ) = line.split( ':', 1 )
				self.__addWarn( None, aliases_str, warn )
			except:
				self.mm.error( "IGA: Invalid warning '%s'" % line )

		# Register your game handlers and provide any
		# other dynamic initialisation here
		self.mm.registerRconAuthHandler( self.inGameAuth, self.inGameAllowed )

		if 0 == self.__state:
			# Register your host handlers here
			host.registerHandler( 'ChatMessage', self.onChatMessage, 1 )

		# Register our rcon command handlers
		self.mm.registerRconCmdHandler( 'iga', { 'method': self.cmdExec, 'subcmds': self.__cmds, 'level': 1 } )

		# Update to the running state
		self.__state = 1
Ejemplo n.º 51
0
 def round_start(self, hooker):
     try:
         host.registerHandler('PlayerDeath', self.onPlayerDeath)
         host.registerHandler('PlayerSpawn', self.onPlayerSpawn)
         host.registerHandler('PlayerConnect', self.onPlayerConnect)
         host.registerHandler('PlayerDisconnect', self.onPlayerDisconnect)
         if DEBUG: print 'Spawnwave hooked'
         
         self.round_start_time = host.timer_getWallTime()
         if DEBUG: print 'Spawnwave round_start time is', self.round_start_time
     except Exception, e:
         print 'round_start exception', e
Ejemplo n.º 52
0
def init():
	global controlAccess
	host.registerHandler('ProcessCommand', onCommand, True)
	
	for name in startupLoad:
		importedPlugins[name] = __import__(name, globals(), locals(), [], -1)
		loadedPlugins[name] = importedPlugins[name]
		loadedPlugins[name].init()
	
	# configuration
	config = host.config()
	controlAccess = config.getInt("p_pluginman_access", controlAccess)
	startupConfLoad = config.getString("p_pluginman_plugins", "").split(" ")
	
	for name in startupConfLoad:
		if name.strip():
			name = ''.join(ch for ch in name.strip() if ch.isalnum() or ch == "_" or ch == "-")
			importedPlugins[name] = __import__(name, globals(), locals(), [], -1)
			loadedPlugins[name] = importedPlugins[name]
			loadedPlugins[name].init()
Ejemplo n.º 53
0
def onGameStatusChanged(status):
	global updateTimer
	if status == bf2.GameStatus.Playing:
		host.registerHandler('PlayerKilled', onPlayerKilled3)
		host.registerHandler('ExitVehicle', onExitVehicle)
		host.registerHandler('PlayerScore', onPlayerScore)
		
		if updateTimer:
			updateTimer.destroy()
	
		updateTimer = bf2.Timer(onUpdate, 1, 0)
		updateTimer.setRecurring(1)
	
		# connect already connected players if reinitializing
		for p in bf2.playerManager.getPlayers():
			onPlayerConnect(p)
			
		global g_lastPlayerChecked
		g_lastPlayerChecked = 0
	
	
	elif status == bf2.GameStatus.EndGame:
		givePositionalMedals(True, bf2.gameLogic.getWinner())
		
		# produce snapshot
		bf2.stats.snapshot.invoke()
			
		if g_debug: print "Destroyed timer"
		if updateTimer:
			updateTimer.destroy()
Ejemplo n.º 54
0
	def init( self ):
		"""Provides default initialisation."""
		self.__config = self.mm.getModuleConfig( configDefaults )
		self.__joinMessages = []
		self.__timedMessages = []
		self.__newPlayers = {}

		# Register our base handlers
		if 0 == self.__state:
			host.registerHandler( 'PlayerConnect', self.onPlayerConnect, 1 )
			host.registerHandler( 'PlayerSpawn', self.onPlayerSpawn, 1 )
			host.registerHandler( 'PlayerDisconnect', self.onPlayerDisconnect, 1 )

		# Load the join messages
		for msg in self.__config['joinMessages']:
			self.__joinMessages.append( msg )

		# Load in the timed messages
		for msg in self.__config['timedMessages']:
			try:
				( start, repeat, text ) = msg.split( ':', 2 )
				self.__addTimedMsg( int( start ), int( repeat ), text )
			except:
				self.mm.error( "Announcer: Invalid timed messaged '%s'" % msg )

		# Register our rcon command handlers
		self.mm.registerRconCmdHandler( 'announcer', { 'method': self.cmdExec, 'subcmds': self.__cmds, 'level': 1 } )

		self.__state = 1