Example #1
0
 async def _add_item_to_inventory(self,
                                  ctx,
                                  item_id: int = 0,
                                  count: int = 0):
     """Add any item to inventory"""
     player = Player(ctx.message.author.id)
     player.add_to_inventory(item_id, count)
     item_object = Item(item_id)
     await ctx.send(
         str(count) + ' of ' + item_object.name + ' added to inventory')
Example #2
0
 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.")