Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1.     @property
  2.     def title(self, noprefix=False, noart=False, nosuffix=False, notitle=False):
  3.         """
  4.        Fancy format an object name in a VR-context.  Mainly used by
  5.        return_appearance() to pretty-print room contents but may have other
  6.        uses as well.
  7.        
  8.        """
  9.  
  10.         # Initialize.    
  11.         out = []
  12.         title = self.key
  13.  
  14.         # First check for the specific and general tags.
  15.         if not noart:
  16.             if self.tags.get("specific"):
  17.                 out.append("the")
  18.             elif self.tags.get("general"):
  19.                 if title and title[0] in 'aeiou':
  20.                     out.append('an')
  21.                 else:
  22.                     out.append('a')
  23.  
  24.         # Add the prefix, 'UNN', 'Lord', 'Captain', etc.
  25.         if not noprefix:            
  26.             x = (self.db.prefix or '')
  27.             x and out.append(x)
  28.  
  29.         # Add the base name.
  30.         out.append(title)
  31.  
  32.         # Add the suffix, 'Jr', 'III', 'Esquire', etc.
  33.         if not nosuffix:
  34.             x = (self.db.suffix or '')
  35.             x and out.append(x)
  36.  
  37.         return utils.capstr(' '.join(out))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement