Support starrail rogue nous

This commit is contained in:
xtaodada 2023-12-30 10:20:49 +08:00
parent 338f5367a0
commit 8a1ac17eda
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 98 additions and 1 deletions

View File

@ -11,7 +11,7 @@ from simnet.models.starrail.chronicle.characters import StarRailDetailCharacters
from simnet.models.starrail.chronicle.museum import StarRailMuseumBasic, StarRailMuseumDetail
from simnet.models.starrail.chronicle.notes import StarRailNote, StarRailNoteWidget, StarRailNoteOverseaWidget
from simnet.models.starrail.chronicle.resident import StarRailResident
from simnet.models.starrail.chronicle.rogue import StarRailRogue, StarRailRogueLocust
from simnet.models.starrail.chronicle.rogue import StarRailRogue, StarRailRogueLocust, StarRailRogueNous
from simnet.models.starrail.chronicle.stats import StarRailUserStats, StarRailUserInfo
from simnet.utils.enums import Game, Region
from simnet.utils.player import recognize_starrail_server, recognize_region
@ -251,6 +251,28 @@ class StarRailBattleChronicleClient(BaseChronicleClient):
data = await self._request_starrail_record("rogue_locust", player_id, lang=lang, payload=payload)
return StarRailRogueLocust(**data)
async def get_starrail_rogue_nous(
self,
player_id: Optional[int] = None,
lang: Optional[str] = None,
) -> StarRailRogueNous:
"""Get starrail rogue nous runs.
Args:
player_id (Optional[int], optional): The player ID. Defaults to None.
lang (Optional[str], optional): The language of the data. Defaults to None.
Returns:
StarRailRogueNous: The requested rogue nous runs.
Raises:
BadRequest: If the request is invalid.
DataNotPublic: If the requested data is not public.
"""
payload = dict(need_detail="true")
data = await self._request_starrail_record("rogue_nous", player_id, lang=lang, payload=payload)
return StarRailRogueNous(**data)
async def get_starrail_museum_info(
self,
uid: Optional[int] = None,

View File

@ -170,3 +170,78 @@ class StarRailRogueLocust(APIModel):
basic: RogueLocustBasic
detail: RogueLocustRecords
role: RogueUserRole
class StarRailRogueNousBasic(APIModel):
"""StarRail Rogue Nous Basic"""
cur_progress: int
max_progress: int
cur_rolling: int
max_rolling: int
unlock_miracle: int
active_nerve: int
unlock_event: int
exist_data: bool
class StarRailRogueNousSide(APIModel):
"""StarRail Rogue Nous Side"""
icon: str
rarity: int
class StarRailRogueNousRolling(APIModel):
"""StarRail Rogue Nous Rolling"""
id: int
name_mi18n: str
icon: str
sides: List[StarRailRogueNousSide]
main_buff_mi18n: str
aeon_id: int
class StarRailRogueNousRecordDetail(APIModel):
"""Detailed Rogue nous record info."""
name_mi18n: str
finish_time: PartialTime
final_lineup: List[RogueCharacter]
base_type_list: List[RogueBuffType]
cached_avatars: List[RogueCharacter]
buffs: List[RogueBuff]
miracles: List[RogueMiracle]
blocks: List[RogueLocustRecordDetailBlock]
boss_effect: List[str]
rolling: StarRailRogueNousRolling
difficulty: int
difficulty_type1_value: int
difficulty_type2_value: int
has_difficulty_type: bool
fury: RogueLocustRecordDetailFury
@property
def time_str(self) -> str:
"""Get the time as a string."""
if self.finish_time is None:
return "N/A"
return self.finish_time.datetime.strftime("%Y.%m.%d %H:%M")
class StarRailRogueNousRecords(APIModel):
"""Rogue Nous records"""
records: List[StarRailRogueNousRecordDetail]
class StarRailRogueNous(APIModel):
"""StarRail Rogue Nous"""
basic: StarRailRogueNousBasic
detail: StarRailRogueNousRecords
role: RogueUserRole