async def depositMoney(self, ctx, money: int): ''' deposit money ''' player = darkmemer.player(ctx.author.id, ctx.author.name, ctx.author.discriminator) deposited = player.deposit(money) if deposited: return await ctx.send( '**{amount}** coins deposited!'.format(amount=str(money))) return await ctx.send('Not enough money !')
async def withdrawMoney(self, ctx, money: int): ''' withdraw money ''' player = darkmemer.player(ctx.author.id, ctx.author.name, ctx.author.discriminator) withdrawn = player.withdraw(money) if withdrawn: return await ctx.send( '**{amount}** coins withdrawn !'.format(amount=str(money))) return await ctx.send('Not enough money !')
async def getProfile(self, ctx): ''' returns the player profile ''' player = darkmemer.player(ctx.author.id, ctx.author.name, ctx.author.discriminator) embed1 = discord.Embed(title='Profile', description=player.profile(), colour=discord.Colour.blue()) embed1.set_thumbnail(url=ctx.author.avatar_url) return await ctx.send(embed=embed1)
async def buyItems(self, ctx, itemName: str, quantity: int): ''' buy items ''' player = darkmemer.player(ctx.author.id, ctx.author.name, ctx.author.discriminator) buy = player.buyItem(itemName, quantity) if buy: return await ctx.send('{player}, you bought this item !'.format( player=ctx.author.name)) return await ctx.send( '{player}, either you have low balance or item is not in stock !'. format(player=ctx.author.name))
async def playerNetBalance(self, ctx): ''' returns the balance of player ''' player = darkmemer.player(ctx.author.id, ctx.author.name, ctx.author.discriminator) embed_ = discord.Embed( title='{player}\'s Balance'.format(player=ctx.author.name), description= 'Total : {total} \nWallet : Rs.{wallet} \nBank : Rs.{bank}'.format( total=str(player.netBalance()), wallet=str(player.playerWallet()), bank=str(player.playerBank())), colour=discord.Colour.dark_green()) if player: return await ctx.send(embed=embed_)
async def doSomeWork(self, ctx): ''' work to get money ''' player = darkmemer.player(ctx.author.id, ctx.author.name, ctx.author.discriminator) amount = random.randint(150, 800) worked = player.addMoney(amount) embed_ = discord.Embed( description= '**{player_}**, you worked !\n**{amount_}** coins added to wallet'. format(player_=ctx.author, amount_=amount), colour=discord.Colour.red()) if worked: return await ctx.send(embed=embed_) return await ctx.send( 'Something went wrong {player_} !'.format(player_=ctx.author))
async def playerInventory(self, ctx): ''' returns the inventory of player ''' player = darkmemer.player(ctx.author.id, ctx.author.name, ctx.author.discriminator) items = player.inventory() inventory_ = '(Items, Price, Quantity)\n' for item in items: inventory_ += item inventory_ += ' ' inventory_ += str(items[item][1]) inventory_ += ' ' inventory_ += str(items[item][2]) inventory_ += '\n' embed_ = discord.Embed( title='{player}\'s Inventory'.format(player=ctx.author.name), description=inventory_, colour=discord.Colour.teal()) embed_.set_thumbnail(url=ctx.author.avatar_url) if player: return await ctx.send(embed=embed_)
def __init__(self, pid, name, pdsc): self.playerName = name self.player = player(pid, name, pdsc) self.profile = self.player.profile() self.wallet = self.player.playerWallet() self.hasPet = True if profile[7] else False