Skip to content

Commit

Permalink
🤫
Browse files Browse the repository at this point in the history
  • Loading branch information
tookender committed Oct 18, 2024
1 parent 56b1433 commit fe04c37
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions extensions/dq/calculators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from numerize import numerize
from numerize import numerize as numerize
from discord import app_commands
from discord.ext import commands

Expand All @@ -7,6 +7,9 @@
from utils import Embed
from typing import Optional

def n(value):
return numerize.numerize(value)

class CalculatorsCog(DQBase):
@commands.hybrid_command(description="Calculate max potential of an item and the upgrade cost.", aliases=["potential", "pot", "calc_pot", "calcpot", "potcalc", "potentialcalc"])
@app_commands.describe(current_power="Current power of your item.")
Expand All @@ -16,8 +19,8 @@ async def calc_potential(self, ctx, current_power: int, current_upgrades: int, t
upgrade_cost = calculate_upgrade_cost(current_upgrades, total_upgrades)
potential = calculate_potential(current_power, current_upgrades, total_upgrades)

humanized_cost = f"({numerize.numerize(upgrade_cost)})"
humanized_potential = f"({numerize.numerize(potential)})"
humanized_cost = f"({n(upgrade_cost)})"
humanized_potential = f"({n(potential)})"

embed = Embed(title="Potential Calculator")

Expand Down Expand Up @@ -49,8 +52,8 @@ async def calc_potential(self, ctx, current_power: int, current_upgrades: int, t
app_commands.Choice(name="Jade Roller", value="Jade Roller"),
app_commands.Choice(name="Solar Beam (2 ticks)", value="Solar Beam (2 ticks)"),
])
async def calc_damage(self, ctx, ability: app_commands.Choice[str], helmet_power: int, armor_power: int, weapon_power: int,
ring1_power: int, ring2_power: int, damage_skill_points: int):
async def calc_damage(self, ctx, ability: app_commands.Choice[str], helmet_power: Optional[int] = 0, armor_power: Optional[int] = 0, weapon_power: Optional[int] = 0,
ring1_power: Optional[int] = 0, ring2_power: Optional[int] = 0, damage_skill_points: Optional[int] = 0):
damage = calculate_damage(ability, armor_power, helmet_power, weapon_power, ring1_power, ring2_power, damage_skill_points)

ni_low = damage['No Inner']['Low Damage']
Expand All @@ -65,10 +68,10 @@ async def calc_damage(self, ctx, ability: app_commands.Choice[str], helmet_power
ei_avg = damage['With Enhanced Inner']['Average']
ei_high = damage["With Enhanced Inner"]["High Damage"]

embed = Embed(title="Damage Range Calculator", description=f"{damage}")
embed = Embed(title="Damage Range Calculator")

embed.add_field(name="❌ No Inner", value=f"Low Damage: {ni_low:,}\nAverage Damage: {ni_avg:,}\n High Damage: {ni_high:,}", inline=False)
embed.add_field(name="✨ With Inner", value=f"Low Damage: {wi_low:,}\nAverage Damage: {wi_avg:,}\n High Damage: {wi_high:,}", inline=False)
embed.add_field(name="🌟 With Inner", value=f"Low Damage: {ei_low:,}\nAverage Damage: {ei_avg:,}\n High Damage: {ei_high:,}", inline=False)
embed.add_field(name="❌ No Inner", value=f"Low Damage: {ni_low:,} ({n(ni_low)})\nAverage Damage: {ni_avg:,} ({n(ni_avg)})\n High Damage: {ni_high:,} ({n(ni_high)})", inline=False)
embed.add_field(name="✨ With Inner", value=f"Low Damage: {wi_low:,} ({n(wi_low)})\nAverage Damage: {wi_avg:,} ({n(wi_avg)})\n High Damage: {wi_high:,} ({n(wi_high)})", inline=False)
embed.add_field(name="🌟 With Inner", value=f"Low Damage: {ei_low:,} ({n(ei_low)})\nAverage Damage: {ei_avg:,} ({n(ei_avg)})\n High Damage: {ei_high:,} ({n(ei_high)})", inline=False)

return await ctx.send(embed=embed)

0 comments on commit fe04c37

Please sign in to comment.