战绩图片新样式(开发中)

This commit is contained in:
ccc_dw 2023-11-03 10:28:27 +08:00
parent 2d29cdede7
commit 50db6acbf3
6 changed files with 6222 additions and 28 deletions

141
.gitignore vendored Normal file
View File

@ -0,0 +1,141 @@
/.idea/.gitignore
/hexi/data/cache/nonebot_plugin_chatrecorder/images/0b046fef26a1afb031d2ec5a1d530eb3.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/0c86682f87619be8eb9ba4ffe18c5126.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/1aae2513b28f0c544945782379a5daa2.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/1be0a06417247ba9f83e4749c03892ba.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/1cbd5ad06ee3b988e1472855d3ac3757.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/1e01e3386ac1cea4725d251410a5b253.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/1e600a9c96c19bdb6080dbfc46855818.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/2a9584d599054ec7d80646cbfaddc966.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/2fdda4ab30ed8ab416a477eb16ff38b2.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/002e00d772c1da7ff3df03d67db6e4fa.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/3f41a07e31de9b930f7a2bf88c263ae9.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/3f8157304cd842c69e57f558e0248aff.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/4c01cd82ab1d14b033d6c60862385e97.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/4c27966c1c183b4dbfedef1e297bf99d.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/4cec1709769dd6012a745beccfa2a491.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/4edc568ece2856c14973dd185f6548c8.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/5b3c6c864ce75f3c4d1bddc97a0f6873.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/5e02b8b4a6faea447ea039e8c79c6f9f.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/05c1ff2fa9b4c596d1c31bb64413647b.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/6d7432d4f473df6b318f9b4aad8aa29a.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/6e07bec0218994d1bbf5393d1e088072.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/6f5f5956a3d27837ab03f66f19d474cf.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/6f145098abc5431dbc32565cda9c602a.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/7b19f3c8dc042ffe315ea1581fe86f96.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/8f9259a10f7013b31f6f70407587d7b4.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/9edf00e36195393e8daa34d8143dc542.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/9f7fdfd5c718546f1a481022e02b3e55.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/9fe20b99a834893f55af429aed348dde.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/14dc728572b04ea0421a6c1f2fa19cbd.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/16d522040849d7a58c1a9582a24f8b5c.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/19be43d72ee2e738f3b3ad9a7c46523b.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/24a92a52f5415318e97641fa71f2da68.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/26c572bdc424fb515873aa7bc5c27670.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/47da864896f5055c502d69fb0e02a3b1.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/51f987b75f6840392f9193735c129d90.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/53bef6ebf7eefec552abe3debda502bd.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/64b15d42d6fbe2963d5af2396c2b0f2b.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/66ef6f322030eabc98f3580d36885cc2.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/68f1995950126918825f56ee4efb1126.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/69fa5bc0467ce9e8f070ecb8d082e5bb.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/72edf92fc2e22db8ce33b44e183e36f3.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/73f4381cb0ae30baedf2b3dcb52a4681.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/80ded50d064d5eb837f2076cde2ddd86.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/81dab2d175d8bcfd14cadc3d1c6aed37.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/96e8bda8856db4224faaff1920211f60.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/96f0922f03933305aa4977df7d720a0e.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/97cc3e0ae952e5832ef9ec35ab501fc0.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/98a0b1e88f2b6d15046a54564945c724.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/175d8150a4e2656c4d56ce3ffc57abba.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/225c3e05e00db34c022dbdd7772374ec.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/246a46c02b9653a7dae25fe0b8c55e66.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/275ffdf5bfcce974fa12b03da6aa73a2.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/451fd52a5a6abac25621c08a8ed37a5d.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/568b7d6274aed7036b4976891c25a428.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/590e6c855bc8d16c84752f6b9d90f838.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/661a115850430a3961ccfabc1801026c.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/693edbe30255d0440cd5d13d29822cf1.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/758e2537b637e9735fee3ab5cad976f6.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/788c0d77f884ceb635b0888cd4c32cbf.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/793a61bc46a7b4779d33ce072e143949.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/812ffe4c0e893ae4b71f7dcf5ac1d600.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/877ac81a5de51e082d0fe0f75190032b.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/893a2d31a250cb2180eff9ea6758f1fa.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/3817a85ff0b61f57367048860b7709c9.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/3992bc555977fc7748a99fdd52960ce8.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/5388d81aba006e9f378ecb7b7337f413.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/5740a8bdb8636d75ee7fa05a619f5398.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/5811ddee71dd8bd3971662e05af156fe.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/6897c706b23b2fb58d695c0a451fcdb0.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/8652d16b55677ef5772a17ed63b8c614.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/8915e4a541355dedb40f44bf4b50a7b7.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/90107d04bd9d4fecfcbbac230a6b0df9.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/96088a11b0a28575a4f28e7bea69b499.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/97208f58b30cb308e9c3cb422fb3d22e.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/502087c37002227997fed74f8ff92e31.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/573554b8881c28d07eeab24ce912d5a1.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/886213e74738481f60e184d3d57ec64f.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/892202c9491f76790072ba1f364ec09b.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/34510779e6ce5f55853dd063ee6af6a2.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/73678600a4f7c121b102180cbee868aa.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/96837078f809a33c8f64f6e7b15e711e.cache
/hexi/plugins/dailywife/config/615526714.json
/hexi/plugins/dailywife/config/689722301.json
/hexi/plugins/dailywife/config/697997949.json
/hexi/data/cache/nonebot_plugin_chatrecorder/images/8443086078926d9ab0d00a676448ea73.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/56422241328570c49cbe70584635a47e.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/a0eeef7adf5c5e04e1cb994e289661b2.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/a9a88464330e5a6d4a84769af34db5b8.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/a63d3b9633dc19d0d1766596cf686f2f.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/a185a2b3caddb7b79334432362b49f71.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/a301d14e12683e62612560689a39fa98.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/a420a0389444ceff22443c276d1d7514.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/a597f0bf704d65477457fcdc94082d44.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/ac7dbbaac61e8a482ce486bb1d7db65d.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/afb497b92eeba0abb9b014bc16bf9068.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/b20f12a1be0692dbafa28eb605f51bb8.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/b72abe9bface4652bf72327e75ce6151.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/ba36f26bc78cff6e158ff09bcb7e891b.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/ba7996d5717bc5c62ff3503d6bc11da8.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/bbae8226dce98b4d067db335ec0e8fd3.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/bf8a66df42351752d69bbbdfe53f1818.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/c0c291b2dcceaef80b28fcdd453eb1fb.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/c5d987bd1e92217cd2397521c11a9944.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/caf5e74d57d31eded7e5ea5ead151eef.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/cd9ca37584884d48717f6b19df70a274.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/cdd4356b344af0d1d9c19b3debe900e9.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/ce5bba5209492127a73942feb6f5c447.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/d4dc3a8b843c01d98460087fd181d1b4.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/d8f7ac7708701d26b43b8f76c6b8ab2e.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/d68f6178df29a6263802a189dbceea1b.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/d70d9dd2d7c39080b90196aa32304f33.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/d56521d843f953556202286bd382bc41.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/d0770191da28c85e7f0a9e8865a60dc1.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/da212dd092b145b93ae42b0e092026e9.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/da327134ab01e12edf67f74486809688.cache
/hexi/data/data.db
/hexi/data/cache/nonebot_plugin_chatrecorder/images/df0c050ef30872fa5fa89399e039bb2f.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/e0b4a874f674ca04038f7917afa1dfda.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/e6ec73e98d331c04699592f0a39e4e69.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/e9b94e0e00816c731b26d281cd710e22.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/e096c0bd49169f24671a7063e4dc030f.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/e199a65ddce4246d480792d302409d69.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/ea8767006c763d76bff11d514c2e52ae.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/ee0db4c4a89bc3cfacc601037921a7a5.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/eebaade744586ee22c2f7022dfcf2977.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/f0c4fc8436a2e9be38be46976f8ae619.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/f1ca899d7ad70cba2c225e29bdf1fffb.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/f3dfc34c04e82360906a264d989e8348.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/f05673c777a3226a5e19dc6d2cc6b858.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/f6676e7e2fe59c8d30476a53a1f20a81.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/fbbd42391cfb5629de7b32a49b5f64e1.cache
/hexi/data/cache/nonebot_plugin_chatrecorder/images/fe55526f5178e19cbb35e0287d4b15c9.cache
/.idea/HEXI.iml
/.idea/misc.xml
/.idea/modules.xml
/.idea/inspectionProfiles/profiles_settings.xml
/.idea/inspectionProfiles/Project_Default.xml
/hexi/plugins/dailywife/config/test.json
/hexi/plugins/user.db
/.idea/vcs.xml

View File

@ -0,0 +1,53 @@
class PlayerStats:
def __init__(self, data):
self.userId = data["userId"] # 用户ID
self.avatar = data["avatar"] # 用户头像URL
self.userName = data["userName"] # 用户名
self.id = data["id"] # ID
self.bestClass = data["bestClass"] # 最佳职业
self.humanPrecentage = data["humanPrecentage"] # 人类百分比
self.kills = data["kills"] # 击杀数
self.deaths = data["deaths"] # 死亡数
self.wins = data["wins"] # 胜利数
self.loses = data["loses"] # 失败数
self.killsPerMinute = data["killsPerMinute"] # 每分钟击杀数
self.damagePerMinute = data["damagePerMinute"] # 每分钟伤害
self.killsPerMatch = data["killsPerMatch"] # 每场比赛平均击杀数
self.damagePerMatch = data["damagePerMatch"] # 每场比赛平均伤害
self.headShots = data["headShots"] # 爆头击杀数
self.winPercent = data["winPercent"] # 胜率
self.headshots = data["headshots"] # 爆头比例
self.killDeath = data["killDeath"] # 击杀/死亡比率
self.infantryKillDeath = data["infantryKillDeath"] # 步兵击杀/死亡比率
self.damage = data["damage"] # 造成的总伤害
self.timePlayed = data["timePlayed"] # 游戏时间
self.accuracy = data["accuracy"] # 命中率
self.revives = data["revives"] # 复活队友次数
self.heals = data["heals"] # 治疗队友次数
self.resupplies = data["resupplies"] # 补给队友次数
self.repairs = data["repairs"] # 修复工具使用次数
self.squadmateRevive = data["squadmateRevive"] # 复活队友次数
self.squadmateRespawn = data["squadmateRespawn"] # 尝试复活但失败的次数
self.thrownThrowables = data["thrownThrowables"] # 扔出的可投掷物数量
self.gadgetsDestoyed = data["gadgetsDestoyed"] # 摧毁敌方设备数量
self.callIns = data["callIns"] # 呼叫支援次数
self.playerTakeDowns = data["playerTakeDowns"] # 击倒敌方玩家数
self.matchesPlayed = data["matchesPlayed"] # 游戏场次
self.secondsPlayed = data["secondsPlayed"] # 游戏时间(秒)
self.bestSquad = data["bestSquad"] # 最佳小队排名
self.teammatesSupported = data["teammatesSupported"] # 支持的队友数
self.saviorKills = data["saviorKills"] # 挽救友军次数
self.shotsFired = data["shotsFired"] # 开火次数
self.shotsHit = data["shotsHit"] # 命中次数
self.killAssists = data["killAssists"] # 协助击杀数
self.vehiclesDestroyed = data["vehiclesDestroyed"] # 摧毁的敌方载具数
self.enemiesSpotted = data["enemiesSpotted"] # 发现敌人次数
self.mvp = data["mvp"] # MVP 次数
self.weapons = sorted(data["weapons"], key=lambda k: k['kills'], reverse=True) # 武器列表 按击杀倒序排列
self.vehicles = sorted(data["vehicles"], key=lambda k: k['kills'], reverse=True) # 载具列表 按击杀倒序排列
self.weaponGroups = data["weaponGroups"] # 武器组
self.vehicleGroups = data["vehicleGroups"] # 载具组
self.classes = sorted(data["classes"], key=lambda k: k['kills'], reverse=True) # 专家列表 按击杀倒序排列
self.gamemodes = sorted(data["gamemodes"], key=lambda k: k['secondsPlayed'], reverse=True) # 游戏模式列表 按时长倒序排列
self.maps = sorted(data["maps"], key=lambda k: k['secondsPlayed'], reverse=True) # 地图列表 按时长倒序排列
self.gadgets = sorted(data["gadgets"], key=lambda k: k['secondsPlayed'], reverse=True) # 小工具/配备 列表

View File

@ -3,8 +3,8 @@ from nonebot.adapters.onebot.v11 import MessageEvent, MessageSegment
from nonebot.plugin import PluginMetadata
from nonebot.typing import T_State
from .bf2042 import bf_2042_gen_pic
from .data import query_data
from .picture_builder import builder
from .data import query_data, get_img
from ..core.message_handle import MessageState
__plugin_meta__ = PluginMetadata(
@ -24,24 +24,20 @@ async def handle_status(event: MessageEvent, state: T_State):
m_state = MessageState(state)
cmd = m_state.get_command()
msg = m_state.get_command_arg()
a = {".盒": 0,
".武器": 1,
".配备": 3,
".专家": 4,
".载具": 5
}
if msg is None:
await status.send("消息是空的喵")
else:
msg_info = (MessageSegment.text(f"消息是{msg.text}"))
await status.send(msg_info)
print(state)
print(m_state)
cmd = cmd[0]
property = {".盒": "0",
".武器": "weapons",
".配备": "gadgets",
".专家": "classes",
".载具": "vehicles"
}
msg_info = (MessageSegment.text(f"正在查询 {msg.text}{cmd.replace('.', '')} 数据,请耐心等待"))
await status.send(msg_info)
img_mes = await get_img(property[cmd])
message_id = event.message_id
# img_mes = await query_data(player, "pc", query_type)
# if img_mes[0]:
# res = MessageSegment.image(img_mes[1])
# else:
# res = MessageSegment.text(img_mes[1])
# msg_gen = (MessageSegment.reply(message_id), res)
if img_mes[0]:
res = MessageSegment.image(img_mes[1])
else:
res = MessageSegment.text(img_mes[1])
msg_gen = (MessageSegment.reply(message_id), res)
await status.finish(msg_gen)

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,66 @@
import base64
import os
import random
from decimal import Decimal
from io import BytesIO
from PIL import Image, ImageDraw, ImageFont
from .picture_tools import draw_rect, circle_corner, png_resize, \
get_top_object_img, \
image_paste, paste_ic_logo, get_avatar, get_special_icon, draw_point_line\
from .PlayDataClass import PlayerStats
filepath = os.path.dirname(__file__).replace("\\", "/")
async def builder(data, platform, property):
# 1. 构建纯黑画板 1920*1080
data_image = Image.new('RGBA', (1920, 1080), (0, 0, 0, 1000))
draw = ImageDraw.Draw(data_image)
# 2. 载入字体
ch_text_font4 = ImageFont.truetype(filepath + '/font/NotoSansSCMedium-4.ttf', 32)
en_text_font4 = ImageFont.truetype(filepath + '/font/BF_Modernista-Bold.ttf', 32)
ch_text_font_5 = ImageFont.truetype(filepath + '/font/NotoSansSCMedium-4.ttf', 24)
# 3. 获取各个类别的数据
we = PlayerStats(data)
weapon_list = we.weapons
weapon_list = sorted(data[property], key=lambda k: k['kills'], reverse=True)
vehicle_list = sorted(data[property], key=lambda k: k['kills'], reverse=True)
class_list = sorted(data[property], key=lambda k: k['kills'], reverse=True)
# 4. 绘制武器板块
height = 170
line_height = 515
for i in range(0, 5):
# 粘贴武器图片
data_image = image_paste(get_top_object_img(weapon_list[i]).resize((160, 80)), data_image, (50, height + 5))
# 绘制竖线
draw.line([290, height - 5, 290, height+130], fill="white", width=3, joint=None)
# 获取文字的宽度
weapon_name = weapon_list[i]["weaponName"]
width = draw.textlength(weapon_name, en_text_font4) # 获取长度
# 绘制武器名称
draw.text((200-width, height+90), f'{weapon_name}', fill="white", direction="rtl", font=en_text_font4)
# 绘制武器数据
draw.text((300, height), f'击杀数:{weapon_list[i]["kills"]}', fill="white", font=ch_text_font_5)
draw.text((300, height + 35), f'爆头率:{weapon_list[i]["headshots"]}', fill="white", font=ch_text_font_5)
draw.text((300, height + 70), f'命中率:{weapon_list[i]["accuracy"]}', fill="white", font=ch_text_font_5)
draw.text((300, height + 105), f'KPM{weapon_list[i]["killsPerMinute"]}', fill="white", font=ch_text_font_5)
# 绘制时长边框
data_image = draw_rect(data_image, (210, height+90, 290, height+130), 5, fill=(255, 255, 255, 1000))
# 绘制时长
play_time = f'{int(int(weapon_list[i]["timeEquipped"]) / 3600 + 0.55)}H'
font_width = draw.textlength(play_time, en_text_font4) # 获取长度
draw.text((285-font_width, height+90), play_time,
fill="black",
font=en_text_font4)
height += 180
data_image.show()
b_io = BytesIO()
data_image.save(b_io, format="PNG")
base64_str = 'base64://' + base64.b64encode(b_io.getvalue()).decode()
return base64_str