Add Encounter Points to Genshin Notes

This commit is contained in:
omg-xtao 2023-09-28 17:34:28 +08:00 committed by GitHub
parent 72f3bfe797
commit c7bd82e731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
from datetime import timedelta, datetime from datetime import timedelta, datetime
from enum import Enum
from typing import Union, Literal, Tuple, List, Optional, Dict, Any from typing import Union, Literal, Tuple, List, Optional, Dict, Any
from pydantic import Field, root_validator from pydantic import Field, root_validator
@ -6,6 +7,11 @@ from pydantic import Field, root_validator
from simnet.models.base import APIModel from simnet.models.base import APIModel
__all__ = [ __all__ = [
"TaskRewardStatus",
"TaskReward",
"AttendanceRewardStatus",
"AttendanceReward",
"DailyTask",
"Expedition", "Expedition",
"Notes", "Notes",
"ExpeditionWidget", "ExpeditionWidget",
@ -96,6 +102,68 @@ class TransformerTimedelta(timedelta):
return self.timedata[3] return self.timedata[3]
class TaskRewardStatus(str, Enum):
"""The enum for task reward statuses."""
Invalid = "TaskRewardStatusInvalid"
TakenAward = "TaskRewardStatusTakenAward"
Finished = "TaskRewardStatusFinished"
Unfinished = "TaskRewardStatusUnfinished"
class TaskReward(APIModel):
"""The model for a task reward.
Attributes:
status (TaskRewardStatus): The status of the task reward.
"""
status: TaskRewardStatus
class AttendanceRewardStatus(str, Enum):
"""The enum for attendance reward statuses."""
Invalid = "AttendanceRewardStatusInvalid"
TakenAward = "AttendanceRewardStatusTakenAward"
WaitTaken = "AttendanceRewardStatusWaitTaken"
Unfinished = "AttendanceRewardStatusUnfinished"
FinishedNonReward = "AttendanceRewardStatusFinishedNonReward"
Forbid = "AttendanceRewardStatusForbid"
class AttendanceReward(APIModel):
"""The model for an attendance reward.
Attributes:
status (AttendanceRewardStatus): The status of the attendance reward.
progress (int): The progress of the attendance reward.
"""
status: AttendanceRewardStatus
progress: int
class DailyTask(APIModel):
"""The model for a daily task.
Attributes:
total_num (int): The total number of daily tasks.
finished_num (int): The number of finished daily tasks.
is_extra_task_reward_received (bool): Whether the extra task reward has been received.
task_rewards (List[TaskReward]): The list of task rewards.
attendance_rewards (List[AttendanceReward]): The list of attendance rewards.
attendance_visible (bool): Whether the attendance rewards are visible.
"""
total_num: int
finished_num: int
is_extra_task_reward_received: bool
task_rewards: List[TaskReward]
attendance_rewards: List[AttendanceReward]
attendance_visible: bool
class Notes(APIModel): class Notes(APIModel):
"""The model for real-time notes. """The model for real-time notes.
@ -141,6 +209,8 @@ class Notes(APIModel):
expeditions: List[Expedition] expeditions: List[Expedition]
max_expeditions: int = Field(alias="max_expedition_num") max_expeditions: int = Field(alias="max_expedition_num")
daily_task: DailyTask
@property @property
def resin_recovery_time(self) -> datetime: def resin_recovery_time(self) -> datetime:
"""A property that returns the time when resin will be fully recovered.""" """A property that returns the time when resin will be fully recovered."""