def __init__(self, bot, ctx, challenger, challenged, purse): self.bot = bot self.ctx = ctx self.purse = purse self.wagers = {challenger: {}, challenged: {}} self.challenger = challenger self.challenger_cock_status = db.get_cock_status(challenger.id) self.challenged = challenged self.challenged_cock_status = db.get_cock_status(challenged.id) self.accepted = False self.odds = self.get_odds_for_challenger()
async def prepare_cock(self, ctx): user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) cock_power = get_cock_power(cock_status) if cock_status != -1: await ctx.send("Your c**k is already prepared for battle, currently at {:.1f}% hardness".format(cock_power * 100)) return if balance < self.cock_price: await ctx.send("Your c**k is too mangled and bruised to battle, please wait until you can afford 100 for a c**k doctor before battling again.") return else: db.modify_user_balance(user_id, -1 * self.cock_price) db.set_cock_status(user_id, 0) await ctx.send("Your c**k is ready for battle, you tip your fluffer {} for their service".format(self.cock_price))
async def prepare_worm(self, ctx): '''Buy a fight worm''' user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) cock_power = get_cock_power(cock_status) if cock_status != -1: await ctx.send("Your battle worm is already prepared for battle, currently at {:.1f}% toughness".format(cock_power * 100)) return if balance < self.cock_price: await ctx.send("You don't have any worms!") return else: db.modify_user_balance(user_id, -1 * self.cock_price) db.set_cock_status(user_id, 0) await ctx.send("You exchanged {} worms for a rookie battle worm! Win fights and battles to level him up!".format(self.cock_price))
async def wormfight(self, ctx, amount:int): '''Test your worm in a fight to the death, each win increases your worms toughness and odds of winning! Buy a fightworm with !bw and then bet on the outcome of a fight with !wf <amount>''' user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) if self.cock_battle: if ctx.author == self.cock_battle.challenger or ctx.author == self.cock_battle.challenged: await ctx.send("You cannot participate in wormfights while your worm is preparing for battle") return if cock_status == -1: await ctx.send("Your worm is not ready for battle, prepare your worm with !prepare_worm first.") return if amount > balance: await ctx.send("That would cost {}, you only have {} :(".format(amount, balance)) return else: new_balance = db.modify_user_balance(user_id, -1 * amount) result = random.random() cock_power = get_cock_power(cock_status) if result < cock_power: amount_won = amount * 2 new_cock_status = cock_status + 1 new_balance = db.modify_user_balance(user_id, amount_won) db.set_cock_status(user_id, new_cock_status) result_msg = "Your worm made you {:,} worms richer".format(amount) hardness_msg= "Now at {:.1f}% toughness".format(get_cock_power(new_cock_status) * 100) embed_dict = {'colour':discord.Colour(0x00e553), 'author_name':ctx.author.name, 'fields': {1:{'name': result_msg, 'value': hardness_msg}}} await ctx.send(embed=build_embed(embed_dict)) else: db.set_cock_status(user_id, -1) result_msg = "Your worm got smoosh :(" embed_dict = {'colour':discord.Colour(0xe10531), 'author_name':ctx.author.name, 'fields': {1:{'name': 'Ouch', 'value': result_msg}}} await ctx.send(embed=build_embed(embed_dict))
async def leaderboard(self, ctx): '''Displays user balance, c**k status and number of tickets in current drawing''' user_list = db.get_user() balances = [] for user_id in user_list: user = await self.bot.get_user_info(user_id[0]) if not user.bot: balance = db.get_user_balance(user.id) cock_status = db.get_cock_status(user.id) balances.append((user.name, cock_status, balance)) sorted_balances = sorted(balances, key=lambda balances: balances[2], reverse=True) rank = 1 output = [] for user_name, cock_status, user_balance in sorted_balances: cock_power = "{:.1f}% <:peen:456499857759404035>".format(( get_cock_power(cock_status) * 100)) if cock_status is not -1 else "<:sad:455866480454533120>" output.append("{}: **{}** - {:,} - {}".format( rank, user_name, round(user_balance), cock_power)) rank += 1 embed_dict = { 'colour': discord.Colour(0x034cc1), 'author_name': "Lotto-Bot", 'fields': { 1: { 'name': "Leaderboard", 'value': "\n".join(output) } } } await ctx.send(embed=build_embed(embed_dict))
async def leaderboard(self, ctx): '''Displays worm balance leaderboard''' user_list = db.get_user() balances = [] for user in user_list: user_id = user[0] balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) balances.append((user_id, cock_status, balance)) sorted_balances = sorted(balances, key=lambda balances: balances[2], reverse=True) top_sorted_balances = sorted_balances[0:10] rank = 1 output = [] for user_id, cock_status, user_balance in top_sorted_balances: user = await self.bot.fetch_user(user_id) cock_power = "{:.1f}% <:Worm:752975370231218178>".format( (get_cock_power(cock_status) * 100)) if cock_status is not -1 else ":x:" output.append("{}: **{}** - {:,} - {}".format( rank, user.name, round(user_balance), cock_power)) rank += 1 embed_dict = { 'colour': discord.Colour(0x034cc1), 'author_name': "Worm Hall of Fame", 'fields': { 1: { 'name': "Leaderboard", 'value': "\n".join(output) } } } await ctx.send(embed=build_embed(embed_dict))
async def cockfight(self, ctx, amount:int): user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) if self.cock_battle: if ctx.author == self.cock_battle.challenger or ctx.author == self.cock_battle.challenged: await ctx.send("You cannot participate in cockfights while your c**k is preparing for battle") return if cock_status == -1: await ctx.send("Your c**k is not ready for battle, prepare your lil c**k with $prepare_cock first.") return if amount > balance: await ctx.send("That would cost {}, you only have {} you chode".format(amount, balance)) return else: new_balance = db.modify_user_balance(user_id, -1 * amount) result = random.random() cock_power = get_cock_power(cock_status) if result < cock_power: amount_won = amount * 2 new_cock_status = cock_status + 1 new_balance = db.modify_user_balance(user_id, amount_won) db.set_cock_status(user_id, new_cock_status) result_msg = "Your lil c**k made you {:,} richer".format(amount) hardness_msg= "Now at {:.1f}% hardness <:peen:456499857759404035>".format(get_cock_power(new_cock_status) * 100) embed_dict = {'colour':discord.Colour(0x00e553), 'author_name':ctx.author.name, 'fields': {1:{'name': result_msg, 'value': hardness_msg}}} await ctx.send(embed=build_embed(embed_dict)) else: db.set_cock_status(user_id, -1) result_msg = "Your c**k snapped in half <:sad:455866480454533120>" embed_dict = {'colour':discord.Colour(0xe10531), 'author_name':ctx.author.name, 'fields': {1:{'name': 'Ouch', 'value': result_msg}}} await ctx.send(embed=build_embed(embed_dict))
async def wormbattle(self, ctx, user, purse=0): '''Challenge another users worm to a battle to the death, anyone can bet on the outcome''' if purse > db.get_user_balance(ctx.author.id): ctx.send("You don't have {} worms!".format(purse)) if self.cock_battle is not None: await ctx.send("Only one worm battle at a time, wait for {} and {} to finish their battle!".format(self.cock_battle.challenger.name, self.cock_battle.challenged.name)) return if db.get_cock_status(ctx.author.id) == -1: await ctx.send("You don't have a battleworm") return try: challenged_user = ctx.message.mentions[0] except: await ctx.send("You need to mention a user to challenge them!") if db.get_cock_status(challenged_user.id) == -1: await ctx.send("{} doesn't have a battleworm!".format(challenged_user.name)) return if challenged_user == ctx.author: await ctx.send("Try punching yourself in the face instead?") return self.cock_battle = CockBattle(self.bot, ctx, ctx.author, challenged_user, purse=purse) embed_dict = {'colour':discord.Colour(0xffa500), 'author_name':"Worm Battle Challenge!", 'fields': {1:{'name': self.cock_battle.challenger.name, 'value': "{:.1f}% <:Worm:752975370231218178> @{:.2f}:1 odds".format(get_cock_power(self.cock_battle.challenger_cock_status)*100, 1/self.cock_battle.odds), 'inline': True}, 2:{'name': "VS", 'value': '-', 'inline': True}, 3:{'name': self.cock_battle.challenged.name, 'value': "{:.1f}% <:Worm:752975370231218178> @{:.2f}:1 odds".format(get_cock_power(self.cock_battle.challenged_cock_status)*100, self.cock_battle.odds), 'inline': True}, 4:{'name': "```{} has 60s to accept the challenge!```".format(self.cock_battle.challenged.name), 'value': 'Use <!challenge_accepted> to accept!', 'inline': False} } } battle_message = await ctx.send(embed = build_embed(embed_dict)) wait_cycles = 0 while self.cock_battle.accepted == False and wait_cycles < 60: await asyncio.sleep(time_to_accept_battle//60) wait_cycles += 1 if wait_cycles in [50, 30, 15]: embed_dict['fields'][4] = {'name': "```{} has {}s to accept the challenge!```".format(self.cock_battle.challenged.name, (time_to_accept_battle/60) * (60 - wait_cycles)), 'value': 'Use <!challenge_accepted> to accept!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) if self.cock_battle.accepted: embed_dict['colour'] = discord.Colour(0x00e553) embed_dict['author_name'] = "Worm Battle Accepted!" embed_dict['fields'][4] = {'name': "```60s until the battle!```", 'value': 'Type !bb <amount> <user> to place your bets!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) wait_cycles = 0 while wait_cycles < 12: await asyncio.sleep(time_to_battle//12) wait_cycles += 1 if wait_cycles in [10, 6, 3]: embed_dict['fields'][4] = {'name': "```{}s until the battle!```".format((time_to_battle/12) * (12 - wait_cycles)), 'value': 'Type !bb <amount> <user> to place your bets!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) embed_dict['author_name'] = "Battle Results Below!" embed_dict['colour'] = discord.Colour(0xd3d3d3) embed_dict['fields'][4] = {'name': "```Battle!```", 'value': 'Results below!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) rounds, winner, loser = self.cock_battle.resolve_battle() db.modify_user_balance(winner.id, self.cock_battle.purse) db.set_cock_status(loser.id, -1) if loser == self.cock_battle.challenger: donated_cock_power = ((self.cock_battle.challenger_cock_status) / 2) + 1 embed_dict['fields'][3]['name'] = "{}:white_check_mark:".format(self.cock_battle.challenged.name) db.set_cock_status(winner.id, self.cock_battle.challenged_cock_status + donated_cock_power) else: donated_cock_power = ((self.cock_battle.challenged_cock_status) / 2) + 1 embed_dict['fields'][1]['name'] = "{}:white_check_mark:".format(self.cock_battle.challenger.name) db.set_cock_status(winner.id, self.cock_battle.challenger_cock_status + donated_cock_power) results = [] for user, amount_won in self.cock_battle.wagers[winner].items(): new_user_balance = db.modify_user_balance(user.id, amount_won) results.append("{} won {:,} worms, new balance is {:,}".format(user, round(amount_won,2), round(new_user_balance,2))) embed_dict['author_name'] = "{}s battleworm won the battle!".format(winner.name) embed_dict['colour'] = discord.Colour(0x0077be) embed_dict['fields'][4] = {'name': "{} battleworm was victorious in round {} and wins {} from the purse!".format(winner.name, rounds, self.cock_battle.purse), 'value': "{}\% is added to his battleworms toughness".format(donated_cock_power), 'inline': False} await ctx.send(embed=build_embed(embed_dict)) self.cock_battle = None await ctx.send("\n".join(results)) else: embed_dict['author_name'] = "Worm Battle Aborted!" embed_dict['colour'] = discord.Colour(0xe10531) embed_dict['fields'][4] = {'name': "```{} did not accept, the battle is cancelled!```".format(self.cock_battle.challenged.name), 'value': 'Challenge someone awake next time!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) self.cock_battle = None
async def cockbattle(self, ctx, user_string: str, purse=0): if purse > db.get_user_balance(ctx.author.id): ctx.send( "You don't have {} to fund the purse you broke ass bitch!". format(purse)) if self.cock_battle is not None: await ctx.send( "Only one c**k battle at a time u s**t, wait for {} and {} to finish their battle!" .format(self.cock_battle.challenger.name, self.cock_battle.challenged.name)) return if db.get_cock_status(ctx.author.id) == -1: await ctx.send("You don't have a c**k") return try: challenged_user = match_string_to_user(self.bot, ctx, user_string) except: await ctx.send("No user found matching that name") if db.get_cock_status(challenged_user.id) == -1: await ctx.send("{} doesn't have a c**k!".format( challenged_user.name)) return if challenged_user == ctx.author: await ctx.send("Try punching yourself in the face instead") return self.cock_battle = CockBattle(self.bot, ctx, ctx.author, challenged_user, purse=purse) embed_dict = { 'colour': discord.Colour(0xffa500), 'author_name': "C**k Battle Challenge!", 'fields': { 1: { 'name': self.cock_battle.challenger.name, 'value': "{:.1f}% <:peen:456499857759404035> @{:.2f}:1 odds".format( get_cock_power(self.cock_battle.challenger_cock_status) * 100, 1 / self.cock_battle.odds), 'inline': True }, 2: { 'name': "VS", 'value': '-', 'inline': True }, 3: { 'name': self.cock_battle.challenged.name, 'value': "{:.1f}% <:peen:456499857759404035> @{:.2f}:1 odds".format( get_cock_power(self.cock_battle.challenged_cock_status) * 100, self.cock_battle.odds), 'inline': True }, 4: { 'name': "```{} has 60s to accept the challenge!```".format( self.cock_battle.challenged.name), 'value': 'Use <$challenge_accepted> to accept!', 'inline': False } } } battle_message = await ctx.send(embed=build_embed(embed_dict)) wait_cycles = 0 while self.cock_battle.accepted == False and wait_cycles < 60: await asyncio.sleep(time_to_accept_battle // 60) wait_cycles += 1 if wait_cycles in [50, 30, 15]: embed_dict['fields'][4] = { 'name': "```{} has {}s to accept the challenge!```".format( self.cock_battle.challenged.name, (time_to_accept_battle / 60) * (60 - wait_cycles)), 'value': 'Use <$challenge_accepted> to accept!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) if self.cock_battle.accepted: embed_dict['colour'] = discord.Colour(0x00e553) embed_dict['author_name'] = "C**k Battle Accepted!" embed_dict['fields'][4] = { 'name': "```60s until the battle!```", 'value': 'Use <$bb amount user> to raise your bets!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) wait_cycles = 0 while wait_cycles < 12: await asyncio.sleep(time_to_battle // 12) wait_cycles += 1 if wait_cycles in [10, 6, 3]: embed_dict['fields'][4] = { 'name': "```{}s until the battle!```".format( (time_to_battle / 12) * (12 - wait_cycles)), 'value': 'Use <$bb amount user> to raise your bets!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) embed_dict['author_name'] = "Battle Results Below!" embed_dict['colour'] = discord.Colour(0xd3d3d3) embed_dict['fields'][4] = { 'name': "```Battle!```", 'value': 'Results below!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) rounds, winner, loser = self.cock_battle.resolve_battle() db.modify_user_balance(winner.id, self.cock_battle.purse) db.set_cock_status(loser.id, -1) if loser == self.cock_battle.challenger: donated_cock_power = ( (self.cock_battle.challenger_cock_status) / 2) + 1 embed_dict['fields'][3][ 'name'] = "{}:white_check_mark:".format( self.cock_battle.challenged.name) db.set_cock_status( winner.id, self.cock_battle.challenged_cock_status + donated_cock_power) else: donated_cock_power = ( (self.cock_battle.challenged_cock_status) / 2) + 1 embed_dict['fields'][1][ 'name'] = "{}:white_check_mark:".format( self.cock_battle.challenger.name) db.set_cock_status( winner.id, self.cock_battle.challenger_cock_status + donated_cock_power) results = [] for user, amount_won in self.cock_battle.wagers[winner].items(): new_user_balance = db.modify_user_balance(user.id, amount_won) results.append("{} won {:,}, new balance is {:,}".format( user, round(amount_won, 2), round(new_user_balance, 2))) embed_dict['author_name'] = "{}s c**k won the battle!".format( winner.name) embed_dict['colour'] = discord.Colour(0x0077be) embed_dict['fields'][4] = { 'name': "{} c**k was victorious in round {} and wins {} from the purse!" .format(winner.name, rounds, self.cock_battle.purse), 'value': "{}\% is added to his cocks power from his vanquished foe". format(donated_cock_power), 'inline': False } await ctx.send(embed=build_embed(embed_dict)) self.cock_battle = None await ctx.send("\n".join(results)) else: embed_dict['author_name'] = "C**k Battle Aborted!" embed_dict['colour'] = discord.Colour(0xe10531) embed_dict['fields'][4] = { 'name': "```{} did not accept, the battle is cancelled!```".format( self.cock_battle.challenged.name), 'value': 'Challenge someone awake next time!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) self.cock_battle = None