mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-09 02:41:22 +08:00
refactor: Adjust model class position
This commit is contained in:
parent
aa9093e28d
commit
a5c884aa0b
@ -2,71 +2,9 @@ from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field, root_validator
|
||||
|
||||
from .combat import Attribute, Element, Path, Property
|
||||
from .combat import Element, Path, Trace, TraceTreeNode
|
||||
from .equipment import LightCone, Relic, RelicSet
|
||||
|
||||
|
||||
class Trace(BaseModel):
|
||||
"""
|
||||
Represents a character's skill trace.
|
||||
|
||||
Attributes:
|
||||
- id (`int`): The ID of the trace.
|
||||
- name (`str`): The name of the trace.
|
||||
- level (`int`): The current level of the trace.
|
||||
- max_level (`int`): The maximum level of the trace.
|
||||
- element (`Element` | None): The element of the trace, or None if not applicable.
|
||||
- type (`str`): The type of the trace.
|
||||
- type_text (`str`): The type text of the trace.
|
||||
- effect (`str`): The effect of the trace.
|
||||
- effect_text (`str`): The effect text of the trace.
|
||||
- simple_desc (`str`): The simple description of the trace.
|
||||
- desc (`str`): The detailed description of the trace.
|
||||
- icon (`str`): The trace icon.
|
||||
"""
|
||||
|
||||
id: int
|
||||
"""The ID of the trace"""
|
||||
name: str
|
||||
"""The name of the trace"""
|
||||
level: int
|
||||
"""The current level of the trace"""
|
||||
max_level: int
|
||||
"""The maximum level of the trace"""
|
||||
element: Element | None = None
|
||||
"""The element of the trace"""
|
||||
type: str
|
||||
"""The type of the trace"""
|
||||
type_text: str
|
||||
"""The type text of the trace"""
|
||||
effect: str
|
||||
"""The effect of the trace"""
|
||||
effect_text: str
|
||||
"""The effect text of the trace"""
|
||||
simple_desc: str
|
||||
"""The simple description of the trace"""
|
||||
desc: str
|
||||
"""The detailed description of the trace"""
|
||||
icon: str
|
||||
"""The trace icon"""
|
||||
|
||||
|
||||
class TraceTreeNode(BaseModel):
|
||||
"""
|
||||
Represents a node in the trace skill tree of a character.
|
||||
|
||||
Attributes:
|
||||
- id (`int`): The ID of the trace.
|
||||
- level (`int`): The level of the trace.
|
||||
- icon (`str`): The icon of the trace.
|
||||
"""
|
||||
|
||||
id: int
|
||||
"""The ID of the trace"""
|
||||
level: int
|
||||
"""The level of the trace"""
|
||||
icon: str
|
||||
"""The icon of the trace"""
|
||||
from .stat import Attribute, Property
|
||||
|
||||
|
||||
class Character(BaseModel):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Element(BaseModel):
|
||||
@ -40,58 +40,64 @@ class Path(BaseModel):
|
||||
"""The path icon"""
|
||||
|
||||
|
||||
class Attribute(BaseModel):
|
||||
class Trace(BaseModel):
|
||||
"""
|
||||
Represents an attribute.
|
||||
Represents a character's skill trace.
|
||||
|
||||
Attributes:
|
||||
- field (`str`): The field of the attribute.
|
||||
- name (`str`): The name of the attribute.
|
||||
- icon (`str`): The attribute icon image.
|
||||
- value (`float`): The value of the attribute.
|
||||
- displayed_value (`str`): The displayed value of the attribute.
|
||||
- is_percent (`bool`): Indicates if the value is in percentage.
|
||||
- id (`int`): The ID of the trace.
|
||||
- name (`str`): The name of the trace.
|
||||
- level (`int`): The current level of the trace.
|
||||
- max_level (`int`): The maximum level of the trace.
|
||||
- element (`Element` | None): The element of the trace, or None if not applicable.
|
||||
- type (`str`): The type of the trace.
|
||||
- type_text (`str`): The type text of the trace.
|
||||
- effect (`str`): The effect of the trace.
|
||||
- effect_text (`str`): The effect text of the trace.
|
||||
- simple_desc (`str`): The simple description of the trace.
|
||||
- desc (`str`): The detailed description of the trace.
|
||||
- icon (`str`): The trace icon.
|
||||
"""
|
||||
|
||||
field: str
|
||||
"""The field of the attribute"""
|
||||
id: int
|
||||
"""The ID of the trace"""
|
||||
name: str
|
||||
"""The name of the attribute"""
|
||||
icon: str
|
||||
"""The attribute icon image"""
|
||||
value: float
|
||||
"""The value of the attribute"""
|
||||
displayed_value: str = Field(..., alias="display")
|
||||
"""The displayed value of the attribute"""
|
||||
is_percent: bool = Field(..., alias="percent")
|
||||
"""Indicates if the value is in percentage"""
|
||||
|
||||
|
||||
class Property(BaseModel):
|
||||
"""
|
||||
Represents a property.
|
||||
|
||||
Attributes:
|
||||
- type (`str`): The type of the property.
|
||||
- field (`str`): The field of the property.
|
||||
- name (`str`): The name of the property.
|
||||
- icon (`str`): The property icon image.
|
||||
- value (`float`): The value of the property.
|
||||
- displayed_value (`str`): The displayed value of the property.
|
||||
- is_percent (`bool`): Indicates if the value is in percentage.
|
||||
"""
|
||||
|
||||
"""The name of the trace"""
|
||||
level: int
|
||||
"""The current level of the trace"""
|
||||
max_level: int
|
||||
"""The maximum level of the trace"""
|
||||
element: Element | None = None
|
||||
"""The element of the trace"""
|
||||
type: str
|
||||
"""The type of the property"""
|
||||
field: str
|
||||
"""The field of the property"""
|
||||
name: str
|
||||
"""The name of the property"""
|
||||
"""The type of the trace"""
|
||||
type_text: str
|
||||
"""The type text of the trace"""
|
||||
effect: str
|
||||
"""The effect of the trace"""
|
||||
effect_text: str
|
||||
"""The effect text of the trace"""
|
||||
simple_desc: str
|
||||
"""The simple description of the trace"""
|
||||
desc: str
|
||||
"""The detailed description of the trace"""
|
||||
icon: str
|
||||
"""The property icon image"""
|
||||
value: float
|
||||
"""The value of the property"""
|
||||
displayed_value: str = Field(..., alias="display")
|
||||
"""The displayed value of the property"""
|
||||
is_percent: bool = Field(..., alias="percent")
|
||||
"""Indicates if the value is in percentage"""
|
||||
"""The trace icon"""
|
||||
|
||||
|
||||
class TraceTreeNode(BaseModel):
|
||||
"""
|
||||
Represents a node in the trace skill tree of a character.
|
||||
|
||||
Attributes:
|
||||
- id (`int`): The ID of the trace.
|
||||
- level (`int`): The level of the trace.
|
||||
- icon (`str`): The icon of the trace.
|
||||
"""
|
||||
|
||||
id: int
|
||||
"""The ID of the trace"""
|
||||
level: int
|
||||
"""The level of the trace"""
|
||||
icon: str
|
||||
"""The icon of the trace"""
|
||||
|
@ -1,6 +1,7 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from .combat import Attribute, Path, Property
|
||||
from .combat import Path
|
||||
from .stat import Attribute, Property
|
||||
|
||||
|
||||
class LightCone(BaseModel):
|
||||
|
58
mihomo/models/stat.py
Normal file
58
mihomo/models/stat.py
Normal file
@ -0,0 +1,58 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class Attribute(BaseModel):
|
||||
"""
|
||||
Represents an attribute.
|
||||
|
||||
Attributes:
|
||||
- field (`str`): The field of the attribute.
|
||||
- name (`str`): The name of the attribute.
|
||||
- icon (`str`): The attribute icon image.
|
||||
- value (`float`): The value of the attribute.
|
||||
- displayed_value (`str`): The displayed value of the attribute.
|
||||
- is_percent (`bool`): Indicates if the value is in percentage.
|
||||
"""
|
||||
|
||||
field: str
|
||||
"""The field of the attribute"""
|
||||
name: str
|
||||
"""The name of the attribute"""
|
||||
icon: str
|
||||
"""The attribute icon image"""
|
||||
value: float
|
||||
"""The value of the attribute"""
|
||||
displayed_value: str = Field(..., alias="display")
|
||||
"""The displayed value of the attribute"""
|
||||
is_percent: bool = Field(..., alias="percent")
|
||||
"""Indicates if the value is in percentage"""
|
||||
|
||||
|
||||
class Property(BaseModel):
|
||||
"""
|
||||
Represents a property.
|
||||
|
||||
Attributes:
|
||||
- type (`str`): The type of the property.
|
||||
- field (`str`): The field of the property.
|
||||
- name (`str`): The name of the property.
|
||||
- icon (`str`): The property icon image.
|
||||
- value (`float`): The value of the property.
|
||||
- displayed_value (`str`): The displayed value of the property.
|
||||
- is_percent (`bool`): Indicates if the value is in percentage.
|
||||
"""
|
||||
|
||||
type: str
|
||||
"""The type of the property"""
|
||||
field: str
|
||||
"""The field of the property"""
|
||||
name: str
|
||||
"""The name of the property"""
|
||||
icon: str
|
||||
"""The property icon image"""
|
||||
value: float
|
||||
"""The value of the property"""
|
||||
displayed_value: str = Field(..., alias="display")
|
||||
"""The displayed value of the property"""
|
||||
is_percent: bool = Field(..., alias="percent")
|
||||
"""Indicates if the value is in percentage"""
|
Loading…
Reference in New Issue
Block a user