Example #1
0
 def __init__(self,
              name,
              description,
              inventory=None,
              up=None,
              down=None,
              north=None,
              south=None,
              east=None,
              west=None,
              displayAutomatically=False):
     if inventory is None:
         inventory = InventoryManager(inside=True,
                                      on=False,
                                      under=False)
     self.name = name
     self.__class__.registry[name] = self
     self.description = description
     self.directions = dict()
     self.directions['up'] = up
     self.directions['down'] = down
     self.directions['north'] = north
     self.directions['south'] = south
     self.directions['east'] = east
     self.directions['west'] = west
     GameEntity.__init__(self,
                         name=name,
                         description=description,
                         inventory=inventory,
                         displayAutomatically=displayAutomatically)
Example #2
0
 def __init__(self,
              name,
              description=None,
              inventory=None,
              aliases=None,
              exposeInventory=False,
              displayAutomatically=True,
              shortDescription=None,
              displayName=None,
              recurseAutomatically=True):
     if inventory is None:
         inventory = InventoryManager(on=False,
                                      under=False,
                                      inside=True)
         inventory.slots['inside'].exposed = False
         
     GameEntity.__init__(self,
                         name=name,
                         description=description,
                         inventory=inventory,
                         aliases=aliases,
                         exposeInventory=exposeInventory,
                         displayAutomatically=displayAutomatically,
                         shortDescription=shortDescription,
                         displayName=displayName,
                         recurseAutomatically=recurseAutomatically)
     self.__class__.registry[name] = self
Example #3
0
 def __init__(self,
              name,
              displayName=None,
              description=None,
              shortDescription=None,
              inventory=None,
              aliases=None,
              isGettable=False,
              displayAutomatically=True):
     GameEntity.__init__(self,
                         name=name,
                         description=description,
                         shortDescription=shortDescription,
                         inventory=inventory,
                         aliases=aliases,
                         isGettable=isGettable,
                         displayAutomatically=displayAutomatically)
     self.__class__.registry[name] = self
     self.displayName = displayName
     if displayName is not None:
         self.names.add(displayName.lower())
Example #4
0
 def getDescription(self,
                    isLooking=False):
     description = GameEntity.getDescription(self,
                                             isLooking=isLooking)
     for slot in self.inventory.slots.values():
         for entity in slot.values():
             if not entity.displayAutomatically:
                 continue
             entityDescription = entity.getDescription(isLooking=isLooking)
             if entityDescription is not None:
                 if description:
                     description = '%s\n%s' % (description,
                                               entityDescription)
                 else:
                     description = entityDescription
     return description
Example #5
0
 def getDescription(self,
                    isLooking=False):
     description = GameEntity.getDescription(self,
                                             isLooking=isLooking)
     for slotKey in self.inventory.slots.keys():
         inventoryDescription = self.getDescriptionOfContents(
                                       inventory=self.inventory,
                                       slotKey=slotKey)
         if inventoryDescription is not None:
             description = '%s\n%s' % (description,
                                       inventoryDescription)
     if self.attachedTo:
         description = '%s  Attached to %s is %s' %\
                                 (description,
                                  self.getDisplayNameWithDefiniteArticle(),
                                  self.getListOfAttachedEntities())
         
     return description