From 33da1d3db70370335d36c3d5e99036cd9b6d9f17 Mon Sep 17 00:00:00 2001 From: seria Date: Mon, 3 Feb 2025 15:38:54 +0900 Subject: [PATCH] fix: Fix ZZZ bangboo channel adds to polychrome count --- hoyo_buddy/ui/hoyo/gacha/view.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hoyo_buddy/ui/hoyo/gacha/view.py b/hoyo_buddy/ui/hoyo/gacha/view.py index 5a4a8e52..f872479a 100644 --- a/hoyo_buddy/ui/hoyo/gacha/view.py +++ b/hoyo_buddy/ui/hoyo/gacha/view.py @@ -170,6 +170,9 @@ async def get_stats_embed(self, pool: asyncpg.Pool) -> DefaultEmbed: if lifetime_pulls == 0: raise NoGachaLogFoundError + bangboo_channel_pulls = await self.get_pulls_count(banner_type=5) + lifetime_currency = (lifetime_pulls - bangboo_channel_pulls) * 160 + # Five star pity last_five_star_num = await get_last_gacha_num( self.account, banner=self.banner_type, rarity=5 @@ -191,6 +194,11 @@ async def get_stats_embed(self, pool: asyncpg.Pool) -> DefaultEmbed: total_five_stars = await self.get_pulls_count(rarity=5, banner_type=self.banner_type) total_four_stars = await self.get_pulls_count(rarity=4, banner_type=self.banner_type) banner_total_pulls = await self.get_pulls_count(banner_type=self.banner_type) + + # Bangboo channel pulls are free + is_bangboo_channel = self.banner_type == 5 and self.account.game == Game.ZZZ + banner_total_currency = 0 if is_bangboo_channel else banner_total_pulls * 160 + five_star_avg_pulls = banner_total_pulls / total_five_stars if total_five_stars else 0 four_star_avg_pulls = banner_total_pulls / total_four_stars if total_four_stars else 0 @@ -216,10 +224,10 @@ async def get_stats_embed(self, pool: asyncpg.Pool) -> DefaultEmbed: personal_stats = LocaleStr( key="gacha_log_personal_stats", lifetime_pulls=lifetime_pulls, - lifetime_currency=f"{lifetime_pulls * 160:,}", + lifetime_currency=f"{lifetime_currency:,}", currency_emoji=CURRENCY_EMOJIS[self.account.game], total_pulls=banner_total_pulls, - total_currency=f"{banner_total_pulls * 160:,}", + total_currency=f"{banner_total_currency:,}", star5_pity_cur=current_five_star_pity, star5_pity_max=max_five_star_pity, star4_pity_cur=current_four_star_pity,