完成版本深渊4.0的数据解析, 样式仍需调整 (#504)

This commit is contained in:
Wuyi无疑 2023-07-18 01:40:06 +08:00
parent 6e9e762046
commit 7ea1822e89
17 changed files with 257 additions and 5 deletions

View File

@ -1,6 +1,8 @@
from pathlib import Path
from typing import List, Literal
import httpx
import aiofiles
from PIL import Image, ImageDraw
from gsuid_core.utils.image.convert import convert_img
from gsuid_core.utils.api.ambr.request import get_ambr_icon
@ -8,8 +10,8 @@ from gsuid_core.utils.image.image_tools import get_color_bg
from ..version import Genshin_version
from .abyss_new_history import history_data
from ..utils.map.GS_MAP_PATH import abyss_data, monster_data
from ..utils.resource.RESOURCE_PATH import TEXT2D_PATH, MONSTER_ICON_PATH
from ..utils.map.GS_MAP_PATH import abyss_data, monster_data, ex_monster_data
from ..utils.fonts.genshin_fonts import (
gs_font_24,
gs_font_28,
@ -23,6 +25,18 @@ upper_tag = Image.open(TEXT_PATH / 'upper_tag.png')
lower_tag = Image.open(TEXT_PATH / 'lower_tag.png')
async def download_Oceanid():
path = MONSTER_ICON_PATH / 'UI_MonsterIcon_Oceanid_Underling.png'
if path.exists():
return
async with httpx.AsyncClient() as client:
response = await client.get(
'https://enka.network/ui/UI_MonsterIcon_Oceanid_Underling.png'
)
async with aiofiles.open(path, 'wb') as file:
await file.write(response.content)
async def get_half_img(data: List, half: Literal['Upper', 'Lower']):
half_img = Image.new('RGBA', (1100, 3000), (0, 0, 0, 0))
upper_h = 60
@ -48,8 +62,14 @@ async def get_half_img(data: List, half: Literal['Upper', 'Lower']):
real_id = '0' + real_id
real_id = '2' + real_id + '01'
monster_num = monster['Num']
monster_name = monster_data[real_id]['name']
icon_name = monster_data[real_id]['icon']
if real_id not in monster_data:
monster_name = ex_monster_data[real_id]['name']
icon_name = ex_monster_data[real_id]['icon']
else:
monster_name = monster_data[real_id]['name']
icon_name = monster_data[real_id]['icon']
monster_icon = await get_ambr_icon(
'monster', icon_name, MONSTER_ICON_PATH
)
@ -74,7 +94,7 @@ async def get_half_img(data: List, half: Literal['Upper', 'Lower']):
(5 + (m_index % 3) * 360, 83 + (m_index // 3) * 110 + temp),
monster_img,
)
temp = wave_monster_uh
temp += wave_monster_uh
tag = upper_tag if half == 'Upper' else lower_tag
half_img.paste(tag, (0, 0), tag)

View File

@ -6,6 +6,7 @@ from gsuid_core.logger import logger
from ..utils.database import get_sqla
from ..genshinuid_resource import startup
from ..genshinuid_xkdata import draw_xk_abyss_img
from ..genshinuid_guide.get_new_abyss_data import download_Oceanid
# from ..genshinuid_enka.start import check_artifacts_list
# from ..genshinuid_guide.get_abyss_data import generate_data
@ -19,6 +20,7 @@ from ..genshinuid_xkdata.get_all_char_data import (
async def all_start():
try:
get_sqla('TEMP')
await download_Oceanid()
await startup()
# await check_artifacts_list()
await create_all_char_card()

View File

@ -22,6 +22,7 @@ icon2Name_fileName = f'icon2Name_mapping_{version}.json'
avatarName2Weapon_fileName = f'avatarName2Weapon_mapping_{version}.json'
monster_fileName = f'monster_{version}.json'
SAConfig_fileName = 'SpiralAbyssFloorConfig.json'
EXMonster_fileName = 'ExtraMonster.json'
class TS(TypedDict):
@ -79,3 +80,6 @@ with open(MAP / monster_fileName, 'r', encoding='utf8') as f:
with open(MAP / SAConfig_fileName, 'r', encoding='utf8') as f:
abyss_data = msgjson.decode(f.read(), type=Dict[str, Dict])
with open(MAP / EXMonster_fileName, 'r', encoding='utf8') as f:
ex_monster_data = msgjson.decode(f.read(), type=Dict[str, Dict])

View File

@ -0,0 +1,226 @@
{
"22100101": {
"id": 22100101,
"name": "深罪浸礼者·火冰雷",
"type": "ABYSS",
"icon": "UI_MonsterIcon_Invoker_Archdeacon",
"route": "Iniquitous Baptist"
},
"22100201": {
"id": 22100201,
"name": "深罪浸礼者·冰水火",
"type": "ABYSS",
"icon": "UI_MonsterIcon_Invoker_Archdeacon",
"route": "Iniquitous Baptist"
},
"22100301": {
"id": 22100301,
"name": "深罪浸礼者·雷火水",
"type": "ABYSS",
"icon": "UI_MonsterIcon_Invoker_Archdeacon",
"route": "Iniquitous Baptist"
},
"22100401": {
"id": 22100401,
"name": "深罪浸礼者·水冰雷",
"type": "ABYSS",
"icon": "UI_MonsterIcon_Invoker_Archdeacon",
"route": "Iniquitous Baptist"
},
"26040101": {
"id": 26040101,
"name": "岩龙蜥·水",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Rock",
"route": "Geovishap"
},
"26040201": {
"id": 26040201,
"name": "岩龙蜥·火",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Rock",
"route": "Geovishap"
},
"26040301": {
"id": 26040301,
"name": "岩龙蜥·雷",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Rock",
"route": "Geovishap"
},
"26040401": {
"id": 26040401,
"name": "岩龙蜥·冰",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Rock",
"route": "Geovishap"
},
"26050101": {
"id": 26040101,
"name": "古岩龙蜥·水",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Primo_Rock",
"route": "Primo Geovishap"
},
"26050201": {
"id": 26040201,
"name": "古岩龙蜥·火",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Primo_Rock",
"route": "Primo Geovishap"
},
"26050301": {
"id": 26040301,
"name": "古岩龙蜥·雷",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Primo_Rock",
"route": "Primo Geovishap"
},
"26050401": {
"id": 26040401,
"name": "古岩龙蜥·冰",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Primo_Rock",
"route": "Primo Geovishap"
},
"20502001": {
"id": 20502001,
"name": "水幻形猪",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20502101": {
"id": 20502101,
"name": "水幻形猪·强化",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20050301": {
"id": 20050301,
"name": "水幻形鹤",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20504001": {
"id": 20504001,
"name": "水幻形蟹",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20504101": {
"id": 20504101,
"name": "水幻形蟹·强化",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20050501": {
"id": 20050501,
"name": "水幻形雀",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20050601": {
"id": 20050601,
"name": "水幻形鸭",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20507001": {
"id": 20507001,
"name": "水幻形鼠",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20507101": {
"id": 20507101,
"name": "水幻形鼠·强化",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20050801": {
"id": 20050801,
"name": "水幻形蛙",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"20050901": {
"id": 20050901,
"name": "水幻形鹰",
"type": "ELEMENTAL",
"icon": "UI_MonsterIcon_Oceanid_Underling",
"route": "Water-Splitting Phantasm"
},
"26050901": {
"id": 26050901,
"name": "深海龙蜥幼体·原种",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Deepsea_Water",
"route": "Primordial Bathysmal Vishap"
},
"26051001": {
"id": 26051001,
"name": "深海龙蜥幼体·啮冰",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Deepsea_Ice",
"route": "Rimebiter Bathysmal Vishap"
},
"26051101": {
"id": 26051101,
"name": "深海龙蜥幼体·吞雷",
"type": "BEAST",
"icon": "UI_MonsterIcon_Drake_Deepsea_Electric",
"route": "Bolteater Bathysmal Vishap"
},
"24065901": {
"id": 24065901,
"name": "压制特化型机关·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Ruggiero_02",
"route": "Suppression Specialist Mek"
},
"24066201": {
"id": 24066201,
"name": "建造特化型机关·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Excavator",
"route": "Suppression Specialist Mek"
},
"24061201": {
"id": 24061201,
"name": "建造特化型机关·荒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Excavator",
"route": "Suppression Specialist Mek"
},
"24061001": {
"id": 24061201,
"name": "歼灭特化型机关·荒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Bradamante",
"route": "Suppression Specialist Mek"
},
"26170101": {
"id": 26170101,
"name": "铁甲熔火帝皇",
"type": "BEAST",
"icon": "UI_MonsterIcon_HermitCrab_Primo",
"route": "Suppression Specialist Mek"
},
"24070101": {
"id": 24070101,
"name": "冰风组曲",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Nutcracker",
"route": "Suppression Specialist Mek"
}
}

View File

@ -1,2 +1,2 @@
GenshinUID_version = '4.0.2'
Genshin_version = '3.7.0'
Genshin_version = '3.8.0'