Skip to content

Commit

Permalink
Changed battleBg type to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Jan 8, 2024
1 parent 2f69cec commit c0a04fa
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/core/nice/quest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from ...schemas.common import Language, Region, ScriptLink
from ...schemas.enums import STAGE_LIMIT_ACT_TYPE_NAME, get_class_name
from ...schemas.gameenums import (
BATTLE_ENVIRONMENT_GRANT_TYPE_NAME,
COND_TYPE_NAME,
FREQUENCY_TYPE_NAME,
QUEST_AFTER_CLEAR_NAME,
Expand Down Expand Up @@ -173,7 +174,7 @@ def get_nice_quest_restriction(
def get_nice_battle_bg(battle_bg: MstBattleBg) -> NiceBattleBg:
return NiceBattleBg(
id=battle_bg.id,
type=battle_bg.type,
type=BATTLE_ENVIRONMENT_GRANT_TYPE_NAME[battle_bg.type],
priority=battle_bg.priority,
individuality=get_traits_list(battle_bg.individuality),
imageId=battle_bg.imageId,
Expand Down
21 changes: 21 additions & 0 deletions app/schemas/gameenums.py
Original file line number Diff line number Diff line change
Expand Up @@ -5331,3 +5331,24 @@ class NiceWarBoardTreasureRarity(StrEnum):
10: NiceWarBoardTreasureRarity.itemIconPlus,
11: NiceWarBoardTreasureRarity.itemIconPlus2,
}


class BattleFieldEnvironmentDataGrantType(IntEnum):
None = 0
Stage = 1
Function = 2


class NiceBattleFieldEnvironmentGrantType(StrEnum):
"""Battle Field Environment Grant Type"""

none = "none"
stage = "stage"
function = "function"


BATTLE_ENVIRONMENT_GRANT_TYPE_NAME: dict[int, NiceBattleFieldEnvironmentGrantType] = {
0: NiceBattleFieldEnvironmentGrantType.none,
1: NiceBattleFieldEnvironmentGrantType.stage,
2: NiceBattleFieldEnvironmentGrantType.function,
}
3 changes: 2 additions & 1 deletion app/schemas/nice.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
NiceAiActTarget,
NiceAiActType,
NiceAiCond,
NiceBattleFieldEnvironmentGrantType,
NiceBuffType,
NiceCardType,
NiceClassBoardSkillType,
Expand Down Expand Up @@ -2370,7 +2371,7 @@ class NiceStageCutIn(BaseModelORJson):

class NiceBattleBg(BaseModelORJson):
id: int
type: int
type: NiceBattleFieldEnvironmentGrantType
priority: int
individuality: list[NiceTrait]
imageId: int
Expand Down
6 changes: 6 additions & 0 deletions scripts/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1811,3 +1811,9 @@ export enum NiceWarBoardTreasureRarity {
ITEM_ICON_PLUS = "itemIconPlus",
ITEM_ICON_PLUS2 = "itemIconPlus2",
}

export enum NiceBattleFieldEnvironmentGrantType {
None = "none",
Stage = "stage",
Function = "function",
}
7 changes: 7 additions & 0 deletions scripts/extract_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,13 @@ def cs_enum_to_ts(cs_enums: list[str], raw_class: str, nice_class: str) -> list[
"War Board Treasure Rarity",
"WAR_BOARD_TREASURE_RARITY_NAME",
),
(
"BattleFieldEnvironmentData.GrantType",
"BattleFieldEnvironmentDataGrantType",
"NiceBattleFieldEnvironmentGrantType",
"Battle Field Environment Grant Type",
"BATTLE_ENVIRONMENT_GRANT_TYPE_NAME",
),
]


Expand Down

0 comments on commit c0a04fa

Please sign in to comment.