mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-06-04 22:49:47 +08:00
完善Map制作方式
This commit is contained in:
parent
56ae609c94
commit
2e70e18b2d
@ -1,24 +1,30 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from pathlib import Path
|
|
||||||
import httpx
|
|
||||||
import json
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
R_PATH = Path(__file__).parents[0]
|
R_PATH = Path(__file__).parents[0]
|
||||||
MAP_PATH = R_PATH / 'map'
|
MAP_PATH = R_PATH / 'map'
|
||||||
DATA_PATH = R_PATH / 'data'
|
DATA_PATH = R_PATH / 'data'
|
||||||
|
|
||||||
verison = '2.7.0'
|
version = '2.7.0'
|
||||||
|
version_old = '2.6.0'
|
||||||
|
|
||||||
avatarName2Element_fileName = f'avatarName2Element_mapping_{verison}.json'
|
avatarName2Element_fileName = f'avatarName2Element_mapping_{version}.json'
|
||||||
weaponHash2Name_fileName = f'weaponHash2Name_mapping_{verison}.json'
|
weaponHash2Name_fileName = f'weaponHash2Name_mapping_{version}.json'
|
||||||
weaponHash2Type_fileName = f'weaponHash2Type_mapping_{verison}.json'
|
weaponHash2Type_fileName = f'weaponHash2Type_mapping_{version}.json'
|
||||||
skillId2Name_fileName = f'skillId2Name_mapping_{verison}.json'
|
skillId2Name_fileName = f'skillId2Name_mapping_{version}.json'
|
||||||
talentId2Name_fileName = f'talentId2Name_mapping_{verison}.json'
|
talentId2Name_fileName = f'talentId2Name_mapping_{version}.json'
|
||||||
avatarId2Name_fileName = f'avatarId2Name_mapping_{verison}.json'
|
avatarId2Name_fileName = f'avatarId2Name_mapping_{version}.json'
|
||||||
|
|
||||||
|
artifact2attr_fileName = f'artifact2attr_mapping_{version_old}.json'
|
||||||
|
icon2Name_fileName = f'icon2Name_mapping_{version_old}.json'
|
||||||
|
|
||||||
with open(DATA_PATH / 'textMap.json', "r", encoding='UTF-8') as f:
|
with open(DATA_PATH / 'textMap.json', "r", encoding='UTF-8') as f:
|
||||||
raw_data = json.load(f)
|
raw_data = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
async def avatarId2NameJson() -> None:
|
async def avatarId2NameJson() -> None:
|
||||||
with open(DATA_PATH / 'AvatarExcelConfigData.json', "r", encoding='UTF-8') as f:
|
with open(DATA_PATH / 'AvatarExcelConfigData.json', "r", encoding='UTF-8') as f:
|
||||||
avatar_data = json.load(f)
|
avatar_data = json.load(f)
|
||||||
@ -30,6 +36,7 @@ async def avatarId2NameJson() -> None:
|
|||||||
with open(MAP_PATH / avatarId2Name_fileName, 'w', encoding='UTF-8') as file:
|
with open(MAP_PATH / avatarId2Name_fileName, 'w', encoding='UTF-8') as file:
|
||||||
json.dump(temp, file, ensure_ascii=False)
|
json.dump(temp, file, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
async def avatarName2ElementJson() -> None:
|
async def avatarName2ElementJson() -> None:
|
||||||
with open(MAP_PATH / avatarId2Name_fileName, "r", encoding='UTF-8') as f:
|
with open(MAP_PATH / avatarId2Name_fileName, "r", encoding='UTF-8') as f:
|
||||||
avatarId2Name = json.load(f)
|
avatarId2Name = json.load(f)
|
||||||
@ -46,6 +53,7 @@ async def avatarName2ElementJson() -> None:
|
|||||||
with open(MAP_PATH / avatarName2Element_fileName, 'w', encoding='UTF-8') as file:
|
with open(MAP_PATH / avatarName2Element_fileName, 'w', encoding='UTF-8') as file:
|
||||||
json.dump(temp, file, ensure_ascii=False)
|
json.dump(temp, file, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
async def weaponHash2NameJson() -> None:
|
async def weaponHash2NameJson() -> None:
|
||||||
with open(DATA_PATH / 'WeaponExcelConfigData.json', "r", encoding='UTF-8') as f:
|
with open(DATA_PATH / 'WeaponExcelConfigData.json', "r", encoding='UTF-8') as f:
|
||||||
weapon_data = json.load(f)
|
weapon_data = json.load(f)
|
||||||
@ -57,7 +65,8 @@ async def weaponHash2NameJson() -> None:
|
|||||||
with open(MAP_PATH / weaponHash2Name_fileName, 'w', encoding='UTF-8') as file:
|
with open(MAP_PATH / weaponHash2Name_fileName, 'w', encoding='UTF-8') as file:
|
||||||
json.dump(temp, file, ensure_ascii=False)
|
json.dump(temp, file, ensure_ascii=False)
|
||||||
|
|
||||||
async def weaponHash2NameJson() -> None:
|
|
||||||
|
async def weaponHash2TypeJson() -> None:
|
||||||
with open(DATA_PATH / 'WeaponExcelConfigData.json', "r", encoding='UTF-8') as f:
|
with open(DATA_PATH / 'WeaponExcelConfigData.json', "r", encoding='UTF-8') as f:
|
||||||
weapon_data = json.load(f)
|
weapon_data = json.load(f)
|
||||||
|
|
||||||
@ -80,6 +89,7 @@ async def weaponHash2NameJson() -> None:
|
|||||||
with open(MAP_PATH / weaponHash2Type_fileName, 'w', encoding='UTF-8') as file:
|
with open(MAP_PATH / weaponHash2Type_fileName, 'w', encoding='UTF-8') as file:
|
||||||
json.dump(temp, file, ensure_ascii=False)
|
json.dump(temp, file, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
async def skillId2NameJson() -> None:
|
async def skillId2NameJson() -> None:
|
||||||
with open(DATA_PATH / 'AvatarSkillExcelConfigData.json', "r", encoding='UTF-8') as f:
|
with open(DATA_PATH / 'AvatarSkillExcelConfigData.json', "r", encoding='UTF-8') as f:
|
||||||
skill_data = json.load(f)
|
skill_data = json.load(f)
|
||||||
@ -92,6 +102,7 @@ async def skillId2NameJson() -> None:
|
|||||||
with open(MAP_PATH / skillId2Name_fileName, 'w', encoding='UTF-8') as file:
|
with open(MAP_PATH / skillId2Name_fileName, 'w', encoding='UTF-8') as file:
|
||||||
json.dump(temp, file, ensure_ascii=False)
|
json.dump(temp, file, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
async def talentId2NameJson() -> None:
|
async def talentId2NameJson() -> None:
|
||||||
with open(DATA_PATH / 'AvatarTalentExcelConfigData.json', "r", encoding='UTF-8') as f:
|
with open(DATA_PATH / 'AvatarTalentExcelConfigData.json', "r", encoding='UTF-8') as f:
|
||||||
talent_data = json.load(f)
|
talent_data = json.load(f)
|
||||||
@ -104,6 +115,34 @@ async def talentId2NameJson() -> None:
|
|||||||
with open(MAP_PATH / talentId2Name_fileName, 'w', encoding='UTF-8') as file:
|
with open(MAP_PATH / talentId2Name_fileName, 'w', encoding='UTF-8') as file:
|
||||||
json.dump(temp, file, ensure_ascii=False)
|
json.dump(temp, file, ensure_ascii=False)
|
||||||
|
|
||||||
|
async def artifact2attrJson() -> None:
|
||||||
|
with open(DATA_PATH / 'ReliquaryExcelConfigData.json', "r", encoding='UTF-8') as f:
|
||||||
|
reliquary_data = json.load(f)
|
||||||
|
|
||||||
|
with open(DATA_PATH / 'DisplayItemExcelConfigData.json', "r", encoding='UTF-8') as f:
|
||||||
|
Display_data = json.load(f)
|
||||||
|
|
||||||
|
temp = {}
|
||||||
|
for i in reliquary_data:
|
||||||
|
temp[str(i['icon'])] = raw_data[str(i['nameTextMapHash'])]
|
||||||
|
|
||||||
|
with open(MAP_PATH / icon2Name_fileName, 'w', encoding='UTF-8') as file:
|
||||||
|
json.dump(temp, file, ensure_ascii=False)
|
||||||
|
|
||||||
|
temp2 = {}
|
||||||
|
for i in Display_data:
|
||||||
|
if i['icon'].startswith('UI_RelicIcon'):
|
||||||
|
temp2[raw_data[str(i['nameTextMapHash'])]] = '_'.join(i['icon'].split('_')[:-1])
|
||||||
|
|
||||||
|
temp3 = {}
|
||||||
|
for i in temp:
|
||||||
|
for k in temp2:
|
||||||
|
if i.startswith(temp2[k]):
|
||||||
|
temp3[temp[i]] = k
|
||||||
|
|
||||||
|
with open(MAP_PATH / artifact2attr_fileName, 'w', encoding='UTF-8') as file:
|
||||||
|
json.dump(temp3, file, ensure_ascii=False)
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
await avatarId2NameJson()
|
await avatarId2NameJson()
|
||||||
await avatarName2ElementJson()
|
await avatarName2ElementJson()
|
||||||
@ -111,5 +150,6 @@ async def main():
|
|||||||
await skillId2NameJson()
|
await skillId2NameJson()
|
||||||
await talentId2NameJson()
|
await talentId2NameJson()
|
||||||
await weaponHash2NameJson()
|
await weaponHash2NameJson()
|
||||||
|
await artifact2attrJson()
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
@ -10,22 +10,26 @@ ICON_PATH = R_PATH / 'icon'
|
|||||||
DATA_PATH = R_PATH / 'data'
|
DATA_PATH = R_PATH / 'data'
|
||||||
PLAYER_PATH = R_PATH / 'player'
|
PLAYER_PATH = R_PATH / 'player'
|
||||||
|
|
||||||
verison = '2.7.0'
|
version = '2.7.0'
|
||||||
|
version_old = '2.6.0'
|
||||||
|
|
||||||
avatarName2Element_fileName = f'avatarName2Element_mapping_{verison}.json'
|
avatarName2Element_fileName = f'avatarName2Element_mapping_{version}.json'
|
||||||
weaponHash2Name_fileName = f'weaponHash2Name_mapping_{verison}.json'
|
weaponHash2Name_fileName = f'weaponHash2Name_mapping_{version}.json'
|
||||||
weaponHash2Type_fileName = f'weaponHash2Type_mapping_{verison}.json'
|
weaponHash2Type_fileName = f'weaponHash2Type_mapping_{version}.json'
|
||||||
skillId2Name_fileName = f'skillId2Name_mapping_{verison}.json'
|
skillId2Name_fileName = f'skillId2Name_mapping_{version}.json'
|
||||||
talentId2Name_fileName = f'talentId2Name_mapping_{verison}.json'
|
talentId2Name_fileName = f'talentId2Name_mapping_{version}.json'
|
||||||
avatarId2Name_fileName = f'avatarId2Name_mapping_{verison}.json'
|
avatarId2Name_fileName = f'avatarId2Name_mapping_{version}.json'
|
||||||
|
|
||||||
|
artifact2attr_fileName = f'artifact2attr_mapping_{version_old}.json'
|
||||||
|
icon2Name_fileName = f'icon2Name_mapping_{version_old}.json'
|
||||||
|
|
||||||
with open(MAP_PATH / avatarId2Name_fileName, "r", encoding='UTF-8') as f:
|
with open(MAP_PATH / avatarId2Name_fileName, "r", encoding='UTF-8') as f:
|
||||||
avatarId2Name = json.load(f)
|
avatarId2Name = json.load(f)
|
||||||
|
|
||||||
with open(MAP_PATH / 'icon2Name_mapping_2.6.0.json', "r", encoding='UTF-8') as f:
|
with open(MAP_PATH / icon2Name_fileName, "r", encoding='UTF-8') as f:
|
||||||
icon2Name = json.load(f)
|
icon2Name = json.load(f)
|
||||||
|
|
||||||
with open(MAP_PATH / 'artifact2attr_mapping_2.6.0.json', "r", encoding='UTF-8') as f:
|
with open(MAP_PATH / artifact2attr_fileName, "r", encoding='UTF-8') as f:
|
||||||
artifact2attr = json.load(f)
|
artifact2attr = json.load(f)
|
||||||
|
|
||||||
with open(MAP_PATH / 'propId2Name_mapping.json', "r", encoding='UTF-8') as f:
|
with open(MAP_PATH / 'propId2Name_mapping.json', "r", encoding='UTF-8') as f:
|
||||||
@ -214,7 +218,7 @@ async def enkaToData(uid: str, enka_data: Optional[dict] = None) -> dict:
|
|||||||
artifact_temp['nameTextMapHash'] = artifact['flat']['nameTextMapHash']
|
artifact_temp['nameTextMapHash'] = artifact['flat']['nameTextMapHash']
|
||||||
artifact_temp['icon'] = artifact['flat']['icon']
|
artifact_temp['icon'] = artifact['flat']['icon']
|
||||||
artifact_temp['aritifactName'] = icon2Name[artifact['flat']['icon']]
|
artifact_temp['aritifactName'] = icon2Name[artifact['flat']['icon']]
|
||||||
artifact_temp['aritifactSetsName'] = artifact2attr['mapping'][artifact_temp['aritifactName']]
|
artifact_temp['aritifactSetsName'] = artifact2attr[artifact_temp['aritifactName']]
|
||||||
artifact_temp['aritifactSetPiece'] = artifactId2Piece[artifact_temp['icon'].split('_')[-1]][0]
|
artifact_temp['aritifactSetPiece'] = artifactId2Piece[artifact_temp['icon'].split('_')[-1]][0]
|
||||||
artifact_temp['aritifactPieceName'] = artifactId2Piece[artifact_temp['icon'].split('_')[-1]][1]
|
artifact_temp['aritifactPieceName'] = artifactId2Piece[artifact_temp['icon'].split('_')[-1]][1]
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user