Skip to content

Commit d38b65c

Browse files
committed
Added gacha release
1 parent 8110ab5 commit d38b65c

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
lines changed

app/core/nice/gacha.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from ...schemas.common import Language
44
from ...schemas.gameenums import COND_TYPE_NAME, GACHA_FLAG_NAME, PAY_TYPE_NAME
5-
from ...schemas.nice import GachaStoryAdjust, NiceGacha, NiceGachaSub
5+
from ...schemas.nice import GachaStoryAdjust, NiceGacha, NiceGachaRelease, NiceGachaSub
66
from ...schemas.raw import (
77
GachaEntity,
88
MstCommonRelease,
9+
MstGachaRelease,
910
MstGachaStoryAdjust,
1011
MstGachaSub,
1112
)
@@ -45,6 +46,14 @@ def get_nice_gacha_sub(
4546
)
4647

4748

49+
def get_nice_gacha_release(gacha_release: MstGachaRelease) -> NiceGachaRelease:
50+
return NiceGachaRelease(
51+
type=COND_TYPE_NAME[gacha_release.type],
52+
targetId=gacha_release.targetId,
53+
value=gacha_release.value,
54+
)
55+
56+
4857
def get_nice_gacha(gacha: GachaEntity, lang: Language = Language.jp) -> NiceGacha:
4958
return NiceGacha(
5059
id=gacha.mstGacha.id,
@@ -71,6 +80,9 @@ def get_nice_gacha(gacha: GachaEntity, lang: Language = Language.jp) -> NiceGach
7180
featuredSvtIds=(
7281
gacha.viewGachaFeaturedSvt[0].svtIds if gacha.viewGachaFeaturedSvt else []
7382
),
83+
releaseConditions=[
84+
get_nice_gacha_release(release) for release in gacha.mstGachaRelease
85+
],
7486
)
7587

7688

app/db/helpers/gacha.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from ...models.raw import (
55
mstCommonRelease,
66
mstGacha,
7+
mstGachaRelease,
78
mstGachaStoryAdjust,
89
mstGachaSub,
910
viewGachaFeaturedSvt,
@@ -22,6 +23,7 @@
2223
mstGachaStoryAdjust, mstGacha.c.id == mstGachaStoryAdjust.c.gachaId
2324
)
2425
.outerjoin(mstGachaSub, mstGacha.c.id == mstGachaSub.c.gachaId)
26+
.outerjoin(mstGachaRelease, mstGacha.c.id == mstGachaRelease.c.gachaId)
2527
.outerjoin(mstCommonRelease, mstGachaSub.c.commonReleaseId == mstCommonRelease.c.id)
2628
.outerjoin(viewGachaFeaturedSvt, mstGacha.c.id == viewGachaFeaturedSvt.c.gachaId)
2729
)

app/models/raw.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,17 @@
12941294
Column("commonReleaseId", Integer),
12951295
)
12961296

1297+
1298+
mstGachaRelease = Table(
1299+
"mstGachaRelease",
1300+
metadata,
1301+
Column("gachaId", Integer, index=True),
1302+
Column("type", Integer),
1303+
Column("targetId", Integer),
1304+
Column("value", Integer),
1305+
)
1306+
1307+
12971308
viewGachaFeaturedSvt = Table(
12981309
"viewGachaFeaturedSvt",
12991310
metadata,
@@ -3020,7 +3031,7 @@
30203031
[mstClassBoardLock, mstClassBoardSquare],
30213032
[mstGrandGraph, mstGrandGraphDetail],
30223033
[mstFuncTypeDetail, mstBuffTypeDetail],
3023-
[mstGacha, mstGachaStoryAdjust, mstGachaSub, viewGachaFeaturedSvt],
3034+
[mstGacha, mstGachaStoryAdjust, mstGachaSub, mstGachaRelease, viewGachaFeaturedSvt],
30243035
[mstItemDropEfficiency],
30253036
[mstImagePartsGroup],
30263037
]

app/schemas/nice.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3332,6 +3332,13 @@ class NiceGachaSub(BaseModelORJson):
33323332
script: dict[str, Any] | None = None
33333333

33343334

3335+
class NiceGachaRelease(BaseModelORJson):
3336+
# gachaId: int
3337+
type: NiceCondType
3338+
targetId: int
3339+
value: int
3340+
3341+
33353342
class NiceGacha(BaseModelORJson):
33363343
id: int
33373344
name: str
@@ -3350,3 +3357,4 @@ class NiceGacha(BaseModelORJson):
33503357
storyAdjusts: list[GachaStoryAdjust]
33513358
gachaSubs: list[NiceGachaSub]
33523359
featuredSvtIds: list[int]
3360+
releaseConditions: list[NiceGachaRelease]

app/schemas/raw.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,13 @@ class MstGachaSub(BaseModelORJson):
11281128
commonReleaseId: int
11291129

11301130

1131+
class MstGachaRelease(BaseModelORJson):
1132+
gachaId: int
1133+
type: int
1134+
targetId: int
1135+
value: int
1136+
1137+
11311138
class ViewGachaFeaturedSvt(BaseModelORJson):
11321139
gachaId: int
11331140
svtIds: list[int]
@@ -2683,6 +2690,7 @@ class GachaEntity(BaseModelORJson):
26832690
mstGacha: MstGacha
26842691
mstGachaStoryAdjust: list[MstGachaStoryAdjust]
26852692
mstGachaSub: list[MstGachaSub]
2693+
mstGachaRelease: list[MstGachaRelease]
26862694
viewGachaFeaturedSvt: list[ViewGachaFeaturedSvt]
26872695
mstCommonRelease: list[MstCommonRelease]
26882696

0 commit comments

Comments
 (0)