🐛 修复武器介绍雾切 (#592)

This commit is contained in:
KimigaiiWuyi 2023-10-16 23:04:24 +08:00
parent 5884ddbe4c
commit b771e5916f
3 changed files with 11 additions and 2 deletions

View File

@ -195,7 +195,7 @@ async def draw_weapons_wiki_img(data: Weapon, stats: WeaponStats):
if _cost_pic is None:
cost_pic = get_unknown_png()
else:
cost_pic = _cost_pic.resize((64, 64))
cost_pic = _cost_pic.convert('RGBA').resize((64, 64))
if not cost_pos and material['materialtype'] == '武器突破素材':
pos = material['dropdomain']

View File

@ -19,8 +19,10 @@ async def _get_assets(
return Image.open(path)
if type == 'AMBR':
URL = AMBR_UI
EURL = ENKA_UI
else:
URL = ENKA_UI
EURL = AMBR_UI
async with ClientSession() as sess:
async with sess.get(URL.format(name)) as res:
if res.status == 200:
@ -29,7 +31,14 @@ async def _get_assets(
await f.write(content)
return Image.open(BytesIO(content))
else:
return None
async with sess.get(EURL.format(name)) as res:
if res.status == 200:
content = await res.read()
async with aiofiles.open(path, 'wb') as f:
await f.write(content)
return Image.open(BytesIO(content))
else:
return None
async def get_assets_from_enka(name: str) -> Optional[Image.Image]:

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B