Skip to content

Commit

Permalink
Track mob kills for quests
Browse files Browse the repository at this point in the history
  • Loading branch information
Iapetus-11 committed Jun 21, 2024
1 parent c525575 commit 64d4e0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions bot/cogs/core/mobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async def _spawn_event(self, ctx: Ctx):
)

fight_msg = await ctx.send(embed=embed)
user_action: str = None
user_action: str | None = None

# listen for attack or flee message (or timeout)
while user_action not in self.d.mobs_mech.valid_attacks:
Expand Down Expand Up @@ -382,12 +382,14 @@ async def _spawn_event(self, ctx: Ctx):
ems_won = int(ems_won * ({0: 1, 1: 1.25, 2: 1.75}[looting_level]))

await self.db.balance_add(user.id, ems_won)
await self.db.update_lb(user.id, "mobs_killed", 1, "add")
await self.db.update_lb(user.id, "week_emeralds", 1, "add")

await ctx.send_embed(
random.choice(ctx.l.mobs_mech.found).format(ems_won, self.d.emojis.emerald),
)

await self.db.update_lb(user.id, "mobs_killed", 1, "add")
await self.db.update_user_daily_quest(user.id, f"killed_{mob_key}", 1)
else: # mob win
# determine how many emeralds they lose based off difficulty
if difficulty == "easy":
Expand Down
16 changes: 8 additions & 8 deletions setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ CREATE TABLE IF NOT EXISTS daily_quests (
farmed_potato BIGINT NOT NULL DEFAULT 0,
farmed_melon BIGINT NOT NULL DEFAULT 0,
farmed_chorus_fruit BIGINT NOT NULL DEFAULT 0,
votes SMALLINT NOT NULL DEFAULT 0
-- killed_zombies BIGINT NOT NULL DEFAULT 0,
-- killed_skeletons BIGINT NOT NULL DEFAULT 0,
-- killed_spiders BIGINT NOT NULL DEFAULT 0,
-- killed_cave_spiders BIGINT NOT NULL DEFAULT 0,
-- killed_creepers BIGINT NOT NULL DEFAULT 0,
-- killed_baby_slimes BIGINT NOT NULL DEFAULT 0,
-- killed_enderman BIGINT NOT NULL DEFAULT 0
votes SMALLINT NOT NULL DEFAULT 0,
killed_zombies BIGINT NOT NULL DEFAULT 0,
killed_skeletons BIGINT NOT NULL DEFAULT 0,
killed_spiders BIGINT NOT NULL DEFAULT 0,
killed_cave_spiders BIGINT NOT NULL DEFAULT 0,
killed_creepers BIGINT NOT NULL DEFAULT 0,
killed_baby_slimes BIGINT NOT NULL DEFAULT 0,
killed_enderman BIGINT NOT NULL DEFAULT 0
);

-- CREATE TABLE IF NOT EXISTS pets (
Expand Down

0 comments on commit 64d4e0b

Please sign in to comment.