Support starrail rogue locust

This commit is contained in:
xtaodada 2023-09-06 21:05:33 +08:00 committed by omg-xtao
parent 5801b6766d
commit 6760b3cbc2
2 changed files with 91 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
from simnet.models.starrail.chronicle.rogue import StarRailRogue, StarRailRogueLocust
from simnet.models.starrail.chronicle.stats import StarRailUserStats, StarRailUserInfo
from simnet.utils.enum_ import Game, Region
from simnet.utils.player import recognize_starrail_server, recognize_region
@ -229,6 +229,28 @@ class StarRailBattleChronicleClient(BaseChronicleClient):
data = await self._request_starrail_record("rogue", player_id, lang=lang, payload=payload)
return StarRailRogue(**data)
async def get_starrail_rogue_locust(
self,
player_id: Optional[int] = None,
lang: Optional[str] = None,
) -> StarRailRogueLocust:
"""Get starrail rogue locust 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:
StarRailRogueLocust: The requested rogue locust 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_locust", player_id, lang=lang, payload=payload)
return StarRailRogueLocust(**data)
async def get_starrail_museum_info(
self,
uid: Optional[int] = None,

View File

@ -94,3 +94,71 @@ class StarRailRogue(APIModel):
basic_info: RogueBasicInfo
current_record: RogueRecord
last_record: RogueRecord
class RogueLocustBasicCnt(APIModel):
"""Rogue Locust Basic Cnt"""
narrow: int
miracle: int
event: int
class RogueLocustBasicDestiny(APIModel):
"""Rogue Locust Basic Destiny"""
id: int
desc: str
level: int
class RogueLocustBasic(APIModel):
"""Rogue Locust Basic"""
cnt: RogueLocustBasicCnt
destiny: List[RogueLocustBasicDestiny]
class RogueLocustRecordDetailBlock(APIModel):
"""Rogue Locust Block"""
block_id: int
name: str
num: int
class RogueLocustRecordDetailFury(APIModel):
"""Rogue Locust Fury"""
type: int
point: str
class RogueLocustRecordDetail(APIModel):
"""Detailed Rogue Locust record info."""
name: 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]
difficulty: int
worm_weak: List[str]
fury: RogueLocustRecordDetailFury
class RogueLocustRecords(APIModel):
"""Rogue Locust records"""
records: List[RogueLocustRecordDetail]
class StarRailRogueLocust(APIModel):
"""StarRail Rogue Locust"""
basic: RogueLocustBasic
detail: RogueLocustRecords
role: RogueUserRole