Support starrail activity - EndlessSide

This commit is contained in:
xtaodada 2023-10-27 21:36:43 +08:00
parent 61c1a2505f
commit 292ecd3c47
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 41 additions and 1 deletions

View File

@ -36,4 +36,4 @@ class ActivityCharacter(StarRailBaseCharacter):
"""Combat character model."""
level: int
is_trial: bool
is_trial: bool = False

View File

@ -137,6 +137,41 @@ class StarRailYitaiBattleRecord(StarRailActivityBase):
info: StarRailYitaiBattleInfo
class StarRailEndlessSideRecord(APIModel):
"""Endless Side Record"""
name: str
status: str
level: int
point: int
avatars: List[ActivityCharacter]
buff_cnt: int
miracle_cnt: int
base_buff_id: int
base_buff_name: str
rank: int
cached_avatars: List[ActivityCharacter]
@property
def finished(self) -> bool:
"""Check if the record is finished."""
return self.status == "PassHard"
class StarRailEndlessSideInfo(APIModel):
"""Endless Side Info"""
total_score: str
records: List[StarRailEndlessSideRecord]
exists_data: bool = True
class StarRailEndlessSide(StarRailActivityBase):
"""Endless Side Activity"""
info: StarRailEndlessSideInfo
class StarRailActivity(APIModel):
"""Starrail chronicle activity."""
@ -163,3 +198,8 @@ class StarRailActivity(APIModel):
def yitai_battle(self) -> StarRailYitaiBattleRecord:
"""Get the yitai battle activity."""
return StarRailYitaiBattleRecord(**self.find_activity("yitai_battle"))
@property
def endless_side(self) -> StarRailEndlessSide:
"""Get the endless side activity."""
return StarRailEndlessSide(**self.find_activity("endless_side"))