Skip to content

Commit

Permalink
Fix loot names (#445)
Browse files Browse the repository at this point in the history
* Fix display of loot names in output
prevent inclusion of Rarities.pet in autocomplete responses. It's not a valid rarity anywhere except the pet forage stuff.

* Bump micro
  • Loading branch information
TrustyJAID authored Jul 2, 2023
1 parent 6f7f03b commit 4f50475
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion adventure/adventure.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def red_delete_data_for_user(
user_id
).clear() # This will only ever touch the separate currency, leaving bot economy to be handled by core.

__version__ = "4.0.2"
__version__ = "4.0.3"

def __init__(self, bot: Red):
self.bot = bot
Expand Down
5 changes: 3 additions & 2 deletions adventure/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Rarities(Enum):
pet = 64

def __str__(self):
return self.name.title()
return self.names()[self]

@classmethod
def get_from_name(cls, name: str) -> Rarities:
Expand All @@ -150,6 +150,7 @@ def names():
Rarities.set: _("Set"),
Rarities.forged: _("Forged"),
Rarities.event: _("Event"),
Rarities.pet: _("Pet"),
}

def prefix_chance(self) -> Optional[float]:
Expand All @@ -169,7 +170,7 @@ def suffix_chance(self) -> Optional[float]:
}.get(self)

def get_name(self) -> str:
return self.names().get(self.name, _("Normal"))
return self.names().get(self, _("Normal"))

@property
def ansi(self) -> str:
Expand Down
2 changes: 2 additions & 0 deletions adventure/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ async def autocomplete(self, interaction: discord.Interaction, current: str) ->
# cog = interaction.client.get_cog("Adventure")
log.debug(interaction.command)
for rarity in Rarities:
if rarity is Rarities.pet:
continue
if interaction.command and interaction.command.name in ["loot", "convert"] and not rarity.is_chest:
continue
if current.lower() in rarity.get_name().lower():
Expand Down

0 comments on commit 4f50475

Please sign in to comment.