def MakeClassTrainer(className, costgold, greetText, successText, failureText): costpp = costgold / 100 if costpp: costgold = costgold - costpp * 100 if costpp: money = "%i platinum pieces" % costpp if costgold: money = money[:-6] money += "and %i gold pieces" % costgold else: money = "%i gold pieces" % costgold greeting = DBDialogLine(text=greetText) choiceconfirm = DBDialogChoice( text=r'Yes, I want to train in the %s class for %s.' % (className, money)) choiceconfirm.failLine = DBDialogLine(text=failureText) choiceconfirm.successLine = DBDialogLine(text=successText) choicecancel = DBDialogChoice(text=r'No, I have chosen to reconsider.') classReq = DBDialogRequirement() classReq.addClassRequirement(False, className) choice = DBDialogChoice(text=r'Train in the %s class for %s.' % (className, money)) choice.addRequirement(req) choice.addRequirement(classReq) choice.successLine = DBDialogLine( text="\\nDo you really want to train in the %s for %s?\\n" % (className, money)) choice.successLine.addChoice(choiceconfirm) choice.successLine.addChoice(choicecancel) action = DBDialogAction() action.takeGold = costgold action.takePlatinum = costpp action.trainClass = className choiceconfirm.successLine.addAction(action) greeting.addChoice(choice) dialog = DBDialog(name="%s Trainer" % className, greeting=greeting)
def MakeClassTrainer(className,costgold, greetText,successText,failureText): costpp = costgold/100 if costpp: costgold = costgold-costpp*100 if costpp: money = "%i platinum pieces"%costpp if costgold: money = money[:-6] money+="and %i gold pieces"%costgold else: money = "%i gold pieces"%costgold greeting = DBDialogLine(text = greetText) choiceconfirm = DBDialogChoice(text=r'Yes, I want to train in the %s class for %s.'%(className,money)) choiceconfirm.failLine = DBDialogLine(text=failureText) choiceconfirm.successLine = DBDialogLine(text=successText) choicecancel = DBDialogChoice(text=r'No, I have chosen to reconsider.') classReq = DBDialogRequirement() classReq.addClassRequirement(False,className) choice = DBDialogChoice(text=r'Train in the %s class for %s.'%(className,money)) choice.addRequirement(req) choice.addRequirement(classReq) choice.successLine = DBDialogLine(text="\\nDo you really want to train in the %s for %s?\\n"%(className,money)) choice.successLine.addChoice(choiceconfirm) choice.successLine.addChoice(choicecancel) action = DBDialogAction() action.takeGold = costgold action.takePlatinum = costpp action.trainClass = className choiceconfirm.successLine.addAction(action) greeting.addChoice(choice) dialog = DBDialog(name="%s Trainer"%className,greeting = greeting)