mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 03:32:33 +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 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
|
from .equipment import LightCone, Relic, RelicSet
|
||||||
|
from .stat import Attribute, Property
|
||||||
|
|
||||||
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"""
|
|
||||||
|
|
||||||
|
|
||||||
class Character(BaseModel):
|
class Character(BaseModel):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class Element(BaseModel):
|
class Element(BaseModel):
|
||||||
|
@ -40,58 +40,64 @@ class Path(BaseModel):
|
||||||
"""The path icon"""
|
"""The path icon"""
|
||||||
|
|
||||||
|
|
||||||
class Attribute(BaseModel):
|
class Trace(BaseModel):
|
||||||
"""
|
"""
|
||||||
Represents an attribute.
|
Represents a character's skill trace.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
- field (`str`): The field of the attribute.
|
- id (`int`): The ID of the trace.
|
||||||
- name (`str`): The name of the attribute.
|
- name (`str`): The name of the trace.
|
||||||
- icon (`str`): The attribute icon image.
|
- level (`int`): The current level of the trace.
|
||||||
- value (`float`): The value of the attribute.
|
- max_level (`int`): The maximum level of the trace.
|
||||||
- displayed_value (`str`): The displayed value of the attribute.
|
- element (`Element` | None): The element of the trace, or None if not applicable.
|
||||||
- is_percent (`bool`): Indicates if the value is in percentage.
|
- 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
|
id: int
|
||||||
"""The field of the attribute"""
|
"""The ID of the trace"""
|
||||||
name: str
|
name: str
|
||||||
"""The name of the attribute"""
|
"""The name of the trace"""
|
||||||
icon: str
|
level: int
|
||||||
"""The attribute icon image"""
|
"""The current level of the trace"""
|
||||||
value: float
|
max_level: int
|
||||||
"""The value of the attribute"""
|
"""The maximum level of the trace"""
|
||||||
displayed_value: str = Field(..., alias="display")
|
element: Element | None = None
|
||||||
"""The displayed value of the attribute"""
|
"""The element of the trace"""
|
||||||
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
|
type: str
|
||||||
"""The type of the property"""
|
"""The type of the trace"""
|
||||||
field: str
|
type_text: str
|
||||||
"""The field of the property"""
|
"""The type text of the trace"""
|
||||||
name: str
|
effect: str
|
||||||
"""The name of the property"""
|
"""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
|
icon: str
|
||||||
"""The property icon image"""
|
"""The trace icon"""
|
||||||
value: float
|
|
||||||
"""The value of the property"""
|
|
||||||
displayed_value: str = Field(..., alias="display")
|
class TraceTreeNode(BaseModel):
|
||||||
"""The displayed value of the property"""
|
"""
|
||||||
is_percent: bool = Field(..., alias="percent")
|
Represents a node in the trace skill tree of a character.
|
||||||
"""Indicates if the value is in percentage"""
|
|
||||||
|
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 pydantic import BaseModel, Field
|
||||||
|
|
||||||
from .combat import Attribute, Path, Property
|
from .combat import Path
|
||||||
|
from .stat import Attribute, Property
|
||||||
|
|
||||||
|
|
||||||
class LightCone(BaseModel):
|
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