def _setupConfiguration(self): """ Goes through and sets up all the engine-specific configuration pieces. """ c = self._managers["config"] # this one doesn't seem to do anything # c.add("variablechar", config.CharConfig("variablechar", "$", 0, "denotes variables")) cops = config.options c.add("repeathistory", config.BoolConfig("repeathistory", utils.convert_boolean(cops.get("repeathistory", 1)), 0, "Whether (yes) or not (no) we record repeated user input in the " + "history buffer. For example, if you type \"north\" and then " + "\"north\" again, if repeathistory is on, we record both. " + "Otherwise we would only record the first one.")) c.add("commandchar", config.CharConfig("commandchar", config.options.get("commandchar", "#"), 0, "The character used to denote a command.")) c.add("debugmode", config.BoolConfig("debugmode", utils.convert_boolean(cops.get("debugmode", 0)), 0, "Debug mode helps you to figure out how your commands are being " + "evaluated.")) c.add("promptdetection", config.BoolConfig("promptdetection", utils.convert_boolean(cops.get("promptdetection", 0)), 0, "Prompt detection is done in net.py when mud data comes in. " + "This toggles whether we detect prompts or not. This won't help " + "you unless you have a plugin which requires it.")) c.add("ansicolor", config.BoolConfig("ansicolor", utils.convert_boolean(cops.get("ansicolor", 1)), 1, "Allows you to enable or disable ansi color handling.")) c.add("mudecho", config.BoolConfig("mudecho", utils.convert_boolean(cops.get("mudecho", 1)), 0, "Whether (1) or not (0) we're echoing user input to the ui.")) c.add("datadir", config.StringConfig("datadir", config.options["datadir"], 0, "Default directory to find config files etc.")) c.add("splitchar", config.CharConfig("splitchar", config.options.get("splitchar", ";"), 0, "The character used to split commands in a single input.")) self._sessions["common"].setupCommonSession()
def setupCommonSession(self): import config c = self._engine.getConfigManager() if type(config.options["snoopdefault"]) is list: config.options["snoopdefault"] = config.options["snoopdefault"][0] tc = config.BoolConfig("snoop", utils.convert_boolean(config.options['snoopdefault']), 0, "Whether or not you see the data from this session when it's not " "active.") c.add("snoop", tc, self) tc = config.BoolConfig("verbatim", 0, 0, "Whether we're in verbatim mode where we pass the user text " "straight to the mud without massaging it.") c.add("verbatim", tc, self)
def setupCommonSession(self): import config c = self._engine.getConfigManager() if type(config.options["snoopdefault"]) is list: config.options["snoopdefault"] = config.options["snoopdefault"][0] tc = config.BoolConfig( "snoop", utils.convert_boolean(config.options['snoopdefault']), 0, "Whether or not you see the data from this session when it's not " "active.") c.add("snoop", tc, self) tc = config.BoolConfig( "verbatim", 0, 0, "Whether we're in verbatim mode where we pass the user text " "straight to the mud without massaging it.") c.add("verbatim", tc, self)
def check(self, value): ret = utils.convert_boolean(value) if ret == 1 or ret == 0: return ret raise ValueError("Invalid boolean value specified: %s" % (value))