Esempio n. 1
0
 def player_joined(self):
     """
     Called when we join the game. If the server is in online mode, this
     means the server accepted our session.
     """
     Protocol.player_joined(self)
     self.logger.info("Joined the game.")
Esempio n. 2
0
    def player_joined(self):
        """Called when the player joins the game"""
        Protocol.player_joined(self)

        self.logger.info("%s has joined." % self.username)

        self.switch_protocol_mode("play")
Esempio n. 3
0
 def player_joined(self):
     """
     Called when we join the game. If the server is in online mode, this
     means the server accepted our session.
     """
     Protocol.player_joined(self)
     self.logger.info("Joined the game.")
Esempio n. 4
0
    def player_joined(self):
        """Called when the player joins the game"""
        Protocol.player_joined(self)

        self.logger.info("%s has joined." % self.display_name)

        self.switch_protocol_mode("play")
Esempio n. 5
0
    def close(self, reason=None):
        if not self.closed and reason is not None:
            # Kick the player if possible.
            if self.protocol_mode == "play":
                def real_kick(*a):
                    self.send_packet(0x40, self.buff_type.pack_chat(reason))
                    Protocol.close(self, reason)

                if self.safe_kick:
                    self.safe_kick.addCallback(real_kick)
                else:
                    real_kick()
            else:
                if self.protocol_mode == "login":
                    self.send_packet(0x00, self.buff_type.pack_chat(reason))
                Protocol.close(self, reason)
        else:
            Protocol.close(self, reason)
Esempio n. 6
0
    def close(self, reason=None):
        """Closes the connection"""
        if not self.closed and reason is not None:
            # Kick the player if possible.
            if self.protocol_mode == "play":

                def real_kick(*a):
                    self.send_packet("disconnect",
                                     self.buff_type.pack_chat(reason))
                    super(ServerProtocol, self).close(reason)

                if self.safe_kick:
                    self.safe_kick.addCallback(real_kick)
                else:
                    real_kick()
            else:
                if self.protocol_mode == "login":
                    self.send_packet("login_disconnect",
                                     self.buff_type.pack_chat(reason))
                Protocol.close(self, reason)
        else:
            Protocol.close(self, reason)
Esempio n. 7
0
    def close(self, reason=None):
        """Closes the connection"""
        if not self.closed and reason is not None:
            # Kick the player if possible.
            if self.protocol_mode == "play":
                def real_kick(*a):
                    self.send_packet(
                        "disconnect",
                        self.buff_type.pack_chat(reason))
                    super(ServerProtocol, self).close(reason)

                if self.safe_kick:
                    self.safe_kick.addCallback(real_kick)
                else:
                    real_kick()
            else:
                if self.protocol_mode == "login":
                    self.send_packet(
                        "login_disconnect",
                        self.buff_type.pack_chat(reason))
                Protocol.close(self, reason)
        else:
            Protocol.close(self, reason)
Esempio n. 8
0
    def player_left(self):
        """Called when the player leaves the game"""
        Protocol.player_left(self)

        self.logger.info("%s has left." % self.username)
Esempio n. 9
0
 def __init__(self, factory, addr):
     Protocol.__init__(self, factory, addr)
     self.server_id    = crypto.make_server_id()
     self.verify_token = crypto.make_verify_token()
Esempio n. 10
0
 def player_left(self):
     Protocol.player_left(self)
     self.logger.info("Left the game.")
Esempio n. 11
0
 def player_joined(self):
     Protocol.player_joined(self)
     self.logger.info("Joined the game.")
Esempio n. 12
0
 def connection_made(self):
     Protocol.connection_made(self)
     self.switch_protocol_mode(self.protocol_mode_next)
Esempio n. 13
0
 def player_left(self):
     """Called when we leave the game."""
     Protocol.player_left(self)
     self.logger.info("Left the game.")
Esempio n. 14
0
 def __init__(self, factory, addr):
     Protocol.__init__(self, factory, addr)
Esempio n. 15
0
    def player_left(self):
        Protocol.player_left(self)

        self.logger.info("%s has left." % self.username)
Esempio n. 16
0
 def real_kick(*a):
     self.send_packet(0x40, self.buff_type.pack_chat(reason))
     Protocol.close(self, reason)
Esempio n. 17
0
 def __init__(self, factory, remote_addr):
     Protocol.__init__(self, factory, remote_addr)
Esempio n. 18
0
 def connection_lost(self, reason=None):
     """Called when the connection is lost"""
     if self.protocol_mode in ("login", "play"):
         self.factory.players.discard(self)
     Protocol.connection_lost(self, reason)
Esempio n. 19
0
    def player_left(self):
        """Called when the player leaves the game"""
        Protocol.player_left(self)

        self.logger.info("%s has left." % self.display_name)
Esempio n. 20
0
 def connection_made(self):
     """Called when the connection is established"""
     Protocol.connection_made(self)
     self.switch_protocol_mode(self.protocol_mode_next)
Esempio n. 21
0
 def __init__(self, factory, remote_addr):
     Protocol.__init__(self, factory, remote_addr)
Esempio n. 22
0
    def player_joined(self):
        Protocol.player_joined(self)

        self.logger.info("%s has joined." % self.username)

        self.switch_protocol_mode("play")
Esempio n. 23
0
 def real_kick(*a):
     self.send_packet("disconnect",
                      self.buff_type.pack_chat(reason))
     Protocol.close(self, reason)
Esempio n. 24
0
 def connection_made(self):
     Protocol.connection_made(self)
     self.switch_protocol_mode(self.protocol_mode_next)
Esempio n. 25
0
 def player_left(self):
     """Called when we leave the game."""
     Protocol.player_left(self)
     self.logger.info("Left the game.")
Esempio n. 26
0
 def __init__(self, factory, remote_addr):
     Protocol.__init__(self, factory, remote_addr)
     self.server_id = crypto.make_server_id()
     self.verify_token = crypto.make_verify_token()
Esempio n. 27
0
 def player_joined(self):
     Protocol.player_joined(self)
     self.logger.info("Joined the game.")
Esempio n. 28
0
 def connection_lost(self, reason=None):
     """Called when the connection is lost"""
     if self.protocol_mode in ("login", "play"):
         self.factory.players.discard(self)
     Protocol.connection_lost(self, reason)
Esempio n. 29
0
 def player_left(self):
     Protocol.player_left(self)
     self.logger.info("Left the game.")
Esempio n. 30
0
 def __init__(self, factory, addr):
     Protocol.__init__(self, factory, addr)
Esempio n. 31
0
 def real_kick(*a):
     self.send_packet("disconnect",
         self.buff_type.pack_chat(reason))
     Protocol.close(self, reason)