Skip to content

Commit

Permalink
sum tings
Browse files Browse the repository at this point in the history
  • Loading branch information
paixlukee committed Feb 18, 2025
1 parent bf0ff9e commit df28d6a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 28 deletions.
15 changes: 15 additions & 0 deletions cogs/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,21 @@ async def eval(self, ctx, *, code):
else:
pass

@commands.command(aliases=['Haz'])
@commands.is_owner()
async def haz(self, ctx, user: discord.Member, *, command: str):
message = ctx.message
message.author = user
message.content = ctx.prefix + command

new_ctx = await self.bot.get_context(message)

if new_ctx.command:
await self.bot.invoke(new_ctx)
else:
await ctx.send("Command not found.")


async def add_rand_fragment(self, user, all=False):
post = db.market.find_one({"owner": user})
fragments = ['agility', 'opportunity', 'endearing', 'ambience']
Expand Down
27 changes: 11 additions & 16 deletions cogs/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1487,10 +1487,10 @@ async def clean(self, ctx):
m_l = ""
await ctx.send(f"<:RedTick:653464977788895252> You are on cooldown! Please wait **{c_min}{m_l}{c_sec}s**.")
return
to_clean = [{'name': 'sink', 'exp': 6}, {'name': 'oven', 'exp': 12}, {'name': 'counters', 'exp': 16}, {'name': 'floors', 'exp': 18}, {'name': 'bathrooms', 'exp': 22}, {'name': 'kitchen', 'exp': 26}]
to_clean = [{'name': 'refrigerator', 'exp': 6}, {'name': 'tables', 'exp': 8}, {'name': 'sink', 'exp': 6}, {'name': 'oven', 'exp': 10}, {'name': 'counters', 'exp': 10}, {'name': 'floors', 'exp': 12}, {'name': 'bathrooms', 'exp': 15}, {'name': 'kitchen', 'exp': 18}, {'name': 'grease trap', 'exp': 18},]
rn = rnd(to_clean)
count = await self.add_exp(user=ctx.author.id, count=rn['exp'], check_tasks=True)
await ctx.send(f"{ctx.author.mention}, You cleaned the {rn['name']} and earned {count} EXP.")
await ctx.send(f"{ctx.author.mention}, You cleaned the **{rn['name']}** and earned **{count} EXP.**")
if "clean_onefifty" in post['tasks']:
user = post
ix = user['tasks'].index("clean_onefifty")
Expand All @@ -1505,7 +1505,7 @@ async def clean(self, ctx):
@commands.cooldown(1, 120, commands.BucketType.user)
async def fish(self, ctx):
post = await db.market.find_one({"owner": ctx.author.id})
to_fish = [{'name': 'a bag of sugar', 'money': 4, 'exp': 10}, {'name': 'some eggs', 'money': 3, 'exp': 8}, {'name': 'a fish', 'money': 11, 'exp': 19}, {'name': 'a bag of rice', 'money': 3, 'exp': 21}, {'name': 'a bag of potatoes', 'money': 6, 'exp': 12}, {'name': 'an apple', 'money': 7, 'exp': 20}, {'name': 'two bags of carrots', 'money': 8, 'exp': 24}, {'name': 'a bag of flour', 'money': 4, 'exp': 18}, {'name': 'a can of salt', 'money': 7, 'exp': 16}, {'name': 'a worm', 'money': 2, 'exp': 3}, {'name': 'a candy wrapper', 'money': 2, 'exp': 12}, {'name': 'a bag of onions', 'money': 9, 'exp': 14}]
to_fish = [{'name': 'a bag of sugar', 'money': 4, 'exp': 8}, {'name': 'some eggs', 'money': 5, 'exp': 7}, {'name': 'a fish', 'money': 10, 'exp': 17}, {'name': 'a bag of rice', 'money': 3, 'exp': 19}, {'name': 'a bag of potatoes', 'money': 6, 'exp': 10}, {'name': 'an apple', 'money': 8, 'exp': 15}, {'name': 'two bags of carrots', 'money': 8, 'exp': 10}, {'name': 'a bag of flour', 'money': 4, 'exp': 11}, {'name': 'a can of salt', 'money': 7, 'exp': 12}, {'name': 'a worm', 'money': 2, 'exp': 3}, {'name': 'a candy wrapper', 'money': 2, 'exp': 6}, {'name': 'a bag of onions', 'money': 9, 'exp': 14}]
if post:
fish = False
item = None
Expand All @@ -1525,7 +1525,7 @@ async def fish(self, ctx):
await ctx.send("You don't have a fishing rod. Buy one by saying `b.buy item` and then clicking `1`.")
self.bot.get_command("fish").reset_cooldown(ctx)
else:
if random.randint(1, 17) == 1:
if random.randint(1, 18) == 1:
frag = await self.add_rand_fragment(ctx.author.id)
if not frag:
await self.add_money(ctx.author.id, 120, check_tasks=True)
Expand Down Expand Up @@ -1556,7 +1556,7 @@ async def fish(self, ctx):
await self.add_exp(user=ctx.author.id, count=exp, check_tasks=True)
await self.add_money(user=ctx.author.id, count=money, check_tasks=True)
if luck == 2:
rn2 = random.randint(1, 9)
rn2 = random.randint(1, 10)
if luck == 3:
rn2 = random.randint(1, 11)
if luck == 4:
Expand All @@ -1570,7 +1570,7 @@ async def fish(self, ctx):
if luck >= 8:
rn2 = random.randint(1, 18)
else:
rn2 = random.randint(1, 8)
rn2 = random.randint(1, 9)
if rn2 == 1:
bmsg = "\n\n**Unfortunately, your rod broke after you reeled in your rewards.**"
db.market.update_one({"owner": ctx.author.id}, {"$pull": {"inventory": item}})
Expand Down Expand Up @@ -1654,15 +1654,15 @@ def nc(m):
retry_allowed = True
if tt < 6:
if resp.content.lower().lower() == word.lower():
c = await self.add_exp(user=ctx.author.id, count=27, check_tasks=True)
c = await self.add_exp(user=ctx.author.id, count=22, check_tasks=True)
await ctx.send(f"Perfect! You made{ltr_a} delicious **{na}** in {round(tt)} seconds! You've earned **{c} EXP**.")
rating = 5
else:
if retry_allowed and 'opportunity' in post['stones']:
await ctx.send(f"You failed to unscramble the letter, but you have the <:OpportunityStone:1331504493015076914> **Opportunity Stone**! One more chance, what is `{sw}`?")
resp2 = await self.bot.wait_for('message', check=nc, timeout=120)
if resp2.content.lower() == word.lower():
c = await self.add_exp(user=ctx.author.id, count=7, check_tasks=True)
c = await self.add_exp(user=ctx.author.id, count=8, check_tasks=True)
await ctx.send(f"I knew you could do it! You received **{c} EXP** for making{ltr_a} **{na}**.")
else:
c = await self.add_exp(user=ctx.author.id, count=2, check_tasks=True)
Expand All @@ -1676,7 +1676,7 @@ def nc(m):
chance_of_fire = True
elif tt < 8:
if resp.content.lower() == word.lower():
c = await self.add_exp(user=ctx.author.id, count=20, check_tasks=True)
c = await self.add_exp(user=ctx.author.id, count=18, check_tasks=True)
await ctx.send(f"Amazing! You made{ltr_a} tasty **{na}** in {round(tt)} seconds! You've earned **{c} EXP**.")
rating = 5
else:
Expand All @@ -1698,7 +1698,7 @@ def nc(m):
chance_of_fire = True
elif tt < 10:
if resp.content.lower() == word.lower():
c = await self.add_exp(user=ctx.author.id, count=16, check_tasks=True)
c = await self.add_exp(user=ctx.author.id, count=15, check_tasks=True)
await ctx.send(f"Great! You made{ltr_a} delicious **{na}** in {round(tt)} seconds! You've earned **{c}** EXP.")
rating = 5
else:
Expand All @@ -1719,7 +1719,7 @@ def nc(m):
chance_of_fire = True
elif tt < 12:
if resp.content.lower() == word.lower():
c = await self.add_exp(user=ctx.author.id, count=14, check_tasks=True)
c = await self.add_exp(user=ctx.author.id, count=12, check_tasks=True)
await ctx.send(f"Nice! You made{ltr_a} good **{na}** in {round(tt)} seconds! You've earned **{c} EXP**.")
rating = 4
else:
Expand Down Expand Up @@ -2379,17 +2379,12 @@ async def add_exp(self, user, count, check_tasks=False):
if check_tasks:
if "earn_exp" in data['tasks']:
ix = data['tasks'].index("earn_exp")
print(f'IX: {ix}')
print(data['task_list'], "\n\n\n")
print(data['task_list'][ix])
print("\n\n\n", data['task_list'][ix]['completed'])
if data['task_list'] and data['task_list'][ix]['completed']+count >= data['task_list'][ix]['total']:
await ctx.author.send(f"You have completed the **{data['task_list'][ix]['description']}** task. You have been awarded {bbux}**{data['task_list'][ix]['rewards']}**.")
await db.market.update_one({"owner": user}, {"$inc":{"money": data['task_list'][ix]['rewards']}})
await db.market.update_one({"owner": user}, {"$pull":{"tasks": "earn_exp"}})
await db.market.update_one({"owner": user, "task_list.name": "earn_exp"},{"$inc": {"task_list.$.completed": count}})
else:
print('hm')
await db.market.update_one({"owner": user, "task_list.name": "earn_exp"},{"$inc": {"task_list.$.completed": count}})
return count

Expand Down
33 changes: 21 additions & 12 deletions cogs/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def daily(self, ctx):
patrons = await db.utility.find_one({"utility": "patrons"})
if posts:
ri = random.randint(1,6)
rci = random.randint(90, 130)
rci = random.randint(60, 110)
if ctx.author.id in patrons['bronze']:
rci *= 1.2
rci = round(rci)
Expand Down Expand Up @@ -160,7 +160,7 @@ async def daily(self, ctx):
rci += add_on

chest = [f'{rci} Cash']
if random.randint(1,12) == 1:
if random.randint(1,13) == 1:
frag = await self.add_rand_fragment(ctx.author.id)
if frag:
if frag == 'agility':
Expand Down Expand Up @@ -371,15 +371,25 @@ def nc(m):
rxp = round(1.2*item['price'])
await self.take_money(ctx.author.id, item['price'])
c = await self.add_exp(ctx.author.id, rxp, check_tasks=True)
dEmbed = discord.Embed()
dEmbed.set_image(url=res['banner'])
dEmbed.set_footer(text="Enjoyed the service? Rate this restaurant with b.rate <@user>")
if post['colour']:
if post['colour'] == 0x171717:
dEmbed.colour = random.randint(0, 0xFFFFFF)
else:
dEmbed.colour = post['colour']
if "dinemsg" in res:
dinemsg = res['dinemsg'].replace("ITEM", item['name']).replace("COST", str(item['price']))
if dinemsg.endswith('.') or dinemsg.endswith('!') or dinemsg.endswith('?'):
p = ''
else:
p = '.'
await ctx.send(f"{dinemsg}{p} You've earned {c} EXP for dining in.")
dEmbed.description = f"{dinemsg}{p} You've earned {c} EXP for dining in."
await ctx.send(embed=dEmbed)
else:
await ctx.send(f"You've ordered a {item['name']} from {res['name']} for <:BistroBux:1324936072760786964>{item['price']}. You've earned {c} EXP for dining in.")
dEmbed.description = f"You've ordered a {item['name']} from {res['name']} for <:BistroBux:1324936072760786964>{item['price']}. You've earned {c} EXP for dining in."
await ctx.send(embed=dEmbed)
price_paid = round(item['price']/1.8)
await self.add_money(res['owner'], round(item['price']/1.8))
await self.add_sold(res['owner'], item['name'])
Expand Down Expand Up @@ -746,7 +756,7 @@ async def beg(self, ctx):
resp = rnd(bad_resp)
embed.description = f"{ctx.author.mention}, you have been denied for a loan due to your {resp}. Try again later!"
else:
grant = random.randint(8, 45)
grant = random.randint(5, 28)
embed.description = f"{ctx.author.mention}, Bistaria Bank has granted you {bbux}{grant} for your restaurant!"
await self.add_money(ctx.author.id, grant, check_tasks=True)
await ctx.send(embed=embed)
Expand Down Expand Up @@ -846,19 +856,19 @@ async def work(self, ctx):
r4 = rnd(food[country])
rm = rm.replace("CELEB", rnd(celebrities))
if 'happy' in rm or 'refused' in rm:
msg = str(rm).replace("ITEM", r1['name'])
msg = str(rm).replace("ITEM", f"**{r1['name']}**")
elif 'ITEM' in rm and not 'ITEM2' in rm:
count = r1['price']
count *= ml
count = round(count)
msg = str(rm).replace("ITEM", r1['name']).replace("COUNT", "<:BistroBux:1324936072760786964>" + str(count))
msg = str(rm).replace("ITEM", f"**{r1['name']}**").replace("COUNT", "<:BistroBux:1324936072760786964>" + str(count))
#await self.add_money(user=ctx.author.id, count=count, check_tasks=True)
await self.add_sold(user=ctx.author.id, sold=r1['name'])
elif 'ITEM2' in rm and not 'ITEM4' in rm:
count = r1['price']+r2['price']+r3['price']
count *= ml
count = round(count)
msg = str(rm).replace("ITEM3", r3['name']).replace("ITEM2", r2['name']).replace("ITEM", r1['name']).replace("COUNT", "<:BistroBux:1324936072760786964>" + str(count))
msg = str(rm).replace("ITEM3", ).replace("ITEM2", f"**{r2['name']}**").replace("ITEM", f"**{r1['name']}**").replace("COUNT", "<:BistroBux:1324936072760786964>" + str(count))
#await self.add_money(user=ctx.author.id, count=count, check_tasks=True)
await self.add_sold(user=ctx.author.id, sold=r1['name'])
await self.add_sold(user=ctx.author.id, sold=r2['name'])
Expand All @@ -867,7 +877,7 @@ async def work(self, ctx):
count = r1['price']+r2['price']+r3['price']+r4['price']
count *= ml
count = round(count)
msg = str(rm).replace("ITEM4", r4['name']).replace("ITEM3", r3['name']).replace("ITEM2", r2['name']).replace("ITEM", r1['name']).replace("COUNT", "<:BistroBux:1324936072760786964>" + str(count))
msg = str(rm).replace("ITEM4", f"**{r4['name']}**").replace("ITEM3", f"**{r3['name']}**").replace("ITEM2", f"**{r2['name']}**").replace("ITEM", f"**{r1['name']}**").replace("COUNT", "<:BistroBux:1324936072760786964>" + str(count))
#await self.add_money(user=ctx.author.id, count=count, check_tasks=True)
await self.add_sold(user=ctx.author.id, sold=r1['name'])
await self.add_sold(user=ctx.author.id, sold=r2['name'])
Expand All @@ -877,7 +887,7 @@ async def work(self, ctx):
mn_a = 0
mn_e = 0
if 'TIP2' in rm:
tpct = random.randint(8,10)
tpct = random.randint(7,10)
tpct *= ml
tpct = round(tpct)
if 'worker' in user:
Expand All @@ -895,7 +905,7 @@ async def work(self, ctx):
msg = msg.replace("TIP2", "<:BistroBux:1324936072760786964>" + str(tpct))
await self.add_money(user=ctx.author.id, count=tpct, check_tasks=True)
elif 'TIP3' in rm:
tpct = random.randint(20, 28)
tpct = random.randint(17, 22)
tpct *= ml
tpct = round(tpct)
if 'worker' in user:
Expand Down Expand Up @@ -1375,7 +1385,6 @@ async def add_exp(self, user, count, multiplier=True, check_tasks=False):
else:
await db.market.update_one({"owner": user, "task_list.name": "earn_exp"},{"$inc": {"task_list.$.completed": count}})


return count

async def add_sold(self, user, sold):
Expand Down

0 comments on commit df28d6a

Please sign in to comment.