🐛 修复材料地图,增加材料数单次上限

This commit is contained in:
CMHopeSunshine 2022-09-18 22:51:18 +08:00
parent f875cf8611
commit 14a4fceb29
2 changed files with 4 additions and 2 deletions

View File

@ -159,6 +159,8 @@ async def _(event: MessageEvent, map_: str = Arg('map'), names=Arg('names')):
if not freq_limiter.check(f'材料地图_{event.group_id if isinstance(event, GroupMessageEvent) else event.user_id}'):
await material_map_full.finish(f'材料地图查询冷却中,剩余{freq_limiter.left(f"材料地图_{event.group_id if isinstance(event, GroupMessageEvent) else event.user_id}")}', at_sender=True)
freq_limiter.start(f'材料地图_{event.group_id if isinstance(event, GroupMessageEvent) else event.user_id}', 15)
if len(names) > 3:
names = names[:3]
await material_map_full.send(MessageBuild.Text(f'开始查找{"".join(names)}的资源点,请稍候...'))
result = await get_full_map(names, map_)
await material_map_full.finish(result, at_sender=True)

View File

@ -78,7 +78,7 @@ async def draw_map(name: str, map_: str):
models.XYPoint(x1_temp, y1_temp),
models.XYPoint(x2_temp, y2_temp),
points)]
map_img = await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'results' / f'{map_id.name}.png')
map_img = (await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'results' / f'{map_id.name}.png')).copy()
lt_point = group_point[0][0]
rb_point = group_point[0][1]
map_img = map_img.crop((int(lt_point.x), int(lt_point.y), int(rb_point.x), int(rb_point.y)))
@ -134,7 +134,7 @@ async def get_full_map(names: List[str], map_: str):
resources_not.append(resource.name)
if not resources_points:
return MessageBuild.Text(f'{map_}未查找到材料{"".join(names)},请尝试其他地图')
map_img = await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'results' / f'{map_id.name}.png')
map_img = (await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'results' / f'{map_id.name}.png')).copy()
box_icon = await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'point_box.png')
i = 0
max_point = XYPoint(x=0, y=0)