async def wallet(self, ctx): """View your wallet.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) wallet_balance = '{0:,.2f}'.format(float(player[0][5])) if player[0][20] is None: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Wallet", value='__Current ISK:__ {}'.format(wallet_balance), inline=False) await ctx.author.send(embed=embed) else: wallet_journal = ast.literal_eval(player[0][20]) journal_array = [] time = 'N/A' for entry in wallet_journal: if 'time' in entry: time = entry['time'] journal_isk = '{0:,.2f}'.format(float(entry['isk'])) journal_array.append("{} EVE - *{}* - {} ISK".format( time, entry['type'], journal_isk)) journal_text = '\n'.join(journal_array) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Wallet", value='__Current ISK:__ {}'.format(wallet_balance), inline=False) embed.add_field( name="Transactions", value='__**Type**__ - __**Amount**__\n{}'.format(journal_text), inline=False) await ctx.author.send(embed=embed) return await ctx.invoke(self.bot.get_command("me"), True)
async def _uptime(self, ctx): """Shows bot uptime""" uptime_str = ctx.bot.uptime_str embed = utils.make_embed(title='Uptime', content=uptime_str, msg_colour='blue', icon="https://i.imgur.com/82Cqf1x.png") try: await ctx.send(embed=embed) except discord.errors.Forbidden: await ctx.send("Uptime: {}".format(uptime_str))
async def _contacts(self, ctx): """View your contact list.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass if ctx.invoked_subcommand is None: sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) player_name = self.bot.get_user(int(player[0][2])).display_name blue_array = [] if player[0][21] is not None: for user in ast.literal_eval(player[0][21]): sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (user, ) blue = await db.select_var(sql, values) if len(blue) > 0: blue_name = self.bot.get_user(int( blue[0][2])).display_name blue_array.append(blue_name) else: continue blue_text = '\n'.join(blue_array) else: blue_text = '' embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="{}'s Contacts".format(player_name), value="__**Blues**__\n{}\n\n**1.** Add user to the blue list\n" "**2.** Remove a user from the blue list\n" "**3.** Return to the main menu".format(blue_text)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.add_blue(ctx, player[0]) elif content == '2': await self.remove_blue(ctx, player[0]) elif content == '3': await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return
async def _about(self, ctx): """Shows info about Firetail""" memory = memory_usage() memory_format = '{0:,.2f}'.format(memory['rss'] / 1024) bot = ctx.bot author_repo = "https://github.com/shibdib" bot_repo = author_repo + "/Firetail" server_url = "https://discord.gg/ZWmzTP3" owner = "Ingame: Mr Twinkie" uptime_str = bot.uptime_str invite_str = ("[Click to invite me to your server!]({})" "").format(bot.invite_url) about = ( "I'm a Python based Discord bot to help organise and coordinate EVE Online " "communities!\n\n" "To learn about what I do either use the `!help` command, or " "check the [documentation here]({bot_repo}).\n\n" "[Join our support server]({server_invite}) if you have any " "questions or feedback.\n\n" "").format(bot_repo=bot_repo, server_invite=server_url) member_count = 0 server_count = 0 for guild in bot.guilds: server_count += 1 member_count += len(guild.members) embed = utils.make_embed(msg_type='info', title="About Firetail", content=about) embed.set_thumbnail(url=bot.user.avatar_url_as(format='png')) embed.add_field(name="Creator", value=owner) embed.add_field(name="Uptime", value=uptime_str) embed.add_field(name="Servers", value=server_count) embed.add_field(name="Members", value=member_count) embed.add_field(name="Commands Used", value=bot.command_count) embed.add_field(name="Messages Read", value=bot.message_count) embed.add_field(name="Current Memory Usage", value='{} MB'.format(memory_format)) embed.add_field(name="Invite Link", value=invite_str, inline=False) footer_txt = ("For support, contact us on our Discord server. " "Invite Code: ZWmzTP3") embed.set_footer(text=footer_txt) try: await ctx.send(embed=embed) except discord.HTTPException: await ctx.send("I need the `Embed links` permission to send this")
async def change_clone(self, ctx, player): """Change your clone location.""" if player[0][18] is player[0][4]: await ctx.author.send( '**This region is already your clone location**') return await ctx.invoke(self.bot.get_command("me"), True) home_region_name = await game_functions.get_region(player[0][18]) current_region_name = await game_functions.get_region(player[0][4]) embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Change Clone Location", value= "Are you sure you want to change your clone location from **{}** to **{}**\n\n*Relocating" " your clone costs 10,000 ISK*\n\n" "**1.** Yes.\n" "**2.** No.\n".format(home_region_name, current_region_name)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) content = int(msg.content) if content != 1: await ctx.author.send('**Clone Location Not Changed**') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return if int(float(player[0][5])) < int(float(10000)): await ctx.author.send('**Not enough ISK**') return await ctx.invoke(self.bot.get_command("me"), True) sql = ''' UPDATE eve_rpg_players SET home = (?), isk = (?) WHERE player_id = (?); ''' remaining_isk = int(float(player[0][5])) - int(float(10000)) values = ( player[0][4], remaining_isk, ctx.author.id, ) await db.execute_sql(sql, values) await ctx.author.send('**Clone Location Changed**') await self.update_journal(player[0], 10000, 'Clone Location') return await ctx.invoke(self.bot.get_command("me"), True)
async def _bot_invite(self, ctx, plain_url: bool = False): """Shows bot invite url""" invite_url = ctx.bot.invite_url if plain_url: await ctx.send("Invite URL: <{}>".format(invite_url)) return else: embed = utils.make_embed( title='Click to invite me to your server!', title_url=invite_url, msg_colour='blue', icon="https://i.imgur.com/DtPWJPG.png") try: await ctx.send(embed=embed) except discord.errors.Forbidden: await ctx.send("Invite URL: <{}>".format(invite_url))
async def kick_member(self, ctx, fleet): fleet_member_dict = {} fleet_member_array = [] member_number = 1 members = ast.literal_eval(fleet[3]) for member_id in members: sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (int(member_id), ) member = await db.select_var(sql, values) member_name = self.bot.get_user(int(member[0][2])).display_name fleet_member_dict[member_number] = member[0][0] fleet_member_array.append('**{}.** {}'.format( member_number, member_name)) member_number += 1 clean_members = '\n'.join(fleet_member_array) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Kick Member", value="{}".format(clean_members)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if int(content) not in fleet_member_dict: await ctx.author.send('**ERROR** - Incorrect Selection.') return await ctx.invoke(self.bot.get_command("me"), True) sql = ''' UPDATE eve_rpg_players SET fleet = (?) WHERE id = (?); ''' values = ( None, fleet_member_dict[int(content)], ) await db.execute_sql(sql, values) members.remove(fleet_member_dict[int(content)]) sql = ''' UPDATE fleet_info SET fleet_members = (?) WHERE fleet_id = (?); ''' values = (str(members), fleet[1]) await db.execute_sql(sql, values) await ctx.author.send('**Success** - Member Kicked.') await ctx.invoke(self.bot.get_command("me"), True)
async def hunting_options(self, ctx, player): region_id = int(player[4]) region_info = await game_functions.get_region_info(region_id) accepted = [1, 2, 3] pirate_anomaly_text = "" if region_info[4] != 0: accepted.append(4) pirate_anomaly_text = "**4.** In the pirate anomaly.\n" mining_anomaly_text = "" if region_info[5] != 0: accepted.append(5) mining_anomaly_text = "**5.** In the ore anomaly.\n" embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Choose Target", value="Where do you want to look for targets?\n\n" "**1.** In the belts.\n" "**2.** On the gates.\n" "**3.** At safe spots.\n" "{}{}".format(pirate_anomaly_text, mining_anomaly_text)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = int(msg.content) if content in accepted: sql = ''' UPDATE eve_rpg_players SET task = (?) WHERE player_id = (?); ''' values = ( int(content) + 30, ctx.author.id, ) await db.execute_sql(sql, values) player = await game_functions.refresh_player(player) new_task = await game_functions.get_task(int(player[6])) await ctx.author.send( '**Task Updated** - You are now *{}*.'.format(new_task)) return await ctx.invoke(self.bot.get_command("me"), True) else: return await ctx.invoke(self.bot.get_command("me"), True)
async def _guilds(self, ctx): """List the guild names""" server_count = 0 bot = ctx.bot guilds = [] for guild in bot.guilds: server_count += 1 guilds.append(guild.name) guild_list = '\n'.join(guilds) split_string = lambda x, n: [x[i:i + n] for i in range(0, len(x), n)] guild_list = split_string(guild_list, 1024) for split_list in guild_list: embed = utils.make_embed(msg_type='info', title="Firetail Server Info") embed.set_thumbnail(url=bot.user.avatar_url_as(format='png')) embed.add_field(name="Server Count", value=server_count) embed.add_field(name="Servers", value=split_list, inline=False) await ctx.send(embed=embed)
async def purge(self, ctx, msg_number: int = 10): """Delete a number of messages from the channel. Default is 10. Max 100.""" if ctx.guild.id == 202724765218242560: return if msg_number > 100: embed = utils.make_embed( msg_type='info', title="ERROR", content="No more than 100 messages can be purged at a time.", guild=ctx.guild) await ctx.send(embed=embed) return deleted = await ctx.channel.purge(limit=msg_number) result_msg = await ctx.send('Deleted {} message{}'.format( len(deleted), "s" if len(deleted) > 1 else "")) await asyncio.sleep(3) await result_msg.delete()
async def disband_corp(self, ctx, corp): embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Disband Corp", value="Are you sure you want to disband {}?\n\n" "**1.** Yes\n" "**2.** No".format(corp[3])) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': sql = ''' UPDATE eve_rpg_players SET corporation = (?) WHERE corporation = (?); ''' values = ( None, corp[1], ) await db.execute_sql(sql, values) sql = ''' DELETE FROM `corporations` WHERE `corp_id` = (?) ''' values = (int(corp[1]), ) await db.execute_sql(sql, values) await ctx.author.send('**Success** - Corp disbanded.') await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return
async def _corps(self, ctx): """Corporation Menu.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass if ctx.invoked_subcommand is None: sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) player_name = self.bot.get_user(int(player[0][2])).display_name if player[0][23] is not None: corp_info = await game_functions.get_user_corp(player[0][23]) corp_officers = [] if corp_info[6] is not None: corp_officers = ast.literal_eval(corp_info[6]) if corp_info is None: sql = ''' UPDATE eve_rpg_players SET corporation = (?) WHERE player_id = (?); ''' values = ( None, ctx.author.id, ) await db.execute_sql(sql, values) return await ctx.invoke(self.bot.get_command("corp")) pending_members = [] if corp_info[8] is not None: pending_members = ast.literal_eval(corp_info[8]) corp_members = ast.literal_eval(corp_info[7]) if corp_info[5] == player[0][0]: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Corporation Management".format(player_name), value="__**Corporation Info**__\n" "Corp ID: {}\n" "Member Count: {}\n\n" "**1.** Review Pending Members ({} Waiting)\n" "**2.** Kick Member\n" "**3.** Manage Officers\n" "**4.** Disband Corporation\n" "**5.** Return to the main menu".format( corp_info[1], len(corp_members), len(pending_members))) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.review_pending(ctx, corp_info) elif content == '2': await self.kick_member(ctx, corp_info) elif content == '3': await ctx.author.send('**ERROR** - Not added yet.') elif content == '4': await self.disband_corp(ctx, corp_info) elif content == '5': await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.' ) elif content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return elif player[0][0] in corp_officers: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Corporation Management".format(player_name), value="__**Corporation Info**__\n" "Corp ID: {}\n" "Member Count: {}\n\n" "**1.** Review Pending Members ({} Waiting)\n" "**2.** Kick Member\n" "**3.** Return to the main menu".format( corp_info[1], len(corp_members), len(pending_members))) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.review_pending(ctx, corp_info) elif content == '2': await self.kick_member(ctx, corp_info) elif content == '3': await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.' ) elif content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return else: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Corporation Management".format(player_name), value="__**Corporation Info**__\n" "Corp ID: {}\n" "Member Count: {}\n\n" "**1.** Leave Corp\n" "**2.** Return to the main menu".format( corp_info[1], len(corp_members))) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.leave_corp(ctx, player, corp_info) elif content == '2': return await ctx.invoke(self.bot.get_command("me"), True) elif content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return else: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Corporation Management".format(player_name), value="**1.** Create a Corporation\n" "**2.** Join a Corporation\n" "**3.** Return to the main menu") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.create_corp(ctx, player[0]) elif content == '2': await self.join_corp(ctx, player[0]) elif content == '3': await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return
async def create_corp(self, ctx, player): embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Create Corporation", value="What do you want to name your corporation?\n\n" "*Names should not exceed 15 characters.*\n\n" "*Vulgar names will result in GM action.*\n\n" "Type **!!me** to cancel this action.") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) if msg.content == '!!me': return await ctx.invoke(self.bot.get_command("me"), True) corp_name = msg.content[:15] embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Create Corporation", value="What would you like your corp ticker to be?\n\n" "*Tickers should not exceed 5 characters.*\n\n" "*Vulgar tickers will result in GM action.*\n\n" "Type **!!me** to cancel this action.") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) if msg.content == '!!me': return await ctx.invoke(self.bot.get_command("me"), True) ticker = msg.content[:15] sql = ''' SELECT * FROM corporations WHERE `ticker` = (?) ''' values = (ticker, ) tickers = await db.select_var(sql, values) if len(tickers) > 0: await ctx.author.send('**ERROR** - Ticker already taken.') return await ctx.invoke(self.bot.get_command("corp"), True) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Create Corporation", value="__**Confirmation**__\n" "**CREATING A CORPORATION COSTS 50,000,000 ISK**\n\n" "Corp Name: {}\n" "Corp Ticker: [{}]\n\n" "**1.** Confirm\n" "**2.** Cancel\n\n" "Type **!!me** to cancel this action.".format( corp_name, ticker)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) if msg.content == '!!me' or msg.content != '1': return await ctx.invoke(self.bot.get_command("me"), True) if int(50000000) > int(float(player[5])): await ctx.author.send('**Not Enough Isk**') return await ctx.invoke(self.bot.get_command("me"), True) sql = ''' UPDATE eve_rpg_players SET corporation = (?), isk = (?) WHERE player_id = (?); ''' unique_id = await game_functions.create_unique_id() values = ( unique_id, int(float(player[5])) - int(50000000), ctx.author.id, ) await db.execute_sql(sql, values) sql = ''' REPLACE INTO corporations(corp_id,name,ticker,ceo,members,corp_offices) VALUES(?,?,?,?,?,?) ''' values = (unique_id, corp_name, ticker, player[0], str([player[0]]), str([player[4]])) await db.execute_sql(sql, values) await ctx.author.send('**Success** - Corporation created.') await ctx.invoke(self.bot.get_command("corp"))
async def ship_fitting(self, ctx): """Fit your current ship.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id,) player = await db.select_var(sql, values) region_id = int(player[0][4]) region_name = await game_functions.get_region(region_id) player_ship_obj = ast.literal_eval(player[0][14]) ship = await game_functions.get_ship(int(player_ship_obj['ship_type'])) # check if ship has a custom name set custom_name = '' rename_ship = '**n.** Name Your Ship' if 'custom_name' in player_ship_obj: custom_name = '- {}'.format(player_ship_obj['custom_name']) rename_ship = '**n.** Rename Your Ship' drone_size = 0 clean_equipped_modules = '' clean_equipped_drones = '' remove_module_order = {} module_number = 1 remove_commands = [] remove_drones_commands = [] # check if insured insured = '' if 'insured' in player_ship_obj: insured = '\n*This Ship Is Insured*' # check if killmark killmarks = '' if 'kill_marks' in player_ship_obj: killmarks = '\n**{} Kill Marks**'.format(player_ship_obj['kill_marks']) module_count = 0 drone_count = 0 equipped_prop_mods = [] if player[0][12] is not None: equipped_modules = ast.literal_eval(player[0][12]) equipped_prop_mods = [] equipped_modules_array = [] equipped_drones_array = [] for item in equipped_modules: module = await game_functions.get_module(int(item)) if 'size' in module: drone_size += module['size'] remove_module_order[module_number] = int(item) drone_attack = module['attack'] drone_defense = module['defense'] drone_maneuver = module['maneuver'] drone_tracking = module['tracking'] stats = '({}/{}/{}/{})'.format(drone_attack, drone_defense, drone_maneuver, drone_tracking) if module['special'] is not None: stats = '{} {}'.format(stats, module['special']) equipped_drones_array.append('**{}.** {} - {}'.format(module_number, module['name'], stats)) remove_drones_commands.append(module_number) module_number += 1 drone_count += 1 else: if module['class'] == 3: equipped_prop_mods.append(module_number) module_count += 1 remove_module_order[module_number] = int(item) module_attack = module['attack'] module_defense = module['defense'] module_maneuver = module['maneuver'] module_tracking = module['tracking'] stats = '({}%/{}%/{}%/{}%)'.format(module_attack * 100, module_defense * 100, module_maneuver * 100, module_tracking * 100) if module['special'] is not None: stats = '{} {}'.format(stats, module['special']) equipped_modules_array.append('**{}.** {} - {}'.format(module_number, module['name'], stats)) remove_commands.append(module_number) module_number += 1 clean_equipped_modules = '\n'.join(equipped_modules_array) clean_equipped_drones = '\n'.join(equipped_drones_array) ship_attack, ship_defense, ship_maneuver, ship_tracking = \ await game_functions.get_combat_attributes(player[0], int(player_ship_obj['ship_type'])) ship_regen = await game_functions.manage_regen(player[0], 0) value = '**{}** {}\n*{}*\n**s.** To save this fit.\n{}/{} Module Slots{}{}\n\n**Current Attack:** {}\n**Current Defense:** {}\n**Current Regen:** {}\n**Current ' \ 'Maneuver:** {}\n**Current Tracking:** {}'.format(ship['name'], custom_name, rename_ship, module_count, ship['slots'], killmarks, insured, ship_attack, ship_defense, round(ship_regen, 1), ship_maneuver, ship_tracking) if player[0][12] is not None: value = '{}\n\n__Equipped Modules__\n{}'.format(value, clean_equipped_modules) value = '{}\n\n**{}m3/{}m3 Drone Bay**\n__Equipped Drones__\n{}'.format(value, drone_size, ship['drone_bay'], clean_equipped_drones) embed = make_embed(icon=ctx.bot.user.avatar) ship_image = await game_functions.get_ship_image(int(player_ship_obj['ship_type'])) embed.set_thumbnail(url="{}".format(ship_image)) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Ship Fitting".format(region_name), value=value, inline=False) equip_module_order = {} equip_commands = [] equip_drones_commands = [] counter = 0 embed_count = 1 if player[0][13] is not None: module_hangar = ast.literal_eval(player[0][13]) if player[0][4] in module_hangar: stored_modules_array = [] for item in module_hangar[player[0][4]]: if module_number >= 35 * embed_count: await ctx.author.send(embed=embed) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed_count += 1 module = await game_functions.get_module(int(item)) if 'no_fit' in module: continue if 'size' in module and ship['drone_bay'] == 0: continue equip_module_order[module_number] = int(item) module_attack = module['attack'] module_defense = module['defense'] module_maneuver = module['maneuver'] module_tracking = module['tracking'] stats = '({}%/{}%/{}%/{}%)'.format(module_attack * 100, module_defense * 100, module_maneuver * 100, module_tracking * 100) if 'size' in module and ship['drone_bay'] > 0: stats = '({}/{}/{}/{}) - Size: {}m3'.format(module_attack, module_defense, module_maneuver, module_tracking, module['size']) equip_drones_commands.append(module_number) else: equip_commands.append(module_number) if module['special'] is not None: stats = '{} {}'.format(stats, module['special']) stored_modules_array.append('**{}.** {} - {}'.format(module_number, module['name'], stats)) module_number += 1 counter += 1 if counter >= 10: counter = 0 stored_modules = '\n'.join(stored_modules_array) embed.add_field(name="{} Module/Drone Hangar".format(region_name), value=stored_modules) stored_modules_array = [] if len(stored_modules_array) > 0: stored_modules = '\n'.join(stored_modules_array) embed.add_field(name="{} Module/Drone Hangar".format(region_name), value=stored_modules) await ctx.author.send(embed=embed) if player[0][6] is not 1: return await ctx.invoke(self.bot.get_command("me"), True) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) if msg.content.lower() == 'n': if custom_name == '': custom_name = ship['name'] embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Rename Ship", value="__Current Name:__ {}\n\n" "If you'd like to rename it reply with the name. If you'd like to return to the menu " "reply with **!!me**".format(custom_name)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) if msg.content == '!!me': return await ctx.invoke(self.bot.get_command("me"), True) else: player_ship_obj['custom_name'] = msg.content[:15] sql = ''' UPDATE eve_rpg_players SET ship = (?) WHERE player_id = (?); ''' values = (str(player_ship_obj), ctx.author.id,) await db.execute_sql(sql, values) await ctx.author.send('**Changes Complete**') return await ctx.invoke(self.bot.get_command("me"), True) if msg.content.lower() == 's': embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Save Fitting", value="What would you like to name this fit?\n\n" "*Once you save a fit for a ship, whenever you go to purchase that ship again you " "will get an option to buy the ship already fit with your saved fitting.*") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) if msg.content == '!!me': return await ctx.invoke(self.bot.get_command("me"), True) else: modules = ast.literal_eval(player[0][12]) saved_fit = {'modules': modules, 'ship_type': player_ship_obj['ship_type'], 'fit_name': msg.content[:15]} if player[0][26] is not None: players_saved_fits = ast.literal_eval(player[0][26]) players_saved_fits.append(saved_fit) else: players_saved_fits = [saved_fit] sql = ''' UPDATE eve_rpg_players SET saved_fits = (?) WHERE player_id = (?); ''' values = (str(players_saved_fits), ctx.author.id,) await db.execute_sql(sql, values) await ctx.author.send('**Fit Saved For Future Purchase**') return await ctx.invoke(self.bot.get_command("me"), True) module_array = list(set(ast.literal_eval('[{}]'.format(msg.content)))) if type(module_array) is list: remove_prop_mods = [] equip_prop_mods = [] equip_modules = [] equip_modules_text = [] remove_modules = [] remove_modules_text = [] equip_size = 0 equip_drones_text = [] remove_size = 0 remove_drones_text = [] drone_equip_count = 0 drone_remove_count = 0 for module in module_array: if int(module) in remove_commands: selected_module = await game_functions.get_module(int(remove_module_order[module])) if selected_module['class'] == 3: remove_prop_mods.append(int(remove_module_order[module])) remove_modules_text.append('{}'.format(selected_module['name'])) remove_modules.append(int(remove_module_order[module])) elif int(module) in equip_commands: selected_module = await game_functions.get_module(int(equip_module_order[module])) if selected_module['class'] == 3: equip_prop_mods.append(int(equip_module_order[module])) equip_modules_text.append('{}'.format(selected_module['name'])) equip_modules.append(int(equip_module_order[module])) elif int(module) in equip_drones_commands: selected_module = await game_functions.get_module(int(equip_module_order[module])) equip_size += selected_module['size'] equip_drones_text.append('{}'.format(selected_module['name'])) equip_modules.append(int(equip_module_order[module])) drone_equip_count += 1 elif int(module) in remove_drones_commands: selected_module = await game_functions.get_module(int(remove_module_order[module])) remove_size += selected_module['size'] remove_drones_text.append('{}'.format(selected_module['name'])) remove_modules.append(int(remove_module_order[module])) drone_remove_count += 1 if ((len(equipped_prop_mods) + len(equip_prop_mods)) - len(remove_prop_mods)) > 1: await ctx.author.send('**This ship can only have 1 propulsion mod equipped at a time**') return await ctx.invoke(self.bot.get_command("fitting")) if ((int(drone_count) + int(drone_equip_count)) - int(drone_remove_count)) > 5: await ctx.author.send('**This ship can only have 5 drones equipped at one time**') return await ctx.invoke(self.bot.get_command("fitting")) if ((int(drone_size) + int(equip_size)) - int(remove_size)) > ship['drone_bay']: await ctx.author.send('**The current selection would overfill your drone bay**') return await ctx.invoke(self.bot.get_command("fitting")) if ((int(module_count) + (len(equip_modules) - drone_equip_count)) - (len(remove_modules) - drone_remove_count)) > ship['slots']: await ctx.author.send('**The current selection would put you over the maximum modules for this ' 'ship**') return await ctx.invoke(self.bot.get_command("fitting")) equip_list = '\n'.join(equip_modules_text) if len(equip_drones_commands) > 0: equip_list = equip_list + '\n'.join(equip_drones_text) remove_list = '\n'.join(remove_modules_text) if len(remove_drones_commands) > 0: remove_list = remove_list + '\n'.join(remove_drones_text) embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Confirm Switch", value="__Remove__\n{}\n__Equip__\n{}\n\n" "**1.** Yes.\n" "**2.** No.\n".format(remove_list, equip_list)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) response = msg.content if response != '1': await ctx.author.send('**Changes Canceled**') if response.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return hangar = None equipped = None module_hangar = None equipped_modules = [] if player[0][13] is not None: module_hangar = ast.literal_eval(player[0][13]) if len(remove_modules) > 0: if player[0][13] is not None and player[0][4] in ast.literal_eval(player[0][13]): module_hangar = ast.literal_eval(player[0][13]) module_hangar[player[0][4]] += remove_modules elif player[0][13] is not None: module_hangar = ast.literal_eval(player[0][13]) module_hangar[player[0][4]] = remove_modules else: module_hangar = {player[0][4]: remove_modules} equipped_modules = ast.literal_eval(player[0][12]) for remove in remove_modules: equipped_modules.remove(remove) if len(equipped_modules) > 0: equipped = str(equipped_modules) else: equipped = [] hangar = str(module_hangar) if hangar is None: hangar = player[0][13] if equipped is None: equipped = player[0][12] if len(equip_modules) > 0: if equipped is not None and type(equipped) is str: equipped_modules = ast.literal_eval(equipped) equipped_modules += equip_modules else: equipped_modules = equip_modules module_hangar = ast.literal_eval(hangar) for remove in equip_modules: module_hangar[player[0][4]].remove(remove) if len(module_hangar[player[0][4]]) == 0: module_hangar.pop(player[0][4], None) if len(module_hangar) > 0: hangar = str(module_hangar) else: hangar = None if len(equipped_modules) > 0: equipped = str(equipped_modules) else: equipped = None sql = ''' UPDATE eve_rpg_players SET modules = (?), module_hangar = (?) WHERE player_id = (?); ''' values = (equipped, hangar, ctx.author.id,) await db.execute_sql(sql, values) await ctx.author.send('**Changes Complete**') return await ctx.invoke(self.bot.get_command("me"), True) else: content = int(msg.content) if int(msg.content) in remove_commands: selected_module = await game_functions.get_module(int(remove_module_order[content])) embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.set_thumbnail(url="{}".format(selected_module['image'])) embed.add_field(name="Confirm Switch", value="Are you sure you want to remove a **{}**\n\n" "**1.** Yes.\n" "**2.** No.\n".format(selected_module['name'])) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) response = msg.content if response != '1': await ctx.author.send('**Removal Canceled**') if response.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return if player[0][13] is not None and player[0][4] in ast.literal_eval(player[0][13]): module_hangar = ast.literal_eval(player[0][13]) module_hangar[player[0][4]].append(remove_module_order[content]) elif player[0][13] is not None: module_hangar = ast.literal_eval(player[0][13]) module_hangar[player[0][4]] = [remove_module_order[content]] else: module_hangar = {player[0][4]: [remove_module_order[content]]} sql = ''' UPDATE eve_rpg_players SET modules = (?), module_hangar = (?) WHERE player_id = (?); ''' remove_module_order.pop(content, None) if remove_module_order is not None and len(remove_module_order) > 0: now_equipped = [] for key, module in remove_module_order.items(): now_equipped.append(module) values = (str(now_equipped), str(module_hangar), ctx.author.id,) else: values = (None, str(module_hangar), ctx.author.id,) await db.execute_sql(sql, values) await ctx.author.send('**{} Has Been Removed**'.format(selected_module['name'])) return await ctx.invoke(self.bot.get_command("me"), True) elif int(msg.content) in equip_commands: if module_count >= ship['slots']: await ctx.author.send('**All module slots are occupied for this ship**') return await ctx.invoke(self.bot.get_command("me"), True) selected_module = await game_functions.get_module(int(equip_module_order[content])) embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.set_thumbnail(url="{}".format(selected_module['image'])) embed.add_field(name="Confirm Switch", value="Are you sure you want to equip a **{}**\n\n" "**1.** Yes.\n" "**2.** No.\n".format(selected_module['name'])) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) response = msg.content if player[0][12] is not None: equipped_modules = ast.literal_eval(player[0][12]) equipped_modules.append(equip_module_order[content]) else: equipped_modules = [equip_module_order[content]] if response != '1': await ctx.author.send('**Equipping Module Canceled**') if response.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return module_hangar = ast.literal_eval(player[0][13]) module_hangar[player[0][4]].remove(equip_module_order[content]) sql = ''' UPDATE eve_rpg_players SET modules = (?), module_hangar = (?) WHERE player_id = (?); ''' if module_hangar[player[0][4]] is None or len(module_hangar[player[0][4]]) < 1: module_hangar.pop(player[0][4], None) if len(module_hangar) == 0: values = (str(equipped_modules), None, ctx.author.id,) else: values = (str(equipped_modules), str(module_hangar), ctx.author.id,) else: values = (str(equipped_modules), str(module_hangar), ctx.author.id,) await db.execute_sql(sql, values) await ctx.author.send('**{} Has Been Equipped**'.format(selected_module['name'])) else: await ctx.author.send('**ERROR** - Not a valid choice.') if msg.content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return
async def _fleets(self, ctx): """Fleet Menu.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass if ctx.invoked_subcommand is None: sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) player_name = self.bot.get_user(int(player[0][2])).display_name if player[0][16] is not None and player[0][16] != 0: sql = ''' SELECT * FROM fleet_info WHERE `fleet_id` = (?) ''' values = (player[0][16], ) fleet_info = await db.select_var(sql, values) if len(fleet_info) == 0: sql = ''' UPDATE eve_rpg_players SET fleet = (?) WHERE player_id = (?); ''' values = ( None, ctx.author.id, ) await db.execute_sql(sql, values) return await ctx.invoke(self.bot.get_command("fleet")) fleet_members = ast.literal_eval(fleet_info[0][3]) if fleet_info[0][2] == player[0][0]: fleet_members = ast.literal_eval(fleet_info[0][3]) new_access = 'Public' if fleet_info[0][4] == 1: new_access = 'Blues Only' embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Fleet Management".format(player_name), value="__**Fleet Info**__\n" "Member Count: {}\n\n" "**1.** Disband Fleet\n" "**2.** Kick Member\n" "**3.** Change Access to {}\n" "**4.** Return to the main menu".format( len(fleet_members), new_access)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.disband_fleet(ctx, fleet_info[0]) elif content == '2': await self.kick_member(ctx, fleet_info[0]) elif content == '3': await self.change_access(ctx, fleet_info[0]) elif content == '4': await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.' ) if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return else: sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (int(fleet_info[0][2]), ) fc = await db.select_var(sql, values) fc_name = self.bot.get_user(fc[0][2]).display_name fc_location = await game_functions.get_region(fc[0][4]) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Fleet Management".format(player_name), value="__**Fleet Info**__\n" "Member Count: {}\n" "FC: {}\n" "FC Location: {}\n\n" "**1.** Leave Fleet\n" "**2.** Return to the main menu".format( len(fleet_members), fc_name, fc_location)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.leave_fleet(ctx, player[0], fleet_info[0]) elif content == '2': await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.' ) if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return else: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Fleet Management".format(player_name), value="**1.** Create a Fleet\n" "**2.** Join a Fleet\n" "**3.** Return to the main menu") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': await self.create_fleet(ctx, player[0]) elif content == '2': await self.join_fleet(ctx, player[0]) elif content == '3': await ctx.invoke(self.bot.get_command("me"), True) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return
async def remove_blue(self, ctx, player): if player[21] is not None: remove_blue = {} remove_text = [] count = 1 for user in ast.literal_eval(player[21]): sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (user, ) blue = await db.select_var(sql, values) blue_name = self.bot.get_user(int(blue[0][2])).display_name remove_blue[count] = { 'name': blue_name, 'id': user, 'selection': count } remove_text.append('**{}.** {}'.format(count, blue_name)) blue_text = '\n'.join(remove_text) else: await ctx.author.send('**ERROR** - You have no one to remove.') return await ctx.invoke(self.bot.get_command("me"), True) player_name = self.bot.get_user(int(player[2])).display_name embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Remove Contacts".format(player_name), value="Select the user you'd like to remove\n\n{}".format( blue_text)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if int(content) not in remove_blue: await ctx.author.send('**ERROR** - Incorrect Selection.') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (remove_blue[int(content)]['id'], ) blue = await db.select_var(sql, values) blue_name = self.bot.get_user(int(blue[0][2])).display_name embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Add Contacts".format(player_name), value="Confirm you want to remove **{}** from your blue list.\n\n" "*You will freely engage this player if you encounter them*\n\n" "**1.** Yes\n" "**2.** No".format(blue_name)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) confirm = msg.content if int(confirm) != 1: await ctx.author.send('**Removal Canceled**') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return blue_array = ast.literal_eval(player[21]) blue_array.remove(remove_blue[int(content)]['id']) sql = ''' UPDATE eve_rpg_players SET blue_players = (?) WHERE player_id = (?); ''' values = ( str(blue_array), ctx.author.id, ) await db.execute_sql(sql, values) await ctx.author.send( '**Success** - {} is no longer blue.'.format(blue_name)) await ctx.invoke(self.bot.get_command("me"), True)
async def change_task(self, ctx): """Change your current task.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) if player[0][6] == 20: await ctx.author.send( '**ERROR** - You need to finish traveling first.') return await ctx.invoke(self.bot.get_command("me"), True) dock_text = "**1.** Dock in current region.\n" if player[0][6] is 1: dock_text = "**1.** Un-dock in your current region.\n" region_id = int(player[0][4]) region_security = await game_functions.get_region_security(region_id) region_info = await game_functions.get_region_info(region_id) pirate_anomaly = False pirate_anomaly_text = '' if region_info[4] != 0: pirate_anomaly = True pirate_anomaly_text = "**7.** Run the combat anomalies in this region.\n" mining_anomaly = False mining_anomaly_text = '' if region_info[5] != 0: mining_anomaly = True mining_anomaly_text = "**11.** Mine the rich ore anomaly.\n" current_task = await game_functions.get_task(int(player[0][6])) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") mission_destination = '' if player[0][22] is not None: mission_details = ast.literal_eval(player[0][22]) region_name = await game_functions.get_region( mission_details['region']) mission_destination = '\nMission Location: {}'.format(region_name) if int(player[0][4]) == int(mission_details['region']): mission_task = '**9.** Warp to mission site.\n' else: mission_task = '**9.** Abandon Mission.\n' else: mission_task = '**9.** Request a Mission.\n' if player[0][16] is not None and player[0][16] != 0: fleet_task = '**5.** Fleet Options.\n' else: fleet_task = '**5.** Join Fleet.\n' if region_security != 'High': embed.add_field(name="Change Task", value="**Current Task** - {}{}\n\n" "**Dock**\n" "{}" "**PVP Tasks**\n" "**2.** Hunt for players.\n" "**3.** Camp a gate in your current region.\n" "{}" "**PVE Tasks**\n" "**6.** Kill belt rats.\n" "{}" "{}" "**Mining Tasks**\n" "**10.** Mine an asteroid belt.\n" "{}".format(current_task, mission_destination, dock_text, fleet_task, pirate_anomaly_text, mission_task, mining_anomaly_text)) accepted = [1, 2, 3, 5, 6, 8, 9, 10] if pirate_anomaly is True: accepted.append(7) if mining_anomaly is True: accepted.append(11) else: embed.add_field( name="Change Task", value="**Current Task** - {}{}\n\n" "**Dock**\n" "{}" "**PVP Tasks**\n" "**4.** Try to gank someone.\n" "{}" "**PVE Tasks**\n" "**6.** Kill belt rats.\n" "**8.** Do some exploration and run sites in the system.\n" "{}" "**Mining Tasks**\n" "**10.** Mine an asteroid belt.\n".format( current_task, mission_destination, dock_text, fleet_task, mission_task)) accepted = [1, 4, 6, 8, 9, 10] await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) content = msg.content if content == '8' and player[0][0] != 4: await ctx.author.send('**Not Yet Implemented**') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return elif content == '8': return await ctx.invoke(self.bot.get_command("explore")) elif content == '5': return await ctx.invoke(self.bot.get_command("fleet")) elif content == '2' and int(content) in accepted: await self.hunting_options(ctx, player[0]) elif content == '9': await self.process_mission(ctx, player[0]) elif int(content) in accepted: if content == '1' and player[0][25] is not None: return await ctx.author.send( '**ERROR** - Your hostile actions have forced us to deny docking access for' ' approximately {} more seconds.'.format(player[0][25] * 12)) if player[0][6] is 1 and content == '1': content = '21' sql = ''' UPDATE eve_rpg_players SET task = (?) WHERE player_id = (?); ''' values = ( int(content), ctx.author.id, ) await db.execute_sql(sql, values) sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) new_task = await game_functions.get_task(int(player[0][6])) await ctx.author.send( '**Task Updated** - You are now {}.'.format(new_task)) elif '!!' not in content: await ctx.author.send('**ERROR** - Not a valid choice.') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return
async def process_mission(self, ctx, player): restrictions = game_assets.mission_restrictions if player[22] is not None: mission_details = ast.literal_eval(player[22]) if int(player[4]) == int(mission_details['region']): ship_type = ast.literal_eval(player[14])['ship_type'] ship = await game_functions.get_ship(int(ship_type)) level = mission_details['level'] if ship['class'] not in restrictions[level]: await ctx.author.send( '**That Class Of Ship Is Not Authorized In This Area**' ) return await ctx.invoke(self.bot.get_command("me"), True) sql = ''' UPDATE eve_rpg_players SET task = (?) WHERE player_id = (?); ''' values = ( 9, ctx.author.id, ) await db.execute_sql(sql, values) await ctx.author.send('**Entering Mission Site**') return await ctx.invoke(self.bot.get_command("me"), True) else: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Abandon Mission", value="Are you sure you want to abandon this mission?\n\n" "It will cost you {} ISK\n\n" "**1.** Yes\n" "**2.** No".format('{0:,.2f}'.format( float(mission_details['failure'])))) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '2': await ctx.author.send('**Mission Not Abandoned**') return await ctx.invoke(self.bot.get_command("me"), True) elif content != '1': await ctx.author.send('**Invalid Choice**') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return sql = ''' UPDATE eve_rpg_players SET mission_details = (?), isk = (?) WHERE player_id = (?); ''' values = ( None, player[5] - int(float(mission_details['failure'])), ctx.author.id, ) await db.execute_sql(sql, values) await ctx.author.send('**Mission Abandoned**') return await ctx.invoke(self.bot.get_command("me"), True) else: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Request Mission", value="What level mission are you looking for?\n\n" "*Higher level gets you better rewards, but the risk of death increases as well*\n\n" "**Respond with a number 1 - 5**") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content mission = await game_functions.get_mission(content) if mission is None: await ctx.author.send( '**No mission found for the requested level**') return await ctx.invoke(self.bot.get_command("me"), True) if int(content) < 3: reward = random.randint(35000 * int(content), 95000 * int(content)) failure = random.randint(int(float(reward * 0.20)), int(float(reward * 0.60))) elif int(content) < 5: reward = random.randint(125000 * int(content), 550000 * int(content)) failure = random.randint(int(float(reward * 0.20)), int(float(reward * 0.60))) else: reward = random.randint(525000 * int(content), 1000000 * int(content)) failure = random.randint(int(float(reward * 0.20)), int(float(reward * 0.60))) region_id = random.randint(5, 20) region_name = await game_functions.get_region(region_id) accepted_classes = [] for ship_class in restrictions[int(content)]: ship_class_name = game_assets.ship_classes[ship_class] accepted_classes.append(ship_class_name) ship_class_text = ', '.join(accepted_classes) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Offered Mission", value="__**{}**__\n\n" "{}\n\n" "**Mission Region:** {}\n" "**Accepted Ship Classes:** {}\n" "**Reward:** {} ISK\n" "**Failure Penalty:** {} ISK\n\n" "**1.** Accept\n" "**2.** Deny\n" "**3.** Request another mission\n".format( mission['name'], mission['initial'], region_name, ship_class_text, '{0:,.2f}'.format(float(reward)), '{0:,.2f}'.format(float(failure)))) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '3': return await self.process_mission(ctx, player) elif content == '2': await ctx.author.send('**Canceled**') return await ctx.invoke(self.bot.get_command("me"), True) elif content != '1': await ctx.author.send('**Invalid Choice**') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return details = mission mission['region'] = region_id mission['reward'] = reward mission['failure'] = failure sql = ''' UPDATE eve_rpg_players SET mission_details = (?) WHERE player_id = (?); ''' values = ( str(details), ctx.author.id, ) await db.execute_sql(sql, values) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Mission Assigned", value="Start heading towards {}, once in system visit the " "tasks menu to enter the site".format(region_name)) await ctx.author.send(embed=embed) return await ctx.invoke(self.bot.get_command("me"), True)
async def review_pending(self, ctx, corp): if corp[8] is not None: pending_members = ast.literal_eval(corp[8]) else: await ctx.author.send('**ERROR** - No pending applications.') return await ctx.invoke(self.bot.get_command("me"), True) pending_member_dict = {} pending_member_array = [] member_number = 1 for pending in pending_members: sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (int(pending), ) member = await db.select_var(sql, values) member_name = self.bot.get_user(int(member[0][2])).display_name pending_member_dict[member_number] = member[0][0] pending_member_array.append('**{}.** {}'.format( member_number, member_name)) member_number += 1 clean_members = '\n'.join(pending_member_array) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Manage Pending Applications", value="{}".format(clean_members)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if int(content) not in pending_member_dict: await ctx.author.send('**ERROR** - Incorrect Selection.') return await ctx.invoke(self.bot.get_command("me"), True) sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (int(pending_member_dict[int(content)]), ) applicant = await db.select_var(sql, values) applicant = applicant[0] applicant_user = self.bot.get_user(int(applicant[2])) applicant_name = applicant_user.display_name embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Manage Pending Applications", value="**Applicant:** {}\n\n" "**1.** Approve\n" "**2.** Deny\n".format(applicant_name)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if content == '1': sql = ''' UPDATE eve_rpg_players SET corporation = (?) WHERE id = (?); ''' values = ( corp[1], pending_member_dict[int(content)], ) await db.execute_sql(sql, values) await ctx.author.send('**Member Added**') await applicant_user.send( '**You have been added to the corporation {}**'.format(corp[3]) ) current_members = ast.literal_eval(corp[7]) current_members.append(applicant[0]) pending_members = ast.literal_eval(corp[8]) pending_members.remove(applicant[0]) pending_members = list(set(pending_members)) enter_pending = str(pending_members) if len(enter_pending) == 0: enter_pending = None sql = ''' UPDATE corporations SET pending_members = (?), members = (?) WHERE corp_id = (?); ''' values = (enter_pending, str(current_members), int(corp[1])) await db.execute_sql(sql, values) return elif content == '2': pending_members = ast.literal_eval(corp[8]) pending_members.remove(applicant[0]) pending_members = list(set(pending_members)) enter_pending = str(pending_members) if len(enter_pending) == 0: enter_pending = None sql = ''' UPDATE corporations SET pending_members = (?) WHERE corp_id = (?); ''' values = (enter_pending, int(content)) await db.execute_sql(sql, values) await ctx.author.send('**Member Denied**') await applicant_user.send( '**Your application to {} has been denied.**'.format(corp[3])) return
async def ship_hangar(self, ctx): """Visit your regional ship hangar.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) if player[0][6] is not 1: await ctx.author.send('**ERROR** - You must be docked to do this.') return await ctx.invoke(self.bot.get_command("me"), True) region_id = int(player[0][4]) region_name = await game_functions.get_region(region_id) player_ship_obj = ast.literal_eval(player[0][14]) current_ship = await game_functions.get_ship_name( int(player_ship_obj['ship_type'])) if player[0][15] is None: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="{} Ship Hangar".format(region_name), value='No Ships Found In This Region') return await ctx.author.send(embed=embed) else: ship_hangar = ast.literal_eval(player[0][15]) if player[0][4] not in ship_hangar: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="{} Ship Hangar".format(region_name), value='No Ships Found In This Region') return await ctx.author.send(embed=embed) stored_ships_array = [] owned_ship_ids = [] ship_number = 1 for ship in ship_hangar[player[0][4]]: owned_ship_ids.append(ship_number) ship['selection'] = ship_number custom_name = '' if 'custom_name' in ship: custom_name = '- {}'.format(ship['custom_name']) ship_name = await game_functions.get_ship_name( int(ship['ship_type'])) stored_ships_array.append('{}. {} {}'.format( ship_number, ship_name, custom_name)) ship_number += 1 stored_ships = '\n'.join(stored_ships_array) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="{} Ship Hangar".format(region_name), value=stored_ships) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) content = msg.content if int(content) in owned_ship_ids: for ship in ship_hangar[player[0][4]]: if ship['selection'] == int(content): ship_id = ship['id'] selected_ship = await game_functions.get_ship( int(ship['ship_type'])) insert_this = ship embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.set_thumbnail(url="{}".format(selected_ship['image'])) embed.add_field( name="Confirm Switch", value= "Are you sure you want to switch from a **{}** into a **{}**\n\n" "**1.** Yes.\n" "**2.** No.\n".format(current_ship, selected_ship['name'])) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) content = msg.content current_ship = ast.literal_eval(player[0][14]) if content != '1': await ctx.author.send('**Switch Canceled**') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return for ship in ship_hangar[player[0][4]]: if ship['id'] == ship_id: remove = ship break if player[0][12] is not None: old_modules = ast.literal_eval(player[0][12]) current_ship['modules'] = old_modules elif 'modules' in current_ship: current_ship['modules'] = None ship_hangar[player[0][4]].remove(remove) new_hangar = ship_hangar insert_this.pop('selection', None) if 'modules' in insert_this and insert_this[ 'modules'] is not None: modules = str(insert_this['modules']) else: modules = None if new_hangar is None: new_hangar = {player[0][4]: [current_ship]} else: new_hangar[player[0][4]].append(current_ship) values = ( str(insert_this), str(new_hangar), modules, ctx.author.id, ) sql = ''' UPDATE eve_rpg_players SET ship = (?), ship_hangar = (?), modules = (?) WHERE player_id = (?); ''' await db.execute_sql(sql, values) await ctx.author.send( '**A {} Is Now Your Active Ship**'.format( selected_ship['name'])) else: await ctx.author.send('**ERROR** - Not a valid choice.') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return
async def _ping(self, ctx): """Gets the discord server response time.""" msg = "{0:.2f} ms".format(ctx.bot.ws.latency * 1000) embed = utils.make_embed(msg_type='info', title='Bot Latency: {}'.format(msg)) await ctx.send(embed=embed)
async def explore(self, ctx): """Run a site.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) if player[0][6] is 1: await ctx.author.send( '**ERROR** - You must be undocked to do this.') return await ctx.invoke(self.bot.get_command("me"), True) explorer = player[0] region_id = int(explorer[4]) region_security = await game_functions.get_region_security(region_id) isk = random.randint(3000, 7500) best_of = 3 loot_chance = 2 if region_security == 'Low': isk = random.randint(6500, 12500) best_of = 5 loot_chance = 4 elif region_security == 'Null': isk = random.randint(10500, 20500) best_of = 5 loot_chance = 7 # PVE Rolls find_sites = await weighted_choice([(True, 60), (False, 40)]) if find_sites is False: await ctx.author.send( '**No Sites Found** - Failed to find any sites, try again.') return await ctx.invoke(self.bot.get_command("task")) else: player = self.bot.get_user(explorer[2]) embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Site Found", value= "You've located an empty site and begin trying to hack the storage containers in " "the area.") await player.send(embed=embed) your_score = 0 ai_score = 0 last_action = '' win = False for x in range(11): if your_score >= best_of: win = True break if ai_score >= best_of: win = False break embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Hacking", value="Someone is countering your hack...\n\n" "{}" "Your Hack Score: {}\n" "Hostile Hack Score: {}\n\n" "__Choose an action__\n" "**B.** Brute Attack\n" "**F.** Firewall\n" "**T.** Trojan Attack\n".format( last_action, your_score, ai_score)) await player.send(embed=embed) def check(m): return m.author == player and m.channel == player.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120.0) response = msg.content.lower() if response != 'b' and response != 'f' and response != 't': last_action = '**Last Action:** Incorrect Response\n' ai_score += 1 continue ai_action = await weighted_choice([('1', 33), ('2', 33), ('3', 33)]) if response == 'b' and ai_action != '2' and ai_action != response: last_action = '**Last Action:** Brute Attack Successful\n' your_score += 1 continue if response == 'b' and ai_action == '2': last_action = '**Last Action:** Brute Attack Stopped By Firewall\n' ai_score += 1 continue if response == 'f' and ai_action != '3' and ai_action != response: last_action = '**Last Action:** Firewall Successful\n' your_score += 1 continue if response == 'f' and ai_action == '3': last_action = '**Last Action:** Trojan Attack Countered Your Firewall\n' ai_score += 1 continue if response == 't' and ai_action != '1' and ai_action != response: last_action = '**Last Action:** Trojan Attack Successful\n' your_score += 1 continue if response == 't' and ai_action == '1': last_action = '**Last Action:** Brute Attack Overwhelmed Your Trojan Attack Attempt\n' ai_score += 1 continue if win is True: xp_gained = await weighted_choice([(2, 35), (3, 15), (0, 15)]) await add_xp(explorer, xp_gained) await add_isk(explorer, isk) await update_journal(explorer, isk, 'Exploration') await player.send( '**Success** Site succesfully hacked for {} ISK, hunting for a new site.' .format('{0:,.2f}'.format(float(isk)))) await self.pve_loot(explorer, loot_chance) else: await player.send( '**Failure** The AI defeated you, looking for a new site.')
async def join_fleet(self, ctx, player): embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Join Fleet", value="What is the player ID of the FC?\n\n" "*Users can find their player ID on the top of their !!me menu*") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content sql = ''' SELECT * FROM fleet_info WHERE `fleet_fc` = (?) ''' values = (int(content), ) fleet = await db.select_var(sql, values) if len(fleet) == 0: await ctx.author.send('**ERROR** - No fleet found.') return await ctx.invoke(self.bot.get_command("me"), True) if fleet[0][4] == 1: members = ast.literal_eval(fleet[0][3]) members.append(player[0]) sql = ''' UPDATE eve_rpg_players SET fleet = (?) WHERE player_id = (?); ''' values = ( fleet[0][1], ctx.author.id, ) await db.execute_sql(sql, values) sql = ''' UPDATE fleet_info SET fleet_members = (?) WHERE fleet_id = (?); ''' values = (str(members), fleet[0][1]) await db.execute_sql(sql, values) await ctx.author.send('**Success** - Fleet created.') return await ctx.invoke(self.bot.get_command("me"), True) if fleet[0][4] == 2: sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (int(content), ) fc = await db.select_var(sql, values) if fc[0][21] is not None: blue_array = ast.literal_eval(fc[0][21]) if player[0] in blue_array: members = ast.literal_eval(fleet[0][3]) members.append(player[0]) sql = ''' UPDATE eve_rpg_players SET fleet = (?) WHERE player_id = (?); ''' values = ( fleet[0][1], ctx.author.id, ) await db.execute_sql(sql, values) sql = ''' UPDATE fleet_info SET fleet_members = (?) WHERE fleet_id = (?); ''' values = (str(members), fleet[0][1]) await db.execute_sql(sql, values) await ctx.author.send('**Success** - Joined Fleet.') return await ctx.invoke(self.bot.get_command("me"), True) await ctx.author.send( '**Failure** - FC has set the fleet to only accept blues.') return await ctx.invoke(self.bot.get_command("me"), True)
async def _sessions_resumed(self, ctx): """Gets the number of websocket reconnections.""" r_c = ctx.bot.resumed_count embed = utils.make_embed(msg_type='info', title="Connections Resumed: {}".format(r_c)) await ctx.send(embed=embed)
async def add_blue(self, ctx, player): player_name = self.bot.get_user(int(player[2])).display_name embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Add Contacts".format(player_name), value="What is the player ID of the user you'd like to add?\n\n" "*Users can find their player ID on the top of their !!me menu*") await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content sql = ''' SELECT * FROM eve_rpg_players WHERE `id` = (?) ''' values = (int(content), ) new_blue = await db.select_var(sql, values) if len(new_blue) == 0: await ctx.author.send('**ERROR** - Not a valid player.') return await ctx.invoke(self.bot.get_command("me"), True) blue_name = self.bot.get_user(int(new_blue[0][2])).display_name embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Add Contacts".format(player_name), value="Confirm you want to add **{}** to your blue list.\n\n" "*Players on your blue list will not be attacked by you, they will still attack you " "unless they also add you to their blues list*\n\n" "**1.** Yes\n" "**2.** No".format(blue_name)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=120) content = msg.content if int(content) != 1: await ctx.author.send('**New Contact Canceled**') if content.find('!!') == -1: return await ctx.invoke(self.bot.get_command("me"), True) else: return if player[21] is not None: blue_array = ast.literal_eval(player[21]) blue_array.append(new_blue[0][0]) else: blue_array = [new_blue[0][0]] sql = ''' UPDATE eve_rpg_players SET blue_players = (?) WHERE player_id = (?); ''' values = ( str(blue_array), ctx.author.id, ) await db.execute_sql(sql, values) await ctx.author.send('**Success** - {} is now blue.'.format(blue_name) ) await ctx.invoke(self.bot.get_command("me"), True)
async def _me(self, ctx, redirect=False): """Manage your character.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass if ctx.invoked_subcommand is None: sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) player_name = self.bot.get_user(int(player[0][2])).display_name if player[0][23] is not None: corp_info = await game_functions.get_user_corp(player[0][23]) player_name = '{} [{}]'.format(player_name, corp_info[4]) region_id = int(player[0][4]) sql = ''' SELECT * FROM eve_rpg_players WHERE `region` = (?) ''' values = (region_id, ) local_players = await db.select_var(sql, values) region_name = await game_functions.get_region(region_id) region_info = await game_functions.get_region_info(region_id) anomaly_text = '' if region_info[4] != 0: anomaly_text = "*Pirate Anomalies Present In This Region*\n\n" if region_info[5] != 0: anomaly_text = "*Rich Mining Anomalies Present In This Region*\n\n" if region_info[5] != 0 and region_info[4] != 0: anomaly_text = "*Pirate Anomalies Present In This Region*\n*Rich Ore Anomalies Present In This Region*\n\n" current_task = await game_functions.get_task(int(player[0][6])) player_ship_obj = ast.literal_eval(player[0][14]) module_cargo_option = '' if 'module_cargo_bay' in player_ship_obj and int( player[0][6]) == 1: module_cargo_option = '**8.** Empty Module Cargo Bay\n' component_cargo_option = '' if 'component_cargo_bay' in player_ship_obj and int( player[0][6]) == 1: component_cargo_option = '**9.** Empty Component Cargo Bay\n' current_ship_raw = await game_functions.get_ship_name( int(player_ship_obj['ship_type'])) current_ship = current_ship_raw wallet_balance = '{0:,.2f}'.format(float(player[0][5])) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") timeout = None if redirect is False: embed.add_field( name="Welcome {} - Player ID: {} ".format( player_name, player[0][0]), value= "**Current Region** - {}\n**Local Count** - {}\n**Current Ship** - {}\n" "**Current Task** - {}\n**Wallet Balance** - {}\n**i.** For Regional Stats\n\n{}" "**1.** Change task.\n" "**2.** Travel to a new region.\n" "**3.** Modify current ship.\n" "**4.** Change into another ship.\n" "**5.** Visit the regional market.\n" "**6.** View your asset list.\n" "**7.** Insure your ship.\n" "{}" "{}" "**10.** Change your clone to here.\n" "**11.** View Local.\n" "**12.** View Your Wallet.\n" "**13.** Manage your contacts.\n" "**14.** Corporation Management.\n".format( region_name, len(local_players), current_ship, current_task, wallet_balance, anomaly_text, module_cargo_option, component_cargo_option)) if redirect is True: timeout = None embed.add_field( name="Welcome {} - Player ID: {} ".format( player_name, player[0][0]), value="**Current Region** - {}\n**Local Count** - {}\n\n{}" "**m.** Open Full Menu.\n".format(region_name, len(local_players), anomaly_text)) await ctx.author.send(embed=embed) def check(m): return m.author == ctx.author and m.channel == ctx.author.dm_channel msg = await self.bot.wait_for('message', check=check, timeout=timeout) content = msg.content if content.lower() == 'm': await ctx.invoke(self.bot.get_command("me")) elif content.lower() == 'i': pve_kills_hour, pve_kills_day, pvp_kills_hour, pvp_kills_day, pve_kills_last_hour, pve_kills_yesterday, pvp_kills_last_hour, pvp_kills_yesterday = await game_functions.get_region_kill_info( region_id) embed = make_embed(icon=self.bot.user.avatar) embed.set_footer(icon_url=self.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field( name="Regional Data For {}".format(region_name), value='Local Count - {}\n\n' '__Hourly Kill Data__\n' 'NPC Kills Last Hour/Prior Hour - {}/{}\n' 'Player Kills Last Hour/Prior Hour - {}/{}\n' '__Daily Kill Data__\n\n' 'NPC Kills Last Day/Prior Day - {}/{}\n' 'Player Kills Last Day/Prior Day - {}/{}\n'.format( len(local_players), pve_kills_hour, pve_kills_last_hour, pvp_kills_hour, pvp_kills_last_hour, pve_kills_day, pve_kills_yesterday, pvp_kills_day, pvp_kills_yesterday)) await ctx.author.send(embed=embed) await ctx.invoke(self.bot.get_command("me"), True) elif content == '1': await ctx.invoke(self.bot.get_command("task")) elif content == '2': await ctx.invoke(self.bot.get_command("travel")) elif content == '3': await ctx.invoke(self.bot.get_command("fitting")) elif content == '4': await ctx.invoke(self.bot.get_command("hangar")) elif content == '5': await ctx.invoke(self.bot.get_command("market")) elif content == '6': await ctx.invoke(self.bot.get_command("assets")) elif content == '7': await self.insure_ship(ctx, player) elif content == '8' and 'module_cargo_bay' in player_ship_obj and int( player[0][6]) == 1: await self.empty_module_cargo(ctx) elif content == '9' and 'component_cargo_bay' in player_ship_obj and int( player[0][6]) == 1: await self.empty_component_cargo(ctx) elif content == '10': await self.change_clone(ctx, player) elif content == '11': await ctx.invoke(self.bot.get_command("local")) elif content == '12': await ctx.invoke(self.bot.get_command("wallet")) elif content == '13': await ctx.invoke(self.bot.get_command("contacts")) elif content == '14': await ctx.invoke(self.bot.get_command("corp")) else: return
async def assets(self, ctx): """View your assets.""" if ctx.guild is not None: try: await ctx.message.delete() except Exception: pass sql = ''' SELECT * FROM eve_rpg_players WHERE `player_id` = (?) ''' values = (ctx.message.author.id, ) player = await db.select_var(sql, values) if player[0][15] is None and player[0][13] is None: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed.add_field(name="Asset List", value='No Assets Found') await ctx.author.send(embed=embed) else: embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") total = 0 embed_count = 1 if player[0][15] is not None: ship_hangar = ast.literal_eval(player[0][15]) stored_ships_array = [] count = 0 for key, ships in ship_hangar.items(): for ship in ships: if total >= 35 * embed_count: await ctx.author.send(embed=embed) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed_count += 1 total += 1 region_name = await game_functions.get_region(key) ship_name = await game_functions.get_ship_name( int(ship['ship_type'])) stored_ships_array.append('{} - {}'.format( ship_name, region_name)) count += 1 if count >= 10: count = 0 stored_ships = '\n'.join(stored_ships_array) embed.add_field(name="Ships", value='{}'.format(stored_ships)) stored_ships_array = [] if len(stored_ships_array) > 0: stored_ships = '\n'.join(stored_ships_array) embed.add_field(name="Ships", value='{}'.format(stored_ships)) total = 0 embed_count = 1 if player[0][13] is not None: module_hangar = ast.literal_eval(player[0][13]) stored_modules_array = [] count = 0 for key, items in module_hangar.items(): for item in items: if total >= 35 * embed_count: await ctx.author.send(embed=embed) embed = make_embed(icon=ctx.bot.user.avatar) embed.set_footer(icon_url=ctx.bot.user.avatar_url, text="Aura - EVE Text RPG") embed_count += 1 total += 1 region_name = await game_functions.get_region(key) module_name = await game_functions.get_module_name( int(item)) stored_modules_array.append('{} - {}'.format( module_name, region_name)) count += 1 if count >= 10: count = 0 stored_modules = '\n'.join(stored_modules_array) embed.add_field(name="Modules", value='{}'.format(stored_modules)) stored_modules_array = [] if len(stored_modules_array) > 0: stored_modules = '\n'.join(stored_modules_array) embed.add_field(name="Modules", value='{}'.format(stored_modules)) if player[0][13] is None and player[0][15] is None: embed.add_field(name="Asset List", value='No Assets Found') await ctx.author.send(embed=embed) return await ctx.invoke(self.bot.get_command("me"), True)