pull/144/head
bobloy 5 years ago
parent 458e0c04ea
commit 218388fe8f

@ -31,9 +31,7 @@ class Gardener:
"Badges: {}\n"
"Points: {}\n"
"Products: {}\n"
"Current: {}".format(
self.user, self.badges, self.points, self.products, self.current
)
"Current: {}".format(self.user, self.badges, self.points, self.products, self.current)
)
def __repr__(self):
@ -257,17 +255,12 @@ class PlantTycoon(commands.Cog):
degradation = (
100
/ (gardener.current["time"] / 60)
* (
self.defaults["degradation"]["base_degradation"]
+ gardener.current["degradation"]
)
* (self.defaults["degradation"]["base_degradation"] + gardener.current["degradation"])
) + modifiers
d = collections.namedtuple("degradation", "degradation time modifiers")
return d(
degradation=degradation, time=gardener.current["time"], modifiers=modifiers
)
return d(degradation=degradation, time=gardener.current["time"], modifiers=modifiers)
# async def _get_member(self, user_id):
#
@ -296,10 +289,7 @@ class PlantTycoon(commands.Cog):
await self._load_plants_products()
product = product.lower()
product_category = product_category.lower()
if (
product in self.products
and self.products[product]["category"] == product_category
):
if product in self.products and self.products[product]["category"] == product_category:
if product in gardener.products:
if gardener.products[product] > 0:
gardener.current["health"] += self.products[product]["health"]
@ -370,11 +360,11 @@ class PlantTycoon(commands.Cog):
``{0}prune``: Prune your plant.\n"""
em = discord.Embed(
title=title, description=description.format(prefix), color=discord.Color.green(),
)
em.set_thumbnail(
url="https://image.prntscr.com/image/AW7GuFIBSeyEgkR2W3SeiQ.png"
title=title,
description=description.format(prefix),
color=discord.Color.green(),
)
em.set_thumbnail(url="https://image.prntscr.com/image/AW7GuFIBSeyEgkR2W3SeiQ.png")
em.set_footer(
text="This cog was made by SnappyDragon18 and PaddoInWonderland. Inspired by The Lorax (2012)."
)
@ -448,9 +438,7 @@ class PlantTycoon(commands.Cog):
em = discord.Embed(color=discord.Color.green()) # , description='\a\n')
avatar = author.avatar_url if author.avatar else author.default_avatar_url
em.set_author(
name="Gardening profile of {}".format(author.name), icon_url=avatar
)
em.set_author(name="Gardening profile of {}".format(author.name), icon_url=avatar)
em.add_field(name="**Thneeds**", value=str(gardener.points))
if not gardener.current:
em.add_field(name="**Currently growing**", value="None")
@ -517,9 +505,7 @@ class PlantTycoon(commands.Cog):
else:
tock += "**{}**\n".format(plant["name"])
tick_tock = 0
em = discord.Embed(
title="All plants that are growable", color=discord.Color.green()
)
em = discord.Embed(title="All plants that are growable", color=discord.Color.green())
em.add_field(name="\a", value=tick)
em.add_field(name="\a", value=tock)
await ctx.send(embed=em)
@ -541,17 +527,14 @@ class PlantTycoon(commands.Cog):
if t:
em = discord.Embed(
title="Plant statistics of {}".format(plant["name"]), color=discord.Color.green(),
title="Plant statistics of {}".format(plant["name"]),
color=discord.Color.green(),
)
em.set_thumbnail(url=plant["image"])
em.add_field(name="**Name**", value=plant["name"])
em.add_field(name="**Rarity**", value=plant["rarity"].capitalize())
em.add_field(
name="**Grow Time**", value="{0:.1f} minutes".format(plant["time"] / 60)
)
em.add_field(
name="**Damage Threshold**", value="{}%".format(plant["threshold"])
)
em.add_field(name="**Grow Time**", value="{0:.1f} minutes".format(plant["time"] / 60))
em.add_field(name="**Damage Threshold**", value="{}%".format(plant["threshold"]))
em.add_field(name="**Badge**", value=plant["badge"])
em.add_field(name="**Reward**", value="{} τ".format(plant["reward"]))
else:
@ -603,7 +586,8 @@ class PlantTycoon(commands.Cog):
author = ctx.author
if product is None:
em = discord.Embed(
title="All gardening supplies that you can buy:", color=discord.Color.green(),
title="All gardening supplies that you can buy:",
color=discord.Color.green(),
)
for pd in self.products:
em.add_field(
@ -636,8 +620,11 @@ class PlantTycoon(commands.Cog):
await gardener.save_gardener()
message = "You bought {}.".format(product.lower())
else:
message = "You don't have enough Thneeds. You have {}, but need {}.".format(
gardener.points, self.products[product.lower()]["cost"] * amount,
message = (
"You don't have enough Thneeds. You have {}, but need {}.".format(
gardener.points,
self.products[product.lower()]["cost"] * amount,
)
)
else:
message = "I don't have this product."
@ -656,14 +643,11 @@ class PlantTycoon(commands.Cog):
plural = "s"
if withdraw_points:
await bank.deposit_credits(author, amount)
message = "{} Thneed{} successfully exchanged for credits.".format(
amount, plural
)
message = "{} Thneed{} successfully exchanged for credits.".format(amount, plural)
await gardener.save_gardener()
else:
message = (
"You don't have enough Thneed{}. "
"You have {}, but need {}.".format(plural, gardener.points, amount)
message = "You don't have enough Thneed{}. " "You have {}, but need {}.".format(
plural, gardener.points, amount
)
em = discord.Embed(description=message, color=discord.Color.green())
@ -755,9 +739,7 @@ class PlantTycoon(commands.Cog):
degradation = await self._degradation(gardener)
now = int(time.time())
timestamp = gardener.current["timestamp"]
degradation_count = (now - timestamp) // (
self.defaults["timers"]["degradation"] * 60
)
degradation_count = (now - timestamp) // (self.defaults["timers"]["degradation"] * 60)
degradation_count -= gardener.current["degrade_count"]
gardener.current["health"] -= degradation.degradation * degradation_count
gardener.points += self.defaults["points"]["growing"] * degradation_count

Loading…
Cancel
Save