def open_shop(self, reply): self.state = 'shop' if self.visited_shop: self.open_corridor(reply) return self.shop_items = itemloader.load_shop_items() items = [ itemloader.load_item(i[1], i[0]) for i in self.shop_items ] self.shop_names = [ i.name for i in items ] self.shop_names.append('Выход') for item in self.get_items(): item.on_shop(self, reply, items) txt = ( 'Привет! Давно не виделись, смотри, что у меня есть:\n\n' '{0}\nЦена: {1}\n{2}\n\n' '{3}\nЦена: {4}\n{5}\n\n' '{6}\nЦена: {7}\n{8}' ).format( items[0].name, items[0].price, items[0].description, items[1].name, items[1].price, items[1].description, items[2].name, items[2].price, items[2].description ) reply(txt, self.shop_names)
def open_shop(self, reply): self.state = 'shop' if self.visited_shop: self.open_corridor(reply) return if self.shop_names is None or len(self.shop_items) != 4: self.shop_items = itemloader.load_shop_items() items = [ itemloader.load_item(i[1], i[0], usr=self) for i in self.shop_items ] self.shop_names = [i.name for i in items] for item in self.get_items(): item.on_shop(self, reply, items) txt = locale_manager.get('SHOP_MESSAGE').format( items[0].name, items[0].price, items[0].description, items[1].name, items[1].price, items[1].description, items[2].name, items[2].price, items[2].description, items[3].name, items[3].price, items[3].description) keyboard = [ self.shop_names[0:2], self.shop_names[2:], locale_manager.get('EXIT') ] reply(txt, keyboard)
def open_shop(self, reply): self.state = 'shop' if self.visited_shop: self.open_corridor(reply) return if self.shop_names is None or len(self.shop_items) != 4: self.shop_items = itemloader.load_shop_items() items = [ itemloader.load_item(i[1], i[0], usr=self) for i in self.shop_items ] self.shop_names = [ i.name for i in items ] for item in self.get_items(): item.on_shop(self, reply, items) txt = locale_manager.get('SHOP_MESSAGE').format( items[0].name, items[0].price, items[0].description, items[1].name, items[1].price, items[1].description, items[2].name, items[2].price, items[2].description, items[3].name, items[3].price, items[3].description ) keyboard = [ self.shop_names[0:2], self.shop_names[2:], locale_manager.get('EXIT') ] reply(txt, keyboard)
def open_shop(self, reply): self.state = 'shop' if self.visited_shop: self.open_corridor(reply) return self.shop_items = itemloader.load_shop_items() items = [itemloader.load_item(i[1], i[0]) for i in self.shop_items] self.shop_names = [i.name for i in items] self.shop_names.append(locale_manager.get('EXIT')) for item in self.get_items(): item.on_shop(self, reply, items) txt = locale_manager.get('SHOP_MESSAGE').format( items[0].name, items[0].price, items[0].description, items[1].name, items[1].price, items[1].description, items[2].name, items[2].price, items[2].description) reply(txt, self.shop_names)