Example #1
0
	def __init__(self):
		FBRconProtocol.__init__(self)
		# need to move some (all?) of these handlers into the parent class, or a mixin, should probably evict the 
		# modehash/levelhash too
		self.handlers = {
			"player.onJoin":          self.player_onJoin,
			"player.onLeave":         self.player_onLeave,
			"player.onAuthenticated": self.player_onAuthenticated,
			"player.onChat":          self.player_onChat,
			"player.onTeamChange":    self.player_onTeamChange,
			"player.onSquadChange":   self.player_onSquadChange,
			"player.onKill":          self.player_onKill,
			"server.onLevelLoaded":   self.server_onLevelLoaded,
			"punkBuster.onMessage":   self.nullop,
			"player.onSpawn":         self.nullop,
			"version":                self.nullop,
			"serverInfo":             self.nullop,
			"listPlayers":            self.nullop,
			"server.onRoundOver":     self.nullop,
			"server.onRoundOverPlayers": self.nullop,
			"server.onRoundOverTeamScores": self.nullop,
			"login.hashed": self.nullop,
			"admin.say": self.nullop,
			"vars.preset": self.nullop,
		}
		self.seq = 1
		self.callbacks = {}
		self.server = Server(self)
Example #2
0
 def __init__(self):
     FBRconProtocol.__init__(self)
     self.server = Server()
     self.stateapi = StateAPI(self.server, self)
     self.handlers = {}
     self._register_handler('player.onJoin', self.stateapi.player_joined, 2)
     self._register_handler('player.onLeave', self.stateapi.player_left, 2)
     self._register_handler('player.onAuthenticated', self.stateapi.player_authenticated, 1)
     self._register_handler('player.onSpawn', self.stateapi.player_spawned, 1+1)
     self._register_handler('player.onKicked', self.stateapi.player_kicked, 2)
     self._register_handler('player.onChat', self.stateapi.player_chat, 3)
     self._register_handler('player.onTeamChange', self.stateapi.player_team_changed, 3)
     self._register_handler('player.onSquadChange', self.stateapi.player_squad_changed, 3)
     self._register_handler('punkBuster.onMessage', self.stateapi.pb_message, 1)
     self._register_handler('server.onLoadingLevel', self.stateapi.server_loading_level, 3)
     self._register_handler('server.onLevelStarted', self.stateapi.server_start_level, 0)
     self._register_handler('server.onRoundOver', self.stateapi.server_round_over, 1)
     self._register_handler('server.onRoundOverPlayers', self.stateapi.server_round_over_playerdata, 1)
     self._register_handler('server.onRoundOverTeamScores', self.stateapi.server_round_over_teamdata, 1)
     self._register_handler('player.onKill', self.stateapi.player_killed, 3)
     self._register_handler('serverInfo', self.stateapi.server_info_hint, 0)
     #self._register_handler('serverInfo', self.stateapi.server_info, 7, processor=self.server_info_parser)
     self.connection_made_handler = self.stateapi.connection_made
     self.connection_lost_handler = self.stateapi.connection_lost
     self.seq = 1
     self.callbacks = {}
     self.plugins = []
     self.plugins.append( DebugPlugin(self.stateapi, self) )
     self.plugins.append( ToyPlugin(self.stateapi, self) )
Example #3
0
 def connectionMade(self):
     self.params = self.factory.params
     FBRconProtocol.connectionMade(self)
     ver   = yield self.sendRequest(["version"])
     salt  = yield self.sendRequest(["login.hashed"])
     m = hashlib.md5()
     m.update(salt[1].decode("hex"))
     m.update(self.factory.params["secret"])
     login = yield self.sendRequest(["login.hashed", m.digest().encode("hex").upper()])
     event = yield self.sendRequest(["admin.eventsEnabled", "true"])
     self.connection_made_handler()
Example #4
0
	def connectionMade(self):
		self.params = self.factory.params
		self.mongo  = self.factory.rm.mongo
		FBRconProtocol.connectionMade(self)
		ver   = yield self.sendRequest(["version"])
		salt  = yield self.sendRequest(["login.hashed"])
		m = hashlib.md5()
		m.update(salt[1].decode("hex"))
		m.update(self.factory.params["secret"])
		login = yield self.sendRequest(["login.hashed", m.digest().encode("hex").upper()])
		event = yield self.sendRequest(["admin.eventsEnabled", "true"])
		players = yield self.admin_listPlayers()
		for player in players:
			pl = players[player]
			ph = self.server.addPlayer(pl['name'], pl['guid'])
		self.postMessage("status", "connectionMade")
Example #5
0
	def __init__(self):
		FBRconProtocol.__init__(self)
		self.handlers = {
			"player.onJoin":          self.player_onJoin,
			"player.onLeave":         self.player_onLeave,
			"player.onAuthenticated": self.player_onAuthenticated,
			"player.onChat":          self.player_onChat,
			"player.onTeamChange":    self.player_onTeamChange,
			"player.onSquadChange":   self.player_onSquadChange,
			"player.onKill":          self.nullop, # temporary
			"server.onLevelLoaded":   self.server_onLevelLoaded,
			"punkBuster.onMessage":   self.nullop,
			"player.onSpawn":         self.nullop,
			"version":                self.nullop,
			"serverInfo":             self.nullop,
			"listPlayers":            self.nullop,
			"server.onRoundOver":     self.nullop,
			"server.onRoundOverPlayers": self.nullop,
			"server.onRoundOverTeamScores": self.nullop,
		}
		self.seq = 1
		self.callbacks = {}
		self.server = Server(self)
Example #6
0
 def connectionLost(self, reason):
     self.connection_lost_handler(reason)
     FBRconProtocol.connectionLost(self, reason)
Example #7
0
	def connectionLost(self, reason):
		self.postMessage("status", "connectionLost")
		FBRconProtocol.connectionLost(self, reason)