diff --git a/database/crud/currency.py b/database/crud/currency.py index da0ff84..25c0523 100644 --- a/database/crud/currency.py +++ b/database/crud/currency.py @@ -6,11 +6,6 @@ from sqlalchemy.ext.asyncio import AsyncSession from database.crud import users from database.exceptions import currency as exceptions from database.schemas import Bank, NightlyData -from database.utils.math.currency import ( - capacity_upgrade_price, - interest_upgrade_price, - rob_upgrade_price, -) __all__ = [ "add_dinks", @@ -18,13 +13,10 @@ __all__ = [ "get_bank", "get_nightly_data", "invest", - "upgrade_capacity", - "upgrade_interest", - "upgrade_rob", "NIGHTLY_AMOUNT", ] -NIGHTLY_AMOUNT = 420 +NIGHTLY_AMOUNT = 50 async def get_bank(session: AsyncSession, user_id: int) -> Bank: @@ -81,57 +73,3 @@ async def claim_nightly(session: AsyncSession, user_id: int): session.add(bank) session.add(nightly_data) await session.commit() - - -async def upgrade_capacity(session: AsyncSession, user_id: int) -> int: - """Upgrade capacity level""" - bank = await get_bank(session, user_id) - upgrade_price = capacity_upgrade_price(bank.capacity_level) - - # Can't afford this upgrade - if upgrade_price > bank.dinks: - raise exceptions.NotEnoughDinks - - bank.dinks -= upgrade_price - bank.capacity_level += 1 - - session.add(bank) - await session.commit() - - return bank.capacity_level - - -async def upgrade_interest(session: AsyncSession, user_id: int) -> int: - """Upgrade interest level""" - bank = await get_bank(session, user_id) - upgrade_price = interest_upgrade_price(bank.interest_level) - - # Can't afford this upgrade - if upgrade_price > bank.dinks: - raise exceptions.NotEnoughDinks - - bank.dinks -= upgrade_price - bank.interest_level += 1 - - session.add(bank) - await session.commit() - - return bank.interest_level - - -async def upgrade_rob(session: AsyncSession, user_id: int) -> int: - """Upgrade rob level""" - bank = await get_bank(session, user_id) - upgrade_price = rob_upgrade_price(bank.rob_level) - - # Can't afford this upgrade - if upgrade_price > bank.dinks: - raise exceptions.NotEnoughDinks - - bank.dinks -= upgrade_price - bank.rob_level += 1 - - session.add(bank) - await session.commit() - - return bank.rob_level diff --git a/database/utils/math/__init__.py b/database/utils/math/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/database/utils/math/currency.py b/database/utils/math/currency.py deleted file mode 100644 index b06c558..0000000 --- a/database/utils/math/currency.py +++ /dev/null @@ -1,27 +0,0 @@ -import math - -__all__ = ["capacity_upgrade_price", "interest_upgrade_price", "rob_upgrade_price"] - - -def interest_upgrade_price(level: int) -> int: - """Calculate the price to upgrade your interest level""" - base_cost = 600 - growth_rate = 1.8 - - return math.floor(base_cost * (growth_rate**level)) - - -def capacity_upgrade_price(level: int) -> int: - """Calculate the price to upgrade your capacity level""" - base_cost = 800 - growth_rate = 1.6 - - return math.floor(base_cost * (growth_rate**level)) - - -def rob_upgrade_price(level: int) -> int: - """Calculate the price to upgrade your rob level""" - base_cost = 950 - growth_rate = 1.9 - - return math.floor(base_cost * (growth_rate**level)) diff --git a/didier/cogs/currency.py b/didier/cogs/currency.py index 4049654..f4efa25 100644 --- a/didier/cogs/currency.py +++ b/didier/cogs/currency.py @@ -4,12 +4,7 @@ import discord from discord.ext import commands from database.crud import currency as crud -from database.exceptions.currency import DoubleNightly, NotEnoughDinks -from database.utils.math.currency import ( - capacity_upgrade_price, - interest_upgrade_price, - rob_upgrade_price, -) +from database.exceptions.currency import DoubleNightly from didier import Didier from didier.utils.discord.checks import is_owner from didier.utils.discord.converters import abbreviated_number @@ -59,61 +54,6 @@ class Currency(commands.Cog): await ctx.reply(embed=embed, mention_author=False) - @bank.group( # type: ignore[arg-type] - name="upgrade", aliases=["u", "upgrades"], case_insensitive=True, invoke_without_command=True - ) - async def bank_upgrades(self, ctx: commands.Context): - """List the upgrades you can buy & their prices.""" - async with self.client.postgres_session as session: - bank = await crud.get_bank(session, ctx.author.id) - - embed = discord.Embed(title="Bank upgrades", colour=discord.Colour.blue()) - - embed.add_field( - name=f"Interest ({bank.interest_level})", value=str(interest_upgrade_price(bank.interest_level)) - ) - embed.add_field( - name=f"Capacity ({bank.capacity_level})", value=str(capacity_upgrade_price(bank.capacity_level)) - ) - embed.add_field(name=f"Rob ({bank.rob_level})", value=str(rob_upgrade_price(bank.rob_level))) - - embed.set_footer(text="Didier Bank Upgrade [Category]") - - await ctx.reply(embed=embed, mention_author=False) - - @bank_upgrades.command(name="capacity", aliases=["c"]) # type: ignore[arg-type] - async def bank_upgrade_capacity(self, ctx: commands.Context): - """Upgrade the capacity level of your bank.""" - async with self.client.postgres_session as session: - try: - await crud.upgrade_capacity(session, ctx.author.id) - await ctx.message.add_reaction("⏫") - except NotEnoughDinks: - await ctx.reply("You don't have enough Didier Dinks to do this.", mention_author=False) - await self.client.reject_message(ctx.message) - - @bank_upgrades.command(name="interest", aliases=["i"]) # type: ignore[arg-type] - async def bank_upgrade_interest(self, ctx: commands.Context): - """Upgrade the interest level of your bank.""" - async with self.client.postgres_session as session: - try: - await crud.upgrade_interest(session, ctx.author.id) - await ctx.message.add_reaction("⏫") - except NotEnoughDinks: - await ctx.reply("You don't have enough Didier Dinks to do this.", mention_author=False) - await self.client.reject_message(ctx.message) - - @bank_upgrades.command(name="rob", aliases=["r"]) # type: ignore[arg-type] - async def bank_upgrade_rob(self, ctx: commands.Context): - """Upgrade the rob level of your bank.""" - async with self.client.postgres_session as session: - try: - await crud.upgrade_rob(session, ctx.author.id) - await ctx.message.add_reaction("⏫") - except NotEnoughDinks: - await ctx.reply("You don't have enough Didier Dinks to do this.", mention_author=False) - await self.client.reject_message(ctx.message) - @commands.hybrid_command(name="dinks") # type: ignore[arg-type] async def dinks(self, ctx: commands.Context): """Check your Didier Dinks.""" diff --git a/didier/utils/types/string.py b/didier/utils/types/string.py index 6f4a0cc..44f8c4b 100644 --- a/didier/utils/types/string.py +++ b/didier/utils/types/string.py @@ -62,7 +62,7 @@ def mock(string: str) -> str: def pluralize(word: str, amount: int, plural_form: Optional[str] = None) -> str: - """Turn a word into plural""" + """Turn a word into plural if necessary""" if amount == 1: return word