示例#1
0
 def add_to_list(self, propname, success, redundant, announce_online=False):
     """
         Add a user to a list, letting them know if the work is redundant.
     If announce_online is true, lets the user know if the target is
     currently online.
     """
     object_list = getattr(self.caller.db, propname)
     if not object_list:
         object_list = []
     adding_list = validate_targets(self.caller,
                                    self.arglist,
                                    ignores=False,
                                    local_only=False)
     net_list = []
     for item in adding_list:
         if item in object_list:
             self.caller.msg(ALERT % "%s %s." % (redundant, item.name))
         else:
             net_list.append(item)
     for item in net_list:
         if announce_online and item.sessions and check_ignores(
                 self.caller, [item], silent=True) and check_hiding(
                     self.caller, [item]):
             self.caller.msg(ALERT % "%s is currently online." % item.name)
         self.caller.msg(ALERT % "%s %s." % (success, item.name))
         object_list.extend(net_list)
     setattr(self.caller.db, propname, object_list)
示例#2
0
 def announce_message(self, user, target, message, message_key, must_be_online=False):
     """
         Sends an announcement to other characters.
     message is a string to send.
     message_key is a label for the type of message being sent. An
         announcement that a user is connection might have this as "connection".
     must_be_online makes the message cancel if the user disconnects before
         the targets receive it.
     """
     if (must_be_online and not self.sessions) or (not check_hiding(user, [target])) or (not check_ignores(target, [self], silent=True) ) \
         or self.db.hiding or message_key in ignored_notifications(target):
         return
     target.msg(message)
示例#3
0
 def display_watching(self):
     watching_list = self.caller.db.watching
     if not watching_list:
         self.caller.msg(ALERT % "You are not watching anyone. If you find someone interesting, or meet a friend, be sure to watch them with: watch {yYourFriend'sNameHere{n")
         return
     watching_list = check_ignores(self.caller, watching_list, silent=True)
     watching_list = check_sleepers(self.caller, watching_list, silent=True)
     watching_list = check_hiding(self.caller, watching_list)
     ROW_LENGTH = 4
     watching_list = [watching_list[i:i+ROW_LENGTH] for i in range(0, len(watching_list), ROW_LENGTH)]
     if not watching_list:
         self.caller.msg("{cNo one you are watching is online.{n")
         return
     self.caller.msg("{cPeople online that you are watching:{n")
     for group in watching_list:
         self.caller.msg("%-20s"*len(group) % tuple(group))
示例#4
0
 def announce_message(self,
                      user,
                      target,
                      message,
                      message_key,
                      must_be_online=False):
     """
         Sends an announcement to other characters.
     message is a string to send.
     message_key is a label for the type of message being sent. An
         announcement that a user is connection might have this as "connection".
     must_be_online makes the message cancel if the user disconnects before
         the targets receive it.
     """
     if (must_be_online and not self.sessions) or (not check_hiding(user, [target])) or (not check_ignores(target, [self], silent=True) ) \
         or self.db.hiding or message_key in ignored_notifications(target):
         return
     target.msg(message)
示例#5
0
 def display_watching(self):
     watching_list = self.caller.db.watching
     if not watching_list:
         self.caller.msg(
             ALERT %
             "You are not watching anyone. If you find someone interesting, or meet a friend, be sure to watch them with: watch {yYourFriend'sNameHere{n"
         )
         return
     watching_list = check_ignores(self.caller, watching_list, silent=True)
     watching_list = check_sleepers(self.caller, watching_list, silent=True)
     watching_list = check_hiding(self.caller, watching_list)
     ROW_LENGTH = 4
     watching_list = [
         watching_list[i:i + ROW_LENGTH]
         for i in range(0, len(watching_list), ROW_LENGTH)
     ]
     if not watching_list:
         self.caller.msg("{cNo one you are watching is online.{n")
         return
     self.caller.msg("{cPeople online that you are watching:{n")
     for group in watching_list:
         self.caller.msg("%-20s" * len(group) % tuple(group))
示例#6
0
 def add_to_list(self, propname, success, redundant, announce_online=False):
     """
         Add a user to a list, letting them know if the work is redundant.
     If announce_online is true, lets the user know if the target is
     currently online.
     """
     object_list = getattr(self.caller.db, propname)
     if not object_list:
         object_list = []
     adding_list = validate_targets(self.caller, self.arglist, ignores=False, local_only=False)
     net_list = []
     for item in adding_list:
         if item in object_list:
             self.caller.msg(ALERT % "%s %s." % (redundant, item.name))
         else:
             net_list.append(item)
     for item in net_list:
         if announce_online and item.sessions and check_ignores(self.caller, [item], silent=True) and check_hiding(self.caller, [item]):
             self.caller.msg(ALERT % "%s is currently online." % item.name)
         self.caller.msg(ALERT % "%s %s." % (success, item.name))
         object_list.extend(net_list)
     setattr(self.caller.db, propname, object_list)