Skip to content

Commit 9c408fa

Browse files
committed
fea: sub story support
1 parent c11b21d commit 9c408fa

4 files changed

Lines changed: 38 additions & 0 deletions

File tree

autopcr/core/pcrclient.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,15 @@ async def tpr_register_success(self, panel_id: int, correct_type: int, parts_id_
739739
req.parts_id_list = parts_id_list
740740
return await self.request(req)
741741

742+
async def read_lss_story(self, sub_story_id: int):
743+
req = SubStoryLssReadStoryRequest()
744+
req.sub_story_id = sub_story_id
745+
req.skip_info = StorySkipInfo(
746+
skip_type = eStorySkipType.MENU_SKIP,
747+
scroll_coordinate = ""
748+
)
749+
return await self.request(req)
750+
742751
async def read_tpr_story(self, sub_story_id: int):
743752
req = SubStoryTprReadStoryRequest()
744753
req.sub_story_id = sub_story_id

autopcr/db/database.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,14 @@ def hatsune_item(self) -> Dict[int, HatsuneItem]:
12631263
.to_dict(lambda x: x.event_id, lambda x: x)
12641264
)
12651265

1266+
@lazy_property
1267+
def lss_story_data(self) -> Dict[int, LssStoryDatum]:
1268+
with self.dbmgr.session() as db:
1269+
return (
1270+
LssStoryDatum.query(db)
1271+
.to_dict(lambda x: x.sub_story_id, lambda x: x)
1272+
)
1273+
12661274
@lazy_property
12671275
def tpr_story_data(self) -> Dict[int, TprStoryDatum]:
12681276
with self.dbmgr.session() as db:

autopcr/model/handlers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,17 @@ async def update(self, mgr: datamgr, request):
784784
mgr.update_inventory(reward)
785785

786786
@handles
787+
class SubStoryLssReadStoryResponse(responses.SubStoryLssReadStoryResponse):
788+
async def update(self, mgr: datamgr, request):
789+
if self.reward_info:
790+
for reward in self.reward_info:
791+
mgr.update_inventory(reward)
792+
if self.special_reward_list:
793+
for reward in self.special_reward_list:
794+
mgr.update_inventory(reward)
795+
if self.user_jewel:
796+
mgr.jewel = self.user_jewel
797+
@handles
787798
class SubStoryNydReadStoryResponse(responses.SubStoryNydReadStoryResponse):
788799
async def update(self, mgr: datamgr, request):
789800
if self.reward_info:

autopcr/util/substory.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ def GetSubStoryReader(sub_story_data: EventSubStory, client: pcrclient) -> Union
4545
return constructor[sub_story_data.event_id](client)
4646
return None
4747

48+
@EventId(10150)
49+
class lss_substory(SubStoryReader):
50+
51+
def title(self, sub_story_id: int) -> str:
52+
return db.lss_story_data[sub_story_id].title
53+
54+
async def read(self, sub_story_id: int):
55+
await self.client.story_check(sub_story_id)
56+
await self.client.read_lss_story(sub_story_id)
57+
4858
@EventId(10148)
4959
class tpr_substory(SubStoryReader):
5060
special = True

0 commit comments

Comments
 (0)