Skip to content

Commit aff1425

Browse files
authored
Merge pull request #252 from cc004/dev
Fix
2 parents 9c38136 + 82af25a commit aff1425

2 files changed

Lines changed: 35 additions & 15 deletions

File tree

autopcr/module/modules/story.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,14 @@ async def do_task(self, client: pcrclient):
7575
if story.story_group_id == 1255: # 忽略魔姬剧情
7676
continue
7777
if (
78+
story.read_process_flag and
7879
story.story_id not in read_story and
7980
(story.pre_story_id in read_story or now >= db.parse_time(story.force_unlock_time)) and
8081
(story.pre_story_id_2 in read_story or now >= db.parse_time(story.force_unlock_time_2)) and
8182
story.story_group_id in client.data.unit_love_data and
82-
client.data.unit_love_data[story.story_group_id].love_level >= story.love_level
83+
client.data.unit_love_data[story.story_group_id].love_level >= story.love_level and
84+
apiclient.datetime >= db.parse_time(story.start_time) and
85+
apiclient.datetime <= db.parse_time(story.end_time)
8386
):
8487
await client.read_story(story.story_id)
8588
read_story.add(story.story_id)

autopcr/module/modules/unit.py

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,34 @@ async def set_unique_growth_unit(self):
5959
await self.client.set_growth_item_unique(self.unit_id, ball[1])
6060

6161
async def is_growth_unit(self) -> Union[GrowthParameter, None]:
62-
if self.unit_id not in self.client.data.unit:
63-
raise AbortError(f"未解锁角色{self.unit_name}")
64-
if self.unit_id not in self.client.data.growth_unit:
65-
return None
66-
growth_id = list(set(self.client.data.growth_unit[self.unit_id].growth_parameter_list.growth_id_list) & set(db.growth_parameter.keys()))
67-
if not growth_id:
68-
return None
69-
if len(growth_id) > 1:
70-
raise ValueError(f"{self.unit_name}怎么装了多个辉光球?" + ','.join(map(str, growth_id)))
71-
growth_limit = db.growth_parameter[growth_id[0]]
72-
return growth_limit
62+
def old():
63+
if self.unit_id not in self.client.data.unit:
64+
raise AbortError(f"未解锁角色{self.unit_name}")
65+
if self.unit_id not in self.client.data.growth_unit:
66+
return None
67+
if not self.client.data.growth_unit[self.unit_id].growth_parameter_list:
68+
return None
69+
if not self.client.data.growth_unit[self.unit_id].growth_parameter_list.growth_id_list:
70+
return None
71+
growth_id = list(set(self.client.data.growth_unit[self.unit_id].growth_parameter_list.growth_id_list) & set(db.growth_parameter.keys()))
72+
if not growth_id:
73+
return None
74+
if len(growth_id) > 1:
75+
raise ValueError(f"{self.unit_name}怎么装了多个辉光球?" + ','.join(map(str, growth_id)))
76+
growth_limit = db.growth_parameter[growth_id[0]]
77+
return growth_limit
78+
ret = old()
79+
return ret if ret else self.client.data.get_synchro_parameter()
7380

7481
async def is_unique_growth_unit(self) -> Union[GrowthParameterUnique, None]:
7582
if self.unit_id not in self.client.data.unit:
7683
raise AbortError(f"未解锁角色{self.unit_name}")
7784
if self.unit_id not in self.client.data.growth_unit:
7885
return None
86+
if not self.client.data.growth_unit[self.unit_id].growth_parameter_list:
87+
return None
88+
if not self.client.data.growth_unit[self.unit_id].growth_parameter_list.growth_id_list:
89+
return None
7990
growth_id = list(set(self.client.data.growth_unit[self.unit_id].growth_parameter_list.growth_id_list) & set(db.growth_parameter_unique.keys()))
8091
if not growth_id:
8192
return None
@@ -811,7 +822,9 @@ async def do_task(self, client: pcrclient):
811822
target_unique1_level = target_unique1_level,
812823
target_unique2_level = target_unique2_level)
813824
except Exception as e:
814-
self._warn(str(e))
825+
msg = f"拉{unit_id}练度失败: {e}"
826+
logger.exception(msg)
827+
self._warn(msg)
815828
continue
816829

817830
@description('''角色ID 角色名字 角色等级 角色星级 好感度 Rank 左上 右上 左中 右中 左下 右下 UB 技能1 技能2 EX技能 专武1 专武2 EX武器 EX武器等级 EX防具 EX防具等级 EX首饰 EX首饰等级 高级设置
@@ -886,7 +899,9 @@ async def do_task(self, client: pcrclient):
886899
cb_ex = cb_ex)
887900

888901
except Exception as e:
889-
self._warn(str(e))
902+
msg = f"拉{unit_text}练度失败: {e}"
903+
logger.exception(msg)
904+
self._warn(msg)
890905
continue
891906

892907
@name('购买记忆碎片')
@@ -958,7 +973,9 @@ async def do_task(self, client: pcrclient):
958973
summary.append(f"{gap}{unit_name}记忆碎片" + ",但不购买" if gap > uplimit else "")
959974

960975
except Exception as e:
961-
self._warn(str(e))
976+
msg = f"购买{unit_text}记忆碎片失败: {e}"
977+
logger.exception(msg)
978+
self._warn(msg)
962979
continue
963980

964981
if summary:

0 commit comments

Comments
 (0)