async def _buy_item(self, ctx, item_id: int = 0, count: int = 0): """Buy an item from the store.""" item_object = Item(item_id) cost = item_object.get_price() * count player = Player(ctx.message.author.id) balance = player.get_balance() wallet = balance['wallet'] if cost > wallet: return await ctx.send("Not enough cash. Need: " + str(cost)) else: player.add_balance('wallet', -cost) player.add_to_inventory(item_id, count) return await ctx.send("Successfully purchased.")
async def _list_items(self, ctx): await ctx.trigger_typing() items = self.items.list() embed = discord.Embed(title='Available Items', description='Some text') for item in items: item_object = Item(item['id']) if item['price_min'] != item['price_max']: market_price = item_object.get_price() else: market_price = item['price_min'] embed.add_field( name=item['name'], value='ID: ' + str(item['id']) + '\nEmoji: ' + item['emoji'] + '\nDescription :' + item['description'] + '\nMin Price: ' + str(item['price_min']) + '\nMax Price: ' + str(item['price_max']) + '\nMarket Price: ' + str(market_price) ) await ctx.send(embed=embed)