From c0ff6960bf1e8376063bf66e41e9a982946ea0d3 Mon Sep 17 00:00:00 2001 From: qwerdvd <2450899274@qq.com> Date: Sat, 23 Sep 2023 18:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20=E6=94=AF=E6=8C=81=E4=BD=8E?= =?UTF-8?q?=E7=89=88=E6=9C=ACpy=EF=BC=8C=E6=94=B9=E7=94=A8msgspec=E8=AF=BB?= =?UTF-8?q?=E5=8F=96excel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- ArknightsUID/arknightsuid_ap/notice.py | 11 +- .../arknightsuid_config/config_default.py | 3 +- ArknightsUID/arknightsuid_help/get_help.py | 7 +- .../arknightsuid_resource/cachedata.py | 28 +- .../arknightsuid_resource/constants.py | 621 +++---- ArknightsUID/arknightsuid_user/__init__.py | 3 +- ArknightsUID/utils/api/skd/request.py | 58 +- ArknightsUID/utils/database/models.py | 38 +- ArknightsUID/utils/error_reply.py | 5 +- ArknightsUID/utils/file.py | 5 +- ArknightsUID/utils/image/image_tools.py | 3 +- ArknightsUID/utils/message.py | 4 +- ArknightsUID/utils/models/common.py | 126 ++ .../utils/models/gamedata/ActivityTable.py | 1607 +++++++++-------- .../utils/models/gamedata/AudioData.py | 62 +- .../utils/models/gamedata/BattleEquipTable.py | 78 +- .../utils/models/gamedata/BuildingData.py | 305 ++-- .../utils/models/gamedata/CampaignTable.py | 119 +- .../utils/models/gamedata/ChapterTable.py | 17 +- .../utils/models/gamedata/CharMetaTable.py | 27 +- .../utils/models/gamedata/CharPatchTable.py | 172 +- .../utils/models/gamedata/CharacterTable.py | 161 +- .../utils/models/gamedata/CharmTable.py | 56 +- .../utils/models/gamedata/CharwordTable.py | 58 +- .../utils/models/gamedata/CheckinTable.py | 29 +- .../utils/models/gamedata/ClimbTowerTable.py | 226 +-- .../utils/models/gamedata/ClueData.py | 20 +- .../utils/models/gamedata/CrisisTable.py | 35 +- .../utils/models/gamedata/DisplayMetaTable.py | 44 +- .../models/gamedata/EnemyHandbookTable.py | 50 +- .../utils/models/gamedata/FavorTable.py | 11 +- .../utils/models/gamedata/GachaTable.py | 119 +- .../utils/models/gamedata/GamedataConst.py | 66 +- .../models/gamedata/HandbookInfoTable.py | 89 +- .../utils/models/gamedata/HandbookTable.py | 27 +- .../models/gamedata/HandbookTeamTable.py | 13 +- .../utils/models/gamedata/ItemTable.py | 92 +- .../utils/models/gamedata/MedalTable.py | 66 +- .../utils/models/gamedata/MissionTable.py | 89 +- .../utils/models/gamedata/OpenServerTable.py | 225 ++- .../models/gamedata/PlayerAvatarTable.py | 15 +- .../utils/models/gamedata/RangeTable.py | 24 +- .../utils/models/gamedata/ReplicateTable.py | 27 +- .../utils/models/gamedata/RetroTable.py | 306 ++-- .../utils/models/gamedata/RoguelikeTable.py | 169 +- .../models/gamedata/RoguelikeTopicTable.py | 803 ++++---- .../utils/models/gamedata/SandboxTable.py | 265 +-- .../utils/models/gamedata/ShopClientTable.py | 82 +- .../utils/models/gamedata/SkillTable.py | 49 +- .../utils/models/gamedata/SkinTable.py | 85 +- .../utils/models/gamedata/StageTable.py | 197 +- .../models/gamedata/StoryReviewMetaTable.py | 160 +- .../utils/models/gamedata/StoryReviewTable.py | 48 +- .../utils/models/gamedata/StoryTable.py | 44 +- .../utils/models/gamedata/TechBuffTable.py | 36 +- .../utils/models/gamedata/TipTable.py | 13 +- .../utils/models/gamedata/TokenTable.py | 154 +- .../utils/models/gamedata/UniequipData.py | 44 +- .../utils/models/gamedata/UniequipTable.py | 48 +- .../utils/models/gamedata/ZoneTable.py | 94 +- ArknightsUID/utils/models/skland/models.py | 167 +- .../utils/resource/download_from_cos.py | 7 +- ArknightsUID/utils/resource/download_url.py | 7 +- 64 files changed, 3872 insertions(+), 3749 deletions(-) create mode 100644 ArknightsUID/utils/models/common.py diff --git a/.gitignore b/.gitignore index 0ea37fd..f21d06d 100644 --- a/.gitignore +++ b/.gitignore @@ -669,7 +669,7 @@ result.txt ### ArknightsUID ### ArknightsUID/tools/ upload_file.py - +test.py ### Debug ### testnb2/ diff --git a/ArknightsUID/arknightsuid_ap/notice.py b/ArknightsUID/arknightsuid_ap/notice.py index 12724eb..a76f9bc 100644 --- a/ArknightsUID/arknightsuid_ap/notice.py +++ b/ArknightsUID/arknightsuid_ap/notice.py @@ -1,3 +1,4 @@ +from typing import Dict from gsuid_core.gss import gss from gsuid_core.logger import logger @@ -15,8 +16,8 @@ NOTICE = { } -async def get_notice_list() -> dict[str, dict[str, dict]]: - msg_dict: dict[str, dict[str, dict]] = {} +async def get_notice_list() -> Dict[str, Dict[str, Dict]]: + msg_dict: Dict[str, Dict[str, Dict]] = {} for _bot_id in gss.active_bot: user_list = await ArknightsUser.get_all_push_user_list() for user in user_list: @@ -40,11 +41,11 @@ async def get_notice_list() -> dict[str, dict[str, dict]]: async def all_check( bot_id: str, raw_data: ArknightsPlayerInfoModel, - push_data: dict, - msg_dict: dict[str, dict[str, dict]], + push_data: Dict, + msg_dict: Dict[str, Dict[str, Dict]], user_id: str, uid: str, -) -> dict[str, dict[str, dict]]: +) -> Dict[str, Dict[str, Dict]]: for mode in NOTICE.keys(): # 检查条件 if push_data[f'{mode}_is_push'] is True: diff --git a/ArknightsUID/arknightsuid_config/config_default.py b/ArknightsUID/arknightsuid_config/config_default.py index 1302853..6797bb5 100644 --- a/ArknightsUID/arknightsuid_config/config_default.py +++ b/ArknightsUID/arknightsuid_config/config_default.py @@ -1,3 +1,4 @@ +from typing import Dict from gsuid_core.utils.plugins_config.models import ( GSC, GsBoolConfig, @@ -5,7 +6,7 @@ from gsuid_core.utils.plugins_config.models import ( GsStrConfig, ) -CONIFG_DEFAULT: dict[str, GSC] = { +CONIFG_DEFAULT: Dict[str, GSC] = { 'SignTime': GsListStrConfig('每晚签到时间设置', '每晚森空岛签到时间设置(时,分)', ['0', '38']), 'SignReportSimple': GsBoolConfig( '简洁签到报告', diff --git a/ArknightsUID/arknightsuid_help/get_help.py b/ArknightsUID/arknightsuid_help/get_help.py index af10e95..2b79738 100644 --- a/ArknightsUID/arknightsuid_help/get_help.py +++ b/ArknightsUID/arknightsuid_help/get_help.py @@ -1,4 +1,5 @@ from pathlib import Path +from typing import Dict, Union import aiofiles from gsuid_core.help.draw_plugin_help import get_help @@ -13,15 +14,15 @@ TEXT_PATH = Path(__file__).parent / 'texture2d' HELP_DATA = Path(__file__).parent / 'Help.json' -async def get_help_data() -> dict[str, PluginHelp] | None: +async def get_help_data() -> Union[Dict[str, PluginHelp], None]: if HELP_DATA.exists(): async with aiofiles.open(HELP_DATA, 'rb') as file: return msgjson.decode( - await file.read(), type=dict[str, PluginHelp], + await file.read(), type=Dict[str, PluginHelp], ) -async def get_core_help() -> bytes | str: +async def get_core_help() -> Union[bytes, str]: help_data = await get_help_data() if help_data is None: return '暂未找到帮助数据...' diff --git a/ArknightsUID/arknightsuid_resource/cachedata.py b/ArknightsUID/arknightsuid_resource/cachedata.py index 40987d9..567846b 100644 --- a/ArknightsUID/arknightsuid_resource/cachedata.py +++ b/ArknightsUID/arknightsuid_resource/cachedata.py @@ -2,7 +2,7 @@ import json from functools import cache from pathlib import Path from time import time -from typing import Any, ClassVar +from typing import Any, ClassVar, Dict, Union from loguru import logger @@ -10,54 +10,58 @@ from ..utils.file import read_json class StoreData: - data: dict[Any, Any] + data: Dict[Any, Any] modification_time: float - def __init__(self, data: dict[Any, Any], modification_time: float) -> None: + def __init__(self, data: Dict[Any, Any], modification_time: float) -> None: self.data = data self.modification_time = modification_time class CacheData: - cached_data: ClassVar[dict[str, StoreData]] = {} + cached_data: ClassVar[Dict[str, StoreData]] = {} @classmethod @cache - def get_cache(cls, local_path: Path) -> dict[Any, Any]: + def get_cache(cls, local_path: Path) -> Dict[Any, Any]: data_name = local_path.stem if data_name in cls.cached_data: current_modification_time = local_path.stat().st_mtime if current_modification_time == cls.cached_data[data_name].modification_time: - logger.debug(f'hit cached: {data_name}') return cls.cached_data[data_name].data return cls.set_cache(local_path, data_name) @classmethod def set_cache( - cls, local_path: Path | None, data_name: str, memory_data: dict | None = None - ) -> dict[Any, Any]: + cls, local_path: Union[Path, None], data_name: str, memory_data: Union[Dict, None] = None + ) -> Dict[Any, Any]: data = read_json(local_path) if local_path else memory_data if data is None: raise FileNotFoundError modification_time = local_path.stat().st_mtime if local_path else time() cls.cached_data[data_name] = StoreData(data, modification_time) - logger.debug(f'cached: {data_name}') return cls.cached_data[data_name].data @classmethod - def readFile(cls, local_path: Path) -> dict[Any, Any]: + def readFile(cls, local_path: Path) -> Dict[Any, Any]: try: if isinstance(local_path, str): local_path = Path(local_path) - logger.debug(f'loading: {local_path.stem}') return cls.get_cache(local_path) except json.decoder.JSONDecodeError as e: logger.error(f'Could not load file "{local_path}".') raise FileNotFoundError from e @classmethod - def readExcel(cls, table_name: str) -> dict[Any, Any]: + def readExcel(cls, table_name: str) -> Dict[Any, Any]: logger.debug(f'loading: {table_name}.json') if table_name not in cls.cached_data: return {} return cls.cached_data[table_name].data + + @classmethod + def readBytesExcel(cls, table_name: str) -> bytes: + logger.debug(f'loading: {table_name}.json') + if table_name not in cls.cached_data: + return bytes({}) + return json.dumps(cls.cached_data[table_name].data).encode('utf-8') diff --git a/ArknightsUID/arknightsuid_resource/constants.py b/ArknightsUID/arknightsuid_resource/constants.py index 99a0f4c..85f18b7 100644 --- a/ArknightsUID/arknightsuid_resource/constants.py +++ b/ArknightsUID/arknightsuid_resource/constants.py @@ -1,12 +1,14 @@ import inspect +from typing import Dict, Union +from msgspec import json as msgjson from ..utils.models.gamedata.ActivityTable import ActivityTable from ..utils.models.gamedata.AudioData import AudioData -from ..utils.models.gamedata.BattleEquipTable import BattleEquipTable +from ..utils.models.gamedata.BattleEquipTable import BattleEquipData from ..utils.models.gamedata.BuildingData import BuildingData from ..utils.models.gamedata.CampaignTable import CampaignTable -from ..utils.models.gamedata.ChapterTable import ChapterTable -from ..utils.models.gamedata.CharacterTable import CharacterTable +from ..utils.models.gamedata.ChapterTable import ChapterData +from ..utils.models.gamedata.CharacterTable import CharacterData from ..utils.models.gamedata.CharMetaTable import CharMetaTable from ..utils.models.gamedata.CharmTable import CharmTable from ..utils.models.gamedata.CharPatchTable import CharPatchTable @@ -22,28 +24,28 @@ from ..utils.models.gamedata.GachaTable import GachaTable from ..utils.models.gamedata.GamedataConst import GamedataConst from ..utils.models.gamedata.HandbookInfoTable import HandbookInfoTable from ..utils.models.gamedata.HandbookTable import HandbookTable -from ..utils.models.gamedata.HandbookTeamTable import HandbookTeamTable +from ..utils.models.gamedata.HandbookTeamTable import HandbookTeam from ..utils.models.gamedata.ItemTable import ItemTable from ..utils.models.gamedata.MedalTable import MedalTable from ..utils.models.gamedata.MissionTable import MissionTable from ..utils.models.gamedata.OpenServerTable import OpenServerTable from ..utils.models.gamedata.PlayerAvatarTable import PlayerAvatarTable -from ..utils.models.gamedata.RangeTable import RangeTable -from ..utils.models.gamedata.ReplicateTable import ReplicateTable +from ..utils.models.gamedata.RangeTable import Stage +from ..utils.models.gamedata.ReplicateTable import ReplicateList from ..utils.models.gamedata.RetroTable import RetroTable from ..utils.models.gamedata.RoguelikeTable import RoguelikeTable from ..utils.models.gamedata.RoguelikeTopicTable import RoguelikeTopicTable from ..utils.models.gamedata.SandboxTable import SandboxTable from ..utils.models.gamedata.ShopClientTable import ShopClientTable -from ..utils.models.gamedata.SkillTable import SkillTable +from ..utils.models.gamedata.SkillTable import SkillDataBundle from ..utils.models.gamedata.SkinTable import SkinTable from ..utils.models.gamedata.StageTable import StageTable from ..utils.models.gamedata.StoryReviewMetaTable import StoryReviewMetaTable -from ..utils.models.gamedata.StoryReviewTable import StoryReviewTable -from ..utils.models.gamedata.StoryTable import StoryTable +from ..utils.models.gamedata.StoryReviewTable import StoryReviewGroupClientData +from ..utils.models.gamedata.StoryTable import StoryData from ..utils.models.gamedata.TechBuffTable import TechBuffTable from ..utils.models.gamedata.TipTable import TipTable -from ..utils.models.gamedata.TokenTable import TokenTable +from ..utils.models.gamedata.TokenTable import TokenCharacterData from ..utils.models.gamedata.UniequipData import UniequipData from ..utils.models.gamedata.UniequipTable import UniEquipTable from ..utils.models.gamedata.ZoneTable import ZoneTable @@ -51,625 +53,438 @@ from .cachedata import CacheData class ExcelTableManager: - activity_table_: ActivityTable | None = None - audio_data_: AudioData | None = None - battle_equip_table_: BattleEquipTable | None = None - building_data_: BuildingData | None = None - campaign_table_: CampaignTable | None = None - chapter_table_: ChapterTable | None = None - character_table_: CharacterTable | None = None - char_meta_table_: CharMetaTable | None = None - charm_table_: CharmTable | None = None - char_patch_table_: CharPatchTable | None = None - charword_table_: CharwordTable | None = None - checkin_table_: CheckinTable | None = None - climb_tower_table_: ClimbTowerTable | None = None - clue_data_: ClueData | None = None - crisis_table_: CrisisTable | None = None - display_meta_table_: DisplayMetaTable | None = None - enemy_handbook_table_: EnemyHandbookTable | None = None - favor_table_: FavorTable | None = None - gacha_table_: GachaTable | None = None - gamedata_const_: GamedataConst | None = None - handbook_info_table_: HandbookInfoTable | None = None - handbook_table_: HandbookTable | None = None - handbook_team_table_: HandbookTeamTable | None = None - item_table_: ItemTable | None = None - medal_table_: MedalTable | None = None - mission_table_: MissionTable | None = None - open_server_table_: OpenServerTable | None = None - player_avatar_table_: PlayerAvatarTable | None = None - range_table_: RangeTable | None = None - replicate_table_: ReplicateTable | None = None - retro_table_: RetroTable | None = None - roguelike_table_: RoguelikeTable | None = None - roguelike_topic_table_: RoguelikeTopicTable | None = None - sandbox_table_: SandboxTable | None = None - shop_client_table_: ShopClientTable | None = None - skill_table_: SkillTable | None = None - skin_table_: SkinTable | None = None - stage_table_: StageTable | None = None - story_review_meta_table_: StoryReviewMetaTable | None = None - story_review_table_: StoryReviewTable | None = None - story_table_: StoryTable | None = None - tech_buff_table_: TechBuffTable | None = None - tip_table_: TipTable | None = None - token_table_: TokenTable | None = None - uniequip_data_: UniequipData | None = None - uniequip_table_: UniEquipTable | None = None - zone_table_: ZoneTable | None = None + activity_table_: Union[ActivityTable, None] = None + audio_data_: Union[AudioData, None] = None + battle_equip_table_: Union[Dict[str, BattleEquipData], None] = None + building_data_: Union[BuildingData, None] = None + campaign_table_: Union[CampaignTable, None] = None + chapter_table_: Union[Dict[str, ChapterData], None] = None + character_table_: Union[Dict[str, CharacterData], None] = None + char_meta_table_: Union[CharMetaTable, None] = None + charm_table_: Union[CharmTable, None] = None + char_patch_table_: Union[CharPatchTable, None] = None + charword_table_: Union[CharwordTable, None] = None + checkin_table_: Union[CheckinTable, None] = None + climb_tower_table_: Union[ClimbTowerTable, None] = None + clue_data_: Union[ClueData, None] = None + crisis_table_: Union[CrisisTable, None] = None + display_meta_table_: Union[DisplayMetaTable, None] = None + enemy_handbook_table_: Union[EnemyHandbookTable, None] = None + favor_table_: Union[FavorTable, None] = None + gacha_table_: Union[GachaTable, None] = None + gamedata_const_: Union[GamedataConst, None] = None + handbook_info_table_: Union[HandbookInfoTable, None] = None + handbook_table_: Union[HandbookTable, None] = None + handbook_team_table_: Union[Dict[str, HandbookTeam], None] = None + item_table_: Union[ItemTable, None] = None + medal_table_: Union[MedalTable, None] = None + mission_table_: Union[MissionTable, None] = None + open_server_table_: Union[OpenServerTable, None] = None + player_avatar_table_: Union[PlayerAvatarTable, None] = None + range_table_: Union[Dict[str, Stage], None] = None + replicate_table_: Union[Dict[str, ReplicateList], None] = None + retro_table_: Union[RetroTable, None] = None + roguelike_table_: Union[RoguelikeTable, None] = None + roguelike_topic_table_: Union[RoguelikeTopicTable, None] = None + sandbox_table_: Union[SandboxTable, None] = None + shop_client_table_: Union[ShopClientTable, None] = None + skill_table_: Union[Dict[str, SkillDataBundle], None] = None + skin_table_: Union[SkinTable, None] = None + stage_table_: Union[StageTable, None] = None + story_review_meta_table_: Union[StoryReviewMetaTable, None] = None + story_review_table_: Union[Dict[str, StoryReviewGroupClientData], None] = None + story_table_: Union[Dict[str, StoryData], None] = None + tech_buff_table_: Union[TechBuffTable, None] = None + tip_table_: Union[TipTable, None] = None + token_table_: Union[Dict[str, TokenCharacterData], None] = None + uniequip_data_: Union[UniequipData, None] = None + uniequip_table_: Union[UniEquipTable, None] = None + zone_table_: Union[ZoneTable, None] = None @property def ACTIVITY_TABLE(self) -> ActivityTable: if not self.activity_table_: - if hasattr(ActivityTable, 'model_validate'): - self.activity_table_ = ActivityTable.model_validate( # type: ignore - CacheData.readExcel('activity_table') - ) - else: - self.activity_table_ = ActivityTable.parse_obj( - CacheData.readExcel('activity_table') - ) + self.activity_table_ = ActivityTable.convert( + CacheData.readExcel('activity_table') + ) return self.activity_table_ @property def AUDIO_DATA(self) -> AudioData: if not self.audio_data_: - if hasattr(AudioData, 'model_validate'): - self.audio_data_ = AudioData.model_validate( # type: ignore - CacheData.readExcel('audio_data') - ) - else: - self.audio_data_ = AudioData.parse_obj( - CacheData.readExcel('audio_data') - ) + self.audio_data_ = AudioData.convert( + CacheData.readExcel('audio_data') + ) return self.audio_data_ @property - def BATTLE_EQUIP_TABLE(self) -> BattleEquipTable: + def BATTLE_EQUIP_TABLE(self) -> Dict[str, BattleEquipData]: if not self.battle_equip_table_: - self.battle_equip_table_ = BattleEquipTable( - CacheData.readExcel('battle_equip_table') + self.battle_equip_table_ = msgjson.decode( + CacheData.readBytesExcel('battle_equip_table'), + type=Dict[str, BattleEquipData] ) return self.battle_equip_table_ @property def BUILDING_DATA(self) -> BuildingData: if not self.building_data_: - if hasattr(BuildingData, 'model_validate'): - self.building_data_ = BuildingData.model_validate( # type: ignore - CacheData.readExcel('building_data') - ) - else: - self.building_data_ = BuildingData.parse_obj( - CacheData.readExcel('building_data') - ) + self.building_data_ = BuildingData.convert( + CacheData.readExcel('building_data') + ) return self.building_data_ @property def CAMPAIGN_TABLE(self) -> CampaignTable: if not self.campaign_table_: - if hasattr(CampaignTable, 'model_validate'): - self.campaign_table_ = CampaignTable.model_validate( # type: ignore - CacheData.readExcel('campaign_table') - ) - else: - self.campaign_table_ = CampaignTable.parse_obj( - CacheData.readExcel('campaign_table') - ) + self.campaign_table_ = CampaignTable.convert( + CacheData.readExcel('campaign_table') + ) return self.campaign_table_ @property - def CHAPTER_TABLE(self) -> ChapterTable: + def CHAPTER_TABLE(self) -> Dict[str, ChapterData]: if not self.chapter_table_: - self.chapter_table_ = ChapterTable(CacheData.readExcel('chapter_table')) + self.chapter_table_ = msgjson.decode( + CacheData.readBytesExcel('chapter_table'), + type=Dict[str, ChapterData] + ) return self.chapter_table_ @property - def CHARATER_TABLE(self) -> CharacterTable: + def CHARATER_TABLE(self) -> Dict[str, CharacterData]: if not self.character_table_: - if hasattr(CharacterTable, 'model_validate'): - self.character_table_ = CharacterTable.model_validate( # type: ignore - CacheData.readExcel('character_table') - ) - else: - self.character_table_ = CharacterTable( - CacheData.readExcel('character_table') - ) + self.character_table_ = msgjson.decode( + CacheData.readBytesExcel('character_table'), + type=Dict[str, CharacterData] + ) return self.character_table_ @property def CHAR_META_TABLE(self) -> CharMetaTable: if not self.char_meta_table_: - if hasattr(CharMetaTable, 'model_validate'): - self.char_meta_table_ = CharMetaTable.model_validate( # type: ignore - CacheData.readExcel('char_meta_table') - ) - else: - self.char_meta_table_ = CharMetaTable.parse_obj( - CacheData.readExcel('char_meta_table') - ) + self.char_meta_table_ = CharMetaTable.convert( + CacheData.readExcel('char_meta_table') + ) return self.char_meta_table_ @property def CHARM_TABLE(self) -> CharmTable: if not self.charm_table_: - if hasattr(CharmTable, 'model_validate'): - self.charm_table_ = CharmTable.model_validate( # type: ignore - CacheData.readExcel('charm_table') - ) - else: - self.charm_table_ = CharmTable.parse_obj( - CacheData.readExcel('charm_table') - ) + self.charm_table_ = CharmTable.convert( + CacheData.readExcel('charm_table') + ) return self.charm_table_ @property def CHAR_PATH_TABLE(self) -> CharPatchTable: if not self.char_patch_table_: - if hasattr(CharPatchTable, 'model_validate'): - self.char_patch_table_ = CharPatchTable.model_validate( # type: ignore - CacheData.readExcel('char_patch_table') - ) - else: - self.char_patch_table_ = CharPatchTable.parse_obj( - CacheData.readExcel('char_patch_table') - ) + self.char_patch_table_ = CharPatchTable.convert( + CacheData.readExcel('char_patch_table') + ) return self.char_patch_table_ @property def CHARWORD_TABLE(self) -> CharwordTable: if not self.charword_table_: - if hasattr(CharwordTable, 'model_validate'): - self.charword_table_ = CharwordTable.model_validate( # type: ignore - CacheData.readExcel('charword_table') - ) - else: - self.charword_table_ = CharwordTable.parse_obj( - CacheData.readExcel('charword_table') - ) + self.charword_table_ = CharwordTable.convert( + CacheData.readExcel('charword_table') + ) return self.charword_table_ @property def CHECKIN_TABLE(self) -> CheckinTable: if not self.checkin_table_: - if hasattr(CheckinTable, 'model_validate'): - self.checkin_table_ = CheckinTable.model_validate( # type: ignore - CacheData.readExcel('checkin_table') - ) - else: - self.checkin_table_ = CheckinTable.parse_obj( - CacheData.readExcel('checkin_table') - ) + self.checkin_table_ = CheckinTable.convert( + CacheData.readExcel('checkin_table') + ) return self.checkin_table_ @property def CLIMB_TOWER_TABLE(self) -> ClimbTowerTable: if not self.climb_tower_table_: - if hasattr(ClimbTowerTable, 'model_validate'): - self.climb_tower_table_ = ClimbTowerTable.model_validate( # type: ignore - CacheData.readExcel('climb_tower_table') - ) - else: - self.climb_tower_table_ = ClimbTowerTable.parse_obj( - CacheData.readExcel('climb_tower_table') - ) + self.climb_tower_table_ = ClimbTowerTable.convert( + CacheData.readExcel('climb_tower_table') + ) return self.climb_tower_table_ @property def CLUE_DATA(self) -> ClueData: if not self.clue_data_: - if hasattr(ClueData, 'model_validate'): - self.clue_data_ = ClueData.model_validate( # type: ignore - CacheData.readExcel('clue_data') - ) - else: - self.clue_data_ = ClueData.parse_obj( - CacheData.readExcel('clue_data') - ) + self.clue_data_ = ClueData.convert( + CacheData.readExcel('clue_data') + ) return self.clue_data_ @property def CRISIS_TABLE(self) -> CrisisTable: if not self.crisis_table_: - if hasattr(CrisisTable, 'model_validate'): - self.crisis_table_ = CrisisTable.model_validate( # type: ignore - CacheData.readExcel('crisis_table') - ) - else: - self.crisis_table_ = CrisisTable.parse_obj( - CacheData.readExcel('crisis_table') - ) + self.crisis_table_ = CrisisTable.convert( + CacheData.readExcel('crisis_table') + ) return self.crisis_table_ @property def DISPLAY_META_TABLE(self) -> DisplayMetaTable: if not self.display_meta_table_: - if hasattr(DisplayMetaTable, 'model_validate'): - self.display_meta_table_ = DisplayMetaTable.model_validate( # type: ignore - CacheData.readExcel('display_meta_table') - ) - else: - self.display_meta_table_ = DisplayMetaTable.parse_obj( - CacheData.readExcel('display_meta_table') - ) + self.display_meta_table_ = DisplayMetaTable.convert( + CacheData.readExcel('display_meta_table') + ) return self.display_meta_table_ @property def ENEMY_HANDBOOK_TABLE(self) -> EnemyHandbookTable: if not self.enemy_handbook_table_: - if hasattr(EnemyHandbookTable, 'model_validate'): - self.enemy_handbook_table_ = EnemyHandbookTable.model_validate( # type: ignore - CacheData.readExcel('enemy_handbook_table') - ) - else: - self.enemy_handbook_table_ = EnemyHandbookTable.parse_obj( - CacheData.readExcel('enemy_handbook_table') - ) + self.enemy_handbook_table_ = EnemyHandbookTable.convert( + CacheData.readExcel('enemy_handbook_table') + ) return self.enemy_handbook_table_ @property def FAVOR_TABLE(self) -> FavorTable: if not self.favor_table_: - if hasattr(FavorTable, 'model_validate'): - self.favor_table_ = FavorTable.model_validate( # type: ignore - CacheData.readExcel('favor_table') - ) - else: - self.favor_table_ = FavorTable.parse_obj( - CacheData.readExcel('favor_table') - ) + self.favor_table_ = FavorTable.convert( + CacheData.readExcel('favor_table') + ) return self.favor_table_ @property def GACHA_TABLE(self) -> GachaTable: if not self.gacha_table_: - if hasattr(GachaTable, 'model_validate'): - self.gacha_table_ = GachaTable.model_validate( # type: ignore - CacheData.readExcel('gacha_table') - ) - else: - self.gacha_table_ = GachaTable.parse_obj( - CacheData.readExcel('gacha_table') - ) + self.gacha_table_ = GachaTable.convert( + CacheData.readExcel('gacha_table') + ) return self.gacha_table_ @property def GAMEDATA_CONST(self) -> GamedataConst: if not self.gamedata_const_: - if hasattr(GamedataConst, 'model_validate'): - self.gamedata_const_ = GamedataConst.model_validate( # type: ignore - CacheData.readExcel('gamedata_const') - ) - else: - self.gamedata_const_ = GamedataConst.parse_obj( - CacheData.readExcel('gamedata_const') - ) + self.gamedata_const_ = GamedataConst.convert( + CacheData.readExcel('gamedata_const') + ) return self.gamedata_const_ @property def HANDBOOK_INFO_TABLE(self) -> HandbookInfoTable: if not self.handbook_info_table_: - if hasattr(HandbookInfoTable, 'model_validate'): - self.handbook_info_table_ = HandbookInfoTable.model_validate( # type: ignore - CacheData.readExcel('handbook_info_table') - ) - else: - self.handbook_info_table_ = HandbookInfoTable.parse_obj( - CacheData.readExcel('handbook_info_table') - ) + self.handbook_info_table_ = HandbookInfoTable.convert( + CacheData.readExcel('handbook_info_table') + ) return self.handbook_info_table_ @property def HANDBOOK_TABLE(self) -> HandbookTable: if not self.handbook_table_: - if hasattr(HandbookTable, 'model_validate'): - self.handbook_table_ = HandbookTable.model_validate( # type: ignore - CacheData.readExcel('handbook_table') - ) - else: - self.handbook_table_ = HandbookTable.parse_obj( - CacheData.readExcel('handbook_table') - ) + self.handbook_table_ = HandbookTable.convert( + CacheData.readExcel('handbook_table') + ) return self.handbook_table_ @property - def HANDBOOK_TEAM_TABLE(self) -> HandbookTeamTable: + def HANDBOOK_TEAM_TABLE(self) -> Dict[str, HandbookTeam]: if not self.handbook_team_table_: - if hasattr(HandbookTeamTable, 'model_validate'): - self.handbook_team_table_ = HandbookTeamTable.model_validate( # type: ignore - CacheData.readExcel('handbook_team_table') - ) - else: - self.handbook_team_table_ = HandbookTeamTable.parse_obj( - CacheData.readExcel('handbook_team_table') - ) + self.handbook_team_table_ = msgjson.decode( + CacheData.readBytesExcel('handbook_team_table'), + type=Dict[str, HandbookTeam] + ) return self.handbook_team_table_ @property def ITEM_TABLE(self) -> ItemTable: if not self.item_table_: - if hasattr(ItemTable, 'model_validate'): - self.item_table_ = ItemTable.model_validate( # type: ignore - CacheData.readExcel('item_table') - ) - else: - self.item_table_ = ItemTable.parse_obj( - CacheData.readExcel('item_table') - ) + self.item_table_ = ItemTable.convert( + CacheData.readExcel('item_table') + ) return self.item_table_ @property def MEDAL_TABLE(self) -> MedalTable: if not self.medal_table_: - if hasattr(MedalTable, 'model_validate'): - self.medal_table_ = MedalTable.model_validate( # type: ignore - CacheData.readExcel('medal_table') - ) - else: - self.medal_table_ = MedalTable.parse_obj( - CacheData.readExcel('medal_table') - ) + self.medal_table_ = MedalTable.convert( + CacheData.readExcel('medal_table') + ) return self.medal_table_ @property def MISSION_TABLE(self) -> MissionTable: if not self.mission_table_: - if hasattr(MissionTable, 'model_validate'): - self.mission_table_ = MissionTable.model_validate( # type: ignore - CacheData.readExcel('mission_table') - ) - else: - self.mission_table_ = MissionTable.parse_obj( - CacheData.readExcel('mission_table') - ) + self.mission_table_ = MissionTable.convert( + CacheData.readExcel('mission_table') + ) return self.mission_table_ @property def OPEN_SERVER_TABLE(self) -> OpenServerTable: if not self.open_server_table_: - if hasattr(OpenServerTable, 'model_validate'): - self.open_server_table_ = OpenServerTable.model_validate( # type: ignore - CacheData.readExcel('open_server_table') - ) - else: - self.open_server_table_ = OpenServerTable.parse_obj( - CacheData.readExcel('open_server_table') - ) + self.open_server_table_ = OpenServerTable.convert( + CacheData.readExcel('open_server_table') + ) return self.open_server_table_ @property def PLAYER_AVATAR_TABLE(self) -> PlayerAvatarTable: if not self.player_avatar_table_: - if hasattr(PlayerAvatarTable, 'model_validate'): - self.player_avatar_table_ = PlayerAvatarTable.model_validate( # type: ignore - CacheData.readExcel('player_avatar_table') - ) - else: - self.player_avatar_table_ = PlayerAvatarTable.parse_obj( - CacheData.readExcel('player_avatar_table') - ) + self.player_avatar_table_ = PlayerAvatarTable.convert( + CacheData.readExcel('player_avatar_table') + ) return self.player_avatar_table_ @property - def RANGE_TABLE(self) -> RangeTable: + def RANGE_TABLE(self) -> Dict[str, Stage]: if not self.range_table_: - if hasattr(RangeTable, 'model_validate'): - self.range_table_ = RangeTable.model_validate( # type: ignore - CacheData.readExcel('range_table') - ) - else: - self.range_table_ = RangeTable.parse_obj( - CacheData.readExcel('range_table') - ) + self.range_table_ = msgjson.decode( + CacheData.readBytesExcel('range_table'), + type=Dict[str, Stage] + ) return self.range_table_ @property - def REPLICATE_TABLE(self) -> ReplicateTable: + def REPLICATE_TABLE(self) -> Dict[str, ReplicateList]: if not self.replicate_table_: - if hasattr(ReplicateTable, 'model_validate'): - self.replicate_table_ = ReplicateTable.model_validate( # type: ignore - CacheData.readExcel('replicate_table') - ) - else: - self.replicate_table_ = ReplicateTable.parse_obj( - CacheData.readExcel('replicate_table') - ) + self.replicate_table_ = msgjson.decode( + CacheData.readBytesExcel('replicate_table'), + type=Dict[str, ReplicateList] + ) return self.replicate_table_ @property def RETRO_TABLE(self) -> RetroTable: if not self.retro_table_: - if hasattr(RetroTable, 'model_validate'): - self.retro_table_ = RetroTable.model_validate( # type: ignore - CacheData.readExcel('retro_table') - ) - else: - self.retro_table_ = RetroTable.parse_obj( - CacheData.readExcel('retro_table') - ) + self.retro_table_ = RetroTable.convert( + CacheData.readExcel('retro_table') + ) return self.retro_table_ @property def ROGUELIKE_TABLE(self) -> RoguelikeTable: if not self.roguelike_table_: - if hasattr(RoguelikeTable, 'model_validate'): - self.roguelike_table_ = RoguelikeTable.model_validate( # type: ignore - CacheData.readExcel('roguelike_table') - ) - else: - self.roguelike_table_ = RoguelikeTable.parse_obj( - CacheData.readExcel('roguelike_table') - ) + self.roguelike_table_ = RoguelikeTable.convert( + CacheData.readExcel('roguelike_table') + ) return self.roguelike_table_ @property def ROGUELIKE_TOPIC_TABLE(self) -> RoguelikeTopicTable: if not self.roguelike_topic_table_: - if hasattr(RoguelikeTopicTable, 'model_validate'): - self.roguelike_topic_table_ = RoguelikeTopicTable.model_validate( # type: ignore - CacheData.readExcel('roguelike_topic_table') - ) - else: - self.roguelike_topic_table_ = RoguelikeTopicTable.parse_obj( - CacheData.readExcel('roguelike_topic_table') - ) + self.roguelike_topic_table_ = RoguelikeTopicTable.convert( + CacheData.readExcel('roguelike_topic_table') + ) return self.roguelike_topic_table_ @property def SANDBOX_TABLE(self) -> SandboxTable: if not self.sandbox_table_: - if hasattr(SandboxTable, 'model_validate'): - self.sandbox_table_ = SandboxTable.model_validate( # type: ignore - CacheData.readExcel('sandbox_table') - ) - else: - self.sandbox_table_ = SandboxTable.parse_obj( - CacheData.readExcel('sandbox_table') - ) + self.sandbox_table_ = SandboxTable.convert( + CacheData.readExcel('sandbox_table') + ) return self.sandbox_table_ @property def SHOP_CLIENT_TABLE(self) -> ShopClientTable: if not self.shop_client_table_: - if hasattr(ShopClientTable, 'model_validate'): - self.shop_client_table_ = ShopClientTable.model_validate( # type: ignore - CacheData.readExcel('shop_client_table') - ) - else: - self.shop_client_table_ = ShopClientTable.parse_obj( - CacheData.readExcel('shop_client_table') - ) + self.shop_client_table_ = ShopClientTable.convert( + CacheData.readExcel('shop_client_table') + ) return self.shop_client_table_ @property - def SKILL_TABLE(self) -> SkillTable: + def SKILL_TABLE(self) -> Dict[str, SkillDataBundle]: if not self.skill_table_: - self.skill_table_ = SkillTable(CacheData.readExcel('skill_table')) + self.skill_table_ = msgjson.decode( + CacheData.readBytesExcel('skill_table'), + type=Dict[str, SkillDataBundle] + ) return self.skill_table_ @property def SKIN_TABLE(self) -> SkinTable: if not self.skin_table_: - if hasattr(SkinTable, 'model_validate'): - self.skin_table_ = SkinTable.model_validate( # type: ignore - CacheData.readExcel('skin_table') - ) - else: - self.skin_table_ = SkinTable.parse_obj( - CacheData.readExcel('skin_table') - ) + self.skin_table_ = SkinTable.convert( + CacheData.readExcel('skin_table') + ) return self.skin_table_ @property def STAGE_TABLE(self) -> StageTable: if not self.stage_table_: - if hasattr(StageTable, 'model_validate'): - self.stage_table_ = StageTable.model_validate( # type: ignore - CacheData.readExcel('stage_table') - ) - else: - self.stage_table_ = StageTable.parse_obj( - CacheData.readExcel('stage_table') - ) + self.stage_table_ = StageTable.convert( + CacheData.readExcel('stage_table') + ) return self.stage_table_ @property def STORY_REVIEW_META_TABLE(self) -> StoryReviewMetaTable: if not self.story_review_meta_table_: - if hasattr(StoryReviewMetaTable, 'model_validate'): - self.story_review_meta_table_ = StoryReviewMetaTable.model_validate( # type: ignore - CacheData.readExcel('story_review_meta_table') - ) - else: - self.story_review_meta_table_ = StoryReviewMetaTable.parse_obj( - CacheData.readExcel('story_review_meta_table') - ) + self.story_review_meta_table_ = StoryReviewMetaTable.convert( + CacheData.readExcel('story_review_meta_table') + ) return self.story_review_meta_table_ @property - def STORY_REVIEW_TABLE(self) -> StoryReviewTable: + def STORY_REVIEW_TABLE(self) -> Dict[str, StoryReviewGroupClientData]: if not self.story_review_table_: - self.story_review_table_ = StoryReviewTable( - CacheData.readExcel('story_review_table') + self.story_review_table_ = msgjson.decode( + CacheData.readBytesExcel('story_review_table'), + type=Dict[str, StoryReviewGroupClientData] ) return self.story_review_table_ @property - def STORY_TABLE(self) -> StoryTable: + def STORY_TABLE(self) -> Dict[str, StoryData]: if not self.story_table_: - self.story_table_ = StoryTable(CacheData.readExcel('story_table')) + self.story_table_ = msgjson.decode( + CacheData.readBytesExcel('story_table'), + type=Dict[str, StoryData] + ) return self.story_table_ @property def TECH_BUFF_TABLE(self) -> TechBuffTable: if not self.tech_buff_table_: - if hasattr(TechBuffTable, 'model_validate'): - self.tech_buff_table_ = TechBuffTable.model_validate( # type: ignore - CacheData.readExcel('tech_buff_table') - ) - else: - self.tech_buff_table_ = TechBuffTable.parse_obj( - CacheData.readExcel('tech_buff_table') - ) + self.tech_buff_table_ = TechBuffTable.convert( + CacheData.readExcel('tech_buff_table') + ) return self.tech_buff_table_ @property def TIP_TABLE(self) -> TipTable: if not self.tip_table_: - if hasattr(TipTable, 'model_validate'): - self.tip_table_ = TipTable.model_validate( # type: ignore - CacheData.readExcel('tip_table') - ) - else: - self.tip_table_ = TipTable.parse_obj( - CacheData.readExcel('tip_table') - ) + self.tip_table_ = TipTable.convert( + CacheData.readExcel('tip_table') + ) return self.tip_table_ @property - def TOKEN_TABLE(self) -> TokenTable: + def TOKEN_TABLE(self) -> Dict[str, TokenCharacterData]: if not self.token_table_: - self.token_table_ = TokenTable(CacheData.readExcel('token_table')) + self.token_table_ = msgjson.decode( + CacheData.readBytesExcel('token_table'), + type=Dict[str, TokenCharacterData] + ) return self.token_table_ @property def UNIEQUIP_DATA(self) -> UniequipData: if not self.uniequip_data_: - if hasattr(UniequipData, 'model_validate'): - self.uniequip_data_ = UniequipData.model_validate( # type: ignore - CacheData.readExcel('uniequip_data') - ) - else: - self.uniequip_data_ = UniequipData.parse_obj( - CacheData.readExcel('uniequip_data') - ) + self.uniequip_data_ = UniequipData.convert( + CacheData.readExcel('uniequip_data') + ) return self.uniequip_data_ @property def UNIEQUIP_TABLE(self) -> UniEquipTable: if not self.uniequip_table_: - if hasattr(UniEquipTable, 'model_validate'): - self.uniequip_table_ = UniEquipTable.model_validate( # type: ignore - CacheData.readExcel('uniequip_table') - ) - else: - self.uniequip_table_ = UniEquipTable.parse_obj( - CacheData.readExcel('uniequip_table') - ) + self.uniequip_table_ = UniEquipTable.convert( + CacheData.readExcel('uniequip_table') + ) return self.uniequip_table_ @property def ZONE_TABLE(self) -> ZoneTable: if not self.zone_table_: - if hasattr(ZoneTable, 'model_validate'): - self.zone_table_ = ZoneTable.model_validate( # type: ignore - CacheData.readExcel('zone_table') - ) - else: - self.zone_table_ = ZoneTable.parse_obj( - CacheData.readExcel('zone_table') - ) + self.zone_table_ = ZoneTable.convert( + CacheData.readExcel('zone_table') + ) return self.zone_table_ def preload_table(self) -> None: diff --git a/ArknightsUID/arknightsuid_user/__init__.py b/ArknightsUID/arknightsuid_user/__init__.py index 7c2e6d8..c998390 100644 --- a/ArknightsUID/arknightsuid_user/__init__.py +++ b/ArknightsUID/arknightsuid_user/__init__.py @@ -1,3 +1,4 @@ +from typing import List from gsuid_core.bot import Bot from gsuid_core.models import Event from gsuid_core.sv import SV @@ -50,7 +51,7 @@ async def send_link_uid_msg(bot: Bot, ev: Event): ) elif '切换' in ev.command: data = await ArknightsBind.switch_uid_by_game(qid, ev.bot_id, ark_uid) - if isinstance(data, list): + if isinstance(data, List): return await bot.send(f'切换ARK_UID{ark_uid}成功!') else: return await bot.send(f'尚未绑定该ARK_UID{ark_uid}') diff --git a/ArknightsUID/utils/api/skd/request.py b/ArknightsUID/utils/api/skd/request.py index cbbb7a8..0be4a0c 100644 --- a/ArknightsUID/utils/api/skd/request.py +++ b/ArknightsUID/utils/api/skd/request.py @@ -3,7 +3,7 @@ import hashlib import json import time import hmac -from typing import Any, ClassVar, Literal, cast +from typing import Any, ClassVar, Dict, Literal, Tuple, Union, cast from urllib.parse import urlparse import msgspec @@ -24,7 +24,7 @@ proxy_url = core_plugins_config.get_config('proxy').data ssl_verify = core_plugins_config.get_config('MhySSLVerify').data -_HEADER: dict[str, str] = { +_HEADER: Dict[str, str] = { 'Host': 'zonai.skland.com', 'platform': '1', 'Origin': 'https://www.skland.com', @@ -49,9 +49,9 @@ class TokenRefreshFailed(Exception): class BaseArkApi: - proxy_url: str | None = proxy_url if proxy_url else None + proxy_url: Union[str, None] = proxy_url if proxy_url else None - async def _pass(self, gt: str, ch: str) -> tuple[str | None, str | None]: + async def _pass(self, gt: str, ch: str) -> Tuple[Union[str, None], Union[str, None]]: _pass_api = core_plugins_config.get_config('_pass_API').data if _pass_api: data = await self._ark_request( @@ -68,8 +68,8 @@ class BaseArkApi: return validate, ch - async def get_game_player_info(self, uid: str) -> int | ArknightsPlayerInfoModel: - cred: str | None = await ArknightsUser.get_user_attr_by_uid(uid=uid, attr='cred') + async def get_game_player_info(self, uid: str) -> Union[int, ArknightsPlayerInfoModel]: + cred: Union[str, None] = await ArknightsUser.get_user_attr_by_uid(uid=uid, attr='cred') if cred is None: return -60 is_vaild = await self.check_cred_valid(cred) @@ -92,8 +92,8 @@ class BaseArkApi: else: return msgspec.convert(unpack_data, type=ArknightsPlayerInfoModel) - async def skd_sign(self, uid: str) -> int | ArknightsAttendanceModel: - cred: str | None = await ArknightsUser.get_user_attr_by_uid(uid=uid, attr='cred') + async def skd_sign(self, uid: str) -> Union[int, ArknightsAttendanceModel]: + cred: Union[str, None] = await ArknightsUser.get_user_attr_by_uid(uid=uid, attr='cred') if cred is None: return -60 is_vaild = await self.check_cred_valid(cred) @@ -127,8 +127,8 @@ class BaseArkApi: else: return msgspec.convert(unpack_data, ArknightsAttendanceModel) - async def get_sign_info(self, uid: str) -> int | ArknightsAttendanceCalendarModel: - cred: str | None = await ArknightsUser.get_user_attr_by_uid(uid=uid, attr='cred') + async def get_sign_info(self, uid: str) -> Union[int, ArknightsAttendanceCalendarModel]: + cred: Union[str, None] = await ArknightsUser.get_user_attr_by_uid(uid=uid, attr='cred') if cred is None: return -60 is_vaild = await self.check_cred_valid(cred) @@ -163,8 +163,8 @@ class BaseArkApi: return msgspec.convert(unpack_data, ArknightsAttendanceCalendarModel) async def check_cred_valid( - self, cred: str | None = None, token: str | None = None, uid: str | None = None - ) -> bool | ArknightsUserMeModel: + self, cred: Union[str, None] = None, token: Union[str, None] = None, uid: Union[str, None] = None + ) -> Union[bool, ArknightsUserMeModel]: if uid is not None: cred = cred if cred else await ArknightsUser.get_user_attr_by_uid(uid=uid, attr='cred') header = deepcopy(_HEADER) @@ -181,14 +181,14 @@ class BaseArkApi: unpack_data = self.unpack(raw_data) return msgspec.convert(unpack_data, type=ArknightsUserMeModel) - def unpack(self, raw_data: dict) -> dict: + def unpack(self, raw_data: Dict) -> Dict: try: data = raw_data['data'] return data except KeyError: return raw_data - async def refresh_token(self, cred: str, uid: str | None = None) -> str: + async def refresh_token(self, cred: str, uid: Union[str, None] = None) -> str: header = deepcopy(_HEADER) header['cred'] = cred header['sign_enable'] = 'false' @@ -205,11 +205,11 @@ class BaseArkApi: async def set_sign( self, url: str, - header: dict[str, Any], - data: dict[str, Any] | None = None, - params: dict[str, Any] | None = None, - token: str | None = None, - ) -> dict: + header: Dict[str, Any], + data: Union[Dict[str, Any], None ]= None, + params: Union[Dict[str, Any], None] = None, + token: Union[str, None] = None, + ) -> Dict: parsed_url = urlparse(url) path = parsed_url.path timestamp = str(int(time.time()) - 2) @@ -249,11 +249,11 @@ class BaseArkApi: self, url: str, method: Literal['GET', 'POST'] = 'GET', - header: dict[str, Any] = _HEADER, - params: dict[str, Any] | None = None, - data: dict[str, Any] | None = None, - use_proxy: bool | None = False, - ) -> dict | int: + header: Dict[str, Any] = _HEADER, + params: Union[Dict[str, Any], None] = None, + data: Union[Dict[str, Any], None] = None, + use_proxy: Union[bool, None] = False, + ) -> Union[Dict, int]: logger.debug(f'{url} {method} {header} {params} {data} {use_proxy}') try: raw_data = await self._ark_request( @@ -281,11 +281,11 @@ class BaseArkApi: self, url: str, method: Literal['GET', 'POST'] = 'GET', - header: dict[str, Any] = _HEADER, - params: dict[str, Any] | None = None, - data: dict[str, Any] | None = None, - use_proxy: bool | None = False, - ) -> dict | int: + header: Dict[str, Any] = _HEADER, + params: Union[Dict[str, Any], None ]= None, + data: Union[Dict[str, Any], None] = None, + use_proxy: Union[bool, None] = False, + ) -> Union[Dict, int]: async with ClientSession( connector=TCPConnector(verify_ssl=ssl_verify) ) as client: diff --git a/ArknightsUID/utils/database/models.py b/ArknightsUID/utils/database/models.py index d2a4c41..a4ada8b 100644 --- a/ArknightsUID/utils/database/models.py +++ b/ArknightsUID/utils/database/models.py @@ -1,4 +1,4 @@ -from typing import Literal +from typing import Dict, Literal, Union from gsuid_core.utils.database.base_models import Bind, Push, T_BaseIDModel, T_User, User, with_session, BaseModel from gsuid_core.webconsole.mount_app import GsAdminModel, PageSchema, site @@ -8,14 +8,14 @@ from sqlalchemy.ext.asyncio import AsyncSession class ArknightsBind(Bind, table=True): - uid: str | None = Field(default=None, title='明日方舟UID') + uid: Union[str, None] = Field(default=None, title='明日方舟UID') class ArknightsUser(User, table=True): - uid: str | None = Field(default=None, title='明日方舟UID') - skd_uid: str | None = Field(default=None, title='SKD用户ID') - cred: str | None = Field(default=None, title='SKD凭证') - token: str | None = Field(default=None, title='SKD Token') + uid: Union[str, None] = Field(default=None, title='明日方舟UID') + skd_uid: Union[str, None] = Field(default=None, title='SKD用户ID') + cred: Union[str, None] = Field(default=None, title='SKD凭证') + token: Union[str, None] = Field(default=None, title='SKD Token') @classmethod @with_session @@ -23,19 +23,19 @@ class ArknightsUser(User, table=True): cls, session: AsyncSession, cred: str - ) -> BaseModel | None: + ) -> Union[BaseModel, None]: sql= select(cls).where(cls.cred == cred) result = await session.execute(sql) data = result.scalars().all() return data[0] if data else None @classmethod - async def get_token_by_cred(cls, cred: str) -> str | None: + async def get_token_by_cred(cls, cred: str) -> Union[str, None]: result = await cls.select_data_by_cred(cred) return getattr(result, 'token') if result else None @classmethod - async def get_uid_by_cred(cls, cred: str) -> str | None: + async def get_uid_by_cred(cls, cred: str) -> Union[str, None]: result = await cls.select_data_by_cred(cred) return getattr(result, 'uid') if result else None @@ -55,14 +55,14 @@ class ArknightsUser(User, table=True): class ArknightsPush(Push, table=True): - uid: str | None = Field(default=None, title='明日方舟UID') - skd_uid: str | None = Field(default=None, title='森空岛用户ID') - ap_push: bool | None = Field(default=False, title='理智推送') - ap_value: int | None = Field(default=110, title='理智推送阈值') - ap_is_push: bool | None = Field(default=False, title='理智是否已经推送') - training_push: bool | None = Field(default=False, title='训练室推送') - training_value: int | None = Field(default=30, title='训练室推送阈值') - training_is_push: bool | None = Field(default=False, title='训练室是否已经推送') + uid: Union[str, None] = Field(default=None, title='明日方舟UID') + skd_uid: Union[str, None] = Field(default=None, title='森空岛用户ID') + ap_push: Union[bool, None] = Field(default=False, title='理智推送') + ap_value: Union[int, None] = Field(default=110, title='理智推送阈值') + ap_is_push: Union[bool, None] = Field(default=False, title='理智是否已经推送') + training_push: Union[bool, None] = Field(default=False, title='训练室推送') + training_value: Union[int, None] = Field(default=30, title='训练室推送阈值') + training_is_push: Union[bool, None] = Field(default=False, title='训练室是否已经推送') @classmethod async def insert_push_data(cls, uid: str, skd_uid: str): @@ -79,7 +79,7 @@ class ArknightsPush(Push, table=True): ) @classmethod - async def update_push_data(cls, uid: str, data: dict) -> bool: + async def update_push_data(cls, uid: str, data: Dict) -> bool: retcode = -1 if await cls.data_exist(uid=uid): retcode = await cls.update_data_by_uid( @@ -99,7 +99,7 @@ class ArknightsPush(Push, table=True): @classmethod async def select_push_data( cls: type[T_BaseIDModel], uid: str - ) -> T_BaseIDModel | None: + ) -> Union[T_BaseIDModel, None]: return await cls.base_select_data(uid=uid) @classmethod diff --git a/ArknightsUID/utils/error_reply.py b/ArknightsUID/utils/error_reply.py index 2e7d3bb..3c62475 100644 --- a/ArknightsUID/utils/error_reply.py +++ b/ArknightsUID/utils/error_reply.py @@ -1,6 +1,9 @@ +from typing import Union + + UID_HINT = '添加失败, 请先绑定明日方舟UID' -def get_error(retcode: int | str) -> str: +def get_error(retcode: Union[int, str]) -> str: if retcode == 10000: return '请求异常, 请检查具体实现代码...' if retcode == 10001: diff --git a/ArknightsUID/utils/file.py b/ArknightsUID/utils/file.py index 5e22743..94be422 100644 --- a/ArknightsUID/utils/file.py +++ b/ArknightsUID/utils/file.py @@ -1,10 +1,11 @@ import json from pathlib import Path +from typing import Dict from loguru import logger -def read_json(file_path: Path, **kwargs) -> dict: +def read_json(file_path: Path, **kwargs) -> Dict: """ Read a JSON file and return its contents as a dictionary. """ @@ -16,7 +17,7 @@ def read_json(file_path: Path, **kwargs) -> dict: return {} -def write_json(data: dict, file_path: Path) -> None: +def write_json(data: Dict, file_path: Path) -> None: """ Write a dictionary to a JSON file. """ diff --git a/ArknightsUID/utils/image/image_tools.py b/ArknightsUID/utils/image/image_tools.py index 3265e55..206a629 100644 --- a/ArknightsUID/utils/image/image_tools.py +++ b/ArknightsUID/utils/image/image_tools.py @@ -1,4 +1,5 @@ from pathlib import Path +from typing import Union from gsuid_core.utils.image.image_tools import CustomizeImage from PIL import Image @@ -9,7 +10,7 @@ SP_BG_PATH = BG_PATH / 'sp_bg' async def get_simple_bg( - based_w: int, based_h: int, image: str | None | Image.Image = None + based_w: int, based_h: int, image: Union[str, Union[None, Image.Image]] = None ) -> Image.Image: CIL = CustomizeImage(NM_BG_PATH) return CIL.get_image(image, based_w, based_h) diff --git a/ArknightsUID/utils/message.py b/ArknightsUID/utils/message.py index 96ba4b0..70130bd 100644 --- a/ArknightsUID/utils/message.py +++ b/ArknightsUID/utils/message.py @@ -1,9 +1,9 @@ -from typing import Any +from typing import Any, Dict, Union from gsuid_core.bot import Bot -async def send_diff_msg(bot: Bot, code: Any, data: dict | None = None): +async def send_diff_msg(bot: Bot, code: Any, data: Union[Dict, None] = None): if data is None: data = { 0: '绑定UID成功!', diff --git a/ArknightsUID/utils/models/common.py b/ArknightsUID/utils/models/common.py new file mode 100644 index 0000000..87359fa --- /dev/null +++ b/ArknightsUID/utils/models/common.py @@ -0,0 +1,126 @@ +import base64 +import json +from collections.abc import Callable, Iterable, Iterator +from copy import copy, deepcopy +from typing import Any, Dict, List, Tuple, TypeVar, Union + +from msgspec import Meta, Struct, UnsetType, convert, field +from msgspec import json as mscjson +from typing_extensions import dataclass_transform + +Model = TypeVar('Model', bound='BaseStruct') +T = TypeVar("T") + + +def transUnset(v: Union[T, UnsetType], d: Any = None) -> Union[T, Any]: + return v if not isinstance(v, UnsetType) else d + + +@dataclass_transform(field_specifiers=(field,)) +class BaseStruct(Struct, forbid_unknown_fields=True, omit_defaults=True, gc=False): + class Config: + encoder = mscjson.Encoder() + + @classmethod + def json_schema(cls) -> str: + return ( + f"```json\n{json.dumps(mscjson.schema(cls), ensure_ascii=False, indent=2)}" + ) + + @classmethod + def convert( + cls: type[Model], + obj: Any, + *, + strict: bool = True, + from_attributes: bool = False, + dec_hook: Union[Callable[[type, Any], Any], None] = None, + builtin_types: Union[Iterable[type], None] = None, + str_keys: bool = False, + ) -> Model: + return convert( + obj=obj, + type=cls, + strict=strict, + from_attributes=from_attributes, + dec_hook=dec_hook, + builtin_types=builtin_types, + str_keys=str_keys + ) + + def __post_init__( + self, + validate_whitespace: Union[List[str], None] = None, + validate_num_with_range: Union[List[Tuple[str, Meta]], None] = None, + validate_optional: Union[List[Tuple[str, Meta]], None] = None, + validate_int: Union[List[str], None] = None, + validate_base64: Union[List[str], None] = None, + ) -> None: + if validate_base64 is None: + validate_base64 = [] + if validate_int is None: + validate_int = [] + if validate_optional is None: + validate_optional = [] + if validate_num_with_range is None: + validate_num_with_range = [] + if validate_whitespace is None: + validate_whitespace = [] + for field_name in validate_whitespace: + if (field_value := getattr(self, field_name)) is not None: + if isinstance(field_value, str) and not field_value.strip(): + raise ValueError( + f'child "{field_name}" fails because ["{field_name}" is not allowed to be empty]' + ) + + for field_group in validate_num_with_range: + if (field_value := getattr(self, field_group[0])) is not None: + if field_value > (le := field_group[1].le or field_value): + raise ValueError(f'"{field_group[0]}" must be less than {le}') + if field_value < (ge := field_group[1].ge or field_value): + raise ValueError(f'"{field_group[0]}" must be greater than {ge}') + + for field_group in validate_optional: + if (field_value := getattr(self, field_group[0])) is not None: + if field_value not in field_group[1].examples: + raise ValueError( + f'"{field_group[0]}" must be one of {field_group[1]}' + ) + + for field_name in validate_int: + if (field_value := getattr(self, field_name)) is not None: + if not field_value.isdigit(): + raise ValueError( + f'child "{field_name}" fails because ["{field_name}" must be a number]' + ) + + for field_name in validate_base64: + try: + base64.b64decode(getattr(self, field_name)) + except Exception as e: + raise ValueError( + f'child "{field_name}" fails because ["{field_name}" must be a valid base64 string]' + ) from e + + def __iter__(self) -> Iterator[Tuple[str, Any]]: + for field_name in self.__struct_fields__: + yield field_name, getattr(self, field_name) + + def __getattribute__(self, __name: str) -> Union[Any, None]: + value = super().__getattribute__(__name) + if isinstance(value, UnsetType): + return None + return value + + def keys(self) -> Iterator[str]: + yield from self.__struct_fields__ + + def values(self) -> Iterator[Any]: + for field_name in self.__struct_fields__: + yield getattr(self, field_name) + + def model_dump(self) -> Dict[str, Any]: + return mscjson.decode(mscjson.encode(self)) + + def model_copy(self: Model, *, deep: bool = False) -> Model: + return deepcopy(self) if deep else copy(self) diff --git a/ArknightsUID/utils/models/gamedata/ActivityTable.py b/ArknightsUID/utils/models/gamedata/ActivityTable.py index 6e7b77a..9541759 100644 --- a/ArknightsUID/utils/models/gamedata/ActivityTable.py +++ b/ArknightsUID/utils/models/gamedata/ActivityTable.py @@ -1,86 +1,87 @@ -from typing import Any -from pydantic import BaseModel, Field +from typing import Any, Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ActivityTableBasicData(BaseModel): - id_: str = Field(alias='id') - type_: str = Field(alias='type') - displayType: str | None = None +class ActivityTableBasicData(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') name: str startTime: int endTime: int rewardEndTime: int displayOnHome: bool hasStage: bool - templateShopId: str | None - medalGroupId: str | None - ungroupedMedalIds: list[str] | None = None + templateShopId: Union[str, None] + medalGroupId: Union[str, None] isReplicate: bool needFixedSync: bool + displayType: Union[str, None] = None + ungroupedMedalIds: Union[List[str], None] = None -class ActivityTableHomeActivityConfig(BaseModel): +class ActivityTableHomeActivityConfig(BaseStruct): actId: str isPopupAfterCheckin: bool showTopBarMenu: bool - actTopBarColor: str | None - actTopBarText: str | None + actTopBarColor: Union[str, None] + actTopBarText: Union[str, None] -class MissionDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class MissionDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') count: int -class MissionData(BaseModel): - id_: str = Field(alias='id') +class MissionData(BaseStruct): + id_: str = field(name='id') sortId: int description: str - type_: str = Field(alias='type') + type_: str = field(name='type') itemBgType: str - preMissionIds: list[str] | None + preMissionIds: Union[List[str], None] template: str templateType: str - param: list[str] - unlockCondition: str | None - unlockParam: list[str] | None + param: List[str] + unlockCondition: Union[str, None] + unlockParam: Union[List[str], None] missionGroup: str - toPage: str | None + toPage: Union[str, None] periodicalPoint: int - rewards: list[MissionDisplayRewards] | None - backImagePath: str | None - foldId: str | None + rewards: Union[List[MissionDisplayRewards], None] + backImagePath: Union[str, None] + foldId: Union[str, None] haveSubMissionToUnlock: bool -class MissionGroup(BaseModel): - id_: str = Field(alias='id') - title: str | None - type_: str = Field(alias='type') - preMissionGroup: str | None - period: list[int] | None - rewards: list[MissionDisplayRewards] | None - missionIds: list[str] +class MissionGroup(BaseStruct): + id_: str = field(name='id') + title: Union[str, None] + type_: str = field(name='type') + preMissionGroup: Union[str, None] + period: Union[List[int], None] + rewards: Union[List[MissionDisplayRewards], None] + missionIds: List[str] startTs: int endTs: int -class DefaultZoneData(BaseModel): +class DefaultZoneData(BaseStruct): zoneId: str zoneIndex: str zoneName: str zoneDesc: str - itemDropList: list[str] + itemDropList: List[str] -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class DefaultShopData(BaseModel): +class DefaultShopData(BaseStruct): goodId: str slotId: int price: int @@ -89,13 +90,13 @@ class DefaultShopData(BaseModel): item: ItemBundle -class DefaultFirstData(BaseModel): - zoneList: list[DefaultZoneData] - shopList: list[DefaultShopData] | None +class DefaultFirstData(BaseStruct): + zoneList: List[DefaultZoneData] + shopList: Union[List[DefaultShopData], None] -class DefaultCheckInDataCheckInDailyInfo(BaseModel): - itemList: list[ItemBundle] +class DefaultCheckInDataCheckInDailyInfo(BaseStruct): + itemList: List[ItemBundle] order: int color: int keyItem: int @@ -103,63 +104,63 @@ class DefaultCheckInDataCheckInDailyInfo(BaseModel): isDynItem: bool -class DefaultCheckInDataDynCheckInDailyInfo(BaseModel): +class DefaultCheckInDataDynCheckInDailyInfo(BaseStruct): questionDesc: str preOption: str - optionList: list[str] + optionList: List[str] showDay: int spOrderIconId: str spOrderDesc: str spOrderCompleteDesc: str -class DefaultCheckInDataOptionInfo(BaseModel): - optionDesc: str | None - showImageId1: str | None - showImageId2: str | None - optionCompleteDesc: str | None +class DefaultCheckInDataOptionInfo(BaseStruct): + optionDesc: Union[str, None] + showImageId1: Union[str, None] + showImageId2: Union[str, None] + optionCompleteDesc: Union[str, None] isStart: bool -class DefaultCheckInDataDynamicCheckInConsts(BaseModel): +class DefaultCheckInDataDynamicCheckInConsts(BaseStruct): firstQuestionDesc: str firstQuestionTipsDesc: str expirationDesc: str firstQuestionConfirmDesc: str -class DefaultCheckInDataDynamicCheckInData(BaseModel): - dynCheckInDict: dict[str, DefaultCheckInDataDynCheckInDailyInfo] - dynOptionDict: dict[str, DefaultCheckInDataOptionInfo] - dynItemDict: dict[str, list[ItemBundle]] +class DefaultCheckInDataDynamicCheckInData(BaseStruct): + dynCheckInDict: Dict[str, DefaultCheckInDataDynCheckInDailyInfo] + dynOptionDict: Dict[str, DefaultCheckInDataOptionInfo] + dynItemDict: Dict[str, List[ItemBundle]] constData: DefaultCheckInDataDynamicCheckInConsts initOption: str -class DefaultCheckInDataExtraCheckinDailyInfo(BaseModel): +class DefaultCheckInDataExtraCheckinDailyInfo(BaseStruct): order: int blessing: str absolutData: int adTip: str relativeData: int - itemList: list[ItemBundle] + itemList: List[ItemBundle] -class DefaultCheckInData(BaseModel): - checkInList: dict[str, DefaultCheckInDataCheckInDailyInfo] - apSupplyOutOfDateDict: dict[str, int] - dynCheckInData: DefaultCheckInDataDynamicCheckInData | None = None - extraCheckinList: list[DefaultCheckInDataExtraCheckinDailyInfo] | None +class DefaultCheckInData(BaseStruct): + checkInList: Dict[str, DefaultCheckInDataCheckInDailyInfo] + apSupplyOutOfDateDict: Dict[str, int] + extraCheckinList: Union[List[DefaultCheckInDataExtraCheckinDailyInfo], None] + dynCheckInData: Union[DefaultCheckInDataDynamicCheckInData, None] = None -class AllPlayerCheckinDataDailyInfo(BaseModel): - itemList: list[ItemBundle] +class AllPlayerCheckinDataDailyInfo(BaseStruct): + itemList: List[ItemBundle] order: int keyItem: bool showItemOrder: int -class AllPlayerCheckinDataPublicBehaviour(BaseModel): +class AllPlayerCheckinDataPublicBehaviour(BaseStruct): sortId: int allBehaviorId: str displayOrder: int @@ -167,10 +168,10 @@ class AllPlayerCheckinDataPublicBehaviour(BaseModel): requiringValue: int requireRepeatCompletion: bool rewardReceivedDesc: str - rewards: list[ItemBundle] + rewards: List[ItemBundle] -class AllPlayerCheckinDataPersonalBehaviour(BaseModel): +class AllPlayerCheckinDataPersonalBehaviour(BaseStruct): sortId: int personalBehaviorId: str displayOrder: int @@ -178,165 +179,165 @@ class AllPlayerCheckinDataPersonalBehaviour(BaseModel): desc: str -class AllPlayerCheckinDataConstData(BaseModel): +class AllPlayerCheckinDataConstData(BaseStruct): characterName: str skinName: str -class AllPlayerCheckinData(BaseModel): - checkInList: dict[str, AllPlayerCheckinDataDailyInfo] - apSupplyOutOfDateDict: dict[str, int] - pubBhvs: dict[str, AllPlayerCheckinDataPublicBehaviour] - personalBhvs: dict[str, AllPlayerCheckinDataPersonalBehaviour] +class AllPlayerCheckinData(BaseStruct): + checkInList: Dict[str, AllPlayerCheckinDataDailyInfo] + apSupplyOutOfDateDict: Dict[str, int] + pubBhvs: Dict[str, AllPlayerCheckinDataPublicBehaviour] + personalBhvs: Dict[str, AllPlayerCheckinDataPersonalBehaviour] constData: AllPlayerCheckinDataConstData -class VersusCheckInDataDailyInfo(BaseModel): - rewardList: list[ItemBundle] +class VersusCheckInDataDailyInfo(BaseStruct): + rewardList: List[ItemBundle] order: int -class VersusCheckInDataVoteData(BaseModel): +class VersusCheckInDataVoteData(BaseStruct): plSweetNum: int plSaltyNum: int plTaste: int -class VersusCheckInDataTasteInfoData(BaseModel): +class VersusCheckInDataTasteInfoData(BaseStruct): plTaste: int tasteType: str tasteText: str -class VersusCheckInDataTasteRewardData(BaseModel): +class VersusCheckInDataTasteRewardData(BaseStruct): tasteType: str rewardItem: ItemBundle -class VersusCheckInData(BaseModel): - checkInDict: dict[str, VersusCheckInDataDailyInfo] - voteTasteList: list[VersusCheckInDataVoteData] - tasteInfoDict: dict[str, VersusCheckInDataTasteInfoData] - tasteRewardDict: dict[str, VersusCheckInDataTasteRewardData] - apSupplyOutOfDateDict: dict[str, int] +class VersusCheckInData(BaseStruct): + checkInDict: Dict[str, VersusCheckInDataDailyInfo] + voteTasteList: List[VersusCheckInDataVoteData] + tasteInfoDict: Dict[str, VersusCheckInDataTasteInfoData] + tasteRewardDict: Dict[str, VersusCheckInDataTasteRewardData] + apSupplyOutOfDateDict: Dict[str, int] versusTotalDays: int ruleText: str -class Act3D0DataCampBasicInfo(BaseModel): +class Act3D0DataCampBasicInfo(BaseStruct): campId: str campName: str campDesc: str - rewardDesc: str | None + rewardDesc: Union[str, None] -class Act3D0DataLimitedPoolDetailInfoPoolItemInfo(BaseModel): +class Act3D0DataLimitedPoolDetailInfoPoolItemInfo(BaseStruct): goodId: str - itemInfo: ItemBundle | None + itemInfo: Union[ItemBundle, None] goodType: str perCount: int totalCount: int weight: int - type_: str = Field(alias='type') + type_: str = field(name='type') orderId: int -class Act3D0DataLimitedPoolDetailInfo(BaseModel): +class Act3D0DataLimitedPoolDetailInfo(BaseStruct): poolId: str - poolItemInfo: list[Act3D0DataLimitedPoolDetailInfoPoolItemInfo] + poolItemInfo: List[Act3D0DataLimitedPoolDetailInfoPoolItemInfo] -class Act3D0DataInfinitePoolDetailInfoPoolItemInfo(BaseModel): +class Act3D0DataInfinitePoolDetailInfoPoolItemInfo(BaseStruct): goodId: str itemInfo: ItemBundle goodType: str perCount: int weight: int - type_: str = Field(alias='type') + type_: str = field(name='type') orderId: int -class Act3D0DataInfinitePoolDetailInfo(BaseModel): +class Act3D0DataInfinitePoolDetailInfo(BaseStruct): poolId: str - poolItemInfo: list[Act3D0DataInfinitePoolDetailInfoPoolItemInfo] + poolItemInfo: List[Act3D0DataInfinitePoolDetailInfoPoolItemInfo] -class Act3D0DataInfinitePoolPercent(BaseModel): - percentDict: dict[str, int] +class Act3D0DataInfinitePoolPercent(BaseStruct): + percentDict: Dict[str, int] -class Act3D0DataCampItemMapInfo(BaseModel): +class Act3D0DataCampItemMapInfo(BaseStruct): goodId: str - itemDict: dict[str, ItemBundle] + itemDict: Dict[str, ItemBundle] -class Act3D0DataClueInfo(BaseModel): +class Act3D0DataClueInfo(BaseStruct): itemId: str campId: str orderId: int imageId: str -class Act3D0DataMileStoneInfo(BaseModel): +class Act3D0DataMileStoneInfo(BaseStruct): mileStoneId: str orderId: int mileStoneType: int - normalItem: ItemBundle | None - specialItemDict: dict[str, ItemBundle] + normalItem: Union[ItemBundle, None] + specialItemDict: Dict[str, ItemBundle] tokenNum: int -class Act3D0DataGachaBoxInfo(BaseModel): +class Act3D0DataGachaBoxInfo(BaseStruct): gachaBoxId: str boxType: str - keyGoodId: str | None + keyGoodId: Union[str, None] tokenId: ItemBundle tokenNumOnce: int - unlockImg: str | None - nextGachaBoxInfoId: str | None + unlockImg: Union[str, None] + nextGachaBoxInfoId: Union[str, None] -class Act3D0DataCampInfo(BaseModel): +class Act3D0DataCampInfo(BaseStruct): campId: str campChineseName: str -class Act3D0DataZoneDescInfo(BaseModel): +class Act3D0DataZoneDescInfo(BaseStruct): zoneId: str - lockedText: str | None + lockedText: Union[str, None] -class CommonFavorUpInfo(BaseModel): +class CommonFavorUpInfo(BaseStruct): charId: str displayStartTime: int displayEndTime: int -class Act3D0Data(BaseModel): - campBasicInfo: dict[str, Act3D0DataCampBasicInfo] - limitedPoolList: dict[str, Act3D0DataLimitedPoolDetailInfo] - infinitePoolList: dict[str, Act3D0DataInfinitePoolDetailInfo] - infinitePercent: dict[str, Act3D0DataInfinitePoolPercent] | None - campItemMapInfo: dict[str, Act3D0DataCampItemMapInfo] - clueInfo: dict[str, Act3D0DataClueInfo] - mileStoneInfo: list[Act3D0DataMileStoneInfo] +class Act3D0Data(BaseStruct): + campBasicInfo: Dict[str, Act3D0DataCampBasicInfo] + limitedPoolList: Dict[str, Act3D0DataLimitedPoolDetailInfo] + infinitePoolList: Dict[str, Act3D0DataInfinitePoolDetailInfo] + infinitePercent: Union[Dict[str, Act3D0DataInfinitePoolPercent], None] + campItemMapInfo: Dict[str, Act3D0DataCampItemMapInfo] + clueInfo: Dict[str, Act3D0DataClueInfo] + mileStoneInfo: List[Act3D0DataMileStoneInfo] mileStoneTokenId: str coinTokenId: str etTokenId: str - gachaBoxInfo: list[Act3D0DataGachaBoxInfo] - campInfo: dict[str, Act3D0DataCampInfo] | None - zoneDesc: dict[str, Act3D0DataZoneDescInfo] - favorUpList: dict[str, CommonFavorUpInfo] | None + gachaBoxInfo: List[Act3D0DataGachaBoxInfo] + campInfo: Union[Dict[str, Act3D0DataCampInfo], None] + zoneDesc: Dict[str, Act3D0DataZoneDescInfo] + favorUpList: Union[Dict[str, CommonFavorUpInfo], None] -class Act4D0DataMileStoneItemInfo(BaseModel): +class Act4D0DataMileStoneItemInfo(BaseStruct): mileStoneId: str orderId: int tokenNum: int item: ItemBundle -class Act4D0DataMileStoneStoryInfo(BaseModel): +class Act4D0DataMileStoneStoryInfo(BaseStruct): mileStoneId: str orderId: int tokenNum: int @@ -344,7 +345,7 @@ class Act4D0DataMileStoneStoryInfo(BaseModel): desc: str -class Act4D0DataStoryInfo(BaseModel): +class Act4D0DataStoryInfo(BaseStruct): storyKey: str storyId: str storySort: str @@ -353,7 +354,7 @@ class Act4D0DataStoryInfo(BaseModel): storyDesc: str -class Act4D0DataStageJumpInfo(BaseModel): +class Act4D0DataStageJumpInfo(BaseStruct): stageKey: str zoneId: str stageId: str @@ -361,18 +362,18 @@ class Act4D0DataStageJumpInfo(BaseModel): lockDesc: str -class Act4D0Data(BaseModel): - mileStoneItemList: list[Act4D0DataMileStoneItemInfo] - mileStoneStoryList: list[Act4D0DataMileStoneStoryInfo] - storyInfoList: list[Act4D0DataStoryInfo] - stageInfo: list[Act4D0DataStageJumpInfo] +class Act4D0Data(BaseStruct): + mileStoneItemList: List[Act4D0DataMileStoneItemInfo] + mileStoneStoryList: List[Act4D0DataMileStoneStoryInfo] + storyInfoList: List[Act4D0DataStoryInfo] + stageInfo: List[Act4D0DataStageJumpInfo] tokenItem: ItemBundle charStoneId: str - apSupplyOutOfDateDict: dict[str, int] - extraDropZones: list[str] + apSupplyOutOfDateDict: Dict[str, int] + extraDropZones: List[str] -class MileStoneInfo(BaseModel): +class MileStoneInfo(BaseStruct): mileStoneId: str orderId: int tokenNum: int @@ -381,26 +382,26 @@ class MileStoneInfo(BaseModel): IsBonus: int -class Act5D0DataZoneDescInfo(BaseModel): +class Act5D0DataZoneDescInfo(BaseStruct): zoneId: str - lockedText: str | None + lockedText: Union[str, None] -class Act5D0DataMissionExtraInfo(BaseModel): +class Act5D0DataMissionExtraInfo(BaseStruct): difficultLevel: int levelDesc: str sortId: int -class Act5D0Data(BaseModel): - mileStoneInfo: list[MileStoneInfo] +class Act5D0Data(BaseStruct): + mileStoneInfo: List[MileStoneInfo] mileStoneTokenId: str - zoneDesc: dict[str, Act5D0DataZoneDescInfo] - missionExtraList: dict[str, Act5D0DataMissionExtraInfo] + zoneDesc: Dict[str, Act5D0DataZoneDescInfo] + missionExtraList: Dict[str, Act5D0DataMissionExtraInfo] spReward: str -class Act5D1DataRuneStageData(BaseModel): +class Act5D1DataRuneStageData(BaseStruct): stageId: str levelId: str code: str @@ -410,18 +411,18 @@ class Act5D1DataRuneStageData(BaseModel): picId: str -class Act5D1DataRuneRecurrentStateData(BaseModel): +class Act5D1DataRuneRecurrentStateData(BaseStruct): runeReId: str stageId: str slotId: int startTime: int endTime: int - runeList: list[str] + runeList: List[str] isAvail: bool warningPoint: int -class Act5D1DataRuneUnlockData(BaseModel): +class Act5D1DataRuneUnlockData(BaseStruct): runeId: str priceItem: ItemBundle runeName: str @@ -431,13 +432,13 @@ class Act5D1DataRuneUnlockData(BaseModel): iconId: str -class Act5D1DataRuneReleaseData(BaseModel): +class Act5D1DataRuneReleaseData(BaseStruct): runeId: str stageId: str releaseTime: int -class Act5D1DataShopGood(BaseModel): +class Act5D1DataShopGood(BaseStruct): goodId: str slotId: int price: int @@ -447,126 +448,127 @@ class Act5D1DataShopGood(BaseModel): goodType: str -class Act5D1DataProgessGoodItem(BaseModel): +class Act5D1DataProgessGoodItem(BaseStruct): order: int price: int displayName: str item: ItemBundle -class Act5D1DataShopData(BaseModel): - shopGoods: dict[str, Act5D1DataShopGood] - progressGoods: dict[str, list[Act5D1DataProgessGoodItem]] +class Act5D1DataShopData(BaseStruct): + shopGoods: Dict[str, Act5D1DataShopGood] + progressGoods: Dict[str, List[Act5D1DataProgessGoodItem]] -class RuneDataSelector(BaseModel): - professionMask: int | str +class RuneDataSelector(BaseStruct): + professionMask: Union[int, str] buildableMask: int - charIdFilter: list[str] | None - enemyIdFilter: list[str] | None - enemyIdExcludeFilter: list[str] | None - skillIdFilter: list[str] | None - tileKeyFilter: list[str] | None - groupTagFilter: list[str] | None - filterTagFilter: list[str] | None + charIdFilter: Union[List[str], None] + enemyIdFilter: Union[List[str], None] + enemyIdExcludeFilter: Union[List[str], None] + skillIdFilter: Union[List[str], None] + tileKeyFilter: Union[List[str], None] + groupTagFilter: Union[List[str], None] + filterTagFilter: Union[List[str], None] + subProfessionExcludeFilter: Union[List[str], None] -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class RuneData(BaseModel): +class RuneData(BaseStruct): key: str selector: RuneDataSelector - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class RuneTablePackedRuneData(BaseModel): - id_: str = Field(alias='id') +class RuneTablePackedRuneData(BaseStruct): + id_: str = field(name='id') points: float - mutexGroupKey: str | None + mutexGroupKey: Union[str, None] description: str - runes: list[RuneData] + runes: List[RuneData] -class RuneTableRuneStageExtraData(BaseModel): +class RuneTableRuneStageExtraData(BaseStruct): stageId: str - runes: list[RuneTablePackedRuneData] + runes: List[RuneTablePackedRuneData] -class Act5D1Data(BaseModel): - stageCommonData: list[Act5D1DataRuneStageData] - runeStageData: list[Act5D1DataRuneRecurrentStateData] - runeUnlockDict: dict[str, list[Act5D1DataRuneUnlockData]] - runeReleaseData: list[Act5D1DataRuneReleaseData] - missionData: list[MissionData] - missionGroup: list[MissionGroup] - useBenefitMissionDict: dict[str, bool] +class Act5D1Data(BaseStruct): + stageCommonData: List[Act5D1DataRuneStageData] + runeStageData: List[Act5D1DataRuneRecurrentStateData] + runeUnlockDict: Dict[str, List[Act5D1DataRuneUnlockData]] + runeReleaseData: List[Act5D1DataRuneReleaseData] + missionData: List[MissionData] + missionGroup: List[MissionGroup] + useBenefitMissionDict: Dict[str, bool] shopData: Act5D1DataShopData coinItemId: str ptItemId: str - stageRune: list[RuneTableRuneStageExtraData] - showRuneMissionList: list[str] + stageRune: List[RuneTableRuneStageExtraData] + showRuneMissionList: List[str] -class ActivityCollectionDataCollectionInfo(BaseModel): - id_: int = Field(alias='id') +class ActivityCollectionDataCollectionInfo(BaseStruct): + id_: int = field(name='id') itemType: str itemId: str itemCnt: int pointId: str pointCnt: int isBonus: bool - pngName: str | None + pngName: Union[str, None] pngSort: int isShow: bool showInList: bool showIconBG: bool -class ActivityCollectionData(BaseModel): - collections: list[ActivityCollectionDataCollectionInfo] - apSupplyOutOfDateDict: dict[str, int] +class ActivityCollectionData(BaseStruct): + collections: List[ActivityCollectionDataCollectionInfo] + apSupplyOutOfDateDict: Dict[str, int] -class Act9D0DataZoneDescInfo(BaseModel): +class Act9D0DataZoneDescInfo(BaseStruct): zoneId: str unlockText: str displayStartTime: int -class Act9D0DataFavorUpInfo(BaseModel): +class Act9D0DataFavorUpInfo(BaseStruct): charId: str displayStartTime: int displayEndTime: int -class Act9D0DataSubMissionInfo(BaseModel): +class Act9D0DataSubMissionInfo(BaseStruct): missionId: str missionTitle: str sortId: int missionIndex: str -class Act9D0DataActivityNewsStyleInfo(BaseModel): +class Act9D0DataActivityNewsStyleInfo(BaseStruct): typeId: str typeName: str typeLogo: str typeMainLogo: str -class Act9D0DataActivityNewsLine(BaseModel): +class Act9D0DataActivityNewsLine(BaseStruct): lineType: int content: str -class Act9D0DataActivityNewsInfo(BaseModel): +class Act9D0DataActivityNewsInfo(BaseStruct): newsId: str newsSortId: int styleInfo: Act9D0DataActivityNewsStyleInfo - preposedStage: str | None + preposedStage: Union[str, None] titlePic: str newsTitle: str newsInfShow: int @@ -575,27 +577,27 @@ class Act9D0DataActivityNewsInfo(BaseModel): newsParam1: int newsParam2: int newsParam3: float - newsLines: list[Act9D0DataActivityNewsLine] + newsLines: List[Act9D0DataActivityNewsLine] -class Act9D0DataActivityNewsServerInfo(BaseModel): +class Act9D0DataActivityNewsServerInfo(BaseStruct): newsId: str preposedStage: str -class Act9D0Data(BaseModel): +class Act9D0Data(BaseStruct): tokenItemId: str - zoneDescList: dict[str, Act9D0DataZoneDescInfo] - favorUpList: dict[str, Act9D0DataFavorUpInfo] - subMissionInfo: dict[str, Act9D0DataSubMissionInfo] | None + zoneDescList: Dict[str, Act9D0DataZoneDescInfo] + favorUpList: Dict[str, Act9D0DataFavorUpInfo] + subMissionInfo: Union[Dict[str, Act9D0DataSubMissionInfo], None] hasSubMission: bool - apSupplyOutOfDateDict: dict[str, int] - newsInfoList: dict[str, Act9D0DataActivityNewsInfo] | None - newsServerInfoList: dict[str, Act9D0DataActivityNewsServerInfo] | None - miscHub: dict[str, str] + apSupplyOutOfDateDict: Dict[str, int] + newsInfoList: Union[Dict[str, Act9D0DataActivityNewsInfo], None] + newsServerInfoList: Union[Dict[str, Act9D0DataActivityNewsServerInfo], None] + miscHub: Dict[str, str] -class Act12SideDataConstData(BaseModel): +class Act12SideDataConstData(BaseStruct): recycleRewardThreshold: int charmRepoUnlockStageId: str recycleLowThreshold: int @@ -608,21 +610,21 @@ class Act12SideDataConstData(BaseModel): fogUnlockDesc: str -class Act12SideDataZoneAdditionData(BaseModel): +class Act12SideDataZoneAdditionData(BaseStruct): zoneId: str unlockText: str zoneClass: str -class Act12SideDataMissionDescInfo(BaseModel): +class Act12SideDataMissionDescInfo(BaseStruct): zoneClass: str specialMissionDesc: str needLock: bool - unlockHint: str | None - unlockStage: str | None + unlockHint: Union[str, None] + unlockStage: Union[str, None] -class Act12SideDataMileStoneInfo(BaseModel): +class Act12SideDataMileStoneInfo(BaseStruct): mileStoneId: str orderId: int tokenNum: int @@ -631,32 +633,32 @@ class Act12SideDataMileStoneInfo(BaseModel): mileStoneStage: int -class Act12SideDataPhotoInfo(BaseModel): +class Act12SideDataPhotoInfo(BaseStruct): picId: str picName: str mileStoneId: str picDesc: str - jumpStageId: str | None + jumpStageId: Union[str, None] -class Act12SideDataRecycleDialogData(BaseModel): +class Act12SideDataRecycleDialogData(BaseStruct): dialogType: str dialog: str dialogExpress: str -class Act12SideData(BaseModel): +class Act12SideData(BaseStruct): constData: Act12SideDataConstData - zoneAdditionDataList: list[Act12SideDataZoneAdditionData] - missionDescList: dict[str, Act12SideDataMissionDescInfo] - mileStoneInfoList: list[Act12SideDataMileStoneInfo] - photoList: dict[str, Act12SideDataPhotoInfo] - recycleDialogDict: dict[str, list[Act12SideDataRecycleDialogData]] + zoneAdditionDataList: List[Act12SideDataZoneAdditionData] + missionDescList: Dict[str, Act12SideDataMissionDescInfo] + mileStoneInfoList: List[Act12SideDataMileStoneInfo] + photoList: Dict[str, Act12SideDataPhotoInfo] + recycleDialogDict: Dict[str, List[Act12SideDataRecycleDialogData]] -class Act13SideDataConstData(BaseModel): - prestigeDescList: list[str] - dailyRandomCount: list[list[int]] | None +class Act13SideDataConstData(BaseStruct): + prestigeDescList: List[str] + dailyRandomCount: Union[List[List[int]], None] dailyWeightInitial: int dailyWeightComplete: int agendaRecover: int @@ -664,130 +666,130 @@ class Act13SideDataConstData(BaseModel): agendaHint: int missionPoolMax: int missionBoardMax: int - itemRandomList: list[ItemBundle] + itemRandomList: List[ItemBundle] unlockPrestigeCond: str hotSpotShowFlag: int -class Act13SideDataPrestigeData(BaseModel): +class Act13SideDataPrestigeData(BaseStruct): rank: str threshold: int - reward: ItemBundle | None + reward: Union[ItemBundle, None] newsCount: int archiveCount: int avgCount: int -class Act13SideDataLongTermMissionGroupData(BaseModel): +class Act13SideDataLongTermMissionGroupData(BaseStruct): groupId: str groupName: str orgId: str - missionList: list[str] + missionList: List[str] -class Act13SideDataOrgSectionData(BaseModel): +class Act13SideDataOrgSectionData(BaseStruct): sectionName: str sortId: int groupData: Act13SideDataLongTermMissionGroupData -class Act13SideDataOrgData(BaseModel): +class Act13SideDataOrgData(BaseStruct): orgId: str orgName: str orgEnName: str openTime: int - principalIdList: list[str] - prestigeList: list[Act13SideDataPrestigeData] - agendaCount2PrestigeItemMap: dict[str, ItemBundle] - orgSectionList: list[Act13SideDataOrgSectionData] + principalIdList: List[str] + prestigeList: List[Act13SideDataPrestigeData] + agendaCount2PrestigeItemMap: Dict[str, ItemBundle] + orgSectionList: List[Act13SideDataOrgSectionData] prestigeItem: ItemBundle -class Act13SideDataPrincipalData(BaseModel): +class Act13SideDataPrincipalData(BaseStruct): principalId: str principalName: str principalEnName: str avgCharId: str - principalDescList: list[str] + principalDescList: List[str] -class Act13SideDataLongTermMissionData(BaseModel): +class Act13SideDataLongTermMissionData(BaseStruct): missionName: str groupId: str principalId: str finishedDesc: str sectionSortId: int haveStageBtn: bool - jumpStageId: str | None + jumpStageId: Union[str, None] -class Act13SideDataDailyMissionData(BaseModel): - id_: str = Field(alias='id') +class Act13SideDataDailyMissionData(BaseStruct): + id_: str = field(name='id') sortId: int description: str missionName: str template: str templateType: str - param: list[str] - rewards: list[MissionDisplayRewards] | None - orgPool: list[str] | None - rewardPool: list[str] | None + param: List[str] + rewards: Union[List[MissionDisplayRewards], None] + orgPool: Union[List[str], None] + rewardPool: Union[List[str], None] jumpStageId: str agendaCount: int -class Act13SideDataDailyMissionRewardGroupData(BaseModel): +class Act13SideDataDailyMissionRewardGroupData(BaseStruct): groupId: str - rewards: list[ItemBundle] + rewards: List[ItemBundle] -class Act13SideDataArchiveItemUnlockData(BaseModel): +class Act13SideDataArchiveItemUnlockData(BaseStruct): itemId: str itemType: str unlockCondition: str - param1: str | None - param2: str | None + param1: Union[str, None] + param2: Union[str, None] -class ActivityTableActHiddenAreaPreposeStageData(BaseModel): +class ActivityTableActHiddenAreaPreposeStageData(BaseStruct): stageId: str unlockRank: int -class ActivityTableActivityHiddenAreaData(BaseModel): +class ActivityTableActivityHiddenAreaData(BaseStruct): name: str desc: str - preposedStage: list[ActivityTableActHiddenAreaPreposeStageData] + preposedStage: List[ActivityTableActHiddenAreaPreposeStageData] preposedTime: int -class Act13SideDataZoneAdditionData(BaseModel): +class Act13SideDataZoneAdditionData(BaseStruct): unlockText: str zoneClass: str -class Act13SideData(BaseModel): +class Act13SideData(BaseStruct): constData: Act13SideDataConstData - orgDataMap: dict[str, Act13SideDataOrgData] - principalDataMap: dict[str, Act13SideDataPrincipalData] - longTermMissionDataMap: dict[str, Act13SideDataLongTermMissionData] - dailyMissionDataList: list[Act13SideDataDailyMissionData] - dailyRewardGroupDataMap: dict[str, Act13SideDataDailyMissionRewardGroupData] - archiveItemUnlockData: dict[str, Act13SideDataArchiveItemUnlockData] - hiddenAreaData: dict[str, ActivityTableActivityHiddenAreaData] - zoneAddtionDataMap: dict[str, Act13SideDataZoneAdditionData] + orgDataMap: Dict[str, Act13SideDataOrgData] + principalDataMap: Dict[str, Act13SideDataPrincipalData] + longTermMissionDataMap: Dict[str, Act13SideDataLongTermMissionData] + dailyMissionDataList: List[Act13SideDataDailyMissionData] + dailyRewardGroupDataMap: Dict[str, Act13SideDataDailyMissionRewardGroupData] + archiveItemUnlockData: Dict[str, Act13SideDataArchiveItemUnlockData] + hiddenAreaData: Dict[str, ActivityTableActivityHiddenAreaData] + zoneAddtionDataMap: Dict[str, Act13SideDataZoneAdditionData] -class Act17sideDataPlaceData(BaseModel): +class Act17sideDataPlaceData(BaseStruct): placeId: str placeDesc: str - lockEventId: str | None + lockEventId: Union[str, None] zoneId: str - visibleCondType: str | None = None - visibleParams: list[str] | None = None + visibleCondType: Union[str, None] = None + visibleParams: Union[List[str], None] = None -class Act17sideDataNodeInfoData(BaseModel): +class Act17sideDataNodeInfoData(BaseStruct): nodeId: str nodeType: str sortId: int @@ -795,105 +797,105 @@ class Act17sideDataNodeInfoData(BaseModel): isPointPlace: bool chapterId: str trackPointType: str - unlockCondType: str | None = None - unlockParams: list[str] | None = None + unlockCondType: Union[str, None] = None + unlockParams: Union[List[str], None] = None -class Act17sideDataLandmarkNodeData(BaseModel): +class Act17sideDataLandmarkNodeData(BaseStruct): nodeId: str landmarkId: str landmarkName: str - landmarkPic: str | None + landmarkPic: Union[str, None] landmarkSpecialPic: str - landmarkDesList: list[str] + landmarkDesList: List[str] -class Act17sideDataStoryNodeData(BaseModel): +class Act17sideDataStoryNodeData(BaseStruct): nodeId: str storyId: str storyKey: str storyName: str - storyPic: str | None + storyPic: Union[str, None] confirmDes: str - storyDesList: list[str] + storyDesList: List[str] -class Act17sideDataBattleNodeData(BaseModel): +class Act17sideDataBattleNodeData(BaseStruct): nodeId: str stageId: str -class Act17sideDataTreasureNodeData(BaseModel): +class Act17sideDataTreasureNodeData(BaseStruct): nodeId: str treasureId: str treasureName: str - treasurePic: str | None - treasureSpecialPic: str | None + treasurePic: Union[str, None] + treasureSpecialPic: Union[str, None] endEventId: str confirmDes: str - treasureDesList: list[str] - missionIdList: list[str] - rewardList: list[ItemBundle] + treasureDesList: List[str] + missionIdList: List[str] + rewardList: List[ItemBundle] treasureType: str -class Act17sideDataEventNodeData(BaseModel): +class Act17sideDataEventNodeData(BaseStruct): nodeId: str eventId: str endEventId: str -class Act17sideDataTechNodeData(BaseModel): +class Act17sideDataTechNodeData(BaseStruct): nodeId: str techTreeId: str techTreeName: str - techPic: str | None + techPic: Union[str, None] techSpecialPic: str endEventId: str confirmDes: str - techDesList: list[str] - missionIdList: list[str] + techDesList: List[str] + missionIdList: List[str] -class Act17sideDataChoiceNodeOptionData(BaseModel): +class Act17sideDataChoiceNodeOptionData(BaseStruct): canRepeat: bool eventId: str des: str - unlockDes: str | None - unlockCondType: str | None = None - unlockParams: str | None = None + unlockDes: Union[str, None] + unlockCondType: Union[str, None] = None + unlockParams: Union[str, None] = None -class Act17sideDataChoiceNodeData(BaseModel): +class Act17sideDataChoiceNodeData(BaseStruct): nodeId: str - choicePic: str | None + choicePic: Union[str, None] isDisposable: bool - choiceSpecialPic: str | None + choiceSpecialPic: Union[str, None] choiceName: str - choiceDesList: list[str] + choiceDesList: List[str] cancelDes: str choiceNum: int - optionList: list[Act17sideDataChoiceNodeOptionData] + optionList: List[Act17sideDataChoiceNodeOptionData] -class Act17sideDataEventData(BaseModel): +class Act17sideDataEventData(BaseStruct): eventId: str - eventPic: str | None - eventSpecialPic: str | None + eventPic: Union[str, None] + eventSpecialPic: Union[str, None] eventTitle: str - eventDesList: list[str] + eventDesList: List[str] -class Act17sideDataArchiveItemUnlockData(BaseModel): +class Act17sideDataArchiveItemUnlockData(BaseStruct): itemId: str itemType: str unlockCondition: str - nodeId: str | None + nodeId: Union[str, None] stageParam: str - chapterId: str | None + chapterId: Union[str, None] -class Act17sideDataTechTreeData(BaseModel): +class Act17sideDataTechTreeData(BaseStruct): techTreeId: str sortId: int techTreeName: str @@ -901,7 +903,7 @@ class Act17sideDataTechTreeData(BaseModel): lockDes: str -class Act17sideDataTechTreeBranchData(BaseModel): +class Act17sideDataTechTreeBranchData(BaseStruct): techTreeBranchId: str techTreeId: str techTreeBranchName: str @@ -910,116 +912,116 @@ class Act17sideDataTechTreeBranchData(BaseModel): runeData: RuneTablePackedRuneData -class Act17sideDataMainlineChapterData(BaseModel): +class Act17sideDataMainlineChapterData(BaseStruct): chapterId: str chapterDes: str chapterIcon: str unlockDes: str - id_: str = Field(alias='id') + id_: str = field(name='id') -class Act17sideDataMainlineData(BaseModel): +class Act17sideDataMainlineData(BaseStruct): mainlineId: str - nodeId: str | None + nodeId: Union[str, None] sortId: int missionSort: str zoneId: str mainlineDes: str - focusNodeId: str | None + focusNodeId: Union[str, None] -class Act17sideDataZoneData(BaseModel): +class Act17sideDataZoneData(BaseStruct): zoneId: str - unlockPlaceId: str | None + unlockPlaceId: Union[str, None] unlockText: str -class Act17sideDataConstData(BaseModel): +class Act17sideDataConstData(BaseStruct): techTreeUnlockEventId: str -class Act17sideData(BaseModel): - placeDataMap: dict[str, Act17sideDataPlaceData] - nodeInfoDataMap: dict[str, Act17sideDataNodeInfoData] - landmarkNodeDataMap: dict[str, Act17sideDataLandmarkNodeData] - storyNodeDataMap: dict[str, Act17sideDataStoryNodeData] - battleNodeDataMap: dict[str, Act17sideDataBattleNodeData] - treasureNodeDataMap: dict[str, Act17sideDataTreasureNodeData] - eventNodeDataMap: dict[str, Act17sideDataEventNodeData] - techNodeDataMap: dict[str, Act17sideDataTechNodeData] - choiceNodeDataMap: dict[str, Act17sideDataChoiceNodeData] - eventDataMap: dict[str, Act17sideDataEventData] - archiveItemUnlockDataMap: dict[str, Act17sideDataArchiveItemUnlockData] - techTreeDataMap: dict[str, Act17sideDataTechTreeData] - techTreeBranchDataMap: dict[str, Act17sideDataTechTreeBranchData] - mainlineChapterDataMap: dict[str, Act17sideDataMainlineChapterData] - mainlineDataMap: dict[str, Act17sideDataMainlineData] - zoneDataList: list[Act17sideDataZoneData] +class Act17sideData(BaseStruct): + placeDataMap: Dict[str, Act17sideDataPlaceData] + nodeInfoDataMap: Dict[str, Act17sideDataNodeInfoData] + landmarkNodeDataMap: Dict[str, Act17sideDataLandmarkNodeData] + storyNodeDataMap: Dict[str, Act17sideDataStoryNodeData] + battleNodeDataMap: Dict[str, Act17sideDataBattleNodeData] + treasureNodeDataMap: Dict[str, Act17sideDataTreasureNodeData] + eventNodeDataMap: Dict[str, Act17sideDataEventNodeData] + techNodeDataMap: Dict[str, Act17sideDataTechNodeData] + choiceNodeDataMap: Dict[str, Act17sideDataChoiceNodeData] + eventDataMap: Dict[str, Act17sideDataEventData] + archiveItemUnlockDataMap: Dict[str, Act17sideDataArchiveItemUnlockData] + techTreeDataMap: Dict[str, Act17sideDataTechTreeData] + techTreeBranchDataMap: Dict[str, Act17sideDataTechTreeBranchData] + mainlineChapterDataMap: Dict[str, Act17sideDataMainlineChapterData] + mainlineDataMap: Dict[str, Act17sideDataMainlineData] + zoneDataList: List[Act17sideDataZoneData] constData: Act17sideDataConstData -class Act20SideDataResidentCartData(BaseModel): +class Act20SideDataResidentCartData(BaseStruct): residentPic: str -class Act20SideData(BaseModel): - zoneAdditionDataMap: dict[str, str] - residentCartDatas: dict[str, Act20SideDataResidentCartData] +class Act20SideData(BaseStruct): + zoneAdditionDataMap: Dict[str, str] + residentCartDatas: Dict[str, Act20SideDataResidentCartData] -class Act21SideDataZoneAddtionData(BaseModel): +class Act21SideDataZoneAddtionData(BaseStruct): zoneId: str unlockText: str - stageUnlockText: str | None + stageUnlockText: Union[str, None] entryId: str -class Act21SideDataConstData(BaseModel): +class Act21SideDataConstData(BaseStruct): lineConnectZone: str -class Act21SideData(BaseModel): - zoneAdditionDataMap: dict[str, Act21SideDataZoneAddtionData] +class Act21SideData(BaseStruct): + zoneAdditionDataMap: Dict[str, Act21SideDataZoneAddtionData] constData: Act21SideDataConstData -class ActivityLoginData(BaseModel): +class ActivityLoginData(BaseStruct): description: str - itemList: list[ItemBundle] - apSupplyOutOfDateDict: dict[str, int] + itemList: List[ItemBundle] + apSupplyOutOfDateDict: Dict[str, int] -class ActivitySwitchCheckinConstData(BaseModel): +class ActivitySwitchCheckinConstData(BaseStruct): activityTime: str activityRule: str -class ActivitySwitchCheckinData(BaseModel): +class ActivitySwitchCheckinData(BaseStruct): constData: ActivitySwitchCheckinConstData - rewards: dict[str, list[ItemBundle]] - apSupplyOutOfDateDict: dict[str, int] - rewardsTitle: dict[str, str] + rewards: Dict[str, List[ItemBundle]] + apSupplyOutOfDateDict: Dict[str, int] + rewardsTitle: Dict[str, str] -class ActivityMiniStoryDataZoneDescInfo(BaseModel): +class ActivityMiniStoryDataZoneDescInfo(BaseStruct): zoneId: str unlockText: str -class ActivityMiniStoryDataFavorUpInfo(BaseModel): +class ActivityMiniStoryDataFavorUpInfo(BaseStruct): charId: str displayStartTime: int displayEndTime: int -class ActivityMiniStoryData(BaseModel): +class ActivityMiniStoryData(BaseStruct): tokenItemId: str - zoneDescList: dict[str, ActivityMiniStoryDataZoneDescInfo] - favorUpList: dict[str, ActivityMiniStoryDataFavorUpInfo] - extraDropZoneList: list[str] + zoneDescList: Dict[str, ActivityMiniStoryDataZoneDescInfo] + favorUpList: Dict[str, ActivityMiniStoryDataFavorUpInfo] + extraDropZoneList: List[str] -class ActivityRoguelikeDataOuterBuffUnlockInfo(BaseModel): +class ActivityRoguelikeDataOuterBuffUnlockInfo(BaseStruct): buffLevel: int name: str iconId: str @@ -1030,26 +1032,26 @@ class ActivityRoguelikeDataOuterBuffUnlockInfo(BaseModel): cost: int -class ActivityRoguelikeDataOuterBuffUnlockInfoData(BaseModel): +class ActivityRoguelikeDataOuterBuffUnlockInfoData(BaseStruct): buffId: str - buffUnlockInfos: dict[str, ActivityRoguelikeDataOuterBuffUnlockInfo] + buffUnlockInfos: Dict[str, ActivityRoguelikeDataOuterBuffUnlockInfo] -class ActivityRoguelikeDataMileStoneItemInfo(BaseModel): +class ActivityRoguelikeDataMileStoneItemInfo(BaseStruct): mileStoneId: str orderId: int tokenNum: int item: ItemBundle -class ActivityTableCustomUnlockCond(BaseModel): - actId: str | None +class ActivityTableCustomUnlockCond(BaseStruct): + actId: Union[str, None] stageId: str -class ActivityRoguelikeData(BaseModel): - outBuffInfos: dict[str, ActivityRoguelikeDataOuterBuffUnlockInfoData] - apSupplyOutOfDateDict: dict[str, int] +class ActivityRoguelikeData(BaseStruct): + outBuffInfos: Dict[str, ActivityRoguelikeDataOuterBuffUnlockInfoData] + apSupplyOutOfDateDict: Dict[str, int] outerBuffToken: str shopToken: str relicUnlockTime: int @@ -1060,21 +1062,21 @@ class ActivityRoguelikeData(BaseModel): reOpenCoolDown: int tokenItem: ItemBundle charStoneId: str - milestone: list[ActivityRoguelikeDataMileStoneItemInfo] - unlockConds: list[ActivityTableCustomUnlockCond] + milestone: List[ActivityRoguelikeDataMileStoneItemInfo] + unlockConds: List[ActivityTableCustomUnlockCond] -class ActivityMultiplayDataStageData(BaseModel): +class ActivityMultiplayDataStageData(BaseStruct): stageId: str levelId: str groupId: str difficulty: str loadingPicId: str dangerLevel: str - unlockConds: list[str] + unlockConds: List[str] -class ActivityMultiplayDataStageGroupData(BaseModel): +class ActivityMultiplayDataStageGroupData(BaseStruct): groupId: str sortId: int code: str @@ -1082,17 +1084,17 @@ class ActivityMultiplayDataStageGroupData(BaseModel): description: str -class ActivityMultiplayDataMissionExtraData(BaseModel): +class ActivityMultiplayDataMissionExtraData(BaseStruct): missionId: str isHard: bool -class ActivityMultiplayDataRoomMessageData(BaseModel): +class ActivityMultiplayDataRoomMessageData(BaseStruct): sortId: int picId: str -class ActivityMultiplayDataConstData(BaseModel): +class ActivityMultiplayDataConstData(BaseStruct): linkActId: str maxRetryTimeInTeamRoom: int maxRetryTimeInMatchRoom: int @@ -1105,23 +1107,23 @@ class ActivityMultiplayDataConstData(BaseModel): settleRetryTime: float -class ActivityMultiplayData(BaseModel): - stages: dict[str, ActivityMultiplayDataStageData] - stageGroups: dict[str, ActivityMultiplayDataStageGroupData] - missionExtras: dict[str, ActivityMultiplayDataMissionExtraData] - roomMessages: list[ActivityMultiplayDataRoomMessageData] +class ActivityMultiplayData(BaseStruct): + stages: Dict[str, ActivityMultiplayDataStageData] + stageGroups: Dict[str, ActivityMultiplayDataStageGroupData] + missionExtras: Dict[str, ActivityMultiplayDataMissionExtraData] + roomMessages: List[ActivityMultiplayDataRoomMessageData] constData: ActivityMultiplayDataConstData - unlockConds: list[ActivityTableCustomUnlockCond] + unlockConds: List[ActivityTableCustomUnlockCond] -class ActivityInterlockDataStageAdditionData(BaseModel): +class ActivityInterlockDataStageAdditionData(BaseStruct): stageId: str stageType: str - lockStageKey: str | None + lockStageKey: Union[str, None] lockSortIndex: int -class ActivityInterlockDataTreasureMonsterData(BaseModel): +class ActivityInterlockDataTreasureMonsterData(BaseStruct): lockStageKey: str enemyId: str enemyName: str @@ -1129,54 +1131,54 @@ class ActivityInterlockDataTreasureMonsterData(BaseModel): enemyDescription: str -class SharedCharDataCharEquipInfo(BaseModel): +class SharedCharDataCharEquipInfo(BaseStruct): hide: int - locked: bool | int + locked: Union[bool, int] level: int -class SharedCharDataSharedCharSkillData(BaseModel): - completeUpgradeTime: int | None = None - unlock: bool | int | None = None +class SharedCharDataSharedCharSkillData(BaseStruct): skillId: str specializeLevel: int - state: int | None = None + completeUpgradeTime: Union[int, None] = None + unlock: Union[bool, Union[int, None]] = None + state: Union[int, None] = None -class SharedCharDataTmplData(BaseModel): +class SharedCharDataTmplData(BaseStruct): skinId: str defaultSkillIndex: int - skills: list[SharedCharDataSharedCharSkillData] - currentEquip: str | None - equip: dict[str, SharedCharDataSharedCharSkillData] | None = None + skills: List[SharedCharDataSharedCharSkillData] + currentEquip: Union[str, None] + equip: Union[Dict[str, SharedCharDataSharedCharSkillData], None] = None -class SharedCharData(BaseModel): +class SharedCharData(BaseStruct): charId: str potentialRank: int - skillIndex: int | None = None - skinId: str | None = None - skin: str | None = None - skills: list[SharedCharDataSharedCharSkillData] | None = None - currentEquip: str | None = Field(alias='currentEquip', default=None) - equips: dict[str, SharedCharDataCharEquipInfo] | None = Field(alias='equip', default={}) mainSkillLvl: int evolvePhase: int level: int favorPoint: int - crisisRecord: dict[str, int] | None = None - currentTmpl: str | None | None = None - tmpl: dict[str, SharedCharDataTmplData] | None = None + currentEquip: Union[str, None] = field(name='currentEquip', default=None) + equips: Union[Dict[str, SharedCharDataCharEquipInfo], None] = field(name='equip', default={}) + skillIndex: Union[int, None] = None + skinId: Union[str, None] = None + skin: Union[str, None] = None + skills: Union[List[SharedCharDataSharedCharSkillData], None] = None + crisisRecord: Union[Dict[str, int], None] = None + currentTmpl: Union[Union[str, None], None] = None + tmpl: Union[Dict[str, SharedCharDataTmplData], None] = None -class ActivityInterlockDataMileStoneItemInfo(BaseModel): +class ActivityInterlockDataMileStoneItemInfo(BaseStruct): mileStoneId: str orderId: int tokenNum: int item: ItemBundle -class ActivityInterlockDataFinalStageProgressData(BaseModel): +class ActivityInterlockDataFinalStageProgressData(BaseStruct): stageId: str killCnt: int apCost: int @@ -1185,70 +1187,70 @@ class ActivityInterlockDataFinalStageProgressData(BaseModel): gold: int -class ActivityInterlockData(BaseModel): - stageAdditionInfoMap: dict[str, ActivityInterlockDataStageAdditionData] - treasureMonsterMap: dict[str, ActivityInterlockDataTreasureMonsterData] +class ActivityInterlockData(BaseStruct): + stageAdditionInfoMap: Dict[str, ActivityInterlockDataStageAdditionData] + treasureMonsterMap: Dict[str, ActivityInterlockDataTreasureMonsterData] specialAssistData: SharedCharData - mileStoneItemList: list[ActivityInterlockDataMileStoneItemInfo] - finalStageProgressMap: dict[str, list[ActivityInterlockDataFinalStageProgressData]] + mileStoneItemList: List[ActivityInterlockDataMileStoneItemInfo] + finalStageProgressMap: Dict[str, List[ActivityInterlockDataFinalStageProgressData]] -class ActivityBossRushDataZoneAdditionData(BaseModel): +class ActivityBossRushDataZoneAdditionData(BaseStruct): unlockText: str displayStartTime: int -class ActivityBossRushDataBossRushStageGroupData(BaseModel): +class ActivityBossRushDataBossRushStageGroupData(BaseStruct): stageGroupId: str sortId: int stageGroupName: str - stageIdMap: dict[str, str] - waveBossInfo: list[list[str]] + stageIdMap: Dict[str, str] + waveBossInfo: List[List[str]] normalStageCount: int isHardStageGroup: bool - unlockCondtion: str | None + unlockCondtion: Union[str, None] -class ActivityBossRushDataBossRushStageAdditionData(BaseModel): +class ActivityBossRushDataBossRushStageAdditionData(BaseStruct): stageId: str stageType: str stageGroupId: str - teamIdList: list[str] - unlockText: str | None + teamIdList: List[str] + unlockText: Union[str, None] -class ActivityBossRushDataDisplayDetailRewards(BaseModel): +class ActivityBossRushDataDisplayDetailRewards(BaseStruct): occPercent: int dropCount: int - type_: str = Field(alias='type') - id_: str = Field(alias='id') + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class ActivityBossRushDataBossRushDropInfo(BaseModel): +class ActivityBossRushDataBossRushDropInfo(BaseStruct): clearWaveCount: int - displayDetailRewards: list[ActivityBossRushDataDisplayDetailRewards] - firstPassRewards: list[ItemBundle] - passRewards: list[ItemBundle] + displayDetailRewards: List[ActivityBossRushDataDisplayDetailRewards] + firstPassRewards: List[ItemBundle] + passRewards: List[ItemBundle] -class ActivityBossRushDataBossRushMissionAdditionData(BaseModel): +class ActivityBossRushDataBossRushMissionAdditionData(BaseStruct): missionId: str isRelicTask: bool -class ActivityBossRushDataBossRushTeamData(BaseModel): +class ActivityBossRushDataBossRushTeamData(BaseStruct): teamId: str teamName: str - charIdList: list[str] - teamBuffName: str | None - teamBuffDes: str | None - teamBuffId: str | None + charIdList: List[str] + teamBuffName: Union[str, None] + teamBuffDes: Union[str, None] + teamBuffId: Union[str, None] maxCharNum: int - runeData: RuneTablePackedRuneData | None + runeData: Union[RuneTablePackedRuneData, None] -class ActivityBossRushDataRelicData(BaseModel): +class ActivityBossRushDataRelicData(BaseStruct): relicId: str sortId: int name: str @@ -1256,83 +1258,84 @@ class ActivityBossRushDataRelicData(BaseModel): relicTaskId: str -class ActivityBossRushDataRelicLevelInfo(BaseModel): +class ActivityBossRushDataRelicLevelInfo(BaseStruct): level: int effectDesc: str runeData: RuneTablePackedRuneData + needItemCount: int -class ActivityBossRushDataRelicLevelInfoData(BaseModel): +class ActivityBossRushDataRelicLevelInfoData(BaseStruct): relicId: str - levelInfos: dict[str, ActivityBossRushDataRelicLevelInfo] + levelInfos: Dict[str, ActivityBossRushDataRelicLevelInfo] -class ActivityBossRushDataBossRushMileStoneData(BaseModel): +class ActivityBossRushDataBossRushMileStoneData(BaseStruct): mileStoneId: str mileStoneLvl: int needPointCnt: int rewardItem: ItemBundle -class ActivityBossRushDataConstData(BaseModel): +class ActivityBossRushDataConstData(BaseStruct): maxProvidedCharNum: int textMilestoneItemLevelDesc: str milestonePointId: str relicUpgradeItemId: str - defaultRelictList: list[str] + defaultRelictList: List[str] rewardSkinId: str -class ActivityBossRushData(BaseModel): - zoneAdditionDataMap: dict[str, ActivityBossRushDataZoneAdditionData] - stageGroupMap: dict[str, ActivityBossRushDataBossRushStageGroupData] - stageAdditionDataMap: dict[str, ActivityBossRushDataBossRushStageAdditionData] - stageDropDataMap: dict[str, dict[str, ActivityBossRushDataBossRushDropInfo]] - missionAdditionDataMap: dict[str, ActivityBossRushDataBossRushMissionAdditionData] - teamDataMap: dict[str, ActivityBossRushDataBossRushTeamData] - relicList: list[ActivityBossRushDataRelicData] - relicLevelInfoDataMap: dict[str, ActivityBossRushDataRelicLevelInfoData] - mileStoneList: list[ActivityBossRushDataBossRushMileStoneData] - bestWaveRuneList: list[RuneTablePackedRuneData] +class ActivityBossRushData(BaseStruct): + zoneAdditionDataMap: Dict[str, ActivityBossRushDataZoneAdditionData] + stageGroupMap: Dict[str, ActivityBossRushDataBossRushStageGroupData] + stageAdditionDataMap: Dict[str, ActivityBossRushDataBossRushStageAdditionData] + stageDropDataMap: Dict[str, Dict[str, ActivityBossRushDataBossRushDropInfo]] + missionAdditionDataMap: Dict[str, ActivityBossRushDataBossRushMissionAdditionData] + teamDataMap: Dict[str, ActivityBossRushDataBossRushTeamData] + relicList: List[ActivityBossRushDataRelicData] + relicLevelInfoDataMap: Dict[str, ActivityBossRushDataRelicLevelInfoData] + mileStoneList: List[ActivityBossRushDataBossRushMileStoneData] + bestWaveRuneList: List[RuneTablePackedRuneData] constData: ActivityBossRushDataConstData -class ActivityFloatParadeDataConstData(BaseModel): +class ActivityFloatParadeDataConstData(BaseStruct): cityName: str lowStandard: float variationTitle: str ruleDesc: str -class ActivityFloatParadeDataDailyData(BaseModel): +class ActivityFloatParadeDataDailyData(BaseStruct): dayIndex: int dateName: str placeName: str placeEnName: str placePic: str - eventGroupId: int - extReward: ItemBundle | None + eventGroupId: str + extReward: Union[ItemBundle, None] -class ActivityFloatParadeDataRewardPool(BaseModel): - grpId: int - id_: int = Field(alias='id') - type_: str = Field(alias='type') +class ActivityFloatParadeDataRewardPool(BaseStruct): + grpId: str + id_: str = field(name='id') + type_: str = field(name='type') name: str - desc: str | None + desc: Union[str, None] reward: ItemBundle -class ActivityFloatParadeDataTactic(BaseModel): - id_: int = Field(alias='id') +class ActivityFloatParadeDataTactic(BaseStruct): + id_: int = field(name='id') name: str packName: str briefName: str - rewardVar: dict[str, float] + rewardVar: Dict[str, float] -class ActivityFloatParadeDataGroupData(BaseModel): - groupId: int +class ActivityFloatParadeDataGroupData(BaseStruct): + groupId: str name: str startDay: int endDay: int @@ -1340,15 +1343,15 @@ class ActivityFloatParadeDataGroupData(BaseModel): extRewardCount: int -class ActivityFloatParadeData(BaseModel): +class ActivityFloatParadeData(BaseStruct): constData: ActivityFloatParadeDataConstData - dailyDataDic: list[ActivityFloatParadeDataDailyData] - rewardPools: dict[str, dict[str, ActivityFloatParadeDataRewardPool]] - tacticList: list[ActivityFloatParadeDataTactic] - groupInfos: dict[str, ActivityFloatParadeDataGroupData] + dailyDataDic: List[ActivityFloatParadeDataDailyData] + rewardPools: Dict[str, Dict[str, ActivityFloatParadeDataRewardPool]] + tacticList: List[ActivityFloatParadeDataTactic] + groupInfos: Dict[str, ActivityFloatParadeDataGroupData] -class ActSandboxDataMilestoneData(BaseModel): +class ActSandboxDataMilestoneData(BaseStruct): milestoneId: str orderId: int tokenId: str @@ -1357,50 +1360,50 @@ class ActSandboxDataMilestoneData(BaseModel): isPrecious: bool -class ActSandboxData(BaseModel): - milestoneDataList: list[ActSandboxDataMilestoneData] +class ActSandboxData(BaseStruct): + milestoneDataList: List[ActSandboxDataMilestoneData] milestoneTokenId: str -class ActivityMainlineBuffDataMissionGroupData(BaseModel): - id_: str = Field(alias='id') +class ActivityMainlineBuffDataMissionGroupData(BaseStruct): + id_: str = field(name='id') bindBanner: str sortId: int zoneId: str - missionIdList: list[str] + missionIdList: List[str] -class ActivityMainlineBuffDataPeriodDataStepData(BaseModel): +class ActivityMainlineBuffDataPeriodDataStepData(BaseStruct): isBlock: bool - favorUpDesc: str | None - unlockDesc: str | None - bindStageId: str | None - blockDesc: str | None + favorUpDesc: Union[str, None] + unlockDesc: Union[str, None] + bindStageId: Union[str, None] + blockDesc: Union[str, None] -class ActivityMainlineBuffDataPeriodData(BaseModel): - id_: str = Field(alias='id') +class ActivityMainlineBuffDataPeriodData(BaseStruct): + id_: str = field(name='id') startTime: int endTime: int favorUpCharDesc: str favorUpImgName: str newChapterImgName: str - newChapterZoneId: str | None - stepDataList: list[ActivityMainlineBuffDataPeriodDataStepData] + newChapterZoneId: Union[str, None] + stepDataList: List[ActivityMainlineBuffDataPeriodDataStepData] -class ActivityMainlineBuffDataConstData(BaseModel): +class ActivityMainlineBuffDataConstData(BaseStruct): favorUpStageRange: str -class ActivityMainlineBuffData(BaseModel): - missionGroupList: dict[str, ActivityMainlineBuffDataMissionGroupData] - periodDataList: list[ActivityMainlineBuffDataPeriodData] - apSupplyOutOfDateDict: dict[str, int] +class ActivityMainlineBuffData(BaseStruct): + missionGroupList: Dict[str, ActivityMainlineBuffDataMissionGroupData] + periodDataList: List[ActivityMainlineBuffDataPeriodData] + apSupplyOutOfDateDict: Dict[str, int] constData: ActivityMainlineBuffDataConstData -class Act24SideDataToolData(BaseModel): +class Act24SideDataToolData(BaseStruct): toolId: str sortId: int toolName: str @@ -1412,7 +1415,7 @@ class Act24SideDataToolData(BaseModel): runeData: RuneTablePackedRuneData -class Act24SideDataMealData(BaseModel): +class Act24SideDataMealData(BaseStruct): mealId: str sortId: int mealName: str @@ -1424,14 +1427,14 @@ class Act24SideDataMealData(BaseModel): mealRewardItemInfo: ItemBundle -class Act24SideDataMeldingItemData(BaseModel): +class Act24SideDataMeldingItemData(BaseStruct): meldingId: str sortId: int meldingPrice: int rarity: int -class Act24SideDataMeldingGachaBoxData(BaseModel): +class Act24SideDataMeldingGachaBoxData(BaseStruct): gachaBoxId: str gachaSortId: int gachaIcon: str @@ -1442,7 +1445,7 @@ class Act24SideDataMeldingGachaBoxData(BaseModel): remainItemBgColor: str -class Act24SideDataMeldingGachaBoxGoodData(BaseModel): +class Act24SideDataMeldingGachaBoxGoodData(BaseStruct): goodId: str gachaBoxId: str orderId: int @@ -1454,14 +1457,14 @@ class Act24SideDataMeldingGachaBoxGoodData(BaseModel): gachaType: str -class Act24SideDataZoneAdditionData(BaseModel): +class Act24SideDataZoneAdditionData(BaseStruct): zoneId: str zoneIcon: str unlockText: str displayTime: str -class QuestStageData(BaseModel): +class QuestStageData(BaseStruct): stageId: str stageRank: int sortId: int @@ -1469,7 +1472,7 @@ class QuestStageData(BaseModel): isDragonStage: bool -class Act24SideDataMissionExtraData(BaseModel): +class Act24SideDataMissionExtraData(BaseStruct): taskTypeName: str taskTypeIcon: str taskType: str @@ -1478,61 +1481,61 @@ class Act24SideDataMissionExtraData(BaseModel): taskClientDesc: str -class WeightItemBundle(BaseModel): - id_: str = Field(alias='id') - type_: str = Field(alias='type') +class WeightItemBundle(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') dropType: str count: int weight: int -class StageDataDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class StageDataDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class StageDataDisplayDetailRewards(BaseModel): +class StageDataDisplayDetailRewards(BaseStruct): occPercent: int - type_: str = Field(alias='type') - id_: str = Field(alias='id') + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class StageDataStageDropInfo(BaseModel): - firstPassRewards: list[ItemBundle] | None - firstCompleteRewards: list[ItemBundle] | None - passRewards: list[list[WeightItemBundle]] | None - completeRewards: list[list[WeightItemBundle]] | None - displayRewards: list[StageDataDisplayRewards] - displayDetailRewards: list[StageDataDisplayDetailRewards] +class StageDataStageDropInfo(BaseStruct): + firstPassRewards: Union[List[ItemBundle], None] + firstCompleteRewards: Union[List[ItemBundle], None] + passRewards: Union[List[List[WeightItemBundle]], None] + completeRewards: Union[List[List[WeightItemBundle]], None] + displayRewards: List[StageDataDisplayRewards] + displayDetailRewards: List[StageDataDisplayDetailRewards] -class Act24SideDataConstData(BaseModel): +class Act24SideDataConstData(BaseStruct): stageUnlockToolDesc: str mealLackMoney: str mealDayTimesLimit: int toolMaximum: int - stageCanNotUseToTool: list[str] - gachaExtraProb: float | int + stageCanNotUseToTool: List[str] + gachaExtraProb: Union[float, int] -class Act24SideData(BaseModel): - toolDataList: dict[str, Act24SideDataToolData] - mealDataList: dict[str, Act24SideDataMealData] - meldingDict: dict[str, Act24SideDataMeldingItemData] - meldingGachaBoxDataList: dict[str, Act24SideDataMeldingGachaBoxData] - meldingGachaBoxGoodDataMap: dict[str, list[Act24SideDataMeldingGachaBoxGoodData]] - mealWelcomeTxtDataMap: dict[str, str] - zoneAdditionDataMap: dict[str, Act24SideDataZoneAdditionData] - questStageList: list[QuestStageData] - missionDataList: dict[str, Act24SideDataMissionExtraData] - meldingDropDict: dict[str, StageDataStageDropInfo] - stageMapPreviewDict: dict[str, list[str]] +class Act24SideData(BaseStruct): + toolDataList: Dict[str, Act24SideDataToolData] + mealDataList: Dict[str, Act24SideDataMealData] + meldingDict: Dict[str, Act24SideDataMeldingItemData] + meldingGachaBoxDataList: Dict[str, Act24SideDataMeldingGachaBoxData] + meldingGachaBoxGoodDataMap: Dict[str, List[Act24SideDataMeldingGachaBoxGoodData]] + mealWelcomeTxtDataMap: Dict[str, str] + zoneAdditionDataMap: Dict[str, Act24SideDataZoneAdditionData] + questStageList: List[QuestStageData] + missionDataList: Dict[str, Act24SideDataMissionExtraData] + meldingDropDict: Dict[str, StageDataStageDropInfo] + stageMapPreviewDict: Dict[str, List[str]] constData: Act24SideDataConstData -class Act25SideDataConstData(BaseModel): +class Act25SideDataConstData(BaseStruct): getDailyCount: int costName: str costDesc: str @@ -1546,25 +1549,25 @@ class Act25SideDataConstData(BaseModel): harvestDesc: str -class Act25SideDataZoneDescInfo(BaseModel): +class Act25SideDataZoneDescInfo(BaseStruct): zoneId: str unlockText: str displayStartTime: int -class Act25SideDataArchiveItemData(BaseModel): +class Act25SideDataArchiveItemData(BaseStruct): itemId: str itemType: int itemUnlockType: int itemUnlockParam: str - unlockDesc: str | None - iconId: str | None + unlockDesc: Union[str, None] + iconId: Union[str, None] itemName: str -class Act25SideDataArchiveMapInfoData(BaseModel): +class Act25SideDataArchiveMapInfoData(BaseStruct): objectId: str - type_: int = Field(alias='type') + type_: int = field(name='type') numberId: str areaId: str sortId: int @@ -1572,7 +1575,7 @@ class Act25SideDataArchiveMapInfoData(BaseModel): hasDot: bool -class Act25SideDataAreaInfoData(BaseModel): +class Act25SideDataAreaInfoData(BaseStruct): areaId: str sortId: int areaIcon: str @@ -1586,10 +1589,10 @@ class Act25SideDataAreaInfoData(BaseModel): finalId: str -class Act25SideDataAreaMissionData(BaseModel): - id_: str = Field(alias='id') +class Act25SideDataAreaMissionData(BaseStruct): + id_: str = field(name='id') areaId: str - preposedMissionId: str | None + preposedMissionId: Union[str, None] sortId: int isZone: bool stageId: str @@ -1597,15 +1600,15 @@ class Act25SideDataAreaMissionData(BaseModel): transform: int progress: int progressPicId: str - template: str | None + template: Union[str, None] templateType: int desc: str - param: list[str] | None - rewards: list[ItemBundle] - archiveItems: list[str] + param: Union[List[str], None] + rewards: List[ItemBundle] + archiveItems: List[str] -class Act25SideDataBattlePerformanceData(BaseModel): +class Act25SideDataBattlePerformanceData(BaseStruct): itemId: str sortId: int itemName: str @@ -1615,82 +1618,82 @@ class Act25SideDataBattlePerformanceData(BaseModel): runeData: RuneTablePackedRuneData -class Act25SideDataKeyData(BaseModel): +class Act25SideDataKeyData(BaseStruct): keyId: str keyName: str keyIcon: str toastText: str -class Act25SideDataFogUnlockData(BaseModel): +class Act25SideDataFogUnlockData(BaseStruct): lockId: str lockedCollectionIconId: str unlockedCollectionIconId: str -class Act25SideDataDailyFarmData(BaseModel): +class Act25SideDataDailyFarmData(BaseStruct): transform: int unitTime: int -class Act25SideData(BaseModel): +class Act25SideData(BaseStruct): tokenItemId: str constData: Act25SideDataConstData - zoneDescList: dict[str, Act25SideDataZoneDescInfo] - archiveItemData: dict[str, Act25SideDataArchiveItemData] - arcMapInfoData: dict[str, Act25SideDataArchiveMapInfoData] - areaInfoData: dict[str, Act25SideDataAreaInfoData] - areaMissionData: dict[str, Act25SideDataAreaMissionData] - battlePerformanceData: dict[str, Act25SideDataBattlePerformanceData] - keyData: dict[str, Act25SideDataKeyData] - fogUnlockData: dict[str, Act25SideDataFogUnlockData] - farmList: list[Act25SideDataDailyFarmData] + zoneDescList: Dict[str, Act25SideDataZoneDescInfo] + archiveItemData: Dict[str, Act25SideDataArchiveItemData] + arcMapInfoData: Dict[str, Act25SideDataArchiveMapInfoData] + areaInfoData: Dict[str, Act25SideDataAreaInfoData] + areaMissionData: Dict[str, Act25SideDataAreaMissionData] + battlePerformanceData: Dict[str, Act25SideDataBattlePerformanceData] + keyData: Dict[str, Act25SideDataKeyData] + fogUnlockData: Dict[str, Act25SideDataFogUnlockData] + farmList: List[Act25SideDataDailyFarmData] -class Act38D1DataAct38D1NodeData(BaseModel): +class Act38D1DataAct38D1NodeData(BaseStruct): slotId: str - groupId: str | None + groupId: Union[str, None] isUpper: bool - adjacentSlotList: list[str] + adjacentSlotList: List[str] -class Act38D1DataAct38D1RoadData(BaseModel): +class Act38D1DataAct38D1RoadData(BaseStruct): roadId: str startSlotId: str endSlotId: str -class Act38D1DataAct38D1RewardBoxData(BaseModel): +class Act38D1DataAct38D1RewardBoxData(BaseStruct): rewardBoxId: str roadId: str -class Act38D1DataAct38D1ExclusionGroupData(BaseModel): +class Act38D1DataAct38D1ExclusionGroupData(BaseStruct): groupId: str - slotIdList: list[str] + slotIdList: List[str] -class Act38D1DataAct38D1DimensionItemData(BaseModel): +class Act38D1DataAct38D1DimensionItemData(BaseStruct): desc: str maxScore: int -class Act38D1DataAct38D1CommentData(BaseModel): - id_: str = Field(alias='id') +class Act38D1DataAct38D1CommentData(BaseStruct): + id_: str = field(name='id') sortId: int desc: str -class Act38D1DataAct38D1StageDetailData(BaseModel): - nodeDataMap: dict[str, Act38D1DataAct38D1NodeData] - roadDataMap: dict[str, Act38D1DataAct38D1RoadData] - rewardBoxDataMap: dict[str, Act38D1DataAct38D1RewardBoxData] - exclusionGroupDataMap: dict[str, Act38D1DataAct38D1ExclusionGroupData] - dimensionItemList: list[Act38D1DataAct38D1DimensionItemData] - commentDataMap: dict[str, Act38D1DataAct38D1CommentData] +class Act38D1DataAct38D1StageDetailData(BaseStruct): + nodeDataMap: Dict[str, Act38D1DataAct38D1NodeData] + roadDataMap: Dict[str, Act38D1DataAct38D1RoadData] + rewardBoxDataMap: Dict[str, Act38D1DataAct38D1RewardBoxData] + exclusionGroupDataMap: Dict[str, Act38D1DataAct38D1ExclusionGroupData] + dimensionItemList: List[Act38D1DataAct38D1DimensionItemData] + commentDataMap: Dict[str, Act38D1DataAct38D1CommentData] -class Act38D1DataAct38D1ConstData(BaseModel): +class Act38D1DataAct38D1ConstData(BaseStruct): redScoreThreshold: int detailBkgRedThreshold: int voiceGrade: int @@ -1703,159 +1706,164 @@ class Act38D1DataAct38D1ConstData(BaseModel): mapRewardReceivedText: str -class Act38D1Data(BaseModel): - scoreLevelToAppraiseDataMap: dict[str, str] - detailDataMap: dict[str, Act38D1DataAct38D1StageDetailData] +class Act38D1Data(BaseStruct): + scoreLevelToAppraiseDataMap: Dict[str, str] + detailDataMap: Dict[str, Act38D1DataAct38D1StageDetailData] constData: Act38D1DataAct38D1ConstData - trackPointPeriodData: list[int] + trackPointPeriodData: List[int] -class Act27SideDataAct27SideGoodData(BaseModel): - id_: str = Field(alias='id') +class Act27SideDataAct27SideGoodData(BaseStruct): + id_: str = field(name='id') name: str typeDesc: str iconId: str launchIconId: str - purchasePrice: list[int] - sellingPriceList: list[int] - sellShopList: list[str] + purchasePrice: List[int] + sellingPriceList: List[int] + sellShopList: List[str] isPermanent: bool -class Act27SideDataAct27SideMileStoneData(BaseModel): +class Act27SideDataAct27SideMileStoneData(BaseStruct): mileStoneId: str mileStoneLvl: int needPointCnt: int rewardItem: ItemBundle -class Act27SideDataAct27SideGoodLaunchData(BaseModel): +class Act27SideDataAct27SideGoodLaunchData(BaseStruct): groupId: str startTime: int - stageId: str | None - code: str | None + stageId: Union[str, None] + code: Union[str, None] drinkId: str foodId: str souvenirId: str -class Act27SideDataAct27SideShopData(BaseModel): +class Act27SideDataAct27SideShopData(BaseStruct): shopId: str sortId: int name: str iconId: str -class Act27SideDataAct27SideInquireData(BaseModel): +class Act27SideDataAct27SideInquireData(BaseStruct): mileStonePt: int inquireCount: int -class Act27SideDataAct27SideDynEntrySwitchData(BaseModel): +class Act27SideDataAct27SideDynEntrySwitchData(BaseStruct): entryId: str startHour: int signalId: str -class Act27SideDataAct27sideZoneAdditionData(BaseModel): +class Act27SideDataAct27sideZoneAdditionData(BaseStruct): zoneId: str unlockText: str displayTime: str -class Act27SideDataAct27SideMileStoneFurniRewardData(BaseModel): +class Act27SideDataAct27SideMileStoneFurniRewardData(BaseStruct): furniId: str pointNum: int -class Act27SideDataAct27SideConstData(BaseModel): +class Act27SideDataAct27SideConstData(BaseStruct): stageId: str stageCode: str - purchasePriceName: list[str] - furniRewardList: list[Act27SideDataAct27SideMileStoneFurniRewardData] + purchasePriceName: List[str] + furniRewardList: List[Act27SideDataAct27SideMileStoneFurniRewardData] prizeText: str playerShopId: str milestonePointName: str inquirePanelTitle: str inquirePanelDesc: str - gain123: list[float] - gain113: list[float] - gain122: list[float] - gain111: list[float] - gain11None: list[float] - gain12None: list[float] + gain123: List[float] + gain113: List[float] + gain122: List[float] + gain111: List[float] + gain11None: List[float] + gain12None: List[float] campaignEnemyCnt: int -class Act27SideData(BaseModel): - goodDataMap: dict[str, Act27SideDataAct27SideGoodData] - mileStoneList: list[Act27SideDataAct27SideMileStoneData] - goodLaunchDataList: list[Act27SideDataAct27SideGoodLaunchData] - shopDataMap: dict[str, Act27SideDataAct27SideShopData] - inquireDataList: list[Act27SideDataAct27SideInquireData] - dynEntrySwitchData: list[Act27SideDataAct27SideDynEntrySwitchData] - zoneAdditionDataMap: dict[str, Act27SideDataAct27sideZoneAdditionData] +class Act27SideData(BaseStruct): + goodDataMap: Dict[str, Act27SideDataAct27SideGoodData] + mileStoneList: List[Act27SideDataAct27SideMileStoneData] + goodLaunchDataList: List[Act27SideDataAct27SideGoodLaunchData] + shopDataMap: Dict[str, Act27SideDataAct27SideShopData] + inquireDataList: List[Act27SideDataAct27SideInquireData] + dynEntrySwitchData: List[Act27SideDataAct27SideDynEntrySwitchData] + zoneAdditionDataMap: Dict[str, Act27SideDataAct27sideZoneAdditionData] constData: Act27SideDataAct27SideConstData -class ActivityTableActivityDetailTable(BaseModel): - DEFAULT: dict[str, DefaultFirstData] - CHECKIN_ONLY: dict[str, DefaultCheckInData] - CHECKIN_ALL_PLAYER: dict[str, AllPlayerCheckinData] - CHECKIN_VS: dict[str, VersusCheckInData] - TYPE_ACT3D0: dict[str, Act3D0Data] - TYPE_ACT4D0: dict[str, Act4D0Data] - TYPE_ACT5D0: dict[str, Act5D0Data] - TYPE_ACT5D1: dict[str, Act5D1Data] - COLLECTION: dict[str, ActivityCollectionData] - TYPE_ACT9D0: dict[str, Act9D0Data] - TYPE_ACT12SIDE: dict[str, Act12SideData] - TYPE_ACT13SIDE: dict[str, Act13SideData] - TYPE_ACT17SIDE: dict[str, Act17sideData] - TYPE_ACT20SIDE: dict[str, Act20SideData] - TYPE_ACT21SIDE: dict[str, Act21SideData] - LOGIN_ONLY: dict[str, ActivityLoginData] - SWITCH_ONLY: dict[str, ActivitySwitchCheckinData] - MINISTORY: dict[str, ActivityMiniStoryData] - ROGUELIKE: dict[str, ActivityRoguelikeData] - MULTIPLAY: dict[str, ActivityMultiplayData] - INTERLOCK: dict[str, ActivityInterlockData] - BOSS_RUSH: dict[str, ActivityBossRushData] - FLOAT_PARADE: dict[str, ActivityFloatParadeData] - SANDBOX: dict[str, ActSandboxData] - MAIN_BUFF: dict[str, ActivityMainlineBuffData] - TYPE_ACT24SIDE: dict[str, Act24SideData] - TYPE_ACT25SIDE: dict[str, Act25SideData] - TYPE_ACT38D1: dict[str, Act38D1Data] - TYPE_ACT27SIDE: dict[str, Act27SideData] +class Act42D0Data(BaseStruct): + pass -class ActivityStageRewardData(BaseModel): - stageRewardsDict: dict[str, list[StageDataDisplayDetailRewards]] +class ActivityTableActivityDetailTable(BaseStruct): + DEFAULT: Dict[str, DefaultFirstData] + CHECKIN_ONLY: Dict[str, DefaultCheckInData] + CHECKIN_ALL_PLAYER: Dict[str, AllPlayerCheckinData] + CHECKIN_VS: Dict[str, VersusCheckInData] + TYPE_ACT3D0: Dict[str, Act3D0Data] + TYPE_ACT4D0: Dict[str, Act4D0Data] + TYPE_ACT5D0: Dict[str, Act5D0Data] + TYPE_ACT5D1: Dict[str, Act5D1Data] + COLLECTION: Dict[str, ActivityCollectionData] + TYPE_ACT9D0: Dict[str, Act9D0Data] + TYPE_ACT12SIDE: Dict[str, Act12SideData] + TYPE_ACT13SIDE: Dict[str, Act13SideData] + TYPE_ACT17SIDE: Dict[str, Act17sideData] + TYPE_ACT20SIDE: Dict[str, Act20SideData] + TYPE_ACT21SIDE: Dict[str, Act21SideData] + LOGIN_ONLY: Dict[str, ActivityLoginData] + SWITCH_ONLY: Dict[str, ActivitySwitchCheckinData] + MINISTORY: Dict[str, ActivityMiniStoryData] + ROGUELIKE: Dict[str, ActivityRoguelikeData] + MULTIPLAY: Dict[str, ActivityMultiplayData] + INTERLOCK: Dict[str, ActivityInterlockData] + BOSS_RUSH: Dict[str, ActivityBossRushData] + FLOAT_PARADE: Dict[str, ActivityFloatParadeData] + SANDBOX: Dict[str, ActSandboxData] + MAIN_BUFF: Dict[str, ActivityMainlineBuffData] + TYPE_ACT24SIDE: Dict[str, Act24SideData] + TYPE_ACT25SIDE: Dict[str, Act25SideData] + TYPE_ACT38D1: Dict[str, Act38D1Data] + TYPE_ACT27SIDE: Dict[str, Act27SideData] + TYPE_ACT42D0: Dict[str, Act42D0Data] -class ActivityThemeDataTimeNode(BaseModel): +class ActivityStageRewardData(BaseStruct): + stageRewardsDict: Dict[str, List[StageDataDisplayDetailRewards]] + + +class ActivityThemeDataTimeNode(BaseStruct): title: str ts: int -class ActivityThemeData(BaseModel): - id_: str = Field(alias='id') - type_: str = Field(alias='type') +class ActivityThemeData(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') funcId: str endTs: int sortId: int - itemId: str | None - timeNodes: list[ActivityThemeDataTimeNode] + itemId: Union[str, None] + timeNodes: List[ActivityThemeDataTimeNode] startTs: int -class StageDataConditionDesc(BaseModel): +class StageDataConditionDesc(BaseStruct): stageId: str completeState: int -class AprilFoolStageData(BaseModel): +class AprilFoolStageData(BaseStruct): stageId: str levelId: str code: str @@ -1863,50 +1871,50 @@ class AprilFoolStageData(BaseModel): appearanceStyle: int loadingPicId: str difficulty: str - unlockCondition: list[StageDataConditionDesc] - stageDropInfo: list[ItemBundle] + unlockCondition: List[StageDataConditionDesc] + stageDropInfo: List[ItemBundle] -class AprilFoolScoreData(BaseModel): +class AprilFoolScoreData(BaseStruct): stageId: str sortId: int playerName: str playerScore: int -class AprilFoolConst(BaseModel): +class AprilFoolConst(BaseStruct): battleFinishLoseDes: str killEnemyDes: str killBossDes: str totalTime: str -class Act4funPerformGroupInfo(BaseModel): +class Act4funPerformGroupInfo(BaseStruct): performGroupId: str - performIds: list[str] + performIds: List[str] -class Act4funPerformWordData(BaseModel): +class Act4funPerformWordData(BaseStruct): text: str picId: str backgroundId: str -class Act4funPerformInfo(BaseModel): +class Act4funPerformInfo(BaseStruct): performId: str - performFinishedPicId: str | None - fixedCmpGroup: str | None - cmpGroups: list[str | None] - words: list[Act4funPerformWordData] + performFinishedPicId: Union[str, None] + fixedCmpGroup: Union[str, None] + cmpGroups: List[Union[str, None]] + words: List[Act4funPerformWordData] -class Act4funLiveMatEffectInfo(BaseModel): +class Act4funLiveMatEffectInfo(BaseStruct): liveMatEffectId: str valueId: str performGroup: str -class Act4funLiveMatInfoData(BaseModel): +class Act4funLiveMatInfoData(BaseStruct): liveMatId: str stageId: str name: str @@ -1914,10 +1922,10 @@ class Act4funLiveMatInfoData(BaseModel): tagTxt: str emojiIcon: str selectedPerformId: str - effectInfos: dict[str, Act4funLiveMatEffectInfo] + effectInfos: Dict[str, Act4funLiveMatEffectInfo] -class Act4funSpLiveMatInfoData(BaseModel): +class Act4funSpLiveMatInfoData(BaseStruct): spLiveMatId: str spLiveEveId: str stageId: str @@ -1925,18 +1933,18 @@ class Act4funSpLiveMatInfoData(BaseModel): picId: str tagTxt: str emojiIcon: str - accordingPerformId: str | None - selectedPerformId: str | None + accordingPerformId: Union[str, None] + selectedPerformId: Union[str, None] valueEffectId: str - accordingSuperChatId: str | None + accordingSuperChatId: Union[str, None] -class Act4funValueEffectInfoData(BaseModel): +class Act4funValueEffectInfoData(BaseStruct): valueEffectId: str - effectParams: dict[str, int] + effectParams: Dict[str, int] -class Act4funLiveValueInfoData(BaseModel): +class Act4funLiveValueInfoData(BaseStruct): liveValueId: str name: str stageId: str @@ -1947,7 +1955,7 @@ class Act4funLiveValueInfoData(BaseModel): decreaseToastTxt: str -class Act4funSuperChatInfo(BaseModel): +class Act4funSuperChatInfo(BaseStruct): superChatId: str chatType: int userName: str @@ -1957,42 +1965,42 @@ class Act4funSuperChatInfo(BaseModel): superChatTxt: str -class Act4funCmtInfo(BaseModel): - iconId: str | None - name: str | None +class Act4funCmtInfo(BaseStruct): + iconId: Union[str, None] + name: Union[str, None] cmtTxt: str -class Act4funCmtGroupInfo(BaseModel): +class Act4funCmtGroupInfo(BaseStruct): cmtGroupId: str - cmtList: list[Act4funCmtInfo] + cmtList: List[Act4funCmtInfo] -class Act4funEndingInfo(BaseModel): +class Act4funEndingInfo(BaseStruct): endingId: str endingAvg: str - endingDesc: str | None - stageId: str | None + endingDesc: Union[str, None] + stageId: Union[str, None] isGoodEnding: bool -class Act4funTokenInfoData(BaseModel): +class Act4funTokenInfoData(BaseStruct): tokenLevelId: str - levelDesc: str | None + levelDesc: Union[str, None] skillDesc: str tokenLevelNum: int levelIconId: str -class Act4funMissionData(BaseModel): +class Act4funMissionData(BaseStruct): missionId: str - sortId: int + sortId: str missionDes: str - rewardIconIds: list[str] - rewards: list[ItemBundle] + rewardIconIds: List[str] + rewards: List[ItemBundle] -class Act4funConst(BaseModel): +class Act4funConst(BaseStruct): liveMatAmtLowerLimit: int liveTurnUpperLimit: int superChatCountDownNum: int @@ -2029,43 +2037,43 @@ class Act4funConst(BaseModel): formalLevelUnlockToastTxt: str -class Act4funStageExtraData(BaseModel): +class Act4funStageExtraData(BaseStruct): description: str - valueIconId: str | None + valueIconId: Union[str, None] -class Act4funData(BaseModel): - performGroupInfoDict: dict[str, Act4funPerformGroupInfo] - performInfoDict: dict[str, Act4funPerformInfo] - normalMatDict: dict[str, Act4funLiveMatInfoData] - spMatDict: dict[str, Act4funSpLiveMatInfoData] - valueEffectInfoDict: dict[str, Act4funValueEffectInfoData] - liveValueInfoDict: dict[str, Act4funLiveValueInfoData] - superChatInfoDict: dict[str, Act4funSuperChatInfo] - cmtGroupInfoDict: dict[str, Act4funCmtGroupInfo] - cmtUsers: list[str] - endingDict: dict[str, Act4funEndingInfo] - tokenLevelInfos: dict[str, Act4funTokenInfoData] - missionDatas: dict[str, Act4funMissionData] +class Act4funData(BaseStruct): + performGroupInfoDict: Dict[str, Act4funPerformGroupInfo] + performInfoDict: Dict[str, Act4funPerformInfo] + normalMatDict: Dict[str, Act4funLiveMatInfoData] + spMatDict: Dict[str, Act4funSpLiveMatInfoData] + valueEffectInfoDict: Dict[str, Act4funValueEffectInfoData] + liveValueInfoDict: Dict[str, Act4funLiveValueInfoData] + superChatInfoDict: Dict[str, Act4funSuperChatInfo] + cmtGroupInfoDict: Dict[str, Act4funCmtGroupInfo] + cmtUsers: List[str] + endingDict: Dict[str, Act4funEndingInfo] + tokenLevelInfos: Dict[str, Act4funTokenInfoData] + missionDatas: Dict[str, Act4funMissionData] constant: Act4funConst - stageExtraDatas: dict[str, Act4funStageExtraData] - randomMsgText: list[str] - randomUserIconId: list[str] + stageExtraDatas: Dict[str, Act4funStageExtraData] + randomMsgText: List[str] + randomUserIconId: List[str] -class AprilFoolTable(BaseModel): - stages: dict[str, AprilFoolStageData] - scoreDict: dict[str, list[AprilFoolScoreData]] +class AprilFoolTable(BaseStruct): + stages: Dict[str, AprilFoolStageData] + scoreDict: Dict[str, List[AprilFoolScoreData]] constant: AprilFoolConst act4FunData: Act4funData -class CartComponents(BaseModel): +class CartComponents(BaseStruct): compId: str sortId: int type: str - posList: list[str] - posIdDict: dict[str, list[str]] + posList: List[str] + posIdDict: Dict[str, List[str]] name: str icon: str showScores: int @@ -2077,36 +2085,36 @@ class CartComponents(BaseModel): price: int specialObtain: str obtainInRandom: bool - additiveColor: str | None + additiveColor: Union[str, None] -class CartDataCartConstData(BaseModel): +class CartDataCartConstData(BaseStruct): carItemUnlockStageId: str carItemUnlockDesc: str spLevelUnlockItemCnt: int mileStoneBaseInterval: int - spStageIds: list[str] + spStageIds: List[str] carFrameDefaultColor: str -class CartData(BaseModel): - carDict: dict[str, CartComponents] - runeDataDict: dict[str, RuneTablePackedRuneData] - cartStages: list[str] +class CartData(BaseStruct): + carDict: Dict[str, CartComponents] + runeDataDict: Dict[str, RuneTablePackedRuneData] + cartStages: List[str] constData: CartDataCartConstData -class SiracusaDataAreaData(BaseModel): +class SiracusaDataAreaData(BaseStruct): areaId: str areaName: str areaSubName: str unlockType: str - unlockStage: str | None + unlockStage: Union[str, None] areaIconId: str - pointList: list[str] + pointList: List[str] -class SiracusaDataPointData(BaseModel): +class SiracusaDataPointData(BaseStruct): pointId: str areaId: str pointName: str @@ -2115,11 +2123,11 @@ class SiracusaDataPointData(BaseModel): pointItaName: str -class SiracusaDataCharCardData(BaseModel): +class SiracusaDataCharCardData(BaseStruct): charCardId: str sortIndex: int avgChar: str - avgCharOffsetY: float | int + avgCharOffsetY: Union[float, int] charCardName: str charCardItaName: str charCardTitle: str @@ -2127,12 +2135,12 @@ class SiracusaDataCharCardData(BaseModel): fullCompleteDes: str gainDesc: str themeColor: str - taskRingList: list[str] + taskRingList: List[str] operaItemId: str - gainParamList: list[str] | None + gainParamList: Union[List[str], None] -class SiracusaDataTaskRingData(BaseModel): +class SiracusaDataTaskRingData(BaseStruct): taskRingId: str sortIndex: int charCardId: str @@ -2140,30 +2148,30 @@ class SiracusaDataTaskRingData(BaseModel): ringText: str item: ItemBundle isPrecious: bool - taskIdList: list[str] + taskIdList: List[str] -class SiracusaDataTaskBasicInfoData(BaseModel): +class SiracusaDataTaskBasicInfoData(BaseStruct): taskId: str taskRingId: str sortIndex: int placeId: str - npcId: str | None + npcId: Union[str, None] taskType: str -class SiracusaDataBattleTaskData(BaseModel): +class SiracusaDataBattleTaskData(BaseStruct): taskId: str stageId: str battleTaskDesc: str -class SiracusaDataAVGTaskData(BaseModel): +class SiracusaDataAVGTaskData(BaseStruct): taskId: str taskAvg: str -class SiracusaDataItemInfoData(BaseModel): +class SiracusaDataItemInfoData(BaseStruct): itemId: str itemName: str itemItalyName: str @@ -2171,113 +2179,113 @@ class SiracusaDataItemInfoData(BaseModel): itemIcon: str -class SiracusaDataItemCardInfoData(BaseModel): +class SiracusaDataItemCardInfoData(BaseStruct): cardId: str cardName: str cardDesc: str optionScript: str -class SiracusaDataNavigationInfoData(BaseModel): +class SiracusaDataNavigationInfoData(BaseStruct): entryId: str navigationType: str entryIcon: str - entryName: str | None - entrySubName: str | None + entryName: Union[str, None] + entrySubName: Union[str, None] -class SiracusaDataOptionInfoData(BaseModel): +class SiracusaDataOptionInfoData(BaseStruct): optionId: str optionDesc: str optionScript: str - optionGoToScript: str | None + optionGoToScript: Union[str, None] isLeaveOption: bool needCommentLike: bool - requireCardId: str | None + requireCardId: Union[str, None] -class SiracusaDataStagePointInfoData(BaseModel): +class SiracusaDataStagePointInfoData(BaseStruct): stageId: str pointId: str sortId: int isTaskStage: bool -class SiracusaDataStoryBriefInfoData(BaseModel): +class SiracusaDataStoryBriefInfoData(BaseStruct): storyId: str stageId: str storyInfo: str -class SiracusaDataOperaInfoData(BaseModel): +class SiracusaDataOperaInfoData(BaseStruct): operaId: str sortId: int operaName: str operaSubName: str - operaScore: float + operaScore: str unlockTime: int -class SiracusaDataOperaCommentInfoData(BaseModel): +class SiracusaDataOperaCommentInfoData(BaseStruct): commentId: str referenceOperaId: str columnIndex: int columnSortId: int commentTitle: str - score: float + score: str commentContent: str commentCharId: str -class SiracusaDataConstData(BaseModel): +class SiracusaDataConstData(BaseStruct): operaDailyNum: int operaAllUnlockTime: int defaultFocusArea: str -class SiracusaData(BaseModel): - areaDataMap: dict[str, SiracusaDataAreaData] - pointDataMap: dict[str, SiracusaDataPointData] - charCardMap: dict[str, SiracusaDataCharCardData] - taskRingMap: dict[str, SiracusaDataTaskRingData] - taskInfoMap: dict[str, SiracusaDataTaskBasicInfoData] - battleTaskMap: dict[str, SiracusaDataBattleTaskData] - avgTaskMap: dict[str, SiracusaDataAVGTaskData] - itemInfoMap: dict[str, SiracusaDataItemInfoData] - itemCardInfoMap: dict[str, SiracusaDataItemCardInfoData] - navigationInfoMap: dict[str, SiracusaDataNavigationInfoData] - optionInfoMap: dict[str, SiracusaDataOptionInfoData] - stagePointList: list[SiracusaDataStagePointInfoData] - storyBriefInfoDataMap: dict[str, SiracusaDataStoryBriefInfoData] - operaInfoMap: dict[str, SiracusaDataOperaInfoData] - operaCommentInfoMap: dict[str, SiracusaDataOperaCommentInfoData] +class SiracusaData(BaseStruct): + areaDataMap: Dict[str, SiracusaDataAreaData] + pointDataMap: Dict[str, SiracusaDataPointData] + charCardMap: Dict[str, SiracusaDataCharCardData] + taskRingMap: Dict[str, SiracusaDataTaskRingData] + taskInfoMap: Dict[str, SiracusaDataTaskBasicInfoData] + battleTaskMap: Dict[str, SiracusaDataBattleTaskData] + avgTaskMap: Dict[str, SiracusaDataAVGTaskData] + itemInfoMap: Dict[str, SiracusaDataItemInfoData] + itemCardInfoMap: Dict[str, SiracusaDataItemCardInfoData] + navigationInfoMap: Dict[str, SiracusaDataNavigationInfoData] + optionInfoMap: Dict[str, SiracusaDataOptionInfoData] + stagePointList: List[SiracusaDataStagePointInfoData] + storyBriefInfoDataMap: Dict[str, SiracusaDataStoryBriefInfoData] + operaInfoMap: Dict[str, SiracusaDataOperaInfoData] + operaCommentInfoMap: Dict[str, SiracusaDataOperaCommentInfoData] constData: SiracusaDataConstData -class KVSwitchInfo(BaseModel): +class KVSwitchInfo(BaseStruct): isDefault: bool displayTime: int - zoneId: str | None + zoneId: Union[str, None] -class ActivityKVSwitchData(BaseModel): - kvSwitchInfo: dict[str, KVSwitchInfo] +class ActivityKVSwitchData(BaseStruct): + kvSwitchInfo: Dict[str, KVSwitchInfo] -class DynEntrySwitchInfo(BaseModel): +class DynEntrySwitchInfo(BaseStruct): entryId: str sortId: int - stageId: str | None + stageId: Union[str, None] -class ActivityDynEntrySwitchData(BaseModel): - entrySwitchInfo: dict[str, DynEntrySwitchInfo] +class ActivityDynEntrySwitchData(BaseStruct): + entrySwitchInfo: Dict[str, DynEntrySwitchInfo] -class ActivityTableActivityHiddenStageUnlockConditionData(BaseModel): +class ActivityTableActivityHiddenStageUnlockConditionData(BaseStruct): unlockStageId: str unlockTemplate: str - unlockParams: list[str] | None + unlockParams: Union[List[str], None] missionStageId: str unlockedName: str lockedName: str @@ -2288,47 +2296,40 @@ class ActivityTableActivityHiddenStageUnlockConditionData(BaseModel): riddle: str -class ActivityTableActivityHiddenStageData(BaseModel): +class ActivityTableActivityHiddenStageData(BaseStruct): stageId: str encodedName: str showStageId: str rewardDiamond: bool - missions: list[ActivityTableActivityHiddenStageUnlockConditionData] + missions: List[ActivityTableActivityHiddenStageUnlockConditionData] -class ActivityTable(BaseModel): +class ActivityTableExtraData(BaseStruct): + periodId: str + startTs: int + endTs: int + + +class ActivityTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - basicInfo: dict[str, ActivityTableBasicData] - homeActConfig: dict[str, ActivityTableHomeActivityConfig] - zoneToActivity: dict[str, str] - missionData: list[MissionData] - missionGroup: list[MissionGroup] - replicateMissions: dict[str, str] | None + basicInfo: Dict[str, ActivityTableBasicData] + homeActConfig: Dict[str, ActivityTableHomeActivityConfig] + zoneToActivity: Dict[str, str] + missionData: List[MissionData] + missionGroup: List[MissionGroup] + replicateMissions: Union[Dict[str, str], None] activity: ActivityTableActivityDetailTable - activityItems: dict[str, list[str]] - syncPoints: dict[str, list[int]] + extraData: Dict[str, Dict[str, Dict[str, List[ActivityTableExtraData]]]] + activityItems: Dict[str, List[str]] + syncPoints: Dict[str, List[int]] dynActs: Any - stageRewardsData: dict[str, ActivityStageRewardData] - actThemes: list[ActivityThemeData] + stageRewardsData: Dict[str, ActivityStageRewardData] + actThemes: List[ActivityThemeData] actFunData: AprilFoolTable carData: CartData siracusaData: SiracusaData - kvSwitchData: dict[str, ActivityKVSwitchData] - dynEntrySwitchData: dict[str, ActivityDynEntrySwitchData] - hiddenStageData: list[ActivityTableActivityHiddenStageData] - stringRes: dict[str, dict[str, str]] - - class Config: - extra = 'allow' - - -if __name__ == '__main__': - import json - - path = "C:/Users/Administrator/Desktop/gsuid_core/data/ArknightsUID/resource/gamedata/activity_table.json" - - with open(path, encoding='utf-8') as f: - data = json.load(f) - - print(ActivityTable(**data)) + kvSwitchData: Dict[str, ActivityKVSwitchData] + dynEntrySwitchData: Dict[str, ActivityDynEntrySwitchData] + hiddenStageData: List[ActivityTableActivityHiddenStageData] + stringRes: Dict[str, Dict[str, str]] diff --git a/ArknightsUID/utils/models/gamedata/AudioData.py b/ArknightsUID/utils/models/gamedata/AudioData.py index e46ecb3..831a2bf 100644 --- a/ArknightsUID/utils/models/gamedata/AudioData.py +++ b/ArknightsUID/utils/models/gamedata/AudioData.py @@ -1,19 +1,18 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class Bank(BaseModel): +class BGMBank(BaseStruct): name: str - - -class BGMBank(Bank): - intro: str | None - loop: str | None + intro: Union[str, None] + loop: Union[str, None] volume: float crossfade: float delay: float -class SoundFXBankSoundFX(BaseModel): +class SoundFXBankSoundFX(BaseStruct): asset: str weight: float important: bool @@ -26,30 +25,32 @@ class SoundFXBankSoundFX(BaseModel): ignoreTimeScale: bool -class SoundFXBank(Bank): - sounds: list[SoundFXBankSoundFX] | None +class SoundFXBank(BaseStruct): + name: str + sounds: Union[List[SoundFXBankSoundFX], None] maxSoundAllowed: int popOldest: bool - customMixerGroup: str | None + customMixerGroup: Union[str, None] loop: bool -class SoundFXCtrlBank(Bank): +class SoundFXCtrlBank(BaseStruct): + name: str targetBank: str ctrlStop: bool ctrlStopFadetime: float + + +class SnapshotBank(BaseStruct): name: str - - -class SnapshotBank(Bank): targetSnapshot: str hookSoundFxBank: str delay: float duration: float - targetFxBank: Bank | None = None + targetFxBank: Union[str, None] = None -class BattleVoiceOption(BaseModel): +class BattleVoiceOption(BaseStruct): voiceType: int priority: int overlapIfSamePriority: bool @@ -57,30 +58,27 @@ class BattleVoiceOption(BaseModel): delay: float -class MusicData(BaseModel): - id_: str = Field(alias='id') +class MusicData(BaseStruct): + id_: str = field(name='id') name: str bank: str -class BattleVoiceData(BaseModel): +class BattleVoiceData(BaseStruct): crossfade: float minTimeDeltaForEnemyEncounter: float minSpCostForImportantPassiveSkill: int - voiceTypeOptions: list[BattleVoiceOption] + voiceTypeOptions: List[BattleVoiceOption] -class AudioData(BaseModel): +class AudioData(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - bgmBanks: list[BGMBank] - soundFXBanks: list[SoundFXBank] - soundFXCtrlBanks: list[SoundFXCtrlBank] - snapshotBanks: list[SnapshotBank] + bgmBanks: List[BGMBank] + soundFXBanks: List[SoundFXBank] + soundFXCtrlBanks: List[SoundFXCtrlBank] + snapshotBanks: List[SnapshotBank] battleVoice: BattleVoiceData - musics: list[MusicData] - soundFxVoiceLang: dict[str, dict[str, dict[str, str]]] - bankAlias: dict[str, str] - - class Config: - extra = 'allow' + musics: List[MusicData] + soundFxVoiceLang: Dict[str, Dict[str, Dict[str, str]]] + bankAlias: Dict[str, str] diff --git a/ArknightsUID/utils/models/gamedata/BattleEquipTable.py b/ArknightsUID/utils/models/gamedata/BattleEquipTable.py index 00b7bb1..9d0d14e 100644 --- a/ArknightsUID/utils/models/gamedata/BattleEquipTable.py +++ b/ArknightsUID/utils/models/gamedata/BattleEquipTable.py @@ -1,80 +1,82 @@ -from pydantic import BaseModel +from typing import Dict, List, Union +from ..common import BaseStruct -class CharacterDataUnlockCondition(BaseModel): +class CharacterDataUnlockCondition(BaseStruct): phase: int level: int -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class TalentData(BaseModel): +class TalentData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int - prefabKey: str | None - name: str | None - description: str | None - rangeId: str | None - blackboard: list[Blackboard] + prefabKey: Union[str, None] + name: Union[str, None] + description: Union[str, None] + rangeId: Union[str, None] + blackboard: List[Blackboard] class EquipTalentData(TalentData): displayRangeId: bool upgradeDescription: str talentIndex: int + tokenKey: Union[str, None] = None -class CharacterDataEquipTalentDataBundle(BaseModel): - candidates: list[EquipTalentData] | None +class CharacterDataEquipTalentDataBundle(BaseStruct): + candidates: Union[List[EquipTalentData], None] -class CharacterDataTraitData(BaseModel): +class CharacterDataTraitData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int - blackboard: list[Blackboard] - overrideDescripton: str | None - prefabKey: str | None - rangeId: str | None + blackboard: List[Blackboard] + overrideDescripton: Union[str, None] + prefabKey: Union[str, None] + rangeId: Union[str, None] -class CharacterDataEquipTraitData(BaseModel): - additionalDescription: str | None +class CharacterDataEquipTraitData(BaseStruct): + additionalDescription: Union[str, None] + unlockCondition: CharacterDataUnlockCondition + requiredPotentialRank: int + blackboard: List[Blackboard] + overrideDescripton: Union[str, None] + prefabKey: Union[str, None] + rangeId: Union[str, None] -class CharacterDataEquipTraitDataBundle(BaseModel): - candidates: list[CharacterDataEquipTraitData] | None +class CharacterDataEquipTraitDataBundle(BaseStruct): + candidates: Union[List[CharacterDataEquipTraitData], None] -class BattleUniEquipData(BaseModel): - resKey: str | None +class BattleUniEquipData(BaseStruct): + resKey: Union[str, None] target: str isToken: bool addOrOverrideTalentDataBundle: CharacterDataEquipTalentDataBundle overrideTraitDataBundle: CharacterDataEquipTraitDataBundle -class BattleEquipPerLevelPack(BaseModel): +class BattleEquipPerLevelPack(BaseStruct): equipLevel: int - parts: list[BattleUniEquipData] - attributeBlackboard: list[Blackboard] - tokenAttributeBlackboard: dict[str, list[Blackboard]] + parts: List[BattleUniEquipData] + attributeBlackboard: List[Blackboard] + tokenAttributeBlackboard: Dict[str, List[Blackboard]] -class BattleEquipData(BaseModel): - phases: list[BattleEquipPerLevelPack] +class BattleEquipData(BaseStruct): + phases: List[BattleEquipPerLevelPack] -class BattleEquipTable(BaseModel): +class BattleEquipTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - equips: dict[str, BattleEquipData] - - class Config: - extra = 'allow' - - def __init__(self, data: dict) -> None: - super().__init__(equips=data) + equips: Dict[str, BattleEquipData] diff --git a/ArknightsUID/utils/models/gamedata/BuildingData.py b/ArknightsUID/utils/models/gamedata/BuildingData.py index bbb191a..6e3b55a 100644 --- a/ArknightsUID/utils/models/gamedata/BuildingData.py +++ b/ArknightsUID/utils/models/gamedata/BuildingData.py @@ -1,37 +1,39 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class BuildingDataRoomUnlockCondCondItem(BaseModel): - type_: str = Field(alias='type') +class BuildingDataRoomUnlockCondCondItem(BaseStruct): + type_: str = field(name='type') level: int count: int -class BuildingDataRoomUnlockCond(BaseModel): - id_: str = Field(alias='id') - number: dict[str, BuildingDataRoomUnlockCondCondItem] +class BuildingDataRoomUnlockCond(BaseStruct): + id_: str = field(name='id') + number: Dict[str, BuildingDataRoomUnlockCondCondItem] -class GridPosition(BaseModel): +class GridPosition(BaseStruct): row: int col: int -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class BuildingDataRoomDataBuildCost(BaseModel): - items: list[ItemBundle] +class BuildingDataRoomDataBuildCost(BaseStruct): + items: List[ItemBundle] time: int labor: int -class BuildingDataRoomDataPhaseData(BaseModel): - overrideName: str | None - overridePrefabId: str | None +class BuildingDataRoomDataPhaseData(BaseStruct): + overrideName: Union[str, None] + overridePrefabId: Union[str, None] unlockCondId: str buildCost: BuildingDataRoomDataBuildCost electricity: int @@ -39,20 +41,20 @@ class BuildingDataRoomDataPhaseData(BaseModel): manpowerCost: int -class BuildingDataRoomData(BaseModel): - id_: str = Field(alias='id') +class BuildingDataRoomData(BaseStruct): + id_: str = field(name='id') name: str - description: str | None + description: Union[str, None] defaultPrefabId: str canLevelDown: bool maxCount: int category: str size: GridPosition - phases: list[BuildingDataRoomDataPhaseData] + phases: List[BuildingDataRoomDataPhaseData] -class BuildingDataLayoutDataRoomSlot(BaseModel): - id_: str = Field(alias='id') +class BuildingDataLayoutDataRoomSlot(BaseStruct): + id_: str = field(name='id') cleanCostId: str costLabor: int provideLabor: int @@ -62,133 +64,149 @@ class BuildingDataLayoutDataRoomSlot(BaseModel): storeyId: str -class BuildingDataLayoutDataSlotCleanCostCountCost(BaseModel): - items: list[ItemBundle] +class BuildingDataLayoutDataSlotCleanCostCountCost(BaseStruct): + items: List[ItemBundle] -class BuildingDataLayoutDataSlotCleanCost(BaseModel): - id_: str = Field(alias='id') - number: dict[str, BuildingDataLayoutDataSlotCleanCostCountCost] +class BuildingDataLayoutDataSlotCleanCost(BaseStruct): + id_: str = field(name='id') + number: Dict[str, BuildingDataLayoutDataSlotCleanCostCountCost] -class BuildingDataLayoutDataStoreyData(BaseModel): - id_: str = Field(alias='id') +class BuildingDataLayoutDataStoreyData(BaseStruct): + id_: str = field(name='id') yOffset: int unlockControlLevel: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class BuildingDataLayoutData(BaseModel): - id_: str = Field(alias='id') - slots: dict[str, BuildingDataLayoutDataRoomSlot] - cleanCosts: dict[str, BuildingDataLayoutDataSlotCleanCost] - storeys: dict[str, BuildingDataLayoutDataStoreyData] +class BuildingDataLayoutData(BaseStruct): + id_: str = field(name='id') + slots: Dict[str, BuildingDataLayoutDataRoomSlot] + cleanCosts: Dict[str, BuildingDataLayoutDataSlotCleanCost] + storeys: Dict[str, BuildingDataLayoutDataStoreyData] -class BuildingDataPrefabInfo(BaseModel): - id_: str = Field(alias='id') - blueprintRoomOverrideId: str | None +class BuildingDataPrefabInfo(BaseStruct): + id_: str = field(name='id') + blueprintRoomOverrideId: Union[str, None] size: GridPosition floorGridSize: GridPosition backWallGridSize: GridPosition - obstacleId: str | None + obstacleId: Union[str, None] -class BuildingDataManufactPhase(BaseModel): - speed: float | int +class BuildingDataManufactPhase(BaseStruct, tag='BuildingDataManufactPhase'): + speed: Union[float, int] outputCapacity: int -class BuildingDataShopPhase(BaseModel): +class BuildingDataShopPhase(BaseStruct, tag='BuildingDataShopPhase'): counterNum: int - speed: float | int + speed: Union[float, int] moneyCapacity: int -class BuildingDataHirePhase(BaseModel): +class BuildingDataHirePhase(BaseStruct, tag='BuildingDataHirePhase'): economizeRate: float resSpeed: int refreshTimes: int -class BuildingDataDormPhase(BaseModel): +class BuildingDataDormPhase(BaseStruct, tag='BuildingDataDormPhase'): manpowerRecover: int decorationLimit: int -class BuildingDataMeetingPhase(BaseModel): +class BuildingDataMeetingPhase(BaseStruct, tag='BuildingDataMeetingPhase'): friendSlotInc: int maxVisitorNum: int gatheringSpeed: int -class BuildingDataTradingPhase(BaseModel): - orderSpeed: float | int +class BuildingDataTradingPhase(BaseStruct, tag='BuildingDataTradingPhase'): + orderSpeed: Union[float, int] orderLimit: int orderRarity: int -class BuildingDataWorkshopPhase(BaseModel): - manpowerFactor: float | int +class BuildingDataWorkshopPhase(BaseStruct, tag='BuildingDataWorkshopPhase'): + manpowerFactor: Union[float, int] -class BuildingDataTrainingPhase(BaseModel): +class BuildingDataTrainingPhase(BaseStruct, tag='BuildingDataTrainingPhase'): specSkillLvlLimit: int -class BuildingDataRoomBean(BaseModel): - phases: list[BuildingDataManufactPhase | BuildingDataShopPhase | BuildingDataHirePhase | BuildingDataDormPhase | BuildingDataMeetingPhase | BuildingDataTradingPhase | BuildingDataWorkshopPhase | BuildingDataTrainingPhase] | None # noqa: E501 +class BuildingDataShopRoomBean(BaseStruct): + phases: None = None + # phases: Union[List[Union[Union[Union[Union[Union[Union[Union[BuildingDataManufactPhase, BuildingDataShopPhase], BuildingDataHirePhase], BuildingDataDormPhase], BuildingDataMeetingPhase], BuildingDataTradingPhase], BuildingDataWorkshopPhase], BuildingDataTrainingPhase]], None] # noqa: E501 -class BuildingDataControlRoomBean(BuildingDataRoomBean): +class BuildingDataControlRoomBean(BaseStruct): basicCostBuff: int + phases: None = None -class BuildingDataManufactRoomBean(BuildingDataRoomBean): +class BuildingDataManufactRoomBean(BaseStruct): basicSpeedBuff: float + phases: List[BuildingDataManufactPhase] -class BuildingDataHireRoomBean(BuildingDataRoomBean): +class BuildingDataHireRoomBean(BaseStruct): basicSpeedBuff: float + phases: List[BuildingDataHirePhase] -class BuildingDataMeetingRoomBean(BuildingDataRoomBean): +class BuildingDataDormRoomBean(BaseStruct): + phases: List[BuildingDataDormPhase] + + +class BuildingDataMeetingRoomBean(BaseStruct): basicSpeedBuff: float + phases: List[BuildingDataMeetingPhase] -class BuildingDataTradingRoomBean(BuildingDataRoomBean): +class BuildingDataTradingRoomBean(BaseStruct): basicSpeedBuff: float + phases: List[BuildingDataTradingPhase] -class BuildingDataTrainingBean(BuildingDataRoomBean): +class BuildingDataWorkShopRoomBean(BaseStruct): + phases: List[BuildingDataWorkshopPhase] + + +class BuildingDataTrainingBean(BaseStruct): basicSpeedBuff: float + phases: List[BuildingDataTrainingPhase] -class BuildingDataPowerRoomBean(BuildingDataRoomBean): +class BuildingDataPowerRoomBean(BaseStruct): basicSpeedBuff: float + phases: None = None -class CharacterDataUnlockCondition(BaseModel): +class CharacterDataUnlockCondition(BaseStruct): phase: int level: int -class BuildingDataBuildingBuffCharSlotSlotItem(BaseModel): +class BuildingDataBuildingBuffCharSlotSlotItem(BaseStruct): buffId: str cond: CharacterDataUnlockCondition -class BuildingDataBuildingBuffCharSlot(BaseModel): - buffData: list[BuildingDataBuildingBuffCharSlotSlotItem] +class BuildingDataBuildingBuffCharSlot(BaseStruct): + buffData: List[BuildingDataBuildingBuffCharSlotSlotItem] -class BuildingDataBuildingCharacter(BaseModel): +class BuildingDataBuildingCharacter(BaseStruct): charId: str maxManpower: int - buffChar: list[BuildingDataBuildingBuffCharSlot] + buffChar: List[BuildingDataBuildingBuffCharSlot] -class BuildingDataBuildingBuff(BaseModel): +class BuildingDataBuildingBuff(BaseStruct): buffId: str buffName: str buffIcon: str @@ -201,13 +219,12 @@ class BuildingDataBuildingBuff(BaseModel): description: str -class BuildingDataCustomDataFurnitureData(BaseModel): - id_: str = Field(alias='id') +class BuildingDataCustomDataFurnitureData(BaseStruct): + id_: str = field(name='id') sortId: int name: str iconId: str - interactType: str | None = None - type_: str = Field(alias='type') + type_: str = field(name='type') subType: str location: str category: str @@ -226,101 +243,102 @@ class BuildingDataCustomDataFurnitureData(BaseModel): processedProductId: str processedProductCount: int processedByProductPercentage: int - processedByProductGroup: list + processedByProductGroup: List canBeDestroy: bool isOnly: int quantity: int + interactType: Union[str, None] = None -class BuildingDataCustomDataThemeQuickSetupItem(BaseModel): +class BuildingDataCustomDataThemeQuickSetupItem(BaseStruct): furnitureId: str pos0: int pos1: int - dir_: int = Field(alias='dir') + dir_: int = field(name='dir') -class BuildingDataCustomDataThemeData(BaseModel): - id_: str = Field(alias='id') +class BuildingDataCustomDataThemeData(BaseStruct): + id_: str = field(name='id') sortId: int name: str themeType: str desc: str - quickSetup: list[BuildingDataCustomDataThemeQuickSetupItem] - groups: list[str] - furnitures: list[str] + quickSetup: List[BuildingDataCustomDataThemeQuickSetupItem] + groups: List[str] + furnitures: List[str] -class BuildingDataCustomDataGroupData(BaseModel): - id_: str = Field(alias='id') +class BuildingDataCustomDataGroupData(BaseStruct): + id_: str = field(name='id') sortId: int name: str themeId: str comfort: int count: int - furniture: list[str] + furniture: List[str] -class BuildingDataCustomDataFurnitureTypeData(BaseModel): - type_: str = Field(alias='type') +class BuildingDataCustomDataFurnitureTypeData(BaseStruct): + type_: str = field(name='type') name: str -class BuildingDataCustomDataFurnitureSubTypeData(BaseModel): +class BuildingDataCustomDataFurnitureSubTypeData(BaseStruct): subType: str name: str - type_: str = Field(alias='type') + type_: str = field(name='type') sortId: int -class BuildingDataCustomDataDormitoryDefaultFurnitureItem(BaseModel): +class BuildingDataCustomDataDormitoryDefaultFurnitureItem(BaseStruct): furnitureId: str xOffset: int yOffset: int defaultPrefabId: str -class BuildingDataCustomDataInteractItem(BaseModel): +class BuildingDataCustomDataInteractItem(BaseStruct): skinId: str -class BuildingDataCustomDataDiyUISortTemplateListDataDiyUISortTemplateData(BaseModel): +class BuildingDataCustomDataDiyUISortTemplateListDataDiyUISortTemplateData(BaseStruct): name: str - sequences: list[str] + sequences: List[str] stableSequence: str stableSequenceOrder: str -class BuildingDataCustomDataDiyUISortTemplateListData(BaseModel): +class BuildingDataCustomDataDiyUISortTemplateListData(BaseStruct): diyUIType: str expandState: str defaultTemplateIndex: int defaultTemplateOrder: str - templates: list[BuildingDataCustomDataDiyUISortTemplateListDataDiyUISortTemplateData] + templates: List[BuildingDataCustomDataDiyUISortTemplateListDataDiyUISortTemplateData] -class BuildingDataCustomData(BaseModel): - furnitures: dict[str, BuildingDataCustomDataFurnitureData] - themes: dict[str, BuildingDataCustomDataThemeData] - groups: dict[str, BuildingDataCustomDataGroupData] - types: dict[str, BuildingDataCustomDataFurnitureTypeData] - subTypes: dict[str, BuildingDataCustomDataFurnitureSubTypeData] - defaultFurnitures: dict[str, list[BuildingDataCustomDataDormitoryDefaultFurnitureItem]] - interactGroups: dict[str, list[BuildingDataCustomDataInteractItem]] - diyUISortTemplates: dict[str, dict[str, BuildingDataCustomDataDiyUISortTemplateListData]] +class BuildingDataCustomData(BaseStruct): + furnitures: Dict[str, BuildingDataCustomDataFurnitureData] + themes: Dict[str, BuildingDataCustomDataThemeData] + groups: Dict[str, BuildingDataCustomDataGroupData] + types: Dict[str, BuildingDataCustomDataFurnitureTypeData] + subTypes: Dict[str, BuildingDataCustomDataFurnitureSubTypeData] + defaultFurnitures: Dict[str, List[BuildingDataCustomDataDormitoryDefaultFurnitureItem]] + interactGroups: Dict[str, List[BuildingDataCustomDataInteractItem]] + diyUISortTemplates: Dict[str, Dict[str, BuildingDataCustomDataDiyUISortTemplateListData]] -class BuildingDataManufactFormulaUnlockRoom(BaseModel): +class BuildingDataManufactFormulaUnlockRoom(BaseStruct): roomId: str roomLevel: int roomCount: int -class BuildingDataManufactFormulaUnlockStage(BaseModel): +class BuildingDataManufactFormulaUnlockStage(BaseStruct): stageId: str rank: int -class BuildingDataManufactFormula(BaseModel): +class BuildingDataManufactFormula(BaseStruct): formulaId: str itemId: str count: int @@ -328,43 +346,43 @@ class BuildingDataManufactFormula(BaseModel): costPoint: int formulaType: str buffType: str - costs: list[ItemBundle] - requireRooms: list[BuildingDataManufactFormulaUnlockRoom] - requireStages: list[BuildingDataManufactFormulaUnlockStage] + costs: List[ItemBundle] + requireRooms: List[BuildingDataManufactFormulaUnlockRoom] + requireStages: List[BuildingDataManufactFormulaUnlockStage] -class BuildingDataShopFormulaUnlockRoom(BaseModel): +class BuildingDataShopFormulaUnlockRoom(BaseStruct): roomId: str roomLevel: int -class BuildingDataShopFormula(BaseModel): +class BuildingDataShopFormula(BaseStruct): formulaId: str itemId: str formulaType: str costPoint: int gainItem: ItemBundle - requireRooms: list[BuildingDataShopFormulaUnlockRoom] + requireRooms: List[BuildingDataShopFormulaUnlockRoom] -class BuildingDataWorkshopExtraWeightItem(BaseModel): +class BuildingDataWorkshopExtraWeightItem(BaseStruct): weight: int itemId: str itemCount: int -class BuildingDataWorkshopFormulaUnlockRoom(BaseModel): +class BuildingDataWorkshopFormulaUnlockRoom(BaseStruct): roomId: str roomLevel: int roomCount: int -class BuildingDataWorkshopFormulaUnlockStage(BaseModel): +class BuildingDataWorkshopFormulaUnlockStage(BaseStruct): stageId: str rank: int -class BuildingDataWorkshopFormula(BaseModel): +class BuildingDataWorkshopFormula(BaseStruct): sortId: int formulaId: str rarity: int @@ -375,23 +393,25 @@ class BuildingDataWorkshopFormula(BaseModel): formulaType: str buffType: str extraOutcomeRate: float - extraOutcomeGroup: list[BuildingDataWorkshopExtraWeightItem] - costs: list[ItemBundle] - requireRooms: list[BuildingDataWorkshopFormulaUnlockRoom] - requireStages: list[BuildingDataWorkshopFormulaUnlockStage] + extraOutcomeGroup: List[BuildingDataWorkshopExtraWeightItem] + costs: List[ItemBundle] + requireRooms: List[BuildingDataWorkshopFormulaUnlockRoom] + requireStages: List[BuildingDataWorkshopFormulaUnlockStage] -class BuildingDataCreditFormulaValueModel(BaseModel): +class BuildingDataCreditFormulaValueModel(BaseStruct): basic: int addition: int -class BuildingDataCreditFormula(BaseModel): - initiative: BuildingDataCreditFormulaValueModel | dict - passive: BuildingDataCreditFormulaValueModel | dict +class BuildingDataCreditFormula(BaseStruct): + initiative: Dict + passive: Dict + # initiative: Union[BuildingDataCreditFormulaValueModel, Dict] + # passive: Union[BuildingDataCreditFormulaValueModel, Dict] -class BuildingData(BaseModel): +class BuildingData(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' controlSlotId: str @@ -411,8 +431,8 @@ class BuildingData(BaseModel): manufactStationBuff: float comfortManpowerRecoverFactor: int manpowerDisplayFactor: int - shopOutputRatio: dict[str, int] | None - shopStackRatio: dict[str, int] | None + shopOutputRatio: Union[Dict[str, int], None] + shopStackRatio: Union[Dict[str, int], None] basicFavorPerDay: int humanResourceLimit: int tiredApThreshold: int @@ -429,32 +449,29 @@ class BuildingData(BaseModel): socialSlotNum: int furniDuplicationLimit: int assistFavorReport: int - manufactManpowerCostByNum: list[int] - tradingManpowerCostByNum: list[int] - roomUnlockConds: dict[str, BuildingDataRoomUnlockCond] - rooms: dict[str, BuildingDataRoomData] - layouts: dict[str, BuildingDataLayoutData] - prefabs: dict[str, BuildingDataPrefabInfo] + manufactManpowerCostByNum: List[int] + tradingManpowerCostByNum: List[int] + roomUnlockConds: Dict[str, BuildingDataRoomUnlockCond] + rooms: Dict[str, BuildingDataRoomData] + layouts: Dict[str, BuildingDataLayoutData] + prefabs: Dict[str, BuildingDataPrefabInfo] controlData: BuildingDataControlRoomBean manufactData: BuildingDataManufactRoomBean - shopData: BuildingDataRoomBean + shopData: BuildingDataShopRoomBean hireData: BuildingDataHireRoomBean - dormData: BuildingDataRoomBean + dormData: BuildingDataDormRoomBean meetingData: BuildingDataMeetingRoomBean tradingData: BuildingDataTradingRoomBean - workshopData: BuildingDataRoomBean + workshopData: BuildingDataWorkShopRoomBean trainingData: BuildingDataTrainingBean powerData: BuildingDataPowerRoomBean - chars: dict[str, BuildingDataBuildingCharacter] - buffs: dict[str, BuildingDataBuildingBuff] - workshopBonus: dict[str, list[str]] + chars: Dict[str, BuildingDataBuildingCharacter] + buffs: Dict[str, BuildingDataBuildingBuff] + workshopBonus: Dict[str, List[str]] customData: BuildingDataCustomData - manufactFormulas: dict[str, BuildingDataManufactFormula] - shopFormulas: dict[str, BuildingDataShopFormula] - workshopFormulas: dict[str, BuildingDataWorkshopFormula] + manufactFormulas: Dict[str, BuildingDataManufactFormula] + shopFormulas: Dict[str, BuildingDataShopFormula] + workshopFormulas: Dict[str, BuildingDataWorkshopFormula] creditFormula: BuildingDataCreditFormula - goldItems: dict[str, int] - assistantUnlock: list[int] - - class Config: - extra = 'allow' + goldItems: Dict[str, int] + assistantUnlock: List[int] diff --git a/ArknightsUID/utils/models/gamedata/CampaignTable.py b/ArknightsUID/utils/models/gamedata/CampaignTable.py index 7b40fd0..51227ea 100644 --- a/ArknightsUID/utils/models/gamedata/CampaignTable.py +++ b/ArknightsUID/utils/models/gamedata/CampaignTable.py @@ -1,29 +1,31 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class CampaignDataBreakRewardLadder(BaseModel): +class CampaignDataBreakRewardLadder(BaseStruct): killCnt: int breakFeeAdd: int - rewards: list[ItemBundle] + rewards: List[ItemBundle] -class WeightItemBundle(BaseModel): - id_: str = Field(alias='id') - type_: str = Field(alias='type') +class WeightItemBundle(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') dropType: str count: int weight: int -class StageDataDisplayRewards_(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class StageDataDisplayRewards_(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') dropType: int @@ -33,18 +35,18 @@ class StageDataDisplayDetailRewards_(StageDataDisplayRewards_): CannotGetPercent: float -class CampaignDataCampaignDropInfo(BaseModel): - firstPassRewards: list[ItemBundle] | None - passRewards: list[list[WeightItemBundle]] | None - displayDetailRewards: list[StageDataDisplayDetailRewards_] | None +class CampaignDataCampaignDropInfo(BaseStruct): + firstPassRewards: Union[List[ItemBundle], None] + passRewards: Union[List[List[WeightItemBundle]], None] + displayDetailRewards: Union[List[StageDataDisplayDetailRewards_], None] -class CampaignDataDropLadder(BaseModel): +class CampaignDataDropLadder(BaseStruct): killCnt: int dropInfo: CampaignDataCampaignDropInfo -class CampaignDataGainLadder(BaseModel): +class CampaignDataGainLadder(BaseStruct): killCnt: int apFailReturn: int favor: int @@ -53,62 +55,62 @@ class CampaignDataGainLadder(BaseModel): displayDiamondShdNum: int -class StageDataDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class StageDataDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class StageDataDisplayDetailRewards(BaseModel): +class StageDataDisplayDetailRewards(BaseStruct): occPercent: int - type_: str = Field(alias='type') - id_: str = Field(alias='id') + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class CampaignDataDropGainInfo(BaseModel): - dropLadders: list[CampaignDataDropLadder] - gainLadders: list[CampaignDataGainLadder] - displayRewards: list[StageDataDisplayRewards] - displayDetailRewards: list[StageDataDisplayDetailRewards] +class CampaignDataDropGainInfo(BaseStruct): + dropLadders: List[CampaignDataDropLadder] + gainLadders: List[CampaignDataGainLadder] + displayRewards: List[StageDataDisplayRewards] + displayDetailRewards: List[StageDataDisplayDetailRewards] -class CampaignData(BaseModel): +class CampaignData(BaseStruct): stageId: str isSmallScale: int - breakLadders: list[CampaignDataBreakRewardLadder] + breakLadders: List[CampaignDataBreakRewardLadder] isCustomized: bool - dropGains: dict[str, CampaignDataDropGainInfo] + dropGains: Dict[str, CampaignDataDropGainInfo] -class CampaignGroupData(BaseModel): +class CampaignGroupData(BaseStruct): groupId: str - activeCamps: list[str] + activeCamps: List[str] startTs: int endTs: int -class CampaignRegionData(BaseModel): - id_: str = Field(alias='id') +class CampaignRegionData(BaseStruct): + id_: str = field(name='id') isUnknwon: int -class CampaignZoneData(BaseModel): - id_: str = Field(alias='id') +class CampaignZoneData(BaseStruct): + id_: str = field(name='id') name: str regionId: str templateId: str -class CampaignMissionData(BaseModel): - id_: str = Field(alias='id') +class CampaignMissionData(BaseStruct): + id_: str = field(name='id') sortId: int - param: list[str] + param: List[str] description: str breakFeeAdd: int -class CampaignConstTable(BaseModel): +class CampaignConstTable(BaseStruct): systemPreposedStage: str rotateStartTime: int rotatePreposedStage: str @@ -117,42 +119,39 @@ class CampaignConstTable(BaseModel): sweepStartTime: int -class CampaignRotateOpenTimeData(BaseModel): +class CampaignRotateOpenTimeData(BaseStruct): groupId: str stageId: str mapId: str - unknownRegions: list[str] + unknownRegions: List[str] duration: int startTs: int endTs: int -class CampaignTrainingOpenTimeData(BaseModel): +class CampaignTrainingOpenTimeData(BaseStruct): groupId: str - stages: list[str] + stages: List[str] startTs: int endTs: int -class CampaignTrainingAllOpenTimeData(BaseModel): +class CampaignTrainingAllOpenTimeData(BaseStruct): groupId: str startTs: int endTs: int -class CampaignTable(BaseModel): +class CampaignTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - campaigns: dict[str, CampaignData] - campaignGroups: dict[str, CampaignGroupData] - campaignRegions: dict[str, CampaignRegionData] - campaignZones: dict[str, CampaignZoneData] - campaignMissions: dict[str, CampaignMissionData] - stageIndexInZoneMap: dict[str, int] + campaigns: Dict[str, CampaignData] + campaignGroups: Dict[str, CampaignGroupData] + campaignRegions: Dict[str, CampaignRegionData] + campaignZones: Dict[str, CampaignZoneData] + campaignMissions: Dict[str, CampaignMissionData] + stageIndexInZoneMap: Dict[str, int] campaignConstTable: CampaignConstTable - campaignRotateStageOpenTimes: list[CampaignRotateOpenTimeData] - campaignTrainingStageOpenTimes: list[CampaignTrainingOpenTimeData] - campaignTrainingAllOpenTimes: list[CampaignTrainingAllOpenTimeData] - - class Config: - extra = 'allow' + campaignRotateStageOpenTimes: List[CampaignRotateOpenTimeData] + campaignTrainingStageOpenTimes: List[CampaignTrainingOpenTimeData] + campaignTrainingAllOpenTimes: List[CampaignTrainingAllOpenTimeData] diff --git a/ArknightsUID/utils/models/gamedata/ChapterTable.py b/ArknightsUID/utils/models/gamedata/ChapterTable.py index 902a600..d58aaad 100644 --- a/ArknightsUID/utils/models/gamedata/ChapterTable.py +++ b/ArknightsUID/utils/models/gamedata/ChapterTable.py @@ -1,24 +1,19 @@ -from pydantic import BaseModel +from typing import Dict, Union +from ..common import BaseStruct -class ChapterData(BaseModel): +class ChapterData(BaseStruct): chapterId: str chapterName: str chapterName2: str chapterIndex: int - preposedChapterId: str | None + preposedChapterId: Union[str, None] startZoneId: str endZoneId: str chapterEndStageId: str -class ChapterTable(BaseModel): +class ChapterTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - chapters: dict[str, ChapterData] - - class Config: - extra = 'allow' - - def __init__(self, data: dict) -> None: - super().__init__(chapters=data) + chapters: Dict[str, ChapterData] diff --git a/ArknightsUID/utils/models/gamedata/CharMetaTable.py b/ArknightsUID/utils/models/gamedata/CharMetaTable.py index 6f9293e..9a6acec 100644 --- a/ArknightsUID/utils/models/gamedata/CharMetaTable.py +++ b/ArknightsUID/utils/models/gamedata/CharMetaTable.py @@ -1,27 +1,26 @@ -from pydantic import BaseModel, Field +from typing import Dict, List +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class SpCharMissionData(BaseModel): +class SpCharMissionData(BaseStruct): charId: str missionId: str sortId: int condType: str - param: list[str] - rewards: list[ItemBundle] + param: List[str] + rewards: List[ItemBundle] -class CharMetaTable(BaseModel): +class CharMetaTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - class Config: - extra = 'allow' - - spCharGroups: dict[str, list[str]] - spCharMissions: dict[str, dict[str, SpCharMissionData]] - spCharVoucherSkinTime: dict[str, int] + spCharGroups: Dict[str, List[str]] + spCharMissions: Dict[str, Dict[str, SpCharMissionData]] + spCharVoucherSkinTime: Dict[str, int] diff --git a/ArknightsUID/utils/models/gamedata/CharPatchTable.py b/ArknightsUID/utils/models/gamedata/CharPatchTable.py index 2171f9e..1ceaef4 100644 --- a/ArknightsUID/utils/models/gamedata/CharPatchTable.py +++ b/ArknightsUID/utils/models/gamedata/CharPatchTable.py @@ -1,39 +1,41 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class CharPatchDataPatchInfo(BaseModel): - tmplIds: list[str] +class CharPatchDataPatchInfo(BaseStruct): + tmplIds: List[str] default: str -class CharacterDataUnlockCondition(BaseModel): +class CharacterDataUnlockCondition(BaseStruct): phase: int level: int -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class CharacterDataTraitData(BaseModel): +class CharacterDataTraitData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int - blackboard: list[Blackboard] - overrideDescripton: str | None - prefabKey: str | None - rangeId: str | None + blackboard: List[Blackboard] + overrideDescripton: Union[str, None] + prefabKey: Union[str, None] + rangeId: Union[str, None] -class CharacterDataTraitDataBundle(BaseModel): - candidates: list[CharacterDataTraitData] +class CharacterDataTraitDataBundle(BaseStruct): + candidates: List[CharacterDataTraitData] -class AttributesData(BaseModel): +class AttributesData(BaseStruct): maxHp: int atk: int - def_: int = Field(alias='def') + def_: int = field(name='def') magicResistance: float cost: int blockCnt: int @@ -55,54 +57,55 @@ class AttributesData(BaseModel): levitateImmune: bool -class CharacterDataAttributesKeyFrame(BaseModel): +class CharacterDataAttributesKeyFrame(BaseStruct): level: int data: AttributesData -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class CharacterDataPhaseData(BaseModel): +class CharacterDataPhaseData(BaseStruct): characterPrefabKey: str - rangeId: str | None + rangeId: Union[str, None] maxLevel: int - attributesKeyFrames: list[CharacterDataAttributesKeyFrame] - evolveCost: list[ItemBundle] | None + attributesKeyFrames: List[CharacterDataAttributesKeyFrame] + evolveCost: Union[List[ItemBundle], None] -class CharacterDataMainSkillSpecializeLevelData(BaseModel): +class CharacterDataMainSkillSpecializeLevelData(BaseStruct): unlockCond: CharacterDataUnlockCondition lvlUpTime: int - levelUpCost: list[ItemBundle] | None + levelUpCost: Union[List[ItemBundle], None] -class CharacterDataMainSkill(BaseModel): - skillId: str | None - overridePrefabKey: str | None - overrideTokenKey: str | None - levelUpCostCond: list[CharacterDataMainSkillSpecializeLevelData] +class CharacterDataMainSkill(BaseStruct): + skillId: Union[str, None] + overridePrefabKey: Union[str, None] + overrideTokenKey: Union[str, None] + levelUpCostCond: List[CharacterDataMainSkillSpecializeLevelData] unlockCond: CharacterDataUnlockCondition -class TalentData(BaseModel): +class TalentData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int prefabKey: str - name: str | None - description: str | None - rangeId: str | None - blackboard: list[Blackboard] + name: Union[str, None] + description: Union[str, None] + rangeId: Union[str, None] + blackboard: List[Blackboard] + displayRange: bool -class CharacterDataTalentDataBundle(BaseModel): - candidates: list[TalentData] | None +class CharacterDataTalentDataBundle(BaseStruct): + candidates: Union[List[TalentData], None] -class AttributeModifierDataAttributeModifier(BaseModel): +class AttributeModifierDataAttributeModifier(BaseStruct): attributeType: int formulaItem: int value: float @@ -110,86 +113,85 @@ class AttributeModifierDataAttributeModifier(BaseModel): fetchBaseValueFromSourceEntity: bool -class AttributeModifierData(BaseModel): - abnormalFlags: list[str] | None - abnormalImmunes: list[str] | None - abnormalAntis: list[str] | None - abnormalCombos: list[str] | None - abnormalComboImmunes: list[str] | None - attributeModifiers: list[AttributeModifierDataAttributeModifier] +class AttributeModifierData(BaseStruct): + abnormalFlags: Union[List[str], None] + abnormalImmunes: Union[List[str], None] + abnormalAntis: Union[List[str], None] + abnormalCombos: Union[List[str], None] + abnormalComboImmunes: Union[List[str], None] + attributeModifiers: List[AttributeModifierDataAttributeModifier] -class ExternalBuff(BaseModel): +class ExternalBuff(BaseStruct): attributes: AttributeModifierData -class CharacterDataPotentialRank(BaseModel): - type_: int = Field(alias='type') +class CharacterDataPotentialRank(BaseStruct): + type_: int = field(name='type') description: str - buff: ExternalBuff | None - equivalentCost: ItemBundle | None + buff: Union[ExternalBuff, None] + equivalentCost: Union[ItemBundle, None] -class CharacterDataSkillLevelCost(BaseModel): +class CharacterDataSkillLevelCost(BaseStruct): unlockCond: CharacterDataUnlockCondition - lvlUpCost: list[ItemBundle] | None + lvlUpCost: Union[List[ItemBundle], None] -class CharacterData(BaseModel): +class CharacterData(BaseStruct): name: str - description: str | None + description: Union[str, None] canUseGeneralPotentialItem: bool canUseActivityPotentialItem: bool - potentialItemId: str | None - activityPotentialItemId: str | None - nationId: str | None - groupId: str | None - teamId: str | None - displayNumber: str | None - tokenKey: str | None = None + potentialItemId: Union[str, None] + activityPotentialItemId: Union[str, None] + nationId: Union[str, None] + groupId: Union[str, None] + teamId: Union[str, None] + displayNumber: Union[str, None] appellation: str position: str - tagList: list[str] | None - itemUsage: str | None - itemDesc: str | None - itemObtainApproach: str | None + tagList: Union[List[str], None] + itemUsage: Union[str, None] + itemDesc: Union[str, None] + itemObtainApproach: Union[str, None] isNotObtainable: bool isSpChar: bool maxPotentialLevel: int rarity: int profession: str subProfessionId: str - trait: CharacterDataTraitDataBundle | None - phases: list[CharacterDataPhaseData] - skills: list[CharacterDataMainSkill] - talents: list[CharacterDataTalentDataBundle] | None - potentialRanks: list[CharacterDataPotentialRank] - favorKeyFrames: list[CharacterDataAttributesKeyFrame] | None - allSkillLvlup: list[CharacterDataSkillLevelCost] + trait: Union[CharacterDataTraitDataBundle, None] + phases: List[CharacterDataPhaseData] + skills: List[CharacterDataMainSkill] + talents: Union[List[CharacterDataTalentDataBundle], None] + potentialRanks: List[CharacterDataPotentialRank] + favorKeyFrames: Union[List[CharacterDataAttributesKeyFrame], None] + allSkillLvlup: List[CharacterDataSkillLevelCost] + minPowerId: str + maxPowerId: str + tokenKey: Union[str, None] = None -class CharPatchDataUnlockCondItem(BaseModel): +class CharPatchDataUnlockCondItem(BaseStruct): stageId: str completeState: int -class CharPatchDataUnlockCond(BaseModel): - conds: list[CharPatchDataUnlockCondItem] +class CharPatchDataUnlockCond(BaseStruct): + conds: List[CharPatchDataUnlockCondItem] -class CharPatchDataPatchDetailInfo(BaseModel): +class CharPatchDataPatchDetailInfo(BaseStruct): patchId: str sortId: int infoParam: str -class CharPatchTable(BaseModel): +class CharPatchTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - infos: dict[str, CharPatchDataPatchInfo] - patchChars: dict[str, CharacterData] - unlockConds: dict[str, CharPatchDataUnlockCond] - patchDetailInfoList: dict[str, CharPatchDataPatchDetailInfo] - - class Config: - extra = 'allow' + infos: Dict[str, CharPatchDataPatchInfo] + patchChars: Dict[str, CharacterData] + unlockConds: Dict[str, CharPatchDataUnlockCond] + patchDetailInfoList: Dict[str, CharPatchDataPatchDetailInfo] diff --git a/ArknightsUID/utils/models/gamedata/CharacterTable.py b/ArknightsUID/utils/models/gamedata/CharacterTable.py index 1054a3e..d4e532a 100644 --- a/ArknightsUID/utils/models/gamedata/CharacterTable.py +++ b/ArknightsUID/utils/models/gamedata/CharacterTable.py @@ -1,34 +1,37 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class CharacterDataUnlockCondition(BaseModel): +class CharacterDataUnlockCondition(BaseStruct): phase: int level: int -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class CharacterDataTraitData(BaseModel): +class CharacterDataTraitData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int - blackboard: list[Blackboard] - overrideDescripton: str | None - prefabKey: str | None - rangeId: str | None + blackboard: List[Blackboard] + overrideDescripton: Union[str, None] + prefabKey: Union[str, None] + rangeId: Union[str, None] + additionalDesc: str -class CharacterDataTraitDataBundle(BaseModel): - candidates: list[CharacterDataTraitData] +class CharacterDataTraitDataBundle(BaseStruct): + candidates: List[CharacterDataTraitData] -class AttributesData(BaseModel): +class AttributesData(BaseStruct): maxHp: int atk: int - def_: int = Field(alias='def') + def_: int = field(name='def') magicResistance: float cost: int blockCnt: int @@ -50,54 +53,56 @@ class AttributesData(BaseModel): levitateImmune: bool -class CharacterDataAttributesKeyFrame(BaseModel): +class CharacterDataAttributesKeyFrame(BaseStruct): level: int data: AttributesData -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class CharacterDataPhaseData(BaseModel): +class CharacterDataPhaseData(BaseStruct): characterPrefabKey: str - rangeId: str | None + rangeId: Union[str, None] maxLevel: int - attributesKeyFrames: list[CharacterDataAttributesKeyFrame] - evolveCost: list[ItemBundle] | None + attributesKeyFrames: List[CharacterDataAttributesKeyFrame] + evolveCost: Union[List[ItemBundle], None] -class CharacterDataMainSkillSpecializeLevelData(BaseModel): +class CharacterDataMainSkillSpecializeLevelData(BaseStruct): unlockCond: CharacterDataUnlockCondition lvlUpTime: int - levelUpCost: list[ItemBundle] | None + levelUpCost: Union[List[ItemBundle], None] -class CharacterDataMainSkill(BaseModel): - skillId: str | None - overridePrefabKey: str | None - overrideTokenKey: str | None - levelUpCostCond: list[CharacterDataMainSkillSpecializeLevelData] +class CharacterDataMainSkill(BaseStruct): + skillId: Union[str, None] + overridePrefabKey: Union[str, None] + overrideTokenKey: Union[str, None] + levelUpCostCond: List[CharacterDataMainSkillSpecializeLevelData] unlockCond: CharacterDataUnlockCondition -class TalentData(BaseModel): +class TalentData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int prefabKey: str - name: str | None - description: str | None - rangeId: str | None - blackboard: list[Blackboard] + name: Union[str, None] + description: Union[str, None] + rangeId: Union[str, None] + blackboard: List[Blackboard] + displayRange: bool + tokenKey: Union[str, None] = None -class CharacterDataTalentDataBundle(BaseModel): - candidates: list[TalentData] | None +class CharacterDataTalentDataBundle(BaseStruct): + candidates: Union[List[TalentData], None] -class AttributeModifierDataAttributeModifier(BaseModel): +class AttributeModifierDataAttributeModifier(BaseStruct): attributeType: int formulaItem: int value: float @@ -105,74 +110,72 @@ class AttributeModifierDataAttributeModifier(BaseModel): fetchBaseValueFromSourceEntity: bool -class AttributeModifierData(BaseModel): - abnormalFlags: list[str] | None - abnormalImmunes: list[str] | None - abnormalAntis: list[str] | None - abnormalCombos: list[str] | None - abnormalComboImmunes: list[str] | None - attributeModifiers: list[AttributeModifierDataAttributeModifier] +class AttributeModifierData(BaseStruct): + abnormalFlags: Union[List[str], None] + abnormalImmunes: Union[List[str], None] + abnormalAntis: Union[List[str], None] + abnormalCombos: Union[List[str], None] + abnormalComboImmunes: Union[List[str], None] + attributeModifiers: List[AttributeModifierDataAttributeModifier] -class ExternalBuff(BaseModel): +class ExternalBuff(BaseStruct): attributes: AttributeModifierData -class CharacterDataPotentialRank(BaseModel): - type_: int = Field(alias='type') +class CharacterDataPotentialRank(BaseStruct): + type_: int = field(name='type') description: str - buff: ExternalBuff | None - equivalentCost: ItemBundle | None + buff: Union[ExternalBuff, None] + equivalentCost: Union[ItemBundle, None] -class CharacterDataSkillLevelCost(BaseModel): +class CharacterDataSkillLevelCost(BaseStruct): unlockCond: CharacterDataUnlockCondition - lvlUpCost: list[ItemBundle] | None + lvlUpCost: Union[List[ItemBundle], None] -class CharacterData(BaseModel): +class CharacterData(BaseStruct): name: str - description: str | None + description: Union[str, None] canUseGeneralPotentialItem: bool canUseActivityPotentialItem: bool - potentialItemId: str | None - activityPotentialItemId: str | None - nationId: str | None - groupId: str | None - teamId: str | None - displayNumber: str | None - tokenKey: str | None = None + potentialItemId: Union[str, None] + activityPotentialItemId: Union[str, None] + nationId: Union[str, None] + groupId: Union[str, None] + teamId: Union[str, None] + displayNumber: Union[str, None] appellation: str position: str - tagList: list[str] | None - itemUsage: str | None - itemDesc: str | None - itemObtainApproach: str | None + tagList: Union[List[str], None] + itemUsage: Union[str, None] + itemDesc: Union[str, None] + itemObtainApproach: Union[str, None] isNotObtainable: bool isSpChar: bool maxPotentialLevel: int rarity: int profession: str subProfessionId: str - trait: CharacterDataTraitDataBundle | None - phases: list[CharacterDataPhaseData] - skills: list[CharacterDataMainSkill] - talents: list[CharacterDataTalentDataBundle] | None - potentialRanks: list[CharacterDataPotentialRank] - favorKeyFrames: list[CharacterDataAttributesKeyFrame] | None - allSkillLvlup: list[CharacterDataSkillLevelCost] + trait: Union[CharacterDataTraitDataBundle, None] + phases: List[CharacterDataPhaseData] + skills: List[CharacterDataMainSkill] + talents: Union[List[CharacterDataTalentDataBundle], None] + potentialRanks: List[CharacterDataPotentialRank] + favorKeyFrames: Union[List[CharacterDataAttributesKeyFrame], None] + allSkillLvlup: List[CharacterDataSkillLevelCost] + minPowerId: str + maxPowerId: str + displayTokenDict: Union[Dict[str, bool], None] = None + classicPotentialItemId: Union[str, None] = None + tokenKey: Union[str, None] = None -class CharacterTable(BaseModel): +class CharacterTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - chars: dict[str, CharacterData] - - class Config: - extra = 'allow' - - def __init__(self, data: dict) -> None: - super().__init__(chars=data) + chars: Dict[str, CharacterData] def __getitem__(self, key: str) -> CharacterData: return self.chars[key] diff --git a/ArknightsUID/utils/models/gamedata/CharmTable.py b/ArknightsUID/utils/models/gamedata/CharmTable.py index 90d4b83..2840435 100644 --- a/ArknightsUID/utils/models/gamedata/CharmTable.py +++ b/ArknightsUID/utils/models/gamedata/CharmTable.py @@ -1,40 +1,43 @@ -from pydantic import BaseModel, Field +from typing import List, Union +from ..common import BaseStruct +from msgspec import field -class RuneDataSelector(BaseModel): - professionMask: int | str +class RuneDataSelector(BaseStruct): + professionMask: Union[int, str] buildableMask: int - charIdFilter: list[str] | None - enemyIdFilter: list[str] | None - enemyIdExcludeFilter: list[str] | None - skillIdFilter: list[str] | None - tileKeyFilter: list[str] | None - groupTagFilter: list[str] | None - filterTagFilter: list[str] | None + charIdFilter: Union[List[str], None] + enemyIdFilter: Union[List[str], None] + enemyIdExcludeFilter: Union[List[str], None] + skillIdFilter: Union[List[str], None] + tileKeyFilter: Union[List[str], None] + groupTagFilter: Union[List[str], None] + filterTagFilter: Union[List[str], None] + subProfessionExcludeFilter: Union[List[str], None] -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class RuneData(BaseModel): +class RuneData(BaseStruct): key: str selector: RuneDataSelector - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class RuneTablePackedRuneData(BaseModel): - id_: str = Field(alias='id') +class RuneTablePackedRuneData(BaseStruct): + id_: str = field(name='id') points: float - mutexGroupKey: str | None + mutexGroupKey: Union[str, None] description: str - runes: list[RuneData] + runes: List[RuneData] -class CharmItemData(BaseModel): - id_: str = Field(alias='id') +class CharmItemData(BaseStruct): + id_: str = field(name='id') sort: int name: str icon: str @@ -44,18 +47,15 @@ class CharmItemData(BaseModel): rarity: int desc: str price: int - specialObtainApproach: str | None + specialObtainApproach: Union[str, None] charmType: str obtainInRandom: bool - dropStages: list[str] + dropStages: List[str] runeData: RuneTablePackedRuneData charmEffect: str -class CharmTable(BaseModel): +class CharmTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - class Config: - extra = 'allow' - - charmList: list[CharmItemData] + charmList: List[CharmItemData] diff --git a/ArknightsUID/utils/models/gamedata/CharwordTable.py b/ArknightsUID/utils/models/gamedata/CharwordTable.py index 938a197..4b8a1f5 100644 --- a/ArknightsUID/utils/models/gamedata/CharwordTable.py +++ b/ArknightsUID/utils/models/gamedata/CharwordTable.py @@ -1,12 +1,14 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class CharWordUnlockParam(BaseModel): - valueStr: str | None +class CharWordUnlockParam(BaseStruct): + valueStr: Union[str, None] valueInt: int -class CharWordData(BaseModel): +class CharWordData(BaseStruct): charWordId: str wordKey: str charId: str @@ -16,53 +18,51 @@ class CharWordData(BaseModel): voiceIndex: int voiceType: str unlockType: str - unlockParam: list[CharWordUnlockParam] - lockDescription: str | None + unlockParam: List[CharWordUnlockParam] + lockDescription: Union[str, None] placeType: str voiceAsset: str -class VoiceLangInfoData(BaseModel): +class VoiceLangInfoData(BaseStruct): wordkey: str voiceLangType: str - cvName: list[str] + cvName: List[str] + voicePath: Union[str, None] = None -class VoiceLangData(BaseModel): - wordkeys: list[str] +class VoiceLangData(BaseStruct): + wordkeys: List[str] charId: str - dict_: dict[str, VoiceLangInfoData] = Field(alias='dict') + dict_: Dict[str, VoiceLangInfoData] = field(name='dict') -class VoiceLangTypeData(BaseModel): +class VoiceLangTypeData(BaseStruct): name: str groupType: str -class VoiceLangGroupData(BaseModel): +class VoiceLangGroupData(BaseStruct): name: str - members: list[str] + members: List[str] -class NewVoiceTimeData(BaseModel): +class NewVoiceTimeData(BaseStruct): timestamp: int - charSet: list[str] + charSet: List[str] -class CharwordTable(BaseModel): +class CharwordTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - charWords: dict[str, CharWordData] - voiceLangDict: dict[str, VoiceLangData] + charWords: Dict[str, CharWordData] + voiceLangDict: Dict[str, VoiceLangData] defaultLangType: str - newTagList: list[str] - voiceLangTypeDict: dict[str, VoiceLangTypeData] - voiceLangGroupTypeDict: dict[str, VoiceLangGroupData] - charDefaultTypeDict: dict[str, str] - startTimeWithTypeDict: dict[str, list[NewVoiceTimeData]] - displayGroupTypeList: list[str] - displayTypeList: list[str] + newTagList: List[str] + voiceLangTypeDict: Dict[str, VoiceLangTypeData] + voiceLangGroupTypeDict: Dict[str, VoiceLangGroupData] + charDefaultTypeDict: Dict[str, str] + startTimeWithTypeDict: Dict[str, List[NewVoiceTimeData]] + displayGroupTypeList: List[str] + displayTypeList: List[str] playVoiceRange: str - - class Config: - extra = 'allow' diff --git a/ArknightsUID/utils/models/gamedata/CheckinTable.py b/ArknightsUID/utils/models/gamedata/CheckinTable.py index 0408e5d..a2a1136 100644 --- a/ArknightsUID/utils/models/gamedata/CheckinTable.py +++ b/ArknightsUID/utils/models/gamedata/CheckinTable.py @@ -1,42 +1,41 @@ -from pydantic import BaseModel, Field +from typing import Dict, List +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class MonthlySignInData(BaseModel): +class MonthlySignInData(BaseStruct): itemId: str itemType: str count: int -class MonthlySignInGroupData(BaseModel): +class MonthlySignInGroupData(BaseStruct): groupId: str title: str description: str signStartTime: int signEndTime: int - items: list[MonthlySignInData] + items: List[MonthlySignInData] -class MonthlyDailyBonusGroup(BaseModel): +class MonthlyDailyBonusGroup(BaseStruct): groupId: str startTime: int endTime: int - items: list[ItemBundle] + items: List[ItemBundle] imgId: str backId: str -class CheckinTable(BaseModel): +class CheckinTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - groups: dict[str, MonthlySignInGroupData] - monthlySubItem: dict[str, list[MonthlyDailyBonusGroup]] + groups: Dict[str, MonthlySignInGroupData] + monthlySubItem: Dict[str, List[MonthlyDailyBonusGroup]] currentMonthlySubId: str - - class Config: - extra = 'allow' diff --git a/ArknightsUID/utils/models/gamedata/ClimbTowerTable.py b/ArknightsUID/utils/models/gamedata/ClimbTowerTable.py index 3cce53d..3c3998d 100644 --- a/ArknightsUID/utils/models/gamedata/ClimbTowerTable.py +++ b/ArknightsUID/utils/models/gamedata/ClimbTowerTable.py @@ -1,76 +1,78 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class ClimbTowerSingleTowerDataClimbTowerTaskRewardData(BaseModel): +class ClimbTowerSingleTowerDataClimbTowerTaskRewardData(BaseStruct): levelNum: int - rewards: list[ItemBundle] + rewards: List[ItemBundle] -class ClimbTowerSingleTowerData(BaseModel): - id_: str = Field(alias='id') +class ClimbTowerSingleTowerData(BaseStruct): + id_: str = field(name='id') sortId: int stageNum: int name: str subName: str desc: str towerType: str - levels: list[str] - hardLevels: list[str] | None - taskInfo: list[ClimbTowerSingleTowerDataClimbTowerTaskRewardData] | None - preTowerId: str | None - medalId: str | None - hiddenMedalId: str | None - hardModeMedalId: str | None - bossId: str | None - cardId: str | None - curseCardIds: list[str] + levels: List[str] + hardLevels: Union[List[str], None] + taskInfo: Union[List[ClimbTowerSingleTowerDataClimbTowerTaskRewardData], None] + preTowerId: Union[str, None] + medalId: Union[str, None] + hiddenMedalId: Union[str, None] + hardModeMedalId: Union[str, None] + bossId: Union[str, None] + cardId: Union[str, None] + curseCardIds: List[str] dangerDesc: str - hardModeDesc: str | None + hardModeDesc: Union[str, None] -class WeightItemBundle(BaseModel): - id_: str = Field(alias='id') - type_: str = Field(alias='type') +class WeightItemBundle(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') dropType: str count: int weight: int -class StageDataDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class StageDataDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class StageDataDisplayDetailRewards(BaseModel): +class StageDataDisplayDetailRewards(BaseStruct): occPercent: int - type_: str = Field(alias='type') - id_: str = Field(alias='id') + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class ClimbTowerDropDisplayInfo(BaseModel): +class ClimbTowerDropDisplayInfo(BaseStruct): itemId: str - type_: int = Field(alias='type') + type_: int = field(name='type') maxCount: int minCount: int -class ClimbTowerLevelDropInfo(BaseModel): - passRewards: list[list[WeightItemBundle]] | None = None - displayRewards: list[StageDataDisplayRewards] | None - displayDetailRewards: list[StageDataDisplayDetailRewards] | None - displayDropInfo: dict[str, ClimbTowerDropDisplayInfo] | None = None +class ClimbTowerLevelDropInfo(BaseStruct): + displayRewards: Union[List[StageDataDisplayRewards], None] + displayDetailRewards: Union[List[StageDataDisplayDetailRewards], None] + passRewards: Union[List[List[WeightItemBundle]], None] = None + displayDropInfo: Union[Dict[str, ClimbTowerDropDisplayInfo], None] = None -class ClimbTowerSingleLevelData(BaseModel): - id_: str = Field(alias='id') +class ClimbTowerSingleLevelData(BaseStruct): + id_: str = field(name='id') levelId: str towerId: str layerNum: int @@ -82,8 +84,8 @@ class ClimbTowerSingleLevelData(BaseModel): dropInfo: ClimbTowerLevelDropInfo -class ClimbTowerTacticalBuffData(BaseModel): - id_: str = Field(alias='id') +class ClimbTowerTacticalBuffData(BaseStruct): + id_: str = field(name='id') desc: str profession: str isDefaultActive: bool @@ -91,79 +93,80 @@ class ClimbTowerTacticalBuffData(BaseModel): buffType: str -class RuneDataSelector(BaseModel): - professionMask: int | str +class RuneDataSelector(BaseStruct): + professionMask: Union[int, str] buildableMask: int - charIdFilter: list[str] | None - enemyIdFilter: list[str] | None - enemyIdExcludeFilter: list[str] | None - skillIdFilter: list[str] | None - tileKeyFilter: list[str] | None - groupTagFilter: list[str] | None - filterTagFilter: list[str] | None + charIdFilter: Union[List[str], None] + enemyIdFilter: Union[List[str], None] + enemyIdExcludeFilter: Union[List[str], None] + skillIdFilter: Union[List[str], None] + tileKeyFilter: Union[List[str], None] + groupTagFilter: Union[List[str], None] + filterTagFilter: Union[List[str], None] + subProfessionExcludeFilter: Union[List[str], None] -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class RuneData(BaseModel): +class RuneData(BaseStruct): key: str selector: RuneDataSelector - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class RuneTablePackedRuneData(BaseModel): - id_: str = Field(alias='id') +class RuneTablePackedRuneData(BaseStruct): + id_: str = field(name='id') points: float - mutexGroupKey: str | None + mutexGroupKey: Union[str, None] description: str - runes: list[RuneData] + runes: List[RuneData] -class ClimbTowerMainCardData(BaseModel): - id_: str = Field(alias='id') - type_: str = Field(alias='type') - linkedTowerId: str | None +class ClimbTowerMainCardData(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') + linkedTowerId: Union[str, None] sortId: int name: str desc: str - subCardIds: list[str] + subCardIds: List[str] runeData: RuneTablePackedRuneData - trapIds: list[str] + trapIds: List[str] -class ClimbTowerSubCardData(BaseModel): - id_: str = Field(alias='id') +class ClimbTowerSubCardData(BaseStruct): + id_: str = field(name='id') mainCardId: str sortId: int name: str desc: str runeData: RuneTablePackedRuneData - trapIds: list[str] + trapIds: List[str] -class ClimbTowerCurseCardData(BaseModel): - id_: str = Field(alias='id') - towerIdList: list[str] +class ClimbTowerCurseCardData(BaseStruct): + id_: str = field(name='id') + towerIdList: List[str] name: str desc: str trapId: str -class ClimbTowerSeasonInfoData(BaseModel): - id_: str = Field(alias='id') +class ClimbTowerSeasonInfoData(BaseStruct): + id_: str = field(name='id') name: str startTs: int endTs: int - towers: list[str] - seasonCards: list[str] + towers: List[str] + seasonCards: List[str] seasonColor: str -class ClimbTowerDetailConst(BaseModel): +class ClimbTowerDetailConst(BaseStruct): unlockLevelId: str unlockModuleNumRequirement: int lowerItemId: str @@ -171,7 +174,6 @@ class ClimbTowerDetailConst(BaseModel): higherItemId: str higherItemLimit: int initCharCount: int - recruitStageSort: list[int] | None = None charRecruitTimes: int charRecruitChoiceCount: int subcardStageSort: int @@ -179,72 +181,70 @@ class ClimbTowerDetailConst(BaseModel): firstClearTaskDesc: str subCardObtainDesc: str subGodCardUnlockDesc: str + recruitStageSort: Union[List[int], None] = None -class ClimbTowerRewardInfo(BaseModel): +class ClimbTowerRewardInfo(BaseStruct): stageSort: int lowerItemCount: int higherItemCount: int -class MissionDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class MissionDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') count: int -class MissionData(BaseModel): - id_: str = Field(alias='id') +class MissionData(BaseStruct): + id_: str = field(name='id') sortId: int description: str - type_: str = Field(alias='type') + type_: str = field(name='type') itemBgType: str - preMissionIds: list[str] | None + preMissionIds: Union[List[str], None] template: str templateType: str - param: list[str] - unlockCondition: str | None - unlockParam: list[str] | None + param: List[str] + unlockCondition: Union[str, None] + unlockParam: Union[List[str], None] missionGroup: str - toPage: str | None + toPage: Union[str, None] periodicalPoint: int - rewards: list[MissionDisplayRewards] | None - backImagePath: str | None - foldId: str | None + rewards: Union[List[MissionDisplayRewards], None] + backImagePath: Union[str, None] + foldId: Union[str, None] haveSubMissionToUnlock: bool class ClimbTowerMissionData(MissionData): - bindGodCardId: str | None + bindGodCardId: Union[str, None] missionBkg: str -class MissionGroup(BaseModel): - id_: str = Field(alias='id') - title: str | None - type_: str = Field(alias='type') - preMissionGroup: str | None - period: list[int] | None - rewards: list[MissionDisplayRewards] - missionIds: list[str] +class MissionGroup(BaseStruct): + id_: str = field(name='id') + title: Union[str, None] + type_: str = field(name='type') + preMissionGroup: Union[str, None] + period: Union[List[int], None] + rewards: List[MissionDisplayRewards] + missionIds: List[str] startTs: int endTs: int -class ClimbTowerTable(BaseModel): +class ClimbTowerTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - towers: dict[str, ClimbTowerSingleTowerData] - levels: dict[str, ClimbTowerSingleLevelData] - tacticalBuffs: dict[str, ClimbTowerTacticalBuffData] - mainCards: dict[str, ClimbTowerMainCardData] - subCards: dict[str, ClimbTowerSubCardData] - curseCards: dict[str, ClimbTowerCurseCardData] - seasonInfos: dict[str, ClimbTowerSeasonInfoData] + towers: Dict[str, ClimbTowerSingleTowerData] + levels: Dict[str, ClimbTowerSingleLevelData] + tacticalBuffs: Dict[str, ClimbTowerTacticalBuffData] + mainCards: Dict[str, ClimbTowerMainCardData] + subCards: Dict[str, ClimbTowerSubCardData] + curseCards: Dict[str, ClimbTowerCurseCardData] + seasonInfos: Dict[str, ClimbTowerSeasonInfoData] detailConst: ClimbTowerDetailConst - rewardInfoList: list[ClimbTowerRewardInfo] - missionData: dict[str, ClimbTowerMissionData] - missionGroup: dict[str, MissionGroup] - - class Config: - extra = 'allow' + rewardInfoList: List[ClimbTowerRewardInfo] + missionData: Dict[str, ClimbTowerMissionData] + missionGroup: Dict[str, MissionGroup] diff --git a/ArknightsUID/utils/models/gamedata/ClueData.py b/ArknightsUID/utils/models/gamedata/ClueData.py index 610744f..c44df58 100644 --- a/ArknightsUID/utils/models/gamedata/ClueData.py +++ b/ArknightsUID/utils/models/gamedata/ClueData.py @@ -1,29 +1,30 @@ -from pydantic import BaseModel +from typing import List +from ..common import BaseStruct -class MeetingClueDataClueData(BaseModel): +class MeetingClueDataClueData(BaseStruct): clueId: str clueName: str clueType: str number: int -class MeetingClueDataClueTypeData(BaseModel): +class MeetingClueDataClueTypeData(BaseStruct): clueType: str clueNumber: int -class MeetingClueDataReceiveTimeBonus(BaseModel): +class MeetingClueDataReceiveTimeBonus(BaseStruct): receiveTimes: int receiveBonus: int -class ClueData(BaseModel): +class ClueData(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - clues: list[MeetingClueDataClueData] - clueTypes: list[MeetingClueDataClueTypeData] - receiveTimeBonus: list[MeetingClueDataReceiveTimeBonus] + clues: List[MeetingClueDataClueData] + clueTypes: List[MeetingClueDataClueTypeData] + receiveTimeBonus: List[MeetingClueDataReceiveTimeBonus] inventoryLimit: int outputBasicBonus: int outputOperatorsBonus: int @@ -35,6 +36,3 @@ class ClueData(BaseModel): communicationDuration: int initiatorBonus: int participantsBonus: int - - class Config: - extra = 'allow' diff --git a/ArknightsUID/utils/models/gamedata/CrisisTable.py b/ArknightsUID/utils/models/gamedata/CrisisTable.py index 53f2d41..9eb689d 100644 --- a/ArknightsUID/utils/models/gamedata/CrisisTable.py +++ b/ArknightsUID/utils/models/gamedata/CrisisTable.py @@ -1,41 +1,43 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class StringKeyFrames(BaseModel): +class StringKeyFrames(BaseStruct): level: int data: str -class CrisisClientDataSeasonInfo(BaseModel): +class CrisisClientDataSeasonInfo(BaseStruct): seasonId: str startTs: int endTs: int name: str crisisRuneCoinUnlockItem: ItemBundle permBgm: str - medalGroupId: str | None + medalGroupId: Union[str, None] bgmHardPoint: int - permBgmHard: str | None + permBgmHard: Union[str, None] -class CrisisMapRankInfo(BaseModel): - rewards: list[ItemBundle] +class CrisisMapRankInfo(BaseStruct): + rewards: List[ItemBundle] unlockPoint: int -class CrisisTable(BaseModel): +class CrisisTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - seasonInfo: list[CrisisClientDataSeasonInfo] - tempAppraise: list[StringKeyFrames] - permAppraise: list[StringKeyFrames] - mapRankInfo: dict[str, CrisisMapRankInfo] + seasonInfo: List[CrisisClientDataSeasonInfo] + tempAppraise: List[StringKeyFrames] + permAppraise: List[StringKeyFrames] + mapRankInfo: Dict[str, CrisisMapRankInfo] meta: str unlockCoinLv3: int hardPointPerm: int @@ -43,6 +45,3 @@ class CrisisTable(BaseModel): voiceGrade: int crisisRuneCoinUnlockItemTitle: str crisisRuneCoinUnlockItemDesc: str - - class Config: - extra = 'allow' diff --git a/ArknightsUID/utils/models/gamedata/DisplayMetaTable.py b/ArknightsUID/utils/models/gamedata/DisplayMetaTable.py index 75ff1d6..6b65d91 100644 --- a/ArknightsUID/utils/models/gamedata/DisplayMetaTable.py +++ b/ArknightsUID/utils/models/gamedata/DisplayMetaTable.py @@ -1,7 +1,9 @@ -from pydantic import BaseModel +from typing import Dict, List +from ..common import BaseStruct +from msgspec import field -class PlayerAvatarPerData(BaseModel): +class PlayerAvatarPerData(BaseStruct): avatarId: str avatarType: str avatarIdSort: int @@ -12,19 +14,19 @@ class PlayerAvatarPerData(BaseModel): obtainApproach: str -class PlayerAvatarGroupData(BaseModel): +class PlayerAvatarGroupData(BaseStruct): avatarType: str typeName: str - avatarIdList: list[str] + avatarIdList: List[str] -class PlayerAvatarData(BaseModel): +class PlayerAvatarData(BaseStruct): defaultAvatarId: str - avatarList: list[PlayerAvatarPerData] - avatarTypeData: dict[str, PlayerAvatarGroupData] + avatarList: List[PlayerAvatarPerData] + avatarTypeData: Dict[str, PlayerAvatarGroupData] -class HomeBackgroundSingleData(BaseModel): +class HomeBackgroundSingleData(BaseStruct): bgId: str bgType: str bgSortId: int @@ -34,20 +36,32 @@ class HomeBackgroundSingleData(BaseModel): bgDes: str bgUsage: str obtainApproach: str - unlockDesList: list[str] + unlockDesList: List[str] -class HomeBackgroundData(BaseModel): +class HomeBackgroundThemeData(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') + sortId: int + startTime: int + tmName: str + tmDes: str + tmUsage: str + obtainApproach: str + unlockDesList: List[str] + + +class HomeBackgroundData(BaseStruct): defaultBackgroundId: str - homeBgDataList: list[HomeBackgroundSingleData] + defaultThemeId: str + homeBgDataList: List[HomeBackgroundSingleData] + themeList: List[HomeBackgroundThemeData] defaultBgMusicId: str + themeStartTime: int -class DisplayMetaTable(BaseModel): +class DisplayMetaTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' playerAvatarData: PlayerAvatarData homeBackgroundData: HomeBackgroundData - - class Config: - extra = 'allow' diff --git a/ArknightsUID/utils/models/gamedata/EnemyHandbookTable.py b/ArknightsUID/utils/models/gamedata/EnemyHandbookTable.py index a03c53a..837f8c2 100644 --- a/ArknightsUID/utils/models/gamedata/EnemyHandbookTable.py +++ b/ArknightsUID/utils/models/gamedata/EnemyHandbookTable.py @@ -1,57 +1,59 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class EnemyHandBookDataAbilty(BaseModel): +class EnemyHandBookDataAbilty(BaseStruct): text: str textFormat: str -class EnemyHandBookData(BaseModel): +class EnemyHandBookData(BaseStruct): enemyId: str enemyIndex: str - enemyTags: list[str] | None + enemyTags: Union[List[str], None] sortId: int name: str enemyLevel: str description: str - attackType: str | None - ability: str | None + attackType: Union[str, None] + ability: Union[str, None] isInvalidKilled: bool - overrideKillCntInfos: dict[str, int] + overrideKillCntInfos: Dict[str, int] hideInHandbook: bool - abilityList: list[EnemyHandBookDataAbilty] | None - linkEnemies: list[str] | None - damageType: list[str] | None + abilityList: Union[List[EnemyHandBookDataAbilty], None] + linkEnemies: Union[List[str], None] + damageType: Union[List[str], None] invisibleDetail: bool + hideInStage: Union[bool, None] = None -class EnemyHandbookLevelInfoDataRangePair(BaseModel): - min_: float = Field(alias='min') - max_: float = Field(alias='max') +class EnemyHandbookLevelInfoDataRangePair(BaseStruct): + min_: float = field(name='min') + max_: float = field(name='max') -class EnemyHandbookLevelInfoData(BaseModel): +class EnemyHandbookLevelInfoData(BaseStruct): classLevel: str attack: EnemyHandbookLevelInfoDataRangePair - def_: EnemyHandbookLevelInfoDataRangePair = Field(alias='def') + def_: EnemyHandbookLevelInfoDataRangePair = field(name='def') magicRes: EnemyHandbookLevelInfoDataRangePair maxHP: EnemyHandbookLevelInfoDataRangePair moveSpeed: EnemyHandbookLevelInfoDataRangePair attackSpeed: EnemyHandbookLevelInfoDataRangePair + enemyDamageRes: EnemyHandbookLevelInfoDataRangePair + enemyRes: EnemyHandbookLevelInfoDataRangePair -class EnemyHandbookRaceData(BaseModel): - id_: str = Field(alias='id') +class EnemyHandbookRaceData(BaseStruct): + id_: str = field(name='id') raceName: str sortId: int -class EnemyHandbookTable(BaseModel): +class EnemyHandbookTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - levelInfoList: list[EnemyHandbookLevelInfoData] - enemyData: dict[str, EnemyHandBookData] - raceData: dict[str, EnemyHandbookRaceData] - - class Config: - extra = 'allow' + levelInfoList: List[EnemyHandbookLevelInfoData] + enemyData: Dict[str, EnemyHandBookData] + raceData: Dict[str, EnemyHandbookRaceData] diff --git a/ArknightsUID/utils/models/gamedata/FavorTable.py b/ArknightsUID/utils/models/gamedata/FavorTable.py index 944a139..475364c 100644 --- a/ArknightsUID/utils/models/gamedata/FavorTable.py +++ b/ArknightsUID/utils/models/gamedata/FavorTable.py @@ -1,19 +1,20 @@ -from pydantic import BaseModel +from typing import List +from ..common import BaseStruct -class FavorData(BaseModel): +class FavorData(BaseStruct): favorPoint: int percent: int battlePhase: int -class FavorDataFrames(BaseModel): +class FavorDataFrames(BaseStruct): level: int data: FavorData -class FavorTable(BaseModel): +class FavorTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' maxFavor: int - favorFrames: list[FavorDataFrames] + favorFrames: List[FavorDataFrames] diff --git a/ArknightsUID/utils/models/gamedata/GachaTable.py b/ArknightsUID/utils/models/gamedata/GachaTable.py index d596ff9..194c13f 100644 --- a/ArknightsUID/utils/models/gamedata/GachaTable.py +++ b/ArknightsUID/utils/models/gamedata/GachaTable.py @@ -1,25 +1,27 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class GachaDataLinkageTenGachaTkt(BaseModel): +class GachaDataLinkageTenGachaTkt(BaseStruct): itemId: str endTime: int gachaPoolId: str -class GachaDataLimitTenGachaTkt(BaseModel): +class GachaDataLimitTenGachaTkt(BaseStruct): itemId: str endTime: int -class GachaDataFreeLimitGachaData(BaseModel): +class GachaDataFreeLimitGachaData(BaseStruct): poolId: str openTime: int endTime: int freeCount: int -class GachaDataCarouselData(BaseModel): +class GachaDataCarouselData(BaseStruct): poolId: str index: int startTime: int @@ -27,127 +29,124 @@ class GachaDataCarouselData(BaseModel): spriteId: str -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class GachaDataRecruitRange(BaseModel): +class GachaDataRecruitRange(BaseStruct): rarityStart: int rarityEnd: int -class PotentialMaterialConverterConfig(BaseModel): - items: dict[str, ItemBundle] +class PotentialMaterialConverterConfig(BaseStruct): + items: Dict[str, ItemBundle] -class RecruitPoolRecruitTime(BaseModel): +class RecruitPoolRecruitTime(BaseStruct): timeLength: int recruitPrice: int - accumRate: float | None = None + accumRate: Union[float, None] = None -class RecruitConstantsData(BaseModel): - rarityWeights: None = None - tagPriceList: dict[str, int] - recruitTimeFactorList: None = None +class RecruitConstantsData(BaseStruct): + tagPriceList: Dict[str, int] maxRecruitTime: int + rarityWeights: None = None + recruitTimeFactorList: None = None -class RecruitPool(BaseModel): - recruitTimeTable: list[RecruitPoolRecruitTime] - recruitCharacterList: None = None +class RecruitPool(BaseStruct): + recruitTimeTable: List[RecruitPoolRecruitTime] recruitConstants: RecruitConstantsData + recruitCharacterList: None = None maskTypeWeightTable: None = None -class NewbeeGachaPoolClientData(BaseModel): +class NewbeeGachaPoolClientData(BaseStruct): gachaPoolId: str gachaIndex: int gachaPoolName: str gachaPoolDetail: str gachaPrice: int gachaTimes: int - gachaOffset: str | None = None - firstOpenDay: int | None = None - reOpenDay: int | None = None + gachaOffset: Union[str, None] = None + firstOpenDay: Union[int, None] = None + reOpenDay: Union[int, None] = None gachaPoolItems: None = None - signUpEarliestTime: int | None = None + signUpEarliestTime: Union[int, None] = None -class GachaPoolClientData(BaseModel): - CDPrimColor: str | None - CDSecColor: str | None - dynMeta: dict[str, object] | None = None +class GachaPoolClientData(BaseStruct): + CDPrimColor: Union[str, None] + CDSecColor: Union[str, None] endTime: int gachaIndex: int - gachaPoolDetail: str | None + gachaPoolDetail: Union[str, None] gachaPoolId: str gachaPoolName: str gachaPoolSummary: str gachaRuleType: str guarantee5Avail: int guarantee5Count: int - linkageParam: dict[str, object] | None = None - linkageRuleId: str | None = None - LMTGSID: str | None + LMTGSID: Union[str, None] openTime: int + dynMeta: Union[Dict[str, object], None, None] = None + linkageParam: Union[Dict[str, object], None, None] = None + linkageRuleId: Union[str, None] = None -class GachaTag(BaseModel): +class GachaTag(BaseStruct): tagId: int tagName: str tagGroup: int -class SpecialRecruitPoolSpecialRecruitCostData(BaseModel): +class SpecialRecruitPoolSpecialRecruitCostData(BaseStruct): itemCosts: ItemBundle recruitPrice: int timeLength: int -class SpecialRecruitPool(BaseModel): +class SpecialRecruitPool(BaseStruct): endDateTime: int order: int recruitId: str - recruitTimeTable: list[SpecialRecruitPoolSpecialRecruitCostData] + recruitTimeTable: List[SpecialRecruitPoolSpecialRecruitCostData] startDateTime: int tagId: int tagName: str - CDPrimColor: str | None - CDSecColor: str | None - LMTGSID: str | None + CDPrimColor: Union[str, None] + CDSecColor: Union[str, None] + LMTGSID: Union[str, None] gachaRuleType: str -class GachaDataFesGachaPoolRelateItem(BaseModel): +class GachaDataFesGachaPoolRelateItem(BaseStruct): rarityRank5ItemId: str rarityRank6ItemId: str -class GachaTable(BaseModel): +class GachaTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - gachaTags: list[GachaTag] - carousel: list[GachaDataCarouselData] + gachaTags: List[GachaTag] + carousel: List[GachaDataCarouselData] classicPotentialMaterialConverter: PotentialMaterialConverterConfig - dicRecruit6StarHint: dict[str, str] | None - fesGachaPoolRelateItem: dict[str, GachaDataFesGachaPoolRelateItem] | None - freeGacha: list[GachaDataFreeLimitGachaData] - gachaPoolClient: list[GachaPoolClientData] - gachaTagMaxValid: int | None = None - limitTenGachaItem: list[GachaDataLimitTenGachaTkt] - linkageTenGachaItem: list[GachaDataLinkageTenGachaTkt] - newbeeGachaPoolClient: list[NewbeeGachaPoolClientData] + dicRecruit6StarHint: Union[Dict[str, str], None] + fesGachaPoolRelateItem: Union[Dict[str, GachaDataFesGachaPoolRelateItem], None] + freeGacha: List[GachaDataFreeLimitGachaData] + gachaPoolClient: List[GachaPoolClientData] + limitTenGachaItem: List[GachaDataLimitTenGachaTkt] + linkageTenGachaItem: List[GachaDataLinkageTenGachaTkt] + newbeeGachaPoolClient: List[NewbeeGachaPoolClientData] potentialMaterialConverter: PotentialMaterialConverterConfig recruitDetail: str recruitPool: RecruitPool - recruitRarityTable: dict[str, GachaDataRecruitRange] - specialRecruitPool: list[SpecialRecruitPool] - specialTagRarityTable: dict[str, list[int]] - potentialMats: dict | None = None - classicPotentialMats: dict | None = None - - class Config: - extra = 'allow' + recruitRarityTable: Dict[str, GachaDataRecruitRange] + specialRecruitPool: List[SpecialRecruitPool] + specialTagRarityTable: Dict[str, List[int]] + gachaTagMaxValid: Union[int, None] = None + potentialMats: Union[Dict, None] = None + classicPotentialMats: Union[Dict, None] = None diff --git a/ArknightsUID/utils/models/gamedata/GamedataConst.py b/ArknightsUID/utils/models/gamedata/GamedataConst.py index a37ae8b..9d08c2e 100644 --- a/ArknightsUID/utils/models/gamedata/GamedataConst.py +++ b/ArknightsUID/utils/models/gamedata/GamedataConst.py @@ -1,24 +1,27 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field +from msgspec import json as msgjson -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class GameDataConstsCharAssistRefreshTimeState(BaseModel): +class GameDataConstsCharAssistRefreshTimeState(BaseStruct): Hour: int Minute: int -class TermDescriptionData(BaseModel): +class TermDescriptionData(BaseStruct): termId: str termName: str description: str -class GamedataConst(BaseModel): +class GamedataConst(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' addedRewardDisplayZone: str @@ -26,13 +29,13 @@ class GamedataConst(BaseModel): announceWebBusType: str apBuyCost: int apBuyThreshold: int - assistBeUsedSocialPt: dict[str, int] + assistBeUsedSocialPt: Dict[str, int] attackMax: float baseMaxFriendNum: int buyApTimeNoLimitFlag: bool - characterExpMap: list[list[int]] - characterUpgradeCostMap: list[list[int]] - charAssistRefreshTime: list[GameDataConstsCharAssistRefreshTimeState] + characterExpMap: List[List[int]] + characterUpgradeCostMap: List[List[int]] + charAssistRefreshTime: List[GameDataConstsCharAssistRefreshTimeState] charmEquipCount: int commonPotentialLvlUpCount: int completeCrystalBonus: int @@ -46,15 +49,15 @@ class GamedataConst(BaseModel): diamondMaterialToShardExchangeRatio: int diamondToShdRate: int easyCrystalBonus: int - evolveGoldCost: list[list[int]] - friendAssistRarityLimit: list[int] + evolveGoldCost: List[List[int]] + friendAssistRarityLimit: List[int] hardDiamondDrop: int hpMax: float initCampaignTotalFee: int - initCharIdList: list[str] + initCharIdList: List[str] initPlayerDiamondShard: int initPlayerGold: int - initRecruitTagList: list[int] + initRecruitTagList: List[int] instFinDmdShdCost: int isClassicGachaPoolFuncEnabled: bool isClassicPotentialItemFuncEnabled: bool @@ -64,33 +67,31 @@ class GamedataConst(BaseModel): isLMGTSEnabled: bool isRoguelikeAvgAchieveFuncEnabled: bool isRoguelikeTopicFuncEnabled: bool - isVoucherClassicItemDistinguishable: bool | None = None - legacyItemList: list[ItemBundle] + legacyItemList: List[ItemBundle] legacyTime: int lMTGSDescConstOne: str lMTGSDescConstTwo: str LMTGSToEPGSRatio: int - mailBannerType: list[str] + mailBannerType: List[str] mainlineCompatibleDesc: str mainlineEasyDesc: str mainlineNormalDesc: str mainlineToughDesc: str - maxLevel: list[list[int]] + maxLevel: List[List[int]] maxPlayerLevel: int maxPracticeTicket: int monthlySubRemainTimeLimitDays: int monthlySubWarningTime: int - multiInComeByRank: list[str] + multiInComeByRank: List[str] newBeeGiftEPGS: int - normalGachaUnlockPrice: list[int] - normalRecruitLockedString: list[str] - operatorRecordsStartTime: int | None = None - playerApMap: list[int] + normalGachaUnlockPrice: List[int] + normalRecruitLockedString: List[str] + playerApMap: List[int] playerApRegenSpeed: int - playerExpMap: list[int] - pullForces: list[float] + playerExpMap: List[int] + pullForces: List[float] pullForceZeroIndex: int - pushForces: list[float] + pushForces: List[float] pushForceZeroIndex: int recruitPoolVersion: int rejectSpCharMission: int @@ -98,10 +99,9 @@ class GamedataConst(BaseModel): replicateShopStartTime: int requestSameFriendCD: int resPrefVersion: str - richTextStyles: dict[str, str] + richTextStyles: Dict[str, str] storyReviewUnlockItemLackTip: str - subProfessionDamageTypePairs: dict[str, int] | None = None - termDescriptionDict: dict[str, TermDescriptionData] + termDescriptionDict: Dict[str, TermDescriptionData] UnlimitSkinOutOfTime: int useAssistSocialPt: int useAssistSocialPtMaxCount: int @@ -113,6 +113,6 @@ class GamedataConst(BaseModel): voucherSkinRedeem: int weeklyOverrideDesc: str TSO: int - - class Config: - extra = 'allow' + isVoucherClassicItemDistinguishable: Union[bool, None] = None + operatorRecordsStartTime: Union[int, None] = None + subProfessionDamageTypePairs: Union[Dict[str, int], None] = None diff --git a/ArknightsUID/utils/models/gamedata/HandbookInfoTable.py b/ArknightsUID/utils/models/gamedata/HandbookInfoTable.py index 8a64c8d..1291120 100644 --- a/ArknightsUID/utils/models/gamedata/HandbookInfoTable.py +++ b/ArknightsUID/utils/models/gamedata/HandbookInfoTable.py @@ -1,25 +1,27 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class HandbookUnlockParam(BaseModel): +class HandbookUnlockParam(BaseStruct): unlockType: int unlockParam1: str - unlockParam2: str | None - unlockParam3: str | None + unlockParam2: Union[str, None] + unlockParam3: Union[str, None] -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class HandbookStageTimeData(BaseModel): +class HandbookStageTimeData(BaseStruct): timestamp: int - charSet: list[str] + charSet: List[str] -class HandbookStoryStageData(BaseModel): +class HandbookStoryStageData(BaseStruct): charId: str code: str description: str @@ -27,23 +29,23 @@ class HandbookStoryStageData(BaseModel): loadingPicId: str name: str picId: str - rewardItem: list[ItemBundle] + rewardItem: List[ItemBundle] stageGetTime: int stageId: str stageNameForShow: str - unlockParam: list[HandbookUnlockParam] + unlockParam: List[HandbookUnlockParam] zoneId: str zoneNameForShow: str -class HandbookDisplayCondition(BaseModel): +class HandbookDisplayCondition(BaseStruct): charId: str conditionCharId: str - type_: str = Field(alias='type') + type_: str = field(name='type') -class HandbookTeamMission(BaseModel): - id_: str = Field(alias='id') +class HandbookTeamMission(BaseStruct): + id_: str = field(name='id') sort: int powerId: str powerName: str @@ -51,19 +53,19 @@ class HandbookTeamMission(BaseModel): favorPoint: int -class NPCUnlock(BaseModel): +class NPCUnlock(BaseStruct): unLockType: int unLockParam: str - unLockString: str | None = None + unLockString: Union[str, None] = None -class NPCData(BaseModel): +class NPCData(BaseStruct): appellation: str cv: str - designerList: list[str] | None + designerList: Union[List[str], None] displayNumber: str - groupId: str | None - illustList: list[str] + groupId: Union[str, None] + illustList: List[str] name: str nationId: str npcId: str @@ -71,11 +73,11 @@ class NPCData(BaseModel): profession: str resType: str teamId: None - unlockDict: dict[str, NPCUnlock] + unlockDict: Dict[str, NPCUnlock] minPowerId: str -class HandbookAvgData(BaseModel): +class HandbookAvgData(BaseStruct): storyId: str storySetId: str storySort: int @@ -85,47 +87,44 @@ class HandbookAvgData(BaseModel): storyTxt: str -class HandbookAvgGroupData(BaseModel): +class HandbookAvgGroupData(BaseStruct): storySetId: str storySetName: str sortId: int storyGetTime: int - rewardItem: list[ItemBundle] - unlockParam: list[HandbookUnlockParam] - avgList: list[HandbookAvgData] + rewardItem: List[ItemBundle] + unlockParam: List[HandbookUnlockParam] + avgList: List[HandbookAvgData] charId: str -class HandbookStoryData(BaseModel): +class HandbookStoryData(BaseStruct): storyText: str unLockType: int unLockParam: str unLockString: str -class HandBookStoryViewData(BaseModel): - stories: list[HandbookStoryData] +class HandBookStoryViewData(BaseStruct): + stories: List[HandbookStoryData] storyTitle: str unLockorNot: bool -class HandbookInfoData(BaseModel): +class HandbookInfoData(BaseStruct): charID: str infoName: str - storyTextAudio: list[HandBookStoryViewData] - handbookAvgList: list[HandbookAvgGroupData] - isLimited: bool | None = None + storyTextAudio: List[HandBookStoryViewData] + handbookAvgList: List[HandbookAvgGroupData] + isLimited: Union[bool, None] = None -class HandbookInfoTable(BaseModel): +class HandbookInfoTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - handbookDict: dict[str, HandbookInfoData] - npcDict: dict[str, NPCData] - teamMissionList: dict[str, HandbookTeamMission] - handbookDisplayConditionList: dict[str, HandbookDisplayCondition] - handbookStageData: dict[str, HandbookStoryStageData] - handbookStageTime: list[HandbookStageTimeData] - - class Config: - extra = 'allow' + handbookDict: Dict[str, HandbookInfoData] + npcDict: Dict[str, NPCData] + teamMissionList: Dict[str, HandbookTeamMission] + handbookDisplayConditionList: Dict[str, HandbookDisplayCondition] + handbookStageData: Dict[str, HandbookStoryStageData] + handbookStageTime: List[HandbookStageTimeData] diff --git a/ArknightsUID/utils/models/gamedata/HandbookTable.py b/ArknightsUID/utils/models/gamedata/HandbookTable.py index e87efe3..dd8a3a7 100644 --- a/ArknightsUID/utils/models/gamedata/HandbookTable.py +++ b/ArknightsUID/utils/models/gamedata/HandbookTable.py @@ -1,26 +1,27 @@ -from pydantic import BaseModel +from typing import List, Union +from ..common import BaseStruct -class HandBookInfoTextViewDataInfoTextAudio(BaseModel): +class HandBookInfoTextViewDataInfoTextAudio(BaseStruct): infoText: str audioName: str -class StoryTextAudioInfoListItem(BaseModel): - storyText: str | None - storyTitle: str | None +class StoryTextAudioInfoListItem(BaseStruct): + storyText: Union[str, None] + storyTitle: Union[str, None] -class StoryTextAudioItem(BaseModel): - stories: list[StoryTextAudioInfoListItem] +class StoryTextAudioItem(BaseStruct): + stories: List[StoryTextAudioInfoListItem] unLockorNot: bool unLockType: int unLockParam: str unLockString: str -class HandBookInfoTextViewData(BaseModel): - infoList: list[HandBookInfoTextViewDataInfoTextAudio] +class HandBookInfoTextViewData(BaseStruct): + infoList: List[HandBookInfoTextViewDataInfoTextAudio] unLockorNot: bool unLockType: int unLockParam: str @@ -29,15 +30,15 @@ class HandBookInfoTextViewData(BaseModel): unLockString: str -class CharHandbook(BaseModel): +class CharHandbook(BaseStruct): charID: str drawName: str infoName: str - infoTextAudio: list[HandBookInfoTextViewData] - storyTextAudio: list[StoryTextAudioItem] + infoTextAudio: List[HandBookInfoTextViewData] + storyTextAudio: List[StoryTextAudioItem] -class HandbookTable(BaseModel): +class HandbookTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' char_102_texas: CharHandbook diff --git a/ArknightsUID/utils/models/gamedata/HandbookTeamTable.py b/ArknightsUID/utils/models/gamedata/HandbookTeamTable.py index bff8f5b..4cb957a 100644 --- a/ArknightsUID/utils/models/gamedata/HandbookTeamTable.py +++ b/ArknightsUID/utils/models/gamedata/HandbookTeamTable.py @@ -1,7 +1,9 @@ -from pydantic import BaseModel +from typing import Dict +from ..common import BaseStruct +from msgspec import json as msgjson -class HandbookTeam(BaseModel): +class HandbookTeam(BaseStruct): powerId: str orderNum: int powerLevel: int @@ -12,10 +14,7 @@ class HandbookTeam(BaseModel): isRaw: bool -class HandbookTeamTable(BaseModel): +class HandbookTeamTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - team: dict[str, HandbookTeam] - - def __init__(self, **data): - super().__init__(team=data) + team: Dict[str, HandbookTeam] diff --git a/ArknightsUID/utils/models/gamedata/ItemTable.py b/ArknightsUID/utils/models/gamedata/ItemTable.py index 97460e3..13416b4 100644 --- a/ArknightsUID/utils/models/gamedata/ItemTable.py +++ b/ArknightsUID/utils/models/gamedata/ItemTable.py @@ -1,107 +1,107 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ItemDataStageDropInfo(BaseModel): +class ItemDataStageDropInfo(BaseStruct): stageId: str occPer: str -class ItemDataBuildingProductInfo(BaseModel): +class ItemDataBuildingProductInfo(BaseStruct): roomType: str formulaId: str -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class FavorCharacterInfo(BaseModel): +class FavorCharacterInfo(BaseStruct): itemId: str charId: str favorAddAmt: int -class ActivityPotentialCharacterInfo(BaseModel): +class ActivityPotentialCharacterInfo(BaseStruct): charId: str -class FullPotentialCharacterInfo(BaseModel): +class FullPotentialCharacterInfo(BaseStruct): itemId: str ts: int -class ItemPackInfo(BaseModel): +class ItemPackInfo(BaseStruct): packId: str - content: list[ItemBundle] + content: List[ItemBundle] -class UniCollectionInfo(BaseModel): +class UniCollectionInfo(BaseStruct): uniCollectionItemId: str - uniqueItem: list[ItemBundle] + uniqueItem: List[ItemBundle] -class ApSupplyFeature(BaseModel): - id_: str = Field(alias='id') +class ApSupplyFeature(BaseStruct): + id_: str = field(name='id') ap: int hasTs: bool -class ExpItemFeature(BaseModel): - id_: str = Field(alias='id') +class ExpItemFeature(BaseStruct): + id_: str = field(name='id') gainExp: int -class ItemData(BaseModel): +class ItemData(BaseStruct): itemId: str name: str - description: str | None + description: Union[str, None] rarity: int iconId: str overrideBkg: None - stackIconId: str | None + stackIconId: Union[str, None] sortId: int - usage: str | None - obtainApproach: str | None + usage: Union[str, None] + obtainApproach: Union[str, None] classifyType: str itemType: str - stageDropList: list[ItemDataStageDropInfo] - buildingProductList: list[ItemDataBuildingProductInfo] + stageDropList: List[ItemDataStageDropInfo] + buildingProductList: List[ItemDataBuildingProductInfo] + hideInItemGet: Union[bool, None] = None -class CharVoucherItemFeature(BaseModel): +class CharVoucherItemFeature(BaseStruct): displayType: int - id_: str = Field(alias='id') + id_: str = field(name='id') -class ServerItemReminderMailData(BaseModel): +class ServerItemReminderMailData(BaseStruct): content: str sender: str title: str -class ServerItemReminderInfo(BaseModel): - paidItemIdList: list[str] +class ServerItemReminderInfo(BaseStruct): + paidItemIdList: List[str] paidReminderMail: ServerItemReminderMailData -class ItemTable(BaseModel): +class ItemTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - activityPotentialCharacters: dict[str, ActivityPotentialCharacterInfo] - apSupplies: dict[str, ApSupplyFeature] - charVoucherItems: dict[str, CharVoucherItemFeature] | None = None - expItems: dict[str, ExpItemFeature] - favorCharacters: dict[str, FavorCharacterInfo] - fullPotentialCharacters: dict[str, FullPotentialCharacterInfo] - itemPackInfos: dict[str, ItemPackInfo] - items: dict[str, ItemData] - itemTimeLimit: dict[str, int] - potentialItems: dict[str, dict[str, str]] - reminderInfo: ServerItemReminderInfo | None = None - uniCollectionInfo: dict[str, UniCollectionInfo] - uniqueInfo: dict[str, int] - - class Config: - extra = 'allow' + activityPotentialCharacters: Dict[str, ActivityPotentialCharacterInfo] + apSupplies: Dict[str, ApSupplyFeature] + expItems: Dict[str, ExpItemFeature] + favorCharacters: Dict[str, FavorCharacterInfo] + fullPotentialCharacters: Dict[str, FullPotentialCharacterInfo] + itemPackInfos: Dict[str, ItemPackInfo] + items: Dict[str, ItemData] + itemTimeLimit: Dict[str, int] + potentialItems: Dict[str, Dict[str, str]] + uniCollectionInfo: Dict[str, UniCollectionInfo] + uniqueInfo: Dict[str, int] + reminderInfo: Union[ServerItemReminderInfo, None] = None + charVoucherItems: Union[Dict[str, CharVoucherItemFeature], None] = None diff --git a/ArknightsUID/utils/models/gamedata/MedalTable.py b/ArknightsUID/utils/models/gamedata/MedalTable.py index 0773663..065e613 100644 --- a/ArknightsUID/utils/models/gamedata/MedalTable.py +++ b/ArknightsUID/utils/models/gamedata/MedalTable.py @@ -1,65 +1,65 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class MedalExpireTime(BaseModel): +class MedalExpireTime(BaseStruct): start: int end: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class MedalGroupData(BaseModel): +class MedalGroupData(BaseStruct): groupId: str groupName: str groupDesc: str - medalId: list[str] + medalId: List[str] sortId: int groupBackColor: str groupGetTime: int - sharedExpireTimes: list[MedalExpireTime] | None + sharedExpireTimes: Union[List[MedalExpireTime], None] -class MedalRewardGroupData(BaseModel): +class MedalRewardGroupData(BaseStruct): groupId: str slotId: int - itemList: list[ItemBundle] + itemList: List[ItemBundle] -class MedalTypeData(BaseModel): +class MedalTypeData(BaseStruct): medalGroupId: str sortId: int medalName: str - groupData: list[MedalGroupData] + groupData: List[MedalGroupData] -class MedalPerData(BaseModel): - medalId: str | None - medalName: str | None - medalType: str | None - slotId: int | None - preMedalIdList: list[str] | None +class MedalPerData(BaseStruct): + medalId: Union[str, None] + medalName: Union[str, None] + medalType: Union[str, None] + slotId: Union[int, None] + preMedalIdList: Union[List[str], None] rarity: int - template: str | None - unlockParam: list[str] - getMethod: str | None - description: str | None - advancedMedal: str | None - originMedal: str | None + template: Union[str, None] + unlockParam: List[str] + getMethod: Union[str, None] + description: Union[str, None] + advancedMedal: Union[str, None] + originMedal: Union[str, None] displayTime: int - expireTimes: list[MedalExpireTime] - medalRewardGroup: list[MedalRewardGroupData] + expireTimes: List[MedalExpireTime] + medalRewardGroup: List[MedalRewardGroupData] + isHidden: Union[bool, None] = None -class MedalTable(BaseModel): +class MedalTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - medalList: list[MedalPerData] - medalTypeData: dict[str, MedalTypeData] - - class Config: - extra = 'allow' + medalList: List[MedalPerData] + medalTypeData: Dict[str, MedalTypeData] diff --git a/ArknightsUID/utils/models/gamedata/MissionTable.py b/ArknightsUID/utils/models/gamedata/MissionTable.py index e54c048..29f02f5 100644 --- a/ArknightsUID/utils/models/gamedata/MissionTable.py +++ b/ArknightsUID/utils/models/gamedata/MissionTable.py @@ -1,87 +1,86 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class MissionDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class MissionDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') count: int -class DailyMissionGroupInfoperiodInfo(BaseModel): +class DailyMissionGroupInfoperiodInfo(BaseStruct): missionGroupId: str - period: list[int] + period: List[int] rewardGroupId: str -class DailyMissionGroupInfo(BaseModel): +class DailyMissionGroupInfo(BaseStruct): endTime: int - periodList: list[DailyMissionGroupInfoperiodInfo] + periodList: List[DailyMissionGroupInfoperiodInfo] startTime: int - tagState: str | None + tagState: Union[str, None] -class MissionWeeklyRewardConf(BaseModel): +class MissionWeeklyRewardConf(BaseStruct): beginTime: int endTime: int groupId: str - id_: str = Field(alias='id') + id_: str = field(name='id') periodicalPointCost: int - type_: str = Field(alias='type') + type_: str = field(name='type') sortIndex: int - rewards: list[MissionDisplayRewards] + rewards: List[MissionDisplayRewards] -class MissionDailyRewardConf(BaseModel): +class MissionDailyRewardConf(BaseStruct): groupId: str - id_: str = Field(alias='id') + id_: str = field(name='id') periodicalPointCost: int - type_: str = Field(alias='type') + type_: str = field(name='type') sortIndex: int - rewards: list[MissionDisplayRewards] + rewards: List[MissionDisplayRewards] -class MissionGroup(BaseModel): - id_: str = Field(alias='id') - title: str | None - type_: str = Field(alias='type') - preMissionGroup: str | None - period: list[int] | None - rewards: list[MissionDisplayRewards] | None - missionIds: list[str] +class MissionGroup(BaseStruct): + id_: str = field(name='id') + title: Union[str, None] + type_: str = field(name='type') + preMissionGroup: Union[str, None] + period: Union[List[int], None] + rewards: Union[List[MissionDisplayRewards], None] + missionIds: List[str] startTs: int endTs: int -class MissionData(BaseModel): - id_: str = Field(alias='id') +class MissionData(BaseStruct): + id_: str = field(name='id') sortId: int description: str - type_: str = Field(alias='type') + type_: str = field(name='type') itemBgType: str - preMissionIds: list[str] | None + preMissionIds: Union[List[str], None] template: str templateType: str - param: list[str] - unlockCondition: str | None - unlockParam: list[str] | None + param: List[str] + unlockCondition: Union[str, None] + unlockParam: Union[List[str], None] missionGroup: str toPage: None periodicalPoint: int - rewards: list[MissionDisplayRewards] | None - backImagePath: str | None - foldId: str | None + rewards: Union[List[MissionDisplayRewards], None] + backImagePath: Union[str, None] + foldId: Union[str, None] haveSubMissionToUnlock: bool -class MissionTable(BaseModel): +class MissionTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - missions: dict[str, MissionData] - missionGroups: dict[str, MissionGroup] - periodicalRewards: dict[str, MissionDailyRewardConf] - weeklyRewards: dict[str, MissionWeeklyRewardConf] - dailyMissionGroupInfo: dict[str, DailyMissionGroupInfo] - dailyMissionPeriodInfo: list[DailyMissionGroupInfo] - - class Config: - extra = 'allow' + missions: Dict[str, MissionData] + missionGroups: Dict[str, MissionGroup] + periodicalRewards: Dict[str, MissionDailyRewardConf] + weeklyRewards: Dict[str, MissionWeeklyRewardConf] + dailyMissionGroupInfo: Dict[str, DailyMissionGroupInfo] + dailyMissionPeriodInfo: List[DailyMissionGroupInfo] diff --git a/ArknightsUID/utils/models/gamedata/OpenServerTable.py b/ArknightsUID/utils/models/gamedata/OpenServerTable.py index 053e4a2..8a8eaf7 100644 --- a/ArknightsUID/utils/models/gamedata/OpenServerTable.py +++ b/ArknightsUID/utils/models/gamedata/OpenServerTable.py @@ -1,58 +1,67 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class RewardItem(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') + count: int + sortId: int + + +class ItemBundle(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') count: int -class MissionDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class MissionDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') count: int -class OpenServerItemData(BaseModel): +class OpenServerItemData(BaseStruct): itemId: str itemType: str count: int -class ReturnIntroData(BaseModel): +class ReturnIntroData(BaseStruct): sort: int pubTime: int image: str -class ReturnCheckinData(BaseModel): +class ReturnCheckinData(BaseStruct): isImportant: bool - checkinRewardItems: list[ItemBundle] + checkinRewardItems: List[ItemBundle] -class ReturnLongTermTaskData(BaseModel): - id_: str = Field(alias='id') +class ReturnLongTermTaskData(BaseStruct): + id_: str = field(name='id') sortId: int template: str - param: list[str] + param: List[str] desc: str - rewards: list[MissionDisplayRewards] + rewards: List[MissionDisplayRewards] playPoint: int -class ReturnDailyTaskData(BaseModel): +class ReturnDailyTaskData(BaseStruct): groupId: str - id_: str = Field(alias='id') + id_: str = field(name='id') groupSortId: int taskSortId: int template: str - param: list[str] + param: List[str] desc: str - rewards: list[MissionDisplayRewards] + rewards: List[MissionDisplayRewards] playPoint: int -class ReturnConst(BaseModel): +class ReturnConst(BaseStruct): startTime: int systemTab_time: int afkDays: int @@ -66,75 +75,75 @@ class ReturnConst(BaseModel): pointId: str -class ReturnData(BaseModel): +class ReturnData(BaseStruct): constData: ReturnConst - onceRewards: list[ItemBundle] - intro: list[ReturnIntroData] - returnDailyTaskDic: dict[str, list[ReturnDailyTaskData]] - returnLongTermTaskList: list[ReturnLongTermTaskData] - creditsList: list[ItemBundle] - checkinRewardList: list[ReturnCheckinData] + onceRewards: List[ItemBundle] + intro: List[ReturnIntroData] + returnDailyTaskDic: Dict[str, List[ReturnDailyTaskData]] + returnLongTermTaskList: List[ReturnLongTermTaskData] + creditsList: List[ItemBundle] + checkinRewardList: List[ReturnCheckinData] -class OpenServerConst(BaseModel): +class OpenServerConst(BaseStruct): firstDiamondShardMailCount: int initApMailEndTs: int -class TotalCheckinData(BaseModel): +class TotalCheckinData(BaseStruct): order: int item: OpenServerItemData colorId: int -class ChainLoginData(BaseModel): +class ChainLoginData(BaseStruct): order: int item: OpenServerItemData colorId: int -class MissionData(BaseModel): - id_: str = Field(alias='id') +class MissionData(BaseStruct): + id_: str = field(name='id') sortId: int description: str - type_: str = Field(alias='type') + type_: str = field(name='type') itemBgType: str preMissionIds: None template: str templateType: str - param: list[str] + param: List[str] unlockCondition: None unlockParam: None missionGroup: str toPage: None periodicalPoint: int - rewards: list[ItemBundle] + rewards: List[ItemBundle] backImagePath: None foldId: None haveSubMissionToUnlock: bool -class MissionGroup(BaseModel): - id_: str = Field(alias='id') +class MissionGroup(BaseStruct): + id_: str = field(name='id') title: None - type_: str = Field(alias='type') + type_: str = field(name='type') preMissionGroup: None period: None rewards: None - missionIds: list[str] + missionIds: List[str] startTs: int endTs: int -class OpenServerData(BaseModel): +class OpenServerData(BaseStruct): openServerMissionGroup: MissionGroup - openServerMissionData: list[MissionData] - checkInData: list[TotalCheckinData] - chainLoginData: list[ChainLoginData] + openServerMissionData: List[MissionData] + checkInData: List[TotalCheckinData] + chainLoginData: List[ChainLoginData] -class OpenServerScheduleItem(BaseModel): - id_: str = Field(alias='id') +class OpenServerScheduleItem(BaseStruct): + id_: str = field(name='id') startTs: int endTs: int totalCheckinDescption: str @@ -142,13 +151,127 @@ class OpenServerScheduleItem(BaseModel): charImg: str -class OpenServerTable(BaseModel): +class ReturnConstV2(BaseStruct): + startTime: int + unlockLv: int + unlockStage: str + permMissionTime: int + pointId: str + returnPriceDesc: str + dailySupplyDesc: str + + +class onceRewardDataV2(BaseStruct): + groupId: str + startTime: int + endTime: int + rewardList: List[RewardItem] + + +class ReturnCheckinDataV2RewardList(BaseStruct): + sortId: int + isImportant: bool + rewardList: List[ItemBundle] + + +class CheckInRewardData(BaseStruct): + groupId: str + startTime: int + endTime: int + rewardList: List[ReturnCheckinDataV2RewardList] + + +class PriceRewardDataV2Content(BaseStruct): + contentId: str + sortId: int + pointRequire: int + desc: str + iconId: str + topIconId: str + rewardList: List[RewardItem] + + +class PriceRewardDataV2(BaseStruct): + groupId: str + startTime: int + endTime: int + contentList: List[PriceRewardDataV2Content] + + +class MissionGroupDataV2Mission(BaseStruct): + missionId: str + groupId: str + sortId: int + jumpType: str + jumpParam: Union[str, None] + desc: str + rewardList: List[ItemBundle] + + +class MissionGroupDataV2(BaseStruct): + groupId: str + sortId: int + tabTitle: str + title: str + desc: str + diffMissionCount: int + startTime: int + endTime: int + imageId: str + iconId: str + missionList: List[MissionGroupDataV2Mission] + + +class SailySupplyDataV2(BaseStruct): + groupId: str + startTime: int + endTime: int + rewardList: List[ItemBundle] + + +class PackageCheckInRewardDataV2(BaseStruct): + groupId: str + startTime: int + endTime: int + getTime: int + bindGPGoodId: str + totalCheckInDay: int + iconId: str + rewardDict: Dict[str, List[RewardItem]] + + +class ReturnDataV2(BaseStruct): + constData: ReturnConstV2 + onceRewardData: List[onceRewardDataV2] + checkInRewardData: List[CheckInRewardData] + priceRewardData: List[PriceRewardDataV2] + missionGroupData: List[MissionGroupDataV2] + dailySupplyData: List[SailySupplyDataV2] + packageCheckInRewardData: List[PackageCheckInRewardDataV2] + + +class CheckInRewardItem(BaseStruct): + orderNum: int + itemBundle: ItemBundle + + +class OpenServerNewbieCheckInPackage(BaseStruct): + groupId: str + startTime: int + endTime: int + bindGPGoodId: str + checkInDuration: int + totalCheckInDay: int + iconId: str + checkInRewardDict: Dict[str, List[CheckInRewardItem]] + + +class OpenServerTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - schedule: list[OpenServerScheduleItem] - dataMap: dict[str, OpenServerData] + schedule: List[OpenServerScheduleItem] + dataMap: Dict[str, OpenServerData] constant: OpenServerConst playerReturn: ReturnData - - class Config: - extra = 'allow' + playerReturnV2: ReturnDataV2 + newbieCheckInPackageList: List[OpenServerNewbieCheckInPackage] diff --git a/ArknightsUID/utils/models/gamedata/PlayerAvatarTable.py b/ArknightsUID/utils/models/gamedata/PlayerAvatarTable.py index 1c3e173..c789d9d 100644 --- a/ArknightsUID/utils/models/gamedata/PlayerAvatarTable.py +++ b/ArknightsUID/utils/models/gamedata/PlayerAvatarTable.py @@ -1,13 +1,14 @@ -from pydantic import BaseModel +from typing import Dict, List +from ..common import BaseStruct -class PlayerAvatarGroupData(BaseModel): +class PlayerAvatarGroupData(BaseStruct): avatarType: str typeName: str - avatarIdList: list[str] + avatarIdList: List[str] -class PlayerAvatarPerData(BaseModel): +class PlayerAvatarPerData(BaseStruct): avatarId: str avatarType: str avatarIdSort: int @@ -18,9 +19,9 @@ class PlayerAvatarPerData(BaseModel): obtainApproach: str -class PlayerAvatarTable(BaseModel): +class PlayerAvatarTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - avatarList: list[PlayerAvatarPerData] - avatarTypeData: dict[str, PlayerAvatarGroupData] + avatarList: List[PlayerAvatarPerData] + avatarTypeData: Dict[str, PlayerAvatarGroupData] defaultAvatarId: str diff --git a/ArknightsUID/utils/models/gamedata/RangeTable.py b/ArknightsUID/utils/models/gamedata/RangeTable.py index c3c4653..df17543 100644 --- a/ArknightsUID/utils/models/gamedata/RangeTable.py +++ b/ArknightsUID/utils/models/gamedata/RangeTable.py @@ -1,29 +1,29 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field +from msgspec import json as msgjson -class GridPosition(BaseModel): +class GridPosition(BaseStruct): row: int col: int -class ObscuredRect(BaseModel): +class ObscuredRect(BaseStruct): m_xMin: float m_yMin: float m_width: float m_height: float -class Stage(BaseModel): - id_: str = Field(alias='id') +class Stage(BaseStruct): + id_: str = field(name='id') direction: int - grids: list[GridPosition] - boundingBoxes: list[ObscuredRect] | None = None + grids: List[GridPosition] + boundingBoxes: Union[List[ObscuredRect], None] = None -class RangeTable(BaseModel): +class RangeTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - range: dict[str, Stage] - - def __init__(self, **data): - super().__init__(range=data) + range: Dict[str, Stage] diff --git a/ArknightsUID/utils/models/gamedata/ReplicateTable.py b/ArknightsUID/utils/models/gamedata/ReplicateTable.py index 0780cef..c8e6044 100644 --- a/ArknightsUID/utils/models/gamedata/ReplicateTable.py +++ b/ArknightsUID/utils/models/gamedata/ReplicateTable.py @@ -1,28 +1,25 @@ -from pydantic import BaseModel, Field +from typing import Dict, List +from ..common import BaseStruct +from msgspec import field +from msgspec import json as msgjson -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class ReplicateData(BaseModel): +class ReplicateData(BaseStruct): item: ItemBundle replicateTokenItem: ItemBundle -class ReplicateList(BaseModel): - replicateList: list[ReplicateData] +class ReplicateList(BaseStruct): + replicateList: List[ReplicateData] -class ReplicateTable(BaseModel): +class ReplicateTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - replicate: dict[str, ReplicateList] - - class Config: - extra = 'allow' - - def __init__(self, **data): - super().__init__(replicate=data) + replicate: Dict[str, ReplicateList] diff --git a/ArknightsUID/utils/models/gamedata/RetroTable.py b/ArknightsUID/utils/models/gamedata/RetroTable.py index 4c9292e..b1a6458 100644 --- a/ArknightsUID/utils/models/gamedata/RetroTable.py +++ b/ArknightsUID/utils/models/gamedata/RetroTable.py @@ -1,78 +1,77 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field +from msgspec.inspect import NoneType -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class StageDataDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class StageDataDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class BlackboardStr(BaseModel): +class Blackboard(BaseStruct): key: str - valueStr: str + value: Union[float, None] = None + valueStr: Union[str, None] = None -class BlackboardInt(BaseModel): - key: str - value: float - - -class Act17sideDataChoiceNodeOptionData(BaseModel): +class Act17sideDataChoiceNodeOptionData(BaseStruct): canRepeat: bool eventId: str des: str - unlockDes: str | None + unlockDes: Union[str, None] -class StageDataDisplayDetailRewards(BaseModel): +class StageDataDisplayDetailRewards(BaseStruct): occPercent: int - type_: str = Field(alias='type') - id_: str = Field(alias='id') + type_: str = field(name='type') + id_: str = field(name='id') dropType: int - CannotGetPercent: float | None = None - GetPercent: float | None = None + CannotGetPercent: Union[float, None] = None + GetPercent: Union[float, None] = None -class StageDataConditionDesc(BaseModel): +class StageDataConditionDesc(BaseStruct): stageId: str completeState: int -class Act17sideDataConstData(BaseModel): +class Act17sideDataConstData(BaseStruct): techTreeUnlockEventId: str -class Act17sideDataZoneData(BaseModel): +class Act17sideDataZoneData(BaseStruct): zoneId: str - unlockPlaceId: str | None + unlockPlaceId: Union[str, None] unlockText: str -class Act17sideDataMainlineData(BaseModel): +class Act17sideDataMainlineData(BaseStruct): mainlineId: str - nodeId: str | None + nodeId: Union[str, None] sortId: int missionSort: str zoneId: str mainlineDes: str - focusNodeId: str | None + focusNodeId: Union[str, None] -class Act17sideDataMainlineChapterData(BaseModel): +class Act17sideDataMainlineChapterData(BaseStruct): chapterId: str chapterDes: str chapterIcon: str unlockDes: str - id_: str = Field(alias='id') + id_: str = field(name='id') -class RunesSelector(BaseModel): +class RunesSelector(BaseStruct): professionMask: int buildableMask: int charIdFilter: None @@ -82,23 +81,24 @@ class RunesSelector(BaseModel): tileKeyFilter: None groupTagFilter: None filterTagFilter: None + subProfessionExcludeFilter: None -class TechTreeBranchRunes(BaseModel): +class TechTreeBranchRunes(BaseStruct): key: str selector: RunesSelector - blackboard: list[BlackboardInt | BlackboardStr] + blackboard: List[Blackboard] -class BranchRuneData(BaseModel): - id_: str = Field(alias='id') +class BranchRuneData(BaseStruct): + id_: str = field(name='id') points: float mutexGroupKey: None description: str - runes: list[TechTreeBranchRunes] + runes: List[TechTreeBranchRunes] -class Act17sideDataTechTreeBranchData(BaseModel): +class Act17sideDataTechTreeBranchData(BaseStruct): techTreeBranchId: str techTreeId: str techTreeBranchName: str @@ -107,7 +107,7 @@ class Act17sideDataTechTreeBranchData(BaseModel): runeData: BranchRuneData -class Act17sideDataTechTreeData(BaseModel): +class Act17sideDataTechTreeData(BaseStruct): techTreeId: str sortId: int techTreeName: str @@ -115,36 +115,36 @@ class Act17sideDataTechTreeData(BaseModel): lockDes: str -class Act17sideDataArchiveItemUnlockData(BaseModel): +class Act17sideDataArchiveItemUnlockData(BaseStruct): itemId: str itemType: str unlockCondition: str - nodeId: str | None + nodeId: Union[str, None] stageParam: str - chapterId: str | None + chapterId: Union[str, None] -class Act17sideDataEventData(BaseModel): +class Act17sideDataEventData(BaseStruct): eventId: str - eventPic: str | None = None - eventSpecialPic: str | None = None eventTitle: str - eventDesList: list[str] + eventDesList: List[str] + eventPic: Union[str, None] = None + eventSpecialPic: Union[str, None] = None -class Act17sideDataChoiceNodeData(BaseModel): +class Act17sideDataChoiceNodeData(BaseStruct): nodeId: str - choicePic: str | None = None isDisposable: bool - choiceSpecialPic: str | None = None choiceName: str - choiceDesList: list[str] + choiceDesList: List[str] cancelDes: str choiceNum: int - optionList: list[Act17sideDataChoiceNodeOptionData] + optionList: List[Act17sideDataChoiceNodeOptionData] + choicePic: Union[str, None] = None + choiceSpecialPic: Union[str, None] = None -class Act17sideDataTechNodeData(BaseModel): +class Act17sideDataTechNodeData(BaseStruct): nodeId: str techTreeId: str techTreeName: str @@ -152,54 +152,55 @@ class Act17sideDataTechNodeData(BaseModel): techSpecialPic: str endEventId: str confirmDes: str - techDesList: list[str] - missionIdList: list[None] + techDesList: List[str] + missionIdList: List[None] -class Act17sideDataEventNodeData(BaseModel): +class Act17sideDataEventNodeData(BaseStruct): nodeId: str eventId: str endEventId: str -class Act17sideDataTreasureNodeData(BaseModel): +class Act17sideDataTreasureNodeData(BaseStruct): nodeId: str treasureId: str treasureName: str - treasurePic: str | None + treasurePic: Union[str, None] treasureSpecialPic: None endEventId: str confirmDes: str - treasureDesList: list[str] - missionIdList: list[str] - rewardList: list[ItemBundle] + treasureDesList: List[str] + missionIdList: List[str] + rewardList: List[ItemBundle] + treasureType: str -class Act17sideDataBattleNodeData(BaseModel): +class Act17sideDataBattleNodeData(BaseStruct): nodeId: str stageId: str -class Act17sideDataStoryNodeData(BaseModel): +class Act17sideDataStoryNodeData(BaseStruct): nodeId: str storyId: str storyKey: str storyName: str - storyPic: str | None + storyPic: Union[str, None] confirmDes: str - storyDesList: list[str] + storyDesList: List[str] -class Act17sideDataLandmarkNodeData(BaseModel): +class Act17sideDataLandmarkNodeData(BaseStruct): nodeId: str landmarkId: str landmarkName: str - landmarkPic: str | None + landmarkPic: Union[str, None] landmarkSpecialPic: str - landmarkDesList: list[str] + landmarkDesList: List[str] -class Act17sideDataNodeInfoData(BaseModel): +class Act17sideDataNodeInfoData(BaseStruct): nodeId: str nodeType: str sortId: int @@ -209,121 +210,122 @@ class Act17sideDataNodeInfoData(BaseModel): trackPointType: str -class Act17sideDataPlaceData(BaseModel): +class Act17sideDataPlaceData(BaseStruct): placeId: str placeDesc: str - lockEventId: str | None + lockEventId: Union[str, None] zoneId: str -class Act17sideData(BaseModel): - archiveItemUnlockDataMap: dict[str, Act17sideDataArchiveItemUnlockData] - battleNodeDataMap: dict[str, Act17sideDataBattleNodeData] - choiceNodeDataMap: dict[str, Act17sideDataChoiceNodeData] +class Act17sideData(BaseStruct): + archiveItemUnlockDataMap: Dict[str, Act17sideDataArchiveItemUnlockData] + battleNodeDataMap: Dict[str, Act17sideDataBattleNodeData] + choiceNodeDataMap: Dict[str, Act17sideDataChoiceNodeData] constData: Act17sideDataConstData - eventDataMap: dict[str, Act17sideDataEventData] - eventNodeDataMap: dict[str, Act17sideDataEventNodeData] - landmarkNodeDataMap: dict[str, Act17sideDataLandmarkNodeData] - mainlineChapterDataMap: dict[str, Act17sideDataMainlineChapterData] - mainlineDataMap: dict[str, Act17sideDataMainlineData] - nodeInfoDataMap: dict[str, Act17sideDataNodeInfoData] - placeDataMap: dict[str, Act17sideDataPlaceData] - storyNodeDataMap: dict[str, Act17sideDataStoryNodeData] - techNodeDataMap: dict[str, Act17sideDataTechNodeData] - techTreeBranchDataMap: dict[str, Act17sideDataTechTreeBranchData] - techTreeDataMap: dict[str, Act17sideDataTechTreeData] - treasureNodeDataMap: dict[str, Act17sideDataTreasureNodeData] - zoneDataList: list[Act17sideDataZoneData] + eventDataMap: Dict[str, Act17sideDataEventData] + eventNodeDataMap: Dict[str, Act17sideDataEventNodeData] + landmarkNodeDataMap: Dict[str, Act17sideDataLandmarkNodeData] + mainlineChapterDataMap: Dict[str, Act17sideDataMainlineChapterData] + mainlineDataMap: Dict[str, Act17sideDataMainlineData] + nodeInfoDataMap: Dict[str, Act17sideDataNodeInfoData] + placeDataMap: Dict[str, Act17sideDataPlaceData] + storyNodeDataMap: Dict[str, Act17sideDataStoryNodeData] + techNodeDataMap: Dict[str, Act17sideDataTechNodeData] + techTreeBranchDataMap: Dict[str, Act17sideDataTechTreeBranchData] + techTreeDataMap: Dict[str, Act17sideDataTechTreeData] + treasureNodeDataMap: Dict[str, Act17sideDataTreasureNodeData] + zoneDataList: List[Act17sideDataZoneData] -class Blackboard(BaseModel): - key: str - value: float | None = None - valueStr: str | None = None - - -class RuneDataSelector(BaseModel): +class RuneDataSelector(BaseStruct): buildableMask: int - charIdFilter: list[str] | None - enemyIdExcludeFilter: list[str] | None - enemyIdFilter: list[str] | None - filterTagFilter: list[str] | None - groupTagFilter: list[str] | None professionMask: int - skillIdFilter: list[str] | None - tileKeyFilter: list[str] | None + charIdFilter: None + enemyIdExcludeFilter: None + enemyIdFilter: None + filterTagFilter: None + groupTagFilter: None + skillIdFilter: None + tileKeyFilter: None + subProfessionExcludeFilter: None -class RuneData(BaseModel): - blackboard: list[Blackboard] +class RuneData(BaseStruct): + blackboard: List[Blackboard] key: str - m_inited: bool | None = None selector: RuneDataSelector + m_inited: Union[bool, None] = None -class RuneTablePackedRuneData(BaseModel): +class RuneTablePackedRuneData(BaseStruct): description: str - id_: str = Field(alias='id') - mutexGroupKey: str | None = None + id_: str = field(name='id') points: float - runes: list[RuneData] + runes: List[RuneData] + mutexGroupKey: Union[str, None] = None -class Act25SideDataBattlePerformanceData(BaseModel): +class Act25SideDataBattlePerformanceData(BaseStruct): itemDesc: str itemId: str itemIcon: str - ItemName: str | None = None + itemName: str itemTechType: str runeData: RuneTablePackedRuneData sortId: int -class ActivityCustomDataAct25sideCustomData(BaseModel): - battlePerformanceData: dict[str, Act25SideDataBattlePerformanceData] +class ActivityCustomDataAct25sideCustomData(BaseStruct): + battlePerformanceData: Dict[str, Act25SideDataBattlePerformanceData] -class ActivityCustomData(BaseModel): - TYPE_ACT17SIDE: dict[str, Act17sideData] - TYPE_ACT25SIDE: dict[str, ActivityCustomDataAct25sideCustomData] +class ActivityCustomDataAct20sideCustomData(BaseStruct): + zoneAdditionDataMap: Dict[str, str] + residentCartDatas: Dict[str, Dict[str, str]] -class RetroTrailRuleData(BaseModel): - title: list[str] - desc: list[str] +class ActivityCustomData(BaseStruct): + TYPE_ACT17SIDE: Dict[str, Act17sideData] + TYPE_ACT25SIDE: Dict[str, ActivityCustomDataAct25sideCustomData] + TYPE_ACT20SIDE: Dict[str, ActivityCustomDataAct20sideCustomData] -class WeightItemBundle(BaseModel): +class RetroTrailRuleData(BaseStruct): + title: List[str] + desc: List[str] + + +class WeightItemBundle(BaseStruct): count: int dropType: str - id_: str = Field(alias='id') - type_: str = Field(alias='type') + id_: str = field(name='id') + type_: str = field(name='type') weight: int -class StageDataStageDropInfo(BaseModel): - firstPassRewards: list[ItemBundle] | None = None - firstCompleteRewards: list[ItemBundle] | None = None - passRewards: list[list[WeightItemBundle]] | None = None - completeRewards: list[list[WeightItemBundle]] | None = None - displayRewards: list[StageDataDisplayRewards] - displayDetailRewards: list[StageDataDisplayDetailRewards] +class StageDataStageDropInfo(BaseStruct): + displayRewards: List[StageDataDisplayRewards] + displayDetailRewards: List[StageDataDisplayDetailRewards] + firstPassRewards: Union[List[ItemBundle], None] = None + firstCompleteRewards: Union[List[ItemBundle], None] = None + passRewards: Union[List[List[WeightItemBundle]], None] = None + completeRewards: Union[List[List[WeightItemBundle]], None] = None -class StageData(BaseModel): +class StageData(BaseStruct, kw_only=False): stageType: str difficulty: str performanceStageFlag: str diffGroup: str - unlockCondition: list[StageDataConditionDesc] + unlockCondition: List[StageDataConditionDesc] stageId: str - levelId: str | None + levelId: Union[str, None] zoneId: str code: str name: str description: str - hardStagedId: str | None - dangerLevel: str | None + hardStagedId: Union[str, None] + dangerLevel: Union[str, None] dangerPoint: float loadingPicId: str canPractice: bool @@ -357,45 +359,48 @@ class StageData(BaseModel): startButtonOverrideId: None isStagePatch: bool mainStageId: str + canUseTech: Union[bool, None] = None + canUseCharm: Union[bool, None] = None + canUseBattlePerformance: Union[bool, None] = None -class RetroTrailRewardItem(BaseModel): +class RetroTrailRewardItem(BaseStruct): trailRewardId: str starCount: int rewardItem: ItemBundle -class RetroTrailData(BaseModel): +class RetroTrailData(BaseStruct): retroId: str trailStartTime: int - trailRewardList: list[RetroTrailRewardItem] - stageList: list[str] + trailRewardList: List[RetroTrailRewardItem] + stageList: List[str] relatedChar: str relatedFullPotentialItemId: None themeColor: str fullPotentialItemId: str -class RetroActData(BaseModel): +class RetroActData(BaseStruct): retroId: str - type_: int = Field(alias='type') - linkedActId: list[str] + type_: int = field(name='type') + linkedActId: List[str] startTime: int trailStartTime: int index: int name: str detail: str haveTrail: bool - customActId: str | None + customActId: Union[str, None] customActType: str -class StageValidInfo(BaseModel): +class StageValidInfo(BaseStruct): startTs: int endTs: int -class RetroStageOverrideInfo(BaseModel): +class RetroStageOverrideInfo(BaseStruct): apCost: int apFailReturn: int completeFavor: int @@ -406,23 +411,20 @@ class RetroStageOverrideInfo(BaseModel): zoneId: str -class RetroTable(BaseModel): +class RetroTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' customData: ActivityCustomData initRetroCoin: int - retroActList: dict[str, RetroActData] + retroActList: Dict[str, RetroActData] retroCoinMax: int retroCoinPerWeek: int retroDetail: str retroPreShowTime: int - retroTrailList: dict[str, RetroTrailData] + retroTrailList: Dict[str, RetroTrailData] retroUnlockCost: int ruleData: RetroTrailRuleData - stageList: dict[str, StageData] - stages: dict[str, RetroStageOverrideInfo] | None = None - stageValidInfo: dict[str, StageValidInfo] - zoneToRetro: dict[str, str] - - class Config: - extra = 'allow' + stageList: Dict[str, StageData] + stageValidInfo: Dict[str, StageValidInfo] + zoneToRetro: Dict[str, str] + stages: Union[Dict[str, RetroStageOverrideInfo], None] = None diff --git a/ArknightsUID/utils/models/gamedata/RoguelikeTable.py b/ArknightsUID/utils/models/gamedata/RoguelikeTable.py index 9e95015..6f70a31 100644 --- a/ArknightsUID/utils/models/gamedata/RoguelikeTable.py +++ b/ArknightsUID/utils/models/gamedata/RoguelikeTable.py @@ -1,49 +1,51 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class RoguelikeBuff(BaseModel): +class RoguelikeBuff(BaseStruct): key: str - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class RoguelikeOuterBuff(BaseModel): - buffId: str | None = None +class RoguelikeOuterBuff(BaseStruct): level: int name: str iconId: str description: str usage: str key: str - blackboard: list[Blackboard] + blackboard: List[Blackboard] + buffId: Union[str, None] = None -class RoguelikeOutBuffData(BaseModel): - id_: str = Field(alias='id') - buffs: dict[str, RoguelikeOuterBuff] +class RoguelikeOutBuffData(BaseStruct): + id_: str = field(name='id') + buffs: Dict[str, RoguelikeOuterBuff] -class RoguelikeEndingData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeEndingData(BaseStruct): + id_: str = field(name='id') backgroundId: str name: str description: str priority: int - unlockItemId: str | None + unlockItemId: Union[str, None] changeEndingDesc: None -class RoguelikeModeData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeModeData(BaseStruct): + id_: str = field(name='id') name: str canUnlockItem: int scoreFactor: float - itemPools: list[str] + itemPools: List[str] difficultyDesc: str ruleDesc: str sortId: int @@ -51,25 +53,25 @@ class RoguelikeModeData(BaseModel): color: str -class RoguelikeChoiceSceneData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeChoiceSceneData(BaseStruct): + id_: str = field(name='id') title: str description: str background: str -class RoguelikeChoiceData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeChoiceData(BaseStruct): + id_: str = field(name='id') title: str - description: str | None - type_: str = Field(alias='type') - nextSceneId: str | None - icon: str | None - param: dict[str, object] + description: Union[str, None] + type_: str = field(name='type') + nextSceneId: Union[str, None] + icon: Union[str, None] + param: Dict[str, object] -class RoguelikeZoneData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeZoneData(BaseStruct): + id_: str = field(name='id') name: str description: str endingDescription: str @@ -77,106 +79,106 @@ class RoguelikeZoneData(BaseModel): subIconId: str -class RoguelikeStageData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeStageData(BaseStruct): + id_: str = field(name='id') linkedStageId: str levelId: str code: str name: str loadingPicId: str description: str - eliteDesc: str | None + eliteDesc: Union[str, None] isBoss: int isElite: int difficulty: str -class RoguelikeRelicFeature(BaseModel): - id_: str = Field(alias='id') - buffs: list[RoguelikeBuff] +class RoguelikeRelicFeature(BaseStruct): + id_: str = field(name='id') + buffs: List[RoguelikeBuff] -class RoguelikeUpgradeTicketFeature(BaseModel): - id_: str = Field(alias='id') +class RoguelikeUpgradeTicketFeature(BaseStruct): + id_: str = field(name='id') profession: int rarity: int - professionList: list[str] - rarityList: list[int] + professionList: List[str] + rarityList: List[int] -class RoguelikeRecruitTicketFeature(BaseModel): - id_: str = Field(alias='id') +class RoguelikeRecruitTicketFeature(BaseStruct): + id_: str = field(name='id') profession: int rarity: int - professionList: list[str] - rarityList: list[int] + professionList: List[str] + rarityList: List[int] extraEliteNum: int - extraFreeRarity: list[int | None] - extraCharIds: list[str] + extraFreeRarity: List[Union[int, None]] + extraCharIds: List[str] -class RelicStableUnlockParam(BaseModel): +class RelicStableUnlockParam(BaseStruct): unlockCondDetail: str unlockCnt: int -class RoguelikeItemData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeItemData(BaseStruct): + id_: str = field(name='id') name: str - description: str | None + description: Union[str, None] usage: str obtainApproach: str iconId: str - type_: str = Field(alias='type') + type_: str = field(name='type') rarity: str value: int sortId: int - unlockCond: str | None - unlockCondDesc: str | None - unlockCondParams: list[str | None] - stableUnlockCond: RelicStableUnlockParam | None + unlockCond: Union[str, None] + unlockCondDesc: Union[str, None] + unlockCondParams: List[Union[str, None]] + stableUnlockCond: Union[RelicStableUnlockParam, None] -class RoguelikeItemTable(BaseModel): - items: dict[str, RoguelikeItemData] - recruitTickets: dict[str, RoguelikeRecruitTicketFeature] - upgradeTickets: dict[str, RoguelikeUpgradeTicketFeature] - relics: dict[str, RoguelikeRelicFeature] +class RoguelikeItemTable(BaseStruct): + items: Dict[str, RoguelikeItemData] + recruitTickets: Dict[str, RoguelikeRecruitTicketFeature] + upgradeTickets: Dict[str, RoguelikeUpgradeTicketFeature] + relics: Dict[str, RoguelikeRelicFeature] -class RoguelikeConstTableEventTypeData(BaseModel): +class RoguelikeConstTableEventTypeData(BaseStruct): name: str description: str -class RoguelikeConstTableCharUpgradeData(BaseModel): +class RoguelikeConstTableCharUpgradeData(BaseStruct): evolvePhase: int skillLevel: int skillSpecializeLevel: int -class RoguelikeConstTableRecruitData(BaseModel): +class RoguelikeConstTableRecruitData(BaseStruct): recruitPopulation: int upgradePopulation: int -class RoguelikeConstTablePlayerLevelData(BaseModel): +class RoguelikeConstTablePlayerLevelData(BaseStruct): exp: int populationUp: int squadCapacityUp: int battleCharLimitUp: int -class RoguelikeConstTable(BaseModel): - playerLevelTable: dict[str, RoguelikeConstTablePlayerLevelData] - recruitPopulationTable: dict[str, RoguelikeConstTableRecruitData] - charUpgradeTable: dict[str, RoguelikeConstTableCharUpgradeData] - eventTypeTable: dict[str, RoguelikeConstTableEventTypeData] - shopDialogs: list[str] - shopRelicDialogs: list[str] - shopTicketDialogs: list[str] - mimicEnemyIds: list[str] - clearZoneScores: list[int] +class RoguelikeConstTable(BaseStruct): + playerLevelTable: Dict[str, RoguelikeConstTablePlayerLevelData] + recruitPopulationTable: Dict[str, RoguelikeConstTableRecruitData] + charUpgradeTable: Dict[str, RoguelikeConstTableCharUpgradeData] + eventTypeTable: Dict[str, RoguelikeConstTableEventTypeData] + shopDialogs: List[str] + shopRelicDialogs: List[str] + shopTicketDialogs: List[str] + mimicEnemyIds: List[str] + clearZoneScores: List[int] moveToNodeScore: int clearNormalBattleScore: int clearEliteBattleScore: int @@ -185,21 +187,18 @@ class RoguelikeConstTable(BaseModel): gainCharacterScore: int unlockRelicSpecialScore: int squadCapacityMax: int - bossIds: list[str] + bossIds: List[str] -class RoguelikeTable(BaseModel): +class RoguelikeTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' constTable: RoguelikeConstTable itemTable: RoguelikeItemTable - stages: dict[str, RoguelikeStageData] - zones: dict[str, RoguelikeZoneData] - choices: dict[str, RoguelikeChoiceData] - choiceScenes: dict[str, RoguelikeChoiceSceneData] - modes: dict[str, RoguelikeModeData] - endings: dict[str, RoguelikeEndingData] - outBuffs: dict[str, RoguelikeOutBuffData] - - class Config: - extra = 'allow' + stages: Dict[str, RoguelikeStageData] + zones: Dict[str, RoguelikeZoneData] + choices: Dict[str, RoguelikeChoiceData] + choiceScenes: Dict[str, RoguelikeChoiceSceneData] + modes: Dict[str, RoguelikeModeData] + endings: Dict[str, RoguelikeEndingData] + outBuffs: Dict[str, RoguelikeOutBuffData] diff --git a/ArknightsUID/utils/models/gamedata/RoguelikeTopicTable.py b/ArknightsUID/utils/models/gamedata/RoguelikeTopicTable.py index 486e3d7..9cccdff 100644 --- a/ArknightsUID/utils/models/gamedata/RoguelikeTopicTable.py +++ b/ArknightsUID/utils/models/gamedata/RoguelikeTopicTable.py @@ -1,23 +1,25 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class RoguelikeTopicBasicDataHomeEntryDisplayData(BaseModel): +class RoguelikeTopicBasicDataHomeEntryDisplayData(BaseStruct): topicId: str displayId: str startTs: int endTs: int -class RoguelikeTopicConfig(BaseModel): - loadCharCardPlugin: bool | None = None +class RoguelikeTopicConfig(BaseStruct): webBusType: str monthChatTrigType: int loadRewardHpDecoPlugin: bool loadRewardExtraInfoPlugin: bool + loadCharCardPlugin: Union[bool, None] = None -class RoguelikeTopicBasicData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeTopicBasicData(BaseStruct): + id_: str = field(name='id') name: str startTime: int disappearTimeOnMainScreen: int @@ -26,21 +28,21 @@ class RoguelikeTopicBasicData(BaseModel): medalGroupId: str fullStoredTime: int lineText: str - homeEntryDisplayData: list[RoguelikeTopicBasicDataHomeEntryDisplayData] - moduleTypes: list[str] + homeEntryDisplayData: List[RoguelikeTopicBasicDataHomeEntryDisplayData] + moduleTypes: List[str] config: RoguelikeTopicConfig -class RoguelikeTopicConstPredefinedChar(BaseModel): +class RoguelikeTopicConstPredefinedChar(BaseStruct): charId: str canBeFree: bool - uniEquipId: str | None + uniEquipId: Union[str, None] recruitType: str -class RoguelikeTopicConst(BaseModel): +class RoguelikeTopicConst(BaseStruct): milestoneTokenRatio: int - outerBuffTokenRatio: int | float + outerBuffTokenRatio: Union[int, float] relicTokenRatio: int rogueSystemUnlockStage: str ordiModeReOpenCoolDown: int @@ -49,22 +51,22 @@ class RoguelikeTopicConst(BaseModel): monthlyTaskManualRefreshLimit: int monthlyTeamUncompletedTime: int bpPurchaseSystemUnlockTime: int - predefinedChars: dict[str, RoguelikeTopicConstPredefinedChar] + predefinedChars: Dict[str, RoguelikeTopicConstPredefinedChar] -class RoguelikeTopicUpdate(BaseModel): +class RoguelikeTopicUpdate(BaseStruct): updateId: str topicUpdateTime: int topicEndTime: int -class RoguelikeTopicEnroll(BaseModel): +class RoguelikeTopicEnroll(BaseStruct): enrollId: str enrollTime: int -class RoguelikeTopicBP(BaseModel): - id_: str = Field(alias='id') +class RoguelikeTopicBP(BaseStruct): + id_: str = field(name='id') level: int tokenNum: int nextTokenNum: int @@ -75,7 +77,7 @@ class RoguelikeTopicBP(BaseModel): isGrandPrize: bool -class RoguelikeTopicMilestoneUpdateData(BaseModel): +class RoguelikeTopicMilestoneUpdateData(BaseStruct): updateTime: int endTime: int maxBpLevel: int @@ -83,7 +85,13 @@ class RoguelikeTopicMilestoneUpdateData(BaseModel): maxDisplayBpCount: int -class RoguelikeTopicBPGrandPrize(BaseModel): +class ItemBundle(BaseStruct): + id_: str = field(name='id') + count: int + type_: str = field(name='type') + + +class RoguelikeTopicBPGrandPrize(BaseStruct): grandPrizeDisplayId: str sortId: int displayUnlockYear: int @@ -93,74 +101,69 @@ class RoguelikeTopicBPGrandPrize(BaseModel): displayName: str displayDiscription: str bpLevelId: str - accordingCharId: str | None = None - accordingSkinId: str | None = None - detailAnnounceTime: str | None = None - picIdAftrerUnlock: str | None = None + itemBundle: Union[ItemBundle, None] = None + accordingCharId: Union[str, None] = None + accordingSkinId: Union[str, None] = None + detailAnnounceTime: Union[str, None] = None + picIdAftrerUnlock: Union[str, None] = None -class RoguelikeTopicMonthMission(BaseModel): - id_: str = Field(alias='id') +class RoguelikeTopicMonthMission(BaseStruct): + id_: str = field(name='id') taskName: str taskClass: str innerClassWeight: int template: str - paramList: list[str] + paramList: List[str] desc: str tokenRewardNum: int -class ItemBundle(BaseModel): - id_: str = Field(alias='id') - count: int - type_: str = Field(alias='type') - - -class RoguelikeTopicMonthSquad(BaseModel): - id_: str = Field(alias='id') +class RoguelikeTopicMonthSquad(BaseStruct): + id_: str = field(name='id') teamName: str - teamSubName: str | None - teamFlavorDesc: str | None + teamSubName: Union[str, None] + teamFlavorDesc: Union[str, None] teamDes: str teamColor: str teamMonth: str teamYear: str - teamIndex: str | None - teamChars: list[str] - zoneId: str | None + teamIndex: Union[str, None] + teamChars: List[str] + zoneId: Union[str, None] chatId: str tokenRewardNum: int - items: list[ItemBundle] + items: List[ItemBundle] startTime: int endTime: int - taskDes: str | None + taskDes: Union[str, None] -class RoguelikeTopicChallenge(BaseModel): +class RoguelikeTopicChallenge(BaseStruct): challengeId: str sortId: int challengeName: str challengeGroup: int challengeGroupSortId: int - challengeGroupName: str | None - challengeUnlockDesc: str | None - challengeUnlockToastDesc: str | None + challengeGroupName: Union[str, None] + challengeUnlockDesc: Union[str, None] + challengeUnlockToastDesc: Union[str, None] challengeDes: str - challengeConditionDes: list[str] + challengeConditionDes: List[str] taskDes: str completionClass: str - completionParams: list[str] - rewards: list[ItemBundle] + completionParams: List[str] + rewards: List[ItemBundle] -class RoguelikeTopicDifficulty(BaseModel): +class RoguelikeTopicDifficulty(BaseStruct): modeDifficulty: str grade: int name: str - subName: str | None - enrollId: str | None + subName: Union[str, None] + enrollId: Union[str, None] haveInitialRelicIcon: bool - scoreFactor: int | float + scoreFactor: Union[int, float] canUnlockItem: bool doMonthTask: bool ruleDesc: str @@ -169,84 +172,84 @@ class RoguelikeTopicDifficulty(BaseModel): failForceDesc: str sortId: int equivalentGrade: int - color: str | None + color: Union[str, None] bpValue: int bossValue: int - addDesc: str | None + addDesc: Union[str, None] isHard: bool - unlockText: str | None - displayIconId: str | None + unlockText: Union[str, None] + displayIconId: Union[str, None] -class RoguelikeTopicBankReward(BaseModel): +class RoguelikeTopicBankReward(BaseStruct): rewardId: str unlockGoldCnt: int rewardType: str desc: str -class ActArchiveRelicItemData(BaseModel): +class ActArchiveRelicItemData(BaseStruct): relicId: str relicSortId: int relicGroupId: int orderId: str isSpRelic: bool - enrollId: str | None + enrollId: Union[str, None] -class ActArchiveRelicData(BaseModel): - relic: dict[str, ActArchiveRelicItemData] +class ActArchiveRelicData(BaseStruct): + relic: Dict[str, ActArchiveRelicItemData] -class ActArchiveCapsuleItemData(BaseModel): +class ActArchiveCapsuleItemData(BaseStruct): capsuleId: str capsuleSortId: int englishName: str - enrollId: str | None + enrollId: Union[str, None] -class ActArchiveCapsuleData(BaseModel): - capsule: dict[str, ActArchiveCapsuleItemData] +class ActArchiveCapsuleData(BaseStruct): + capsule: Dict[str, ActArchiveCapsuleItemData] -class ActArchiveTrapItemData(BaseModel): +class ActArchiveTrapItemData(BaseStruct): trapId: str trapSortId: int orderId: str - enrollId: str | None + enrollId: Union[str, None] -class ActArchiveTrapData(BaseModel): - trap: dict[str, ActArchiveTrapItemData] +class ActArchiveTrapData(BaseStruct): + trap: Dict[str, ActArchiveTrapItemData] -class ActArchiveChatItemData(BaseModel): +class ActArchiveChatItemData(BaseStruct): chatFloor: int - chatDesc: str | None + chatDesc: Union[str, None] chatStoryId: str -class ActArchiveChatGroupData(BaseModel): +class ActArchiveChatGroupData(BaseStruct): sortId: int numChat: int - clientChatItemData: list[ActArchiveChatItemData] + clientChatItemData: List[ActArchiveChatItemData] -class ActArchiveChatData(BaseModel): - chat: dict[str, ActArchiveChatGroupData] +class ActArchiveChatData(BaseStruct): + chat: Dict[str, ActArchiveChatGroupData] -class ActArchiveEndbookItemData(BaseModel): +class ActArchiveEndbookItemData(BaseStruct): endBookId: str sortId: int - enrollId: str | None = None - isLast: bool | None = None endbookName: str unlockDesc: str textId: str + enrollId: Union[str, None] = None + isLast: Union[bool, None] = None -class ActArchiveEndbookGroupData(BaseModel): +class ActArchiveEndbookGroupData(BaseStruct): endId: str endingId: str sortId: int @@ -256,14 +259,14 @@ class ActArchiveEndbookGroupData(BaseModel): cardId: str hasAvg: bool avgId: str - clientEndbookItemDatas: list[ActArchiveEndbookItemData] + clientEndbookItemDatas: List[ActArchiveEndbookItemData] -class ActArchiveEndbookData(BaseModel): - endbook: dict[str, ActArchiveEndbookGroupData] +class ActArchiveEndbookData(BaseStruct): + endbook: Dict[str, ActArchiveEndbookGroupData] -class ActArchiveBuffItemData(BaseModel): +class ActArchiveBuffItemData(BaseStruct): buffId: str buffGroupIndex: int innerSortId: int @@ -274,59 +277,59 @@ class ActArchiveBuffItemData(BaseModel): color: str -class ActArchiveBuffData(BaseModel): - buff: dict[str, ActArchiveBuffItemData] +class ActArchiveBuffData(BaseStruct): + buff: Dict[str, ActArchiveBuffItemData] -class ActArchiveTotemItemData(BaseModel): - id_: str = Field(alias='id') - type_: int = Field(alias='type') - enrollConditionId: str | None +class ActArchiveTotemItemData(BaseStruct): + id_: str = field(name='id') + type_: int = field(name='type') + enrollConditionId: Union[str, None] sortId: int -class ActArchiveTotemData(BaseModel): - totem: dict[str, ActArchiveTotemItemData] +class ActArchiveTotemData(BaseStruct): + totem: Dict[str, ActArchiveTotemItemData] -class ActArchiveChaosItemData(BaseModel): - id_: str = Field(alias='id') +class ActArchiveChaosItemData(BaseStruct): + id_: str = field(name='id') isHidden: bool - enrollId: str | None + enrollId: Union[str, None] sortId: int -class ActArchiveChaosData(BaseModel): - chaos: dict[str, ActArchiveChaosItemData] +class ActArchiveChaosData(BaseStruct): + chaos: Dict[str, ActArchiveChaosItemData] -class RoguelikeArchiveComponentData(BaseModel): +class RoguelikeArchiveComponentData(BaseStruct): relic: ActArchiveRelicData - capsule: ActArchiveCapsuleData | None + capsule: Union[ActArchiveCapsuleData, None] trap: ActArchiveTrapData chat: ActArchiveChatData endbook: ActArchiveEndbookData buff: ActArchiveBuffData - totem: ActArchiveTotemData | None - chaos: ActArchiveChaosData | None + totem: Union[ActArchiveTotemData, None] + chaos: Union[ActArchiveChaosData, None] -class RoguelikeArchiveUnlockCondDesc(BaseModel): +class RoguelikeArchiveUnlockCondDesc(BaseStruct): archiveType: str description: str -class RoguelikeArchiveEnroll(BaseModel): +class RoguelikeArchiveEnroll(BaseStruct): archiveType: str - enrollId: str | None + enrollId: Union[str, None] -class RoguelikeArchiveUnlockCondData(BaseModel): - unlockCondDesc: dict[str, RoguelikeArchiveUnlockCondDesc] - enroll: dict[str, RoguelikeArchiveEnroll] +class RoguelikeArchiveUnlockCondData(BaseStruct): + unlockCondDesc: Dict[str, RoguelikeArchiveUnlockCondDesc] + enroll: Dict[str, RoguelikeArchiveEnroll] -class RoguelikeTopicDetailConstPlayerLevelData(BaseModel): +class RoguelikeTopicDetailConstPlayerLevelData(BaseStruct): exp: int populationUp: int squadCapacityUp: int @@ -334,16 +337,16 @@ class RoguelikeTopicDetailConstPlayerLevelData(BaseModel): maxHpUp: int -class RoguelikeTopicDetailConstCharUpgradeData(BaseModel): +class RoguelikeTopicDetailConstCharUpgradeData(BaseStruct): evolvePhase: int skillLevel: int skillSpecializeLevel: int -class RoguelikeTopicDetailConst(BaseModel): - playerLevelTable: dict[str, RoguelikeTopicDetailConstPlayerLevelData] - charUpgradeTable: dict[str, RoguelikeTopicDetailConstCharUpgradeData] - difficultyUpgradeRelicDescTable: dict[str, str] +class RoguelikeTopicDetailConst(BaseStruct): + playerLevelTable: Dict[str, RoguelikeTopicDetailConstPlayerLevelData] + charUpgradeTable: Dict[str, RoguelikeTopicDetailConstCharUpgradeData] + difficultyUpgradeRelicDescTable: Dict[str, str] tokenBpId: str tokenOuterBuffId: str previewedRewardsAccordingUpdateId: str @@ -352,11 +355,11 @@ class RoguelikeTopicDetailConst(BaseModel): bpSystemName: str autoSetKV: str bpPurchaseActiveEnroll: str - defaultSacrificeDesc: str | None - defaultExpeditionSelectDesc: str | None - gotCharBuffToast: str | None - gotSquadBuffToast: str | None - loseCharBuffToast: str | None + defaultSacrificeDesc: Union[str, None] + defaultExpeditionSelectDesc: Union[str, None] + gotCharBuffToast: Union[str, None] + gotSquadBuffToast: Union[str, None] + loseCharBuffToast: Union[str, None] monthTeamSystemName: str battlePassUpdateName: str monthCharCardTagName: str @@ -373,12 +376,12 @@ class RoguelikeTopicDetailConst(BaseModel): showBlurBack: bool -class RoguelikeGameInitData(BaseModel): +class RoguelikeGameInitData(BaseStruct): modeId: str modeGrade: int - predefinedId: str | None - initialBandRelic: list[str] - initialRecruitGroup: list[str] | None + predefinedId: Union[str, None] + initialBandRelic: List[str] + initialRecruitGroup: Union[List[str], None] initialHp: int initialPopulation: int initialGold: int @@ -388,30 +391,30 @@ class RoguelikeGameInitData(BaseModel): initialKey: int -class RoguelikeGameStageData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameStageData(BaseStruct): + id_: str = field(name='id') linkedStageId: str levelId: str code: str name: str loadingPicId: str description: str - eliteDesc: str | None + eliteDesc: Union[str, None] isBoss: int isElite: int difficulty: str - capsulePool: str | None - capsuleProb: int | float - vutresProb: list[float] - boxProb: list[float] - specialNodeId: str | None = None + capsulePool: Union[str, None] + capsuleProb: Union[int, float] + vutresProb: List[float] + boxProb: List[float] + specialNodeId: Union[str, None] = None -class RoguelikeGameZoneData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameZoneData(BaseStruct): + id_: str = field(name='id') name: str - clockPerformance: str | None - displayTime: str | None + clockPerformance: Union[str, None] + displayTime: Union[str, None] description: str endingDescription: str backgroundId: str @@ -419,155 +422,155 @@ class RoguelikeGameZoneData(BaseModel): isHiddenZone: bool -class RoguelikeZoneVariationData(BaseModel): +class RoguelikeZoneVariationData(BaseStruct): pass -class RoguelikeGameTrapData(BaseModel): +class RoguelikeGameTrapData(BaseStruct): itemId: str trapId: str trapDesc: str -class RoguelikeGameRecruitTicketData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameRecruitTicketData(BaseStruct): + id_: str = field(name='id') profession: int rarity: int - professionList: list[str] - rarityList: list[int] + professionList: List[str] + rarityList: List[int] extraEliteNum: int - extraFreeRarity: list[int] - extraCharIds: list[str] + extraFreeRarity: List[int] + extraCharIds: List[str] -class RoguelikeGameUpgradeTicketData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameUpgradeTicketData(BaseStruct): + id_: str = field(name='id') profession: int rarity: int - professionList: list[str] - rarityList: list[int] + professionList: List[str] + rarityList: List[int] -class RoguelikeGameCustomTicketData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameCustomTicketData(BaseStruct): + id_: str = field(name='id') subType: str discardText: str -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: int | float | None = None - valueStr: str | None = None + value: Union[Union[int, float], None] = None + valueStr: Union[str, None] = None -class RoguelikeBuff(BaseModel): +class RoguelikeBuff(BaseStruct): key: str - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class RoguelikeGameRelicData(BaseModel): - id_: str = Field(alias='id') - buffs: list[RoguelikeBuff] +class RoguelikeGameRelicData(BaseStruct): + id_: str = field(name='id') + buffs: List[RoguelikeBuff] -class RoguelikeGameRelicCheckParam(BaseModel): +class RoguelikeGameRelicCheckParam(BaseStruct): valueProfessionMask: int - valueStrs: list[str] | None + valueStrs: Union[List[str], None] valueInt: int -class RoguelikeGameRelicParamData(BaseModel): - id_: str = Field(alias='id') - checkCharBoxTypes: list[str] - checkCharBoxParams: list[RoguelikeGameRelicCheckParam] +class RoguelikeGameRelicParamData(BaseStruct): + id_: str = field(name='id') + checkCharBoxTypes: List[str] + checkCharBoxParams: List[RoguelikeGameRelicCheckParam] -class RoguelikeGameRecruitGrpData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameRecruitGrpData(BaseStruct): + id_: str = field(name='id') iconId: str name: str desc: str - unlockDesc: str | None + unlockDesc: Union[str, None] -class RoguelikeChoiceDisplayData(BaseModel): - type_: str = Field(alias='type') - costHintType: int | None = None - effectHintType: int | None = None - funcIconId: str | None - itemId: str | None - difficultyUpgradeRelicGroupId: str | None = None - taskId: str | None +class RoguelikeChoiceDisplayData(BaseStruct): + type_: str = field(name='type') + funcIconId: Union[str, None] + itemId: Union[str, None] + taskId: Union[str, None] + costHintType: Union[int, None] = None + effectHintType: Union[int, None] = None + difficultyUpgradeRelicGroupId: Union[str, None] = None -class RoguelikeGameChoiceData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameChoiceData(BaseStruct): + id_: str = field(name='id') title: str - description: str | None - lockedCoverDesc: str | None - type_: str = Field(alias='type') + description: Union[str, None] + lockedCoverDesc: Union[str, None] + type_: str = field(name='type') leftDecoType: str - nextSceneId: str | None - icon: str | None + nextSceneId: Union[str, None] + icon: Union[str, None] displayData: RoguelikeChoiceDisplayData forceShowWhenOnlyLeave: bool -class RoguelikeGameChoiceSceneData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameChoiceSceneData(BaseStruct): + id_: str = field(name='id') title: str description: str - background: str | None - titleIcon: str | None + background: Union[str, None] + titleIcon: Union[str, None] subTypeId: int useHiddenMusic: bool -class RoguelikeGameNodeTypeData(BaseModel): +class RoguelikeGameNodeTypeData(BaseStruct): name: str description: str -class RoguelikeGameNodeSubTypeData(BaseModel): +class RoguelikeGameNodeSubTypeData(BaseStruct): eventType: str subTypeId: int iconId: str - name: str | None + name: Union[str, None] description: str -class RoguelikeGameVariationData(BaseModel): - id_: str = Field(alias='id') - type_: str = Field(alias='type') +class RoguelikeGameVariationData(BaseStruct): + id_: str = field(name='id') + type_: str = field(name='type') outerName: str innerName: str functionDesc: str desc: str - iconId: str | None - sound: str | None + iconId: Union[str, None] + sound: Union[str, None] -class RoguelikeGameCharBuffData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameCharBuffData(BaseStruct): + id_: str = field(name='id') iconId: str outerName: str innerName: str functionDesc: str desc: str - buffs: list[RoguelikeBuff] + buffs: List[RoguelikeBuff] -class RoguelikeGameSquadBuffData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameSquadBuffData(BaseStruct): + id_: str = field(name='id') iconId: str outerName: str innerName: str functionDesc: str desc: str - buffs: list[RoguelikeBuff] + buffs: List[RoguelikeBuff] -class RoguelikeTaskData(BaseModel): +class RoguelikeTaskData(BaseStruct): taskId: str taskName: str taskDesc: str @@ -575,7 +578,7 @@ class RoguelikeTaskData(BaseModel): taskRarity: str -class RoguelikeGameConst(BaseModel): +class RoguelikeGameConst(BaseStruct): initSceneName: str failSceneName: str hpItemId: str @@ -583,99 +586,100 @@ class RoguelikeGameConst(BaseModel): populationItemId: str squadCapacityItemId: str expItemId: str + initialBandShowGradeFlag: bool bankMaxGold: int - bankCostId: str | None + bankCostId: Union[str, None] bankDrawCount: int bankDrawLimit: int - mimicEnemyIds: list[str] - bossIds: list[str] + mimicEnemyIds: List[str] + bossIds: List[str] goldChestTrapId: str - normBoxTrapId: str | None - rareBoxTrapId: str | None - badBoxTrapId: str | None - maxHpItemId: str | None - shieldItemId: str | None - keyItemId: str | None + normBoxTrapId: Union[str, None] + rareBoxTrapId: Union[str, None] + badBoxTrapId: Union[str, None] + maxHpItemId: Union[str, None] + shieldItemId: Union[str, None] + keyItemId: Union[str, None] chestKeyCnt: int - chestKeyItemId: str | None - keyColorId: str | None - onceNodeTypeList: list[str] + chestKeyItemId: Union[str, None] + keyColorId: Union[str, None] + onceNodeTypeList: List[str] gpScoreRatio: int - overflowUsageSquadBuff: str | None - specialTrapId: str | None - trapRewardRelicId: str | None - unlockRouteItemId: str | None - hideBattleNodeName: str | None - hideBattleNodeDescription: str | None - hideNonBattleNodeName: str | None - hideNonBattleNodeDescription: str | None - charSelectExpeditionConflictToast: str | None - itemDropTagDict: dict[str, str] - expeditionReturnDescCureUpgrade: str | None - expeditionReturnDescUpgrade: str | None - expeditionReturnDescCure: str | None - expeditionReturnDesc: str | None - expeditionReturnDescItem: str | None - expeditionReturnRewardBlackList: list[str] + overflowUsageSquadBuff: Union[str, None] + specialTrapId: Union[str, None] + trapRewardRelicId: Union[str, None] + unlockRouteItemId: Union[str, None] + hideBattleNodeName: Union[str, None] + hideBattleNodeDescription: Union[str, None] + hideNonBattleNodeName: Union[str, None] + hideNonBattleNodeDescription: Union[str, None] + charSelectExpeditionConflictToast: Union[str, None] + itemDropTagDict: Dict[str, str] + expeditionReturnDescCureUpgrade: Union[str, None] + expeditionReturnDescUpgrade: Union[str, None] + expeditionReturnDescCure: Union[str, None] + expeditionReturnDesc: Union[str, None] + expeditionReturnDescItem: Union[str, None] + expeditionReturnRewardBlackList: List[str] gainBuffDiffGrade: int - dsPredictTips: str | None - dsBuffActiveTips: str | None - totemDesc: str | None - relicDesc: str | None - buffDesc: str | None - portalZones: list[str] + dsPredictTips: Union[str, None] + dsBuffActiveTips: Union[str, None] + totemDesc: Union[str, None] + relicDesc: Union[str, None] + buffDesc: Union[str, None] + portalZones: List[str] -class RoguelikeTopicCapsule(BaseModel): +class RoguelikeTopicCapsule(BaseStruct): itemId: str maskType: str innerColor: str -class RoguelikeGameEndingDataLevelIcon(BaseModel): +class RoguelikeGameEndingDataLevelIcon(BaseStruct): level: int iconId: str -class RoguelikeGameEndingData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameEndingData(BaseStruct): + id_: str = field(name='id') familyId: int name: str desc: str bgId: str - icons: list[RoguelikeGameEndingDataLevelIcon] + icons: List[RoguelikeGameEndingDataLevelIcon] priority: int - changeEndingDesc: str | None - bossIconId: str | None + changeEndingDesc: Union[str, None] + bossIconId: Union[str, None] -class RoguelikeBattleSummeryDescriptionData(BaseModel): - randomDescriptionList: list[str] +class RoguelikeBattleSummeryDescriptionData(BaseStruct): + randomDescriptionList: List[str] -class TipData(BaseModel): +class TipData(BaseStruct): tip: str - weight: int | float + weight: Union[int, float] category: str -class RoguelikeGameItemData(BaseModel): - id_: str = Field(alias='id') +class RoguelikeGameItemData(BaseStruct): + id_: str = field(name='id') name: str - description: str | None + description: Union[str, None] usage: str obtainApproach: str iconId: str - type_: str = Field(alias='type') + type_: str = field(name='type') subType: str rarity: str value: int sortId: int canSacrifice: bool - unlockCondDesc: str | None + unlockCondDesc: Union[str, None] -class RoguelikeBandRefData(BaseModel): +class RoguelikeBandRefData(BaseStruct): itemId: str iconId: str description: str @@ -683,17 +687,17 @@ class RoguelikeBandRefData(BaseModel): normalBandId: str -class RoguelikeEndingDetailText(BaseModel): +class RoguelikeEndingDetailText(BaseStruct): textId: str text: str eventType: str showType: int - choiceSceneId: str | None - paramList: list[str] - otherPara1: str | None + choiceSceneId: Union[str, None] + paramList: List[str] + otherPara1: Union[str, None] -class RoguelikeGameTreasureData(BaseModel): +class RoguelikeGameTreasureData(BaseStruct): treasureId: str groupId: str subIndex: int @@ -701,93 +705,93 @@ class RoguelikeGameTreasureData(BaseModel): usage: str -class RoguelikeDifficultyUpgradeRelicData(BaseModel): +class RoguelikeDifficultyUpgradeRelicData(BaseStruct): relicId: str equivalentGrade: int -class RoguelikeDifficultyUpgradeRelicGroupData(BaseModel): - relicData: list[RoguelikeDifficultyUpgradeRelicData] +class RoguelikeDifficultyUpgradeRelicGroupData(BaseStruct): + relicData: List[RoguelikeDifficultyUpgradeRelicData] -class RoguelikeTopicDetail(BaseModel): - updates: list[RoguelikeTopicUpdate] - enrolls: dict[str, RoguelikeTopicEnroll] - milestones: list[RoguelikeTopicBP] - milestoneUpdates: list[RoguelikeTopicMilestoneUpdateData] - grandPrizes: list[RoguelikeTopicBPGrandPrize] - monthMission: list[RoguelikeTopicMonthMission] - monthSquad: dict[str, RoguelikeTopicMonthSquad] - challenges: dict[str, RoguelikeTopicChallenge] - difficulties: list[RoguelikeTopicDifficulty] - bankRewards: list[RoguelikeTopicBankReward] +class RoguelikeTopicDetail(BaseStruct): + updates: List[RoguelikeTopicUpdate] + enrolls: Dict[str, RoguelikeTopicEnroll] + milestones: List[RoguelikeTopicBP] + milestoneUpdates: List[RoguelikeTopicMilestoneUpdateData] + grandPrizes: List[RoguelikeTopicBPGrandPrize] + monthMission: List[RoguelikeTopicMonthMission] + monthSquad: Dict[str, RoguelikeTopicMonthSquad] + challenges: Dict[str, RoguelikeTopicChallenge] + difficulties: List[RoguelikeTopicDifficulty] + bankRewards: List[RoguelikeTopicBankReward] archiveComp: RoguelikeArchiveComponentData archiveUnlockCond: RoguelikeArchiveUnlockCondData detailConst: RoguelikeTopicDetailConst - init: list[RoguelikeGameInitData] - stages: dict[str, RoguelikeGameStageData] - zones: dict[str, RoguelikeGameZoneData] - variation: dict[str, RoguelikeZoneVariationData] - traps: dict[str, RoguelikeGameTrapData] - recruitTickets: dict[str, RoguelikeGameRecruitTicketData] - upgradeTickets: dict[str, RoguelikeGameUpgradeTicketData] - customTickets: dict[str, RoguelikeGameCustomTicketData] - relics: dict[str, RoguelikeGameRelicData] - relicParams: dict[str, RoguelikeGameRelicParamData] - recruitGrps: dict[str, RoguelikeGameRecruitGrpData] - choices: dict[str, RoguelikeGameChoiceData] - choiceScenes: dict[str, RoguelikeGameChoiceSceneData] - nodeTypeData: dict[str, RoguelikeGameNodeTypeData] - subTypeData: list[RoguelikeGameNodeSubTypeData] - variationData: dict[str, RoguelikeGameVariationData] - charBuffData: dict[str, RoguelikeGameCharBuffData] - squadBuffData: dict[str, RoguelikeGameSquadBuffData] - taskData: dict[str, RoguelikeTaskData] + init: List[RoguelikeGameInitData] + stages: Dict[str, RoguelikeGameStageData] + zones: Dict[str, RoguelikeGameZoneData] + variation: Dict[str, RoguelikeZoneVariationData] + traps: Dict[str, RoguelikeGameTrapData] + recruitTickets: Dict[str, RoguelikeGameRecruitTicketData] + upgradeTickets: Dict[str, RoguelikeGameUpgradeTicketData] + customTickets: Dict[str, RoguelikeGameCustomTicketData] + relics: Dict[str, RoguelikeGameRelicData] + relicParams: Dict[str, RoguelikeGameRelicParamData] + recruitGrps: Dict[str, RoguelikeGameRecruitGrpData] + choices: Dict[str, RoguelikeGameChoiceData] + choiceScenes: Dict[str, RoguelikeGameChoiceSceneData] + nodeTypeData: Dict[str, RoguelikeGameNodeTypeData] + subTypeData: List[RoguelikeGameNodeSubTypeData] + variationData: Dict[str, RoguelikeGameVariationData] + charBuffData: Dict[str, RoguelikeGameCharBuffData] + squadBuffData: Dict[str, RoguelikeGameSquadBuffData] + taskData: Dict[str, RoguelikeTaskData] gameConst: RoguelikeGameConst - shopDialogs: dict[str, list[str]] - capsuleDict: dict[str, RoguelikeTopicCapsule] | None - endings: dict[str, RoguelikeGameEndingData] - battleSummeryDescriptions: dict[str, RoguelikeBattleSummeryDescriptionData] - battleLoadingTips: list[TipData] - items: dict[str, RoguelikeGameItemData] - bandRef: dict[str, RoguelikeBandRefData] - endingDetailList: list[RoguelikeEndingDetailText] - treasures: dict[str, list[RoguelikeGameTreasureData]] - difficultyUpgradeRelicGroups: dict[str, RoguelikeDifficultyUpgradeRelicGroupData] + shopDialogs: Dict[str, List[str]] + capsuleDict: Union[Dict[str, RoguelikeTopicCapsule], None] + endings: Dict[str, RoguelikeGameEndingData] + battleSummeryDescriptions: Dict[str, RoguelikeBattleSummeryDescriptionData] + battleLoadingTips: List[TipData] + items: Dict[str, RoguelikeGameItemData] + bandRef: Dict[str, RoguelikeBandRefData] + endingDetailList: List[RoguelikeEndingDetailText] + treasures: Dict[str, List[RoguelikeGameTreasureData]] + difficultyUpgradeRelicGroups: Dict[str, RoguelikeDifficultyUpgradeRelicGroupData] -class RoguelikeModuleBaseData(BaseModel): +class RoguelikeModuleBaseData(BaseStruct): moduleType: str -class RoguelikeSanRangeData(BaseModel): +class RoguelikeSanRangeData(BaseStruct): sanMax: int diceGroupId: str description: str sanDungeonEffect: str sanEffectRank: str - sanEndingDesc: str | None + sanEndingDesc: Union[str, None] -class RoguelikeSanCheckConsts(BaseModel): +class RoguelikeSanCheckConsts(BaseStruct): sanDecreaseToast: str class RoguelikeSanCheckModuleData(RoguelikeModuleBaseData): - sanRanges: list[RoguelikeSanRangeData] + sanRanges: List[RoguelikeSanRangeData] moduleConsts: RoguelikeSanCheckConsts -class RoguelikeDiceData(BaseModel): +class RoguelikeDiceData(BaseStruct): diceId: str description: str isUpgradeDice: int - upgradeDiceId: str | None + upgradeDiceId: Union[str, None] diceFaceCount: int battleDiceId: str -class RoguelikeDiceRuleData(BaseModel): +class RoguelikeDiceRuleData(BaseStruct): dicePointMax: int diceResultClass: str diceGroupId: str @@ -800,31 +804,31 @@ class RoguelikeDiceRuleData(BaseModel): sound: str -class RoguelikeDiceRuleGroupData(BaseModel): +class RoguelikeDiceRuleGroupData(BaseStruct): ruleGroupId: str minGoodNum: int -class RoguelikeDicePredefineData(BaseModel): +class RoguelikeDicePredefineData(BaseStruct): modeId: str modeGrade: int - predefinedId: str | None + predefinedId: Union[str, None] initialDiceCount: int class RoguelikeDiceModuleData(RoguelikeModuleBaseData): - dice: dict[str, RoguelikeDiceData] - diceEvents: dict[str, RoguelikeDiceRuleData] - diceChoices: dict[str, str] - diceRuleGroups: dict[str, RoguelikeDiceRuleGroupData] - dicePredefines: list[RoguelikeDicePredefineData] + dice: Dict[str, RoguelikeDiceData] + diceEvents: Dict[str, RoguelikeDiceRuleData] + diceChoices: Dict[str, str] + diceRuleGroups: Dict[str, RoguelikeDiceRuleGroupData] + dicePredefines: List[RoguelikeDicePredefineData] -class RoguelikeChaosData(BaseModel): +class RoguelikeChaosData(BaseStruct): chaosId: str level: int - nextChaosId: str | None - prevChaosId: str | None + nextChaosId: Union[str, None] + prevChaosId: Union[str, None] iconId: str name: str functionDesc: str @@ -833,17 +837,17 @@ class RoguelikeChaosData(BaseModel): sortId: int -class RoguelikeChaosRangeData(BaseModel): +class RoguelikeChaosRangeData(BaseStruct): chaosMax: int chaosDungeonEffect: str -class RoguelikeChaosPredefineLevelInfo(BaseModel): +class RoguelikeChaosPredefineLevelInfo(BaseStruct): chaosLevelBeginNum: int chaosLevelEndNum: int -class RoguelikeChaosModuleConsts(BaseModel): +class RoguelikeChaosModuleConsts(BaseStruct): maxChaosLevel: int maxChaosSlot: int chaosNotMaxDescription: str @@ -852,18 +856,18 @@ class RoguelikeChaosModuleConsts(BaseModel): class RoguelikeChaosModuleData(RoguelikeModuleBaseData): - chaosDatas: dict[str, RoguelikeChaosData] - chaosRanges: list[RoguelikeChaosRangeData] - levelInfoDict: dict[str, dict[str, RoguelikeChaosPredefineLevelInfo]] + chaosDatas: Dict[str, RoguelikeChaosData] + chaosRanges: List[RoguelikeChaosRangeData] + levelInfoDict: Dict[str, Dict[str, RoguelikeChaosPredefineLevelInfo]] moduleConsts: RoguelikeChaosModuleConsts -class RoguelikeTotemLinkedNodeTypeData(BaseModel): - effectiveNodeTypes: list[str] - blurNodeTypes: list[str] +class RoguelikeTotemLinkedNodeTypeData(BaseStruct): + effectiveNodeTypes: List[str] + blurNodeTypes: List[str] -class RoguelikeTotemBuffData(BaseModel): +class RoguelikeTotemBuffData(BaseStruct): totemId: str color: str pos: str @@ -883,7 +887,7 @@ class RoguelikeTotemBuffData(BaseModel): portalLinkedNodeTypeData: RoguelikeTotemLinkedNodeTypeData -class RoguelikeTotemSubBuffData(BaseModel): +class RoguelikeTotemSubBuffData(BaseStruct): subBuffId: str name: str desc: str @@ -891,21 +895,21 @@ class RoguelikeTotemSubBuffData(BaseModel): info: str -class RoguelikeTotemModuleConsts(BaseModel): +class RoguelikeTotemModuleConsts(BaseStruct): totemPredictDescription: str - colorCombineDesc: dict[str, str] + colorCombineDesc: Dict[str, str] bossCombineDesc: str battleNoPredictDescription: str shopNoGoodsDescription: str class RoguelikeTotemBuffModuleData(RoguelikeModuleBaseData): - totemBuffDatas: dict[str, RoguelikeTotemBuffData] - subBuffs: dict[str, RoguelikeTotemSubBuffData] + totemBuffDatas: Dict[str, RoguelikeTotemBuffData] + subBuffs: Dict[str, RoguelikeTotemSubBuffData] moduleConsts: RoguelikeTotemModuleConsts -class RoguelikeVisionData(BaseModel): +class RoguelikeVisionData(BaseStruct): sightNum: int level: int canForesee: bool @@ -917,12 +921,12 @@ class RoguelikeVisionData(BaseModel): icon: str -class RoguelikeVisionModuleDataVisionChoiceConfig(BaseModel): +class RoguelikeVisionModuleDataVisionChoiceConfig(BaseStruct): value: int - type_: int = Field(alias='type') + type_: int = field(name='type') -class RoguelikeVisionModuleConsts(BaseModel): +class RoguelikeVisionModuleConsts(BaseStruct): maxVision: int totemBottomDescription: str chestBottomDescription: str @@ -930,21 +934,21 @@ class RoguelikeVisionModuleConsts(BaseModel): class RoguelikeVisionModuleData(RoguelikeModuleBaseData): - visionDatas: dict[str, RoguelikeVisionData] - visionChoices: dict[str, RoguelikeVisionModuleDataVisionChoiceConfig] + visionDatas: Dict[str, RoguelikeVisionData] + visionChoices: Dict[str, RoguelikeVisionModuleDataVisionChoiceConfig] moduleConsts: RoguelikeVisionModuleConsts -class RoguelikeModule(BaseModel): - moduleTypes: list[str] - sanCheck: RoguelikeSanCheckModuleData | None - dice: RoguelikeDiceModuleData | None - chaos: RoguelikeChaosModuleData | None - totemBuff: RoguelikeTotemBuffModuleData | None - vision: RoguelikeVisionModuleData | None +class RoguelikeModule(BaseStruct): + moduleTypes: List[str] + sanCheck: Union[RoguelikeSanCheckModuleData, None] + dice: Union[RoguelikeDiceModuleData, None] + chaos: Union[RoguelikeChaosModuleData, None] + totemBuff: Union[RoguelikeTotemBuffModuleData, None] + vision: Union[RoguelikeVisionModuleData, None] -class RoguelikeTopicDisplayItem(BaseModel): +class RoguelikeTopicDisplayItem(BaseStruct): displayType: str displayNum: int displayForm: str @@ -952,26 +956,26 @@ class RoguelikeTopicDisplayItem(BaseModel): sortId: int -class RoguelikeTopicDev(BaseModel): +class RoguelikeTopicDev(BaseStruct): buffId: str sortId: int nodeType: str - nextNodeId: list[str] - frontNodeId: list[str] + nextNodeId: List[str] + frontNodeId: List[str] tokenCost: int buffName: str buffIconId: str buffTypeName: str - buffDisplayInfo: list[RoguelikeTopicDisplayItem] + buffDisplayInfo: List[RoguelikeTopicDisplayItem] -class RoguelikeTopicDevToken(BaseModel): +class RoguelikeTopicDevToken(BaseStruct): sortId: int displayForm: str tokenDesc: str -class RL01EndingText(BaseModel): +class RL01EndingText(BaseStruct): summaryVariation: str summaryDefeatBoss: str summaryAccidentMeet: str @@ -1005,17 +1009,17 @@ class RL01EndingText(BaseModel): summaryFailEnd: str -class RL01CustomizeData(BaseModel): - developments: dict[str, RoguelikeTopicDev] - developmentTokens: dict[str, RoguelikeTopicDevToken] +class RL01CustomizeData(BaseStruct): + developments: Dict[str, RoguelikeTopicDev] + developmentTokens: Dict[str, RoguelikeTopicDevToken] endingText: RL01EndingText -class RL02Development(BaseModel): +class RL02Development(BaseStruct): buffId: str nodeType: str - frontNodeId: list[str] - nextNodeId: list[str] + frontNodeId: List[str] + nextNodeId: List[str] positionP: int positionR: int tokenCost: int @@ -1023,29 +1027,29 @@ class RL02Development(BaseModel): buffIconId: str effectType: str rawDesc: str - buffDisplayInfo: list[RoguelikeTopicDisplayItem] - enrollId: str | None + buffDisplayInfo: List[RoguelikeTopicDisplayItem] + enrollId: Union[str, None] -class RL02DevRawTextBuffGroup(BaseModel): - nodeIdList: list[str] +class RL02DevRawTextBuffGroup(BaseStruct): + nodeIdList: List[str] useLevelMark: bool groupIconId: str useUpBreak: bool sortId: int -class RL02DevelopmentLine(BaseModel): +class RL02DevelopmentLine(BaseStruct): fromNode: str toNode: str fromNodeP: int fromNodeR: int toNodeP: int toNodeR: int - enrollId: str | None + enrollId: Union[str, None] -class RL02EndingText(BaseModel): +class RL02EndingText(BaseStruct): summaryMutation: str summaryDice: str summaryDiceResultGood: str @@ -1071,50 +1075,50 @@ class RL02EndingText(BaseModel): summaryPracticeLowDesc: str -class RL02CustomizeData(BaseModel): - developments: dict[str, RL02Development] - developmentTokens: dict[str, RoguelikeTopicDevToken] - developmentRawTextGroup: list[RL02DevRawTextBuffGroup] - developmentLines: list[RL02DevelopmentLine] +class RL02CustomizeData(BaseStruct): + developments: Dict[str, RL02Development] + developmentTokens: Dict[str, RoguelikeTopicDevToken] + developmentRawTextGroup: List[RL02DevRawTextBuffGroup] + developmentLines: List[RL02DevelopmentLine] endingText: RL02EndingText -class RL03Development(BaseModel): +class RL03Development(BaseStruct): buffId: str nodeType: str - frontNodeId: list[str] - nextNodeId: list[str] + frontNodeId: List[str] + nextNodeId: List[str] positionRow: int positionOrder: int tokenCost: int buffName: str buffIconId: str effectType: str - rawDesc: list[str] - buffDisplayInfo: list[RoguelikeTopicDisplayItem] + rawDesc: List[str] + buffDisplayInfo: List[RoguelikeTopicDisplayItem] groupId: str - enrollId: str | None + enrollId: Union[str, None] -class RL03DevRawTextBuffGroup(BaseModel): - nodeIdList: list[str] +class RL03DevRawTextBuffGroup(BaseStruct): + nodeIdList: List[str] useLevelMark: bool groupIconId: str sortId: int -class RL03DevDifficultyNodePairInfo(BaseModel): +class RL03DevDifficultyNodePairInfo(BaseStruct): frontNode: str nextNode: str -class RL03DevDifficultyNodeInfo(BaseModel): +class RL03DevDifficultyNodeInfo(BaseStruct): buffId: str - nodeMap: list[RL03DevDifficultyNodePairInfo] + nodeMap: List[RL03DevDifficultyNodePairInfo] enableGrade: int -class RL03EndingText(BaseModel): +class RL03EndingText(BaseStruct): summaryGetTotem: str summaryDemoPointUp: str summaryDemoPointDown: str @@ -1160,38 +1164,35 @@ class RL03EndingText(BaseModel): summaryFailEnd: str -class RL03DifficultyExt(BaseModel): +class RL03DifficultyExt(BaseStruct): modeDifficulty: str grade: int - totemProb: int | float + totemProb: Union[int, float] relicDevLevel: str - buffs: list[str] | None - buffDesc: list[str] + buffs: Union[List[str], None] + buffDesc: List[str] -class RL03CustomizeData(BaseModel): - developments: dict[str, RL03Development] - developmentsTokens: dict[str, RoguelikeTopicDevToken] - developmentRawTextGroup: list[RL03DevRawTextBuffGroup] - developmentsDifficultyNodeInfos: dict[str, RL03DevDifficultyNodeInfo] +class RL03CustomizeData(BaseStruct): + developments: Dict[str, RL03Development] + developmentsTokens: Dict[str, RoguelikeTopicDevToken] + developmentRawTextGroup: List[RL03DevRawTextBuffGroup] + developmentsDifficultyNodeInfos: Dict[str, RL03DevDifficultyNodeInfo] endingText: RL03EndingText - difficulties: list[RL03DifficultyExt] + difficulties: List[RL03DifficultyExt] -class RoguelikeTopicCustomizeData(BaseModel): +class RoguelikeTopicCustomizeData(BaseStruct): rogue_1: RL01CustomizeData rogue_2: RL02CustomizeData - rogue_3: RL03CustomizeData | None = None + rogue_3: RL03CustomizeData -class RoguelikeTopicTable(BaseModel): +class RoguelikeTopicTable(BaseStruct): __version__ = '23-04-23-15-07-53-24a81c' - topics: dict[str, RoguelikeTopicBasicData] + topics: Dict[str, RoguelikeTopicBasicData] constant: RoguelikeTopicConst - details: dict[str, RoguelikeTopicDetail] - modules: dict[str, RoguelikeModule] + details: Dict[str, RoguelikeTopicDetail] + modules: Dict[str, RoguelikeModule] customizeData: RoguelikeTopicCustomizeData - - class Config: - extra = 'allow' diff --git a/ArknightsUID/utils/models/gamedata/SandboxTable.py b/ArknightsUID/utils/models/gamedata/SandboxTable.py index 7a4b223..f9cf03e 100644 --- a/ArknightsUID/utils/models/gamedata/SandboxTable.py +++ b/ArknightsUID/utils/models/gamedata/SandboxTable.py @@ -1,8 +1,10 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class SandboxMapConstTable(BaseModel): - directionNames: list[str] +class SandboxMapConstTable(BaseStruct): + directionNames: List[str] homeNodeStageId: str homeRushStageCode: str homeRushStageName: str @@ -11,11 +13,11 @@ class SandboxMapConstTable(BaseModel): homeBuildModeBGM: str -class SandboxBaseConstTable(BaseModel): +class SandboxBaseConstTable(BaseStruct): cookRegularCostItemId: str cookRegularCostItemIdCnt: int - squadTabNameList: list[str] - charRarityColorList: list[str] + squadTabNameList: List[str] + charRarityColorList: List[str] sumFoodLimitedCount: int sumBuildingLimitedCount: int sumTacticalLimitedCount: int @@ -44,69 +46,69 @@ class SandboxBaseConstTable(BaseModel): settleSucDesc: str -class TipData(BaseModel): +class TipData(BaseStruct): tip: str - weight: int | float + weight: Union[int, float] category: str -class SandboxFoodProduceData(BaseModel): +class SandboxFoodProduceData(BaseStruct): itemId: str - mainMaterialItems: list[str] + mainMaterialItems: List[str] buffId: str unlockDesc: str -class SandboxFoodmatBuffData(BaseModel): +class SandboxFoodmatBuffData(BaseStruct): itemId: str - buffId: str | None - buffDesc: str | None + buffId: Union[str, None] + buffDesc: Union[str, None] matType: str sortId: int -class SandboxFoodStaminaData(BaseModel): +class SandboxFoodStaminaData(BaseStruct): itemId: str potCnt: int foodStaminaCnt: int -class SandboxBuildProduceData(BaseModel): +class SandboxBuildProduceData(BaseStruct): itemProduceId: str itemId: str itemTypeText: str - materialItems: dict[str, int] + materialItems: Dict[str, int] -class SandboxBuildGoldRatioData(BaseModel): +class SandboxBuildGoldRatioData(BaseStruct): itemId: str ratio: int effectDesc: str -class SandboxBuildingItemData(BaseModel): +class SandboxBuildingItemData(BaseStruct): itemId: str itemSubType: str itemRarity: int -class SandboxBuildProduceUnlockData(BaseModel): +class SandboxBuildProduceUnlockData(BaseStruct): itemId: str buildingEffectDesc: str buildingItemDesc: str buildingUnlockDesc: str -class SandboxCraftItemData(BaseModel): +class SandboxCraftItemData(BaseStruct): itemId: str sortId: int getFrom: str - npcId: str | None + npcId: Union[str, None] notObtainedDesc: str itemType: str -class SandboxItemTrapData(BaseModel): +class SandboxItemTrapData(BaseStruct): itemId: str trapId: str trapPhase: int @@ -115,87 +117,87 @@ class SandboxItemTrapData(BaseModel): skillLevel: int -class SandboxDevelopmentData(BaseModel): +class SandboxDevelopmentData(BaseStruct): buffId: str positionX: int positionY: int - frontNodeId: str | None - nextNodeIds: list[str] | None + frontNodeId: Union[str, None] + nextNodeIds: Union[List[str], None] buffLimitedId: str tokenCost: int canBuffResearch: bool - buffResearchDesc: str | None + buffResearchDesc: Union[str, None] buffName: str buffIconId: str nodeTitle: str buffEffectDesc: str -class SandboxDevelopmentLimitData(BaseModel): +class SandboxDevelopmentLimitData(BaseStruct): buffLimitedId: str positionX: int buffCostLimitedCount: int -class SandboxItemToastData(BaseModel): +class SandboxItemToastData(BaseStruct): itemType: str toastDesc: str color: str -class SandboxDevelopmentLineSegmentData(BaseModel): +class SandboxDevelopmentLineSegmentData(BaseStruct): fromNodeId: str - passingNodeIds: list[str] + passingNodeIds: List[str] fromAxisPosX: int fromAxisPosY: int toAxisPosX: int toAxisPosY: int -class SandboxRewardItemConfigData(BaseModel): +class SandboxRewardItemConfigData(BaseStruct): rewardItem: str rewardType: str -class SandboxRewardData(BaseModel): - rewardList: list[SandboxRewardItemConfigData] +class SandboxRewardData(BaseStruct): + rewardList: List[SandboxRewardItemConfigData] -class SandboxRewardCommonConfig(BaseModel): - dropType: int | None = None +class SandboxRewardCommonConfig(BaseStruct): rewardItemId: str rewardItemType: str count: int + dropType: Union[int, None] = None class SandboxTrapRewardConfigData(SandboxRewardCommonConfig): dropType: int -class SandboxRewardConfigGroupData(BaseModel): - stagePreviewRewardDict: dict[str, SandboxRewardData] - stageDefaultPreviewRewardDict: dict[str, SandboxRewardData] - rushPreviewRewardDict: dict[str, SandboxRewardData] - stageRewardDict: dict[str, SandboxRewardData] - rushRewardDict: dict[str, SandboxRewardData] - trapRewardDict: dict[str, SandboxRewardCommonConfig] - enemyRewardDict: dict[str, SandboxRewardCommonConfig] - keyWordData: dict[str, str] +class SandboxRewardConfigGroupData(BaseStruct): + stagePreviewRewardDict: Dict[str, SandboxRewardData] + stageDefaultPreviewRewardDict: Dict[str, SandboxRewardData] + rushPreviewRewardDict: Dict[str, SandboxRewardData] + stageRewardDict: Dict[str, SandboxRewardData] + rushRewardDict: Dict[str, SandboxRewardData] + trapRewardDict: Dict[str, SandboxRewardCommonConfig] + enemyRewardDict: Dict[str, SandboxRewardCommonConfig] + keyWordData: Dict[str, str] -class SandboxStaminaData(BaseModel): +class SandboxStaminaData(BaseStruct): levelUpperLimit: int staminaUpperLimit: int -class SandboxNodeTypeData(BaseModel): +class SandboxNodeTypeData(BaseStruct): nodeType: str name: str subName: str iconId: str -class SandboxNodeUpgradeData(BaseModel): +class SandboxNodeUpgradeData(BaseStruct): nodeUpdradeId: str name: str description: str @@ -206,7 +208,7 @@ class SandboxNodeUpgradeData(BaseModel): itemRarity: int -class SandboxWeatherData(BaseModel): +class SandboxWeatherData(BaseStruct): weatherId: str weatherType: str weatherLevel: int @@ -218,7 +220,7 @@ class SandboxWeatherData(BaseModel): buffId: str -class SandboxStageData(BaseModel): +class SandboxStageData(BaseStruct): stageId: str levelId: str code: str @@ -229,157 +231,158 @@ class SandboxStageData(BaseModel): powerCost: int -class SandboxEventData(BaseModel): +class SandboxEventData(BaseStruct): eventSceneId: str hasThumbtack: bool -class SandboxEventSceneData(BaseModel): +class SandboxEventSceneData(BaseStruct): choiceSceneId: str - type_: str = Field(alias='type') + type_: str = field(name='type') title: str description: str - choices: list[str] + choices: List[str] -class SandboxEventChoiceData(BaseModel): +class SandboxEventChoiceData(BaseStruct): choiceId: str - type_: str = Field(alias='type') + type_: str = field(name='type') costAction: int finishScene: bool title: str description: str -class SandboxEventTypeData(BaseModel): +class SandboxEventTypeData(BaseStruct): eventType: str iconId: str -class SandboxMissionData(BaseModel): +class SandboxMissionData(BaseStruct): missionId: str desc: str - effectDesc: str | None + effectDesc: Union[str, None] costAction: int charCnt: int - professionIds: list[str] + professionIds: List[str] profession: int costStamina: int -class SandboxUnitData(BaseModel): - id_: str = Field(alias='id') +class SandboxUnitData(BaseStruct): + id_: str = field(name='id') name: str -class SandboxDailyDescTemplateData(BaseModel): - type_: str = Field(alias='type') - templateDesc: list[str] +class SandboxDailyDescTemplateData(BaseStruct): + type_: str = field(name='type') + templateDesc: List[str] -class RushEnemyConfig(BaseModel): +class RushEnemyConfig(BaseStruct): enemyKey: str branchId: str count: int - interval: int | float + interval: Union[int, float] -class RushEnemyGroupConfig(BaseModel): +class RushEnemyGroupConfig(BaseStruct): enemyGroupKey: str weight: int - enemy: list[RushEnemyConfig] - dynamicEnemy: list[str] + enemy: List[RushEnemyConfig] + dynamicEnemy: List[str] -class RushEnemyGroupRushEnemyDBRef(BaseModel): - id_: str = Field(alias='id') +class RushEnemyGroupRushEnemyDBRef(BaseStruct): + id_: str = field(name='id') level: int -class RushEnemyGroup(BaseModel): - rushEnemyGroupConfigs: dict[str, list[RushEnemyGroupConfig]] - rushEnemyDbRef: list[RushEnemyGroupRushEnemyDBRef] +class RushEnemyGroup(BaseStruct): + rushEnemyGroupConfigs: Dict[str, List[RushEnemyGroupConfig]] + rushEnemyDbRef: List[RushEnemyGroupRushEnemyDBRef] -class RuneDataSelector(BaseModel): +class RuneDataSelector(BaseStruct): professionMask: int buildableMask: int - charIdFilter: list[str] | None - enemyIdFilter: list[str] | None - enemyIdExcludeFilter: list[str] | None - skillIdFilter: list[str] | None - tileKeyFilter: list[str] | None - groupTagFilter: list[str] | None - filterTagFilter: list[str] | None + charIdFilter: Union[List[str], None] + enemyIdFilter: Union[List[str], None] + enemyIdExcludeFilter: Union[List[str], None] + skillIdFilter: Union[List[str], None] + tileKeyFilter: Union[List[str], None] + groupTagFilter: Union[List[str], None] + filterTagFilter: Union[List[str], None] + subProfessionExcludeFilter: Union[List[str], None] -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: int | float | None = None - valueStr: str | None = None + value: Union[Union[int, float], None] = None + valueStr: Union[str, None] = None -class RuneData(BaseModel): +class RuneData(BaseStruct): key: str selector: RuneDataSelector - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class RuneTablePackedRuneData(BaseModel): - id_: str = Field(alias='id') - points: int | float - mutexGroupKey: str | None +class RuneTablePackedRuneData(BaseStruct): + id_: str = field(name='id') + points: Union[int, float] + mutexGroupKey: Union[str, None] description: str - runes: list[RuneData] + runes: List[RuneData] -class LegacyInLevelRuneData(BaseModel): +class LegacyInLevelRuneData(BaseStruct): difficultyMask: int key: str professionMask: int buildableMask: int - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class SandboxActTable(BaseModel): +class SandboxActTable(BaseStruct): mapConstTable: SandboxMapConstTable baseConstTable: SandboxBaseConstTable - battleLoadingTips: list[TipData] - foodProduceDatas: dict[str, SandboxFoodProduceData] - foodmatDatas: dict[str, SandboxFoodmatBuffData] - foodmatBuffDatas: dict[str, SandboxFoodmatBuffData] - foodStaminaDatas: dict[str, SandboxFoodStaminaData] - buildProduceDatas: dict[str, SandboxBuildProduceData] - buildGoldRatioDatas: list[SandboxBuildGoldRatioData] - buildingItemDatas: dict[str, SandboxBuildingItemData] - buildProduceUnlockDatas: dict[str, SandboxBuildProduceUnlockData] - craftItemDatas: dict[str, SandboxCraftItemData] - itemTrapDatas: dict[str, SandboxItemTrapData] - trapDeployLimitDatas: dict[str, int] - developmentDatas: dict[str, SandboxDevelopmentData] - developmentLimitDatas: dict[str, SandboxDevelopmentLimitData] - itemToastDatas: dict[str, SandboxItemToastData] - developmentLineSegmentDatas: list[SandboxDevelopmentLineSegmentData] + battleLoadingTips: List[TipData] + foodProduceDatas: Dict[str, SandboxFoodProduceData] + foodmatDatas: Dict[str, SandboxFoodmatBuffData] + foodmatBuffDatas: Dict[str, SandboxFoodmatBuffData] + foodStaminaDatas: Dict[str, SandboxFoodStaminaData] + buildProduceDatas: Dict[str, SandboxBuildProduceData] + buildGoldRatioDatas: List[SandboxBuildGoldRatioData] + buildingItemDatas: Dict[str, SandboxBuildingItemData] + buildProduceUnlockDatas: Dict[str, SandboxBuildProduceUnlockData] + craftItemDatas: Dict[str, SandboxCraftItemData] + itemTrapDatas: Dict[str, SandboxItemTrapData] + trapDeployLimitDatas: Dict[str, int] + developmentDatas: Dict[str, SandboxDevelopmentData] + developmentLimitDatas: Dict[str, SandboxDevelopmentLimitData] + itemToastDatas: Dict[str, SandboxItemToastData] + developmentLineSegmentDatas: List[SandboxDevelopmentLineSegmentData] rewardConfigDatas: SandboxRewardConfigGroupData - charStaminaMapping: dict[str, dict[str, list[SandboxStaminaData]]] - nodeTypeDatas: dict[str, SandboxNodeTypeData] - nodeUpgradeDatas: dict[str, SandboxNodeUpgradeData] - weatherDatas: dict[str, SandboxWeatherData] - stageDatas: dict[str, SandboxStageData] - eventDatas: dict[str, SandboxEventData] - eventSceneDatas: dict[str, SandboxEventSceneData] - eventChoiceDatas: dict[str, SandboxEventChoiceData] - eventTypeDatas: dict[str, SandboxEventTypeData] - missionDatas: dict[str, SandboxMissionData] - unitData: dict[str, SandboxUnitData] - dailyDescTemplateDatas: dict[str, SandboxDailyDescTemplateData] - rushAvgDict: dict[str, str] + charStaminaMapping: Dict[str, Dict[str, List[SandboxStaminaData]]] + nodeTypeDatas: Dict[str, SandboxNodeTypeData] + nodeUpgradeDatas: Dict[str, SandboxNodeUpgradeData] + weatherDatas: Dict[str, SandboxWeatherData] + stageDatas: Dict[str, SandboxStageData] + eventDatas: Dict[str, SandboxEventData] + eventSceneDatas: Dict[str, SandboxEventSceneData] + eventChoiceDatas: Dict[str, SandboxEventChoiceData] + eventTypeDatas: Dict[str, SandboxEventTypeData] + missionDatas: Dict[str, SandboxMissionData] + unitData: Dict[str, SandboxUnitData] + dailyDescTemplateDatas: Dict[str, SandboxDailyDescTemplateData] + rushAvgDict: Dict[str, str] rushEnemyGroup: RushEnemyGroup - runeDatas: dict[str, RuneTablePackedRuneData] - itemRuneList: dict[str, list[LegacyInLevelRuneData]] + runeDatas: Dict[str, RuneTablePackedRuneData] + itemRuneList: Dict[str, List[LegacyInLevelRuneData]] -class SandboxItemData(BaseModel): +class SandboxItemData(BaseStruct): itemId: str itemType: str itemName: str @@ -387,13 +390,13 @@ class SandboxItemData(BaseModel): itemDesc: str itemRarity: int sortId: int - recommendTypeList: list[str] | None + recommendTypeList: Union[List[str], None] recommendPriority: int obtainApproach: str -class SandboxTable(BaseModel): +class SandboxTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - sandboxActTables: dict[str, SandboxActTable] - itemDatas: dict[str, SandboxItemData] + sandboxActTables: Dict[str, SandboxActTable] + itemDatas: Dict[str, SandboxItemData] diff --git a/ArknightsUID/utils/models/gamedata/ShopClientTable.py b/ArknightsUID/utils/models/gamedata/ShopClientTable.py index 68f94b9..685906b 100644 --- a/ArknightsUID/utils/models/gamedata/ShopClientTable.py +++ b/ArknightsUID/utils/models/gamedata/ShopClientTable.py @@ -1,26 +1,28 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ShopRecommendData(BaseModel): +class ShopRecommendData(BaseStruct): imgId: str slotIndex: int cmd: str - param1: str | None - param2: str | None - skinId: str | None + param1: Union[str, None] + param2: Union[str, None] + skinId: Union[str, None] -class ShopRecommendGroup(BaseModel): - recommendGroup: list[int] - dataList: list[ShopRecommendData] +class ShopRecommendGroup(BaseStruct): + recommendGroup: List[int] + dataList: List[ShopRecommendData] -class ShopKeeperWord(BaseModel): - id_: str = Field(alias='id') +class ShopKeeperWord(BaseStruct): + id_: str = field(name='id') text: str -class ShopRecommendItem(BaseModel): +class ShopRecommendItem(BaseStruct): tagId: str displayType: str tagName: str @@ -28,81 +30,81 @@ class ShopRecommendItem(BaseModel): orderNum: int startDatetime: int endDatetime: int - groupList: list[ShopRecommendGroup] + groupList: List[ShopRecommendGroup] tagWord: ShopKeeperWord -class ShopCreditUnlockItem(BaseModel): +class ShopCreditUnlockItem(BaseStruct): sortId: int unlockNum: int charId: str -class ShopCreditUnlockGroup(BaseModel): - id_: str = Field(alias='id') +class ShopCreditUnlockGroup(BaseStruct): + id_: str = field(name='id') index: str startDateTime: int - charDict: list[ShopCreditUnlockItem] + charDict: List[ShopCreditUnlockItem] -class ShopClientDataShopKeeperData(BaseModel): - welcomeWords: list[ShopKeeperWord] - clickWords: list[ShopKeeperWord] +class ShopClientDataShopKeeperData(BaseStruct): + welcomeWords: List[ShopKeeperWord] + clickWords: List[ShopKeeperWord] -class ShopCarouselDataItem(BaseModel): +class ShopCarouselDataItem(BaseStruct): spriteId: str startTime: int endTime: int cmd: str - param1: str | None + param1: Union[str, None] skinId: str furniId: str -class ShopCarouselData(BaseModel): - items: list[ShopCarouselDataItem] +class ShopCarouselData(BaseStruct): + items: List[ShopCarouselDataItem] -class ChooseShopRelation(BaseModel): +class ChooseShopRelation(BaseStruct): goodId: str - optionList: list[str] + optionList: List[str] -class ShopClientGPData(BaseModel): +class ShopClientGPData(BaseStruct): goodId: str displayName: str condTrigPackageType: str -class LMTGSShopSchedule(BaseModel): +class LMTGSShopSchedule(BaseStruct): gachaPoolId: str LMTGSId: str iconColor: str iconBackColor: str - storeTextColor: str | None = None startTime: int endTime: int + storeTextColor: Union[str, None] = None -class LMTGSShopOverlaySchedule(BaseModel): +class LMTGSShopOverlaySchedule(BaseStruct): gachaPoolId1: str gachaPoolId2: str picId: str -class ShopClientTable(BaseModel): +class ShopClientTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - recommendList: list[ShopRecommendItem] - creditUnlockGroup: dict[str, ShopCreditUnlockGroup] + recommendList: List[ShopRecommendItem] + creditUnlockGroup: Dict[str, ShopCreditUnlockGroup] shopKeeperData: ShopClientDataShopKeeperData - carousels: list[ShopCarouselData] - chooseShopRelations: list[ChooseShopRelation] - shopUnlockDict: dict[str, str] - extraQCShopRule: list[str] - repQCShopRule: list[str] - shopGPDataDict: dict[str, ShopClientGPData] + carousels: List[ShopCarouselData] + chooseShopRelations: List[ChooseShopRelation] + shopUnlockDict: Dict[str, str] + extraQCShopRule: List[str] + repQCShopRule: List[str] + shopGPDataDict: Dict[str, ShopClientGPData] shopMonthlySubGoodId: str - ls: list[LMTGSShopSchedule] - os: list[LMTGSShopOverlaySchedule] + ls: List[LMTGSShopSchedule] + os: List[LMTGSShopOverlaySchedule] diff --git a/ArknightsUID/utils/models/gamedata/SkillTable.py b/ArknightsUID/utils/models/gamedata/SkillTable.py index 2d80562..67a314e 100644 --- a/ArknightsUID/utils/models/gamedata/SkillTable.py +++ b/ArknightsUID/utils/models/gamedata/SkillTable.py @@ -1,51 +1,50 @@ - -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field +from msgspec import json as msgjson -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class SpData(BaseModel): +class SpData(BaseStruct): spType: int - levelUpCost: list[ItemBundle] | None + levelUpCost: Union[List[ItemBundle], None] maxChargeTime: int spCost: int initSp: int - increment: int | float + increment: Union[int, float] -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: int | float | None = None - valueStr: str | None = None + value: Union[Union[int, float], None] = None + valueStr: Union[str, None] = None -class SkillDataBundleLevelData(BaseModel): +class SkillDataBundleLevelData(BaseStruct): name: str - rangeId: str | None - description: str | None + rangeId: Union[str, None] + description: Union[str, None] skillType: int durationType: int spData: SpData - prefabId: str | None - duration: int | float - blackboard: list[Blackboard] + prefabId: Union[str, None] + duration: Union[int, float] + blackboard: List[Blackboard] -class SkillDataBundle(BaseModel): +class SkillDataBundle(BaseStruct): skillId: str - iconId: str | None + iconId: Union[str, None] hidden: bool - levels: list[SkillDataBundleLevelData] + levels: List[SkillDataBundleLevelData] -class SkillTable(BaseModel): +class SkillTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - skills: dict[str, SkillDataBundle] - - def __init__(self, data: dict) -> None: - super().__init__(skills=data) + skills: Dict[str, SkillDataBundle] diff --git a/ArknightsUID/utils/models/gamedata/SkinTable.py b/ArknightsUID/utils/models/gamedata/SkinTable.py index 92f3976..db6776b 100644 --- a/ArknightsUID/utils/models/gamedata/SkinTable.py +++ b/ArknightsUID/utils/models/gamedata/SkinTable.py @@ -1,89 +1,90 @@ - -from pydantic import BaseModel +from typing import Dict, List, Union +from ..common import BaseStruct -class CharSkinDataTokenSkinInfo(BaseModel): +class CharSkinDataTokenSkinInfo(BaseStruct): tokenId: str tokenSkinId: str -class CharSkinDataBattleSkin(BaseModel): +class CharSkinDataBattleSkin(BaseStruct): overwritePrefab: bool - skinOrPrefabId: str | None + skinOrPrefabId: Union[str, None] -class CharSkinDataDisplaySkin(BaseModel): - skinName: str | None - colorList: list[str] | None - titleList: list[str] | None - modelName: str | None - drawerList: list[str] | None - designerList: list[str] | None - skinGroupId: str | None - skinGroupName: str | None +class CharSkinDataDisplaySkin(BaseStruct): + skinName: Union[str, None] + colorList: Union[List[str], None] + titleList: Union[List[str], None] + modelName: Union[str, None] + drawerList: Union[List[str], None] + designerList: Union[List[str], None] + skinGroupId: Union[str, None] + skinGroupName: Union[str, None] skinGroupSortIndex: int - content: str | None - dialog: str | None - usage: str | None - description: str | None - obtainApproach: str | None + content: Union[str, None] + dialog: Union[str, None] + usage: Union[str, None] + description: Union[str, None] + obtainApproach: Union[str, None] sortId: int - displayTagId: str | None + displayTagId: Union[str, None] getTime: int onYear: int onPeriod: int -class CharSkinData(BaseModel): +class CharSkinData(BaseStruct): skinId: str charId: str - tokenSkinMap: list[CharSkinDataTokenSkinInfo] | None - illustId: str | None - dynIllustId: str | None + tokenSkinMap: Union[List[CharSkinDataTokenSkinInfo], None] + illustId: Union[str, None] + dynIllustId: Union[str, None] avatarId: str - portraitId: str | None - dynPortraitId: str | None - dynEntranceId: str | None - buildingId: str | None + portraitId: Union[str, None] + dynPortraitId: Union[str, None] + dynEntranceId: Union[str, None] + buildingId: Union[str, None] battleSkin: CharSkinDataBattleSkin isBuySkin: bool - tmplId: str | None - voiceId: str | None + tmplId: Union[str, None] + voiceId: Union[str, None] voiceType: str displaySkin: CharSkinDataDisplaySkin -class CharSkinGroupInfo(BaseModel): +class CharSkinGroupInfo(BaseStruct): skinGroupId: str publishTime: int -class CharSkinKvImgInfo(BaseModel): +class CharSkinKvImgInfo(BaseStruct): kvImgId: str linkedSkinGroupId: str -class CharSkinBrandInfo(BaseModel): +class CharSkinBrandInfo(BaseStruct): brandId: str - groupList: list[CharSkinGroupInfo] - kvImgIdList: list[CharSkinKvImgInfo] + groupList: List[CharSkinGroupInfo] + kvImgIdList: List[CharSkinKvImgInfo] brandName: str brandCapitalName: str description: str + publishTime: int sortId: int -class SpecialSkinInfo(BaseModel): +class SpecialSkinInfo(BaseStruct): skinId: str startTime: int endTime: int -class SkinTable(BaseModel): +class SkinTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - charSkins: dict[str, CharSkinData] - buildinEvolveMap: dict[str, dict[str, str]] - buildinPatchMap: dict[str, dict[str, str]] - brandList: dict[str, CharSkinBrandInfo] - specialSkinInfoList: list[SpecialSkinInfo] + charSkins: Dict[str, CharSkinData] + buildinEvolveMap: Dict[str, Dict[str, str]] + buildinPatchMap: Dict[str, Dict[str, str]] + brandList: Dict[str, CharSkinBrandInfo] + specialSkinInfoList: List[SpecialSkinInfo] diff --git a/ArknightsUID/utils/models/gamedata/StageTable.py b/ArknightsUID/utils/models/gamedata/StageTable.py index ee090b6..c5a863f 100644 --- a/ArknightsUID/utils/models/gamedata/StageTable.py +++ b/ArknightsUID/utils/models/gamedata/StageTable.py @@ -1,80 +1,82 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class StageDataConditionDesc(BaseModel): +class StageDataConditionDesc(BaseStruct): stageId: str completeState: int -class StageDataDisplayRewards(BaseModel): - type_: str = Field(alias='type') - id_: str = Field(alias='id') +class StageDataDisplayRewards(BaseStruct): + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class StageDataDisplayDetailRewards(BaseModel): +class StageDataDisplayDetailRewards(BaseStruct): occPercent: int - type_: str = Field(alias='type') - id_: str = Field(alias='id') + type_: str = field(name='type') + id_: str = field(name='id') dropType: int -class StageDataStageDropInfo(BaseModel): +class StageDataStageDropInfo(BaseStruct): firstPassRewards: None firstCompleteRewards: None passRewards: None completeRewards: None - displayRewards: list[StageDataDisplayRewards] - displayDetailRewards: list[StageDataDisplayDetailRewards] + displayRewards: List[StageDataDisplayRewards] + displayDetailRewards: List[StageDataDisplayDetailRewards] -class ExtraCondition(BaseModel): +class ExtraCondition(BaseStruct): index: int template: str - unlockParam: list[str] + unlockParam: List[str] -class ProgressInfo(BaseModel): +class ProgressInfo(BaseStruct): progressType: str - descList: dict[str, str] | None + descList: Union[Dict[str, str], None] -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class ExtraInfo(BaseModel): +class ExtraInfo(BaseStruct): stageId: str - rewards: list[ItemBundle] + rewards: List[ItemBundle] progressInfo: ProgressInfo -class StageData(BaseModel): +class StageData(BaseStruct): stageType: str difficulty: str performanceStageFlag: str diffGroup: str - unlockCondition: list[StageDataConditionDesc] + unlockCondition: List[StageDataConditionDesc] stageId: str - levelId: str | None + levelId: Union[str, None] zoneId: str code: str - name: str | None - description: str | None - hardStagedId: str | None - dangerLevel: str | None - dangerPoint: int | float + name: Union[str, None] + description: Union[str, None] + hardStagedId: Union[str, None] + dangerLevel: Union[str, None] + dangerPoint: Union[int, float] loadingPicId: str canPractice: bool canBattleReplay: bool apCost: int apFailReturn: int - etItemId: str | None + etItemId: Union[str, None] etCost: int etFailReturn: int - etButtonStyle: str | None + etButtonStyle: Union[str, None] apProtectTimes: int diamondOnceDrop: int practiceTicketCost: int @@ -86,7 +88,7 @@ class StageData(BaseModel): passFavor: int completeFavor: int slProgress: int - displayMainItem: str | None + displayMainItem: Union[str, None] hilightMark: bool bossMark: bool isPredefined: bool @@ -95,65 +97,65 @@ class StageData(BaseModel): isStoryOnly: bool appearanceStyle: int stageDropInfo: StageDataStageDropInfo - canUseCharm: bool | None = None - canUseTech: bool | None = None - canUseTrapTool: bool | None = None - canUseBattlePerformance: bool | None = None - startButtonOverrideId: str | None + startButtonOverrideId: Union[str, None] isStagePatch: bool - mainStageId: str | None - extraCondition: list[ExtraCondition] | None = None - extraInfo: list[ExtraInfo] | None = None + mainStageId: Union[str, None] + canUseCharm: Union[bool, None] = None + canUseTech: Union[bool, None] = None + canUseTrapTool: Union[bool, None] = None + canUseBattlePerformance: Union[bool, None] = None + extraCondition: Union[List[ExtraCondition], None] = None + extraInfo: Union[List[ExtraInfo], None] = None -class RuneStageGroupDataRuneStageInst(BaseModel): +class RuneStageGroupDataRuneStageInst(BaseStruct): stageId: str - activePackedRuneIds: list[str] + activePackedRuneIds: List[str] -class RuneStageGroupData(BaseModel): +class RuneStageGroupData(BaseStruct): groupId: str - activeRuneStages: list[RuneStageGroupDataRuneStageInst] + activeRuneStages: List[RuneStageGroupDataRuneStageInst] startTs: int endTs: int -class MapThemeData(BaseModel): +class MapThemeData(BaseStruct): themeId: str unitColor: str - buildableColor: str | None - themeType: str | None - trapTintColor: str | None + buildableColor: Union[str, None] + themeType: Union[str, None] + trapTintColor: Union[str, None] -class TileAppendInfo(BaseModel): +class TileAppendInfo(BaseStruct): tileKey: str name: str description: str isFunctional: bool -class WeeklyForceOpenTable(BaseModel): - id_: str = Field(alias='id') +class WeeklyForceOpenTable(BaseStruct): + id_: str = field(name='id') startTime: int endTime: int - forceOpenList: list[str] + forceOpenList: List[str] -class TimelyDropTimeInfo(BaseModel): +class TimelyDropTimeInfo(BaseStruct): startTs: int endTs: int - stagePic: str | None - dropPicId: str | None + stagePic: Union[str, None] + dropPicId: Union[str, None] stageUnlock: str - entranceDownPicId: str | None - entranceUpPicId: str | None + entranceDownPicId: Union[str, None] + entranceUpPicId: Union[str, None] timelyGroupId: str - weeklyPicId: str | None - apSupplyOutOfDateDict: dict[str, int] + weeklyPicId: Union[str, None] + apSupplyOutOfDateDict: Dict[str, int] -class OverrideDropInfo(BaseModel): +class OverrideDropInfo(BaseStruct): itemId: str startTs: int endTs: int @@ -166,19 +168,19 @@ class OverrideDropInfo(BaseModel): desc3: str dropTag: str dropTypeDesc: str - dropInfo: dict[str, StageDataStageDropInfo] + dropInfo: Dict[str, StageDataStageDropInfo] -class TimelyDropInfo(BaseModel): - dropInfo: dict[str, StageDataStageDropInfo] +class TimelyDropInfo(BaseStruct): + dropInfo: Dict[str, StageDataStageDropInfo] -class StageValidInfo(BaseModel): +class StageValidInfo(BaseStruct): startTs: int endTs: int -class StageFogInfo(BaseModel): +class StageFogInfo(BaseStruct): lockId: str fogType: str stageId: str @@ -188,70 +190,71 @@ class StageFogInfo(BaseModel): unlockItemType: str unlockItemNum: int preposedStageId: str - preposedLockId: str | None + preposedLockId: Union[str, None] -class StageStartCondRequireChar(BaseModel): +class StageStartCondRequireChar(BaseStruct): charId: str evolvePhase: int -class StageStartCond(BaseModel): - requireChars: list[StageStartCondRequireChar] - excludeAssists: list[str] +class StageStartCond(BaseStruct): + requireChars: List[StageStartCondRequireChar] + excludeAssists: List[str] isNotPass: bool -class StageDiffGroupTable(BaseModel): +class StageDiffGroupTable(BaseStruct): normalId: str - toughId: str | None + toughId: Union[str, None] easyId: str -class StoryStageShowGroup(BaseModel): +class StoryStageShowGroup(BaseStruct): displayRecordId: str stageId: str - accordingStageId: str | None + accordingStageId: Union[str, None] diffGroup: int -class SpecialBattleFinishStageData(BaseModel): +class SpecialBattleFinishStageData(BaseStruct): stageId: str skipAccomplishPerform: bool -class RecordRewardServerData(BaseModel): +class RecordRewardServerData(BaseStruct): stageId: str - rewards: list[ItemBundle] + rewards: List[ItemBundle] -class ApProtectZoneInfoTimeRange(BaseModel): +class ApProtectZoneInfoTimeRange(BaseStruct): startTs: int endTs: int -class ApProtectZoneInfo(BaseModel): +class ApProtectZoneInfo(BaseStruct): zoneId: str - timeRanges: list[ApProtectZoneInfoTimeRange] + timeRanges: List[ApProtectZoneInfoTimeRange] -class StageTable(BaseModel): +class StageTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - stages: dict[str, StageData] - runeStageGroups: dict[str, RuneStageGroupData] - mapThemes: dict[str, MapThemeData] - tileInfo: dict[str, TileAppendInfo] - forceOpenTable: dict[str, WeeklyForceOpenTable] - timelyStageDropInfo: dict[str, TimelyDropTimeInfo] - overrideDropInfo: dict[str, OverrideDropInfo] - timelyTable: dict[str, TimelyDropInfo] - stageValidInfo: dict[str, StageValidInfo] - stageFogInfo: dict[str, StageFogInfo] - stageStartConds: dict[str, StageStartCond] - diffGroupTable: dict[str, StageDiffGroupTable] - storyStageShowGroup: dict[str, dict[str, StoryStageShowGroup]] - specialBattleFinishStageData: dict[str, SpecialBattleFinishStageData] - recordRewardData: dict[str, RecordRewardServerData] | None - apProtectZoneInfo: dict[str, ApProtectZoneInfo] - spNormalStageIdFor4StarList: list[str] + stages: Dict[str, StageData] + runeStageGroups: Dict[str, RuneStageGroupData] + mapThemes: Dict[str, MapThemeData] + tileInfo: Dict[str, TileAppendInfo] + forceOpenTable: Dict[str, WeeklyForceOpenTable] + timelyStageDropInfo: Dict[str, TimelyDropTimeInfo] + overrideDropInfo: Dict[str, OverrideDropInfo] + timelyTable: Dict[str, TimelyDropInfo] + stageValidInfo: Dict[str, StageValidInfo] + stageFogInfo: Dict[str, StageFogInfo] + stageStartConds: Dict[str, StageStartCond] + diffGroupTable: Dict[str, StageDiffGroupTable] + storyStageShowGroup: Dict[str, Dict[str, StoryStageShowGroup]] + specialBattleFinishStageData: Dict[str, SpecialBattleFinishStageData] + recordRewardData: Union[Dict[str, RecordRewardServerData], None] + apProtectZoneInfo: Dict[str, ApProtectZoneInfo] + actCustomStageDatas: Dict[str, Dict[str, str]] + spNormalStageIdFor4StarList: List[str] diff --git a/ArknightsUID/utils/models/gamedata/StoryReviewMetaTable.py b/ArknightsUID/utils/models/gamedata/StoryReviewMetaTable.py index 02f52a7..bc3f095 100644 --- a/ArknightsUID/utils/models/gamedata/StoryReviewMetaTable.py +++ b/ArknightsUID/utils/models/gamedata/StoryReviewMetaTable.py @@ -1,18 +1,20 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class MiniActTrialDataRuleData(BaseModel): +class MiniActTrialDataRuleData(BaseStruct): ruleType: str ruleText: str -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class MiniActTrialDataMiniActTrialRewardData(BaseModel): +class MiniActTrialDataMiniActTrialRewardData(BaseStruct): trialRewardId: str orderId: int actId: str @@ -20,55 +22,55 @@ class MiniActTrialDataMiniActTrialRewardData(BaseModel): item: ItemBundle -class MiniActTrialDataMiniActTrialSingleData(BaseModel): +class MiniActTrialDataMiniActTrialSingleData(BaseStruct): actId: str rewardStartTime: int themeColor: str - rewardList: list[MiniActTrialDataMiniActTrialRewardData] + rewardList: List[MiniActTrialDataMiniActTrialRewardData] -class MiniActTrialData(BaseModel): +class MiniActTrialData(BaseStruct): preShowDays: int - ruleDataList: list[MiniActTrialDataRuleData] - miniActTrialDataMap: dict[str, MiniActTrialDataMiniActTrialSingleData] + ruleDataList: List[MiniActTrialDataRuleData] + miniActTrialDataMap: Dict[str, MiniActTrialDataMiniActTrialSingleData] -class ActArchiveResDataPicArchiveResItemData(BaseModel): - id_: str = Field(alias='id') +class ActArchiveResDataPicArchiveResItemData(BaseStruct): + id_: str = field(name='id') desc: str assetPath: str - type_: str = Field(alias='type') - subType: str | None + type_: str = field(name='type') + subType: Union[str, None] picDescription: str - kvId: str | None + kvId: Union[str, None] -class ActArchiveResDataAudioArchiveResItemData(BaseModel): - id_: str = Field(alias='id') +class ActArchiveResDataAudioArchiveResItemData(BaseStruct): + id_: str = field(name='id') desc: str name: str -class ActArchiveResDataAvgArchiveResItemData(BaseModel): - id_: str = Field(alias='id') +class ActArchiveResDataAvgArchiveResItemData(BaseStruct): + id_: str = field(name='id') desc: str - breifPath: str | None + breifPath: Union[str, None] contentPath: str imagePath: str - rawBrief: str | None - titleIconPath: str | None + rawBrief: Union[str, None] + titleIconPath: Union[str, None] -class ActArchiveResDataStoryArchiveResItemData(BaseModel): - id_: str = Field(alias='id') +class ActArchiveResDataStoryArchiveResItemData(BaseStruct): + id_: str = field(name='id') desc: str - date: str | None + date: Union[str, None] pic: str text: str - titlePic: str | None + titlePic: Union[str, None] -class ActArchiveResDataNewsFormatData(BaseModel): +class ActArchiveResDataNewsFormatData(BaseStruct): typeId: str typeName: str typeLogo: str @@ -76,13 +78,13 @@ class ActArchiveResDataNewsFormatData(BaseModel): typeMainSealing: str -class ActArchiveResDataActivityNewsLine(BaseModel): +class ActArchiveResDataActivityNewsLine(BaseStruct): lineType: int content: str -class ActArchiveResDataNewsArchiveResItemData(BaseModel): - id_: str = Field(alias='id') +class ActArchiveResDataNewsArchiveResItemData(BaseStruct): + id_: str = field(name='id') desc: str newsType: str newsFormat: ActArchiveResDataNewsFormatData @@ -91,10 +93,10 @@ class ActArchiveResDataNewsArchiveResItemData(BaseModel): paramP0: int paramK: int paramR: float - newsLines: list[ActArchiveResDataActivityNewsLine] + newsLines: List[ActArchiveResDataActivityNewsLine] -class ActArchiveResDataLandmarkArchiveResItemData(BaseModel): +class ActArchiveResDataLandmarkArchiveResItemData(BaseStruct): landmarkId: str landmarkName: str landmarkPic: str @@ -102,111 +104,111 @@ class ActArchiveResDataLandmarkArchiveResItemData(BaseModel): landmarkEngName: str -class ActArchiveResDataLogArchiveResItemData(BaseModel): +class ActArchiveResDataLogArchiveResItemData(BaseStruct): logId: str logDesc: str -class ActArchiveResData(BaseModel): - pics: dict[str, ActArchiveResDataPicArchiveResItemData] - audios: dict[str, ActArchiveResDataAudioArchiveResItemData] - avgs: dict[str, ActArchiveResDataAvgArchiveResItemData] - stories: dict[str, ActArchiveResDataStoryArchiveResItemData] - news: dict[str, ActArchiveResDataNewsArchiveResItemData] - landmarks: dict[str, ActArchiveResDataLandmarkArchiveResItemData] - logs: dict[str, ActArchiveResDataLogArchiveResItemData] +class ActArchiveResData(BaseStruct): + pics: Dict[str, ActArchiveResDataPicArchiveResItemData] + audios: Dict[str, ActArchiveResDataAudioArchiveResItemData] + avgs: Dict[str, ActArchiveResDataAvgArchiveResItemData] + stories: Dict[str, ActArchiveResDataStoryArchiveResItemData] + news: Dict[str, ActArchiveResDataNewsArchiveResItemData] + landmarks: Dict[str, ActArchiveResDataLandmarkArchiveResItemData] + logs: Dict[str, ActArchiveResDataLogArchiveResItemData] -class ActArchiveTimelineItemData(BaseModel): +class ActArchiveTimelineItemData(BaseStruct): timelineId: str timelineSortId: int timelineTitle: str timelineDes: str - picIdList: list[str] | None = None - audioIdList: list[str] | None = None - avgIdList: list[str] | None = None - storyIdList: list[str] | None = None - newsIdList: list[str] | None = None + picIdList: Union[List[str], None] = None + audioIdList: Union[List[str], None] = None + avgIdList: Union[List[str], None] = None + storyIdList: Union[List[str], None] = None + newsIdList: Union[List[str], None] = None -class ActArchiveTimelineData(BaseModel): - timelineList: list[ActArchiveTimelineItemData] +class ActArchiveTimelineData(BaseStruct): + timelineList: List[ActArchiveTimelineItemData] -class ActArchiveMusicItemData(BaseModel): +class ActArchiveMusicItemData(BaseStruct): musicId: str musicSortId: int -class ActArchiveMusicData(BaseModel): - musics: dict[str, ActArchiveMusicItemData] +class ActArchiveMusicData(BaseStruct): + musics: Dict[str, ActArchiveMusicItemData] -class ActArchivePicItemData(BaseModel): +class ActArchivePicItemData(BaseStruct): picId: str picSortId: int -class ActArchivePicData(BaseModel): - pics: dict[str, ActArchivePicItemData] +class ActArchivePicData(BaseStruct): + pics: Dict[str, ActArchivePicItemData] -class ActArchiveStoryItemData(BaseModel): +class ActArchiveStoryItemData(BaseStruct): storyId: str storySortId: int -class ActArchiveStoryData(BaseModel): - stories: dict[str, ActArchiveStoryItemData] +class ActArchiveStoryData(BaseStruct): + stories: Dict[str, ActArchiveStoryItemData] -class ActArchiveAvgItemData(BaseModel): +class ActArchiveAvgItemData(BaseStruct): avgId: str avgSortId: int -class ActArchiveAvgData(BaseModel): - avgs: dict[str, ActArchiveAvgItemData] +class ActArchiveAvgData(BaseStruct): + avgs: Dict[str, ActArchiveAvgItemData] -class ActArchiveNewsItemData(BaseModel): +class ActArchiveNewsItemData(BaseStruct): newsId: str newsSortId: int -class ActArchiveNewsData(BaseModel): - news: dict[str, ActArchiveNewsItemData] +class ActArchiveNewsData(BaseStruct): + news: Dict[str, ActArchiveNewsItemData] -class ActArchiveLandmarkItemData(BaseModel): +class ActArchiveLandmarkItemData(BaseStruct): landmarkId: str landmarkSortId: int -class ActArchiveChapterLogData(BaseModel): +class ActArchiveChapterLogData(BaseStruct): chapterName: str displayId: str unlockDes: str - logs: list[str] + logs: List[str] chapterIcon: str -class ActArchiveComponentData(BaseModel): - timeline: ActArchiveTimelineData | None = None - music: ActArchiveMusicData | None = None +class ActArchiveComponentData(BaseStruct): pic: ActArchivePicData - story: ActArchiveStoryData | None = None - avg: ActArchiveAvgData | None = None - news: ActArchiveNewsData | None = None - landmark: dict[str, ActArchiveLandmarkItemData] | None = None - log: dict[str, ActArchiveChapterLogData] | None = None + timeline: Union[ActArchiveTimelineData, None] = None + music: Union[ActArchiveMusicData, None] = None + story: Union[ActArchiveStoryData, None] = None + avg: Union[ActArchiveAvgData, None] = None + news: Union[ActArchiveNewsData, None] = None + landmark: Union[Dict[str, ActArchiveLandmarkItemData], None] = None + log: Union[Dict[str, ActArchiveChapterLogData], None] = None -class ActArchiveComponentTable(BaseModel): - components: dict[str, ActArchiveComponentData] +class ActArchiveComponentTable(BaseStruct): + components: Dict[str, ActArchiveComponentData] -class StoryReviewMetaTable(BaseModel): +class StoryReviewMetaTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' miniActTrialData: MiniActTrialData diff --git a/ArknightsUID/utils/models/gamedata/StoryReviewTable.py b/ArknightsUID/utils/models/gamedata/StoryReviewTable.py index 5fb1759..4108369 100644 --- a/ArknightsUID/utils/models/gamedata/StoryReviewTable.py +++ b/ArknightsUID/utils/models/gamedata/StoryReviewTable.py @@ -1,42 +1,45 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field +from msgspec import json as msgjson -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class StoryDataConditionStageCondition(BaseModel): +class StoryDataConditionStageCondition(BaseStruct): stageId: str minState: int maxState: int -class StoryReviewInfoClientData(BaseModel): +class StoryReviewInfoClientData(BaseStruct): storyReviewType: int storyId: str storyGroup: str storySort: int - storyDependence: str | None + storyDependence: Union[str, None] storyCanShow: int - storyCode: str | None + storyCode: Union[str, None] storyName: str - storyPic: str | None + storyPic: Union[str, None] storyInfo: str storyCanEnter: int storyTxt: str avgTag: str unLockType: str costItemType: str - costItemId: str | None + costItemId: Union[str, None] costItemCount: int stageCount: int - requiredStages: list[StoryDataConditionStageCondition] | None + requiredStages: Union[List[StoryDataConditionStageCondition], None] -class StoryReviewGroupClientData(BaseModel): - id_: str = Field(alias='id') +class StoryReviewGroupClientData(BaseStruct): + id_: str = field(name='id') name: str entryType: str actType: str @@ -46,19 +49,16 @@ class StoryReviewGroupClientData(BaseModel): endShowTime: int remakeStartTime: int remakeEndTime: int - storyEntryPicId: str | None - storyPicId: str | None - storyMainColor: str | None + storyEntryPicId: Union[str, None] + storyPicId: Union[str, None] + storyMainColor: Union[str, None] customType: int - storyCompleteMedalId: str | None - rewards: list[ItemBundle] | None - infoUnlockDatas: list[StoryReviewInfoClientData] + storyCompleteMedalId: Union[str, None] + rewards: Union[List[ItemBundle], None] + infoUnlockDatas: List[StoryReviewInfoClientData] -class StoryReviewTable(BaseModel): +class StoryReviewTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - storyreviewtable: dict[str, StoryReviewGroupClientData] - - def __init__(self, data: dict) -> None: - super().__init__(storyreviewtable=data) + storyreviewtable: Dict[str, StoryReviewGroupClientData] diff --git a/ArknightsUID/utils/models/gamedata/StoryTable.py b/ArknightsUID/utils/models/gamedata/StoryTable.py index f0b56f8..3e3bf90 100644 --- a/ArknightsUID/utils/models/gamedata/StoryTable.py +++ b/ArknightsUID/utils/models/gamedata/StoryTable.py @@ -1,50 +1,50 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field +from msgspec import json as msgjson -class StoryDataTrigger(BaseModel): - type_: str = Field(alias='type') - key: str | None +class StoryDataTrigger(BaseStruct): + type_: str = field(name='type') + key: Union[str, None] useRegex: bool -class StoryDataConditionStageCondition(BaseModel): +class StoryDataConditionStageCondition(BaseStruct): stageId: str minState: int maxState: int -class StoryDataCondition(BaseModel): +class StoryDataCondition(BaseStruct): minProgress: int maxProgress: int minPlayerLevel: int - requiredFlags: list[str] - excludedFlags: list[str] - requiredStages: list[StoryDataConditionStageCondition] + requiredFlags: List[str] + excludedFlags: List[str] + requiredStages: List[StoryDataConditionStageCondition] -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class StoryData(BaseModel): - id_: str = Field(alias='id') +class StoryData(BaseStruct): + id_: str = field(name='id') needCommit: bool repeatable: bool disabled: bool videoResource: bool trigger: StoryDataTrigger - condition: StoryDataCondition | None + condition: Union[StoryDataCondition, None] setProgress: int - setFlags: list[str] | None - completedRewards: list[ItemBundle] | None + setFlags: Union[List[str], None] + completedRewards: Union[List[ItemBundle], None] -class StoryTable(BaseModel): +class StoryTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - stories: dict[str, StoryData] - - def __init__(self, data: dict) -> None: - super().__init__(stories=data) + stories: Dict[str, StoryData] diff --git a/ArknightsUID/utils/models/gamedata/TechBuffTable.py b/ArknightsUID/utils/models/gamedata/TechBuffTable.py index a952a43..e4ede90 100644 --- a/ArknightsUID/utils/models/gamedata/TechBuffTable.py +++ b/ArknightsUID/utils/models/gamedata/TechBuffTable.py @@ -1,36 +1,38 @@ -from pydantic import BaseModel, Field +from typing import List, Union +from ..common import BaseStruct +from msgspec import field -class RuneDataSelector(BaseModel): +class RuneDataSelector(BaseStruct): professionMask: int buildableMask: int - charIdFilter: list[str] | None - enemyIdFilter: list[str] | None - skillIdFilter: list[str] | None - tileKeyFilter: list[str] | None + charIdFilter: Union[List[str], None] + enemyIdFilter: Union[List[str], None] + skillIdFilter: Union[List[str], None] + tileKeyFilter: Union[List[str], None] -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class RuneData(BaseModel): +class RuneData(BaseStruct): key: str selector: RuneDataSelector - blackboard: list[Blackboard] + blackboard: List[Blackboard] -class PackedRuneData(BaseModel): - id_: str = Field(alias='id') +class PackedRuneData(BaseStruct): + id_: str = field(name='id') points: float - mutexGroupKey: str | None + mutexGroupKey: Union[str, None] description: str - runes: list[RuneData] + runes: List[RuneData] -class TechBuffTable(BaseModel): +class TechBuffTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - runes: list[PackedRuneData] + runes: List[PackedRuneData] diff --git a/ArknightsUID/utils/models/gamedata/TipTable.py b/ArknightsUID/utils/models/gamedata/TipTable.py index 6274c8a..0734c34 100644 --- a/ArknightsUID/utils/models/gamedata/TipTable.py +++ b/ArknightsUID/utils/models/gamedata/TipTable.py @@ -1,21 +1,22 @@ -from pydantic import BaseModel +from typing import List +from ..common import BaseStruct -class TipData(BaseModel): +class TipData(BaseStruct): tip: str weight: float category: str -class WorldViewTip(BaseModel): +class WorldViewTip(BaseStruct): title: str description: str backgroundPicId: str weight: float -class TipTable(BaseModel): +class TipTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - tips: list[TipData] - worldViewTips: list[WorldViewTip] + tips: List[TipData] + worldViewTips: List[WorldViewTip] diff --git a/ArknightsUID/utils/models/gamedata/TokenTable.py b/ArknightsUID/utils/models/gamedata/TokenTable.py index 55eb8b1..6484132 100644 --- a/ArknightsUID/utils/models/gamedata/TokenTable.py +++ b/ArknightsUID/utils/models/gamedata/TokenTable.py @@ -1,36 +1,37 @@ -from pydantic import BaseModel, Field - -# 部分数据似乎不是float类型,等之后问问dice吧awa +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field +from msgspec import json as msgjson -class CharacterDataUnlockCondition(BaseModel): +class CharacterDataUnlockCondition(BaseStruct): phase: int level: int -class Blackboard(BaseModel): +class Blackboard(BaseStruct): key: str - value: float | None = None - valueStr: str | None = None + value: Union[float, None] = None + valueStr: Union[str, None] = None -class CharacterDataTraitData(BaseModel): +class CharacterDataTraitData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int - blackboard: list[Blackboard] - overrideDescripton: str | None - prefabKey: str | None - rangeId: str | None + blackboard: List[Blackboard] + overrideDescripton: Union[str, None] + prefabKey: Union[str, None] + rangeId: Union[str, None] -class CharacterDataTraitDataBundle(BaseModel): - candidates: list[CharacterDataTraitData] +class CharacterDataTraitDataBundle(BaseStruct): + candidates: List[CharacterDataTraitData] -class AttributesData(BaseModel): +class AttributesData(BaseStruct): maxHp: int atk: int - def_: int = Field(..., alias='def') + def_: int = field(name='def') magicResistance: float cost: int blockCnt: int @@ -52,54 +53,54 @@ class AttributesData(BaseModel): levitateImmune: bool -class CharacterDataAttributesKeyFrame(BaseModel): +class CharacterDataAttributesKeyFrame(BaseStruct): level: int data: AttributesData -class ItemBundle(BaseModel): - id_: str = Field(..., alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(..., alias='type') + type_: str = field(name='type') -class CharacterDataPhaseData(BaseModel): +class CharacterDataPhaseData(BaseStruct): characterPrefabKey: str - rangeId: str | None + rangeId: Union[str, None] maxLevel: int - attributesKeyFrames: list[CharacterDataAttributesKeyFrame] - evolveCost: list[ItemBundle] | None + attributesKeyFrames: List[CharacterDataAttributesKeyFrame] + evolveCost: Union[List[ItemBundle], None] -class CharacterDataMainSkillSpecializeLevelData(BaseModel): +class CharacterDataMainSkillSpecializeLevelData(BaseStruct): unlockCond: CharacterDataUnlockCondition lvlUpTime: int - levelUpCost: list[ItemBundle] | None + levelUpCost: Union[List[ItemBundle], None] -class CharacterDataMainSkill(BaseModel): - skillId: str | None - overridePrefabKey: str | None - overrideTokenKey: str | None - levelUpCostCond: list[CharacterDataMainSkillSpecializeLevelData] +class CharacterDataMainSkill(BaseStruct): + skillId: Union[str, None] + overridePrefabKey: Union[str, None] + overrideTokenKey: Union[str, None] + levelUpCostCond: List[CharacterDataMainSkillSpecializeLevelData] unlockCond: CharacterDataUnlockCondition -class TalentData(BaseModel): +class TalentData(BaseStruct): unlockCondition: CharacterDataUnlockCondition requiredPotentialRank: int prefabKey: str - name: str | None - description: str | None - rangeId: str | None - blackboard: list[Blackboard] + name: Union[str, None] + description: Union[str, None] + rangeId: Union[str, None] + blackboard: List[Blackboard] -class CharacterDataTalentDataBundle(BaseModel): - candidates: list[TalentData] | None +class CharacterDataTalentDataBundle(BaseStruct): + candidates: Union[List[TalentData], None] -class AttributeModifierDataAttributeModifier(BaseModel): +class AttributeModifierDataAttributeModifier(BaseStruct): attributeType: int formulaItem: int value: float @@ -107,70 +108,67 @@ class AttributeModifierDataAttributeModifier(BaseModel): fetchBaseValueFromSourceEntity: bool -class AttributeModifierData(BaseModel): - abnormalFlags: list[str] | None - abnormalImmunes: list[str] | None - abnormalAntis: list[str] | None - abnormalCombos: list[str] | None - abnormalComboImmunes: list[str] | None - attributeModifiers: list[AttributeModifierDataAttributeModifier] +class AttributeModifierData(BaseStruct): + abnormalFlags: Union[List[str], None] + abnormalImmunes: Union[List[str], None] + abnormalAntis: Union[List[str], None] + abnormalCombos: Union[List[str], None] + abnormalComboImmunes: Union[List[str], None] + attributeModifiers: List[AttributeModifierDataAttributeModifier] -class ExternalBuff(BaseModel): +class ExternalBuff(BaseStruct): attributes: AttributeModifierData -class CharacterDataPotentialRank(BaseModel): - type_: int = Field(..., alias='type') +class CharacterDataPotentialRank(BaseStruct): + type_: int = field(name='type') description: str - buff: ExternalBuff | None - equivalentCost: ItemBundle | None + buff: Union[ExternalBuff, None] + equivalentCost: Union[ItemBundle, None] -class CharacterDataSkillLevelCost(BaseModel): +class CharacterDataSkillLevelCost(BaseStruct): unlockCond: CharacterDataUnlockCondition - lvlUpCost: list[ItemBundle] | None + lvlUpCost: Union[List[ItemBundle], None] -class CharacterData(BaseModel): +class TokenCharacterData(BaseStruct): name: str - description: str | None + description: Union[str, None] canUseGeneralPotentialItem: bool canUseActivityPotentialItem: bool - potentialItemId: str | None - activityPotentialItemId: str | None - nationId: str | None - groupId: str | None - teamId: str | None - displayNumber: str | None - tokenKey: str | None = None + potentialItemId: Union[str, None] + activityPotentialItemId: Union[str, None] + nationId: Union[str, None] + groupId: Union[str, None] + teamId: Union[str, None] + displayNumber: Union[str, None] appellation: str position: str - tagList: list[str] | None - itemUsage: str | None - itemDesc: str | None - itemObtainApproach: str | None + tagList: Union[List[str], None] + itemUsage: Union[str, None] + itemDesc: Union[str, None] + itemObtainApproach: Union[str, None] isNotObtainable: bool isSpChar: bool maxPotentialLevel: int rarity: int profession: str subProfessionId: str - trait: CharacterDataTraitDataBundle | None - phases: list[CharacterDataPhaseData] - skills: list[CharacterDataMainSkill] | None - talents: list[CharacterDataTalentDataBundle] | None - potentialRanks: list[CharacterDataPotentialRank] | None - favorKeyFrames: list[CharacterDataAttributesKeyFrame] | None - allSkillLvlup: list[CharacterDataSkillLevelCost] | None + trait: Union[CharacterDataTraitDataBundle, None] + phases: List[CharacterDataPhaseData] + skills: Union[List[CharacterDataMainSkill], None] + talents: Union[List[CharacterDataTalentDataBundle], None] + potentialRanks: Union[List[CharacterDataPotentialRank], None] + favorKeyFrames: Union[List[CharacterDataAttributesKeyFrame], None] + allSkillLvlup: Union[List[CharacterDataSkillLevelCost], None] minPowerId: str maxPowerId: str + tokenKey: Union[str, None] = None -class TokenTable(BaseModel): +class TokenTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - tokens: dict[str, CharacterData] - - def __init__(self, data: dict) -> None: - super().__init__(tokens=data) + tokens: Dict[str, TokenCharacterData] diff --git a/ArknightsUID/utils/models/gamedata/UniequipData.py b/ArknightsUID/utils/models/gamedata/UniequipData.py index 1e1ae31..6781d7b 100644 --- a/ArknightsUID/utils/models/gamedata/UniequipData.py +++ b/ArknightsUID/utils/models/gamedata/UniequipData.py @@ -1,25 +1,27 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class UnlockCondition(BaseModel): +class UnlockCondition(BaseStruct): phase: int level: int -class TraitDescBundle(BaseModel): +class TraitDescBundle(BaseStruct): unlockCondition: UnlockCondition requiredPotentialRank: int overrideDescription: None additiveDescription: str -class UniEquipData(BaseModel): +class UniEquipData(BaseStruct): uniEquipId: str uniEquipName: str uniEquipIcon: str @@ -33,31 +35,31 @@ class UniEquipData(BaseModel): showLevel: int unlockLevel: int unlockFavorPercent: int - missionList: list[str] - itemCost: list[ItemBundle] | None - type_: str = Field(..., alias='type') - traitDescBundle: list[TraitDescBundle] + missionList: List[str] + itemCost: Union[List[ItemBundle], None] + type_: str = field(name='type') + traitDescBundle: List[TraitDescBundle] -class UniEquipMissionData(BaseModel): - template: str | None - desc: str | None - paramList: list[str] +class UniEquipMissionData(BaseStruct): + template: Union[str, None] + desc: Union[str, None] + paramList: List[str] uniEquipMissionId: str uniEquipMissionSort: int uniEquipId: str -class SubProfessionData(BaseModel): +class SubProfessionData(BaseStruct): subProfessionId: str subProfessionName: str subProfessionCatagory: int -class UniequipData(BaseModel): +class UniequipData(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - equipDict: dict[str, UniEquipData] - missionList: dict[str, UniEquipMissionData] - subProfDict: dict[str, SubProfessionData] - charEquip: dict[str, list[str]] + equipDict: Dict[str, UniEquipData] + missionList: Dict[str, UniEquipMissionData] + subProfDict: Dict[str, SubProfessionData] + charEquip: Dict[str, List[str]] diff --git a/ArknightsUID/utils/models/gamedata/UniequipTable.py b/ArknightsUID/utils/models/gamedata/UniequipTable.py index 9eedd0e..26505cb 100644 --- a/ArknightsUID/utils/models/gamedata/UniequipTable.py +++ b/ArknightsUID/utils/models/gamedata/UniequipTable.py @@ -1,66 +1,68 @@ -from pydantic import BaseModel, Field +from typing import Dict, List, Union +from ..common import BaseStruct +from msgspec import field -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class UniEquipData(BaseModel): +class UniEquipData(BaseStruct): uniEquipId: str uniEquipName: str uniEquipIcon: str uniEquipDesc: str typeIcon: str typeName1: str - typeName2: str | None + typeName2: Union[str, None] equipShiningColor: str showEvolvePhase: int unlockEvolvePhase: int charId: str - tmplId: str | None + tmplId: Union[str, None] showLevel: int unlockLevel: int unlockFavorPoint: int - missionList: list[str] - itemCost: dict[str, list[ItemBundle]] | None - type_: str = Field(..., alias='type') + missionList: List[str] + itemCost: Union[Dict[str, List[ItemBundle]], None] + type_: str = field(name='type') uniEquipGetTime: int charEquipOrder: int -class UniEquipMissionData(BaseModel): +class UniEquipMissionData(BaseStruct): template: str desc: str - paramList: list[str] + paramList: List[str] uniEquipMissionId: str uniEquipMissionSort: int uniEquipId: str - jumpStageId: str | None + jumpStageId: Union[str, None] -class SubProfessionData(BaseModel): +class SubProfessionData(BaseStruct): subProfessionId: str subProfessionName: str subProfessionCatagory: int -class UniEquipTrack(BaseModel): +class UniEquipTrack(BaseStruct): charId: str equipId: str -class UniEquipTimeInfo(BaseModel): +class UniEquipTimeInfo(BaseStruct): timeStamp: int - trackList: list[UniEquipTrack] + trackList: List[UniEquipTrack] -class UniEquipTable(BaseModel): +class UniEquipTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - equipDict: dict[str, UniEquipData] - missionList: dict[str, UniEquipMissionData] - subProfDict: dict[str, SubProfessionData] - charEquip: dict[str, list[str]] - equipTrackDict: list[UniEquipTimeInfo] + equipDict: Dict[str, UniEquipData] + missionList: Dict[str, UniEquipMissionData] + subProfDict: Dict[str, SubProfessionData] + charEquip: Dict[str, List[str]] + equipTrackDict: List[UniEquipTimeInfo] diff --git a/ArknightsUID/utils/models/gamedata/ZoneTable.py b/ArknightsUID/utils/models/gamedata/ZoneTable.py index 4cc1d38..75adf9b 100644 --- a/ArknightsUID/utils/models/gamedata/ZoneTable.py +++ b/ArknightsUID/utils/models/gamedata/ZoneTable.py @@ -1,34 +1,36 @@ -from pydantic import BaseModel, Field +from typing import Dict, Union, List +from ..common import BaseStruct +from msgspec import field -class ZoneData(BaseModel): +class ZoneData(BaseStruct): zoneID: str zoneIndex: int type: str - zoneNameFirst: str | None - zoneNameSecond: str | None - zoneNameTitleCurrent: str | None - zoneNameTitleUnCurrent: str | None - zoneNameTitleEx: str | None - zoneNameThird: str | None - lockedText: str | None + zoneNameFirst: Union[str, None] + zoneNameSecond: Union[str, None] + zoneNameTitleCurrent: Union[str, None] + zoneNameTitleUnCurrent: Union[str, None] + zoneNameTitleEx: Union[str, None] + zoneNameThird: Union[str, None] + lockedText: Union[str, None] canPreview: bool -class WeeklyZoneData(BaseModel): - daysOfWeek: list[int] - type_: str = Field(..., alias='type') +class WeeklyZoneData(BaseStruct): + daysOfWeek: List[int] + type_: str = field(name='type') -class ZoneValidInfo(BaseModel): +class ZoneValidInfo(BaseStruct): startTs: int endTs: int -class MainlineZoneData(BaseModel): +class MainlineZoneData(BaseStruct): zoneId: str chapterId: str - preposedZoneId: str | None + preposedZoneId: Union[str, None] zoneIndex: int startStageId: str endStageId: str @@ -39,70 +41,70 @@ class MainlineZoneData(BaseModel): buttonStyle: str spoilAlert: bool zoneOpenTime: int - diffGroup: list[int] + diffGroup: List[int] -class ItemBundle(BaseModel): - id_: str = Field(alias='id') +class ItemBundle(BaseStruct): + id_: str = field(name='id') count: int - type_: str = Field(alias='type') + type_: str = field(name='type') -class RecordRewardInfo(BaseModel): +class RecordRewardInfo(BaseStruct): bindStageId: str stageDiff1: int stageDiff: int - picRes: str | None - textPath: str | None - textDesc: str | None - recordReward: list[ItemBundle] | None + picRes: Union[str, None] + textPath: Union[str, None] + textDesc: Union[str, None] + recordReward: Union[List[ItemBundle], None] -class ZoneRecordData(BaseModel): +class ZoneRecordData(BaseStruct): recordId: str zoneId: str recordTitleName: str - preRecordId: str | None - nodeTitle1: str | None - nodeTitle2: str | None - rewards: list[RecordRewardInfo] + preRecordId: Union[str, None] + nodeTitle1: Union[str, None] + nodeTitle2: Union[str, None] + rewards: List[RecordRewardInfo] -class ZoneRecordUnlockData(BaseModel): +class ZoneRecordUnlockData(BaseStruct): noteId: str zoneId: str initialName: str - finalName: str | None - accordingExposeId: str | None + finalName: Union[str, None] + accordingExposeId: Union[str, None] initialDes: str - finalDes: str | None - remindDes: str | None + finalDes: Union[str, None] + remindDes: Union[str, None] -class ZoneRecordGroupData(BaseModel): +class ZoneRecordGroupData(BaseStruct): zoneId: str - records: list[ZoneRecordData] + records: List[ZoneRecordData] unlockData: ZoneRecordUnlockData -class ZoneRecordMissionData(BaseModel): +class ZoneRecordMissionData(BaseStruct): missionId: str recordStageId: str templateDesc: str desc: str -class ZoneMetaData(BaseModel): - ZoneRecordMissionData: dict[str, ZoneRecordMissionData] +class ZoneMetaData(BaseStruct): + ZoneRecordMissionData: Dict[str, ZoneRecordMissionData] -class ZoneTable(BaseModel): +class ZoneTable(BaseStruct): __version__ = '23-07-27-18-50-06-aeb568' - zones: dict[str, ZoneData] - weeklyAdditionInfo: dict[str, WeeklyZoneData] - zoneValidInfo: dict[str, ZoneValidInfo] - mainlineAdditionInfo: dict[str, MainlineZoneData] - zoneRecordGroupedData: dict[str, ZoneRecordGroupData] - zoneRecordRewardData: dict[str, list[str]] + zones: Dict[str, ZoneData] + weeklyAdditionInfo: Dict[str, WeeklyZoneData] + zoneValidInfo: Dict[str, ZoneValidInfo] + mainlineAdditionInfo: Dict[str, MainlineZoneData] + zoneRecordGroupedData: Dict[str, ZoneRecordGroupData] + zoneRecordRewardData: Dict[str, List[str]] zoneMetaData: ZoneMetaData diff --git a/ArknightsUID/utils/models/skland/models.py b/ArknightsUID/utils/models/skland/models.py index 5305f4d..099a17f 100644 --- a/ArknightsUID/utils/models/skland/models.py +++ b/ArknightsUID/utils/models/skland/models.py @@ -1,3 +1,4 @@ +from typing import Dict, List, Union from msgspec import Struct, field @@ -28,9 +29,9 @@ class ArknightsAttendanceCalendar(Struct): class ArknightsAttendanceCalendarModel(Struct): currentTs: str - calendar: list[ArknightsAttendanceCalendar] - records: list[ArknightsAttendanceRecord | None] - resourceInfoMap: dict[str, ArknightsAttendanceAwardResource] + calendar: List[ArknightsAttendanceCalendar] + records: List[Union[ArknightsAttendanceRecord, None]] + resourceInfoMap: Dict[str, ArknightsAttendanceAwardResource] ################ @@ -43,7 +44,7 @@ class ArknightsAttendanceAward(Struct): class ArknightsAttendanceModel(Struct): ts: str - awards: list[ArknightsAttendanceAward] + awards: List[ArknightsAttendanceAward] ################ # ArknightsAttendance End ################ @@ -95,7 +96,7 @@ class UserGameStatus(Struct): charCnt: int furnitureCnt: int skinCnt: int - avatar: UserGameStatusAvatar | None = None + avatar: Union[UserGameStatusAvatar, None] = None class UserMeInfoRts(Struct): @@ -116,7 +117,7 @@ class UserMeInfo(Struct): avatar: str backgroundCode: int isCreator: bool - creatorIdentifiers: list[str] + creatorIdentifiers: List[str] status: int operationStatus: int identity: int @@ -131,7 +132,7 @@ class UserMeInfo(Struct): class ArknightsUserMeModel(Struct, omit_defaults=True): user: UserMeInfo userRts: UserMeInfoRts - userSanctionList: list[str] + userSanctionList: List[str] gameStatus: UserGameStatus moderator: UserMeModerator userInfoApply: UserMeInfoApply @@ -152,7 +153,7 @@ class PlayerManufactureFormulaInfo(Struct): count: int weight: int costPoint: int - costs: list[str] | None = None + costs: Union[List[str], None] = None class PlayerEquipmentInfo(Struct): @@ -160,8 +161,8 @@ class PlayerEquipmentInfo(Struct): name: str typeIcon: str shiningColor: str - desc: str | None = None - typeName1: str | None = None + desc: Union[str, None] = None + typeName1: Union[str, None] = None class PlayerCampaignZoneInfo(Struct): @@ -189,8 +190,8 @@ class PlayerTowerInfo(Struct): id_: str = field(name='id') name: str subName: str - hasHard: bool | None = None - stageNum: int | None = None + hasHard: Union[bool, None] = None + stageNum: Union[int, None] = None class PlayerZoneInfo(Struct): @@ -219,14 +220,14 @@ class PlayerSkinInfo(Struct): brandId: str sortId: int displayTagId: str - name: str | None = None - brandName: str | None = None - brandCapitalName: str | None = None - illustId: str | None = None - dynIllustId: str | None = None - avatarId: str | None = None - portraitId: str | None = None - skinGroupId: str | None = None + name: Union[str, None] = None + brandName: Union[str, None] = None + brandCapitalName: Union[str, None] = None + illustId: Union[str, None] = None + dynIllustId: Union[str, None] = None + avatarId: Union[str, None] = None + portraitId: Union[str, None] = None + skinGroupId: Union[str, None] = None class PlayerCharInfo(Struct): @@ -250,14 +251,14 @@ class ActivityZone(Struct): zoneReplicaId: str clearedStage: int totalStage: int - stageStatus: list[ActivityZoneStageStatus] | None = None + stageStatus: Union[List[ActivityZoneStageStatus], None] = None class PlayerActivity(Struct): actId: str actReplicaId: str - zones: list[ActivityZone] - type_: str | None = field(name='type', default=None) + zones: List[ActivityZone] + type_: Union[str, None] = field(name='type', default=None) class RewoardItem(Struct): @@ -279,12 +280,12 @@ class RogueRecord(Struct): rogueId: str relicCnt: int bank: BankItem - mission: RewoardItem | None = None - clearTime: int | None = None + mission: Union[RewoardItem, None] = None + clearTime: Union[int, None] = None class PlayerRogue(Struct): - records: list[RogueRecord] + records: List[RogueRecord] class TowerReward(Struct): @@ -296,14 +297,14 @@ class TowerReward(Struct): class TowerRecord(Struct): towerId: str best: int - hasHard: bool | None = None - stageNum: int | None = None - unlockHard: bool | None = None - hardBest: int | None = None + hasHard: Union[bool, None] = None + stageNum: Union[int, None] = None + unlockHard: Union[bool, None] = None + hardBest: Union[int, None] = None class PlayerTower(Struct): - records: list[TowerRecord] + records: List[TowerRecord] reward: TowerReward @@ -318,7 +319,7 @@ class CampaignRecord(Struct): class PlayerCampaign(Struct): - records: list[CampaignRecord] + records: List[CampaignRecord] reward: CampaignReward @@ -331,8 +332,8 @@ class PlayerRecruit(Struct): startTs: int finishTs: int state: int - duration: int | None = None - selectTags: list[RecruitTag] | None = None + duration: Union[int, None] = None + selectTags: Union[List[RecruitTag], None] = None class BuildingTrainingTrainee(Struct): @@ -353,7 +354,7 @@ class BuildingClue(Struct): received: int dailyReward: bool needReceive: int - board: list[str] + board: List[str] sharing: bool shareCompleteTime: int @@ -381,7 +382,7 @@ class BuildingControl(Struct): slotId: str slotState: int level: int - chars: list[BuildingChar] + chars: List[BuildingChar] class BuildingCorridor(Struct): @@ -415,14 +416,14 @@ class BuildingTraining(Struct): lastUpdateTime: int remainSecs: int slotState: int - trainee: BuildingTrainingTrainee | None - trainer: BuildingTrainingTrainer | None + trainee: Union[BuildingTrainingTrainee, None] + trainer: Union[BuildingTrainingTrainer, None] class BuildingHire(Struct): slotId: str level: int - chars: list[BuildingChar] + chars: List[BuildingChar] state: int refreshCount: int completeWorkTime: int @@ -432,7 +433,7 @@ class BuildingHire(Struct): class BuildingMeeting(Struct): slotId: str level: int - chars: list[BuildingChar] + chars: List[BuildingChar] clue: BuildingClue lastUpdateTime: int completeWorkTime: int @@ -441,7 +442,7 @@ class BuildingMeeting(Struct): class BuildingDormitories(Struct): slotId: str level: int - chars: list[BuildingChar] + chars: List[BuildingChar] comfort: int @@ -454,7 +455,7 @@ class BuildingStockDelivery(Struct): class BuildingStock(Struct): instId: int type_: str = field(name='type') - delivery: list[BuildingStockDelivery] + delivery: List[BuildingStockDelivery] gain: BuildingStockDelivery isViolated: bool @@ -462,18 +463,18 @@ class BuildingStock(Struct): class BuildingTradings(Struct): slotId: str level: int - chars: list[BuildingChar] + chars: List[BuildingChar] completeWorkTime: int lastUpdateTime: int strategy: str - stock: list[BuildingStock] + stock: List[BuildingStock] stockLimit: int class BuildingManufactures(Struct): slotId: str level: int - chars: list[BuildingChar] + chars: List[BuildingChar] completeWorkTime: int lastUpdateTime: int formulaId: str @@ -487,7 +488,7 @@ class BuildingManufactures(Struct): class BuildingPower(Struct): slotId: str level: int - chars: list[BuildingChar] + chars: List[BuildingChar] class BuildingTiredChar(Struct): @@ -501,19 +502,19 @@ class BuildingTiredChar(Struct): class PlayerBuilding(Struct): - tiredChars: list[BuildingTiredChar] | None - powers: list[BuildingPower] | None - manufactures: list[BuildingManufactures] | None - tradings: list[BuildingTradings] | None - dormitories: list[BuildingDormitories] | None - meeting: BuildingMeeting | None - hire: BuildingHire | None + tiredChars: Union[List[BuildingTiredChar], None] + powers: Union[List[BuildingPower], None] + manufactures: Union[List[BuildingManufactures], None] + tradings: Union[List[BuildingTradings], None] + dormitories: Union[List[BuildingDormitories], None] + meeting: Union[BuildingMeeting, None] + hire: Union[BuildingHire, None] labor: BuildingLabor furniture: BuildingFurniture - elevators: list[BuildingElevator] - corridors: list[BuildingCorridor] | None + elevators: List[BuildingElevator] + corridors: Union[List[BuildingCorridor], None] control: BuildingControl - training: BuildingTraining | None = None + training: Union[BuildingTraining, None] = None class PlayerInfoSkin(Struct): @@ -538,8 +539,8 @@ class PlayerInfoChar(Struct): evolvePhase: int potentialRank: int mainSkillLvl: int - skills: list[PlayerInfoCharSkill] | None - equip: list[PlayerInfoCharEquip] | None + skills: Union[List[PlayerInfoCharSkill] , None] + equip: Union[List[PlayerInfoCharEquip] , None] favorPercent: int defaultSkillId: str gainTime: int @@ -560,14 +561,14 @@ class PlayerAssistChar(Struct): skillId: str mainSkillLvl: int specializeLevel: int - equip: PlayerAssistCharEquip | None + equip: Union[PlayerAssistCharEquip, None] class PlayerMedal(Struct): type_: str = field(name='type') template: str - templateMedalList: list[str] - customMedalLayout: list[str | None] + templateMedalList: List[str] + customMedalLayout: List[Union[str, None]] total: int @@ -603,7 +604,7 @@ class PlayerStatus(Struct): charCnt: int furnitureCnt: int skinCnt: int - avatar: PlayerStatusAvatar | None = None + avatar: Union[PlayerStatusAvatar, None] = None class DisplayShowConfig(Struct): @@ -624,32 +625,32 @@ class ArknightsPlayerInfoModel(Struct, omit_defaults=True, gc=False): currentTs: int showConfig: DisplayShowConfig status: PlayerStatus - assistChars: list[PlayerAssistChar] - chars: list[PlayerInfoChar] - skins: list[PlayerInfoSkin] + assistChars: List[PlayerAssistChar] + chars: List[PlayerInfoChar] + skins: List[PlayerInfoSkin] building: PlayerBuilding - recruit: list[PlayerRecruit] + recruit: List[PlayerRecruit] campaign: PlayerCampaign tower: PlayerTower rogue: PlayerRogue routine: PlayerRoutine - activity: list[PlayerActivity] - charInfoMap: dict[str, PlayerCharInfo] - skinInfoMap: dict[str, PlayerSkinInfo] - stageInfoMap: dict[str, PlayerStageInfo] - activityInfoMap: dict[str, PlayerActivityInfo] - towerInfoMap: dict[str, PlayerTowerInfo] - rogueInfoMap: dict[str, PlayerRogueInfo] - campaignInfoMap: dict[str, PlayerCampaignInfo] - campaignZoneInfoMap: dict[str, PlayerCampaignZoneInfo] - equipmentInfoMap: dict[str, PlayerEquipmentInfo] - manufactureFormulaInfoMap: dict[str, PlayerManufactureFormulaInfo] - charAssets: list[str | None] - skinAssets: list[str | None] - activityBannerList: dict[str, list[PlayerActivityBannerList]] - medal: PlayerMedal | None = None - zoneInfoMap: dict[str, PlayerZoneInfo] | None = None - medalInfoMap: dict[str, PlayerMedalInfo] | None = None + activity: List[PlayerActivity] + charInfoMap: Dict[str, PlayerCharInfo] + skinInfoMap: Dict[str, PlayerSkinInfo] + stageInfoMap: Dict[str, PlayerStageInfo] + activityInfoMap: Dict[str, PlayerActivityInfo] + towerInfoMap: Dict[str, PlayerTowerInfo] + rogueInfoMap: Dict[str, PlayerRogueInfo] + campaignInfoMap: Dict[str, PlayerCampaignInfo] + campaignZoneInfoMap: Dict[str, PlayerCampaignZoneInfo] + equipmentInfoMap: Dict[str, PlayerEquipmentInfo] + manufactureFormulaInfoMap: Dict[str, PlayerManufactureFormulaInfo] + charAssets: List[Union[str, None]] + skinAssets: List[Union[str, None]] + activityBannerList: Dict[str, List[PlayerActivityBannerList]] + medal: Union[PlayerMedal, None] = None + zoneInfoMap: Union[Dict[str, PlayerZoneInfo], None] = None + medalInfoMap: Union[Dict[str, PlayerMedalInfo], None] = None ################ diff --git a/ArknightsUID/utils/resource/download_from_cos.py b/ArknightsUID/utils/resource/download_from_cos.py index 9e7f62e..9db132e 100644 --- a/ArknightsUID/utils/resource/download_from_cos.py +++ b/ArknightsUID/utils/resource/download_from_cos.py @@ -1,5 +1,6 @@ import asyncio from pathlib import Path +from typing import Dict, List, Tuple, Union from aiohttp.client import ClientSession from gsuid_core.logger import logger @@ -15,19 +16,19 @@ with Path.open( ) as f: resource_map = msgjson.decode( f.read(), - type=dict[str, dict[str, dict[str, dict[str, int | str]]]], + type=Dict[str, Dict[str, Dict[str, Dict[str, Union[int, str]]]]], ) async def download_all_file_from_cos(): - async def _download(tasks: list[asyncio.Task]): + async def _download(tasks: List[asyncio.Task]): failed_list.extend( list(filter(lambda x: x is not None, await asyncio.gather(*tasks))) ) tasks.clear() logger.info('[cos]下载完成!') - failed_list: list[tuple[str, str, str, str]] = [] + failed_list: List[Tuple[str, str, str, str]] = [] TASKS = [] async with ClientSession() as sess: for res_type in ['resource']: diff --git a/ArknightsUID/utils/resource/download_url.py b/ArknightsUID/utils/resource/download_url.py index e33ea04..e4b07bd 100644 --- a/ArknightsUID/utils/resource/download_url.py +++ b/ArknightsUID/utils/resource/download_url.py @@ -1,4 +1,5 @@ +from typing import Union, Tuple import aiofiles from aiohttp.client import ClientSession from aiohttp.client_exceptions import ClientConnectorError @@ -16,7 +17,7 @@ async def download( res_type: str, resource_type: str, name: str, -) -> tuple[str, str, str] | None: +) -> Union[Tuple[str, str, str], None]: """ :说明: 下载URL保存入目录 @@ -43,8 +44,8 @@ async def download_file( res_type: str, resource_type: str, name: str, - sess: ClientSession | None = None, -) -> tuple[str, str, str] | None: + sess: Union[ClientSession, None] = None, +) -> Union[Tuple[str, str, str], None]: if sess is None: sess = ClientSession() try: