mirror of
https://github.com/PaiGramTeam/SIMNet.git
synced 2024-11-21 21:58:05 +00:00
✨ Support starrail act calendar
This commit is contained in:
parent
2be6cb3f4d
commit
7d567a3fdb
@ -5,6 +5,7 @@ from simnet.client.components.chronicle.base import BaseChronicleClient
|
|||||||
from simnet.client.routes import RECORD_URL
|
from simnet.client.routes import RECORD_URL
|
||||||
from simnet.errors import BadRequest, DataNotPublic
|
from simnet.errors import BadRequest, DataNotPublic
|
||||||
from simnet.models.lab.record import RecordCard
|
from simnet.models.lab.record import RecordCard
|
||||||
|
from simnet.models.starrail.chronicle.act_calendar import StarRailActCalendar
|
||||||
from simnet.models.starrail.chronicle.activity import StarRailActivity
|
from simnet.models.starrail.chronicle.activity import StarRailActivity
|
||||||
from simnet.models.starrail.chronicle.challenge import StarRailChallenge
|
from simnet.models.starrail.chronicle.challenge import StarRailChallenge
|
||||||
from simnet.models.starrail.chronicle.challenge_boss import StarRailChallengeBoss
|
from simnet.models.starrail.chronicle.challenge_boss import StarRailChallengeBoss
|
||||||
@ -367,6 +368,27 @@ class StarRailBattleChronicleClient(BaseChronicleClient):
|
|||||||
data = await self._request_starrail_record("activity", uid, lang=lang)
|
data = await self._request_starrail_record("activity", uid, lang=lang)
|
||||||
return StarRailActivity(**data)
|
return StarRailActivity(**data)
|
||||||
|
|
||||||
|
async def get_starrail_act_calendar(
|
||||||
|
self,
|
||||||
|
uid: Optional[int] = None,
|
||||||
|
lang: Optional[str] = None,
|
||||||
|
) -> StarRailActCalendar:
|
||||||
|
"""Get starrail act calendar.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
uid (Optional[int], optional): The player ID. Defaults to None.
|
||||||
|
lang (Optional[str], optional): The language of the data. Defaults to None.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
StarRailActCalendar: The requested act calendar info.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
BadRequest: If the request is invalid.
|
||||||
|
DataNotPublic: If the requested data is not public.
|
||||||
|
"""
|
||||||
|
data = await self._request_starrail_record("get_act_calender", uid, lang=lang)
|
||||||
|
return StarRailActCalendar(**data)
|
||||||
|
|
||||||
async def get_starrail_resident(
|
async def get_starrail_resident(
|
||||||
self,
|
self,
|
||||||
uid: Optional[int] = None,
|
uid: Optional[int] = None,
|
||||||
|
164
simnet/models/starrail/chronicle/act_calendar.py
Normal file
164
simnet/models/starrail/chronicle/act_calendar.py
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
import datetime
|
||||||
|
from enum import Enum
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
|
from simnet.models.base import APIModel
|
||||||
|
|
||||||
|
|
||||||
|
class EquipListItem(APIModel):
|
||||||
|
"""A model representing an equipment item in the StarRail act calendar."""
|
||||||
|
|
||||||
|
item_id: str
|
||||||
|
item_name: str
|
||||||
|
item_url: Optional[str] = ""
|
||||||
|
rarity: int
|
||||||
|
avatar_base_type: str
|
||||||
|
is_forward: bool
|
||||||
|
wiki_url: str
|
||||||
|
|
||||||
|
|
||||||
|
class AvatarListItem(EquipListItem):
|
||||||
|
"""A model representing an avatar item in the StarRail act calendar."""
|
||||||
|
|
||||||
|
icon_url: str
|
||||||
|
damage_type: int
|
||||||
|
damage_type_name: str
|
||||||
|
item_avatar_icon_path: str
|
||||||
|
|
||||||
|
|
||||||
|
class TimeInfo(APIModel):
|
||||||
|
"""A model representing time information in the StarRail act calendar."""
|
||||||
|
|
||||||
|
start_ts: datetime.datetime
|
||||||
|
end_ts: datetime.datetime
|
||||||
|
start_time: datetime.datetime
|
||||||
|
end_time: datetime.datetime
|
||||||
|
now: datetime.datetime
|
||||||
|
|
||||||
|
|
||||||
|
class CardPoolTypeEnum(str, Enum):
|
||||||
|
"""An enumeration class representing the type of card pool in the StarRail act calendar."""
|
||||||
|
|
||||||
|
Role = "CardPoolRole"
|
||||||
|
Equipment = "CardPoolEquipment"
|
||||||
|
|
||||||
|
|
||||||
|
class CardPoolListItem(APIModel):
|
||||||
|
"""A model representing an item in the card pool list in the StarRail act calendar."""
|
||||||
|
|
||||||
|
id: str
|
||||||
|
name: str
|
||||||
|
type: CardPoolTypeEnum
|
||||||
|
avatar_list: List[AvatarListItem]
|
||||||
|
equip_list: List[EquipListItem]
|
||||||
|
is_after_version: bool
|
||||||
|
time_info: TimeInfo
|
||||||
|
version: str
|
||||||
|
|
||||||
|
|
||||||
|
class RewardItem(APIModel):
|
||||||
|
"""A model representing a reward item in the StarRail act calendar."""
|
||||||
|
|
||||||
|
item_id: int
|
||||||
|
name: str
|
||||||
|
icon: str
|
||||||
|
wiki_url: str
|
||||||
|
num: int
|
||||||
|
rarity: str
|
||||||
|
|
||||||
|
|
||||||
|
class ActTypeEnum(str, Enum):
|
||||||
|
"""An enumeration class representing the type of act in the StarRail act calendar."""
|
||||||
|
|
||||||
|
Sign = "ActivityTypeSign"
|
||||||
|
Double = "ActivityTypeDouble"
|
||||||
|
Other = "ActivityTypeOther"
|
||||||
|
|
||||||
|
|
||||||
|
class ActStatusEnum(str, Enum):
|
||||||
|
"""An enumeration class representing the status of an act in the StarRail act calendar."""
|
||||||
|
|
||||||
|
SignStatusUnopened = "SignStatusUnopened"
|
||||||
|
SignStatusUnSignedToday = "SignStatusUnSignedToday"
|
||||||
|
SignStatusSignedToday = "SignStatusSignedToday"
|
||||||
|
SignStatusUnclaimed = "SignStatusUnclaimed"
|
||||||
|
SignStatusFinish = "SignStatusFinish"
|
||||||
|
|
||||||
|
DoubleRewardActStatusUnopened = "DoubleRewardActStatusUnopened"
|
||||||
|
DoubleRewardActStatusProgress = "DoubleRewardActStatusProgress"
|
||||||
|
DoubleRewardActStatusFinish = "DoubleRewardActStatusFinish"
|
||||||
|
|
||||||
|
OtherActStatusUnopened = "OtherActStatusUnopened"
|
||||||
|
OtherActStatusUnFinish = "OtherActStatusUnFinish"
|
||||||
|
OtherActStatusFinish = "OtherActStatusFinish"
|
||||||
|
|
||||||
|
|
||||||
|
class ActListItem(APIModel):
|
||||||
|
"""A model representing an item in the StarRail act calendar."""
|
||||||
|
|
||||||
|
id: int
|
||||||
|
version: str
|
||||||
|
name: str
|
||||||
|
act_type: ActTypeEnum
|
||||||
|
act_status: ActStatusEnum
|
||||||
|
reward_list: List[RewardItem]
|
||||||
|
total_progress: int
|
||||||
|
current_progress: int
|
||||||
|
time_info: TimeInfo
|
||||||
|
panel_id: int
|
||||||
|
panel_desc: str
|
||||||
|
strategy: str
|
||||||
|
multiple_drop_type: int
|
||||||
|
multiple_drop_type_list: List[int]
|
||||||
|
count_refresh_type: int
|
||||||
|
count_value: int
|
||||||
|
drop_multiple: int
|
||||||
|
is_after_version: bool
|
||||||
|
sort_weight: int
|
||||||
|
special_reward: RewardItem
|
||||||
|
all_finished: bool
|
||||||
|
show_text: str
|
||||||
|
|
||||||
|
|
||||||
|
class ChallengeTypeEnum(str, Enum):
|
||||||
|
"""An enumeration class representing the type of challenge in the StarRail act calendar."""
|
||||||
|
|
||||||
|
Chasm = "ChallengeTypeChasm"
|
||||||
|
Story = "ChallengeTypeStory"
|
||||||
|
Boss = "ChallengeTypeBoss"
|
||||||
|
|
||||||
|
|
||||||
|
class ChallengeStatusEnum(str, Enum):
|
||||||
|
"""An enumeration class representing the status of a challenge in the StarRail act calendar."""
|
||||||
|
|
||||||
|
Unopened = "challengeStatusUnopened"
|
||||||
|
Progress = "challengeStatusInProgress"
|
||||||
|
Finish = "challengeStatusFinish"
|
||||||
|
|
||||||
|
|
||||||
|
class ChallengeListItem(APIModel):
|
||||||
|
"""A model representing a challenge item in the StarRail act calendar."""
|
||||||
|
|
||||||
|
group_id: int
|
||||||
|
name_mi18n: str
|
||||||
|
challenge_type: ChallengeTypeEnum
|
||||||
|
|
||||||
|
total_progress: int
|
||||||
|
current_progress: int
|
||||||
|
status: ChallengeStatusEnum
|
||||||
|
|
||||||
|
time_info: TimeInfo
|
||||||
|
reward_list: List[RewardItem]
|
||||||
|
special_reward: RewardItem
|
||||||
|
show_text: str
|
||||||
|
|
||||||
|
|
||||||
|
class StarRailActCalendar(APIModel):
|
||||||
|
"""A model representing the StarRail act calendar."""
|
||||||
|
|
||||||
|
avatar_card_pool_list: List[CardPoolListItem]
|
||||||
|
equip_card_pool_list: List[CardPoolListItem]
|
||||||
|
act_list: List[ActListItem]
|
||||||
|
challenge_list: List[ChallengeListItem]
|
||||||
|
now: datetime.datetime
|
||||||
|
cur_game_version: str
|
Loading…
Reference in New Issue
Block a user