|
|
@ -16,7 +16,7 @@ from miyu_bot.commands.common.emoji import rarity_emoji_ids, attribute_emoji_ids |
|
|
|
from miyu_bot.commands.common.event import get_latest_event |
|
|
|
from miyu_bot.commands.common.event import get_latest_event |
|
|
|
from miyu_bot.commands.common.formatting import format_info |
|
|
|
from miyu_bot.commands.common.formatting import format_info |
|
|
|
from miyu_bot.commands.common.master_asset_manager import hash_master |
|
|
|
from miyu_bot.commands.common.master_asset_manager import hash_master |
|
|
|
from miyu_bot.commands.common.name_aliases import characters_by_name, attributes_by_name, units_by_name |
|
|
|
from miyu_bot.commands.common.name_aliases import characters_by_name, attributes_by_name, units_by_name, unit_aliases |
|
|
|
from miyu_bot.commands.common.reaction_message import run_tabbed_message, run_reaction_message, run_paged_message |
|
|
|
from miyu_bot.commands.common.reaction_message import run_tabbed_message, run_reaction_message, run_paged_message |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -123,10 +123,11 @@ class Card(commands.Cog): |
|
|
|
# Not used, but here because it's a valid argument before running require_all_arguments_used. |
|
|
|
# Not used, but here because it's a valid argument before running require_all_arguments_used. |
|
|
|
display, _ = arguments.single(['display', 'disp'], sort, allowed_operators=['='], |
|
|
|
display, _ = arguments.single(['display', 'disp'], sort, allowed_operators=['='], |
|
|
|
converter=card_attribute_aliases) |
|
|
|
converter=card_attribute_aliases) |
|
|
|
character = {characters_by_name[c].id for c in arguments.words(characters_by_name.keys())} |
|
|
|
characters = {characters_by_name[c].id for c in arguments.words(characters_by_name.keys())} |
|
|
|
unit = {units_by_name[a].id for a in arguments.words(units_by_name.keys())} |
|
|
|
units = {units_by_name[unit].id |
|
|
|
rarity = {int(r[0]) for r in arguments.words(['4*', '3*', '2*', '1*', r'4\*', r'3\*', r'2\*', r'1\*'])} |
|
|
|
for unit in arguments.tags(names=units_by_name.keys(), aliases=unit_aliases)} |
|
|
|
attribute = {attributes_by_name[a].id for a in arguments.words(attributes_by_name.keys())} |
|
|
|
rarities = {int(r[0]) for r in arguments.words(['4*', '3*', '2*', '1*', r'4\*', r'3\*', r'2\*', r'1\*'])} |
|
|
|
|
|
|
|
attributes = {attributes_by_name[a].id for a in arguments.words(attributes_by_name.keys())} |
|
|
|
|
|
|
|
|
|
|
|
event_bonus = bool(arguments.tags(['event', 'eventbonus', 'event_bonus'])) |
|
|
|
event_bonus = bool(arguments.tags(['event', 'eventbonus', 'event_bonus'])) |
|
|
|
|
|
|
|
|
|
|
@ -134,13 +135,13 @@ class Card(commands.Cog): |
|
|
|
latest_event = get_latest_event(ctx) |
|
|
|
latest_event = get_latest_event(ctx) |
|
|
|
bonus: EventSpecificBonusMaster = latest_event.bonus |
|
|
|
bonus: EventSpecificBonusMaster = latest_event.bonus |
|
|
|
|
|
|
|
|
|
|
|
if not character: |
|
|
|
if not characters: |
|
|
|
character.update(bonus.character_ids) |
|
|
|
characters.update(bonus.character_ids) |
|
|
|
elif bonus.character_ids: |
|
|
|
elif bonus.character_ids: |
|
|
|
character = {char for char in character if char in bonus.character_ids} |
|
|
|
characters = {char for char in characters if char in bonus.character_ids} |
|
|
|
|
|
|
|
|
|
|
|
if bonus.attribute_id: |
|
|
|
if bonus.attribute_id: |
|
|
|
attribute = {bonus.attribute_id} |
|
|
|
attributes = {bonus.attribute_id} |
|
|
|
|
|
|
|
|
|
|
|
if not arguments.has_named('sort'): |
|
|
|
if not arguments.has_named('sort'): |
|
|
|
sort = CardAttribute.Date |
|
|
|
sort = CardAttribute.Date |
|
|
@ -155,14 +156,14 @@ class Card(commands.Cog): |
|
|
|
cards = cards[::-1] |
|
|
|
cards = cards[::-1] |
|
|
|
if reverse_sort: |
|
|
|
if reverse_sort: |
|
|
|
cards = cards[::-1] |
|
|
|
cards = cards[::-1] |
|
|
|
if character: |
|
|
|
if characters: |
|
|
|
cards = [card for card in cards if card.character.id in character] |
|
|
|
cards = [card for card in cards if card.character.id in characters] |
|
|
|
if unit: |
|
|
|
if units: |
|
|
|
cards = [card for card in cards if card.character.unit.id in unit] |
|
|
|
cards = [card for card in cards if card.character.unit.id in units] |
|
|
|
if rarity: |
|
|
|
if rarities: |
|
|
|
cards = [card for card in cards if card.rarity_id in rarity] |
|
|
|
cards = [card for card in cards if card.rarity_id in rarities] |
|
|
|
if attribute: |
|
|
|
if attributes: |
|
|
|
cards = [card for card in cards if card.attribute.id in attribute] |
|
|
|
cards = [card for card in cards if card.attribute.id in attributes] |
|
|
|
|
|
|
|
|
|
|
|
return cards |
|
|
|
return cards |
|
|
|
|
|
|
|
|
|
|
|