def MakeSkillTrainer(skillName,cost): tin = long(cost[0]) tin += cost[1] * 100L tin += cost[2] * 10000L tin += cost[3] * 1000000L tin += cost[4] * 100000000L money = GenMoneyText(tin) action = DBDialogAction() action.takeTin = tin action.trainSkill(skillName) skillReq = DBDialogRequirement() skillReq.addSkillRequirement(False,skillName) choice = DBDialogChoice(text=r'Learn the %s skill for %s.'%(skillName,money)) choice.failLine = DBDialogLine(text= \ "\\nI cannot teach you the %s skill at this time.\\n"%skillName) choice.successLine = DBDialogLine(text= \ "\\nAlright, here's what you need to know!\\n") choice.successLine.addAction(action) choice.addRequirement(skillReq) greeting = DBDialogLine(text= \ "Hello, would you like to learn the %s skill?\\n"%skillName) greeting.addChoice(choice) dialog = DBDialog(name="%s Trainer"%skillName,greeting=greeting)
def MakeSkillTrainer(skillName, cost): tin = long(cost[0]) tin += cost[1] * 100L tin += cost[2] * 10000L tin += cost[3] * 1000000L tin += cost[4] * 100000000L money = GenMoneyText(tin) action = DBDialogAction() action.takeTin = tin action.trainSkill(skillName) skillReq = DBDialogRequirement() skillReq.addSkillRequirement(False, skillName) choice = DBDialogChoice(text=r'Learn the %s skill for %s.' % (skillName, money)) choice.failLine = DBDialogLine(text= \ "\\nI cannot teach you the %s skill at this time.\\n"%skillName) choice.successLine = DBDialogLine(text= \ "\\nAlright, here's what you need to know!\\n") choice.successLine.addAction(action) choice.addRequirement(skillReq) greeting = DBDialogLine(text= \ "Hello, would you like to learn the %s skill?\\n"%skillName) greeting.addChoice(choice) dialog = DBDialog(name="%s Trainer" % skillName, 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)
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)
import math from genesis.dbdict import DBDialog,DBDialogLine,DBDialogChoice,DBDialogAction,DBDialogRequirement from mud.world.defines import * req = DBDialogRequirement() req.requireClassNumber = 3 req.positiveCheck = False 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()
import math from genesis.dbdict import DBDialog, DBDialogLine, DBDialogChoice, DBDialogAction, DBDialogRequirement from mud.world.defines import * req = DBDialogRequirement() req.requireClassNumber = 3 req.positiveCheck = False 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.')