🐛 修复我的背包, 现在会根据米游社数据设定武器列表

This commit is contained in:
KimigaiiWuyi 2024-09-01 03:56:13 +08:00
parent 41fb329067
commit 0324b4a3d6
4 changed files with 11847 additions and 13 deletions

View File

@ -2,11 +2,7 @@ from typing import Dict, List, Union
from gsuid_core.logger import logger
from ..utils.map.GS_MAP_PATH import (
avatarId2Name,
avatarName2Weapon,
weaponId2Name_data,
)
from ..utils.map.GS_MAP_PATH import mysData, avatarName2Weapon
from ..utils.map.name_covert import (
name_to_element,
avatar_id_to_name,
@ -35,13 +31,11 @@ async def get_all_char_dict() -> List[Dict]:
'长柄武器': [],
}
for weapon_id in weaponId2Name_data:
for weapon in mysData['data']['all_weapon']:
weapon_id = str(weapon['id'])
if int(weapon_id[2]) <= 3:
continue
if weapon_id in ['11419', '11420', '11421', '11429', '15513']:
continue
if weapon_id.startswith('11'):
weapon_list['单手剑'].append(weapon_id)
elif weapon_id.startswith('12'):
@ -53,9 +47,8 @@ async def get_all_char_dict() -> List[Dict]:
elif weapon_id.startswith('15'):
weapon_list[''].append(weapon_id)
for char_id in avatarId2Name:
if char_id in ['10000095']:
continue
for char in mysData['data']['all_avatar']:
char_id = str(char['id'])
char_name = await avatar_id_to_name(char_id)
if char_name not in avatarName2Weapon:

View File

@ -19,6 +19,7 @@ from gsuid_core.utils.api.hakush.request import ( # noqa: E402
)
from GenshinUID.utils.map.GS_MAP_PATH import ( # noqa: E402
mysData_fileName,
charList_fileName,
enName2Id_fileName,
icon2Name_fileName,
@ -484,7 +485,15 @@ async def restore_hakush_data():
json.dump(data2, f, ensure_ascii=False)
async def restore_mysData():
base_url = 'https://api-takumi.mihoyo.com'
resp = httpx.get(f'{base_url}/event/platsimulator/config?gids=2&game=hk4e')
with open(MAP_PATH / mysData_fileName, 'w', encoding='UTF-8') as f:
json.dump(resp.json(), f, ensure_ascii=False)
async def main():
await restore_mysData()
await restore_hakush_data()
await download_new_file()
global raw_data

View File

@ -24,8 +24,9 @@ avatarName2Weapon_fileName = f'avatarName2Weapon_mapping_{version}.json'
monster2entry_fileName = f'monster2entry_mapping_{version}.json'
avatarId2SkillList_fileName = f'avatarId2SkillList_mapping_{version}.json'
weaponId2Name_fileName = f'weaponId2Name_mapping_{version}.json'
EXMonster_fileName = 'ExtraMonster.json'
mysData_fileName = f'mysData_{version}.json'
EXMonster_fileName = 'ExtraMonster.json'
charList_fileName = f'charList_{version}.json'
weaponList_fileName = f'weaponList_{version}.json'
@ -108,3 +109,6 @@ with open(MAP / avatarId2SkillList_fileName, 'r', encoding='utf8') as f:
with open(MAP / weaponId2Name_fileName, 'r', encoding='utf8') as f:
weaponId2Name_data = msgjson.decode(f.read(), type=Dict[str, str])
with open(MAP / mysData_fileName, 'r', encoding='utf8') as f:
mysData = msgjson.decode(f.read(), type=Dict)

File diff suppressed because it is too large Load Diff