Пример #1
0
 def _make_item(self):
     newitem = Item(self._command[1], self._command[2])
     addinventory(self._local, StatusConst.INVENTORY, newitem)
     self._controller.addcommand(self._local.title, CommandConst.GET, Get)
     self._controller.addcommand(self._local.title, CommandConst.SEE, See)
     if len(self._command) > 3:
         self._createstatus(newitem, self._command[3:])
         if hasstatus(newitem, StatusConst.CONTAINER):
             self._controller.addcommand(self._local.title, CommandConst.OPEN, Open)
         if hasstatus(newitem, StatusConst.QUANT):
             for i in range(int(getstatus(newitem, StatusConst.QUANT))-1):
                 addinventory(self._local, StatusConst.INVENTORY, newitem)
         if hasstatus(newitem, StatusConst.INSIDE):
             containername = getstatus(newitem, StatusConst.INSIDE)
             inv = getinventory(self._local, StatusConst.INVENTORY)
             if containername in inv:
                 addstatus(newitem, StatusConst.VISIBLE, False)
             else:
                 raise ContainerNotFoundError(containername)
Пример #2
0
    def __call__(self, args):
        if self.local.name == "Entrance" and args[0].lower() == "north":
            self.local.description = "You are in the Entrance.\n" "The Cave is to the north."
        if self.local.name == "Cave" and args[0].lower() == "east":
            self.local.description = (
                "You are in the Cave.\n" "The Corridor is to the east and the Entrance is to the south."
            )
        if self.local.name == "Corridor" and args[0].lower() == "up":
            self.local.description = (
                "You are in the Corridor.\n"
                "The Cave is to the east and the sign will tell "
                "you where the next room is."
            )
        if self.local.name == "Hallway" and self._controller.hasitem("Key") and args[0].lower() == "east":
            self.local.description = (
                "You are in the Hallway.\n"
                "Below you is the Corridor and east of you is the door."
                "You can also see a box here."
            )

        if self.local.name == "Vault" and not getstatus(self.local, "gate_closed") and args[0].lower() == "south":
            self.local.description = (
                "Here is a button and a gate that leads to the south.\n "
                "To open the gate, you must push the button.\n "
                "To press the button and open the gate, simply type 'push button'.\n"
                "Go ahead and try it now."
            )
            return Go.__call__(self, args)
        if self.local.name == "Study" and not getstatus(self.local, "portal_closed"):
            self.local.description = (
                "You are in the Study.\n"
                "You see a portal to the west and a Wizard here.\n"
                "The Vault is to the north."
            )
            return Go.__call__(self, args)
        return Go.__call__(self, args)
 def gettextobject(self, local, idx):
     return getstatus(local, idx)
 def getstatus(self,idx,idstatus):
     return getstatus(idx,idstatus)