Advertisement
Guest User

Untitled

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