mirror of
https://github.com/PaiGramTeam/HonkaiStarRailWikiDataParser.git
synced 2025-01-30 18:38:36 +00:00
fix: march7th 2
This commit is contained in:
parent
90df0ffafa
commit
d231041a81
@ -40,7 +40,12 @@ async def get_all_avatar() -> List[str]:
|
||||
|
||||
|
||||
async def fix_avatar_icon(content: Content):
|
||||
avatar = all_avatars_name.get(content.title.replace("·", "•"))
|
||||
key = content.title.replace("·", "•")
|
||||
key_map = {"三月七": 1001, "仙舟三月七": 1224}
|
||||
if key in key_map:
|
||||
avatar = all_avatars_map.get(key_map[key])
|
||||
else:
|
||||
avatar = all_avatars_name.get(key)
|
||||
if not avatar:
|
||||
return
|
||||
avatar.icon = content.icon
|
||||
|
@ -1,7 +1,7 @@
|
||||
import asyncio
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
import aiofiles
|
||||
import ujson
|
||||
@ -22,7 +22,7 @@ async def fetch_config() -> List[AvatarConfig]:
|
||||
text_map_data = await get_base_data(text_map)
|
||||
data = await get_base_data(avatar_config)
|
||||
datas = []
|
||||
for i in data.values():
|
||||
for i in data:
|
||||
a = AvatarConfig(**i)
|
||||
a.name = text_map_data[str(a.AvatarName.Hash)]
|
||||
datas.append(a)
|
||||
@ -110,15 +110,26 @@ async def fetch_station(configs_map: Dict[str, AvatarConfig]) -> List[AvatarIcon
|
||||
|
||||
|
||||
async def fix_avatar_config_ktz():
|
||||
data_map = {"开拓者·毁灭": (8001, 8002), "开拓者·存护": (8003, 8004)}
|
||||
data_map = {
|
||||
"开拓者·毁灭": (8001, 8002),
|
||||
"开拓者·存护": (8003, 8004),
|
||||
"开拓者·同谐": (8005, 8006),
|
||||
}
|
||||
for key, value in data_map.items():
|
||||
for i in value:
|
||||
all_avatars_map[i].name = key
|
||||
|
||||
|
||||
async def fix_mult_avatar_config(configs_map: Dict[str, Optional[AvatarConfig]]):
|
||||
configs_map["三月七"] = None
|
||||
|
||||
|
||||
async def fix_avatar_config():
|
||||
configs = await fetch_config()
|
||||
configs_map: Dict[str, AvatarConfig] = {config.name: config for config in configs}
|
||||
configs_map: Dict[str, Optional[AvatarConfig]] = {
|
||||
config.name: config for config in configs
|
||||
}
|
||||
await fix_mult_avatar_config(configs_map)
|
||||
print(f"读取到原始数据:{list(configs_map.keys())}")
|
||||
data_path = Path("data")
|
||||
await read_avatars()
|
||||
|
@ -29,7 +29,7 @@ async def get_text_map() -> dict[str, str]:
|
||||
async def get_avatar_player_icon() -> List[AvatarPlayerIcon]:
|
||||
data = await get_base_data(avatar_player_icon_url)
|
||||
datas = []
|
||||
for i in data.values():
|
||||
for i in data:
|
||||
datas.append(AvatarPlayerIcon(**i))
|
||||
return datas
|
||||
|
||||
@ -37,7 +37,7 @@ async def get_avatar_player_icon() -> List[AvatarPlayerIcon]:
|
||||
async def get_player_icon() -> List[PlayerIcon]:
|
||||
data = await get_base_data(player_icon_url)
|
||||
datas = []
|
||||
for i in data.values():
|
||||
for i in data:
|
||||
datas.append(PlayerIcon(**i))
|
||||
return datas
|
||||
|
||||
@ -45,7 +45,7 @@ async def get_player_icon() -> List[PlayerIcon]:
|
||||
async def get_item_player_card() -> List[ItemPlayerCard]:
|
||||
data = await get_base_data(item_player_card_url)
|
||||
datas = []
|
||||
for i in data.values():
|
||||
for i in data:
|
||||
datas.append(ItemPlayerCard(**i))
|
||||
return datas
|
||||
|
||||
|
@ -17,7 +17,7 @@ data_path = Path("data")
|
||||
async def get_phone_theme() -> List[PhoneThemeConfig]:
|
||||
data = await get_base_data(phone_theme_url)
|
||||
datas = []
|
||||
for i in data.values():
|
||||
for i in data:
|
||||
datas.append(PhoneThemeConfig(**i))
|
||||
return datas
|
||||
|
||||
|
@ -7,7 +7,6 @@ import ujson
|
||||
from models.enums import RelicAffix, RelicPosition
|
||||
from models.relic_affix import RelicAffixAll, SingleRelicAffix
|
||||
from res_func.base_data import get_base_data
|
||||
from res_func.client import client
|
||||
from res_func.url import relic_config, relic_main_affix_config, relic_sub_affix_config
|
||||
|
||||
final_datas: List[RelicAffixAll] = []
|
||||
@ -17,7 +16,8 @@ final_datas_map: Dict[str, RelicAffixAll] = {}
|
||||
async def fetch_all_relic():
|
||||
print("开始获取遗器配置")
|
||||
relic_data = await get_base_data(relic_config)
|
||||
for key, value in relic_data.items():
|
||||
for value in relic_data:
|
||||
key = value["ID"]
|
||||
relic_affix_all = RelicAffixAll(
|
||||
id=int(key),
|
||||
set_id=value["SetID"],
|
||||
@ -38,16 +38,20 @@ async def fetch_main_affix():
|
||||
print("开始获取遗器主词条配置")
|
||||
main_affix_data = await get_base_data(relic_main_affix_config)
|
||||
main_affix_groups_map: Dict[str, Dict[str, SingleRelicAffix]] = {}
|
||||
for key, value in main_affix_data.items():
|
||||
data: Dict[str, SingleRelicAffix] = {}
|
||||
for key2, value2 in value.items():
|
||||
data[key2] = SingleRelicAffix(
|
||||
id=value2["AffixID"],
|
||||
property=RelicAffix(value2["Property"]),
|
||||
base_value=value2["BaseValue"]["Value"],
|
||||
level_value=value2["LevelAdd"]["Value"],
|
||||
is_main=True,
|
||||
)
|
||||
for value in main_affix_data:
|
||||
key = str(value["GroupID"])
|
||||
data: Dict[str, SingleRelicAffix] = main_affix_groups_map.get(key, {})
|
||||
|
||||
value2 = value
|
||||
key2 = str(value2["AffixID"])
|
||||
data[key2] = SingleRelicAffix(
|
||||
id=value2["AffixID"],
|
||||
property=RelicAffix(value2["Property"]),
|
||||
base_value=value2["BaseValue"]["Value"],
|
||||
level_value=value2["LevelAdd"]["Value"],
|
||||
is_main=True,
|
||||
)
|
||||
|
||||
main_affix_groups_map[key] = data
|
||||
for final_data in final_datas:
|
||||
final_data.main_affix = main_affix_groups_map[str(final_data.main_affix_group)]
|
||||
@ -58,17 +62,21 @@ async def fetch_sub_affix():
|
||||
print("开始获取遗器副词条配置")
|
||||
sub_affix_data = await get_base_data(relic_sub_affix_config)
|
||||
sub_affix_groups_map: Dict[str, Dict[str, SingleRelicAffix]] = {}
|
||||
for key, value in sub_affix_data.items():
|
||||
data: Dict[str, SingleRelicAffix] = {}
|
||||
for key2, value2 in value.items():
|
||||
data[key2] = SingleRelicAffix(
|
||||
id=value2["AffixID"],
|
||||
property=RelicAffix(value2["Property"]),
|
||||
base_value=value2["BaseValue"]["Value"],
|
||||
step_value=value2["StepValue"]["Value"],
|
||||
is_main=False,
|
||||
max_step=value2["StepNum"],
|
||||
)
|
||||
for value in sub_affix_data:
|
||||
key = str(value["GroupID"])
|
||||
data: Dict[str, SingleRelicAffix] = sub_affix_groups_map.get(key, {})
|
||||
|
||||
value2 = value
|
||||
key2 = str(value2["AffixID"])
|
||||
data[key2] = SingleRelicAffix(
|
||||
id=value2["AffixID"],
|
||||
property=RelicAffix(value2["Property"]),
|
||||
base_value=value2["BaseValue"]["Value"],
|
||||
step_value=value2["StepValue"]["Value"],
|
||||
is_main=False,
|
||||
max_step=value2["StepNum"],
|
||||
)
|
||||
|
||||
sub_affix_groups_map[key] = data
|
||||
for final_data in final_datas:
|
||||
final_data.sub_affix = sub_affix_groups_map[str(final_data.sub_affix_group)]
|
||||
|
Loading…
Reference in New Issue
Block a user