示例#1
0
	def __init__(self, sock, server, game):
		Connection.__init__(self, sock, server)
		
		self.game=game
		self.player=None
		self._encoder = encoder('plaintext')
		
		# client commands
		self._commands = {
			'SET': self._set_prop,
			"LOGIN": self.game.login,
			"LOGOUT": self.game.logout,
			"PING": self.ping,
			"PLAYERINFO": self.game.playerinfo,
			"NEWUSER": self.game.NewUser,
			"LIST_OF_ENTITIES": self.game.list_of_entities,
			"ENTINFO": self.game.entity_info,
			"ENTACTION": self.game.EntAction,
			"TYPEINFO": entity.typeinfo,
			"PLAYERS": self.game.Players,
			"QUIT": self.game.logout
		}
		
		# properties
		self._props = {
			'ENCODER': self._set_encoder
		}
示例#2
0
    def __init__(self, sock, server, game):
        Connection.__init__(self, sock, server)

        self.game = game
        self.player = None
        self._encoder = encoder('plaintext')

        # client commands
        self._commands = {
            'SET': self._set_prop,
            "LOGIN": self.game.login,
            "LOGOUT": self.game.logout,
            "PING": self.ping,
            "PLAYERINFO": self.game.playerinfo,
            "NEWUSER": self.game.NewUser,
            "LIST_OF_ENTITIES": self.game.list_of_entities,
            "ENTINFO": self.game.entity_info,
            "ENTACTION": self.game.EntAction,
            "TYPEINFO": entity.typeinfo,
            "PLAYERS": self.game.Players,
            "QUIT": self.game.logout
        }

        # properties
        self._props = {'ENCODER': self._set_encoder}
示例#3
0
	def _set_encoder(self, name):
		try:
			self._encoder = encoder(name)
		except KeyError:
			raise CommandError, 'Invalid value'
示例#4
0
 def _set_encoder(self, name):
     try:
         self._encoder = encoder(name)
     except KeyError:
         raise CommandError, 'Invalid value'