Example #1
0
 def at_pre_unpuppet(self):
     """
     We stow away the character when logging off, otherwise the character object will
     remain in the room also after the player logged off ("headless", so to speak).
     """
     if self.location:  # have to check, in case of multiple connections closing
         if len(self.sessions) > 1:
             self.location.msg_contents("{c%s has dropped a connection.{n" %
                                        self.name,
                                        exclude=[self])
         else:
             self.location.msg_contents("{c%s has disconnected.{n" %
                                        self.name,
                                        exclude=[self])
             self.db.prelogout_location = self.location
             self.location = None
             self.db.lastoff = time.time()
             if not self.db.laston:
                 self.db.laston = 0
             if self.db.lastoff - self.db.laston >= WOCharacter.DELAY:
                 message = ALERT % "Somewhere on %s, %s has disconnected." % (
                     SERVERNAME, self.name)
                 action_watchers(self,
                                 self.announce_message,
                                 kwargs={
                                     'message': message,
                                     'message_key': 'connection'
                                 })
Example #2
0
    def at_post_puppet(self):
        """
        This recovers the character again after having been "stowed away" at disconnect.
        """
        if self.db.prelogout_location:
            # try to recover
            self.location = self.db.prelogout_location
        if self.location == None:
            # make sure location is never None (home should always exist)
            self.location = self.home
        # save location again to be sure
        self.db.prelogout_location = self.location

        if self.location:
            self.location.msg_contents("{c%s has connected." % self.name, exclude=[self])
            self.location.at_object_receive(self, self.location)
        # Save login time.
        if len(self.sessions) <= 1:
            self.db.laston = time.time()
        # Announce connection to watchers
        if len(self.sessions) == 1:
            message = ALERT % "Somewhere on %s, %s has connected." % ( SERVERNAME, self.name )
        else:
            message = ALERT % "Somewhere on %s, %s has reconnected." % ( SERVERNAME, self.name )
        action_watchers(self, self.announce_message, delay=WOCharacter.DELAY, kwargs={ 'message' : message, 'message_key' : 'connection', 'must_be_online' : True })
        print "I ran!"
        self.execute_cmd('look')
        self.execute_cmd('mail/check quiet')
        self.execute_cmd('watch')
Example #3
0
 def at_pre_unpuppet(self):
     """
     We stow away the character when logging off, otherwise the character object will
     remain in the room also after the player logged off ("headless", so to speak).
     """
     if self.location: # have to check, in case of multiple connections closing
         if len(self.sessions) > 1:
             self.location.msg_contents("{c%s has dropped a connection.{n" % self.name, exclude=[self])
         else:
             self.location.msg_contents("{c%s has disconnected.{n" % self.name, exclude=[self])
             self.db.prelogout_location = self.location
             self.location = None
             self.db.lastoff = time.time()
             if not self.db.laston:
                 self.db.laston = 0
             if self.db.lastoff - self.db.laston >= WOCharacter.DELAY:
                 message = ALERT % "Somewhere on %s, %s has disconnected." % ( SERVERNAME, self.name )
                 action_watchers(self, self.announce_message, kwargs={ 'message' : message, 'message_key' : 'connection' })
Example #4
0
    def at_post_puppet(self):
        """
        This recovers the character again after having been "stowed away" at disconnect.
        """
        if self.db.prelogout_location:
            # try to recover
            self.location = self.db.prelogout_location
        if self.location == None:
            # make sure location is never None (home should always exist)
            self.location = self.home
        # save location again to be sure
        self.db.prelogout_location = self.location

        if self.location:
            self.location.msg_contents("{c%s has connected." % self.name,
                                       exclude=[self])
            self.location.at_object_receive(self, self.location)
        # Save login time.
        if len(self.sessions) <= 1:
            self.db.laston = time.time()
        # Announce connection to watchers
        if len(self.sessions) == 1:
            message = ALERT % "Somewhere on %s, %s has connected." % (
                SERVERNAME, self.name)
        else:
            message = ALERT % "Somewhere on %s, %s has reconnected." % (
                SERVERNAME, self.name)
        action_watchers(self,
                        self.announce_message,
                        delay=WOCharacter.DELAY,
                        kwargs={
                            'message': message,
                            'message_key': 'connection',
                            'must_be_online': True
                        })
        print "I ran!"
        self.execute_cmd('look')
        self.execute_cmd('mail/check quiet')
        self.execute_cmd('watch')