Ejemplo n.º 1
0
 def getTradeOptions(self):
     code = 0
     options = []
     location = self.getLocation()
     for product in location.market:
         option = {
             'code': str(code),
             'description': 'buy {0}'.format(product['name']),
             'callback': self.getPurchaseClosure(product)
         }
         options.append(option)
         code += 1
     for product in self.inventory.items:
         option = {
             'code': str(code),
             'description': 'sell {0}'.format(product['name']),
             'callback': self.getSaleClosure(product)
         }
         options.append(option)
         code += 1
     options.append({
         'code': 'm',
         'description': 'check out a different area',
         'callback': self.travel
     })
     options.append({
         'code': 'q',
         'description': 'quit',
         'callback': self.exit
     })
     ask('Would you like to trade?', options)
Ejemplo n.º 2
0
	def travel(self):
		code = 0
		options = []
		for location in self.locations:
			if location is self.getLocation():
				continue
			option = {'code': str(code), 'description':location.name, 'callback':self.getMovementClosure(location)}
			options.append(option)
			code += 1
		options.append({'code':'q', 'description':'quit', 'callback':self.exit})
		ask('Where would you like to go?', options)
Ejemplo n.º 3
0
	def getTradeOptions(self):
		code = 0
		options = []
		location = self.getLocation()
		for product in location.market:
			option = {'code': str(code), 'description':'buy {0}'.format(product['name']), 'callback':self.getPurchaseClosure(product)}
			options.append(option)
			code += 1
		for product in self.inventory.items:
			option = {'code': str(code), 'description':'sell {0}'.format(product['name']), 'callback':self.getSaleClosure(product)}
			options.append(option)
			code += 1
		options.append({'code':'m', 'description':'check out a different area', 'callback':self.travel})
		options.append({'code':'q', 'description':'quit', 'callback':self.exit})
		ask('Would you like to trade?', options)
Ejemplo n.º 4
0
 def travel(self):
     code = 0
     options = []
     for location in self.locations:
         if location is self.getLocation():
             continue
         option = {
             'code': str(code),
             'description': location.name,
             'callback': self.getMovementClosure(location)
         }
         options.append(option)
         code += 1
     options.append({
         'code': 'q',
         'description': 'quit',
         'callback': self.exit
     })
     ask('Where would you like to go?', options)