diff --git a/.gitignore b/.gitignore index 502b161..9430aa8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,5 +15,4 @@ icy_metadata_radios.md __pycache__/ ssh_update.py ssh_*.py -blue_archive/assets/ blue_archive/ba_students.json diff --git a/blue_archive/assets/Arona_Blue_Gacha_Animation.gif b/blue_archive/assets/Arona_Blue_Gacha_Animation.gif new file mode 100644 index 0000000..9876fe1 Binary files /dev/null and b/blue_archive/assets/Arona_Blue_Gacha_Animation.gif differ diff --git a/blue_archive/constants.py b/blue_archive/constants.py index b5ce8f0..16546d1 100644 --- a/blue_archive/constants.py +++ b/blue_archive/constants.py @@ -9,7 +9,6 @@ BANNER_FILE = Path("data/ba_banner_state.json") ASSETS_DIR = Path(__file__).parent / "assets" BG_PATH = ASSETS_DIR / "gacha_bg.png" GACHA_ANIM_PATH = ASSETS_DIR / "Arona_Blue_Gacha_Animation.gif" -GACHA_ANIM_DURATION = 19.5 # total seconds — 195 frames × 100 ms # ── APIs ──────────────────────────────────────────────────────────────────── BANNER_API = "https://api.ennead.cc/buruaka/banner" diff --git a/blue_archive/gacha.py b/blue_archive/gacha.py index 6c574b8..e8bc717 100644 --- a/blue_archive/gacha.py +++ b/blue_archive/gacha.py @@ -19,7 +19,7 @@ from .data import ( get_rates_for_banner, ) from .gacha_renderer import render_pull -from .constants import SPARK_TARGET, BANNER_FILE, DEFAULT_RATES, PULL10_RATES, GACHA_ANIM_PATH, GACHA_ANIM_DURATION +from .constants import SPARK_TARGET, BANNER_FILE, DEFAULT_RATES, PULL10_RATES, GACHA_ANIM_PATH log = logging.getLogger(__name__) @@ -258,9 +258,11 @@ class BlueArchiveGacha(commands.Cog): banner_name = f"{gtype} — {rateups}" rates = get_rates_for_banner(banner) - # "Opening envelope" teaser — send animation GIF (plays once, auto-deleted by timer) - teaser = await ctx.reply(file=discord.File(str(GACHA_ANIM_PATH))) - anim_start = asyncio.get_running_loop().time() + # "Opening envelope" teaser — animation GIF, or text fallback + if GACHA_ANIM_PATH.exists(): + teaser = await ctx.reply(file=discord.File(str(GACHA_ANIM_PATH))) + else: + teaser = await ctx.reply("Opening recruitment envelope" + ("s..." if count > 1 else "...")) # Build the banner-specific character pool if banner_id and banner_id != "regular" and banner: @@ -312,19 +314,13 @@ class BlueArchiveGacha(commands.Cog): await ctx.reply(f"Render failed: {e}") return - # Wait for the animation to finish playing, then replace with result - elapsed = asyncio.get_running_loop().time() - anim_start - remaining = GACHA_ANIM_DURATION - elapsed - if remaining > 0: - await asyncio.sleep(remaining) - - try: - await teaser.delete() - except (discord.NotFound, discord.Forbidden): - pass - + # Send image with spark+eligma caption try: file = discord.File(img_bytes, filename="gacha_result.png") + try: + await teaser.delete() + except (discord.NotFound, discord.Forbidden): + pass await ctx.reply( f"Recruitment Points: {spark}/{SPARK_TARGET}{dupe_msg}", file=file,