材料地图支持沙漠,请更新后使用命令生成地图重新生成

This commit is contained in:
CMHopeSunshine 2022-09-28 16:23:47 +08:00
parent efcdeb9633
commit 73ca9747d6
2 changed files with 6 additions and 5 deletions

View File

@ -62,7 +62,7 @@ async def _(event: GroupMessageEvent, msg: Message = CommandArg(), lang=CommandL
else: else:
game = GuessVoice(event.group_id, pm.config.guess_voice_time, lang) game = GuessVoice(event.group_id, pm.config.guess_voice_time, lang)
result = await game.start() result = await game.start()
await guess_voice.send('即将发送一段语音,将在30秒后公布答案') await guess_voice.send(f'即将发送一段语音,将在{pm.config.guess_voice_time}秒后公布答案')
try: try:
await guess_voice.finish(result) await guess_voice.finish(result)
except ActionFailed: except ActionFailed:

View File

@ -24,16 +24,17 @@ map_name_reverse = {
} }
async def init_map(refresh: bool = False): async def init_map():
""" """
初始化地图 初始化地图
:param refresh: 是否刷新
""" """
for map_id in models.MapID: for map_id in models.MapID:
save_path = RESOURCE_BASE_PATH / 'genshin_map' / 'results' / f'{map_id.name}.png' save_path = RESOURCE_BASE_PATH / 'genshin_map' / 'results' / f'{map_id.name}.png'
save_path.parent.mkdir(parents=True, exist_ok=True) save_path.parent.mkdir(parents=True, exist_ok=True)
if map_id.name == 'golden_apple_archipelago' or (save_path.exists() and not refresh): if map_id.name == 'golden_apple_archipelago':
continue continue
if save_path.exists():
save_path.unlink()
status_icon = await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'status_icon.png') status_icon = await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'status_icon.png')
anchor_icon = await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'anchor_icon.png') anchor_icon = await load_image(RESOURCE_BASE_PATH / 'genshin_map' / 'anchor_icon.png')
maps = await request.get_maps(map_id) maps = await request.get_maps(map_id)
@ -46,7 +47,7 @@ async def init_map(refresh: bool = False):
for point in anchor_points: for point in anchor_points:
map_img.paste(anchor_icon, (int(point.x) - 32, int(point.y) - 64), anchor_icon) map_img.paste(anchor_icon, (int(point.x) - 32, int(point.y) - 64), anchor_icon)
map_img.save(save_path) map_img.save(save_path)
logger.info('原神地图', f'<m>{map_name[map_id.name]}</m>地图初始化完成') logger.info('原神地图', f'<m>{map_name[map_id.name]}</m>地图生成完成')
return f'地图资源生成完成,目前有{"".join(list(map_name_reverse.keys()))}地图。' return f'地图资源生成完成,目前有{"".join(list(map_name_reverse.keys()))}地图。'