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,482 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Optional, cast
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
from sqlmodel import Field, Integer, Relationship, SQLModel
|
|
5
|
+
|
|
6
|
+
from seerapi_models.build_model import (
|
|
7
|
+
BaseCategoryModel,
|
|
8
|
+
BaseResModel,
|
|
9
|
+
ConvertToORM,
|
|
10
|
+
)
|
|
11
|
+
from seerapi_models.common import ResourceRef, SixAttributes, SixAttributesORM
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from seerapi_models.element_type import TypeCombination, TypeCombinationORM
|
|
15
|
+
from seerapi_models.items import (
|
|
16
|
+
SkillActivationItem,
|
|
17
|
+
SkillActivationItemORM,
|
|
18
|
+
SuitBonusORM,
|
|
19
|
+
)
|
|
20
|
+
from seerapi_models.mintmark import MintmarkORM
|
|
21
|
+
from seerapi_models.skill import Skill, SkillORM
|
|
22
|
+
|
|
23
|
+
from . import (
|
|
24
|
+
PetArchiveStoryEntry,
|
|
25
|
+
PetArchiveStoryEntryORM,
|
|
26
|
+
PetEncyclopediaEntry,
|
|
27
|
+
PetEncyclopediaEntryORM,
|
|
28
|
+
PetSkinORM,
|
|
29
|
+
Soulmark,
|
|
30
|
+
SoulmarkORM,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class BaseStatORM(SixAttributesORM, table=True):
|
|
35
|
+
id: int | None = Field(
|
|
36
|
+
default=None,
|
|
37
|
+
primary_key=True,
|
|
38
|
+
foreign_key='pet.id',
|
|
39
|
+
)
|
|
40
|
+
pet: 'PetORM' = Relationship(
|
|
41
|
+
back_populates='base_stats',
|
|
42
|
+
sa_relationship_kwargs={
|
|
43
|
+
'primaryjoin': 'BaseStatORM.id == PetORM.id',
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def resource_name(cls) -> str:
|
|
49
|
+
return 'pet_base_stats'
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class YieldingEvORM(SixAttributesORM, table=True):
|
|
53
|
+
id: int | None = Field(default=None, primary_key=True, foreign_key='pet.id')
|
|
54
|
+
pet: 'PetORM' = Relationship(
|
|
55
|
+
back_populates='yielding_ev',
|
|
56
|
+
sa_relationship_kwargs={
|
|
57
|
+
'primaryjoin': 'YieldingEvORM.id == PetORM.id',
|
|
58
|
+
},
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def resource_name(cls) -> str:
|
|
63
|
+
return 'pet_yielding_ev'
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class DiyStatsRangeORM(BaseResModel, table=True):
|
|
67
|
+
id: int = Field(default=None, primary_key=True, foreign_key='pet.id')
|
|
68
|
+
pet: 'PetORM' = Relationship(
|
|
69
|
+
back_populates='diy_stats',
|
|
70
|
+
sa_relationship_kwargs={
|
|
71
|
+
'primaryjoin': 'DiyStatsRangeORM.id == PetORM.id',
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
atk_min: int = Field(description='精灵自定义种族值攻击最小值')
|
|
75
|
+
def_min: int = Field(description='精灵自定义种族值防御最小值')
|
|
76
|
+
sp_atk_min: int = Field(description='精灵自定义种族值特攻最小值')
|
|
77
|
+
sp_def_min: int = Field(description='精灵自定义种族值特防最小值')
|
|
78
|
+
spd_min: int = Field(description='精灵自定义种族值速度最小值')
|
|
79
|
+
hp_min: int = Field(description='精灵自定义种族值体力最小值')
|
|
80
|
+
atk_max: int = Field(description='精灵自定义种族值攻击最大值')
|
|
81
|
+
def_max: int = Field(description='精灵自定义种族值防御最大值')
|
|
82
|
+
sp_atk_max: int = Field(description='精灵自定义种族值特攻最大值')
|
|
83
|
+
sp_def_max: int = Field(description='精灵自定义种族值特防最大值')
|
|
84
|
+
spd_max: int = Field(description='精灵自定义种族值速度最大值')
|
|
85
|
+
hp_max: int = Field(description='精灵自定义种族值体力最大值')
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def resource_name(cls) -> str:
|
|
89
|
+
return 'pet_diy_stats_range'
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class DiyStatsRange(BaseModel):
|
|
93
|
+
min: SixAttributes = Field(description='精灵自定义种族值最小值')
|
|
94
|
+
max: SixAttributes = Field(description='精灵自定义种族值最大值')
|
|
95
|
+
|
|
96
|
+
def to_orm(self, pet_id: int) -> DiyStatsRangeORM:
|
|
97
|
+
"""将DiyStats转换为DiyStatsRangeORM"""
|
|
98
|
+
return DiyStatsRangeORM(
|
|
99
|
+
id=pet_id,
|
|
100
|
+
atk_min=self.min.atk,
|
|
101
|
+
def_min=self.min.def_,
|
|
102
|
+
sp_atk_min=self.min.sp_atk,
|
|
103
|
+
sp_def_min=self.min.sp_def,
|
|
104
|
+
spd_min=self.min.spd,
|
|
105
|
+
hp_min=self.min.hp,
|
|
106
|
+
atk_max=self.max.atk,
|
|
107
|
+
def_max=self.max.def_,
|
|
108
|
+
sp_atk_max=self.max.sp_atk,
|
|
109
|
+
sp_def_max=self.max.sp_def,
|
|
110
|
+
spd_max=self.max.spd,
|
|
111
|
+
hp_max=self.max.hp,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class SkillInPetBase(BaseResModel):
|
|
116
|
+
id: int = Field(
|
|
117
|
+
exclude=True,
|
|
118
|
+
primary_key=True,
|
|
119
|
+
foreign_key='skill.id',
|
|
120
|
+
sa_type=Integer,
|
|
121
|
+
sa_column_kwargs={
|
|
122
|
+
'name': 'skill_id',
|
|
123
|
+
},
|
|
124
|
+
schema_extra={
|
|
125
|
+
'serialization_alias': 'skill_id',
|
|
126
|
+
},
|
|
127
|
+
)
|
|
128
|
+
pet_id: int = Field(primary_key=True, foreign_key='pet.id', exclude=True)
|
|
129
|
+
learning_level: int | None = Field(
|
|
130
|
+
default=None,
|
|
131
|
+
description='技能的学习等级,当该技能无法通过升级获得时,该字段为null',
|
|
132
|
+
)
|
|
133
|
+
is_special: bool = Field(default=False, description='是否是特训技能')
|
|
134
|
+
is_advanced: bool = Field(default=False, description='是否是神谕觉醒技能')
|
|
135
|
+
is_fifth: bool = Field(default=False, description='是否是第五技能')
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def resource_name(cls) -> str:
|
|
139
|
+
return 'skill_in_pet'
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class SkillInPet(SkillInPetBase, ConvertToORM['SkillInPetORM']):
|
|
143
|
+
skill: ResourceRef['Skill'] = Field(description='技能资源')
|
|
144
|
+
skill_activation_item: ResourceRef['SkillActivationItem'] | None = Field(
|
|
145
|
+
default=None, description='学习该技能需要的激活道具'
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
@classmethod
|
|
149
|
+
def get_orm_model(cls) -> type['SkillInPetORM']:
|
|
150
|
+
return SkillInPetORM
|
|
151
|
+
|
|
152
|
+
def to_orm(self) -> 'SkillInPetORM':
|
|
153
|
+
return SkillInPetORM(
|
|
154
|
+
id=self.id,
|
|
155
|
+
pet_id=self.pet_id,
|
|
156
|
+
learning_level=self.learning_level,
|
|
157
|
+
is_special=self.is_special,
|
|
158
|
+
is_advanced=self.is_advanced,
|
|
159
|
+
is_fifth=self.is_fifth,
|
|
160
|
+
skill_activation_item_id=(
|
|
161
|
+
self.skill_activation_item.id if self.skill_activation_item else None
|
|
162
|
+
),
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class SkillInPetORM(SkillInPetBase, table=True):
|
|
167
|
+
skill: 'SkillORM' = Relationship(back_populates='pet_links')
|
|
168
|
+
pet: 'PetORM' = Relationship(back_populates='skill_links')
|
|
169
|
+
skill_activation_item_id: int | None = Field(
|
|
170
|
+
default=None,
|
|
171
|
+
foreign_key='skill_activation_item.id',
|
|
172
|
+
)
|
|
173
|
+
skill_activation_item: Optional['SkillActivationItemORM'] = Relationship(
|
|
174
|
+
back_populates='skill_in_pet',
|
|
175
|
+
sa_relationship_kwargs={
|
|
176
|
+
'primaryjoin': 'SkillInPetORM.skill_activation_item_id == SkillActivationItemORM.id',
|
|
177
|
+
},
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class PetBase(BaseResModel):
|
|
182
|
+
name: str = Field(description='精灵名称')
|
|
183
|
+
# 精灵基础信息
|
|
184
|
+
yielding_exp: int = Field(description='击败精灵可获得的经验值')
|
|
185
|
+
catch_rate: int = Field(description='精灵捕捉率')
|
|
186
|
+
evolving_lv: int | None = Field(
|
|
187
|
+
default=None, description='精灵进化等级,当精灵无法再通过等级进化时为null'
|
|
188
|
+
)
|
|
189
|
+
# 其他
|
|
190
|
+
releaseable: bool = Field(description='精灵是否可放生')
|
|
191
|
+
fusion_master: bool = Field(description='精灵是否可作为融合精灵的主宠')
|
|
192
|
+
fusion_sub: bool = Field(description='精灵是否可作为融合精灵的副宠')
|
|
193
|
+
has_resistance: bool = Field(description='精灵是否可获得抗性')
|
|
194
|
+
|
|
195
|
+
resource_id: int = Field(description='精灵资源ID')
|
|
196
|
+
enemy_resource_id: int | None = Field(
|
|
197
|
+
default=None,
|
|
198
|
+
description='该精灵在对手侧时使用的资源的ID,仅少数精灵存在这种资源',
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def resource_name(cls) -> str:
|
|
203
|
+
return 'pet'
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class Pet(PetBase, ConvertToORM['PetORM']):
|
|
207
|
+
type: ResourceRef['TypeCombination'] = Field(description='精灵属性')
|
|
208
|
+
gender: ResourceRef['PetGenderCategory'] = Field(description='精灵性别')
|
|
209
|
+
base_stats: SixAttributes = Field(description='精灵种族值')
|
|
210
|
+
pet_class: ResourceRef['PetClass'] | None = Field(
|
|
211
|
+
default=None, description='精灵类别,同一进化链中的精灵属于同一类'
|
|
212
|
+
)
|
|
213
|
+
evolution_chain_index: int = Field(description='该精灵在进化链中的位置,从0开始')
|
|
214
|
+
yielding_ev: SixAttributes = Field(description='击败精灵可获得的学习力')
|
|
215
|
+
vipbuff: ResourceRef['PetVipBuffCategory'] | None = Field(
|
|
216
|
+
default=None, description='精灵VIP加成,仅在闪光/暗黑精灵上使用'
|
|
217
|
+
)
|
|
218
|
+
mount_type: ResourceRef['PetMountTypeCategory'] | None = Field(
|
|
219
|
+
default=None, description='精灵骑乘类型,仅在坐骑精灵上使用'
|
|
220
|
+
)
|
|
221
|
+
diy_stats: DiyStatsRange | None = Field(
|
|
222
|
+
default=None, description='精灵自定义种族值,仅在合体精灵王上使用'
|
|
223
|
+
)
|
|
224
|
+
skill: list['SkillInPet'] = Field(description='精灵可学习的技能')
|
|
225
|
+
soulmark: list[ResourceRef['Soulmark']] | None = Field(
|
|
226
|
+
default=None, description='精灵可持有的魂印'
|
|
227
|
+
)
|
|
228
|
+
# 其他数据
|
|
229
|
+
encyclopedia_entry: ResourceRef['PetEncyclopediaEntry'] | None = Field(
|
|
230
|
+
default=None, description='精灵图鉴条目'
|
|
231
|
+
)
|
|
232
|
+
archive_story_entry: ResourceRef['PetArchiveStoryEntry'] | None = Field(
|
|
233
|
+
default=None, description='精灵故事条目'
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
@classmethod
|
|
237
|
+
def get_orm_model(cls) -> 'type[PetORM]':
|
|
238
|
+
return PetORM
|
|
239
|
+
|
|
240
|
+
def to_orm(self) -> 'PetORM':
|
|
241
|
+
base_stats = BaseStatORM(
|
|
242
|
+
id=self.id,
|
|
243
|
+
**self.base_stats.model_dump(),
|
|
244
|
+
)
|
|
245
|
+
yielding_ev = YieldingEvORM(
|
|
246
|
+
id=self.id,
|
|
247
|
+
**self.yielding_ev.model_dump(),
|
|
248
|
+
)
|
|
249
|
+
diy_stats = self.diy_stats.to_orm(self.id) if self.diy_stats else None
|
|
250
|
+
skill_links = [skill.to_orm() for skill in self.skill]
|
|
251
|
+
return PetORM(
|
|
252
|
+
id=self.id,
|
|
253
|
+
name=self.name,
|
|
254
|
+
yielding_exp=self.yielding_exp,
|
|
255
|
+
catch_rate=self.catch_rate,
|
|
256
|
+
evolving_lv=self.evolving_lv,
|
|
257
|
+
releaseable=self.releaseable,
|
|
258
|
+
fusion_master=self.fusion_master,
|
|
259
|
+
fusion_sub=self.fusion_sub,
|
|
260
|
+
has_resistance=self.has_resistance,
|
|
261
|
+
type_id=self.type.id,
|
|
262
|
+
gender_id=self.gender.id,
|
|
263
|
+
pet_class_id=self.pet_class.id if self.pet_class else None,
|
|
264
|
+
base_stats_id=cast(int, base_stats.id),
|
|
265
|
+
base_stats=base_stats,
|
|
266
|
+
skill_links=skill_links,
|
|
267
|
+
yielding_ev_id=cast(int, yielding_ev.id),
|
|
268
|
+
yielding_ev=yielding_ev,
|
|
269
|
+
vipbuff_id=self.vipbuff.id if self.vipbuff else None,
|
|
270
|
+
mount_type_id=self.mount_type.id if self.mount_type else None,
|
|
271
|
+
diy_stats_id=diy_stats.id if diy_stats else None,
|
|
272
|
+
diy_stats=diy_stats,
|
|
273
|
+
resource_id=self.resource_id,
|
|
274
|
+
enemy_resource_id=self.enemy_resource_id,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class PetORM(PetBase, table=True):
|
|
279
|
+
type_id: int = Field(foreign_key='element_type_combination.id')
|
|
280
|
+
type: 'TypeCombinationORM' = Relationship(
|
|
281
|
+
back_populates='pet',
|
|
282
|
+
)
|
|
283
|
+
gender_id: int = Field(foreign_key='pet_gender.id')
|
|
284
|
+
gender: 'PetGenderORM' = Relationship(
|
|
285
|
+
back_populates='pet',
|
|
286
|
+
)
|
|
287
|
+
pet_class_id: int | None = Field(default=None, foreign_key='pet_class.id')
|
|
288
|
+
pet_class: Optional['PetClassORM'] = Relationship(
|
|
289
|
+
back_populates='evolution_chain',
|
|
290
|
+
)
|
|
291
|
+
base_stats_id: int = Field(foreign_key='pet_base_stats.id')
|
|
292
|
+
base_stats: BaseStatORM = Relationship(
|
|
293
|
+
back_populates='pet',
|
|
294
|
+
sa_relationship_kwargs={
|
|
295
|
+
'primaryjoin': 'PetORM.id == BaseStatORM.id',
|
|
296
|
+
},
|
|
297
|
+
)
|
|
298
|
+
yielding_ev_id: int = Field(foreign_key='pet_yielding_ev.id')
|
|
299
|
+
yielding_ev: YieldingEvORM = Relationship(
|
|
300
|
+
back_populates='pet',
|
|
301
|
+
sa_relationship_kwargs={
|
|
302
|
+
'primaryjoin': 'PetORM.id == YieldingEvORM.id',
|
|
303
|
+
},
|
|
304
|
+
)
|
|
305
|
+
# 技能,魂印
|
|
306
|
+
skill_links: list['SkillInPetORM'] = Relationship(
|
|
307
|
+
back_populates='pet',
|
|
308
|
+
)
|
|
309
|
+
soulmark: list['SoulmarkORM'] = Relationship(
|
|
310
|
+
back_populates='pet',
|
|
311
|
+
sa_relationship_kwargs={
|
|
312
|
+
'secondary': 'petsoulmarklink',
|
|
313
|
+
},
|
|
314
|
+
)
|
|
315
|
+
# 杂项分类
|
|
316
|
+
vipbuff_id: int | None = Field(default=None, foreign_key='pet_vipbuff.id')
|
|
317
|
+
vipbuff: Optional['PetVipBuffORM'] = Relationship(
|
|
318
|
+
back_populates='pet',
|
|
319
|
+
)
|
|
320
|
+
mount_type_id: int | None = Field(default=None, foreign_key='pet_mount_type.id')
|
|
321
|
+
mount_type: Optional['PetMountTypeORM'] = Relationship(
|
|
322
|
+
back_populates='pet',
|
|
323
|
+
)
|
|
324
|
+
diy_stats_id: int | None = Field(default=None, foreign_key='pet_diy_stats_range.id')
|
|
325
|
+
diy_stats: Optional['DiyStatsRangeORM'] = Relationship(
|
|
326
|
+
back_populates='pet',
|
|
327
|
+
sa_relationship_kwargs={
|
|
328
|
+
'primaryjoin': 'PetORM.id == DiyStatsRangeORM.id',
|
|
329
|
+
},
|
|
330
|
+
)
|
|
331
|
+
exclusive_mintmark: list['MintmarkORM'] = Relationship(
|
|
332
|
+
back_populates='pet',
|
|
333
|
+
sa_relationship_kwargs={
|
|
334
|
+
'secondary': 'petmintmarklink',
|
|
335
|
+
},
|
|
336
|
+
)
|
|
337
|
+
exclusive_suit_bonus: list['SuitBonusORM'] = Relationship(
|
|
338
|
+
back_populates='effective_pets',
|
|
339
|
+
sa_relationship_kwargs={
|
|
340
|
+
'secondary': 'petsuitlink',
|
|
341
|
+
},
|
|
342
|
+
)
|
|
343
|
+
skins: list['PetSkinORM'] = Relationship(
|
|
344
|
+
back_populates='pet',
|
|
345
|
+
sa_relationship_kwargs={
|
|
346
|
+
'primaryjoin': 'PetORM.id == PetSkinORM.pet_id',
|
|
347
|
+
},
|
|
348
|
+
)
|
|
349
|
+
encyclopedia: Optional['PetEncyclopediaEntryORM'] = Relationship(
|
|
350
|
+
back_populates='pet',
|
|
351
|
+
sa_relationship_kwargs={
|
|
352
|
+
'primaryjoin': 'PetORM.id == PetEncyclopediaEntryORM.id',
|
|
353
|
+
},
|
|
354
|
+
)
|
|
355
|
+
archive_story: Optional['PetArchiveStoryEntryORM'] = Relationship(
|
|
356
|
+
back_populates='pet',
|
|
357
|
+
sa_relationship_kwargs={
|
|
358
|
+
'primaryjoin': 'PetORM.id == PetArchiveStoryEntryORM.pet_id',
|
|
359
|
+
},
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
class PetClassBase(BaseResModel):
|
|
364
|
+
is_variant_pet: bool = Field(default=False, description='是否是异能精灵')
|
|
365
|
+
is_dark_pet: bool = Field(default=False, description='是否是暗黑精灵')
|
|
366
|
+
is_shine_pet: bool = Field(default=False, description='是否是闪光精灵')
|
|
367
|
+
is_rare_pet: bool = Field(default=False, description='是否是稀有精灵')
|
|
368
|
+
is_breeding_pet: bool = Field(default=False, description='是否是繁殖二代精灵')
|
|
369
|
+
is_fusion_pet: bool = Field(default=False, description='是否是融合二代精灵')
|
|
370
|
+
|
|
371
|
+
@classmethod
|
|
372
|
+
def resource_name(cls) -> str:
|
|
373
|
+
return 'pet_class'
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class PetClass(PetClassBase, ConvertToORM['PetClassORM']):
|
|
377
|
+
"""描述一个精灵类别,所有第一形态为同一ID的精灵为一类"""
|
|
378
|
+
|
|
379
|
+
evolution_chain: list[ResourceRef['Pet']] = Field(
|
|
380
|
+
description='精灵进化链,从第一形态到最终形态的精灵列表'
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
@classmethod
|
|
384
|
+
def get_orm_model(cls) -> type['PetClassORM']:
|
|
385
|
+
return PetClassORM
|
|
386
|
+
|
|
387
|
+
def to_orm(self) -> 'PetClassORM':
|
|
388
|
+
return PetClassORM(
|
|
389
|
+
id=self.id,
|
|
390
|
+
is_variant_pet=self.is_variant_pet,
|
|
391
|
+
is_dark_pet=self.is_dark_pet,
|
|
392
|
+
is_shine_pet=self.is_shine_pet,
|
|
393
|
+
is_rare_pet=self.is_rare_pet,
|
|
394
|
+
is_breeding_pet=self.is_breeding_pet,
|
|
395
|
+
is_fusion_pet=self.is_fusion_pet,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class PetClassORM(PetClassBase, table=True):
|
|
400
|
+
evolution_chain: list['PetORM'] = Relationship(back_populates='pet_class')
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class PetCategoryBase(BaseCategoryModel):
|
|
404
|
+
name: str = Field(description='名称')
|
|
405
|
+
description: str = Field(description='描述')
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
class PetCategoryRefs(SQLModel):
|
|
409
|
+
pet: list[ResourceRef['Pet']] = Field(description='精灵列表')
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
class PetGenderBase(PetCategoryBase):
|
|
413
|
+
@classmethod
|
|
414
|
+
def resource_name(cls) -> str:
|
|
415
|
+
return 'pet_gender'
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
class PetGenderCategory(PetGenderBase, PetCategoryRefs, ConvertToORM['PetGenderORM']):
|
|
419
|
+
@classmethod
|
|
420
|
+
def get_orm_model(cls) -> type['PetGenderORM']:
|
|
421
|
+
return PetGenderORM
|
|
422
|
+
|
|
423
|
+
def to_orm(self) -> 'PetGenderORM':
|
|
424
|
+
return PetGenderORM(
|
|
425
|
+
id=self.id,
|
|
426
|
+
name=self.name,
|
|
427
|
+
description=self.description,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
class PetGenderORM(PetGenderBase, table=True):
|
|
432
|
+
pet: list['PetORM'] = Relationship(back_populates='gender')
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
class PetVipBuffBase(PetCategoryBase):
|
|
436
|
+
@classmethod
|
|
437
|
+
def resource_name(cls) -> str:
|
|
438
|
+
return 'pet_vipbuff'
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
class PetVipBuffCategory(
|
|
442
|
+
PetVipBuffBase, PetCategoryRefs, ConvertToORM['PetVipBuffORM']
|
|
443
|
+
):
|
|
444
|
+
@classmethod
|
|
445
|
+
def get_orm_model(cls) -> type['PetVipBuffORM']:
|
|
446
|
+
return PetVipBuffORM
|
|
447
|
+
|
|
448
|
+
def to_orm(self) -> 'PetVipBuffORM':
|
|
449
|
+
return PetVipBuffORM(
|
|
450
|
+
id=self.id,
|
|
451
|
+
name=self.name,
|
|
452
|
+
description=self.description,
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
class PetVipBuffORM(PetVipBuffBase, table=True):
|
|
457
|
+
pet: list['PetORM'] = Relationship(back_populates='vipbuff')
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class PetMountTypeBase(PetCategoryBase):
|
|
461
|
+
@classmethod
|
|
462
|
+
def resource_name(cls) -> str:
|
|
463
|
+
return 'pet_mount_type'
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class PetMountTypeCategory(
|
|
467
|
+
PetMountTypeBase, PetCategoryRefs, ConvertToORM['PetMountTypeORM']
|
|
468
|
+
):
|
|
469
|
+
@classmethod
|
|
470
|
+
def get_orm_model(cls) -> type['PetMountTypeORM']:
|
|
471
|
+
return PetMountTypeORM
|
|
472
|
+
|
|
473
|
+
def to_orm(self) -> 'PetMountTypeORM':
|
|
474
|
+
return PetMountTypeORM(
|
|
475
|
+
id=self.id,
|
|
476
|
+
name=self.name,
|
|
477
|
+
description=self.description,
|
|
478
|
+
)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
class PetMountTypeORM(PetMountTypeBase, table=True):
|
|
482
|
+
pet: list['PetORM'] = Relationship(back_populates='mount_type')
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from sqlmodel import Field, Relationship
|
|
4
|
+
|
|
5
|
+
from seerapi_models.build_model import BaseResModel, ConvertToORM
|
|
6
|
+
from seerapi_models.common import ResourceRef
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from . import Pet, PetORM
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PetSkinBase(BaseResModel):
|
|
13
|
+
id: int = Field(
|
|
14
|
+
primary_key=True, description='皮肤ID,注意该字段不是头像/立绘等所使用的资源ID'
|
|
15
|
+
)
|
|
16
|
+
name: str = Field(description='皮肤名称')
|
|
17
|
+
resource_id: int = Field(description='皮肤资源ID')
|
|
18
|
+
enemy_resource_id: int | None = Field(
|
|
19
|
+
default=None,
|
|
20
|
+
description='该皮肤在对手侧时使用的资源的ID,仅少数皮肤存在这种资源',
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def resource_name(cls) -> str:
|
|
25
|
+
return 'pet_skin'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class PetSkin(PetSkinBase, ConvertToORM['PetSkinORM']):
|
|
29
|
+
pet: ResourceRef['Pet'] = Field(description='使用该皮肤的精灵')
|
|
30
|
+
category: ResourceRef['PetSkinCategory'] = Field(description='该皮肤所属的系列')
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def get_orm_model(cls) -> type['PetSkinORM']:
|
|
34
|
+
return PetSkinORM
|
|
35
|
+
|
|
36
|
+
def to_orm(self) -> 'PetSkinORM':
|
|
37
|
+
return PetSkinORM(
|
|
38
|
+
id=self.id,
|
|
39
|
+
name=self.name,
|
|
40
|
+
resource_id=self.resource_id,
|
|
41
|
+
pet_id=self.pet.id,
|
|
42
|
+
category_id=self.category.id,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PetSkinORM(PetSkinBase, table=True):
|
|
47
|
+
pet_id: int = Field(foreign_key='pet.id')
|
|
48
|
+
pet: 'PetORM' = Relationship(back_populates='skins')
|
|
49
|
+
category_id: int = Field(foreign_key='pet_skin_category.id')
|
|
50
|
+
category: 'PetSkinCategoryORM' = Relationship(back_populates='skins')
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class PetSkinCategoryBase(BaseResModel):
|
|
54
|
+
id: int = Field(primary_key=True, description='系列ID')
|
|
55
|
+
# name: str = Field(
|
|
56
|
+
# description='系列名称'
|
|
57
|
+
# ) TODO: 该字段可能在数据中不存在,暂时忽略,等待游戏内数据或打补丁补充
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def resource_name(cls) -> str:
|
|
61
|
+
return 'pet_skin_category'
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class PetSkinCategory(PetSkinCategoryBase, ConvertToORM['PetSkinCategoryORM']):
|
|
65
|
+
skins: list[ResourceRef['PetSkin']] = Field(
|
|
66
|
+
default_factory=list, description='该系列的皮肤列表'
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def get_orm_model(cls) -> type['PetSkinCategoryORM']:
|
|
71
|
+
return PetSkinCategoryORM
|
|
72
|
+
|
|
73
|
+
def to_orm(self) -> 'PetSkinCategoryORM':
|
|
74
|
+
return PetSkinCategoryORM(id=self.id)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class PetSkinCategoryORM(PetSkinCategoryBase, table=True):
|
|
78
|
+
skins: list['PetSkinORM'] = Relationship(back_populates='category')
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from sqlmodel import Field, Relationship
|
|
4
|
+
|
|
5
|
+
from seerapi_models.build_model import (
|
|
6
|
+
BaseCategoryModel,
|
|
7
|
+
BaseResModel,
|
|
8
|
+
ConvertToORM,
|
|
9
|
+
)
|
|
10
|
+
from seerapi_models.common import ResourceRef
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from .pet import Pet, PetORM
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PetEncyclopediaEntryBase(BaseResModel):
|
|
17
|
+
id: int = Field(primary_key=True, description='精灵图鉴ID', foreign_key='pet.id')
|
|
18
|
+
name: str = Field(description='精灵名称')
|
|
19
|
+
has_sound: bool = Field(description='精灵是否存在叫声')
|
|
20
|
+
height: float | None = Field(
|
|
21
|
+
default=None,
|
|
22
|
+
description="精灵身高,当这个值在图鉴中为'未知'时,这个值为null",
|
|
23
|
+
)
|
|
24
|
+
weight: float | None = Field(
|
|
25
|
+
default=None,
|
|
26
|
+
description="精灵重量,当这个值在图鉴中为'未知'时,这个值为null",
|
|
27
|
+
)
|
|
28
|
+
foundin: str | None = Field(default=None, description='精灵发现地点')
|
|
29
|
+
food: str | None = Field(default=None, description='精灵喜爱的食物')
|
|
30
|
+
introduction: str = Field(description='精灵介绍')
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def resource_name(cls) -> str:
|
|
34
|
+
return 'pet_encyclopedia_entry'
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class PetEncyclopediaEntry(
|
|
38
|
+
PetEncyclopediaEntryBase, ConvertToORM['PetEncyclopediaEntryORM']
|
|
39
|
+
):
|
|
40
|
+
pet: ResourceRef['Pet'] = Field(description='精灵')
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def get_orm_model(cls) -> type['PetEncyclopediaEntryORM']:
|
|
44
|
+
return PetEncyclopediaEntryORM
|
|
45
|
+
|
|
46
|
+
def to_orm(self) -> 'PetEncyclopediaEntryORM':
|
|
47
|
+
return PetEncyclopediaEntryORM(
|
|
48
|
+
id=self.id,
|
|
49
|
+
name=self.name,
|
|
50
|
+
has_sound=self.has_sound,
|
|
51
|
+
height=self.height,
|
|
52
|
+
weight=self.weight,
|
|
53
|
+
foundin=self.foundin,
|
|
54
|
+
food=self.food,
|
|
55
|
+
introduction=self.introduction,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class PetEncyclopediaEntryORM(PetEncyclopediaEntryBase, table=True):
|
|
60
|
+
pet: 'PetORM' = Relationship(back_populates='encyclopedia')
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class PetArchiveStoryEntryBase(BaseResModel):
|
|
64
|
+
id: int = Field(primary_key=True, description='故事条目ID')
|
|
65
|
+
content: str = Field(description='故事条目内容')
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def resource_name(cls) -> str:
|
|
69
|
+
return 'pet_archive_story_entry'
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class PetArchiveStoryEntry(
|
|
73
|
+
PetArchiveStoryEntryBase, ConvertToORM['PetArchiveStoryEntryORM']
|
|
74
|
+
):
|
|
75
|
+
pet: ResourceRef['Pet'] = Field(description='精灵')
|
|
76
|
+
book: ResourceRef['PetArchiveStoryBook'] = Field(description='故事')
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def get_orm_model(cls) -> type['PetArchiveStoryEntryORM']:
|
|
80
|
+
return PetArchiveStoryEntryORM
|
|
81
|
+
|
|
82
|
+
def to_orm(self) -> 'PetArchiveStoryEntryORM':
|
|
83
|
+
return PetArchiveStoryEntryORM(
|
|
84
|
+
id=self.id, content=self.content, pet_id=self.pet.id, book_id=self.book.id
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class PetArchiveStoryEntryORM(PetArchiveStoryEntryBase, table=True):
|
|
89
|
+
pet_id: int = Field(description='精灵ID', foreign_key='pet.id')
|
|
90
|
+
pet: 'PetORM' = Relationship(back_populates='archive_story')
|
|
91
|
+
book_id: int = Field(
|
|
92
|
+
foreign_key='pet_archive_story_book.id',
|
|
93
|
+
)
|
|
94
|
+
book: 'PetArchiveStoryBookORM' = Relationship(back_populates='entries')
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class PetArchiveStoryBookBase(BaseCategoryModel):
|
|
98
|
+
name: str = Field(description='故事名称')
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def resource_name(cls) -> str:
|
|
102
|
+
return 'pet_archive_story_book'
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class PetArchiveStoryBook(
|
|
106
|
+
PetArchiveStoryBookBase, ConvertToORM['PetArchiveStoryBookORM']
|
|
107
|
+
):
|
|
108
|
+
entries: list[ResourceRef[PetArchiveStoryEntryBase]] = Field(
|
|
109
|
+
default_factory=list, description='故事条目'
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def get_orm_model(cls) -> type['PetArchiveStoryBookORM']:
|
|
114
|
+
return PetArchiveStoryBookORM
|
|
115
|
+
|
|
116
|
+
def to_orm(self) -> 'PetArchiveStoryBookORM':
|
|
117
|
+
return PetArchiveStoryBookORM(
|
|
118
|
+
id=self.id,
|
|
119
|
+
name=self.name,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class PetArchiveStoryBookORM(PetArchiveStoryBookBase, table=True):
|
|
124
|
+
entries: list[PetArchiveStoryEntryORM] = Relationship(back_populates='book')
|