3
0

更新 2.6 版本资源/功能

This commit is contained in:
xtaodada 2022-04-01 14:00:37 +08:00
parent e32b17c7a5
commit df9ae047e6
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
8 changed files with 59 additions and 28 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -30,7 +30,7 @@ async def weapon_adv(name):
im = ''.join(char_list)
im = im + " 可能会用到【{}".format(weapon_name)
else:
im = " 没有角色能使用【{}".format(weapon_name)
im = " 没有角色能使用【{}".format(weapon_name if weapon_name else name)
return im

View File

@ -96,7 +96,7 @@ async def get_character(name: str):
return f"派蒙这里没找到 <code>{name}</code> ,可能是派蒙的错,可能是你输入的名字不正确哦。", None
else:
return f"派蒙这里没找到 <code>{name}</code> ,你是要搜索 <code>{correct_result[0]}</code> 吗", None
result = f"<b>{nick_name} {'' * int(data['rarity'])}</b>\n" \
result = f"<b>{data['name']} {'' * int(data['rarity'])}</b>\n" \
f"<b>命之座:</b>{data['constellation']}\n" \
f"<b>所属:</b>{data['affiliation']}\n" \
f"<b>突破加成:</b>{data['substat']}\n" \

View File

@ -1,5 +1,4 @@
import time
import datetime
import os
from re import findall
from bs4 import BeautifulSoup
@ -19,7 +18,7 @@ def generate_event():
raw_data = get(
"https://hk4e-api.mihoyo.com/common/hk4e_cn/announcement/api/getAnnList?game=hk4e&game_biz=hk4e_cn&lang=zh-cn"
"&bundle_id=hk4e_cn&platform=pc&region=cn_gf01&level=55&uid=100000000").json()
now_time = datetime.datetime.now().strftime('%Y-%m-%d')
# now_time = datetime.datetime.now().strftime('%Y-%m-%d')
# raw_time_data = get(
# "https://api-takumi.mihoyo.com/event/bbs_activity_calendar/getActList?"
# "time={}&game_biz=ys_cn&page=1&tag_id=0".format(now_time)).json()
@ -42,7 +41,15 @@ def generate_event():
k["time_data"] = time_data
elif value.text == "〓活动时间〓":
time_data = content_bs.find_all("p")[index + 1].text
time_data = time_data.replace("</t>", "")[16:]
if "<t class=" in time_data:
time_datas = []
for s in time_data.split(" ~ "):
if "<t class=" in s:
time_datas.append(findall("<[a-zA-Z]+.*?>([\s\S]*?)</[a-zA-Z]*?>", s)[0])
else:
time_datas.append(s)
k["time_data"] = "——".join(time_datas)
else:
k["time_data"] = time_data
elif value.text == "〓祈愿介绍〓":
start_time = content_bs.find_all("tr")[1].td.find_all("p")[0].text
@ -52,7 +59,7 @@ def generate_event():
content_bs.find_all("tr")[1].td.find_all("p")[2].text)[0]
if "<t class=" in end_time:
end_time = findall("<[a-zA-Z]+.*?>([\s\S]*?)</[a-zA-Z]*?>", end_time)[0]
time_data = start_time + "~" + end_time
time_data = start_time + "——" + end_time
k["time_data"] = time_data
if "冒险助力礼包" in k["title"] or "纪行" in k["title"]:

View File

@ -80,6 +80,7 @@ daily_im = '''
每日委托{}/{} 奖励{}领取
周本减半{}/{}
洞天宝钱{}
参量质变仪{}
探索派遣
总数/完成/上限{}/{}/{}
{}'''
@ -243,11 +244,18 @@ async def daily(mode="push", uid=None):
coin_add_speed = math.ceil((dailydata["max_home_coin"] - dailydata["current_home_coin"]) / (
int(dailydata["home_coin_recovery_time"]) / 60 / 60))
coin += f'{coin_rec_time}{coin_add_speed}/h'
if dailydata["transformer"]["recovery_time"]["reached"]:
transformer_status = "可用"
else:
transformer_time = dailydata["transformer"]["recovery_time"]
transformer_status = "还剩{}{}小时{}分钟可用".format(
transformer_time["Day"], transformer_time["Hour"], transformer_time["Minute"])
expedition_data = "\n".join(expedition_info)
send_mes = daily_im.format(tip, current_resin, max_resin, rec_time, finished_task_num, total_task_num,
is_extra_got, used_resin_discount_num,
resin_discount_num_limit, coin, current_expedition_num,
resin_discount_num_limit, coin, transformer_status,
current_expedition_num,
finished_expedition_num, max_expedition_num, expedition_data)
temp_list.append(
@ -1255,7 +1263,7 @@ async def draw_info_pic(uid: str, message: Message, image=None) -> str:
# 获取背景图片各项参数
based_w = 900
based_h = 1380
based_h = 1480
image_def = CustomizeImage(image, based_w, based_h)
bg_img = image_def.bg_img
bg_color = image_def.bg_color
@ -1289,10 +1297,10 @@ async def draw_info_pic(uid: str, message: Message, image=None) -> str:
bg_img.paste(avatar_bg_color, (113, 98), avatar_bg)
bg_img.paste(avatar_fg, (114, 95), avatar_fg)
info1_color = Image.new("RGBA", (900, 1300), bg_color)
info1_color = Image.new("RGBA", (900, 1400), bg_color)
bg_img.paste(info1_color, (0, 0), info1)
info2_color = Image.new("RGBA", (900, 1300), text_color)
info2_color = Image.new("RGBA", (900, 1400), text_color)
bg_img.paste(info2_color, (0, 0), info2)
bg_img.paste(info3, (0, 0), info3)
@ -1324,8 +1332,10 @@ async def draw_info_pic(uid: str, message: Message, image=None) -> str:
anchor="lm")
# 收入比例
for index, i in enumerate(award_data['data']['month_data']['group_by']):
text_draw.text((681, 445 + index * 32), f"{str(i['num'])}({str(i['percent'])}%)", text_color, genshin_font(21),
group_by = award_data['data']['month_data']['group_by']
group_by.sort(key=lambda x: (-x['action_id']))
for index, i in enumerate(group_by):
text_draw.text((681, 447 + index * 42), f"{str(i['num'])}({str(i['percent'])}%)", text_color, genshin_font(21),
anchor="lm")
# 基本四项
@ -1339,7 +1349,21 @@ async def draw_info_pic(uid: str, message: Message, image=None) -> str:
f"{str(daily_data['resin_discount_num_limit'] - daily_data['remain_resin_discount_num'])}/{daily_data['resin_discount_num_limit']}",
text_color, genshin_font(26), anchor="lm")
# 参量质变仪
if daily_data['transformer']['recovery_time']['reached']:
transformer_status = "已处于可用状态"
text_draw.text((170, 707), f"{transformer_status}", highlight_color, genshin_font(18), anchor="lm")
else:
transformer_time = daily_data['transformer']['recovery_time']
transformer_status = "还剩{}{}小时{}分钟可用".format(transformer_time['Day'], transformer_time['Hour'],
transformer_time['Minute'])
text_draw.text((170, 707), f"{transformer_status}", text_color, genshin_font(18), anchor="lm")
# 树脂恢复时间计算
# 树脂恢复时间计算
if int(daily_data['resin_recovery_time']) <= 0:
text_draw.text((170, 331), f"已全部恢复", text_color, genshin_font(18), anchor="lm")
else:
resin_recovery_time = seconds2hours(
daily_data['resin_recovery_time'])
next_resin_rec_time = seconds2hours(
@ -1353,8 +1377,8 @@ async def draw_info_pic(uid: str, message: Message, image=None) -> str:
# 洞天宝钱时间计算
coin_rec_time = seconds2hours(int(daily_data["home_coin_recovery_time"]))
if daily_data["home_coin_recovery_time"] == "0":
text_draw.text((170, 425), f"", text_color, genshin_font(18), anchor="lm")
if int(daily_data["home_coin_recovery_time"]) <= 0:
text_draw.text((170, 425), f"达到上限", text_color, genshin_font(18), anchor="lm")
else:
coin_add_speed = math.ceil((daily_data["max_home_coin"] - daily_data["current_home_coin"]) / (
int(daily_data["home_coin_recovery_time"]) / 60 / 60))
@ -1412,10 +1436,10 @@ async def draw_info_pic(uid: str, message: Message, image=None) -> str:
remained_timed: str = seconds2hours(i['remained_time'])
charpic_draw.text((200, 65), f"剩余时间 {remained_timed}", text_color, genshin_font(24), anchor="lm")
bg_img.paste(charpic, (-15, 748 + 115 * index), charpic)
bg_img.paste(charpic, (-15, 848 + 115 * index), charpic)
end_pic = Image.open(os.path.join(BG2_PATH, "abyss_3.png"))
bg_img.paste(end_pic, (0, 1340), end_pic)
bg_img.paste(end_pic, (0, 1440), end_pic)
# 转换之后发送
bg_img = bg_img.convert('RGB')