|
|
@ -39,7 +39,7 @@ class Gardener:
|
|
|
|
self.products = await self.config.user(self.user).products()
|
|
|
|
self.products = await self.config.user(self.user).products()
|
|
|
|
self.current = await self.config.user(self.user).current()
|
|
|
|
self.current = await self.config.user(self.user).current()
|
|
|
|
|
|
|
|
|
|
|
|
async def _save_gardener(self):
|
|
|
|
async def save_gardener(self):
|
|
|
|
await self.config.user(self.user).badges.set(self.badges)
|
|
|
|
await self.config.user(self.user).badges.set(self.badges)
|
|
|
|
await self.config.user(self.user).points.set(self.points)
|
|
|
|
await self.config.user(self.user).points.set(self.points)
|
|
|
|
await self.config.user(self.user).products.set(self.products)
|
|
|
|
await self.config.user(self.user).products.set(self.products)
|
|
|
@ -76,8 +76,7 @@ async def _withdraw_points(gardener: Gardener, amount):
|
|
|
|
# Substract points from the gardener
|
|
|
|
# Substract points from the gardener
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
points = gardener.points
|
|
|
|
if (gardener.points - amount) < 0:
|
|
|
|
if (points - amount) < 0:
|
|
|
|
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
gardener.points -= amount
|
|
|
|
gardener.points -= amount
|
|
|
@ -966,7 +965,7 @@ class PlantTycoon(Cog):
|
|
|
|
damage_msg = 'You gave too much of {}.'.format(product)
|
|
|
|
damage_msg = 'You gave too much of {}.'.format(product)
|
|
|
|
message = '{} Your plant lost some health. :wilted_rose:'.format(damage_msg)
|
|
|
|
message = '{} Your plant lost some health. :wilted_rose:'.format(damage_msg)
|
|
|
|
gardener.points += self.defaults['points']['add_health']
|
|
|
|
gardener.points += self.defaults['points']['add_health']
|
|
|
|
await gardener._save_gardener()
|
|
|
|
await gardener.save_gardener()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
message = 'You have no {}. Go buy some!'.format(product)
|
|
|
|
message = 'You have no {}. Go buy some!'.format(product)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -1076,7 +1075,7 @@ class PlantTycoon(Cog):
|
|
|
|
gardener.products['water'] = 0
|
|
|
|
gardener.products['water'] = 0
|
|
|
|
gardener.products['water'] += 5
|
|
|
|
gardener.products['water'] += 5
|
|
|
|
gardener.current = plant
|
|
|
|
gardener.current = plant
|
|
|
|
await gardener._save_gardener()
|
|
|
|
await gardener.save_gardener()
|
|
|
|
|
|
|
|
|
|
|
|
em = discord.Embed(description=message, color=discord.Color.green())
|
|
|
|
em = discord.Embed(description=message, color=discord.Color.green())
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -1230,7 +1229,7 @@ class PlantTycoon(Cog):
|
|
|
|
gardener.products[product.lower()] = 0
|
|
|
|
gardener.products[product.lower()] = 0
|
|
|
|
gardener.products[product.lower()] += amount
|
|
|
|
gardener.products[product.lower()] += amount
|
|
|
|
gardener.products[product.lower()] += amount * self.products[product.lower()]['uses']
|
|
|
|
gardener.products[product.lower()] += amount * self.products[product.lower()]['uses']
|
|
|
|
await gardener._save_gardener()
|
|
|
|
await gardener.save_gardener()
|
|
|
|
message = 'You bought {}.'.format(product.lower())
|
|
|
|
message = 'You bought {}.'.format(product.lower())
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
message = 'You don\'t have enough Thneeds. You have {}, but need {}.'.format(
|
|
|
|
message = 'You don\'t have enough Thneeds. You have {}, but need {}.'.format(
|
|
|
@ -1253,6 +1252,7 @@ class PlantTycoon(Cog):
|
|
|
|
if withdraw_points:
|
|
|
|
if withdraw_points:
|
|
|
|
await bank.deposit_credits(author, amount)
|
|
|
|
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:
|
|
|
|
else:
|
|
|
|
message = 'You don\'t have enough Thneed{}. ' \
|
|
|
|
message = 'You don\'t have enough Thneed{}. ' \
|
|
|
|
'You have {}, but need {}.'.format(plural, gardener.points, amount)
|
|
|
|
'You have {}, but need {}.'.format(plural, gardener.points, amount)
|
|
|
@ -1272,7 +1272,7 @@ class PlantTycoon(Cog):
|
|
|
|
message = 'You sucessfuly shovelled your plant out.'
|
|
|
|
message = 'You sucessfuly shovelled your plant out.'
|
|
|
|
if gardener.points < 0:
|
|
|
|
if gardener.points < 0:
|
|
|
|
gardener.points = 0
|
|
|
|
gardener.points = 0
|
|
|
|
await gardener._save_gardener()
|
|
|
|
await gardener.save_gardener()
|
|
|
|
|
|
|
|
|
|
|
|
em = discord.Embed(description=message, color=discord.Color.dark_grey())
|
|
|
|
em = discord.Embed(description=message, color=discord.Color.dark_grey())
|
|
|
|
await ctx.send(embed=em)
|
|
|
|
await ctx.send(embed=em)
|
|
|
@ -1327,7 +1327,7 @@ class PlantTycoon(Cog):
|
|
|
|
degradation = await self._degradation(gardener)
|
|
|
|
degradation = await self._degradation(gardener)
|
|
|
|
gardener.current['health'] -= degradation.degradation
|
|
|
|
gardener.current['health'] -= degradation.degradation
|
|
|
|
gardener.points += self.defaults['points']['growing']
|
|
|
|
gardener.points += self.defaults['points']['growing']
|
|
|
|
await gardener._save_gardener()
|
|
|
|
await gardener.save_gardener()
|
|
|
|
await asyncio.sleep(self.defaults['timers']['degradation'] * 60)
|
|
|
|
await asyncio.sleep(self.defaults['timers']['degradation'] * 60)
|
|
|
|
|
|
|
|
|
|
|
|
async def check_completion(self):
|
|
|
|
async def check_completion(self):
|
|
|
@ -1356,7 +1356,7 @@ class PlantTycoon(Cog):
|
|
|
|
if message is not None:
|
|
|
|
if message is not None:
|
|
|
|
await user.send(message)
|
|
|
|
await user.send(message)
|
|
|
|
gardener.current = {}
|
|
|
|
gardener.current = {}
|
|
|
|
await gardener._save_gardener()
|
|
|
|
await gardener.save_gardener()
|
|
|
|
await asyncio.sleep(self.defaults['timers']['completion'] * 60)
|
|
|
|
await asyncio.sleep(self.defaults['timers']['completion'] * 60)
|
|
|
|
|
|
|
|
|
|
|
|
async def send_notification(self):
|
|
|
|
async def send_notification(self):
|
|
|
|