GalaxyCogs/worldzero/worldzero.py

37 lines
1.8 KiB
Python
Raw Permalink Normal View History

2023-08-06 21:48:18 -04:00
from redbot.core import commands
import discord
class WorldZero(commands.Cog):
"""This cog is meant to provide random functions for my crippling World Zero addiction!
Developed by SeaswimmerTheFsh."""
def __init__(self, bot):
self.bot = bot
@commands.group(name="worldzero", invoke_without_command=True, aliases=['wz'])
async def worldzero(self, ctx: commands.Context):
"""Tells the user that this command doesn't do anything currently."""
await ctx.send("This command doesn't do anything currently, have you tried a subcommand?\nCurrent subcommands:\n- `-worldzero upgrade` - Checks what the Attack Power/Health of an item will be after upgrading it.\n - See `-help worldzero upgrade` for more information.")
2023-08-06 21:48:18 -04:00
@worldzero.command(name="upgrade")
async def worldzero_upgrade(self, ctx: commands.Context, power_amount: str, upgrade_amount: str):
2023-08-06 21:52:37 -04:00
"""Checks what the Attack Power/Health of an item will be after upgrading it.
2023-08-06 21:54:36 -04:00
**Arguments**
- The `power_amount` argument is the Attack Power/Health of the item you're looking to upgrade.
2023-08-06 21:52:37 -04:00
- The `upgrade_amount` argument is the number of times your item can be upgraded."""
2023-08-06 21:48:18 -04:00
try:
stat_int = int(f"{power_amount}".replace(",", ""))
upgrade_int = int(f"{upgrade_amount}".replace(",", ""))
except ValueError:
await ctx.send(content="Please input a number!")
return
math = round(stat_int + ((stat_int/15)*upgrade_int))
output_from = f'{stat_int:,}'
output_to = f'{math:,}'
embed = discord.Embed(color=await self.bot.get_embed_color(None))
embed.add_field(name="Default Power", value=f"{output_from}", inline=False)
embed.add_field(name="Upgraded Power", value=f"{output_to}", inline=False)
await ctx.send(embed=embed)