fix: Decompose space_info & add friend_count

This commit is contained in:
KT 2023-06-13 19:54:22 +08:00
parent 2d1b9b23af
commit bfd5e08aab
2 changed files with 17 additions and 6 deletions

View File

@ -19,11 +19,11 @@ class ForgottenHall(BaseModel):
"""
memory: int = Field(..., alias="pre_maze_group_index")
"""The progress of the memory"""
"""The progress of the memory (pre_maze_group_index)"""
memory_of_chaos_id: int = Field(..., alias="maze_group_id")
"""The ID of the memory of chaos"""
"""The ID of the memory of chaos (maze_group_id)"""
memory_of_chaos: int = Field(..., alias="maze_group_index")
"""The progress of the memory of chaos"""
"""The progress of the memory of chaos (maze_group_index)"""
class Player(BaseModel):
@ -35,6 +35,7 @@ class Player(BaseModel):
- name (`str`): The player's nickname.
- level (`int`): The player's Trailblaze level.
- world_level (`int`): The player's Equilibrium level.
- friend_count (`int`): The number of friends.
- avatar (`Avatar`): The player's profile picture.
- signature (`str`): The player's bio.
- is_display (`bool`): Is the player's profile display enabled.
@ -54,6 +55,8 @@ class Player(BaseModel):
"""Trailblaze level"""
world_level: int
"""Equilibrium level"""
friend_count: int
"""Number of friends"""
avatar: Avatar
"""Profile picture"""
signature: str
@ -62,12 +65,20 @@ class Player(BaseModel):
"""Is the player's profile display enabled."""
forgotten_hall: ForgottenHall | None = Field(None, alias="challenge_data")
"""The progress of the Forgotten Hall"""
"""The progress of the Forgotten Hall (challenge_data)"""
simulated_universes: int = Field(0, alias="pass_area_progress")
"""Number of simulated universes passed"""
"""Number of simulated universes passed (pass_area_progress)"""
light_cones: int = Field(0, alias="light_cone_count")
"""Number of light cones owned"""
characters: int = Field(0, alias="avatar_count")
"""Number of characters owned"""
achievements: int = Field(0, alias="achievement_count")
"""Number of achievements unlocked"""
@root_validator(pre=True)
def decompose_space_info(cls, data):
if isinstance(data, dict):
space_info = data.get("space_info")
if isinstance(space_info, dict):
data.update(space_info)
return data

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "mihomo"
version = "1.1.3"
version = "1.1.4"
authors = [
{ name="KT", email="xns77477@gmail.com" },
]