Skip to content

Commit

Permalink
Added war group
Browse files Browse the repository at this point in the history
  • Loading branch information
narumi147 committed Dec 25, 2024
1 parent 4ce5cf4 commit 0173bdb
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/core/nice/event/campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def get_nice_campaign(campaign: MstEventCampaign) -> NiceEventCampaign:
return NiceEventCampaign(
targetIds=campaign.targetIds,
warIds=campaign.warIds,
warGroupIds=campaign.warGroupIds or [],
target=COMBINE_ADJUST_TARGET_TYPE_NAME[campaign.target],
idx=campaign.idx,
value=campaign.value,
Expand Down
13 changes: 13 additions & 0 deletions app/core/nice/war.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from ...schemas.common import Language, Region
from ...schemas.gameenums import (
COND_TYPE_NAME,
QUEST_AFTER_CLEAR_NAME,
QUEST_TYPE_NAME,
SPOT_OVERWRITE_TYPE_NAME,
WAR_FLAG_NAME,
WAR_OVERWRITE_TYPE_NAME,
Expand All @@ -27,6 +29,7 @@
NiceSpotRoad,
NiceWar,
NiceWarAdd,
NiceWarGroup,
NiceWarQuestSelection,
NiceWarRelease,
)
Expand All @@ -41,6 +44,7 @@
MstSpotRoad,
MstWar,
MstWarAdd,
MstWarGroup,
MstWarQuestSelection,
MstWarRelease,
QuestEntity,
Expand Down Expand Up @@ -185,6 +189,14 @@ def get_nice_war_add(
)


def get_nice_war_group(war_group: MstWarGroup) -> NiceWarGroup:
return NiceWarGroup(
id=war_group.id,
questAfterClear=QUEST_AFTER_CLEAR_NAME[war_group.questAfterClear],
questType=QUEST_TYPE_NAME[war_group.questType],
)


def get_nice_war_quest_selection(
region: Region,
quest_selection: MstWarQuestSelection,
Expand Down Expand Up @@ -454,6 +466,7 @@ async def get_nice_war(
get_nice_war_add(region, war_add, banner_template)
for war_add in raw_war.mstWarAdd
],
groups=[get_nice_war_group(war_group) for war_group in raw_war.mstWarGroup],
maps=[
get_nice_map(
region,
Expand Down
2 changes: 2 additions & 0 deletions app/core/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
MstWarBoardStage,
MstWarBoardStageLayout,
MstWarBoardTreasure,
MstWarGroup,
MstWarQuestSelection,
MstWarRelease,
MysticCodeEntity,
Expand Down Expand Up @@ -899,6 +900,7 @@ async def get_war_entity(conn: AsyncConnection, war_id: int) -> WarEntity:
mstWar=war_db,
mstEvent=await fetch.get_one(conn, MstEvent, war_db.eventId),
mstWarAdd=await fetch.get_all(conn, MstWarAdd, war_id),
mstWarGroup=await fetch.get_all(conn, MstWarGroup, war_id),
mstMap=maps,
mstMapGimmick=await fetch.get_all_multiple(conn, MstMapGimmick, map_ids),
mstBgm=bgms,
Expand Down
3 changes: 3 additions & 0 deletions app/db/helpers/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
mstWarBoardStage,
mstWarBoardStageLayout,
mstWarBoardTreasure,
mstWarGroup,
mstWarQuestSelection,
mstWarRelease,
)
Expand Down Expand Up @@ -265,6 +266,7 @@
MstWarBoardStage,
MstWarBoardStageLayout,
MstWarBoardTreasure,
MstWarGroup,
MstWarQuestSelection,
MstWarRelease,
)
Expand Down Expand Up @@ -384,6 +386,7 @@ async def get_one(
),
MstMap: (mstMap, mstMap.c.warId, mstMap.c.id),
MstWarAdd: (mstWarAdd, mstWarAdd.c.warId, mstWarAdd.c.priority),
MstWarGroup: (mstWarGroup, mstWarGroup.c.warId, mstWarGroup.c.id),
MstWarQuestSelection: (
mstWarQuestSelection,
mstWarQuestSelection.c.warId,
Expand Down
14 changes: 13 additions & 1 deletion app/models/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,7 @@
metadata,
Column("targetIds", ARRAY(Integer)),
Column("warIds", ARRAY(Integer)),
Column("warGroupIds", ARRAY(Integer)),
Column("eventId", Integer, index=True),
Column("target", Integer),
Column("idx", Integer),
Expand Down Expand Up @@ -2077,6 +2078,17 @@
Column("assetId", Integer),
)


mstWarGroup = Table(
"mstWarGroup",
metadata,
Column("id", Integer),
Column("warId", Integer),
Column("questAfterClear", Integer),
Column("questType", Integer),
)


mstMapGimmick = Table(
"mstMapGimmick",
metadata,
Expand Down Expand Up @@ -2905,7 +2917,7 @@
[mstMap],
[mstSpot, mstBlankEarthSpot, mstSpotAdd, mstSpotRoad],
[mstMapGimmick],
[mstWarAdd, mstWarRelease],
[mstWarAdd, mstWarRelease, mstWarGroup],
[mstWarQuestSelection],
[mstEventCampaign],
[mstEventQuest],
Expand Down
9 changes: 9 additions & 0 deletions app/schemas/nice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,7 @@ class NiceEventQuest(BaseModelORJson):
class NiceEventCampaign(BaseModelORJson):
targetIds: list[int]
warIds: list[int]
warGroupIds: list[int]
target: NiceCombineAdjustTarget
idx: int
value: int
Expand Down Expand Up @@ -2979,6 +2980,13 @@ class NiceSpot(BaseModel):
quests: list[NiceQuest]


class NiceWarGroup(BaseModelORJson):
id: int
# warId: int
questAfterClear: NiceQuestAfterClearType
questType: NiceQuestType


class NiceWarAdd(BaseModelORJson):
warId: int
type: NiceWarOverwriteType
Expand Down Expand Up @@ -3034,6 +3042,7 @@ class NiceWar(BaseModelORJson):
lastQuestId: int
releaseConditions: list[NiceWarRelease]
warAdds: list[NiceWarAdd]
groups: list[NiceWarGroup]
maps: list[NiceMap]
spots: list[NiceSpot]
spotRoads: list[NiceSpotRoad]
Expand Down
9 changes: 9 additions & 0 deletions app/schemas/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ class MstEventQuestCooltime(BaseModelORJson):
class MstEventCampaign(BaseModelORJson):
targetIds: list[int]
warIds: list[int]
warGroupIds: list[int] | None = None
eventId: int
target: int
idx: int
Expand Down Expand Up @@ -1732,6 +1733,13 @@ class MstWar(BaseModelORJson):
assetId: int # 0


class MstWarGroup(BaseModelORJson):
id: int
warId: int
questAfterClear: int
questType: int


class MstWarAdd(BaseModelORJson):
script: dict[str, Any]
warId: int
Expand Down Expand Up @@ -2438,6 +2446,7 @@ class WarEntity(BaseModelORJson):
mstWar: MstWar
mstEvent: Optional[MstEvent] = None
mstWarAdd: list[MstWarAdd]
mstWarGroup: list[MstWarGroup]
mstMap: list[MstMap]
mstBgm: list[MstBgm]
mstMapGimmick: list[MstMapGimmick]
Expand Down

0 comments on commit 0173bdb

Please sign in to comment.