diff --git a/README.md b/README.md
index 30257f6..9f45ea4 100644
--- a/README.md
+++ b/README.md
@@ -13,28 +13,30 @@
(具体命令请看本页面下方功能命令和描述)
-+ [马娘新闻播报](https://github.com/azmiao/umamusume_news) 【本整合版已支持台服】
++ [马娘新闻播报](https://github.com/azmiao/umamusume_news) 【已支持台/日服】
+ [马娘模拟抽卡](https://github.com/azmiao/uma_gacha)
+ 马娘基础数据库
-+ 支援卡节奏榜【已支持台服】
++ 支援卡节奏榜【已支持台/日服】
-+ 相性计算器
++ 相性计算器【台/日通用】
-+ 马娘黄历
++ 马娘黄历【台/日通用】
-+ 马娘耐力计算器
++ 马娘耐力计算器【台/日通用】
-+ 马娘表情包
++ 马娘表情包【台/日通用】
-+ 马娘漫画
++ 马娘漫画【台/日通用】
+ 马娘限时任务
+ 马娘技能查询
++ 育成目标查询【台/日差不多通用】
+
@@ -53,19 +55,21 @@ https://github.com/azmiao/uma_plugin/
## 最近的更新日志
+22-07-08 v2.3.0 新增查询赛程的育成目标功能,使用命令 “查目标 角色名” 即可,结果图片仿自bwiki,[issue #25](https://github.com/azmiao/uma_plugin/issues/25)
+
22-07-06 v2.2.2 修复台服支援卡命名方式变化后的BUG,更新后请务必手动删除uma_support_chart文件夹下的`sup_config_tw.json`再重启hoshino
22-07-05 v2.2.1 修复支援卡节奏榜网页更新后的BUG,更新后请务必手动删除uma_support_chart文件夹下的`sup_config.json`再重启hoshino,[issue #24](https://github.com/azmiao/uma_plugin/issues/24)
22-06-30 v2.2.0 新增台服马娘新闻功能,整进了“马娘新闻帮助”里
-22-06-30 v2.1.0 新增台服支援卡节奏榜功能,整进了“支援卡节奏榜帮助”里
-
更以前的更新日志
+22-06-30 v2.1.0 新增台服支援卡节奏榜功能,整进了“支援卡节奏榜帮助”里
+
22-06-24 v2.0.4 请务必更新!同步translators更新,以便修复马娘新闻翻译显示不全的BUG
22-06-23 v2.0.3 马娘新闻修复不具合翻译不了的BUG和其他遇不到的BUG,且现在支持配置代理,已添加进本文档的食用教程里
@@ -332,6 +336,16 @@ git pull
+
+马娘育成目标
+
+| 功能命令 | 介绍 |
+| :---- | :---- |
+| 查目标 xxx | xxx是指要查的马娘名,查询该马娘的育成目标 |
+| 查目标 xxx-f | 某尾加上-f为强制重新生成图片,不使用缓存,默认情况下生成一次后续就一直用缓存 |
+
+
+
## 食用教程:
diff --git a/__init__.py b/__init__.py
index 951d43f..78efc3b 100644
--- a/__init__.py
+++ b/__init__.py
@@ -27,6 +27,7 @@
马娘漫画帮助
马娘限时任务帮助
马娘技能帮助
+育成目标帮助
注:数据来自马娘官网和Bwiki
'''.strip()
diff --git a/uma_info/replace_dict.json b/uma_info/replace_dict.json
index ff379df..cf9b8dc 100644
--- a/uma_info/replace_dict.json
+++ b/uma_info/replace_dict.json
@@ -4,7 +4,7 @@
"tokaiteio": ["东海帝王", "帝王", "帝皇", "痛快铁奥"],
"maruzensky": ["司机", "姥爷", "老阿姨"],
"fujikiseki": ["富士", "奇迹", "富士奇石"],
- "oguricap": ["历战王", "帽子", "欧鼓励", "小礼帽"],
+ "oguricap": ["历战王", "帽子", "欧鼓励", "小礼帽", "帽门"],
"goldship": ["皮皮船", "船"],
"vodka": [],
"daiwascarlet": ["大和", "红字白字"],
@@ -42,14 +42,14 @@
"seekingthepearl": [],
"sakurabakushino": ["进王", "爆进", "暴进", "爆进王", "暴进王", "樱花暴进王"],
"shinkowindy": ["新风光"],
- "sweeptosho": ["东尚", "东商", "魔女"],
+ "sweeptosho": ["东尚", "东商", "魔女", "小魔女"],
"supercreek": ["小海湾", "海湾", "大海湾", "超级大海湾", "海湾妈妈", "超级小溪"],
"smartfalcon": ["飞鹰", "飞鹰子", "寄", "寄寄子"],
"zennorobroy": ["荒漠"],
"tosenjordan": ["辣妹", "佐敦"],
"nakayamafesta": ["中山庆典"],
"naritataishin": ["大进", "成田小进", "小进", "迫影人", "迫影"],
- "nishinoflower": [],
+ "nishinoflower": ["小花"],
"haruurara": ["乌拉拉", "春丽", "urara"],
"bamboomemory": ["青竹"],
"marveloussunday": ["周日宁静", "周日"],
@@ -66,7 +66,7 @@
"daitakuhelios": ["太阳神"],
"twinturbo": ["俩喷射", "两喷射", "那个啥"],
"satonodiamond": ["光钻", "钻哥"],
- "kitasanblack": ["北黑", "侑开始了", "悸动战士"],
+ "kitasanblack": ["北黑", "侑开始了", "悸动战士", "小北"],
"sakurachiyonoo": ["千代王"],
"siriussymboli": ["天狼星"],
"mejiroardan": ["阿尔丹", "中国媳妇"],
@@ -81,7 +81,7 @@
"astonmachan": ["真弓快车"],
"xxxx01": ["里见皇冠", "皇冠"],
"xxxx02": ["高尚俊逸", "高尚骏逸"],
- "copanorickey": ["小林历奇"],
+ "copanorickey": ["小林历奇", "小林"],
"happymik": ["米可", "快乐温顺"],
"bitterglasse": ["苦涩眼镜"],
"littlecocon": ["小可可"],
diff --git a/uma_target/__init__.py b/uma_target/__init__.py
new file mode 100644
index 0000000..6763624
--- /dev/null
+++ b/uma_target/__init__.py
@@ -0,0 +1,46 @@
+import os
+import json
+
+from hoshino import Service
+from .get_target import get_tar
+
+sv_help = '''
+注:xxx是指要查的马娘名
+[查目标 xxx] 查询该马娘的育成目标
+[查目标 xxx-f] 某尾加上-f为强制重新生成图片
+'''.strip()
+
+sv = Service('uma_target', help_ = sv_help)
+
+@sv.on_fullmatch('育成目标帮助')
+async def get_help(bot, ev):
+ await bot.send(ev, sv_help)
+
+@sv.on_prefix('查目标')
+async def search_target(bot, ev):
+ uma_name_tmp = str(ev.message).replace('-f', '')
+ is_force = True if str(ev.message).endswith('-f') else False
+ current_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'uma_info/config.json')
+ with open(current_dir, 'r', encoding = 'UTF-8') as f:
+ f_data = json.load(f)
+ with open(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'uma_info/replace_dict.json'), 'r', encoding = 'UTF-8') as af:
+ replace_data = json.load(af)
+ uma_target = ''
+ name_list = list(f_data.keys())
+ name_list.remove('current_chara')
+ for uma_name in name_list:
+ if f_data[uma_name]['category'] == 'umamusume':
+ other_name_list = list(replace_data[uma_name])
+ if f_data[uma_name]['cn_name']:
+ cn_name = f_data[uma_name]['cn_name']
+ else:
+ continue
+ if str(uma_name) == uma_name_tmp or str(cn_name) == uma_name_tmp or\
+ str(f_data[uma_name]['jp_name']) == uma_name_tmp or str(uma_name_tmp) in other_name_list:
+ try:
+ uma_target = await get_tar(cn_name, is_force)
+ except:
+ await bot.finish(ev, f'这只马娘不存在或暂时没有育成目标')
+ if not uma_target:
+ await bot.finish(ev, f'这只马娘不存在或暂时没有育成目标')
+ await bot.send(ev, uma_target)
\ No newline at end of file
diff --git a/uma_target/get_target.py b/uma_target/get_target.py
new file mode 100644
index 0000000..fbbee4b
--- /dev/null
+++ b/uma_target/get_target.py
@@ -0,0 +1,68 @@
+import os
+import httpx
+from bs4 import BeautifulSoup
+from PIL import Image, ImageDraw, ImageFont, ImageColor
+
+from hoshino import R, logger
+
+# 获取育成目标的数据
+async def get_tar_data(uma_name):
+ url = f'https://wiki.biligame.com/umamusume/{uma_name}'
+ res = httpx.get(url, timeout=10)
+ soup = BeautifulSoup(res.text, 'lxml')
+ target_tmp = soup.find_all('table', {"style":"width:100%;margin:0px"})[-1]
+ row_list = target_tmp.find_all('tr')
+ data, i = {}, 0
+ while (i <= 44 and row_list[i+1].find('td').text.strip()):
+ race = row_list[i+3].find('td').text.strip().replace('\t', ' ').replace(' ', ' ').replace('\n', ' | ')\
+ .replace('\xa0', ' ')
+ data[row_list[i].text.strip()] = {
+ row_list[i+1].find('th').text.strip(): row_list[i+1].find('td').text.strip(),
+ row_list[i+2].find('th').text.strip(): row_list[i+2].find('td').text.strip(),
+ row_list[i+3].find('th').text.strip(): race
+ }
+ i += 4
+ return data
+
+# 制作图片
+async def generate_img(uma_name):
+ data = await get_tar_data(uma_name)
+ target_list = list(data.keys())
+ end_img = Image.new('RGB', (1800, 136+309*len(target_list)))
+ title_img = Image.open(os.path.abspath(os.path.join(os.path.dirname(__file__), 'title.png'))).convert("RGBA")
+ target_img = Image.open(os.path.abspath(os.path.join(os.path.dirname(__file__), 'target.png'))).convert("RGBA")
+ end_img.paste(title_img, (0, 0))
+ all_height = 136
+ font_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), f'simhei.ttf')
+ font_rgb = ImageColor.getrgb('#8B4513')
+ for target in target_list:
+ img_font = ImageFont.truetype(font_path, 50, index=0)
+ end_img.paste(target_img, (0, all_height))
+ draw_img = ImageDraw.Draw(end_img)
+ # 调整居中
+ img_size = draw_img.multiline_textsize(target, font=img_font)
+ start_width = 900 - img_size[0] / 2
+ if start_width < 0 : start_width = 15.45
+ draw_img.text(xy=(start_width, all_height+15.45), text=target, font=img_font, fill=font_rgb)
+ draw_img.text(xy=(135, all_height+92.7), text='时间', font=img_font, fill=font_rgb)
+ draw_img.text(xy=(135, all_height+169.95), text='条件', font=img_font, fill=font_rgb)
+ draw_img.text(xy=(80, all_height+247.2), text='比赛描述', font=img_font, fill=font_rgb)
+ draw_img.text(xy=(380, all_height+92.7), text=data[target]['时间'], font=img_font, fill=font_rgb)
+ draw_img.text(xy=(380, all_height+169.95), text=data[target]['条件'], font=img_font, fill=font_rgb)
+ if uma_name == '大和赤骥' and target.startswith('目标4'):
+ img_font = ImageFont.truetype(font_path, 32, index=0)
+ draw_img.text(xy=(380, all_height+247.2), text=data[target]['比赛描述'], font=img_font, fill=font_rgb)
+ all_height += 309
+ return end_img
+
+# 返回目标图片
+async def get_tar(uma_name, is_force):
+ if not os.path.exists(os.path.join(R.img('umamusume').path, f'uma_target/')):
+ os.mkdir(os.path.join(R.img('umamusume').path, f'uma_target/'))
+ img_path = os.path.join(R.img('umamusume').path, f'uma_target/target_{uma_name}.png')
+ if not os.path.exists(img_path) or is_force:
+ img = await generate_img(uma_name)
+ img.save(img_path, 'PNG')
+ logger.info(f'{uma_name}的育成目标图片不存在,现已成功生成!')
+ logger.info(f'{uma_name}的育成目标图片已存在,即将发送图片!')
+ return f'[CQ:image,file=file:///{os.path.abspath(img_path)}]'
\ No newline at end of file
diff --git a/uma_target/target.png b/uma_target/target.png
new file mode 100644
index 0000000..5a5150c
Binary files /dev/null and b/uma_target/target.png differ
diff --git a/uma_target/title.png b/uma_target/title.png
new file mode 100644
index 0000000..d8c5d20
Binary files /dev/null and b/uma_target/title.png differ