fix: apply open-packs hotfix to cogs/economy.py

Port the Check-In Player pack fix from the hotfix branch to the legacy
economy.py cog (which production currently loads instead of economy_new).

- Filter auto-open pack types from the manual open-packs menu
- Add pretty_name fallback for hyphenated pack type names
- Add ruff noqa for pre-existing star import warnings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-03-26 13:04:19 -05:00
parent fca85d583f
commit 94f3b1dc97

View File

@ -1,3 +1,4 @@
# ruff: noqa: F403, F405
import copy import copy
import helpers import helpers
@ -695,6 +696,9 @@ class Economy(commands.Cog):
) )
return return
# Pack types that are auto-opened and should not appear in the manual open menu
AUTO_OPEN_TYPES = {"Check-In Player"}
# Group packs by type and customization (e.g. Standard, Standard-Orioles, Standard-2012, Premium) # Group packs by type and customization (e.g. Standard, Standard-Orioles, Standard-2012, Premium)
p_count = 0 p_count = 0
p_data = { p_data = {
@ -711,6 +715,11 @@ class Economy(commands.Cog):
p_group = None p_group = None
logger.debug(f"pack: {pack}") logger.debug(f"pack: {pack}")
logger.debug(f"pack cardset: {pack['pack_cardset']}") logger.debug(f"pack cardset: {pack['pack_cardset']}")
if pack["pack_type"]["name"] in AUTO_OPEN_TYPES:
logger.debug(
f"Skipping auto-open pack type: {pack['pack_type']['name']}"
)
continue
if pack["pack_team"] is None and pack["pack_cardset"] is None: if pack["pack_team"] is None and pack["pack_cardset"] is None:
p_group = pack["pack_type"]["name"] p_group = pack["pack_type"]["name"]
# Add to p_data if this is a new pack type # Add to p_data if this is a new pack type
@ -773,6 +782,9 @@ class Economy(commands.Cog):
pretty_name = f"{key.split('-')[0]} - {key.split('-')[3]}" pretty_name = f"{key.split('-')[0]} - {key.split('-')[3]}"
elif "Cardset" in key: elif "Cardset" in key:
pretty_name = f"{key.split('-')[0]} - {key.split('-')[3]}" pretty_name = f"{key.split('-')[0]} - {key.split('-')[3]}"
else:
# Pack type name contains a hyphen (e.g. "Check-In Player")
pretty_name = key
if pretty_name is not None: if pretty_name is not None:
embed.add_field(name=pretty_name, value=f"Qty: {len(p_data[key])}") embed.add_field(name=pretty_name, value=f"Qty: {len(p_data[key])}")