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,267 @@
|
|
|
1
|
+
from typing import Optional, cast
|
|
2
|
+
|
|
3
|
+
from sqlmodel import Field, Relationship, SQLModel
|
|
4
|
+
|
|
5
|
+
from seerapi_models.build_model import BaseCategoryModel, BaseResModel, ConvertToORM
|
|
6
|
+
from seerapi_models.common import ResourceRef, SkillEffectInUse, SkillEffectInUseORM
|
|
7
|
+
from seerapi_models.items import Item, ItemORM
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GemEffectLink(SQLModel, table=True):
|
|
11
|
+
gem_id: int | None = Field(default=None, foreign_key='gem.id', primary_key=True)
|
|
12
|
+
skill_effect_in_use_id: int | None = Field(
|
|
13
|
+
default=None, foreign_key='skill_effect_in_use.id', primary_key=True
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class GemBase(BaseResModel):
|
|
18
|
+
id: int = Field(primary_key=True, foreign_key='item.id', description='宝石ID')
|
|
19
|
+
name: str = Field(description='宝石名称')
|
|
20
|
+
level: int = Field(description='宝石等级')
|
|
21
|
+
generation_id: int = Field(
|
|
22
|
+
description='宝石世代', foreign_key='gem_generation_category.id'
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def resource_name(cls) -> str:
|
|
27
|
+
return 'gem'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class GemResRefs(SQLModel):
|
|
31
|
+
next_level_gem: ResourceRef['Gem'] | None = Field(
|
|
32
|
+
default=None,
|
|
33
|
+
description='该宝石的下一等级的引用,当为None时表示该宝石为最高等级',
|
|
34
|
+
)
|
|
35
|
+
category: ResourceRef['GemCategory'] = Field(description='宝石类型引用')
|
|
36
|
+
effect: list[SkillEffectInUse] = Field(description='宝石效果')
|
|
37
|
+
item: ResourceRef['Item'] = Field(description='宝石物品资源引用')
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Gem(GemBase, GemResRefs, ConvertToORM['GemORM']):
|
|
41
|
+
inlay_rate: float | None = Field(default=None, description='镶嵌成功率')
|
|
42
|
+
equivalent_level1_count: int | None = Field(
|
|
43
|
+
default=None, description='相当于多少个1级宝石'
|
|
44
|
+
)
|
|
45
|
+
fail_compensate_range: tuple[int, int] | None = Field(
|
|
46
|
+
default=None, description='当镶嵌失败时返还的宝石的等级范围,仅在1代宝石中有效'
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
upgrade_cost: int | None = Field(
|
|
50
|
+
default=None, description='升级到该等级需要的石之砂数量,仅在2代宝石中有效'
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def get_orm_model(cls) -> type['GemORM']:
|
|
55
|
+
return GemORM
|
|
56
|
+
|
|
57
|
+
def to_orm(self) -> 'GemORM':
|
|
58
|
+
gen1_part = None
|
|
59
|
+
gen2_part = None
|
|
60
|
+
if self.generation_id == 1:
|
|
61
|
+
fail_compensate_range = cast(tuple[int, int], self.fail_compensate_range)
|
|
62
|
+
gen1_part = GemGen1PartORM(
|
|
63
|
+
id=self.id,
|
|
64
|
+
inlay_rate=cast(float, self.inlay_rate),
|
|
65
|
+
equivalent_level1_count=cast(int, self.equivalent_level1_count),
|
|
66
|
+
fail_compensate_level_start=fail_compensate_range[0],
|
|
67
|
+
fail_compensate_level_end=fail_compensate_range[1],
|
|
68
|
+
)
|
|
69
|
+
elif self.generation_id == 2:
|
|
70
|
+
gen2_part = GemGen2PartORM(
|
|
71
|
+
id=self.id,
|
|
72
|
+
upgrade_cost=cast(int, self.upgrade_cost),
|
|
73
|
+
)
|
|
74
|
+
return GemORM(
|
|
75
|
+
id=self.id,
|
|
76
|
+
name=self.name,
|
|
77
|
+
level=self.level,
|
|
78
|
+
generation_id=self.generation_id,
|
|
79
|
+
gen1_part=gen1_part,
|
|
80
|
+
gen2_part=gen2_part,
|
|
81
|
+
next_level_gem_id=self.next_level_gem.id if self.next_level_gem else None,
|
|
82
|
+
category_id=self.category.id,
|
|
83
|
+
skill_effect_in_use=[effect.to_orm() for effect in self.effect],
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
def to_detailed(self) -> 'GemGen1 | GemGen2':
|
|
87
|
+
general_args = {
|
|
88
|
+
'id': self.id,
|
|
89
|
+
'name': self.name,
|
|
90
|
+
'level': self.level,
|
|
91
|
+
'generation_id': self.generation_id,
|
|
92
|
+
'category': self.category,
|
|
93
|
+
'effect': self.effect,
|
|
94
|
+
'next_level_gem': self.next_level_gem,
|
|
95
|
+
'item': self.item,
|
|
96
|
+
}
|
|
97
|
+
if self.generation_id == 1:
|
|
98
|
+
return GemGen1(
|
|
99
|
+
**general_args,
|
|
100
|
+
inlay_rate=cast(float, self.inlay_rate),
|
|
101
|
+
equivalent_level1_count=cast(int, self.equivalent_level1_count),
|
|
102
|
+
fail_compensate_range=cast(tuple[int, int], self.fail_compensate_range),
|
|
103
|
+
)
|
|
104
|
+
else:
|
|
105
|
+
return GemGen2(
|
|
106
|
+
**general_args,
|
|
107
|
+
upgrade_cost=cast(int, self.upgrade_cost),
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class GemGen1(GemBase, GemResRefs):
|
|
112
|
+
inlay_rate: float = Field(description='镶嵌成功率')
|
|
113
|
+
equivalent_level1_count: int = Field(description='相当于多少个1级宝石')
|
|
114
|
+
fail_compensate_range: tuple[int, int] = Field(
|
|
115
|
+
description='当镶嵌失败时返还的宝石的等级范围'
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class GemGen2(GemBase, GemResRefs):
|
|
120
|
+
upgrade_cost: int = Field(description='升级到该等级需要的石之砂数量')
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class GemORM(GemBase, table=True):
|
|
124
|
+
next_level_gem_id: int | None = Field(
|
|
125
|
+
default=None,
|
|
126
|
+
description='该宝石的下一等级的引用,当为None时表示该宝石为最高等级',
|
|
127
|
+
)
|
|
128
|
+
category_id: int = Field(foreign_key='gem_category.id')
|
|
129
|
+
generation: 'GemGenCategoryORM' = Relationship(
|
|
130
|
+
back_populates='gem',
|
|
131
|
+
)
|
|
132
|
+
category: Optional['GemCategoryORM'] = Relationship(
|
|
133
|
+
back_populates='gem',
|
|
134
|
+
sa_relationship_kwargs={
|
|
135
|
+
'primaryjoin': 'GemORM.category_id == GemCategoryORM.id',
|
|
136
|
+
},
|
|
137
|
+
)
|
|
138
|
+
skill_effect_in_use_id: int | None = Field(
|
|
139
|
+
default=None, foreign_key='skill_effect_in_use.id'
|
|
140
|
+
)
|
|
141
|
+
skill_effect_in_use: list['SkillEffectInUseORM'] = Relationship(
|
|
142
|
+
back_populates='gem',
|
|
143
|
+
link_model=GemEffectLink,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
gen1_part: Optional['GemGen1PartORM'] = Relationship(
|
|
147
|
+
back_populates='gem',
|
|
148
|
+
sa_relationship_kwargs={
|
|
149
|
+
'primaryjoin': 'GemORM.id == GemGen1PartORM.id',
|
|
150
|
+
},
|
|
151
|
+
)
|
|
152
|
+
gen2_part: Optional['GemGen2PartORM'] = Relationship(
|
|
153
|
+
back_populates='gem',
|
|
154
|
+
sa_relationship_kwargs={
|
|
155
|
+
'primaryjoin': 'GemORM.id == GemGen2PartORM.id',
|
|
156
|
+
},
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
item: 'ItemORM' = Relationship(back_populates='gem')
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class GemGen1PartORM(BaseResModel, table=True):
|
|
163
|
+
id: int = Field(primary_key=True, foreign_key='gem.id')
|
|
164
|
+
inlay_rate: float = Field(description='镶嵌成功率')
|
|
165
|
+
equivalent_level1_count: int = Field(description='相当于多少个1级宝石')
|
|
166
|
+
|
|
167
|
+
fail_compensate_level_start: int = Field(
|
|
168
|
+
description='当镶嵌失败时返还的宝石的等级范围'
|
|
169
|
+
)
|
|
170
|
+
fail_compensate_level_end: int = Field(
|
|
171
|
+
description='当镶嵌失败时返还的宝石的等级范围'
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
gem: 'GemORM' = Relationship(
|
|
175
|
+
back_populates='gen1_part',
|
|
176
|
+
sa_relationship_kwargs={
|
|
177
|
+
'primaryjoin': 'GemORM.id == GemGen1PartORM.id',
|
|
178
|
+
},
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
@classmethod
|
|
182
|
+
def resource_name(cls) -> str:
|
|
183
|
+
return 'gem_gen1_part'
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class GemGen2PartORM(BaseResModel, table=True):
|
|
187
|
+
id: int = Field(primary_key=True, foreign_key='gem.id')
|
|
188
|
+
upgrade_cost: int = Field(description='升级到该等级需要的石之砂数量')
|
|
189
|
+
|
|
190
|
+
gem: 'GemORM' = Relationship(
|
|
191
|
+
back_populates='gen2_part',
|
|
192
|
+
sa_relationship_kwargs={
|
|
193
|
+
'primaryjoin': 'GemORM.id == GemGen2PartORM.id',
|
|
194
|
+
},
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
@classmethod
|
|
198
|
+
def resource_name(cls) -> str:
|
|
199
|
+
return 'gem_gen2_part'
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
class GemCategoryBase(BaseCategoryModel):
|
|
203
|
+
name: str = Field(description='名称')
|
|
204
|
+
generation_id: int = Field(
|
|
205
|
+
description='宝石世代', foreign_key='gem_generation_category.id'
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
@classmethod
|
|
209
|
+
def resource_name(cls) -> str:
|
|
210
|
+
return 'gem_category'
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class GemCategory(GemCategoryBase, ConvertToORM['GemCategoryORM']):
|
|
214
|
+
gem: list[ResourceRef] = Field(default_factory=list, description='宝石列表')
|
|
215
|
+
|
|
216
|
+
@classmethod
|
|
217
|
+
def get_orm_model(cls) -> type['GemCategoryORM']:
|
|
218
|
+
return GemCategoryORM
|
|
219
|
+
|
|
220
|
+
def to_orm(self) -> 'GemCategoryORM':
|
|
221
|
+
return GemCategoryORM(
|
|
222
|
+
id=self.id,
|
|
223
|
+
name=self.name,
|
|
224
|
+
generation_id=self.generation_id,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class GemCategoryORM(GemCategoryBase, table=True):
|
|
229
|
+
gem: list['GemORM'] = Relationship(
|
|
230
|
+
back_populates='category',
|
|
231
|
+
)
|
|
232
|
+
generation: list['GemGenCategoryORM'] = Relationship(
|
|
233
|
+
back_populates='category',
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class GemGenCategoryBase(BaseCategoryModel):
|
|
238
|
+
@classmethod
|
|
239
|
+
def resource_name(cls) -> str:
|
|
240
|
+
return 'gem_generation_category'
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class GemGenCategory(GemGenCategoryBase, ConvertToORM['GemGenCategoryORM']):
|
|
244
|
+
gem_category: list[ResourceRef] = Field(
|
|
245
|
+
default_factory=list, description='宝石类别列表'
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
@classmethod
|
|
249
|
+
def get_orm_model(cls) -> type['GemGenCategoryORM']:
|
|
250
|
+
return GemGenCategoryORM
|
|
251
|
+
|
|
252
|
+
def to_orm(self) -> 'GemGenCategoryORM':
|
|
253
|
+
return GemGenCategoryORM(
|
|
254
|
+
id=self.id,
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class GemGenCategoryORM(GemGenCategoryBase, table=True):
|
|
259
|
+
gem: list['GemORM'] = Relationship(
|
|
260
|
+
back_populates='generation',
|
|
261
|
+
sa_relationship_kwargs={
|
|
262
|
+
'primaryjoin': 'GemORM.generation_id == GemGenCategoryORM.id',
|
|
263
|
+
},
|
|
264
|
+
)
|
|
265
|
+
category: 'GemCategoryORM' = Relationship(
|
|
266
|
+
back_populates='generation',
|
|
267
|
+
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from sqlmodel import Field, Relationship
|
|
2
|
+
|
|
3
|
+
from seerapi_models.build_model import BaseResModel, ConvertToORM
|
|
4
|
+
from seerapi_models.common import ResourceRef
|
|
5
|
+
from seerapi_models.pet import Pet, SkillInPetORM
|
|
6
|
+
from seerapi_models.skill import Skill
|
|
7
|
+
|
|
8
|
+
from ._common import Item, ItemORM
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SkillActivationItemBase(BaseResModel):
|
|
12
|
+
id: int = Field(
|
|
13
|
+
primary_key=True, foreign_key='item.id', description='技能激活道具ID'
|
|
14
|
+
)
|
|
15
|
+
name: str = Field(description='技能激活道具名称')
|
|
16
|
+
item_number: int = Field(description='激活技能需要的该道具数量')
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
def resource_name(cls) -> str:
|
|
20
|
+
return 'skill_activation_item'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SkillActivationItem(
|
|
24
|
+
SkillActivationItemBase, ConvertToORM['SkillActivationItemORM']
|
|
25
|
+
):
|
|
26
|
+
item: ResourceRef['Item'] = Field(description='道具资源引用')
|
|
27
|
+
skill: ResourceRef['Skill'] = Field(description='使用该道具激活的技能')
|
|
28
|
+
pet: ResourceRef['Pet'] = Field(description='使用该道具的精灵')
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def get_orm_model(cls) -> type['SkillActivationItemORM']:
|
|
32
|
+
return SkillActivationItemORM
|
|
33
|
+
|
|
34
|
+
def to_orm(self) -> 'SkillActivationItemORM':
|
|
35
|
+
return SkillActivationItemORM(
|
|
36
|
+
id=self.id,
|
|
37
|
+
name=self.name,
|
|
38
|
+
item_number=self.item_number,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class SkillActivationItemORM(SkillActivationItemBase, table=True):
|
|
43
|
+
item: 'ItemORM' = Relationship(back_populates='skill_activation_item')
|
|
44
|
+
skill_in_pet: 'SkillInPetORM' = Relationship(back_populates='skill_activation_item')
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from sqlmodel import Field, Relationship, SQLModel
|
|
4
|
+
|
|
5
|
+
from seerapi_models.build_model import (
|
|
6
|
+
BaseCategoryModel,
|
|
7
|
+
BaseResModel,
|
|
8
|
+
BaseResModelWithOptionalId,
|
|
9
|
+
ConvertToORM,
|
|
10
|
+
)
|
|
11
|
+
from seerapi_models.common import ResourceRef, SkillEffectInUse, SkillEffectInUseORM
|
|
12
|
+
|
|
13
|
+
from ._common import Item, ItemORM
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from ..element_type import TypeCombination, TypeCombinationORM
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SkillStoneEffectLink(SQLModel, table=True):
|
|
20
|
+
"""技能石效果链接表"""
|
|
21
|
+
|
|
22
|
+
skill_stone_effect_id: int | None = Field(
|
|
23
|
+
default=None, foreign_key='skill_stone_effect.id', primary_key=True
|
|
24
|
+
)
|
|
25
|
+
effect_in_use_id: int | None = Field(
|
|
26
|
+
default=None, foreign_key='skill_effect_in_use.id', primary_key=True
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SkillStoneEffectBase(BaseResModelWithOptionalId):
|
|
31
|
+
prob: float = Field(description='技能石效果激活概率,0到1之间')
|
|
32
|
+
skill_stone_id: int = Field(
|
|
33
|
+
description='技能石ID', foreign_key='skill_stone.id', exclude=True
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def resource_name(cls) -> str:
|
|
38
|
+
return 'skill_stone_effect'
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class SkillStoneEffect(SkillStoneEffectBase, ConvertToORM['SkillStoneEffectORM']):
|
|
42
|
+
effect: list['SkillEffectInUse'] = Field(description='技能石效果列表')
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def get_orm_model(cls) -> type['SkillStoneEffectORM']:
|
|
46
|
+
return SkillStoneEffectORM
|
|
47
|
+
|
|
48
|
+
def to_orm(self) -> 'SkillStoneEffectORM':
|
|
49
|
+
return SkillStoneEffectORM(
|
|
50
|
+
id=self.id,
|
|
51
|
+
prob=self.prob,
|
|
52
|
+
skill_stone_id=self.skill_stone_id,
|
|
53
|
+
effect=[effect.to_orm() for effect in self.effect],
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class SkillStoneEffectORM(SkillStoneEffectBase, table=True):
|
|
58
|
+
effect: list['SkillEffectInUseORM'] = Relationship(
|
|
59
|
+
back_populates='skill_stone_effect',
|
|
60
|
+
link_model=SkillStoneEffectLink,
|
|
61
|
+
)
|
|
62
|
+
skill_stone: 'SkillStoneORM' = Relationship(back_populates='effect')
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class SkillStoneBase(BaseResModel):
|
|
66
|
+
id: int = Field(primary_key=True, foreign_key='item.id', description='技能石ID')
|
|
67
|
+
name: str = Field(description='技能石名称')
|
|
68
|
+
rank: int = Field(description='技能石等级,1到5分别对应D, C, B, A, S')
|
|
69
|
+
power: int = Field(description='技能石威力')
|
|
70
|
+
max_pp: int = Field(description='技能石最大PP')
|
|
71
|
+
accuracy: int = Field(description='技能石命中率')
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def resource_name(cls) -> str:
|
|
75
|
+
return 'skill_stone'
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class SkillStone(SkillStoneBase, ConvertToORM['SkillStoneORM']):
|
|
79
|
+
category: ResourceRef['SkillStoneCategory'] = Field(description='技能石分类')
|
|
80
|
+
item: ResourceRef['Item'] = Field(description='技能石物品资源引用')
|
|
81
|
+
effect: list['SkillStoneEffect'] = Field(description='完美技能石效果列表')
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def get_orm_model(cls) -> type['SkillStoneORM']:
|
|
85
|
+
return SkillStoneORM
|
|
86
|
+
|
|
87
|
+
def to_orm(self) -> 'SkillStoneORM':
|
|
88
|
+
return SkillStoneORM(
|
|
89
|
+
id=self.id,
|
|
90
|
+
name=self.name,
|
|
91
|
+
rank=self.rank,
|
|
92
|
+
power=self.power,
|
|
93
|
+
max_pp=self.max_pp,
|
|
94
|
+
accuracy=self.accuracy,
|
|
95
|
+
category_id=self.category.id,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class SkillStoneORM(SkillStoneBase, table=True):
|
|
100
|
+
category_id: int = Field(
|
|
101
|
+
description='技能石分类ID', foreign_key='skill_stone_category.id'
|
|
102
|
+
)
|
|
103
|
+
category: 'SkillStoneCategoryORM' = Relationship(
|
|
104
|
+
back_populates='skill_stone',
|
|
105
|
+
)
|
|
106
|
+
item: 'ItemORM' = Relationship(
|
|
107
|
+
back_populates='skill_stone',
|
|
108
|
+
)
|
|
109
|
+
effect: list['SkillStoneEffectORM'] = Relationship(
|
|
110
|
+
back_populates='skill_stone',
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class SkillStoneCategoryBase(BaseCategoryModel):
|
|
115
|
+
name: str = Field(description='技能石分类名称')
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def resource_name(cls) -> str:
|
|
119
|
+
return 'skill_stone_category'
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class SkillStoneCategory(SkillStoneCategoryBase, ConvertToORM['SkillStoneCategoryORM']):
|
|
123
|
+
skill_stone: list[ResourceRef['SkillStone']] = Field(
|
|
124
|
+
default_factory=list,
|
|
125
|
+
description='技能石列表',
|
|
126
|
+
)
|
|
127
|
+
type: ResourceRef['TypeCombination'] = Field(description='技能石类型')
|
|
128
|
+
|
|
129
|
+
@classmethod
|
|
130
|
+
def get_orm_model(cls) -> 'type[SkillStoneCategoryORM]':
|
|
131
|
+
return SkillStoneCategoryORM
|
|
132
|
+
|
|
133
|
+
def to_orm(self) -> 'SkillStoneCategoryORM':
|
|
134
|
+
return SkillStoneCategoryORM(
|
|
135
|
+
id=self.id,
|
|
136
|
+
name=self.name,
|
|
137
|
+
type_id=self.type.id,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class SkillStoneCategoryORM(SkillStoneCategoryBase, table=True):
|
|
142
|
+
type_id: int = Field(
|
|
143
|
+
description='技能石类型ID', foreign_key='element_type_combination.id'
|
|
144
|
+
)
|
|
145
|
+
type: 'TypeCombinationORM' = Relationship(
|
|
146
|
+
back_populates='skill_stone_category',
|
|
147
|
+
)
|
|
148
|
+
skill_stone: list['SkillStoneORM'] = Relationship(
|
|
149
|
+
back_populates='category',
|
|
150
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
from sqlmodel import Field, SQLModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ApiMetadata(BaseModel):
|
|
8
|
+
api_url: str = Field(description='当前API的URL')
|
|
9
|
+
api_version: str = Field(description='API版本')
|
|
10
|
+
generator_name: str = Field(description='生成器名称')
|
|
11
|
+
generator_version: str = Field(description='生成器版本')
|
|
12
|
+
generate_time: datetime = Field(
|
|
13
|
+
default_factory=datetime.now,
|
|
14
|
+
description='生成时间',
|
|
15
|
+
)
|
|
16
|
+
data_source: str = Field(
|
|
17
|
+
default='',
|
|
18
|
+
description='数据源,可填写git仓库地址或url',
|
|
19
|
+
)
|
|
20
|
+
data_version: str = Field(
|
|
21
|
+
default='',
|
|
22
|
+
description='数据版本',
|
|
23
|
+
)
|
|
24
|
+
patch_source: str = Field(
|
|
25
|
+
default='',
|
|
26
|
+
description='补丁源,可填写git仓库地址或url',
|
|
27
|
+
)
|
|
28
|
+
patch_version: str = Field(
|
|
29
|
+
default='',
|
|
30
|
+
description='补丁版本',
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
def to_orm(self) -> 'ApiMetadataORM':
|
|
34
|
+
return ApiMetadataORM(
|
|
35
|
+
api_url=self.api_url,
|
|
36
|
+
api_version=self.api_version,
|
|
37
|
+
generator_name=self.generator_name,
|
|
38
|
+
generator_version=self.generator_version,
|
|
39
|
+
generate_time=self.generate_time,
|
|
40
|
+
data_source=self.data_source,
|
|
41
|
+
data_version=self.data_version,
|
|
42
|
+
patch_source=self.patch_source,
|
|
43
|
+
patch_version=self.patch_version,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class ApiMetadataORM(ApiMetadata, SQLModel, table=True):
|
|
48
|
+
__tablename__ = 'api_metadata' # type: ignore
|
|
49
|
+
id: int | None = Field(default=None, description='ID', primary_key=True)
|