Skip to content

Commit

Permalink
Add owned item quantity to !!iteminfo command (#306)
Browse files Browse the repository at this point in the history

Co-authored-by: Milo Weinberg <[email protected]>
  • Loading branch information
Infernum1 and Iapetus-11 authored Jul 9, 2024
1 parent a746dc0 commit 4934bfb
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
16 changes: 11 additions & 5 deletions bot/cogs/commands/econ.py
Original file line number Diff line number Diff line change
Expand Up @@ -2486,6 +2486,11 @@ async def item_info(self, ctx: Ctx, *, item_name: str):

drop_rate_text = ctx.l.econ.item_bible.drop_rate.not_mineable_or_fishable
trait_text = ""
rarity_text = (
ctx.l.econ.item_bible.rarity.singular
if item_count == 1
else ctx.l.econ.item_bible.rarity.plural.format(amount=item_count)
)

if db_item is not None and db_item.sellable:
trait_text += f"💸 {ctx.l.econ.item_bible.traits.sellable}\n"
Expand Down Expand Up @@ -2533,6 +2538,11 @@ async def item_info(self, ctx: Ctx, *, item_name: str):
f"🛍️ {ctx.l.econ.item_bible.traits.purchaseable.format(prefix=ctx.prefix)}\n"
)

if db_item is not None:
rarity_text += (
f"\n{ctx.l.econ.item_bible.rarity.owned_amount.format(amount=db_item.amount)}"
)

if trait_text:
embed.add_field(name=ctx.l.econ.item_bible.traits.title, value=trait_text)
embed.add_field(name="\ufeff", value="\ufeff")
Expand All @@ -2541,11 +2551,7 @@ async def item_info(self, ctx: Ctx, *, item_name: str):

embed.add_field(
name=ctx.l.econ.item_bible.rarity.title,
value=(
ctx.l.econ.item_bible.rarity.singular
if item_count == 1
else ctx.l.econ.item_bible.rarity.plural.format(amount=item_count)
),
value=rarity_text,
inline=False,
)

Expand Down
4 changes: 3 additions & 1 deletion bot/cogs/core/quests.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ async def quest_completed(
elif quest.reward_item == "Barrel":
await self.db.add_item(user_id, "Barrel", 1024, quest.reward_amount)
else:
raise NotImplementedError(f"Couldn't reward item {quest.reward_item} to user {user_id}")
raise NotImplementedError(
f"Couldn't reward item {quest.reward_item} to user {user_id}"
)

await self.db.update_lb(user_id, "daily_quests", 1)
await self.db.update_lb(user_id, "week_daily_quests", 1)
Expand Down
8 changes: 2 additions & 6 deletions bot/data/text/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2448,11 +2448,6 @@
"You can plant a **Chorus Seed** using the `{prefix}farm plant <amount> Chorus Seed` command to grow `1-2` **Chorus Fruit**."
]
},





"Bone Meal": {
"description": [
"Dropped from killing Skeletons with a chance of `1/20` (affected by looting enchantments). You can use this item with the `{prefix}use Bone Meal` command, which grows all crops by `67%` of the time they take to grow."
Expand Down Expand Up @@ -2532,7 +2527,8 @@
"rarity": {
"title": "Rarity",
"singular": "*`1` person has this item*",
"plural": "*`{amount}` people have this item*"
"plural": "*`{amount}` people have this item*",
"owned_amount": "*You have `{amount}` of this item*"
},
"season": {
"title": "Event / Season",
Expand Down
3 changes: 2 additions & 1 deletion bot/data/text/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,8 @@
"rarity": {
"title": "Rareza",
"singular": "*`1` persona posee este objeto*",
"plural": "*`{amount}` personas poseen este objeto*"
"plural": "*`{amount}` personas poseen este objeto*",
"owned_amount": "*Posees `{amount}` unidades de este objeto*"
},
"season": {
"title": "Evento / Temporada",
Expand Down
3 changes: 2 additions & 1 deletion bot/data/text/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,8 @@
"rarity": {
"title": "Rarity",
"singular": "*`1` personne a cet objet*",
"plural": "*`{amount}` personnes ont cet objet*"
"plural": "*`{amount}` personnes ont cet objet*",
"owned_amount": "*Vous avez `{amount}` exemplaire(s) de cet objet*"
},
"season": {
"title": "Évenement / Saison",
Expand Down
3 changes: 2 additions & 1 deletion bot/data/text/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,8 @@
"rarity": {
"title": "Raridade",
"singular": "*`1` pessoa tem esse item*",
"plural": "*`{amount}` pessoas têm esse item*"
"plural": "*`{amount}` pessoas têm esse item*",
"owned_amount": "*Você tem `{amount}` desse item*"
},
"season": {
"title": "Evento / Temporada",
Expand Down
5 changes: 5 additions & 0 deletions bot/models/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,11 @@ class Econ_ItemBible_Rarity(ImmutableBaseModel):
title: str
singular: str
plural: str
owned_amount: str


class Econ_ItemBible_Owned(ImmutableBaseModel):
text: str


class Econ_ItemBible_Season(ImmutableBaseModel):
Expand Down

0 comments on commit 4934bfb

Please sign in to comment.