From 4ce4e4c44c14d4f81c45966265f659cc82671211 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Fri, 15 Oct 2021 15:12:47 +0800 Subject: [PATCH] Update query_resource.py --- .../query_resource_points/query_resource.py | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/plugins/genshin/query_resource_points/query_resource.py b/plugins/genshin/query_resource_points/query_resource.py index d763ec5a..e7fc3ed2 100644 --- a/plugins/genshin/query_resource_points/query_resource.py +++ b/plugins/genshin/query_resource_points/query_resource.py @@ -178,17 +178,22 @@ async def download_map_init( if not _map.exists(): # padding_w, padding_h = data['padding'] data = data["slices"] - map_url = data[0][0]['url'] - await download_image( - map_url, - f"{map_path}/map.png", - session, - semaphore, - force_flag=flag, - ) - map_file = CreateImg( - 0, 0, background=f"{map_path}/map.png", ratio=MAP_RATIO - ) + idx = 0 + for _map_data in data[0]: + map_url = _map_data['url'] + await download_image( + map_url, + f"{map_path}/{idx}.png", + session, + semaphore, + force_flag=flag, + ) + idx += 1 + _w, h = CreateImg(0, 0, background=f"{map_path}/0.png", ratio=MAP_RATIO).size + w = _w * len(os.listdir(map_path)) + map_file = CreateImg(w, h, _w, h, ratio=MAP_RATIO) + for i in range(idx): + map_file.paste(CreateImg(0, 0, background=f"{map_path}/{i}.png", ratio=MAP_RATIO)) map_file.save(f"{map_path}/map.png") else: logger.warning(f'获取原神地图失败 msg: {data["message"]}')