def create_place_cmdset(self, exidbobj): """ Helper function for creating an exit command set + command. The command of this cmdset has the same name as the Exit object and allows the exit to react when the account enter the exit's name, triggering the movement between rooms. Args: exidbobj (Object): The DefaultExit object to base the command on. """ # create the place command. We give the properties here, # to always trigger metaclass preparations cmd = self.place_command(key=exidbobj.db_key.strip().lower(), aliases=exidbobj.aliases.all(), locks=str(exidbobj.locks), auto_help=False, destination=exidbobj.db_destination, arg_regex=r"^$", is_exit=True, obj=exidbobj) # create a cmdset exit_cmdset = CmdSet(None) exit_cmdset.key = 'PlaceCmdSet' exit_cmdset.priority = self.priority exit_cmdset.duplicates = True # add command to cmdset exit_cmdset.add(cmd) return exit_cmdset
def create_place_cmdset(self, placeobj): """ Helper function for creating an place command set + command. The command of this cmdset has the same name as the Place object and allows the place to react when the account enter the place's name, triggering messages to occupants. Args: placeobj (Object): The PlaceObj object to base the command on. """ # create the place command. We give the properties here, # to always trigger metaclass preparations cmd = self.place_command(key=placeobj.db_key.strip().lower(), aliases=placeobj.aliases.all(), locks=str(placeobj.locks), auto_help=False, destination=placeobj.db_destination, arg_regex=r"^$", is_exit=False, obj=placeobj) # create a cmdset place_cmdset = CmdSet(None) place_cmdset.key = 'PlaceCmdSet' place_cmdset.priority = self.priority place_cmdset.duplicates = True # add command to cmdset place_cmdset.add(cmd) return place_cmdset
def test_multimatch(self): # set up fake matches and store on command instance cmdset = CmdSet() cmdset.add(general.CmdLook()) cmdset.add(general.CmdLook()) matches = cmdparser.build_matches("look", cmdset) multimatch = syscommands.SystemMultimatch() multimatch.matches = matches self.call(multimatch, "look", "")
def _add_multiple(obj: CmdSet, cmds_to_add: Sequence = tuple()): for cmd in cmds_to_add: obj.add(cmd)