def main(argv): # pragma: no cover import getopt try: parsed = gui.commandline.parseArgs(argv) except(getopt.GetoptError): parsed = dict() gui.helpMessage() logging.info("Starting generator") ruleset.rules.rollMethod = parsed.get("rollMethod", gui.askRollMethod()) filename = parsed.get("filename", None) count = parsed.get("count", None) if count is None: count = gui.askCharsCount() rooster = character.rooster.Rooster() rooster.load(filename) rooster.add(count=count) rooster.defineAbility() races = [random.choice(list(race.RACES.keys())) for i in rooster.chars] classes = [random.choice(list(charclass.CLASSES.keys())) for i in rooster.chars] logging.info("Pick Your Race") rooster.pickRace(races) logging.info("Pick Your Class") rooster.pickClass(classes) pickClass(rooster.chars, classes=[]) pickSkills() buyEquipment() finishDetails() createChars(rooster)
def runAction(action=None, args=[]): if action is None: return 0 a = CMDS.get(action, None) logging.debug("Running %s", action) if a is None: gui.helpMessage() a(0, args) import sys sys.exit(0)
""" import gui.menu logging.debug("Adventure generation") default = FILENAMES["local"] logging.debug(options) adventures = [] if len(options) == 0: adventures = [Adventure(id=gui.menu.showMenu(title="Select adventure type:", items=STYLES))] else: adventures = [Adventure(style={"filename": FILENAMES.get(a, default)}) for a in options] for q in adventures: print(q.title) print(q.description) if __name__ == "__main__": # pragma: no cover import sys import getopt import gui import gui.commandline try: options = gui.commandline.parseArgs(sys.argv[1:]) except (getopt.GetoptError): gui.helpMessage() main(options=options.get("args", []))