seerapi-models 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- seerapi_models/__init__.py +244 -0
- seerapi_models/_utils.py +27 -0
- seerapi_models/achievement.py +257 -0
- seerapi_models/battle_effect.py +78 -0
- seerapi_models/build_model/__init__.py +66 -0
- seerapi_models/common.py +406 -0
- seerapi_models/effect.py +119 -0
- seerapi_models/element_type.py +118 -0
- seerapi_models/items/__init__.py +82 -0
- seerapi_models/items/_common.py +95 -0
- seerapi_models/items/enegry_bead.py +93 -0
- seerapi_models/items/equip.py +383 -0
- seerapi_models/items/mintmark_gem.py +267 -0
- seerapi_models/items/skill_activation_item.py +44 -0
- seerapi_models/items/skill_stone.py +150 -0
- seerapi_models/metadata.py +49 -0
- seerapi_models/mintmark.py +448 -0
- seerapi_models/pet/__init__.py +59 -0
- seerapi_models/pet/pet.py +482 -0
- seerapi_models/pet/pet_skin.py +78 -0
- seerapi_models/pet/petbook.py +124 -0
- seerapi_models/pet/soulmark.py +141 -0
- seerapi_models/skill.py +336 -0
- seerapi_models-1.0.0.dist-info/METADATA +120 -0
- seerapi_models-1.0.0.dist-info/RECORD +26 -0
- seerapi_models-1.0.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from ._common import Item, ItemCategory, ItemCategoryORM, ItemORM
|
|
2
|
+
from .enegry_bead import EnergyBead, EnergyBeadBuffAttrORM, EnergyBeadORM
|
|
3
|
+
from .equip import (
|
|
4
|
+
Equip,
|
|
5
|
+
EquipBonus,
|
|
6
|
+
EquipBonusAttrORM,
|
|
7
|
+
EquipBonusORM,
|
|
8
|
+
EquipEffectiveOccasion,
|
|
9
|
+
EquipEffectiveOccasionORM,
|
|
10
|
+
EquipORM,
|
|
11
|
+
EquipType,
|
|
12
|
+
EquipTypeORM,
|
|
13
|
+
Suit,
|
|
14
|
+
SuitBonus,
|
|
15
|
+
SuitBonusAttrORM,
|
|
16
|
+
SuitBonusORM,
|
|
17
|
+
SuitORM,
|
|
18
|
+
)
|
|
19
|
+
from .mintmark_gem import (
|
|
20
|
+
Gem,
|
|
21
|
+
GemCategory,
|
|
22
|
+
GemCategoryORM,
|
|
23
|
+
GemGen1,
|
|
24
|
+
GemGen1PartORM,
|
|
25
|
+
GemGen2,
|
|
26
|
+
GemGen2PartORM,
|
|
27
|
+
GemGenCategory,
|
|
28
|
+
GemGenCategoryORM,
|
|
29
|
+
GemORM,
|
|
30
|
+
)
|
|
31
|
+
from .skill_activation_item import SkillActivationItem, SkillActivationItemORM
|
|
32
|
+
from .skill_stone import (
|
|
33
|
+
SkillStone,
|
|
34
|
+
SkillStoneCategory,
|
|
35
|
+
SkillStoneCategoryORM,
|
|
36
|
+
SkillStoneEffect,
|
|
37
|
+
SkillStoneEffectORM,
|
|
38
|
+
SkillStoneORM,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
'EnergyBead',
|
|
43
|
+
'EnergyBeadBuffAttrORM',
|
|
44
|
+
'EnergyBeadORM',
|
|
45
|
+
'Equip',
|
|
46
|
+
'EquipBonus',
|
|
47
|
+
'EquipBonusAttrORM',
|
|
48
|
+
'EquipBonusORM',
|
|
49
|
+
'EquipEffectiveOccasion',
|
|
50
|
+
'EquipEffectiveOccasionORM',
|
|
51
|
+
'EquipORM',
|
|
52
|
+
'EquipType',
|
|
53
|
+
'EquipTypeORM',
|
|
54
|
+
'Gem',
|
|
55
|
+
'GemCategory',
|
|
56
|
+
'GemCategoryORM',
|
|
57
|
+
'GemGen1',
|
|
58
|
+
'GemGen1PartORM',
|
|
59
|
+
'GemGen2',
|
|
60
|
+
'GemGen2PartORM',
|
|
61
|
+
'GemGenCategory',
|
|
62
|
+
'GemGenCategoryORM',
|
|
63
|
+
'GemORM',
|
|
64
|
+
'GemORM',
|
|
65
|
+
'Item',
|
|
66
|
+
'ItemCategory',
|
|
67
|
+
'ItemCategoryORM',
|
|
68
|
+
'ItemORM',
|
|
69
|
+
'SkillActivationItem',
|
|
70
|
+
'SkillActivationItemORM',
|
|
71
|
+
'SkillStone',
|
|
72
|
+
'SkillStoneCategory',
|
|
73
|
+
'SkillStoneCategoryORM',
|
|
74
|
+
'SkillStoneEffect',
|
|
75
|
+
'SkillStoneEffectORM',
|
|
76
|
+
'SkillStoneORM',
|
|
77
|
+
'Suit',
|
|
78
|
+
'SuitBonus',
|
|
79
|
+
'SuitBonusAttrORM',
|
|
80
|
+
'SuitBonusORM',
|
|
81
|
+
'SuitORM',
|
|
82
|
+
]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Optional
|
|
2
|
+
|
|
3
|
+
from sqlmodel import Field, Relationship
|
|
4
|
+
|
|
5
|
+
from seerapi_models.build_model import BaseCategoryModel, BaseResModel, ConvertToORM
|
|
6
|
+
from seerapi_models.common import ResourceRef
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .enegry_bead import EnergyBeadORM
|
|
10
|
+
from .equip import EquipORM
|
|
11
|
+
from .mintmark_gem import GemORM
|
|
12
|
+
from .skill_activation_item import SkillActivationItemORM
|
|
13
|
+
from .skill_stone import SkillStoneORM
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ItemBase(BaseResModel):
|
|
17
|
+
name: str = Field(description='物品名称')
|
|
18
|
+
desc: str | None = Field(
|
|
19
|
+
default=None, description='物品描述,可能为空(在游戏内显示为默认描述)'
|
|
20
|
+
)
|
|
21
|
+
max: int = Field(description='物品最大数量')
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def resource_name(cls) -> str:
|
|
25
|
+
return 'item'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Item(ItemBase, ConvertToORM['ItemORM']):
|
|
29
|
+
category: ResourceRef['ItemCategory'] = Field(description='物品分类')
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def get_orm_model(cls) -> type['ItemORM']:
|
|
33
|
+
return ItemORM
|
|
34
|
+
|
|
35
|
+
def to_orm(self) -> 'ItemORM':
|
|
36
|
+
return ItemORM(
|
|
37
|
+
id=self.id,
|
|
38
|
+
name=self.name,
|
|
39
|
+
desc=self.desc,
|
|
40
|
+
max=self.max,
|
|
41
|
+
category_id=self.category.id,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ItemORM(ItemBase, table=True):
|
|
46
|
+
skill_stone: Optional['SkillStoneORM'] = Relationship(
|
|
47
|
+
back_populates='item',
|
|
48
|
+
)
|
|
49
|
+
energy_bead: Optional['EnergyBeadORM'] = Relationship(
|
|
50
|
+
back_populates='item',
|
|
51
|
+
)
|
|
52
|
+
skill_activation_item: Optional['SkillActivationItemORM'] = Relationship(
|
|
53
|
+
back_populates='item',
|
|
54
|
+
)
|
|
55
|
+
equip: Optional['EquipORM'] = Relationship(
|
|
56
|
+
back_populates='item',
|
|
57
|
+
)
|
|
58
|
+
gem: Optional['GemORM'] = Relationship(
|
|
59
|
+
back_populates='item',
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
category_id: int = Field(foreign_key='item_category.id')
|
|
63
|
+
category: 'ItemCategoryORM' = Relationship(
|
|
64
|
+
back_populates='item',
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ItemCategoryBase(BaseCategoryModel):
|
|
69
|
+
name: str = Field(description='物品分类名称')
|
|
70
|
+
max: int = Field(description='物品最大数量')
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def resource_name(cls) -> str:
|
|
74
|
+
return 'item_category'
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class ItemCategory(ItemCategoryBase, ConvertToORM['ItemCategoryORM']):
|
|
78
|
+
item: list[ResourceRef['Item']] = Field(
|
|
79
|
+
default_factory=list, description='该分类下的所有物品'
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def get_orm_model(cls) -> type['ItemCategoryORM']:
|
|
84
|
+
return ItemCategoryORM
|
|
85
|
+
|
|
86
|
+
def to_orm(self) -> 'ItemCategoryORM':
|
|
87
|
+
return ItemCategoryORM(
|
|
88
|
+
id=self.id,
|
|
89
|
+
name=self.name,
|
|
90
|
+
max=self.max,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ItemCategoryORM(ItemCategoryBase, table=True):
|
|
95
|
+
item: list['ItemORM'] = Relationship(back_populates='category')
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from sqlmodel import Field, Relationship
|
|
4
|
+
|
|
5
|
+
from seerapi_models.build_model import BaseResModel, ConvertToORM
|
|
6
|
+
from seerapi_models.common import (
|
|
7
|
+
EidEffectInUse,
|
|
8
|
+
EidEffectInUseORM,
|
|
9
|
+
ResourceRef,
|
|
10
|
+
SixAttributes,
|
|
11
|
+
SixAttributesORM,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from ._common import Item, ItemORM
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class EnergyBeadBase(BaseResModel):
|
|
18
|
+
id: int = Field(primary_key=True, foreign_key='item.id', description='能量珠ID')
|
|
19
|
+
name: str = Field(description='能量珠名称')
|
|
20
|
+
desc: str = Field(description='能量珠描述')
|
|
21
|
+
idx: int = Field(description='能量珠效果ID')
|
|
22
|
+
use_times: int = Field(description='使用次数')
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def resource_name(cls) -> str:
|
|
26
|
+
return 'energy_bead'
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class EnergyBead(EnergyBeadBase, ConvertToORM['EnergyBeadORM']):
|
|
30
|
+
item: ResourceRef['Item'] = Field(description='能量珠物品资源引用')
|
|
31
|
+
effect: EidEffectInUse = Field(description='能量珠效果')
|
|
32
|
+
ability_buff: SixAttributes | None = Field(
|
|
33
|
+
default=None, description='能力加成数值,仅当能量珠效果为属性加成时有效'
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def get_orm_model(cls) -> type['EnergyBeadORM']:
|
|
38
|
+
return EnergyBeadORM
|
|
39
|
+
|
|
40
|
+
def to_orm(self) -> 'EnergyBeadORM':
|
|
41
|
+
return EnergyBeadORM(
|
|
42
|
+
id=self.id,
|
|
43
|
+
name=self.name,
|
|
44
|
+
desc=self.desc,
|
|
45
|
+
idx=self.idx,
|
|
46
|
+
effect_in_use=self.effect.to_orm(),
|
|
47
|
+
use_times=self.use_times,
|
|
48
|
+
ability_buff=EnergyBeadBuffAttrORM(
|
|
49
|
+
**self.ability_buff.model_dump(),
|
|
50
|
+
)
|
|
51
|
+
if self.ability_buff
|
|
52
|
+
else None,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class EnergyBeadORM(EnergyBeadBase, table=True):
|
|
57
|
+
effect_in_use: 'EidEffectInUseORM' = Relationship(
|
|
58
|
+
back_populates='energy_bead',
|
|
59
|
+
sa_relationship_kwargs={
|
|
60
|
+
'primaryjoin': 'EnergyBeadORM.effect_in_use_id == EidEffectInUseORM.id',
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
effect_in_use_id: int | None = Field(
|
|
64
|
+
default=None, foreign_key='eid_effect_in_use.id'
|
|
65
|
+
)
|
|
66
|
+
ability_buff: Optional['EnergyBeadBuffAttrORM'] = Relationship(
|
|
67
|
+
back_populates='energy_bead',
|
|
68
|
+
sa_relationship_kwargs={
|
|
69
|
+
'uselist': False,
|
|
70
|
+
'primaryjoin': 'EnergyBeadORM.id == EnergyBeadBuffAttrORM.id',
|
|
71
|
+
},
|
|
72
|
+
)
|
|
73
|
+
item: 'ItemORM' = Relationship(back_populates='energy_bead')
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class EnergyBeadBuffAttrORM(SixAttributesORM, table=True):
|
|
77
|
+
id: int | None = Field(
|
|
78
|
+
default=None,
|
|
79
|
+
primary_key=True,
|
|
80
|
+
foreign_key='energy_bead.id',
|
|
81
|
+
description='能量珠能力加成ID',
|
|
82
|
+
)
|
|
83
|
+
energy_bead: 'EnergyBeadORM' = Relationship(
|
|
84
|
+
back_populates='ability_buff',
|
|
85
|
+
sa_relationship_kwargs={
|
|
86
|
+
'uselist': False,
|
|
87
|
+
'primaryjoin': 'EnergyBeadORM.id == EnergyBeadBuffAttrORM.id',
|
|
88
|
+
},
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def resource_name(cls) -> str:
|
|
93
|
+
return 'energy_bead_buff_attr'
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Optional
|
|
2
|
+
from typing_extensions import Self
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
from sqlmodel import Field, Relationship, SQLModel
|
|
6
|
+
|
|
7
|
+
from seerapi_models.build_model import (
|
|
8
|
+
BaseCategoryModel,
|
|
9
|
+
BaseResModel,
|
|
10
|
+
BaseResModelWithOptionalId,
|
|
11
|
+
ConvertToORM,
|
|
12
|
+
)
|
|
13
|
+
from seerapi_models.common import (
|
|
14
|
+
EidEffectInUse,
|
|
15
|
+
EidEffectInUseORM,
|
|
16
|
+
ResourceRef,
|
|
17
|
+
SixAttributes,
|
|
18
|
+
SixAttributesORM,
|
|
19
|
+
)
|
|
20
|
+
from seerapi_models.items._common import Item, ItemORM
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from seerapi_models.pet import Pet, PetORM
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SuitBonusAttrORM(SixAttributesORM, table=True):
|
|
27
|
+
suit_bonus: 'SuitBonusORM' = Relationship(
|
|
28
|
+
back_populates='attribute',
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def resource_name(cls) -> str:
|
|
33
|
+
return 'suit_bonus_attr'
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class EquipBonusAttrORM(SixAttributesORM, table=True):
|
|
37
|
+
equip_bonus: 'EquipBonusORM' = Relationship(
|
|
38
|
+
back_populates='attribute',
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
@classmethod
|
|
42
|
+
def resource_name(cls) -> str:
|
|
43
|
+
return 'equip_bonus_attr'
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PkAttribute(BaseModel):
|
|
47
|
+
"""装备PK加成(战队保卫战等远古活动使用)"""
|
|
48
|
+
|
|
49
|
+
pk_hp: int = Field(description='装备提供的血量加成')
|
|
50
|
+
pk_atk: int = Field(description='装备提供的攻击力加成')
|
|
51
|
+
pk_fire_range: int = Field(description='装备提供的射击范围加成')
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class OtherAttribute(BaseModel):
|
|
55
|
+
hit_rate: int = Field(default=0, description='命中加成')
|
|
56
|
+
dodge_rate: int = Field(default=0, description='闪避加成')
|
|
57
|
+
crit_rate: int = Field(default=0, description='暴击加成')
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_list(cls, other_attr_args: list[int]) -> Self:
|
|
61
|
+
return cls(
|
|
62
|
+
hit_rate=other_attr_args[0],
|
|
63
|
+
dodge_rate=other_attr_args[1],
|
|
64
|
+
crit_rate=other_attr_args[2],
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class PetSuitLink(SQLModel, table=True):
|
|
69
|
+
pet_id: int | None = Field(default=None, foreign_key='pet.id', primary_key=True)
|
|
70
|
+
suit_id: int | None = Field(
|
|
71
|
+
default=None, foreign_key='suit_bonus.id', primary_key=True
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class EquipEffect(SQLModel):
|
|
76
|
+
newse_id: int | None = Field(
|
|
77
|
+
default=None,
|
|
78
|
+
description='部件特性ID,一部分套装使用该字段来表示效果',
|
|
79
|
+
)
|
|
80
|
+
eid_effect: EidEffectInUse | None = Field(
|
|
81
|
+
default=None,
|
|
82
|
+
description='部件效果,一部分套装使用该字段来表示效果',
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class EquipBonusBase(BaseResModelWithOptionalId):
|
|
87
|
+
desc: str = Field(description='部件描述')
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def resource_name(cls) -> str:
|
|
91
|
+
return 'equip_bonus'
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class EquipBonus(EquipBonusBase, EquipEffect, ConvertToORM['EquipBonusORM']):
|
|
95
|
+
attribute: SixAttributes | None = Field(
|
|
96
|
+
default=None, description='属性加成,仅在部件有属性加成时有效'
|
|
97
|
+
)
|
|
98
|
+
other_attribute: OtherAttribute | None = Field(
|
|
99
|
+
default=None, description='其他属性加成,仅在部件有命中/闪避/暴击加成时有效'
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def get_orm_model(cls) -> type['EquipBonusORM']:
|
|
104
|
+
return EquipBonusORM
|
|
105
|
+
|
|
106
|
+
def to_orm(self) -> 'EquipBonusORM':
|
|
107
|
+
other_attr_kwargs = (
|
|
108
|
+
self.other_attribute.model_dump() if self.other_attribute else {}
|
|
109
|
+
)
|
|
110
|
+
effect_in_use_orm = None
|
|
111
|
+
if self.eid_effect:
|
|
112
|
+
effect_in_use_orm = self.eid_effect.to_orm()
|
|
113
|
+
|
|
114
|
+
return EquipBonusORM(
|
|
115
|
+
id=self.id,
|
|
116
|
+
desc=self.desc,
|
|
117
|
+
effect_in_use=effect_in_use_orm,
|
|
118
|
+
newse_id=self.newse_id,
|
|
119
|
+
attribute=EquipBonusAttrORM(**self.attribute.model_dump())
|
|
120
|
+
if self.attribute
|
|
121
|
+
else None,
|
|
122
|
+
**other_attr_kwargs,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class EquipBonusORM(EquipBonusBase, table=True):
|
|
127
|
+
equip: 'EquipORM' = Relationship(
|
|
128
|
+
back_populates='bonus',
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
effect_in_use_id: int | None = Field(foreign_key='eid_effect_in_use.id')
|
|
132
|
+
effect_in_use: Optional['EidEffectInUseORM'] = Relationship(
|
|
133
|
+
back_populates='equip_bonus',
|
|
134
|
+
)
|
|
135
|
+
newse_id: int | None = Field(default=None)
|
|
136
|
+
attribute_id: int | None = Field(default=None, foreign_key='equip_bonus_attr.id')
|
|
137
|
+
attribute: Optional['EquipBonusAttrORM'] = Relationship(
|
|
138
|
+
back_populates='equip_bonus',
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
hit_rate: int | None = Field(default=None)
|
|
142
|
+
dodge_rate: int | None = Field(default=None)
|
|
143
|
+
crit_rate: int | None = Field(default=None)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class SuitBonusBase(BaseResModel):
|
|
147
|
+
id: int = Field(
|
|
148
|
+
description='套装效果ID',
|
|
149
|
+
primary_key=True,
|
|
150
|
+
foreign_key='suit.id',
|
|
151
|
+
)
|
|
152
|
+
desc: str = Field(description='套装描述')
|
|
153
|
+
|
|
154
|
+
@classmethod
|
|
155
|
+
def resource_name(cls) -> str:
|
|
156
|
+
return 'suit_bonus'
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class SuitBonus(SuitBonusBase, EquipEffect, ConvertToORM['SuitBonusORM']):
|
|
160
|
+
effective_pets: list[ResourceRef['Pet']] | None = Field(
|
|
161
|
+
default=None,
|
|
162
|
+
description='表示套装效果仅在这些精灵上生效,null表示对所有精灵都生效',
|
|
163
|
+
)
|
|
164
|
+
attribute: SixAttributes | None = Field(
|
|
165
|
+
default=None, description='属性加成,仅在套装效果为属性加成时有效'
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def get_orm_model(cls) -> type['SuitBonusORM']:
|
|
170
|
+
return SuitBonusORM
|
|
171
|
+
|
|
172
|
+
def to_orm(self) -> 'SuitBonusORM':
|
|
173
|
+
effect_in_use_orm = None
|
|
174
|
+
if self.eid_effect:
|
|
175
|
+
effect_in_use_orm = self.eid_effect.to_orm()
|
|
176
|
+
|
|
177
|
+
return SuitBonusORM(
|
|
178
|
+
id=self.id,
|
|
179
|
+
desc=self.desc,
|
|
180
|
+
newse_id=self.newse_id,
|
|
181
|
+
effect_in_use=effect_in_use_orm,
|
|
182
|
+
attribute=SuitBonusAttrORM(**self.attribute.model_dump())
|
|
183
|
+
if self.attribute
|
|
184
|
+
else None,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class SuitBonusORM(SuitBonusBase, table=True):
|
|
189
|
+
suit: 'SuitORM' = Relationship(
|
|
190
|
+
back_populates='bonus',
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
newse_id: int | None = Field(default=None)
|
|
194
|
+
effect_in_use_id: int | None = Field(
|
|
195
|
+
default=None, foreign_key='eid_effect_in_use.id'
|
|
196
|
+
)
|
|
197
|
+
effect_in_use: Optional['EidEffectInUseORM'] = Relationship(
|
|
198
|
+
back_populates='suit_bonus',
|
|
199
|
+
)
|
|
200
|
+
attribute_id: int | None = Field(default=None, foreign_key='suit_bonus_attr.id')
|
|
201
|
+
attribute: Optional['SuitBonusAttrORM'] = Relationship(
|
|
202
|
+
back_populates='suit_bonus',
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
effective_pets: list['PetORM'] = Relationship(
|
|
206
|
+
back_populates='exclusive_suit_bonus',
|
|
207
|
+
link_model=PetSuitLink,
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
class SuitBase(BaseResModel):
|
|
212
|
+
name: str = Field(description='名称')
|
|
213
|
+
transform: bool = Field(description='是否可变形')
|
|
214
|
+
tran_speed: float | None = Field(
|
|
215
|
+
default=None, description='变形速度,仅当该套装可变形时有效'
|
|
216
|
+
)
|
|
217
|
+
suit_desc: str = Field(description='套装描述')
|
|
218
|
+
|
|
219
|
+
@classmethod
|
|
220
|
+
def resource_name(cls) -> str:
|
|
221
|
+
return 'suit'
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class Suit(SuitBase, ConvertToORM['SuitORM']):
|
|
225
|
+
equips: list[ResourceRef['Equip']] = Field(
|
|
226
|
+
default_factory=list, description='部件列表'
|
|
227
|
+
)
|
|
228
|
+
bonus: SuitBonus | None = Field(
|
|
229
|
+
default=None, description='套装效果,仅当该套装为能力加成套装时有效'
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
@classmethod
|
|
233
|
+
def get_orm_model(cls) -> type['SuitORM']:
|
|
234
|
+
return SuitORM
|
|
235
|
+
|
|
236
|
+
def to_orm(self) -> 'SuitORM':
|
|
237
|
+
return SuitORM(
|
|
238
|
+
id=self.id,
|
|
239
|
+
name=self.name,
|
|
240
|
+
transform=self.transform,
|
|
241
|
+
tran_speed=self.tran_speed,
|
|
242
|
+
suit_desc=self.suit_desc,
|
|
243
|
+
bonus=self.bonus.to_orm() if self.bonus else None,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
class SuitORM(SuitBase, table=True):
|
|
248
|
+
equips: list['EquipORM'] = Relationship(
|
|
249
|
+
back_populates='suit',
|
|
250
|
+
)
|
|
251
|
+
bonus: Optional['SuitBonusORM'] = Relationship(
|
|
252
|
+
back_populates='suit',
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
class EquipBase(BaseResModel):
|
|
257
|
+
id: int = Field(primary_key=True, foreign_key='item.id', description='部件ID')
|
|
258
|
+
name: str = Field(description='部件名称')
|
|
259
|
+
speed: float | None = Field(
|
|
260
|
+
default=None, description='部件速度移动加成,一般只有脚部部件提供'
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
@classmethod
|
|
264
|
+
def resource_name(cls) -> str:
|
|
265
|
+
return 'equip'
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class Equip(EquipBase, ConvertToORM['EquipORM']):
|
|
269
|
+
item: ResourceRef['Item'] = Field(description='装备部件物品资源引用')
|
|
270
|
+
bonus: EquipBonus | None = Field(
|
|
271
|
+
default=None, description='部件效果,仅当该部件为能力加成部件时有效'
|
|
272
|
+
)
|
|
273
|
+
occasion: ResourceRef['EquipEffectiveOccasion'] | None = Field(
|
|
274
|
+
default=None, description='部件生效场合,仅当该部件为能力加成部件时有效'
|
|
275
|
+
)
|
|
276
|
+
suit: ResourceRef[Suit] | None = Field(
|
|
277
|
+
default=None, description='部件所属套装,仅当该部件有套装时有效'
|
|
278
|
+
)
|
|
279
|
+
part_type: ResourceRef['EquipType'] = Field(description='部件类型')
|
|
280
|
+
pk_attribute: PkAttribute | None = Field(
|
|
281
|
+
default=None,
|
|
282
|
+
description='部件PK加成,战队保卫战等老玩法使用,当三个加成项都为0时为null',
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
@classmethod
|
|
286
|
+
def get_orm_model(cls) -> type['EquipORM']:
|
|
287
|
+
return EquipORM
|
|
288
|
+
|
|
289
|
+
def to_orm(self) -> 'EquipORM':
|
|
290
|
+
pk_kwargs = self.pk_attribute.model_dump() if self.pk_attribute else {}
|
|
291
|
+
return EquipORM(
|
|
292
|
+
id=self.id,
|
|
293
|
+
name=self.name,
|
|
294
|
+
speed=self.speed,
|
|
295
|
+
part_type_id=self.part_type.id,
|
|
296
|
+
suit_id=self.suit.id if self.suit else None,
|
|
297
|
+
occasion_id=self.occasion.id if self.occasion else None,
|
|
298
|
+
bonus=self.bonus.to_orm() if self.bonus else None,
|
|
299
|
+
**pk_kwargs,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
class EquipORM(EquipBase, table=True):
|
|
304
|
+
part_type_id: int = Field(foreign_key='equip_type.id')
|
|
305
|
+
part_type: 'EquipTypeORM' = Relationship(
|
|
306
|
+
back_populates='equip',
|
|
307
|
+
)
|
|
308
|
+
suit_id: int | None = Field(default=None, foreign_key='suit.id')
|
|
309
|
+
suit: 'SuitORM' = Relationship(
|
|
310
|
+
back_populates='equips',
|
|
311
|
+
)
|
|
312
|
+
bonus_id: int | None = Field(default=None, foreign_key='equip_bonus.id')
|
|
313
|
+
bonus: Optional['EquipBonusORM'] = Relationship(
|
|
314
|
+
back_populates='equip',
|
|
315
|
+
)
|
|
316
|
+
occasion_id: int | None = Field(
|
|
317
|
+
default=None, foreign_key='equip_effective_occasion.id'
|
|
318
|
+
)
|
|
319
|
+
occasion: 'EquipEffectiveOccasionORM' = Relationship(
|
|
320
|
+
back_populates='equip',
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
pk_hp: int | None = Field(default=None)
|
|
324
|
+
pk_atk: int | None = Field(default=None)
|
|
325
|
+
pk_fire_range: int | None = Field(default=None)
|
|
326
|
+
|
|
327
|
+
item: 'ItemORM' = Relationship(back_populates='equip')
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
class EquipTypeBase(BaseCategoryModel):
|
|
331
|
+
name: str = Field(description='部件类型名称')
|
|
332
|
+
|
|
333
|
+
@classmethod
|
|
334
|
+
def resource_name(cls) -> str:
|
|
335
|
+
return 'equip_type'
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class EquipType(EquipTypeBase, ConvertToORM['EquipTypeORM']):
|
|
339
|
+
equip: list[ResourceRef] = Field(default_factory=list, description='部件列表')
|
|
340
|
+
|
|
341
|
+
@classmethod
|
|
342
|
+
def get_orm_model(cls) -> type['EquipTypeORM']:
|
|
343
|
+
return EquipTypeORM
|
|
344
|
+
|
|
345
|
+
def to_orm(self) -> 'EquipTypeORM':
|
|
346
|
+
return EquipTypeORM(
|
|
347
|
+
id=self.id,
|
|
348
|
+
name=self.name,
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
class EquipTypeORM(EquipTypeBase, table=True):
|
|
353
|
+
equip: list['EquipORM'] = Relationship(
|
|
354
|
+
back_populates='part_type',
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
class EquipEffectiveOccasionBase(BaseCategoryModel):
|
|
359
|
+
description: str = Field(description='部件生效场合描述')
|
|
360
|
+
|
|
361
|
+
@classmethod
|
|
362
|
+
def resource_name(cls) -> str:
|
|
363
|
+
return 'equip_effective_occasion'
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
class EquipEffectiveOccasion(
|
|
367
|
+
EquipEffectiveOccasionBase, ConvertToORM['EquipEffectiveOccasionORM']
|
|
368
|
+
):
|
|
369
|
+
equip: list[ResourceRef] = Field(default_factory=list, description='部件列表')
|
|
370
|
+
|
|
371
|
+
@classmethod
|
|
372
|
+
def get_orm_model(cls) -> type['EquipEffectiveOccasionORM']:
|
|
373
|
+
return EquipEffectiveOccasionORM
|
|
374
|
+
|
|
375
|
+
def to_orm(self) -> 'EquipEffectiveOccasionORM':
|
|
376
|
+
return EquipEffectiveOccasionORM(
|
|
377
|
+
id=self.id,
|
|
378
|
+
description=self.description,
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class EquipEffectiveOccasionORM(EquipEffectiveOccasionBase, table=True):
|
|
383
|
+
equip: list['EquipORM'] = Relationship(back_populates='occasion')
|