From 20b7211b04ccd42ef5f634624110a09db9bda92c Mon Sep 17 00:00:00 2001 From: xtaodada Date: Thu, 7 Dec 2023 17:14:30 +0800 Subject: [PATCH] :sparkles: Support starrail activity - BoxingShow --- simnet/models/starrail/character.py | 1 + simnet/models/starrail/chronicle/activity.py | 45 +++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/simnet/models/starrail/character.py b/simnet/models/starrail/character.py index cc01051..a8a5dca 100644 --- a/simnet/models/starrail/character.py +++ b/simnet/models/starrail/character.py @@ -30,6 +30,7 @@ class RogueCharacter(StarRailBaseCharacter): level: int rank: int + is_trial: bool = False class ActivityCharacter(StarRailBaseCharacter): diff --git a/simnet/models/starrail/chronicle/activity.py b/simnet/models/starrail/chronicle/activity.py index 57e6cfc..c8d6a90 100644 --- a/simnet/models/starrail/chronicle/activity.py +++ b/simnet/models/starrail/chronicle/activity.py @@ -2,7 +2,7 @@ from typing import List, Optional, Dict from simnet.models.base import APIModel -from simnet.models.starrail.character import ActivityCharacter +from simnet.models.starrail.character import ActivityCharacter, RogueCharacter from .base import PartialTime @@ -250,6 +250,44 @@ class StarRailFoxStory(StarRailActivityBase): info: StarRailFoxStoryInfo +class StarRailBoxingShowBuffsUsedActivity(APIModel): + """Boxing Show Buffs Used Activity""" + + id: int + name_mi18n: str + desc_mi18n: str + + +class StarRailBoxingShowInfoItem(APIModel): + """Boxing Show Info Item""" + + name_mi18n: str + round: int + is_perfect: bool + has_challenge: bool + challenge_id: int + avatars_used_activity: List[RogueCharacter] + buffs_used_activity: List[StarRailBoxingShowBuffsUsedActivity] + + @property + def buffs(self) -> str: + """Get the buffs as a string.""" + return "、".join([i.name_mi18n for i in self.buffs_used_activity]) + + +class StarRailBoxingShowInfo(APIModel): + """Boxing Show Info""" + + list: List[StarRailBoxingShowInfoItem] + exists_data: bool = False + + +class StarRailBoxingShow(StarRailActivityBase): + """Boxing Show Activity""" + + info: StarRailBoxingShowInfo + + class StarRailActivity(APIModel): """Starrail chronicle activity.""" @@ -286,3 +324,8 @@ class StarRailActivity(APIModel): def fox_story(self) -> StarRailFoxStory: """Get the fox story activity.""" return StarRailFoxStory(**self.find_activity("fox_story")) + + @property + def boxing_show(self) -> StarRailBoxingShow: + """Get the boxing show activity.""" + return StarRailBoxingShow(**self.find_activity("boxing_show"))