added insurance command and subcommands

This commit is contained in:
SeaswimmerTheFsh 2023-04-05 22:42:08 -04:00
parent 32f78b93bf
commit 8c0cc75093

View file

@ -118,6 +118,140 @@ class Galaxy(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
await ctx.message.delete() await ctx.message.delete()
@commands.group(autohelp=True)
async def insurance(self, ctx: commands.Context):
"""Calculates insurance."""
@insurance.command()
async def miner(self, ctx: commands.Context, cost: int):
"""Calculates insurance for miners."""
insurance_amount = cost * 0.7
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Miner"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def freighter(self, ctx: commands.Context, cost: int):
"""Calculates insurance for freighters."""
insurance_amount = cost * 0.65
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Freighter"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def frigate(self, ctx: commands.Context, cost: int):
"""Calculates insurance for frigates."""
insurance_amount = cost * 0.6
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Frigate"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def destroyer(self, ctx: commands.Context, cost: int):
"""Calculates insurance for destroyers."""
insurance_amount = cost * 0.55
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Destroyer"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def cruiser(self, ctx: commands.Context, cost: int):
"""Calculates insurance for cruisers."""
insurance_amount = cost * 0.7
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Cruiser"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def battlecruiser(self, ctx: commands.Context, cost: int):
"""Calculates insurance for battlecruisers."""
insurance_amount = cost * 0.4
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Battlecruiser"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def battleship(self, ctx: commands.Context, cost: int):
"""Calculates insurance for battleships."""
insurance_amount = cost * 0.35
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Battleship"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def dreadnought(self, ctx: commands.Context, cost: int):
"""Calculates insurance for Dreadnoughts."""
insurance_amount = cost * 0.3
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Dreadnought"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def carrier(self, ctx: commands.Context, cost: int):
"""Calculates insurance for carriers."""
insurance_amount = cost * 0.3
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Carrier"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@insurance.command()
async def supercapital(self, ctx: commands.Context, cost: int):
"""Calculates insurance for Super Capitals."""
insurance_amount = cost * 0.25
output = (f'{insurance_amount:,}')
cost_output = (f'{cost:,}')
ship_class = "Super Capital"
embed = discord.Embed(title="Insurance Cost", color=await self.bot.get_embed_color(None))
embed.add_field(name="Ship Class", content={ship_class})
embed.add_field(name="Ship Cost", content={cost_output})
embed.add_field(name="Insurance Amount", content={output})
await ctx.send(embed=embed)
@commands.command(aliases=["wh"]) @commands.command(aliases=["wh"])
async def warehouse(self, ctx: commands.Context, lvlfrom: int = 1, lvlto: int = 38): async def warehouse(self, ctx: commands.Context, lvlfrom: int = 1, lvlto: int = 38):
"""Calculates the total cost to upgrade your warehouse from a level to a level.""" """Calculates the total cost to upgrade your warehouse from a level to a level."""