mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-05 11:13:45 +08:00
消除几个报错
This commit is contained in:
parent
99fd1d2cbb
commit
30818559cd
@ -1,32 +1,18 @@
|
|||||||
|
import copy
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import textwrap
|
import textwrap
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, Union
|
from typing import Dict, Union
|
||||||
import copy
|
|
||||||
from PIL import Image, ImageDraw
|
|
||||||
from gsuid_core.logger import logger
|
from gsuid_core.logger import logger
|
||||||
from gsuid_core.utils.image.convert import convert_img
|
from gsuid_core.utils.image.convert import convert_img
|
||||||
from gsuid_core.utils.image.image_tools import draw_text_by_line
|
from gsuid_core.utils.image.image_tools import draw_text_by_line
|
||||||
|
from PIL import Image, ImageDraw
|
||||||
|
|
||||||
from .to_data import api_to_dict
|
|
||||||
from ..utils.error_reply import CHAR_HINT
|
from ..utils.error_reply import CHAR_HINT
|
||||||
from .cal_damage import cal, cal_char_info, cal_info
|
|
||||||
from ..utils.fonts.first_world import fw_font_28
|
|
||||||
from ..utils.excel.read_excel import light_cone_ranks
|
from ..utils.excel.read_excel import light_cone_ranks
|
||||||
from ..utils.map.name_covert import name_to_avatar_id, alias_to_char_name
|
from ..utils.fonts.first_world import fw_font_28
|
||||||
from ..utils.map.SR_MAP_PATH import (
|
|
||||||
RelicId2Rarity,
|
|
||||||
AvatarRelicScore,
|
|
||||||
avatarId2Name,
|
|
||||||
)
|
|
||||||
from ..utils.resource.RESOURCE_PATH import (
|
|
||||||
RELIC_PATH,
|
|
||||||
SKILL_PATH,
|
|
||||||
PLAYER_PATH,
|
|
||||||
WEAPON_PATH,
|
|
||||||
CHAR_PORTRAIT_PATH,
|
|
||||||
)
|
|
||||||
from ..utils.fonts.starrail_fonts import (
|
from ..utils.fonts.starrail_fonts import (
|
||||||
sr_font_18,
|
sr_font_18,
|
||||||
sr_font_20,
|
sr_font_20,
|
||||||
@ -37,6 +23,21 @@ from ..utils.fonts.starrail_fonts import (
|
|||||||
sr_font_34,
|
sr_font_34,
|
||||||
sr_font_38,
|
sr_font_38,
|
||||||
)
|
)
|
||||||
|
from ..utils.map.name_covert import alias_to_char_name, name_to_avatar_id
|
||||||
|
from ..utils.map.SR_MAP_PATH import (
|
||||||
|
AvatarRelicScore,
|
||||||
|
RelicId2Rarity,
|
||||||
|
avatarId2Name,
|
||||||
|
)
|
||||||
|
from ..utils.resource.RESOURCE_PATH import (
|
||||||
|
CHAR_PORTRAIT_PATH,
|
||||||
|
PLAYER_PATH,
|
||||||
|
RELIC_PATH,
|
||||||
|
SKILL_PATH,
|
||||||
|
WEAPON_PATH,
|
||||||
|
)
|
||||||
|
from .cal_damage import cal_char_info, cal_info
|
||||||
|
from .to_data import api_to_dict
|
||||||
|
|
||||||
Excel_path = Path(__file__).parent / 'damage'
|
Excel_path = Path(__file__).parent / 'damage'
|
||||||
with Path.open(Excel_path / 'Excel' / 'SkillData.json', encoding='utf-8') as f:
|
with Path.open(Excel_path / 'Excel' / 'SkillData.json', encoding='utf-8') as f:
|
||||||
@ -611,6 +612,7 @@ async def draw_char_img(char_data: Dict, sr_uid: str, msg: str):
|
|||||||
if damage_len > 0:
|
if damage_len > 0:
|
||||||
damage_title_img = Image.open(TEXT_PATH / 'base_info_pure.png')
|
damage_title_img = Image.open(TEXT_PATH / 'base_info_pure.png')
|
||||||
char_info.paste(damage_title_img, (0, 2028), damage_title_img)
|
char_info.paste(damage_title_img, (0, 2028), damage_title_img)
|
||||||
|
damage_list = []
|
||||||
# damage_list = await cal(char_data)
|
# damage_list = await cal(char_data)
|
||||||
# 写伤害
|
# 写伤害
|
||||||
char_img_draw.text(
|
char_img_draw.text(
|
||||||
|
@ -2,33 +2,33 @@ import asyncio
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Tuple, Union
|
from typing import Dict, List, Tuple, Union
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from aiohttp import ClientTimeout, TCPConnector
|
||||||
from msgspec import json as msgjson
|
|
||||||
from gsuid_core.logger import logger
|
|
||||||
from aiohttp.client import ClientSession
|
from aiohttp.client import ClientSession
|
||||||
from aiohttp import TCPConnector, ClientTimeout
|
from bs4 import BeautifulSoup
|
||||||
from gsuid_core.utils.download_resource.download_file import download
|
from gsuid_core.logger import logger
|
||||||
from gsuid_core.utils.download_resource.download_core import check_url
|
from gsuid_core.utils.download_resource.download_core import check_url
|
||||||
|
from gsuid_core.utils.download_resource.download_file import download
|
||||||
|
from msgspec import json as msgjson
|
||||||
|
|
||||||
from .download_url import download_file
|
from .download_url import download_file
|
||||||
from .RESOURCE_PATH import (
|
from .RESOURCE_PATH import (
|
||||||
WIKI_PATH,
|
CHAR_ICON_PATH,
|
||||||
|
CHAR_PORTRAIT_PATH,
|
||||||
|
CHAR_PREVIEW_PATH,
|
||||||
|
CONSUMABLE_PATH,
|
||||||
|
ELEMENT_PATH,
|
||||||
|
GUIDE_CHARACTER_PATH,
|
||||||
|
GUIDE_LIGHT_CONE_PATH,
|
||||||
GUIDE_PATH,
|
GUIDE_PATH,
|
||||||
RELIC_PATH,
|
RELIC_PATH,
|
||||||
|
RESOURCE_PATH,
|
||||||
SKILL_PATH,
|
SKILL_PATH,
|
||||||
WEAPON_PATH,
|
WEAPON_PATH,
|
||||||
ELEMENT_PATH,
|
|
||||||
RESOURCE_PATH,
|
|
||||||
CHAR_ICON_PATH,
|
|
||||||
WIKI_ROLE_PATH,
|
|
||||||
CONSUMABLE_PATH,
|
|
||||||
WIKI_RELIC_PATH,
|
|
||||||
CHAR_PREVIEW_PATH,
|
|
||||||
CHAR_PORTRAIT_PATH,
|
|
||||||
GUIDE_CHARACTER_PATH,
|
|
||||||
WIKI_LIGHT_CONE_PATH,
|
WIKI_LIGHT_CONE_PATH,
|
||||||
GUIDE_LIGHT_CONE_PATH,
|
|
||||||
WIKI_MATERIAL_FOR_ROLE,
|
WIKI_MATERIAL_FOR_ROLE,
|
||||||
|
WIKI_PATH,
|
||||||
|
WIKI_RELIC_PATH,
|
||||||
|
WIKI_ROLE_PATH,
|
||||||
)
|
)
|
||||||
|
|
||||||
with Path.open(
|
with Path.open(
|
||||||
@ -45,15 +45,15 @@ async def find_fastest_url(urls: Dict[str, str]):
|
|||||||
for tag in urls:
|
for tag in urls:
|
||||||
tasks.append(asyncio.create_task(check_url(tag, urls[tag])))
|
tasks.append(asyncio.create_task(check_url(tag, urls[tag])))
|
||||||
|
|
||||||
results: list[tuple[str, str, float]] = await asyncio.gather(
|
results: list[
|
||||||
*tasks, return_exceptions=True
|
tuple[str, str, float] | BaseException
|
||||||
)
|
] = await asyncio.gather(*tasks, return_exceptions=True)
|
||||||
fastest_tag = ''
|
fastest_tag = ''
|
||||||
fastest_url = None
|
fastest_url = None
|
||||||
fastest_time = float('inf')
|
fastest_time = float('inf')
|
||||||
|
|
||||||
for result in results:
|
for result in results:
|
||||||
if isinstance(result, Exception):
|
if isinstance(result, BaseException):
|
||||||
continue
|
continue
|
||||||
tag, url, elapsed_time = result
|
tag, url, elapsed_time = result
|
||||||
if elapsed_time < fastest_time:
|
if elapsed_time < fastest_time:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user