From c89804002b321a46b51aa4eb6878a0a58fb14897 Mon Sep 17 00:00:00 2001 From: Lanly109 <1094916227@qq.com> Date: Sat, 31 Aug 2024 03:38:28 +0800 Subject: [PATCH 1/5] fix: gacha prize name --- autopcr/core/pcrclient.py | 4 ++-- autopcr/db/database.py | 20 +++++++++++++++++++- autopcr/module/modules/gacha.py | 4 ++-- autopcr/module/modules/tools.py | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/autopcr/core/pcrclient.py b/autopcr/core/pcrclient.py index ed3cdbdf..77a5f7f9 100644 --- a/autopcr/core/pcrclient.py +++ b/autopcr/core/pcrclient.py @@ -660,14 +660,14 @@ async def receive_all(self): req.type = 1 await self.request(req) - async def serlize_gacha_reward(self, gacha: GachaReward): + async def serlize_gacha_reward(self, gacha: GachaReward, gacha_id: int = 0): res = "" if gacha.new_unit: res += f"NEW: \n" + '\n'.join([db.get_inventory_name(item) for item in gacha.new_unit]) + '\n' if gacha.unit_rarity: res += ' '.join(["★"*i + f"x{cnt}" for i, cnt in gacha.unit_rarity.items()]) + '\n' if gacha.prize_rarity: - res += ' '.join([f"{i}等" + f"x{cnt}" for i, cnt in gacha.prize_rarity.items()]) + '\n' + res += ' '.join([f"{db.get_gacha_prize_name(gacha_id, i)}" + f"x{cnt}" for i, cnt in gacha.prize_rarity.items()]) + '\n' res += await self.serlize_reward(gacha.reward_list) diff --git a/autopcr/db/database.py b/autopcr/db/database.py index 53212868..8640e7f6 100644 --- a/autopcr/db/database.py +++ b/autopcr/db/database.py @@ -529,7 +529,18 @@ def update(self, dbmgr: dbmgr): PrizegachaDatum.query(db) .to_dict(lambda x: x.prizegacha_id, lambda x: x) ) - + + self.prizegacha_sp_data: Dict[int, Dict[int, PrizegachaSpDatum]] = ( + PrizegachaSpDatum.query(db) + .group_by(lambda x: x.gacha_id) + .to_dict(lambda x: x.key, lambda x: x.to_dict(lambda x: x.rarity, lambda x: x)) + ) + + self.prizegacha_sp_detail: Dict[int, PrizegachaSpDetail] = ( + PrizegachaSpDetail.query(db) + .to_dict(lambda x: x.disp_rarity, lambda x: x) + ) + self.campaign_gacha: Dict[int, CampaignFreegacha] = ( CampaignFreegacha.query(db) .to_dict(lambda x: x.campaign_id, lambda x: x) @@ -968,4 +979,11 @@ def last_normal_quest_candidate(self): .select(lambda x: f"{x.quest_id}: {x.quest_name.split(' ')[1]}") \ .to_list() + def get_gacha_prize_name(self, gacha_id: int, prize_rarity: int) -> str: + if gacha_id in self.prizegacha_sp_data: + prize_rarity = self.prizegacha_sp_data[gacha_id][prize_rarity].disp_rarity + if prize_rarity in self.prizegacha_sp_detail: + return self.prizegacha_sp_detail[prize_rarity].name + return f"{prize_rarity}等奖" + db = database() diff --git a/autopcr/module/modules/gacha.py b/autopcr/module/modules/gacha.py index 523eba81..f398d3fd 100644 --- a/autopcr/module/modules/gacha.py +++ b/autopcr/module/modules/gacha.py @@ -58,7 +58,7 @@ async def do_task(self, client: pcrclient): self._log("使用十连") gacha_reward += await client.exec_gacha_aware(gacha, 10, eGachaDrawType.Monthly_Free_Multi, 1, 0) - reward = await client.serlize_gacha_reward(gacha_reward) + reward = await client.serlize_gacha_reward(gacha_reward, gacha.id) if reward != "无": self._log(reward) point = client.data.gacha_point[gacha.exchange_id].current_point if gacha.exchange_id in client.data.gacha_point else 0 @@ -115,4 +115,4 @@ async def do_task(self, client: pcrclient): gacha_reward += await client.exec_gacha_aware(target_gacha, 10, eGachaDrawType.Campaign10Shot, cnt, res.campaign_info.campaign_id) cnt -= 1 - self._log(await client.serlize_gacha_reward(gacha_reward)) + self._log(await client.serlize_gacha_reward(gacha_reward, target_gacha.id)) diff --git a/autopcr/module/modules/tools.py b/autopcr/module/modules/tools.py index e2377f3d..6cc96a6f 100644 --- a/autopcr/module/modules/tools.py +++ b/autopcr/module/modules/tools.py @@ -136,7 +136,7 @@ async def do_task(self, client: pcrclient): raise finally: self._log(f"抽取了{cnt}次{'十连' if not single_ticket else '单抽'}") - self._log(await client.serlize_gacha_reward(reward)) + self._log(await client.serlize_gacha_reward(reward, target_gacha.id)) point = client.data.gacha_point[target_gacha.exchange_id].current_point if target_gacha.exchange_id in client.data.gacha_point else 0 self._log(f"当前pt为{point}") From 80cf9902fffe7e13050ce03b4d141dd9d47840f9 Mon Sep 17 00:00:00 2001 From: Lanly109 <1094916227@qq.com> Date: Sat, 31 Aug 2024 23:44:26 +0800 Subject: [PATCH 2/5] fix: update description --- autopcr/module/modules/autosweep.py | 8 ++++---- autopcr/module/modules/tools.py | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/autopcr/module/modules/autosweep.py b/autopcr/module/modules/autosweep.py index d3ba8d17..faf2bb85 100644 --- a/autopcr/module/modules/autosweep.py +++ b/autopcr/module/modules/autosweep.py @@ -356,8 +356,8 @@ async def get_start_quest(self, client: pcrclient) -> List[Tuple[int, int]]: if is_start_run_time: self._log(f"刷取start关卡") for tab in client.data.user_my_quest: - for x in tab.skip_list: - if tab.tab_name == 'start': + if tab.tab_name == 'start': + for x in tab.skip_list: quest.append((x, tab.skip_count)) return quest @@ -367,8 +367,8 @@ async def get_loop_quest(self, client: pcrclient) -> List[Tuple[int, int]]: if is_loop_run_time: self._log(f"刷取loop关卡") for tab in client.data.user_my_quest: - for x in tab.skip_list: - if tab.tab_name == 'loop': + if tab.tab_name == 'loop': + for x in tab.skip_list: quest.append((x, tab.skip_count)) return quest diff --git a/autopcr/module/modules/tools.py b/autopcr/module/modules/tools.py index 6cc96a6f..3dc72782 100644 --- a/autopcr/module/modules/tools.py +++ b/autopcr/module/modules/tools.py @@ -91,8 +91,7 @@ async def read_drama(psy_top_resp: PsyTopResponse): if is_abort: raise AbortError("") if is_skip: raise SkipError("") - -@description('来进行赛博抽卡') +@description('警告!真抽!抽到出指NEW出保底角色,或达天井停下来,如果已有保底角色,就不会NEW!意味着就是一井!') @name('抽卡') @booltype("single_ticket", "用单抽券", False) @singlechoice("pool_id", "池子", "", db.get_cur_gacha) @@ -313,7 +312,7 @@ async def update_deck(self, units: ArenaQueryResult, client: pcrclient): under_rank_bonus_unit = [unit for unit in units_id if client.data.unit[unit].promotion_level < db.equip_max_rank - 1] if under_rank_bonus_unit: - self._warn(f"警告:{'|'.join([db.get_unit_name(unit_id) for unit_id in under_rank_bonus_unit])}无品级加成") + self._warn(f"无品级加成:{','.join([db.get_unit_name(unit_id) for unit_id in under_rank_bonus_unit])}") await client.deck_update(ePartyType.ARENA, units_id) @@ -392,7 +391,7 @@ async def update_deck(self, units: List[ArenaQueryResult], client: pcrclient): under_rank_bonus_unit = [uni_id for unit_id in units_id for uni_id in unit_id if client.data.unit[uni_id].promotion_level < db.equip_max_rank - 1] if under_rank_bonus_unit: - self._warn(f"警告:{'|'.join([db.get_unit_name(unit_id) for unit_id in under_rank_bonus_unit])}无品级加成") + self._warn(f"无品级加成:{','.join([db.get_unit_name(unit_id) for unit_id in under_rank_bonus_unit])}") deck_list = [] for i, unit_id in enumerate(units_id): From 3f54bc9e8ac331c9b3c548e65accc43ac68a566b Mon Sep 17 00:00:00 2001 From: Lanly109 <1094916227@qq.com> Date: Sat, 31 Aug 2024 23:44:49 +0800 Subject: [PATCH 3/5] fea: missing_unit tool --- autopcr/module/modules/__init__.py | 1 + autopcr/module/modules/tools.py | 20 ++++++++++++++++++++ server.py | 3 +++ 3 files changed, 24 insertions(+) diff --git a/autopcr/module/modules/__init__.py b/autopcr/module/modules/__init__.py index aa77a0d3..dfc1806b 100644 --- a/autopcr/module/modules/__init__.py +++ b/autopcr/module/modules/__init__.py @@ -96,6 +96,7 @@ tool_modules = [ # cook_pudding, unit_promote, + missing_unit, get_need_equip, get_normal_quest_recommand, get_need_memory, diff --git a/autopcr/module/modules/tools.py b/autopcr/module/modules/tools.py index 3dc72782..59049100 100644 --- a/autopcr/module/modules/tools.py +++ b/autopcr/module/modules/tools.py @@ -91,6 +91,26 @@ async def read_drama(psy_top_resp: PsyTopResponse): if is_abort: raise AbortError("") if is_skip: raise SkipError("") +@description('看看你缺了什么角色') +@name('查缺角色') +@default(True) +class missing_unit(Module): + async def do_task(self, client: pcrclient): + missing_unit = set(db.unlock_unit_condition.keys()) - set(client.data.unit.keys()) + if not missing_unit: + self._log("全图鉴玩家!你竟然没有缺少的角色!") + else: + limit_unit = set(id for id in missing_unit if db.unit_data[id].is_limited) + resident_unit = missing_unit - limit_unit + self._log(f"缺少{len(missing_unit)}个角色,其中{len(limit_unit)}个限定角色,{len(resident_unit)}个常驻角色") + if limit_unit: + self._log(f"==限定角色==" ) + self._log('\n'.join(db.get_unit_name(id) for id in limit_unit)) + self._log('') + if resident_unit: + self._log(f"==常驻角色==" ) + self._log('\n'.join(db.get_unit_name(id) for id in resident_unit)) + @description('警告!真抽!抽到出指NEW出保底角色,或达天井停下来,如果已有保底角色,就不会NEW!意味着就是一井!') @name('抽卡') @booltype("single_ticket", "用单抽券", False) diff --git a/server.py b/server.py index 4b2e775b..ba177e11 100644 --- a/server.py +++ b/server.py @@ -734,6 +734,9 @@ async def quest_recommand(botev: BotEvent): } return config +@register_tool("查缺角色", "missing_unit") +async def find_missing_unit(botev: BotEvent): + return {} # @register_tool("获取导入", "get_library_import_data") # async def get_library_import(botev: BotEvent): From ad01799d9f1cab85a3f976e163eed29f43e9f019 Mon Sep 17 00:00:00 2001 From: Lanly109 <1094916227@qq.com> Date: Mon, 2 Sep 2024 12:03:50 +0800 Subject: [PATCH 4/5] fix: limit shop equip count --- autopcr/module/modules/shop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autopcr/module/modules/shop.py b/autopcr/module/modules/shop.py index d3f86a92..3809c4d7 100644 --- a/autopcr/module/modules/shop.py +++ b/autopcr/module/modules/shop.py @@ -131,7 +131,7 @@ def buy_kind(self) -> List[str]: return self.get_config('normal_shop_buy_kind') @default(False) class limit_shop(shop_buyer): def _exp_count(self): return 999000 if "经验药水" in self.get_config('limit_shop_buy_kind') else 0 - def _equip_count(self): return 999000 if "装备" in self.get_config('limit_shop_buy_kind') else 0 + def _equip_count(self): return 999000 if "装备" in self.get_config('limit_shop_buy_kind') else -999000 def coin_limit(self) -> int: return self.get_config('limit_shop_buy_coin_limit') def system_id(self) -> eSystemId: return eSystemId.LIMITED_SHOP def reset_count(self) -> int: return 0 From 3ceddc0b584bd40b90e1a456b59aa4245bace3a4 Mon Sep 17 00:00:00 2001 From: Lanly109 <1094916227@qq.com> Date: Mon, 2 Sep 2024 12:05:22 +0800 Subject: [PATCH 5/5] fea: update equipment 2 unit --- autopcr/module/modules/autosweep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autopcr/module/modules/autosweep.py b/autopcr/module/modules/autosweep.py index faf2bb85..086609d9 100644 --- a/autopcr/module/modules/autosweep.py +++ b/autopcr/module/modules/autosweep.py @@ -221,7 +221,7 @@ def get_max_times(self, client: pcrclient, quest_id: int) -> int: return 5 unique_equip_2_pure_memory_id = [ - (32025, 1), # 水女仆 + (32025, 2), # 水女仆,女仆 (32046, 1), # 水猫剑 (32048, 1), # 水子龙 (32060, 1), # 黑猫