更新战地六模板大小位置,最佳兵种部分调整
This commit is contained in:
parent
9ee37493fe
commit
bd4dfc2665
@ -136,7 +136,7 @@ async def handle_function(event: Event, matcher: Matcher, msg: Message = Command
|
||||
score = sum(item.get("score", 0) for item in play_stat['classes'])
|
||||
# 计算4兵种游玩时长
|
||||
seconds = sum(item.get("secondsPlayed", 0) for item in play_stat['classes'])
|
||||
kpm = round(kills / (int(seconds) / 60), 1)
|
||||
kpm = round(kills / (int(seconds) / 60), 2)
|
||||
logger.info(f"击杀数:{kills},游玩分钟数:{seconds / 60},计算kpm值:{kpm}")
|
||||
spm = int(score / (int(seconds) / 60))
|
||||
logger.info(f"计算spm值:{spm}")
|
||||
|
||||
@ -30,7 +30,6 @@ font_XS = ImageFont.truetype(f"{filepath}/font/bf-sub-headline-bold 等宽数字
|
||||
font_XXS = ImageFont.truetype(f"{filepath}/font/bf-sub-headline-bold 等宽数字.ttf", 18)
|
||||
font_XXXS = ImageFont.truetype(f"{filepath}/font/bf-sub-headline-bold 等宽数字.ttf", 16)
|
||||
|
||||
|
||||
font_XXL_CH = ImageFont.truetype(f"{filepath}/font/演示创黑FLY.ttf", 72)
|
||||
font_XL_CH = ImageFont.truetype(f"{filepath}/font/演示创黑FLY.ttf", 64)
|
||||
font_L_CH = ImageFont.truetype(f"{filepath}/font/演示创黑FLY.ttf", 48)
|
||||
@ -158,14 +157,16 @@ async def build_stats_card(game="bfv", player="Player001", pid=1145141919, kd=1.
|
||||
|
||||
# 最佳兵种
|
||||
|
||||
draw_centered_text(draw=draw, text=classes[best_class], x_left=140, x_right=310, y=1290, font=font_L_CH, fill="white")
|
||||
draw_centered_text(draw=draw, text=classes[best_class], x_left=140, x_right=310, y=1290, font=font_L_CH,
|
||||
fill="white")
|
||||
|
||||
# 最远击杀
|
||||
draw_centered_text(draw=draw, text=f"{longest_head_shot}m", x_left=455, x_right=625, y=1290, font=font_L_CH,
|
||||
fill="white")
|
||||
|
||||
# 最高连杀
|
||||
draw_centered_text(draw=draw, text=highest_ill_streak, x_left=765, x_right=935, y=1290, font=font_L_CH, fill="white")
|
||||
draw_centered_text(draw=draw, text=highest_ill_streak, x_left=765, x_right=935, y=1290, font=font_L_CH,
|
||||
fill="white")
|
||||
|
||||
# 最佳⭐
|
||||
pil_img = build_best(draw, pil_img, best_weapon, best_vehicle, game)
|
||||
@ -247,7 +248,7 @@ async def build_bf6_stats_card(game="bfv",
|
||||
|
||||
# 玩家信息 105+160
|
||||
draw.text((265, 80), f"{player}", fill="white", font=font_XL)
|
||||
draw.text((265, 140), f"{pid}", fill="#CCCCCC", font=font_L)
|
||||
draw.text((265, 140), f"UID: {pid}", fill="#CCCCCC", font=font_L)
|
||||
|
||||
# 等级
|
||||
pil_img = paste_rank_icon(int(rank), pil_img)
|
||||
@ -257,7 +258,7 @@ async def build_bf6_stats_card(game="bfv",
|
||||
# draw.text((740, 212), f"{rank}", fill="white", font=font_M)
|
||||
|
||||
# 游玩时长
|
||||
draw.text((2300, 350), f"{time_play}H", fill="white", font=font_L)
|
||||
draw.text((2300, 350), f"{time_play:.1f} H", fill="white", font=font_L)
|
||||
# 场次
|
||||
draw.text((2300, 450), f"{wins + loses}", fill="white", font=font_L)
|
||||
# draw_centered_text(draw=draw, text=(wins + loses), x_left=45, x_right=265, y=350,
|
||||
@ -287,31 +288,30 @@ async def build_bf6_stats_card(game="bfv",
|
||||
draw_centered_text(draw=draw, text=f"{round(float(head_shots), 1)}%", x_left=1210, x_right=1303, y=458, font=font_M,
|
||||
fill="white")
|
||||
# kd
|
||||
# draw.text(text=kd, xy=(1350, 355), font=font_XL, fill="white")
|
||||
draw_centered_text(draw=draw, text=kd, x_left=1350, x_right=1500, y=355, font=font_XL, fill="white")
|
||||
draw.text((1350, 355), text=str(kd), fill="white", font=font_XXL)
|
||||
# kpm
|
||||
draw_centered_text(draw=draw, text=round(kpm, 1), x_left=1610, x_right=1760, y=355, font=font_XL, fill="white")
|
||||
draw.text((1610, 355), text=f"{kpm:.2f}", fill="white", font=font_XXL)
|
||||
# spm
|
||||
draw_centered_text(draw=draw, text=round(spm, 1), x_left=1870, x_right=2010, y=355, font=font_XL, fill="white")
|
||||
draw.text((1870, 355), text=f"{int(spm)}", fill="white", font=font_XXL)
|
||||
|
||||
# 击杀
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 10), x_left=1165, x_right=1455, y=805,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#444445")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(kills)), x_left=1165, x_right=1455, y=805,
|
||||
font=font_L, fill="white")
|
||||
|
||||
# 急救
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 10), x_left=1165, x_right=1455, y=1080,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#444445")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(revives)), x_left=1165, x_right=1455, y=1080,
|
||||
font=font_L, fill="white")
|
||||
|
||||
# 摧毁
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 10), x_left=1165, x_right=1455, y=1350,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#444445")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(destroyed)), x_left=1165, x_right=1455, y=1350,
|
||||
font=font_L, fill="white")
|
||||
|
||||
@ -319,28 +319,28 @@ async def build_bf6_stats_card(game="bfv",
|
||||
# 占领
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 10), x_left=1485, x_right=1780, y=745,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#444445")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(captured)), x_left=1485, x_right=1780, y=745,
|
||||
font=font_L, fill="white")
|
||||
|
||||
# 得分
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 10), x_left=1485, x_right=1780, y=955,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#444445")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(score)), x_left=1485, x_right=1780, y=955,
|
||||
font=font_L, fill="white")
|
||||
|
||||
# 助攻
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 10), x_left=1485, x_right=1780, y=1160,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#444445")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(kill_assists)), x_left=1485, x_right=1780, y=1160,
|
||||
font=font_L, fill="white")
|
||||
|
||||
# 修理
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 10), x_left=1485, x_right=1780, y=1370,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#444445")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(repairs)), x_left=1485, x_right=1780, y=1370,
|
||||
font=font_L, fill="white")
|
||||
|
||||
@ -430,7 +430,7 @@ def build_best_bf6(draw: ImageDraw, img: Image, weapons, vehicle, classes, game:
|
||||
# draw_centered_text(draw=draw, text=bf_item[game][weapon_name].upper(), x_left=1240, x_right=1750, y=1355,
|
||||
# font=font_MS, fill="white")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 7), x_left=95, x_right=313, y=665, font=font_L,
|
||||
fill="#333333")
|
||||
fill="#313131")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(w_kills)), x_left=95, x_right=313, y=665,
|
||||
font=font_L, fill="white")
|
||||
draw_centered_text(draw=draw, text=w_kpm, x_left=335, x_right=447, y=665, font=font_L, fill="white")
|
||||
@ -440,15 +440,15 @@ def build_best_bf6(draw: ImageDraw, img: Image, weapons, vehicle, classes, game:
|
||||
# 载具
|
||||
# draw_centered_text(draw=draw, text=bf_item[game][vehicle_name].upper(), x_left=1990, x_right=2440, y=1355,
|
||||
# font=font_MS, fill="white")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 7), x_left=95, x_right=313, y=1087,
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 7), x_left=125, x_right=325, y=1087,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(v_kills)), x_left=95, x_right=313, y=1087,
|
||||
fill="#313131")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas(str(v_kills)), x_left=125, x_right=325, y=1087,
|
||||
font=font_L, fill="white")
|
||||
draw_centered_text(draw=draw, text=v_kpm, x_left=351, x_right=463, y=1087, font=font_L, fill="white")
|
||||
draw_right_aligned_text(draw=draw, text=add_commas_with_padding("0", 7), x_left=477, x_right=688, y=1087,
|
||||
font=font_L,
|
||||
fill="#333333")
|
||||
fill="#313131")
|
||||
draw_right_aligned_text(draw=draw, text=destroyed, x_left=477, x_right=688, y=1087, font=font_L, fill="white")
|
||||
|
||||
# 图片
|
||||
@ -458,13 +458,13 @@ def build_best_bf6(draw: ImageDraw, img: Image, weapons, vehicle, classes, game:
|
||||
wp_icon = get_save_icon(game, weapon_name, "weapon", weapon_url)
|
||||
vc_icon = get_save_icon(game, vehicle_name, "vehicles", vehicle_url)
|
||||
classes_icon = get_icon_from_cache(classes, 'bf6', 'classes')
|
||||
wp_icon_new = png_resize(wp_icon, new_width=725 - 88)
|
||||
vc_icon_new = png_resize(vc_icon, new_width=725 - 88)
|
||||
classes_icon_new = png_resize(classes_icon, new_height=1072 - 325)
|
||||
wp_icon_new = png_resize(wp_icon, new_width=729 - 88)
|
||||
vc_icon_new = png_resize(vc_icon, new_width=729 - 88)
|
||||
classes_icon_new = png_resize(classes_icon, new_height=1165 - 326, new_width=1100 - 748)
|
||||
|
||||
img = image_paste(wp_icon_new, img, (88, 325))
|
||||
img = image_paste(vc_icon_new, img, (88, 750))
|
||||
img = image_paste(classes_icon_new, img, (753, 325))
|
||||
img = image_paste(vc_icon_new, img, (88, 746))
|
||||
img = image_paste(classes_icon_new, img, (748, 326))
|
||||
|
||||
return img
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user